@vantageos/cloud-identity 0.12.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,119 @@
3
3
  All notable changes to `@vantageos/cloud-identity` are documented here.
4
4
  This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5
5
 
6
+ ## [Unreleased]
7
+
8
+ ### Fixed
9
+
10
+ - `verifyMcpAccessToken` now validates `audience` as an absolute URL with no
11
+ fragment (RFC 8707 section 2), with the same validator as the `resource` of
12
+ `buildProtectedResourceMetadata`. A whitespace-only, non-URL or
13
+ fragment-bearing audience throws the config error instead of being accepted.
14
+
15
+ ## [0.15.0]
16
+
17
+ **Additive: resource-server primitives (`./resource-server`).** No existing
18
+ function changes behaviour for an existing input. This is the identity layer an
19
+ MCP server needs as an OAuth 2.1 protected resource, so a separate
20
+ resource-server package is no longer needed.
21
+
22
+ ### Added
23
+
24
+ - `buildProtectedResourceMetadata(config)`: the RFC 9728 document served at
25
+ `/.well-known/oauth-protected-resource` (`resource`, `authorization_servers`,
26
+ `bearer_methods_supported`, optional `scopes_supported`, `resource_name`,
27
+ `resource_documentation`). Throws on a relative or fragment-bearing resource,
28
+ an empty or relative authorization server list, or empty bearer methods.
29
+ - `unauthorizedChallenge(config)`: the `401` status and a `WWW-Authenticate:
30
+ Bearer` value that always carries `resource_metadata` (RFC 9728 section 5.1),
31
+ with optional `error`, `error_description` and `scope` (RFC 6750). Values are
32
+ quoted and escaped; a line break throws.
33
+ - `deriveClerkDiscoveryUrls(issuer)`: the OIDC discovery and JWKS URLs of an
34
+ `https` issuer.
35
+ - `verifyMcpAccessToken(authorization, config, nowMs?)`: reads the `Authorization`
36
+ header and verifies the token for this resource by delegating to
37
+ `verifyClerkSessionToken` (RS256 only; signature, `iss`, `aud`, `exp`, `nbf`),
38
+ with the audience mandatory. Returns the verified session, or a typed
39
+ `CREDENTIAL_REFUSED` refusal with the `401` envelope (`bearer-missing` and
40
+ `bearer-malformed` answer `invalid_request`; `token-invalid` answers
41
+ `invalid_token`), or `503` with no challenge when the key set is unreachable
42
+ (`jwks-unavailable`). A missing issuer or audience throws.
43
+ - Types `ProtectedResourceMetadataConfig`, `ProtectedResourceMetadata`,
44
+ `UnauthorizedChallengeConfig`, `UnauthorizedChallenge`, `ClerkDiscoveryUrls`,
45
+ `McpResourceServerConfig`, `VerifyMcpAccessTokenResult`.
46
+ - `IdentityRefusalReason` gains `bearer-missing`, `bearer-malformed`,
47
+ `token-invalid`, `jwks-unavailable`.
48
+
49
+ ## [0.14.0]
50
+
51
+ **Additive: who may address whom, which rows a caller may see, and a caller's
52
+ standing, decided by agent ID only (`./principal-by-id`).** No existing function changes behaviour for an existing
53
+ input.
54
+
55
+ ### Added
56
+
57
+ - `assertRecipientAddressable(sender, recipient, lookups, { door? })` (CI-2):
58
+ decides, by agent ID only, whether a sender may address a recipient,
59
+ across organisations included. Admits same organisation; client to operator
60
+ when the recipient's ID is on the sender organisation's roster; operator to
61
+ client when the sender's ID is on the recipient organisation's roster.
62
+ `lookups` is `{ orgKindOf, rosterOf }`. Everything else refuses with a typed
63
+ `RBAC_DENIED` naming the door: client to client, a missing sender or
64
+ recipient, a sender that is not an agent, an unresolvable roster. The roster
65
+ check reuses `assertPrincipalListed`. Types `RecipientIds`,
66
+ `RecipientLookups`, `AssertRecipientAddressableOptions`,
67
+ `AssertRecipientAddressableResult`.
68
+ - `resolveCallerStanding(credential, lookups, { adminRoles, door? })` (CI-4):
69
+ names a caller's standing as `anonymous` (with the typed refusal), `pre-org`
70
+ (a verified session with no organisation, via the new
71
+ `{ kind: "person-no-org", personId }` credential), `member`, `admin` or
72
+ `fleet`. Built on `resolveActingPrincipal` and `assertOrgAdmin`; the only
73
+ case the existing primitives could not say was `pre-org`, which they refuse
74
+ like a garbled credential. Types `CallerCredential`,
75
+ `AssertCallerStandingOptions`, `CallerStanding`.
76
+ - `filterTargetsBelongingTo(principal, rows, lookups, opts?)` (CI-3): the
77
+ ID-keyed row filter that replaces the name-keyed `scopeFilterList`. Async;
78
+ returns `{ ok: true, rows }` or `{ ok: false, refusal }`. Each row is kept
79
+ exactly when `assertTargetBelongsTo` admits it (same `lookups` and options,
80
+ including `door`, `ownerOnly`, `fleetCrossOrg`); that function is reused, not
81
+ re-derived. The principal is proved first: an absent or unresolved principal
82
+ is a refusal naming the door, even for an empty list, never an empty
83
+ success. A resolved principal whose rows all belong elsewhere gets
84
+ `{ ok: true, rows: [] }`. Rows of other organisations, unstamped rows and a
85
+ same-NAME row of another organisation are dropped. A lookup failure on any
86
+ row refuses the whole call, never a silent drop. `fleetCrossOrg: true` from a
87
+ principal that is not `kind: "fleet"` is refused `reserved-fleet-scope` for
88
+ any list. Input order is kept. Type
89
+ `FilterTargetsResult`.
90
+
91
+ ### Deprecated
92
+
93
+ - `scopeFilterList`, `scopeFilterGet`, `passesScopeFilter` and the name-keyed
94
+ `OAuthCtx.fromAllowList` field now point to `filterTargetsBelongingTo` in
95
+ their TSDoc. Behaviour is unchanged; they are removed when the consumer
96
+ migrates.
97
+
98
+ ## [0.13.0]
99
+
100
+ **Additive: admission by membership of a stored list, by agent ID only
101
+ (`./principal-by-id`).** A client roster used to be checked by comparing names.
102
+ `assertPrincipalListed` is the single primitive that replaces it: the caller's
103
+ agent ID must be byte-equal to an entry of a stored ID list. No existing
104
+ function changes behaviour for an existing input.
105
+
106
+ ### Added
107
+
108
+ - `assertPrincipalListed(principal, list, { door? })`: synchronous, returns
109
+ `{ ok: true }` or a typed `RBAC_DENIED` refusal naming the door. Refused by
110
+ default: an absent principal or one without an ID, a principal that is not
111
+ `kind: "agent"`, an absent list, a list without an organisation or stored
112
+ under another organisation, an empty or malformed `principalIds`, and an ID
113
+ not on the list. A name never matches and `"*"` is not a wildcard.
114
+ - Types `PrincipalIdList`, `AssertPrincipalListedOptions`,
115
+ `AssertPrincipalListedResult`.
116
+ - New `IdentityRefusalReason` values: `list-absent`, `list-empty`,
117
+ `principal-not-an-agent`, `principal-not-listed`.
118
+
6
119
  ## [0.12.0]
7
120
 
8
121
  **Additive — the organisation-admin proof, decided by ID
package/README.md CHANGED
@@ -183,7 +183,7 @@ await resolveTenant({ session: null }); // throws Error("Unauthenticated: no ses
183
183
  unrestricted access. Useful for skipping filtering you know is pointless;
184
184
  never as a substitute for it.
185
185
 
186
- **Deprecated since 0.11.0: `passesScopeFilter`, `scopeFilterGet` and
186
+ **Deprecated since 0.11.0 (pointing to `filterTargetsBelongingTo` since 0.14.0): `passesScopeFilter`, `scopeFilterGet` and
187
187
  `scopeFilterList`.** All three (the last two through the first) admit a row
188
188
  when its `createdBy` NAME appears in the caller's `fromAllowList`, so a name
189
189
  selects the row, which backend standard R-53 clause 1 forbids. For a target
@@ -692,6 +692,80 @@ const admin = assertOrgAdmin(who.principal, who.principal.orgId, {
692
692
  if (!admin.ok) throw toHttpError(admin.refusal);
693
693
  ```
694
694
 
695
+ **`assertPrincipalListed(principal, list, opts)`** (`./principal-by-id`, 0.13.0)
696
+
697
+ Synchronous. Returns `{ ok: true }` or `{ ok: false, refusal }`
698
+ (`AssertPrincipalListedResult`). `list` is a `PrincipalIdList`,
699
+ `{ orgId, principalIds }`, the stored roster of agent IDs; `opts`
700
+ (`AssertPrincipalListedOptions`) is `{ door? }`. The single admission check
701
+ for "is this caller on that stored list", decided by agent ID only, no lookup:
702
+
703
+ - the principal's `principalId` must be byte-equal to an entry of
704
+ `principalIds` (`principal-not-listed`). No case folding, no trimming, no
705
+ prefix match, and no name matching anywhere: a name in the list never
706
+ matches, and a principal carrying only a name has no ID
707
+ (`credential-invalid`);
708
+ - only a `kind: "agent"` principal is admitted (`principal-not-an-agent`),
709
+ an agent acting through a service account included, judged by its own ID;
710
+ - `list.orgId` must be present (`target-unstamped`) and equal the principal's
711
+ `orgId` (`target-other-organisation`);
712
+ - an absent list (`list-absent`) and an empty or malformed `principalIds`
713
+ (`list-empty`) refuse;
714
+ - there is no wildcard: `"*"` is an ordinary string and admits nobody.
715
+
716
+ ```js
717
+ const listed = assertPrincipalListed(who.principal, { orgId: row.orgId, principalIds: row.allowedAgentIds }, {
718
+ door: "tasks:complete",
719
+ });
720
+ if (!listed.ok) throw toHttpError(listed.refusal);
721
+ ```
722
+
723
+ **`assertRecipientAddressable(sender, recipient, lookups, opts)`** (`./principal-by-id`, 0.14.0)
724
+
725
+ Async. Returns `{ ok: true }` or `{ ok: false, refusal }`. `recipient` is
726
+ `{ agentId, orgId }`; `lookups` is `{ orgKindOf, rosterOf }` where
727
+ `rosterOf(orgId)` returns the stored `{ orgId, principalIds }` roster of that
728
+ client organisation; `opts` is `{ door? }`. Decided by agent ID only:
729
+
730
+ - same organisation: admitted;
731
+ - client sender to operator recipient: the recipient's ID must be on the
732
+ SENDER organisation's roster;
733
+ - operator sender to client recipient: the sender's ID must be on the
734
+ RECIPIENT organisation's roster;
735
+ - client to client across organisations, a missing sender or recipient, a
736
+ sender that is not an agent, an unknown organisation kind and an
737
+ unresolvable roster all refuse. A name never matches. Types: `RecipientIds`,
738
+ `RecipientLookups`, `AssertRecipientAddressableOptions`,
739
+ `AssertRecipientAddressableResult`.
740
+
741
+ ```js
742
+ const may = await assertRecipientAddressable(who.principal, { agentId: to.id, orgId: to.orgId }, {
743
+ orgKindOf, rosterOf,
744
+ }, { door: "send_message" });
745
+ if (!may.ok) throw toHttpError(may.refusal);
746
+ ```
747
+
748
+ **`filterTargetsBelongingTo(principal, rows, lookups, opts)`** (`./principal-by-id`, 0.14.0)
749
+
750
+ Async. The ID-keyed replacement for `scopeFilterList`. Returns
751
+ `{ ok: true, rows }` (the rows `assertTargetBelongsTo` admits, in input order)
752
+ or `{ ok: false, refusal }`. `lookups` and `opts` are those of
753
+ `assertTargetBelongsTo`. Type: `FilterTargetsResult`.
754
+
755
+ - an absent or unresolved principal is a refusal naming the door, even for an
756
+ empty list; it is never `{ ok: true, rows: [] }`;
757
+ - a resolved principal whose rows all belong elsewhere gets
758
+ `{ ok: true, rows: [] }`, so a refusal is distinguishable from an absence;
759
+ - rows of other organisations, unstamped rows and a same-NAME row of another
760
+ organisation are dropped; a name never decides;
761
+ - a lookup failure is a refusal of the whole call, never a silent drop.
762
+
763
+ ```js
764
+ const out = await filterTargetsBelongingTo(who.principal, rows, { orgKindOf }, { door: "tasks:list" });
765
+ if (!out.ok) throw toHttpError(out.refusal);
766
+ return out.rows;
767
+ ```
768
+
695
769
  **The fleet is the operator organisation.** The fleet is not a reserved ID: it
696
770
  is the organisation your `orgKindOf` adapter reports as `"operator"` (for
697
771
  example the organisation whose mapping row carries `orgKind: "operator"`),
@@ -740,6 +814,87 @@ left in the tables the door reads, then switch the door.
740
814
  takes a name as an identity input, and a test reads the exported signatures to
741
815
  keep it that way.
742
816
 
817
+ ### A caller's standing (0.14.0)
818
+
819
+ `resolveCallerStanding(credential, lookups, { adminRoles, door? })` names which
820
+ of the four callers is asking. It is built on `resolveActingPrincipal` and
821
+ `assertOrgAdmin`; it is not a second path.
822
+
823
+ | Credential (verified by you) | Standing |
824
+ |---|---|
825
+ | none, garbled, unknown or inactive principal | `anonymous`, with the typed `refusal` |
826
+ | `{ kind: "person-no-org", personId }` | `pre-org` (signed in, no organisation) |
827
+ | person or agent, or a non-operator service account, without the admin role | `member`, with `principal` |
828
+ | person whose `verifiedOrgRole` is in `adminRoles` | `admin`, with `principal` |
829
+ | service account of the operator organisation (`orgKindOf` is `"operator"`) | `fleet`, with `principal` |
830
+
831
+ Types: `CallerCredential`, `AssertCallerStandingOptions`, `CallerStanding`.
832
+
833
+ - A master token reaches `fleet` by your mapping it to the operator service
834
+ account: `validateMasterBearer` proves the secret, then you pass
835
+ `{ kind: "service", serviceAccountId }`. The package never mints a fleet
836
+ credential from a bearer.
837
+ - A Clerk session reaches the function through `verifyClerkSessionToken`: with
838
+ an `org_id` claim, pass a `person` credential carrying `verifiedOrgId` and
839
+ `verifiedOrgRole`; without one, pass `person-no-org`. A person credential
840
+ that merely lacks `verifiedOrgId` is garbled and is `anonymous`, never `pre-org`.
841
+ - Branch on `standing`, never on the absence of a field. `pre-org` is not
842
+ `anonymous`: refuse it where an organisation is needed, but answer it as a
843
+ signed-in caller (see the refusal rules of your read doors).
844
+
845
+ ## Protecting an MCP server as an OAuth resource (`/resource-server`)
846
+
847
+ An MCP server that requires a bearer token is an OAuth 2.1 protected resource.
848
+ These primitives are the whole resource side; they fetch nothing and call no
849
+ network.
850
+
851
+ ```ts
852
+ import {
853
+ buildProtectedResourceMetadata,
854
+ unauthorizedChallenge,
855
+ deriveClerkDiscoveryUrls,
856
+ verifyMcpAccessToken,
857
+ } from "@vantageos/cloud-identity/resource-server";
858
+
859
+ // GET /.well-known/oauth-protected-resource (RFC 9728)
860
+ const metadata = buildProtectedResourceMetadata({
861
+ resource: "https://mcp.example.com/mcp",
862
+ authorizationServers: ["https://clerk.example.com"],
863
+ scopesSupported: ["mcp:read", "mcp:write"],
864
+ });
865
+
866
+ // On every MCP request
867
+ const r = await verifyMcpAccessToken(req.headers.authorization, {
868
+ realm: "mcp",
869
+ resourceMetadataUrl: "https://mcp.example.com/.well-known/oauth-protected-resource",
870
+ issuer: "https://clerk.example.com",
871
+ audience: "https://mcp.example.com/mcp", // this resource: required
872
+ jwks: () => fetchJwks(deriveClerkDiscoveryUrls("https://clerk.example.com").jwksUrl),
873
+ });
874
+ if (!r.ok) return respond(r.status, "headers" in r ? r.headers : {});
875
+ // r.session.userId, r.session.claims
876
+ ```
877
+
878
+ - `buildProtectedResourceMetadata` returns the RFC 9728 document
879
+ (`ProtectedResourceMetadataConfig` in, `ProtectedResourceMetadata` out).
880
+ - `unauthorizedChallenge` returns `{ status: 401, headers }` whose
881
+ `WWW-Authenticate` always carries `resource_metadata`, plus `error`,
882
+ `error_description` and `scope` when given (`UnauthorizedChallengeConfig`,
883
+ `UnauthorizedChallenge`). Values are escaped; a line break throws.
884
+ - `deriveClerkDiscoveryUrls` returns `ClerkDiscoveryUrls`
885
+ (`discoveryUrl`, `jwksUrl`) for an `https` issuer.
886
+ - `verifyMcpAccessToken` reuses `verifyClerkSessionToken` (RS256 only) and
887
+ requires the token's `aud` to contain `audience`. It returns the verified
888
+ session, or a `CREDENTIAL_REFUSED` refusal with the `401` envelope
889
+ (`McpResourceServerConfig`, `VerifyMcpAccessTokenResult`):
890
+ `bearer-missing` and `bearer-malformed` answer `invalid_request`,
891
+ `token-invalid` answers `invalid_token` (wrong signature, issuer, audience,
892
+ expiry or not-before are one answer), and an unreachable key set is `503`
893
+ with no challenge (`jwks-unavailable`). A missing issuer or audience throws.
894
+ - Limits, stated: the token needs a `sub` and a `kid` (the Clerk session shape);
895
+ the consumer fetches and caches the key set; no scope check is made on the
896
+ token (read `r.session.claims`).
897
+
743
898
  ## What this package does not do
744
899
 
745
900
  Worth reading before you rely on it.
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Typed refusal shared by the 0.10.0 primitives (role policy, membership,
3
3
  * org-admin proof, namespace write, secret comparison), the 0.11.0
4
- * principal-by-id resolver and target check, and the 0.12.0 org-admin check.
4
+ * principal-by-id resolver and target check, the 0.12.0 org-admin check, and the 0.13.0 list-membership check.
5
5
  *
6
6
  * A refusal is a value carrying its own code, reason and door, so a caller
7
7
  * branches on content rather than on the mere presence of an exception, and an
@@ -13,7 +13,7 @@
13
13
  * closed vocabulary for the person path.
14
14
  */
15
15
  export type IdentityRefusalCode = "RBAC_DENIED" | "CREDENTIAL_REFUSED";
16
- export type IdentityRefusalReason = "unknown-role" | "unknown-minimum-role" | "invalid-role-order" | "role-below-minimum" | "role-claim-absent" | "role-claim-unmapped" | "invalid-role-mapping" | "membership-invalid-input" | "membership-lookup-failed" | "membership-not-found" | "membership-record-invalid" | "membership-inactive" | "other-organisation" | "no-verified-organisation" | "role-not-admin" | "namespace-invalid" | "no-write-prefixes" | "namespace-write-denied" | "secret-not-configured" | "secret-mismatch" | "credential-invalid" | "principal-lookup-failed" | "principal-not-found" | "principal-record-invalid" | "principal-inactive" | "organisation-not-active" | "reserved-fleet-scope" | "acting-agent-other-organisation" | "target-unstamped" | "target-other-organisation" | "target-owner-mismatch" | "principal-not-a-person";
16
+ export type IdentityRefusalReason = "unknown-role" | "unknown-minimum-role" | "invalid-role-order" | "role-below-minimum" | "role-claim-absent" | "role-claim-unmapped" | "invalid-role-mapping" | "membership-invalid-input" | "membership-lookup-failed" | "membership-not-found" | "membership-record-invalid" | "membership-inactive" | "other-organisation" | "no-verified-organisation" | "role-not-admin" | "namespace-invalid" | "no-write-prefixes" | "namespace-write-denied" | "secret-not-configured" | "secret-mismatch" | "credential-invalid" | "principal-lookup-failed" | "principal-not-found" | "principal-record-invalid" | "principal-inactive" | "organisation-not-active" | "reserved-fleet-scope" | "acting-agent-other-organisation" | "target-unstamped" | "target-other-organisation" | "target-owner-mismatch" | "principal-not-a-person" | "list-absent" | "list-empty" | "principal-not-an-agent" | "principal-not-listed" | "bearer-missing" | "bearer-malformed" | "token-invalid" | "jwks-unavailable";
17
17
  export type IdentityRefusal = {
18
18
  code: IdentityRefusalCode;
19
19
  reason: IdentityRefusalReason;
@@ -1 +1 @@
1
- {"version":3,"file":"identity-refusal.d.ts","sourceRoot":"","sources":["../src/identity-refusal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,MAAM,MAAM,mBAAmB,GAAG,aAAa,GAAG,oBAAoB,CAAC;AAEvE,MAAM,MAAM,qBAAqB,GAE7B,cAAc,GACd,sBAAsB,GACtB,oBAAoB,GACpB,oBAAoB,GACpB,mBAAmB,GACnB,qBAAqB,GACrB,sBAAsB,GAEtB,0BAA0B,GAC1B,0BAA0B,GAC1B,sBAAsB,GACtB,2BAA2B,GAC3B,qBAAqB,GACrB,oBAAoB,GAEpB,0BAA0B,GAC1B,gBAAgB,GAEhB,mBAAmB,GACnB,mBAAmB,GACnB,wBAAwB,GAExB,uBAAuB,GACvB,iBAAiB,GAEjB,oBAAoB,GACpB,yBAAyB,GACzB,qBAAqB,GACrB,0BAA0B,GAC1B,oBAAoB,GACpB,yBAAyB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B,wBAAwB,GAExB,aAAa,GACb,YAAY,GACZ,wBAAwB,GACxB,sBAAsB,GAEtB,gBAAgB,GAChB,kBAAkB,GAClB,eAAe,GACf,kBAAkB,CAAC;AAEvB,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,mBAAmB,CAAC;IAC1B,MAAM,EAAE,qBAAqB,CAAC;IAC9B,gEAAgE;IAChE,IAAI,EAAE,MAAM,CAAC;IACb,oEAAoE;IACpE,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,0EAA0E;AAC1E,qBAAa,oBAAqB,SAAQ,KAAK;IAC7C,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC;gBACtB,OAAO,EAAE,eAAe;CAKrC;AAED,gEAAgE;AAChE,wBAAgB,OAAO,CACrB,IAAI,EAAE,mBAAmB,EACzB,MAAM,EAAE,qBAAqB,EAC7B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,GACb,eAAe,CAEjB"}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Typed refusal shared by the 0.10.0 primitives (role policy, membership,
3
3
  * org-admin proof, namespace write, secret comparison), the 0.11.0
4
- * principal-by-id resolver and target check, and the 0.12.0 org-admin check.
4
+ * principal-by-id resolver and target check, the 0.12.0 org-admin check, and the 0.13.0 list-membership check.
5
5
  *
6
6
  * A refusal is a value carrying its own code, reason and door, so a caller
7
7
  * branches on content rather than on the mere presence of an exception, and an
@@ -1 +1 @@
1
- {"version":3,"file":"identity-refusal.js","sourceRoot":"","sources":["../src/identity-refusal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAsDH,0EAA0E;AAC1E,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IACpC,OAAO,CAAkB;IAClC,YAAY,OAAwB;QAClC,KAAK,CAAC,GAAG,OAAO,CAAC,IAAI,KAAK,OAAO,CAAC,MAAM,KAAK,OAAO,CAAC,MAAM,KAAK,OAAO,CAAC,IAAI,GAAG,CAAC,CAAC;QACjF,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;QACnC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF;AAED,gEAAgE;AAChE,MAAM,UAAU,OAAO,CACrB,IAAyB,EACzB,MAA6B,EAC7B,IAAY,EACZ,MAAc;IAEd,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AACxC,CAAC"}
1
+ {"version":3,"file":"identity-refusal.js","sourceRoot":"","sources":["../src/identity-refusal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAgEH,0EAA0E;AAC1E,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IACpC,OAAO,CAAkB;IAClC,YAAY,OAAwB;QAClC,KAAK,CAAC,GAAG,OAAO,CAAC,IAAI,KAAK,OAAO,CAAC,MAAM,KAAK,OAAO,CAAC,MAAM,KAAK,OAAO,CAAC,IAAI,GAAG,CAAC,CAAC;QACjF,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;QACnC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF;AAED,gEAAgE;AAChE,MAAM,UAAU,OAAO,CACrB,IAAyB,EACzB,MAA6B,EAC7B,IAAY,EACZ,MAAc;IAEd,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AACxC,CAAC"}
package/dist/index.d.ts CHANGED
@@ -37,6 +37,8 @@ export { isRowInTenant, resolveMembership, requireOrgAdmin, membershipRecordSche
37
37
  export type { MembershipRecord, ResolvedMembership, ResolveMembershipInput, ResolveMembershipResult, RequireOrgAdminInput, } from "./tenant-membership.js";
38
38
  export { assertNamespaceWrite } from "./namespace-write.js";
39
39
  export { timingSafeEqualSync, assertSecretSync } from "./secret-compare-sync.js";
40
- export { actingCredentialSchema, principalRowSchema, organisationRowSchema, resolveActingPrincipal, assertTargetBelongsTo, assertOrgAdmin, } from "./principal-by-id.js";
41
- export type { ActingCredential, PrincipalRow, OrganisationRow, PrincipalLookups, OrgKind, OrgKindLookups, ActingPrincipalKind, ActingPrincipal, ResolveActingPrincipalResult, TargetIds, AssertTargetOptions, AssertTargetResult, AssertOrgAdminOptions, AssertOrgAdminResult, } from "./principal-by-id.js";
40
+ export { actingCredentialSchema, principalRowSchema, organisationRowSchema, resolveActingPrincipal, assertTargetBelongsTo, filterTargetsBelongingTo, assertOrgAdmin, assertPrincipalListed, assertRecipientAddressable, resolveCallerStanding, } from "./principal-by-id.js";
41
+ export type { ActingCredential, PrincipalRow, OrganisationRow, PrincipalLookups, OrgKind, OrgKindLookups, ActingPrincipalKind, ActingPrincipal, ResolveActingPrincipalResult, TargetIds, AssertTargetOptions, AssertTargetResult, FilterTargetsResult, AssertOrgAdminOptions, AssertOrgAdminResult, PrincipalIdList, AssertPrincipalListedOptions, AssertPrincipalListedResult, RecipientIds, RecipientLookups, AssertRecipientAddressableOptions, AssertRecipientAddressableResult, CallerCredential, AssertCallerStandingOptions, CallerStanding, } from "./principal-by-id.js";
42
+ export { buildProtectedResourceMetadata, unauthorizedChallenge, deriveClerkDiscoveryUrls, verifyMcpAccessToken, } from "./resource-server.js";
43
+ export type { ProtectedResourceMetadataConfig, ProtectedResourceMetadata, UnauthorizedChallengeConfig, UnauthorizedChallenge, ClerkDiscoveryUrls, McpResourceServerConfig, VerifyMcpAccessTokenResult, } from "./resource-server.js";
42
44
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,aAAa,EACb,eAAe,EACf,sBAAsB,EACtB,mBAAmB,EACnB,KAAK,eAAe,GACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,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iBAAiB,EACjB,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,sBAAsB,GACvB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EACV,gBAAgB,EAChB,kBAAkB,EAClB,sBAAsB,EACtB,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAKjF,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,EACrB,cAAc,GACf,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,OAAO,EACP,cAAc,EACd,mBAAmB,EACnB,eAAe,EACf,4BAA4B,EAC5B,SAAS,EACT,mBAAmB,EACnB,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,aAAa,EACb,eAAe,EACf,sBAAsB,EACtB,mBAAmB,EACnB,KAAK,eAAe,GACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,YAAY,EACV,QAAQ,EACR,YAAY,EACZ,eAAe,EACf,kBAAkB,EAClB,0BAA0B,GAC3B,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,mBAA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oBAAoB,GACrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAKjF,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,EACrB,wBAAwB,EACxB,cAAc,EACd,qBAAqB,EACrB,0BAA0B,EAC1B,qBAAqB,GACtB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,OAAO,EACP,cAAc,EACd,mBAAmB,EACnB,eAAe,EACf,4BAA4B,EAC5B,SAAS,EACT,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,EACpB,eAAe,EACf,4BAA4B,EAC5B,2BAA2B,EAC3B,YAAY,EACZ,gBAAgB,EAChB,iCAAiC,EACjC,gCAAgC,EAChC,gBAAgB,EAChB,2BAA2B,EAC3B,cAAc,GACf,MAAM,sBAAsB,CAAC;AAM9B,OAAO,EACL,8BAA8B,EAC9B,qBAAqB,EACrB,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,+BAA+B,EAC/B,yBAAyB,EACzB,2BAA2B,EAC3B,qBAAqB,EACrB,kBAAkB,EAClB,uBAAuB,EACvB,0BAA0B,GAC3B,MAAM,sBAAsB,CAAC"}
package/dist/index.js CHANGED
@@ -38,5 +38,10 @@ export { timingSafeEqualSync, assertSecretSync } from "./secret-compare-sync.js"
38
38
  // 0.11.0 — The acting principal by ID and the target checked by ID. A name is
39
39
  // a display label: it never selects a row and never authorises one.
40
40
  // 0.12.0 — assertOrgAdmin: the org-admin proof on a principal resolved by ID.
41
- export { actingCredentialSchema, principalRowSchema, organisationRowSchema, resolveActingPrincipal, assertTargetBelongsTo, assertOrgAdmin, } from "./principal-by-id.js";
41
+ export { actingCredentialSchema, principalRowSchema, organisationRowSchema, resolveActingPrincipal, assertTargetBelongsTo, filterTargetsBelongingTo, assertOrgAdmin, assertPrincipalListed, assertRecipientAddressable, resolveCallerStanding, } from "./principal-by-id.js";
42
+ // 0.15.0 — Resource-server primitives: RFC 9728 protected resource metadata,
43
+ // the RFC 6750 401 challenge, issuer discovery URLs and MCP access-token
44
+ // verification bound to this resource. Replaces the standalone resource-server
45
+ // package; one identity layer.
46
+ export { buildProtectedResourceMetadata, unauthorizedChallenge, deriveClerkDiscoveryUrls, verifyMcpAccessToken, } from "./resource-server.js";
42
47
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACzD,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,aAAa,EACb,eAAe,EACf,sBAAsB,EACtB,mBAAmB,GAEpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAS9D,0CAA0C;AAC1C,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAU7B,gFAAgF;AAChF,OAAO,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAU1E,kFAAkF;AAClF,OAAO,EACL,sBAAsB,EACtB,6BAA6B,EAC7B,gBAAgB,EAChB,yBAAyB,GAC1B,MAAM,iBAAiB,CAAC;AAWzB,sEAAsE;AACtE,yEAAyE;AACzE,mEAAmE;AACnE,OAAO,EACL,uBAAuB,EACvB,0BAA0B,EAC1B,qBAAqB,GACtB,MAAM,uBAA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;AAc/B,+EAA+E;AAC/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAM7D,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAO/E,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,sBAAsB,GACvB,MAAM,wBAAwB,CAAC;AAQhC,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAEjF,8EAA8E;AAC9E,oEAAoE;AACpE,8EAA8E;AAC9E,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,EACrB,wBAAwB,EACxB,cAAc,EACd,qBAAqB,EACrB,0BAA0B,EAC1B,qBAAqB,GACtB,MAAM,sBAAsB,CAAC;AA6B9B,6EAA6E;AAC7E,yEAAyE;AACzE,+EAA+E;AAC/E,+BAA+B;AAC/B,OAAO,EACL,8BAA8B,EAC9B,qBAAqB,EACrB,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,sBAAsB,CAAC"}
@@ -211,6 +211,40 @@ export declare function resolveActingPrincipal(credential: ActingCredential | nu
211
211
  * absent owner is refused.
212
212
  */
213
213
  export declare function assertTargetBelongsTo(principal: ActingPrincipal | null | undefined, target: TargetIds | null | undefined, lookups: OrgKindLookups, opts?: AssertTargetOptions): Promise<AssertTargetResult>;
214
+ export type FilterTargetsResult<T> = {
215
+ ok: true;
216
+ rows: T[];
217
+ } | {
218
+ ok: false;
219
+ refusal: IdentityRefusal;
220
+ };
221
+ /**
222
+ * Keeps the rows that belong to the principal, deciding by STORED ID only.
223
+ * The ID-keyed replacement for the name-keyed `scopeFilterList`.
224
+ *
225
+ * Each row is judged by `assertTargetBelongsTo` (never re-derived here), so
226
+ * the same organisation, operator-org, unstamped, `ownerOnly` and
227
+ * `fleetCrossOrg` rules apply.
228
+ *
229
+ * - The principal is proved FIRST, before any row is read. An absent or
230
+ * unresolved principal, or a failed organisation-kind lookup for it,
231
+ * returns `{ ok: false, refusal }` naming the door, even for an empty
232
+ * list: a refusal is never an `ok: true` with no rows.
233
+ * - `fleetCrossOrg: true` from a principal that is not `kind: "fleet"` is a
234
+ * misconfigured door and is refused `reserved-fleet-scope` up front, for
235
+ * any list. Per row, `reserved-fleet-scope` therefore only means "this row
236
+ * is in the operator scope" and the row is dropped.
237
+ * - A resolved principal whose rows all belong elsewhere gets
238
+ * `{ ok: true, rows: [] }`: an absence, distinguishable from a refusal.
239
+ * - A row that does not belong (other organisation, operator-org row,
240
+ * unstamped, owner mismatch) is dropped. A same-NAME row of another
241
+ * organisation is dropped: no name field is read.
242
+ * - A lookup failure on any row refuses the whole call. It is never a
243
+ * silent drop and never a pass; any refusal reason not known to mean
244
+ * "this row is not yours" refuses too.
245
+ * - The order of the kept rows is the order of the input.
246
+ */
247
+ export declare function filterTargetsBelongingTo<T extends TargetIds>(principal: ActingPrincipal | null | undefined, rows: readonly T[], lookups: OrgKindLookups, opts?: AssertTargetOptions): Promise<FilterTargetsResult<T>>;
214
248
  export type AssertOrgAdminOptions = {
215
249
  /**
216
250
  * The role values that count as organisation admin, exactly as the verified
@@ -245,5 +279,154 @@ export type AssertOrgAdminResult = {
245
279
  * No case folding, no prefix stripping, no default role.
246
280
  */
247
281
  export declare function assertOrgAdmin(principal: ActingPrincipal | null | undefined, targetOrgId: string | null | undefined, opts: AssertOrgAdminOptions): AssertOrgAdminResult;
282
+ /**
283
+ * A stored list of principal IDs scoped to one organisation, for example a
284
+ * client's roster of agents. Every entry is an ID; a name is never an entry.
285
+ */
286
+ export type PrincipalIdList = {
287
+ /** The organisation the list is stored under. */
288
+ orgId: string;
289
+ /** Stored principal (agent) IDs, compared byte for byte. */
290
+ principalIds: readonly string[];
291
+ };
292
+ export type AssertPrincipalListedOptions = {
293
+ /** The consumer's name for the door; carried on every refusal. */
294
+ door?: string;
295
+ };
296
+ export type AssertPrincipalListedResult = {
297
+ ok: true;
298
+ } | {
299
+ ok: false;
300
+ refusal: IdentityRefusal;
301
+ };
302
+ /**
303
+ * Admits a principal only when its AGENT ID is an entry of a stored list that
304
+ * belongs to its own organisation. The principal must come from
305
+ * `resolveActingPrincipal`; synchronous, no lookup, no name read anywhere.
306
+ *
307
+ * Refusal by default. Each of these refuses with a typed `RBAC_DENIED`
308
+ * carrying the door (default `"assertPrincipalListed"`):
309
+ *
310
+ * - an absent principal, or one with an empty ID or organisation
311
+ * (`credential-invalid`). A principal carrying only a name has no ID.
312
+ * - a principal that is not `kind: "agent"` (`principal-not-an-agent`): the
313
+ * list holds agent IDs, so a person, a service account and the fleet
314
+ * principal are not admitted by it. An agent acting through a service
315
+ * account is `kind: "agent"` and is judged by its own ID.
316
+ * - an absent list (`list-absent`).
317
+ * - a list with a missing or empty `orgId` (`target-unstamped`), or one
318
+ * stored under another organisation (`target-other-organisation`).
319
+ * - an empty or malformed `principalIds` (`list-empty`).
320
+ * - an ID that is not byte-equal to an entry (`principal-not-listed`). No
321
+ * case folding, no trimming, no prefix match.
322
+ *
323
+ * There is no wildcard: a `"*"` entry is an ordinary string, never "everyone".
324
+ * The fleet sentinel is out of scope here.
325
+ */
326
+ export declare function assertPrincipalListed(principal: ActingPrincipal | null | undefined, list: PrincipalIdList | null | undefined, opts?: AssertPrincipalListedOptions): AssertPrincipalListedResult;
327
+ /** The recipient of a message, named by its stored agent ID and organisation ID. */
328
+ export type RecipientIds = {
329
+ /** The recipient agent's stored ID. */
330
+ agentId: string;
331
+ /** The recipient agent's stored organisation ID. */
332
+ orgId: string;
333
+ };
334
+ /**
335
+ * The lookups `assertRecipientAddressable` reads: the organisation kind, and
336
+ * the stored roster of agent IDs of one organisation (a client's list of the
337
+ * fleet agents it may reach). `null`, a miss or a throw is an unresolvable
338
+ * roster and refuses.
339
+ */
340
+ export type RecipientLookups = OrgKindLookups & {
341
+ rosterOf?: Lookup<[orgId: string], PrincipalIdList>;
342
+ };
343
+ export type AssertRecipientAddressableOptions = {
344
+ /** The consumer's name for the door; carried on every refusal. */
345
+ door?: string;
346
+ };
347
+ export type AssertRecipientAddressableResult = {
348
+ ok: true;
349
+ } | {
350
+ ok: false;
351
+ refusal: IdentityRefusal;
352
+ };
353
+ /**
354
+ * Decides whether a sender may address a recipient, across organisations
355
+ * included, by AGENT ID only. The sender must come from
356
+ * `resolveActingPrincipal`. No name is read anywhere; a name never matches.
357
+ *
358
+ * Admitted iff one of these holds:
359
+ * (a) same organisation: the sender's `orgId` equals the recipient's;
360
+ * (b) client to operator: the sender is in a client organisation, the
361
+ * recipient is in the operator organisation, and the RECIPIENT's ID is
362
+ * on the SENDER organisation's roster;
363
+ * (c) operator to client: the sender is in the operator organisation, the
364
+ * recipient is in a client organisation, and the SENDER's ID is on the
365
+ * RECIPIENT organisation's roster.
366
+ *
367
+ * Everything else is refused with a typed `RBAC_DENIED` carrying the door
368
+ * (default `"assertRecipientAddressable"`): an absent sender or one without an
369
+ * ID (`credential-invalid`), a sender that is not `kind: "agent"`
370
+ * (`principal-not-an-agent`), an absent recipient or one without an agent ID
371
+ * or organisation (`target-unstamped`), client to client across organisations
372
+ * and an organisation kind that is neither operator nor client
373
+ * (`target-other-organisation`), a missing or throwing `orgKindOf` /
374
+ * `rosterOf` (`principal-lookup-failed`), an absent roster (`list-absent`), and
375
+ * a roster that is empty, stored under the wrong organisation or does not list
376
+ * the ID (the refusals of {@link assertPrincipalListed}, which is reused for
377
+ * that check).
378
+ */
379
+ export declare function assertRecipientAddressable(sender: ActingPrincipal | null | undefined, recipient: RecipientIds | null | undefined, lookups: RecipientLookups, opts?: AssertRecipientAddressableOptions): Promise<AssertRecipientAddressableResult>;
380
+ /**
381
+ * A verified session that carries a person but NO organisation (a signed-in
382
+ * user who has not joined one). `resolveActingPrincipal` cannot express this:
383
+ * a person credential requires `verifiedOrgId`, so a no-organisation session
384
+ * is refused there exactly as a garbled credential is. This kind exists so
385
+ * the consumer can say "verified, and no organisation" on purpose; an absent
386
+ * `verifiedOrgId` on a `person` credential stays a garbled credential.
387
+ */
388
+ declare const preOrgCredentialSchema: z.ZodObject<{
389
+ kind: z.ZodLiteral<"person-no-org">;
390
+ personId: z.ZodString;
391
+ }, z.core.$strict>;
392
+ export type CallerCredential = ActingCredential | z.input<typeof preOrgCredentialSchema>;
393
+ export type AssertCallerStandingOptions = {
394
+ /** Role values that make a person an organisation admin; see `assertOrgAdmin`. */
395
+ adminRoles: readonly string[];
396
+ /** The consumer's name for the door; carried on every refusal. */
397
+ door?: string;
398
+ };
399
+ /**
400
+ * The four callers, said apart. `anonymous` means no caller could be
401
+ * resolved (no credential, a garbled one, a miss, an inactive row) and carries
402
+ * the typed refusal; it is never what a signed-in session without an
403
+ * organisation becomes.
404
+ */
405
+ export type CallerStanding = {
406
+ standing: "anonymous";
407
+ refusal: IdentityRefusal;
408
+ } | {
409
+ standing: "pre-org";
410
+ personId: string;
411
+ } | {
412
+ standing: "member";
413
+ principal: ActingPrincipal;
414
+ } | {
415
+ standing: "admin";
416
+ principal: ActingPrincipal;
417
+ } | {
418
+ standing: "fleet";
419
+ principal: ActingPrincipal;
420
+ };
421
+ /**
422
+ * Derives a caller's STANDING from a verified credential. It adds one case to
423
+ * the existing primitives, the signed-in session with no organisation, and
424
+ * reuses them for everything else: `resolveActingPrincipal` decides who the
425
+ * caller is (and `fleet`), `assertOrgAdmin` decides `admin` against the
426
+ * principal's own organisation. Any other resolved principal (a person
427
+ * without the admin role, an agent, a non-operator service account) is a
428
+ * `member`; read `principal.kind` to tell them apart.
429
+ */
430
+ export declare function resolveCallerStanding(credential: CallerCredential | null | undefined, lookups: PrincipalLookups, opts: AssertCallerStandingOptions): Promise<CallerStanding>;
248
431
  export {};
249
432
  //# sourceMappingURL=principal-by-id.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"principal-by-id.d.ts","sourceRoot":"","sources":["../src/principal-by-id.ts"],"names":[],"mappings":"AAAA;;;;;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