(m: DynamicClientMetadata)
| 437 | const decodeDcrErrorBodyJson = Schema.decodeUnknownOption(Schema.fromJsonString(DcrErrorBodyJson)); |
| 438 | |
| 439 | const buildDcrBody = (m: DynamicClientMetadata): Record<string, unknown> => { |
| 440 | const body: Record<string, unknown> = { redirect_uris: [...m.redirect_uris] }; |
| 441 | if (m.client_name !== undefined) body.client_name = m.client_name; |
| 442 | if (m.grant_types !== undefined) body.grant_types = [...m.grant_types]; |
| 443 | if (m.response_types !== undefined) body.response_types = [...m.response_types]; |
| 444 | if (m.token_endpoint_auth_method !== undefined) { |
| 445 | body.token_endpoint_auth_method = m.token_endpoint_auth_method; |
| 446 | } |
| 447 | if (m.scope !== undefined) body.scope = m.scope; |
| 448 | if (m.application_type !== undefined) body.application_type = m.application_type; |
| 449 | if (m.client_uri !== undefined) body.client_uri = m.client_uri; |
| 450 | if (m.logo_uri !== undefined) body.logo_uri = m.logo_uri; |
| 451 | if (m.contacts !== undefined) body.contacts = [...m.contacts]; |
| 452 | if (m.software_id !== undefined) body.software_id = m.software_id; |
| 453 | if (m.software_version !== undefined) body.software_version = m.software_version; |
| 454 | if (m.extra) for (const [k, v] of Object.entries(m.extra)) body[k] = v; |
| 455 | return body; |
| 456 | }; |
| 457 | |
| 458 | const interpretDcrFailure = (status: number, text: string): DcrErrorBody | DcrTransport => { |
| 459 | // RFC 6749 error envelope: `{error, error_description?}` with 4xx. |
no outgoing calls
no test coverage detected