* Strict variant: returns the string when present and non-empty, * `undefined` when the key is absent or null, and throws when the * field is present-but-invalid (wrong type or empty string).
( obj: Record<string, unknown>, key: string, errorLabel: string, )
| 399 | * field is present-but-invalid (wrong type or empty string). |
| 400 | */ |
| 401 | function pickRequiredStringOrAbsent( |
| 402 | obj: Record<string, unknown>, |
| 403 | key: string, |
| 404 | errorLabel: string, |
| 405 | ): string | undefined { |
| 406 | const v = obj[key]; |
| 407 | if (v === undefined || v === null) return undefined; |
| 408 | if (typeof v !== "string" || v.length === 0) { |
| 409 | throw ErrInvalidStore(`${errorLabel} must be a non-empty string`); |
| 410 | } |
| 411 | return v; |
| 412 | } |
| 413 | |
| 414 | function serializeCredentials(c: Credentials): Record<string, unknown> { |
| 415 | // Re-emit unrecognized top-level keys first so the known fields below |
no test coverage detected