(bearer: string)
| 53 | |
| 54 | /** The org the bearer is scoped to, read from the JWT's public claims. */ |
| 55 | const orgIdOf = (bearer: string): string => { |
| 56 | const claims = JSON.parse(Buffer.from(bearer.split(".")[1] ?? "", "base64url").toString()) as { |
| 57 | readonly org_id?: string; |
| 58 | }; |
| 59 | if (!claims.org_id) throw new Error("orgIdOf: bearer carries no org_id claim"); |
| 60 | return claims.org_id; |
| 61 | }; |
| 62 | |
| 63 | const mcpPost = ( |
| 64 | url: string | URL, |
no test coverage detected