@pymthouse/builder-sdk 0.4.5 → 0.4.6
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/dist/{client-GP-mTEI7.d.cts → client-CEBVgCD7.d.cts} +19 -1
- package/dist/{client-BhNz0ZAA.d.ts → client-D-p6v8ju.d.ts} +19 -1
- package/dist/env.cjs +24 -6
- package/dist/env.cjs.map +1 -1
- package/dist/env.d.cts +1 -1
- package/dist/env.d.ts +1 -1
- package/dist/env.js +24 -6
- package/dist/env.js.map +1 -1
- package/dist/index.cjs +24 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +24 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -58,6 +58,16 @@ declare class PmtHouseClient {
|
|
|
58
58
|
exchangeForSignerSession(input: {
|
|
59
59
|
userJwt: string;
|
|
60
60
|
resource?: string;
|
|
61
|
+
/**
|
|
62
|
+
* When true, omit the RFC 8707 `resource` parameter entirely. This selects
|
|
63
|
+
* the documented PymtHouse gateway/opaque signer-session exchange
|
|
64
|
+
* (long-lived `pmth_*` token) rather than the signer-JWT path that a
|
|
65
|
+
* `resource = issuer` indicator routes to. Takes precedence over
|
|
66
|
+
* {@link resource}.
|
|
67
|
+
*/
|
|
68
|
+
omitResource?: boolean;
|
|
69
|
+
/** Optional `scope` for the exchange (e.g. `sign:job`). Omitted when unset. */
|
|
70
|
+
scope?: string;
|
|
61
71
|
}): Promise<TokenExchangeResponse>;
|
|
62
72
|
/**
|
|
63
73
|
* Mint a short-lived per-user JWT with the Builder API, then exchange it for
|
|
@@ -115,7 +125,15 @@ declare class PmtHouseClient {
|
|
|
115
125
|
signal?: AbortSignal;
|
|
116
126
|
}): Promise<GetAppManifestResult>;
|
|
117
127
|
/**
|
|
118
|
-
* Upsert an external user, mint a short-lived JWT, and exchange for
|
|
128
|
+
* Upsert an external user, mint a short-lived JWT, and exchange it for a
|
|
129
|
+
* long-lived opaque (`pmth_*`) signer session.
|
|
130
|
+
*
|
|
131
|
+
* Performs the *documented* remote-signer-session exchange (see
|
|
132
|
+
* `builder-api.md` → "Remote signer session exchange"): the RFC 8693 token
|
|
133
|
+
* exchange is sent with `scope=sign:job` and **no `resource` indicator**,
|
|
134
|
+
* which selects the PymtHouse gateway/opaque path. A prior implementation set
|
|
135
|
+
* `resource = issuer`, which routed to the signer-JWT path and returned a JWT
|
|
136
|
+
* that {@link parseSignerSessionExchange} then rejected as non-opaque.
|
|
119
137
|
*/
|
|
120
138
|
mintSignerSessionForExternalUser(input: MintSignerSessionForExternalUserInput): Promise<SignerSessionToken>;
|
|
121
139
|
/**
|
|
@@ -58,6 +58,16 @@ declare class PmtHouseClient {
|
|
|
58
58
|
exchangeForSignerSession(input: {
|
|
59
59
|
userJwt: string;
|
|
60
60
|
resource?: string;
|
|
61
|
+
/**
|
|
62
|
+
* When true, omit the RFC 8707 `resource` parameter entirely. This selects
|
|
63
|
+
* the documented PymtHouse gateway/opaque signer-session exchange
|
|
64
|
+
* (long-lived `pmth_*` token) rather than the signer-JWT path that a
|
|
65
|
+
* `resource = issuer` indicator routes to. Takes precedence over
|
|
66
|
+
* {@link resource}.
|
|
67
|
+
*/
|
|
68
|
+
omitResource?: boolean;
|
|
69
|
+
/** Optional `scope` for the exchange (e.g. `sign:job`). Omitted when unset. */
|
|
70
|
+
scope?: string;
|
|
61
71
|
}): Promise<TokenExchangeResponse>;
|
|
62
72
|
/**
|
|
63
73
|
* Mint a short-lived per-user JWT with the Builder API, then exchange it for
|
|
@@ -115,7 +125,15 @@ declare class PmtHouseClient {
|
|
|
115
125
|
signal?: AbortSignal;
|
|
116
126
|
}): Promise<GetAppManifestResult>;
|
|
117
127
|
/**
|
|
118
|
-
* Upsert an external user, mint a short-lived JWT, and exchange for
|
|
128
|
+
* Upsert an external user, mint a short-lived JWT, and exchange it for a
|
|
129
|
+
* long-lived opaque (`pmth_*`) signer session.
|
|
130
|
+
*
|
|
131
|
+
* Performs the *documented* remote-signer-session exchange (see
|
|
132
|
+
* `builder-api.md` → "Remote signer session exchange"): the RFC 8693 token
|
|
133
|
+
* exchange is sent with `scope=sign:job` and **no `resource` indicator**,
|
|
134
|
+
* which selects the PymtHouse gateway/opaque path. A prior implementation set
|
|
135
|
+
* `resource = issuer`, which routed to the signer-JWT path and returned a JWT
|
|
136
|
+
* that {@link parseSignerSessionExchange} then rejected as non-opaque.
|
|
119
137
|
*/
|
|
120
138
|
mintSignerSessionForExternalUser(input: MintSignerSessionForExternalUserInput): Promise<SignerSessionToken>;
|
|
121
139
|
/**
|
package/dist/env.cjs
CHANGED
|
@@ -1226,8 +1226,13 @@ var PmtHouseClient = class {
|
|
|
1226
1226
|
params.set("subject_token", input.userJwt);
|
|
1227
1227
|
params.set("subject_token_type", SUBJECT_ACCESS_TOKEN_TYPE2);
|
|
1228
1228
|
params.set("requested_token_type", REQUESTED_ACCESS_TOKEN_TYPE);
|
|
1229
|
-
|
|
1230
|
-
|
|
1229
|
+
if (typeof input.scope === "string" && input.scope.trim() !== "") {
|
|
1230
|
+
params.set("scope", input.scope.trim());
|
|
1231
|
+
}
|
|
1232
|
+
if (!input.omitResource) {
|
|
1233
|
+
const resourceCandidate = typeof input.resource === "string" && input.resource.trim() !== "" ? input.resource.trim() : this.issuerUrl;
|
|
1234
|
+
params.set("resource", stripTrailingSlashes(resourceCandidate));
|
|
1235
|
+
}
|
|
1231
1236
|
try {
|
|
1232
1237
|
const response = await oauth4webapi.genericTokenEndpointRequest(
|
|
1233
1238
|
as,
|
|
@@ -1513,18 +1518,31 @@ var PmtHouseClient = class {
|
|
|
1513
1518
|
};
|
|
1514
1519
|
}
|
|
1515
1520
|
/**
|
|
1516
|
-
* Upsert an external user, mint a short-lived JWT, and exchange for
|
|
1521
|
+
* Upsert an external user, mint a short-lived JWT, and exchange it for a
|
|
1522
|
+
* long-lived opaque (`pmth_*`) signer session.
|
|
1523
|
+
*
|
|
1524
|
+
* Performs the *documented* remote-signer-session exchange (see
|
|
1525
|
+
* `builder-api.md` → "Remote signer session exchange"): the RFC 8693 token
|
|
1526
|
+
* exchange is sent with `scope=sign:job` and **no `resource` indicator**,
|
|
1527
|
+
* which selects the PymtHouse gateway/opaque path. A prior implementation set
|
|
1528
|
+
* `resource = issuer`, which routed to the signer-JWT path and returned a JWT
|
|
1529
|
+
* that {@link parseSignerSessionExchange} then rejected as non-opaque.
|
|
1517
1530
|
*/
|
|
1518
1531
|
async mintSignerSessionForExternalUser(input) {
|
|
1532
|
+
const scope = input.scope ?? SIGN_JOB_SCOPE;
|
|
1519
1533
|
await this.upsertAppUser({
|
|
1520
1534
|
externalUserId: input.externalUserId,
|
|
1521
1535
|
email: input.email,
|
|
1522
1536
|
status: "active"
|
|
1523
1537
|
});
|
|
1524
|
-
const
|
|
1538
|
+
const userToken = await this.mintUserAccessToken({
|
|
1525
1539
|
externalUserId: input.externalUserId,
|
|
1526
|
-
scope
|
|
1527
|
-
|
|
1540
|
+
scope
|
|
1541
|
+
});
|
|
1542
|
+
const exchange = await this.exchangeForSignerSession({
|
|
1543
|
+
userJwt: userToken.access_token,
|
|
1544
|
+
omitResource: true,
|
|
1545
|
+
scope
|
|
1528
1546
|
});
|
|
1529
1547
|
return parseSignerSessionExchange(exchange);
|
|
1530
1548
|
}
|