@atlasauth/pca-idjag 0.0.0-stage → 0.2.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Atlas Authorization
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,67 @@
1
- # Temporary Holding Version
1
+ # @atlasauth/pca-idjag
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ ID-JAG / OAuth Cross-App Access bridge for Proof-Carrying Authority (PCA). An ID-JAG (Identity Assertion Authorization Grant, `draft-ietf-oauth-identity-assertion-authz-grant`) is a JWT an enterprise identity provider mints so an agent app can act on a named user's behalf against one other app: `sub` is the human, `act` is the agent, `aud` is the single target app, and `scope` is the delegated authority. This package verifies such a grant, projects it onto a PCA principal and a signed root capability, and builds the two OAuth requests used in the flow (RFC 8693 token exchange to obtain a grant, RFC 7523 jwt-bearer to redeem one).
4
+
5
+ ## Install
6
+
7
+ ```sh
8
+ npm i @atlasauth/pca-idjag @atlasauth/pca @atlasauth/pca-oidc
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```ts
14
+ import { generateKeyPair, encodeKey, verifyChain } from '@atlasauth/pca';
15
+ import { verifyIdJag, idJagToCapability, tokenExchangeRequest, jwtBearerAssertion } from '@atlasauth/pca-idjag';
16
+
17
+ // 1. Verify the ID-JAG. Fails closed (throws IdJagVerificationError) on any signature, issuer,
18
+ // audience, expiry, nonce, actor or scope problem.
19
+ const grant = await verifyIdJag(idJagJwt, {
20
+ issuer: 'https://idp.example.com',
21
+ audience: 'https://resource.example.com', // must be the single audience of the grant
22
+ jwksUri: 'https://idp.example.com/.well-known/jwks.json', // or `discover: true`, or an injected `key`
23
+ requiredScopes: ['calendar.read'],
24
+ });
25
+ grant.sub; // the human
26
+ grant.agent; // the acting app (act.sub)
27
+ grant.scopes; // ['calendar.read', 'mail.send']
28
+
29
+ // 2. Project it onto a signed PCA root capability: authority = scopes, holder = the agent's PCA key.
30
+ const human = generateKeyPair(); // the human root key that signs the capability
31
+ const agentKey = generateKeyPair();
32
+ const { capability } = idJagToCapability(grant, {
33
+ principalSecret: human.secretKey,
34
+ principalPublic: encodeKey(human.publicKey),
35
+ holder: encodeKey(agentKey.publicKey),
36
+ });
37
+ verifyChain([capability], encodeKey(human.publicKey)); // { ok: true }
38
+
39
+ // 3. The OAuth legs of the flow (plain request descriptions; you send them).
40
+ const obtain = tokenExchangeRequest({
41
+ tokenEndpoint: 'https://idp.example.com/oauth2/token',
42
+ subjectToken: userIdToken,
43
+ audience: 'https://resource.example.com',
44
+ scope: ['calendar.read'],
45
+ clientId: 'agent-app-7',
46
+ });
47
+ const redeem = jwtBearerAssertion({
48
+ tokenEndpoint: 'https://resource.example.com/token',
49
+ assertion: idJagJwt,
50
+ scope: 'calendar.read',
51
+ }).request; // { url, method, headers, params, body }
52
+ ```
53
+
54
+ ## API
55
+
56
+ - `verifyIdJag(jwt, options)` returns an `IdJagGrant`; throws `IdJagVerificationError` (with a `code`).
57
+ - `idJagToPcaPrincipal(grant, opts?)`, `idJagToCapability(grant, opts)` map a grant to a PCA principal / signed root capability.
58
+ - `readIdJagAuthority(cap)`, `readIdJagProvenance(cap)`, `isIdJagAuthorityCaveat`, `isIdJagProvenanceCaveat` read the caveats back.
59
+ - `tokenExchangeRequest(opts)`, `jwtBearerAssertion(opts)` build the RFC 8693 / RFC 7523 requests; the `GRANT_TYPE_*`, `TOKEN_TYPE_*` and `CLIENT_ASSERTION_TYPE_JWT_BEARER` URN constants are exported.
60
+
61
+ ## Status
62
+
63
+ The ID-JAG specification is an IETF draft and may change. JWT checks are delegated to `@atlasauth/pca-oidc`; only asymmetric algorithms are accepted by default. This package does not send any network request except the optional JWKS / discovery fetch. PCA cryptography has not been independently audited.
64
+
65
+ ## License
66
+
67
+ MIT - see LICENSE
@@ -0,0 +1,244 @@
1
+ import { type OidcConfirmation, type OidcIdTokenClaims, type OidcPrincipal, type OidcPrincipalOptions, type OidcVerificationErrorCode, type OidcVerifyKey } from '@atlasauth/pca-oidc';
2
+ import { type CapSuiteOpts, type Capability, type Caveat } from '@atlasauth/pca';
3
+ /** The RFC 8693 `act` (actor) claim identifying the AGENT the grant authorizes to act. */
4
+ export interface IdJagActor {
5
+ /** The agent's identifier (required). */
6
+ sub: string;
7
+ [member: string]: unknown;
8
+ }
9
+ /** A verified ID-JAG grant. Every field here passed verification; a failure throws instead. */
10
+ export interface IdJagGrant {
11
+ /** The IdP that asserted the grant (`iss`). */
12
+ iss: string;
13
+ /** The HUMAN the grant is about (`sub`). */
14
+ sub: string;
15
+ /** The AGENT the grant authorizes (`act`). */
16
+ actor: IdJagActor;
17
+ /** Convenience: `actor.sub`, the agent identifier. */
18
+ agent: string;
19
+ /** The SINGLE resource app the grant is for (`aud`). */
20
+ audience: string;
21
+ /** The delegated authority — the parsed `scope` (space-delimited) or `scopes` array. */
22
+ scopes: string[];
23
+ /** Issued-at (epoch seconds). */
24
+ iat: number;
25
+ /** Expiry (epoch seconds). */
26
+ exp: number;
27
+ /** JWT id, when present. */
28
+ jti?: string;
29
+ /** Round-tripped `nonce`, when the verifier required one. */
30
+ nonce?: string;
31
+ /** RFC 7800 `cnf` confirmation, when the grant binds a proof-of-possession key. */
32
+ cnf?: OidcConfirmation;
33
+ /** The verified OIDC base claims — fed straight to `oidcPrincipal` for the principal mapping. */
34
+ oidcClaims: OidcIdTokenClaims;
35
+ }
36
+ /** A stable classification of why ID-JAG verification failed (the OIDC codes plus ID-JAG-specific ones). */
37
+ export type IdJagVerificationErrorCode = OidcVerificationErrorCode | 'actor' | 'scope' | 'grant';
38
+ /** The error thrown for any ID-JAG verification failure. `code` classifies the cause. */
39
+ export declare class IdJagVerificationError extends Error {
40
+ readonly name = "IdJagVerificationError";
41
+ readonly code: IdJagVerificationErrorCode;
42
+ constructor(code: IdJagVerificationErrorCode, message: string, options?: {
43
+ cause?: unknown;
44
+ });
45
+ }
46
+ export interface VerifyIdJagOptions {
47
+ /** Expected `iss` — the exact IdP issuer identifier. Required. */
48
+ issuer: string;
49
+ /**
50
+ * Expected `aud` — the SINGLE resource app this grant must be for. ID-JAG is single-audience: the token's
51
+ * `aud` must be exactly this value (a string, or a one-element array equal to it), else verification fails.
52
+ */
53
+ audience: string;
54
+ /** When set, the grant's `nonce` MUST be present and equal this value. */
55
+ nonce?: string;
56
+ /** When set, every scope here MUST be present in the grant, else verification fails. */
57
+ requiredScopes?: string[];
58
+ /** Clock skew tolerance in seconds (default 0). */
59
+ clockToleranceSec?: number;
60
+ /** When set, reject a grant whose `iat` is older than this many seconds. */
61
+ maxTokenAgeSec?: number;
62
+ /** Allowed JWS `alg`s. Defaults to the asymmetric set (never symmetric). */
63
+ algorithms?: string[];
64
+ /** Injectable key material (a key, JWK, or `createRemoteJWKSet` resolver). Preferred for tests. */
65
+ key?: OidcVerifyKey;
66
+ /** A JWKS endpoint URL to build a remote key set from (skips discovery). */
67
+ jwksUri?: string;
68
+ /** Resolve the JWKS endpoint from the issuer's `.well-known/openid-configuration` first. */
69
+ discover?: boolean;
70
+ /** Injectable `fetch` used for discovery (defaults to the global `fetch`). */
71
+ fetch?: typeof fetch;
72
+ }
73
+ /**
74
+ * Verify an ID-JAG JWT and return the parsed grant. Fails CLOSED: any signature / issuer / audience /
75
+ * expiry / nonce failure, a missing or malformed `act` agent claim, a missing `scope`, or a missing
76
+ * required scope throws {@link IdJagVerificationError}. The JWKS is injectable (`key` / `jwksUri` /
77
+ * `discover`); `key` lets tests verify entirely in-memory.
78
+ */
79
+ export declare function verifyIdJag(jwt: string, opts: VerifyIdJagOptions): Promise<IdJagGrant>;
80
+ /**
81
+ * Map a verified ID-JAG onto a PCA principal descriptor (the ROOT of a capability chain). Delegates to
82
+ * `@atlasauth/pca-oidc`'s `oidcPrincipal` on the grant's OIDC base claims, so the human `iss`+`sub` becomes
83
+ * a stable `principalId`, a signed `oidc_subject` caveat, and — when the grant binds a `cnf` Ed25519 key or
84
+ * the caller supplies one via `opts.principalPublic` — the b64u Ed25519 key the chain roots at.
85
+ */
86
+ export declare function idJagToPcaPrincipal(grant: IdJagGrant, opts?: OidcPrincipalOptions): OidcPrincipal;
87
+ /** The caveat recording the authority (scopes + audience) delegated by an ID-JAG. */
88
+ export declare const IDJAG_AUTHORITY_CAVEAT = "idjag_authority";
89
+ /** The caveat recording the ID-JAG provenance (who asserted it, for whom, by whom, when). */
90
+ export declare const IDJAG_PROVENANCE_CAVEAT = "idjag_provenance";
91
+ /** A capability caveat whose `scopes` ARE the root capability's authority. */
92
+ export interface IdJagAuthorityCaveat extends Caveat {
93
+ type: typeof IDJAG_AUTHORITY_CAVEAT;
94
+ /** The delegated scopes — the authority of the root capability. */
95
+ scopes: string[];
96
+ /** The single resource audience the authority is for. */
97
+ aud: string;
98
+ }
99
+ /** A capability caveat recording the ID-JAG this root capability was projected from. */
100
+ export interface IdJagProvenanceCaveat extends Caveat {
101
+ type: typeof IDJAG_PROVENANCE_CAVEAT;
102
+ /** The IdP that asserted the grant. */
103
+ iss: string;
104
+ /** The human subject. */
105
+ sub: string;
106
+ /** The agent (`act.sub`) the grant authorized. */
107
+ agent: string;
108
+ /** The single resource audience. */
109
+ aud: string;
110
+ /** Grant issued-at (epoch seconds). */
111
+ iat: number;
112
+ /** Grant expiry (epoch seconds). */
113
+ exp: number;
114
+ /** Grant JWT id, when present. */
115
+ jti?: string;
116
+ }
117
+ export interface IdJagToCapabilityOptions extends OidcPrincipalOptions {
118
+ /** The principal (human root) Ed25519 secret key that signs the root capability. */
119
+ principalSecret: Uint8Array;
120
+ /**
121
+ * The b64u Ed25519 principal (human root) public key the chain roots at. When the ID-JAG binds a `cnf`
122
+ * Ed25519 key, this MUST equal it (checked by `oidcPrincipal`), else a mismatch throws (fail closed).
123
+ */
124
+ principalPublic: string;
125
+ /** The b64u Ed25519 key the capability is bound to — the AGENT (`act`) holder. */
126
+ holder: string;
127
+ /** Optional per-hop signature suite for the root (default ed25519). */
128
+ suite?: CapSuiteOpts;
129
+ /** Optional extra caveats appended after the authority / provenance / subject caveats. */
130
+ extraCaveats?: Caveat[];
131
+ }
132
+ export interface IdJagCapabilityResult {
133
+ /** The signed root capability: authority = scopes, holder = agent, subject = human. */
134
+ capability: Capability;
135
+ /** The PCA principal descriptor derived from the grant. */
136
+ principal: OidcPrincipal;
137
+ /** The delegated scopes, == the authority caveat's scopes. */
138
+ scopes: string[];
139
+ }
140
+ /**
141
+ * Project a verified ID-JAG onto a signed PCA ROOT capability:
142
+ * - authority = the grant's scopes (an {@link IdJagAuthorityCaveat});
143
+ * - holder = the agent (`act`) — `opts.holder`, the agent's PCA key;
144
+ * - subject = the human (`sub`) — recorded by the OIDC `oidc_subject` caveat;
145
+ * - provenance= an {@link IdJagProvenanceCaveat} recording iss/sub/agent/aud/iat/exp/jti.
146
+ *
147
+ * The capability is rooted at `opts.principalPublic` (the human's root key) and signed by
148
+ * `opts.principalSecret`, so it anchors straight into `verifyChain([capability, ...], principalPublic)`.
149
+ */
150
+ export declare function idJagToCapability(grant: IdJagGrant, opts: IdJagToCapabilityOptions): IdJagCapabilityResult;
151
+ /** Narrowing guard for an {@link IdJagAuthorityCaveat}. */
152
+ export declare function isIdJagAuthorityCaveat(cv: unknown): cv is IdJagAuthorityCaveat;
153
+ /** Narrowing guard for an {@link IdJagProvenanceCaveat}. */
154
+ export declare function isIdJagProvenanceCaveat(cv: unknown): cv is IdJagProvenanceCaveat;
155
+ /** Read the {@link IdJagAuthorityCaveat} from a root capability, or null if absent/malformed. */
156
+ export declare function readIdJagAuthority(cap: Capability): IdJagAuthorityCaveat | null;
157
+ /** Read the {@link IdJagProvenanceCaveat} from a root capability, or null if absent/malformed. */
158
+ export declare function readIdJagProvenance(cap: Capability): IdJagProvenanceCaveat | null;
159
+ /** RFC 8693 token-exchange grant type. */
160
+ export declare const GRANT_TYPE_TOKEN_EXCHANGE = "urn:ietf:params:oauth:grant-type:token-exchange";
161
+ /** RFC 7523 JWT-bearer grant type (redeem an assertion for an access token). */
162
+ export declare const GRANT_TYPE_JWT_BEARER = "urn:ietf:params:oauth:grant-type:jwt-bearer";
163
+ /** The ID-JAG requested-token-type (draft-ietf-oauth-identity-assertion-authz-grant). */
164
+ export declare const TOKEN_TYPE_ID_JAG = "urn:ietf:params:oauth:token-type:id-jag";
165
+ /** RFC 8693 `id_token` token type. */
166
+ export declare const TOKEN_TYPE_ID_TOKEN = "urn:ietf:params:oauth:token-type:id_token";
167
+ /** RFC 8693 `access_token` token type. */
168
+ export declare const TOKEN_TYPE_ACCESS_TOKEN = "urn:ietf:params:oauth:token-type:access_token";
169
+ /** RFC 8693 generic `jwt` token type. */
170
+ export declare const TOKEN_TYPE_JWT = "urn:ietf:params:oauth:token-type:jwt";
171
+ /** RFC 7523 client-assertion type (for authenticating the client with a JWT). */
172
+ export declare const CLIENT_ASSERTION_TYPE_JWT_BEARER = "urn:ietf:params:oauth:client-assertion-type:jwt-bearer";
173
+ /** A ready-to-send `application/x-www-form-urlencoded` OAuth POST. */
174
+ export interface OAuthFormRequest {
175
+ /** The token endpoint to POST to. */
176
+ url: string;
177
+ method: 'POST';
178
+ headers: Record<string, string>;
179
+ /** The form fields (empty values dropped). */
180
+ params: Record<string, string>;
181
+ /** The url-encoded request body (`params` serialized). */
182
+ body: string;
183
+ }
184
+ export interface TokenExchangeRequestOptions {
185
+ /** The IdP token endpoint the exchange is POSTed to. */
186
+ tokenEndpoint: string;
187
+ /** The subject token being exchanged (e.g. the end-user's ID token). */
188
+ subjectToken: string;
189
+ /** The subject token type (default `urn:...:id_token`). */
190
+ subjectTokenType?: string;
191
+ /** An optional actor token (the agent app's own token), when delegating. */
192
+ actorToken?: string;
193
+ /** The actor token type (default `urn:...:jwt` when `actorToken` is present). */
194
+ actorTokenType?: string;
195
+ /** The logical name of the target resource app the ID-JAG is FOR (RFC 8693 `audience`). */
196
+ audience?: string;
197
+ /** The resource URI the ID-JAG is for (RFC 8693 `resource`). */
198
+ resource?: string;
199
+ /** The scopes to request (string or array). */
200
+ scope?: string | string[];
201
+ /** The requested token type (default the ID-JAG type). */
202
+ requestedTokenType?: string;
203
+ /** The requesting client id (the agent app). */
204
+ clientId?: string;
205
+ /** Extra form fields to merge in. */
206
+ extra?: Record<string, string>;
207
+ }
208
+ /**
209
+ * Build the RFC 8693 token-exchange request that OBTAINS an ID-JAG from the IdP (the first XAA leg): the
210
+ * requesting app presents the user's subject token and asks the IdP to mint an ID-JAG for a single target
211
+ * resource app. Defaults `requested_token_type` to the ID-JAG type and `subject_token_type` to `id_token`.
212
+ */
213
+ export declare function tokenExchangeRequest(opts: TokenExchangeRequestOptions): OAuthFormRequest;
214
+ export interface JwtBearerAssertionOptions {
215
+ /** The target resource app's token endpoint the assertion is REDEEMED at. */
216
+ tokenEndpoint: string;
217
+ /** The assertion being presented — typically the ID-JAG obtained from the IdP. */
218
+ assertion: string;
219
+ /** The scopes to request at the resource app (string or array). */
220
+ scope?: string | string[];
221
+ /** The redeeming client id (the agent app). */
222
+ clientId?: string;
223
+ /** An optional RFC 7523 client-assertion JWT, to authenticate the client. */
224
+ clientAssertion?: string;
225
+ /** Extra form fields to merge in. */
226
+ extra?: Record<string, string>;
227
+ }
228
+ /** The structured RFC 7523 jwt-bearer representation of an ID-JAG being redeemed. */
229
+ export interface JwtBearerAssertion {
230
+ grantType: typeof GRANT_TYPE_JWT_BEARER;
231
+ /** The assertion (the ID-JAG). */
232
+ assertion: string;
233
+ /** The requested scopes, space-delimited (when any). */
234
+ scope?: string;
235
+ /** The ready-to-send token request that redeems the assertion. */
236
+ request: OAuthFormRequest;
237
+ }
238
+ /**
239
+ * Build the RFC 7523 jwt-bearer representation + request that REDEEMS an ID-JAG at the target resource
240
+ * app's token endpoint for an access token (the second XAA leg): `grant_type=...:jwt-bearer` with the
241
+ * ID-JAG as the `assertion`. Pass `clientAssertion` to additionally authenticate the client with a JWT.
242
+ */
243
+ export declare function jwtBearerAssertion(opts: JwtBearerAssertionOptions): JwtBearerAssertion;
244
+ export type { OidcPrincipal, OidcPrincipalOptions, OidcConfirmation, OidcVerifyKey } from '@atlasauth/pca-oidc';
package/dist/index.js ADDED
@@ -0,0 +1,362 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CLIENT_ASSERTION_TYPE_JWT_BEARER = exports.TOKEN_TYPE_JWT = exports.TOKEN_TYPE_ACCESS_TOKEN = exports.TOKEN_TYPE_ID_TOKEN = exports.TOKEN_TYPE_ID_JAG = exports.GRANT_TYPE_JWT_BEARER = exports.GRANT_TYPE_TOKEN_EXCHANGE = exports.IDJAG_PROVENANCE_CAVEAT = exports.IDJAG_AUTHORITY_CAVEAT = exports.IdJagVerificationError = void 0;
4
+ exports.verifyIdJag = verifyIdJag;
5
+ exports.idJagToPcaPrincipal = idJagToPcaPrincipal;
6
+ exports.idJagToCapability = idJagToCapability;
7
+ exports.isIdJagAuthorityCaveat = isIdJagAuthorityCaveat;
8
+ exports.isIdJagProvenanceCaveat = isIdJagProvenanceCaveat;
9
+ exports.readIdJagAuthority = readIdJagAuthority;
10
+ exports.readIdJagProvenance = readIdJagProvenance;
11
+ exports.tokenExchangeRequest = tokenExchangeRequest;
12
+ exports.jwtBearerAssertion = jwtBearerAssertion;
13
+ /**
14
+ * `@atlasauth/pca-idjag` — an ID-JAG / OAuth Cross-App-Access (XAA) bridge for Proof-Carrying Authority.
15
+ *
16
+ * ID-JAG is the Identity Assertion Authorization Grant of
17
+ * {@link https://datatracker.ietf.org/doc/draft-ietf-oauth-identity-assertion-authz-grant/ | draft-ietf-oauth-identity-assertion-authz-grant}
18
+ * (the standards-track form of Okta's "Cross-App Access"). An ID-JAG is a JWT the enterprise IdP mints so
19
+ * one app may act, on a named user's behalf, against ANOTHER app — scoped, time-boxed, single-audience:
20
+ *
21
+ * iss — the IdP that asserts the grant
22
+ * sub — the HUMAN the grant is about
23
+ * act — the AGENT/app doing the acting (RFC 8693 actor claim, `{ sub: "<agent>" , ... }`)
24
+ * aud — the SINGLE resource app the grant is for
25
+ * scope— the authority being delegated
26
+ *
27
+ * That is exactly PCA's principal model: a human subject, an agent holder, a single audience, a scoped
28
+ * authority. This package verifies an ID-JAG and projects it onto a PCA principal + a signed root
29
+ * capability, so PCA drops into an Okta/Entra enterprise stack as the action verifier. It also builds the
30
+ * two OAuth request shapes the XAA flow uses — RFC 8693 token-exchange (to OBTAIN an ID-JAG) and RFC 7523
31
+ * jwt-bearer (to REDEEM one) — so PCA can both consume and participate in the flow.
32
+ *
33
+ * Verification REUSES `@atlasauth/pca-oidc`: `verifyIdToken` performs every crypto + registered-claim check
34
+ * (signature, `iss`, `aud`, `exp`, `iat`, `nonce`, injectable JWKS), and `oidcPrincipal` performs the
35
+ * identity → PCA-principal mapping. This module adds only the ID-JAG-specific rules (single audience, the
36
+ * required `act` agent claim, scope parsing) and the capability projection.
37
+ */
38
+ const jose_1 = require("jose");
39
+ const pca_oidc_1 = require("@atlasauth/pca-oidc");
40
+ const pca_1 = require("@atlasauth/pca");
41
+ /** The error thrown for any ID-JAG verification failure. `code` classifies the cause. */
42
+ class IdJagVerificationError extends Error {
43
+ name = 'IdJagVerificationError';
44
+ code;
45
+ constructor(code, message, options) {
46
+ super(message, options);
47
+ this.code = code;
48
+ }
49
+ }
50
+ exports.IdJagVerificationError = IdJagVerificationError;
51
+ /**
52
+ * Verify an ID-JAG JWT and return the parsed grant. Fails CLOSED: any signature / issuer / audience /
53
+ * expiry / nonce failure, a missing or malformed `act` agent claim, a missing `scope`, or a missing
54
+ * required scope throws {@link IdJagVerificationError}. The JWKS is injectable (`key` / `jwksUri` /
55
+ * `discover`); `key` lets tests verify entirely in-memory.
56
+ */
57
+ async function verifyIdJag(jwt, opts) {
58
+ if (typeof jwt !== 'string' || jwt.length === 0) {
59
+ throw new IdJagVerificationError('invalid_token', 'verifyIdJag: jwt must be a non-empty string');
60
+ }
61
+ if (opts === null || typeof opts !== 'object') {
62
+ throw new IdJagVerificationError('config', 'verifyIdJag: opts is required');
63
+ }
64
+ if (typeof opts.issuer !== 'string' || opts.issuer.length === 0) {
65
+ throw new IdJagVerificationError('config', 'verifyIdJag: opts.issuer is required');
66
+ }
67
+ if (typeof opts.audience !== 'string' || opts.audience.length === 0) {
68
+ throw new IdJagVerificationError('config', 'verifyIdJag: opts.audience is required (ID-JAG is single-audience)');
69
+ }
70
+ // Reuse the OIDC verifier for every crypto + registered-claim check. It maps each jose failure onto a
71
+ // stable OIDC code; we re-wrap as an ID-JAG error preserving that code so callers see one error family.
72
+ let base;
73
+ try {
74
+ base = await (0, pca_oidc_1.verifyIdToken)(jwt, {
75
+ issuer: opts.issuer,
76
+ audience: opts.audience,
77
+ ...(opts.nonce !== undefined ? { nonce: opts.nonce } : {}),
78
+ ...(opts.clockToleranceSec !== undefined ? { clockToleranceSec: opts.clockToleranceSec } : {}),
79
+ ...(opts.maxTokenAgeSec !== undefined ? { maxTokenAgeSec: opts.maxTokenAgeSec } : {}),
80
+ ...(opts.algorithms !== undefined ? { algorithms: opts.algorithms } : {}),
81
+ ...(opts.key !== undefined ? { key: opts.key } : {}),
82
+ ...(opts.jwksUri !== undefined ? { jwksUri: opts.jwksUri } : {}),
83
+ ...(opts.discover !== undefined ? { discover: opts.discover } : {}),
84
+ ...(opts.fetch !== undefined ? { fetch: opts.fetch } : {}),
85
+ });
86
+ }
87
+ catch (cause) {
88
+ if (cause instanceof pca_oidc_1.OidcVerificationError) {
89
+ throw new IdJagVerificationError(cause.code, cause.message, { cause });
90
+ }
91
+ throw new IdJagVerificationError('invalid_token', 'ID-JAG verification failed', { cause });
92
+ }
93
+ // ID-JAG is SINGLE-AUDIENCE: the resource app must be the sole aud. `verifyIdToken` already confirmed the
94
+ // expected audience is PRESENT; here we additionally reject any extra audience (a multi-aud grant).
95
+ const audList = Array.isArray(base.aud) ? base.aud : [base.aud];
96
+ if (audList.length !== 1 || audList[0] !== opts.audience) {
97
+ throw new IdJagVerificationError('audience', 'ID-JAG must carry exactly one audience equal to the resource app (single-audience grant)');
98
+ }
99
+ // The signature is verified, so the payload is authentic: decode it to read the non-OIDC claims
100
+ // (`act`, `scope`, `jti`) that the OIDC claim projection does not surface.
101
+ let raw;
102
+ try {
103
+ raw = (0, jose_1.decodeJwt)(jwt);
104
+ }
105
+ catch (cause) {
106
+ throw new IdJagVerificationError('invalid_token', 'ID-JAG payload could not be decoded', { cause });
107
+ }
108
+ const actor = asActor(raw.act);
109
+ if (actor === undefined) {
110
+ throw new IdJagVerificationError('actor', 'ID-JAG is missing a well-formed "act" (agent) claim with a string "sub"');
111
+ }
112
+ const scopes = parseScopes(raw.scope, raw.scopes);
113
+ if (scopes === undefined) {
114
+ throw new IdJagVerificationError('scope', 'ID-JAG is missing the "scope" (or "scopes") claim');
115
+ }
116
+ if (Array.isArray(opts.requiredScopes)) {
117
+ const have = new Set(scopes);
118
+ for (const req of opts.requiredScopes) {
119
+ if (!have.has(req)) {
120
+ throw new IdJagVerificationError('scope', `ID-JAG does not grant the required scope "${req}"`);
121
+ }
122
+ }
123
+ }
124
+ const jti = typeof raw.jti === 'string' && raw.jti.length > 0 ? raw.jti : undefined;
125
+ return {
126
+ iss: base.iss,
127
+ sub: base.sub,
128
+ actor,
129
+ agent: actor.sub,
130
+ audience: opts.audience,
131
+ scopes,
132
+ iat: base.iat,
133
+ exp: base.exp,
134
+ ...(jti !== undefined ? { jti } : {}),
135
+ ...(base.nonce !== undefined ? { nonce: base.nonce } : {}),
136
+ ...(base.cnf !== undefined ? { cnf: base.cnf } : {}),
137
+ oidcClaims: base,
138
+ };
139
+ }
140
+ function asActor(v) {
141
+ if (v === null || typeof v !== 'object' || Array.isArray(v))
142
+ return undefined;
143
+ const rec = v;
144
+ const sub = rec.sub;
145
+ if (typeof sub !== 'string' || sub.length === 0)
146
+ return undefined;
147
+ return { ...rec, sub };
148
+ }
149
+ /** Parse the delegated authority from the `scope` (space-delimited string or array) / `scopes` claim. */
150
+ function parseScopes(scope, scopes) {
151
+ if (typeof scope === 'string')
152
+ return scope.split(/\s+/).filter((s) => s.length > 0);
153
+ if (Array.isArray(scope))
154
+ return scope.filter((s) => typeof s === 'string' && s.length > 0);
155
+ if (Array.isArray(scopes))
156
+ return scopes.filter((s) => typeof s === 'string' && s.length > 0);
157
+ return undefined;
158
+ }
159
+ // ---------------------------------------------------------------------------------------------------
160
+ // ID-JAG → PCA principal / capability
161
+ // ---------------------------------------------------------------------------------------------------
162
+ /**
163
+ * Map a verified ID-JAG onto a PCA principal descriptor (the ROOT of a capability chain). Delegates to
164
+ * `@atlasauth/pca-oidc`'s `oidcPrincipal` on the grant's OIDC base claims, so the human `iss`+`sub` becomes
165
+ * a stable `principalId`, a signed `oidc_subject` caveat, and — when the grant binds a `cnf` Ed25519 key or
166
+ * the caller supplies one via `opts.principalPublic` — the b64u Ed25519 key the chain roots at.
167
+ */
168
+ function idJagToPcaPrincipal(grant, opts = {}) {
169
+ if (grant === null || typeof grant !== 'object')
170
+ throw new TypeError('idJagToPcaPrincipal: grant is required');
171
+ return (0, pca_oidc_1.oidcPrincipal)(grant.oidcClaims, opts);
172
+ }
173
+ /** The caveat recording the authority (scopes + audience) delegated by an ID-JAG. */
174
+ exports.IDJAG_AUTHORITY_CAVEAT = 'idjag_authority';
175
+ /** The caveat recording the ID-JAG provenance (who asserted it, for whom, by whom, when). */
176
+ exports.IDJAG_PROVENANCE_CAVEAT = 'idjag_provenance';
177
+ /**
178
+ * Project a verified ID-JAG onto a signed PCA ROOT capability:
179
+ * - authority = the grant's scopes (an {@link IdJagAuthorityCaveat});
180
+ * - holder = the agent (`act`) — `opts.holder`, the agent's PCA key;
181
+ * - subject = the human (`sub`) — recorded by the OIDC `oidc_subject` caveat;
182
+ * - provenance= an {@link IdJagProvenanceCaveat} recording iss/sub/agent/aud/iat/exp/jti.
183
+ *
184
+ * The capability is rooted at `opts.principalPublic` (the human's root key) and signed by
185
+ * `opts.principalSecret`, so it anchors straight into `verifyChain([capability, ...], principalPublic)`.
186
+ */
187
+ function idJagToCapability(grant, opts) {
188
+ if (grant === null || typeof grant !== 'object')
189
+ throw new TypeError('idJagToCapability: grant is required');
190
+ if (opts === null || typeof opts !== 'object')
191
+ throw new TypeError('idJagToCapability: opts is required');
192
+ if (!(opts.principalSecret instanceof Uint8Array)) {
193
+ throw new TypeError('idJagToCapability: opts.principalSecret must be a Uint8Array');
194
+ }
195
+ if (typeof opts.principalPublic !== 'string' || opts.principalPublic.length === 0) {
196
+ throw new TypeError('idJagToCapability: opts.principalPublic is required');
197
+ }
198
+ if (typeof opts.holder !== 'string' || opts.holder.length === 0) {
199
+ throw new TypeError('idJagToCapability: opts.holder (the agent key) is required');
200
+ }
201
+ // Derive the principal — this also validates principalPublic against the grant's cnf key when present.
202
+ const principal = idJagToPcaPrincipal(grant, { principalPublic: opts.principalPublic });
203
+ const authority = {
204
+ type: exports.IDJAG_AUTHORITY_CAVEAT,
205
+ scopes: [...grant.scopes],
206
+ aud: grant.audience,
207
+ };
208
+ const provenance = {
209
+ type: exports.IDJAG_PROVENANCE_CAVEAT,
210
+ iss: grant.iss,
211
+ sub: grant.sub,
212
+ agent: grant.agent,
213
+ aud: grant.audience,
214
+ iat: grant.iat,
215
+ exp: grant.exp,
216
+ ...(grant.jti !== undefined ? { jti: grant.jti } : {}),
217
+ };
218
+ const caveats = [authority, provenance, principal.subjectCaveat, ...(opts.extraCaveats ?? [])];
219
+ const capability = (0, pca_1.mintRoot)({
220
+ principalSecret: opts.principalSecret,
221
+ principalPublic: opts.principalPublic,
222
+ holder: opts.holder,
223
+ caveats,
224
+ ...(opts.suite !== undefined ? { suite: opts.suite } : {}),
225
+ });
226
+ return { capability, principal, scopes: [...grant.scopes] };
227
+ }
228
+ /** Narrowing guard for an {@link IdJagAuthorityCaveat}. */
229
+ function isIdJagAuthorityCaveat(cv) {
230
+ if (cv === null || typeof cv !== 'object')
231
+ return false;
232
+ const rec = cv;
233
+ return (rec.type === exports.IDJAG_AUTHORITY_CAVEAT &&
234
+ Array.isArray(rec.scopes) &&
235
+ rec.scopes.every((s) => typeof s === 'string') &&
236
+ typeof rec.aud === 'string' &&
237
+ rec.aud.length > 0);
238
+ }
239
+ /** Narrowing guard for an {@link IdJagProvenanceCaveat}. */
240
+ function isIdJagProvenanceCaveat(cv) {
241
+ if (cv === null || typeof cv !== 'object')
242
+ return false;
243
+ const rec = cv;
244
+ return (rec.type === exports.IDJAG_PROVENANCE_CAVEAT &&
245
+ typeof rec.iss === 'string' &&
246
+ typeof rec.sub === 'string' &&
247
+ typeof rec.agent === 'string' &&
248
+ typeof rec.aud === 'string' &&
249
+ typeof rec.iat === 'number' &&
250
+ typeof rec.exp === 'number');
251
+ }
252
+ /** Read the {@link IdJagAuthorityCaveat} from a root capability, or null if absent/malformed. */
253
+ function readIdJagAuthority(cap) {
254
+ const cv = cap?.caveats?.find((c) => c?.type === exports.IDJAG_AUTHORITY_CAVEAT);
255
+ return cv !== undefined && isIdJagAuthorityCaveat(cv) ? cv : null;
256
+ }
257
+ /** Read the {@link IdJagProvenanceCaveat} from a root capability, or null if absent/malformed. */
258
+ function readIdJagProvenance(cap) {
259
+ const cv = cap?.caveats?.find((c) => c?.type === exports.IDJAG_PROVENANCE_CAVEAT);
260
+ return cv !== undefined && isIdJagProvenanceCaveat(cv) ? cv : null;
261
+ }
262
+ // ---------------------------------------------------------------------------------------------------
263
+ // XAA flow: RFC 8693 token-exchange + RFC 7523 jwt-bearer request shapes
264
+ // ---------------------------------------------------------------------------------------------------
265
+ /** RFC 8693 token-exchange grant type. */
266
+ exports.GRANT_TYPE_TOKEN_EXCHANGE = 'urn:ietf:params:oauth:grant-type:token-exchange';
267
+ /** RFC 7523 JWT-bearer grant type (redeem an assertion for an access token). */
268
+ exports.GRANT_TYPE_JWT_BEARER = 'urn:ietf:params:oauth:grant-type:jwt-bearer';
269
+ /** The ID-JAG requested-token-type (draft-ietf-oauth-identity-assertion-authz-grant). */
270
+ exports.TOKEN_TYPE_ID_JAG = 'urn:ietf:params:oauth:token-type:id-jag';
271
+ /** RFC 8693 `id_token` token type. */
272
+ exports.TOKEN_TYPE_ID_TOKEN = 'urn:ietf:params:oauth:token-type:id_token';
273
+ /** RFC 8693 `access_token` token type. */
274
+ exports.TOKEN_TYPE_ACCESS_TOKEN = 'urn:ietf:params:oauth:token-type:access_token';
275
+ /** RFC 8693 generic `jwt` token type. */
276
+ exports.TOKEN_TYPE_JWT = 'urn:ietf:params:oauth:token-type:jwt';
277
+ /** RFC 7523 client-assertion type (for authenticating the client with a JWT). */
278
+ exports.CLIENT_ASSERTION_TYPE_JWT_BEARER = 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer';
279
+ function formRequest(url, params) {
280
+ const clean = {};
281
+ for (const [k, v] of Object.entries(params)) {
282
+ if (typeof v === 'string' && v.length > 0)
283
+ clean[k] = v;
284
+ }
285
+ const search = new URLSearchParams(clean);
286
+ return {
287
+ url,
288
+ method: 'POST',
289
+ headers: { 'content-type': 'application/x-www-form-urlencoded', accept: 'application/json' },
290
+ params: clean,
291
+ body: search.toString(),
292
+ };
293
+ }
294
+ /** Normalize a `scope` string or array to the space-delimited OAuth `scope` form, or undefined if empty. */
295
+ function scopeParam(scope) {
296
+ if (scope === undefined)
297
+ return undefined;
298
+ const parts = (Array.isArray(scope) ? scope : scope.split(/\s+/)).filter((s) => typeof s === 'string' && s.length > 0);
299
+ return parts.length > 0 ? parts.join(' ') : undefined;
300
+ }
301
+ /**
302
+ * Build the RFC 8693 token-exchange request that OBTAINS an ID-JAG from the IdP (the first XAA leg): the
303
+ * requesting app presents the user's subject token and asks the IdP to mint an ID-JAG for a single target
304
+ * resource app. Defaults `requested_token_type` to the ID-JAG type and `subject_token_type` to `id_token`.
305
+ */
306
+ function tokenExchangeRequest(opts) {
307
+ if (opts === null || typeof opts !== 'object')
308
+ throw new TypeError('tokenExchangeRequest: opts is required');
309
+ if (typeof opts.tokenEndpoint !== 'string' || opts.tokenEndpoint.length === 0) {
310
+ throw new TypeError('tokenExchangeRequest: opts.tokenEndpoint is required');
311
+ }
312
+ if (typeof opts.subjectToken !== 'string' || opts.subjectToken.length === 0) {
313
+ throw new TypeError('tokenExchangeRequest: opts.subjectToken is required');
314
+ }
315
+ const hasActor = typeof opts.actorToken === 'string' && opts.actorToken.length > 0;
316
+ return formRequest(opts.tokenEndpoint, {
317
+ grant_type: exports.GRANT_TYPE_TOKEN_EXCHANGE,
318
+ subject_token: opts.subjectToken,
319
+ subject_token_type: opts.subjectTokenType ?? exports.TOKEN_TYPE_ID_TOKEN,
320
+ requested_token_type: opts.requestedTokenType ?? exports.TOKEN_TYPE_ID_JAG,
321
+ ...(opts.audience !== undefined ? { audience: opts.audience } : {}),
322
+ ...(opts.resource !== undefined ? { resource: opts.resource } : {}),
323
+ ...(scopeParam(opts.scope) !== undefined ? { scope: scopeParam(opts.scope) } : {}),
324
+ ...(hasActor ? { actor_token: opts.actorToken, actor_token_type: opts.actorTokenType ?? exports.TOKEN_TYPE_JWT } : {}),
325
+ ...(opts.clientId !== undefined ? { client_id: opts.clientId } : {}),
326
+ ...(opts.extra ?? {}),
327
+ });
328
+ }
329
+ /**
330
+ * Build the RFC 7523 jwt-bearer representation + request that REDEEMS an ID-JAG at the target resource
331
+ * app's token endpoint for an access token (the second XAA leg): `grant_type=...:jwt-bearer` with the
332
+ * ID-JAG as the `assertion`. Pass `clientAssertion` to additionally authenticate the client with a JWT.
333
+ */
334
+ function jwtBearerAssertion(opts) {
335
+ if (opts === null || typeof opts !== 'object')
336
+ throw new TypeError('jwtBearerAssertion: opts is required');
337
+ if (typeof opts.tokenEndpoint !== 'string' || opts.tokenEndpoint.length === 0) {
338
+ throw new TypeError('jwtBearerAssertion: opts.tokenEndpoint is required');
339
+ }
340
+ if (typeof opts.assertion !== 'string' || opts.assertion.length === 0) {
341
+ throw new TypeError('jwtBearerAssertion: opts.assertion is required');
342
+ }
343
+ const scope = scopeParam(opts.scope);
344
+ const hasClientAssertion = typeof opts.clientAssertion === 'string' && opts.clientAssertion.length > 0;
345
+ const request = formRequest(opts.tokenEndpoint, {
346
+ grant_type: exports.GRANT_TYPE_JWT_BEARER,
347
+ assertion: opts.assertion,
348
+ ...(scope !== undefined ? { scope } : {}),
349
+ ...(opts.clientId !== undefined ? { client_id: opts.clientId } : {}),
350
+ ...(hasClientAssertion
351
+ ? { client_assertion_type: exports.CLIENT_ASSERTION_TYPE_JWT_BEARER, client_assertion: opts.clientAssertion }
352
+ : {}),
353
+ ...(opts.extra ?? {}),
354
+ });
355
+ return {
356
+ grantType: exports.GRANT_TYPE_JWT_BEARER,
357
+ assertion: opts.assertion,
358
+ ...(scope !== undefined ? { scope } : {}),
359
+ request,
360
+ };
361
+ }
362
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AA6HA,kCA0FC;AA4BD,kDAGC;AAsED,8CA0CC;AAGD,wDAUC;AAGD,0DAYC;AAGD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S,EAAE,IAAI,CAAC,SAAS;QACzB,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACzC,OAAO;KACR,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,59 @@
1
1
  {
2
2
  "name": "@atlasauth/pca-idjag",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.2.0",
4
+ "description": "ID-JAG / OAuth Cross-App-Access bridge for PCA: verify an identity-assertion authorization grant (sub=human, act=agent, scoped, single-audience) and map it to a PCA principal/capability; RFC 8693/7523 token-exchange.",
5
+ "keywords": [
6
+ "id-jag",
7
+ "cross app access",
8
+ "oauth",
9
+ "identity assertion",
10
+ "agent authorization",
11
+ "proof-carrying authority",
12
+ "pca",
13
+ "ai agents"
14
+ ],
15
+ "license": "MIT",
16
+ "homepage": "https://github.com/Atlas-Authorization/pca#readme",
17
+ "bugs": {
18
+ "url": "https://github.com/Atlas-Authorization/pca/issues"
19
+ },
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/Atlas-Authorization/pca.git",
23
+ "directory": "packages/pca-idjag"
24
+ },
25
+ "main": "./dist/index.js",
26
+ "types": "./dist/index.d.ts",
27
+ "exports": {
28
+ ".": {
29
+ "types": "./dist/index.d.ts",
30
+ "default": "./dist/index.js"
31
+ },
32
+ "./package.json": "./package.json"
33
+ },
34
+ "dependencies": {
35
+ "jose": "^5.9.6",
36
+ "@atlasauth/pca": "0.2.0",
37
+ "@atlasauth/pca-oidc": "0.2.0"
38
+ },
39
+ "devDependencies": {
40
+ "typescript": "^5.6.3",
41
+ "vitest": "^2.1.4"
42
+ },
43
+ "files": [
44
+ "dist",
45
+ "README.md",
46
+ "LICENSE"
47
+ ],
48
+ "engines": {
49
+ "node": ">=20"
50
+ },
51
+ "publishConfig": {
52
+ "access": "public"
53
+ },
54
+ "scripts": {
55
+ "build": "tsc -p tsconfig.build.json",
56
+ "typecheck": "tsc -p tsconfig.json --noEmit",
57
+ "test": "vitest run"
58
+ }
6
59
  }