(raw: unknown)
| 291 | ]; |
| 292 | |
| 293 | function parseOAuth(raw: unknown): OAuthTokens { |
| 294 | const obj = asJsonObject(raw, "oauth"); |
| 295 | const accessToken = pickHeaderSafeString(obj, "access_token"); |
| 296 | if (!accessToken) { |
| 297 | throw ErrInvalidStore("oauth.access_token must be a non-empty string with no control chars"); |
| 298 | } |
| 299 | const out: OAuthTokens = { access_token: accessToken }; |
| 300 | assignOptionalStrings(out, obj, OAUTH_OPTIONAL); |
| 301 | const unknownOAuth = collectUnknown(obj, KNOWN_OAUTH_KEYS); |
| 302 | if (unknownOAuth) out[UNKNOWN] = unknownOAuth; |
| 303 | return out; |
| 304 | } |
| 305 | |
| 306 | const USER_OPTIONAL: readonly [string, FieldPicker][] = [ |
| 307 | ["email", "non_empty"], |
no test coverage detected