MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / orgIdOf

Function orgIdOf

e2e/cloud/billing-customer-provisioning.test.ts:34–40  ·  view source on GitHub ↗
(bearer: string)

Source from the content-addressed store, hash-verified

32/** The org the bearer is scoped to — the Autumn customer id every billing call
33 * is made against — read from the JWT's public claims. */
34const orgIdOf = (bearer: string): string => {
35 const claims = JSON.parse(Buffer.from(bearer.split(".")[1] ?? "", "base64url").toString()) as {
36 readonly org_id?: string;
37 };
38 if (!claims.org_id) throw new Error("orgIdOf: bearer carries no org_id claim");
39 return claims.org_id;
40};
41
42/** A 404 `customer_not_found`, byte-for-byte the shape Autumn answers with for
43 * an organization it has no customer record for. */

Calls 1

toStringMethod · 0.80

Tested by

no test coverage detected