@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
package/dist/env.d.cts
CHANGED
package/dist/env.d.ts
CHANGED
package/dist/env.js
CHANGED
|
@@ -1224,8 +1224,13 @@ var PmtHouseClient = class {
|
|
|
1224
1224
|
params.set("subject_token", input.userJwt);
|
|
1225
1225
|
params.set("subject_token_type", SUBJECT_ACCESS_TOKEN_TYPE2);
|
|
1226
1226
|
params.set("requested_token_type", REQUESTED_ACCESS_TOKEN_TYPE);
|
|
1227
|
-
|
|
1228
|
-
|
|
1227
|
+
if (typeof input.scope === "string" && input.scope.trim() !== "") {
|
|
1228
|
+
params.set("scope", input.scope.trim());
|
|
1229
|
+
}
|
|
1230
|
+
if (!input.omitResource) {
|
|
1231
|
+
const resourceCandidate = typeof input.resource === "string" && input.resource.trim() !== "" ? input.resource.trim() : this.issuerUrl;
|
|
1232
|
+
params.set("resource", stripTrailingSlashes(resourceCandidate));
|
|
1233
|
+
}
|
|
1229
1234
|
try {
|
|
1230
1235
|
const response = await genericTokenEndpointRequest(
|
|
1231
1236
|
as,
|
|
@@ -1511,18 +1516,31 @@ var PmtHouseClient = class {
|
|
|
1511
1516
|
};
|
|
1512
1517
|
}
|
|
1513
1518
|
/**
|
|
1514
|
-
* Upsert an external user, mint a short-lived JWT, and exchange for
|
|
1519
|
+
* Upsert an external user, mint a short-lived JWT, and exchange it for a
|
|
1520
|
+
* long-lived opaque (`pmth_*`) signer session.
|
|
1521
|
+
*
|
|
1522
|
+
* Performs the *documented* remote-signer-session exchange (see
|
|
1523
|
+
* `builder-api.md` → "Remote signer session exchange"): the RFC 8693 token
|
|
1524
|
+
* exchange is sent with `scope=sign:job` and **no `resource` indicator**,
|
|
1525
|
+
* which selects the PymtHouse gateway/opaque path. A prior implementation set
|
|
1526
|
+
* `resource = issuer`, which routed to the signer-JWT path and returned a JWT
|
|
1527
|
+
* that {@link parseSignerSessionExchange} then rejected as non-opaque.
|
|
1515
1528
|
*/
|
|
1516
1529
|
async mintSignerSessionForExternalUser(input) {
|
|
1530
|
+
const scope = input.scope ?? SIGN_JOB_SCOPE;
|
|
1517
1531
|
await this.upsertAppUser({
|
|
1518
1532
|
externalUserId: input.externalUserId,
|
|
1519
1533
|
email: input.email,
|
|
1520
1534
|
status: "active"
|
|
1521
1535
|
});
|
|
1522
|
-
const
|
|
1536
|
+
const userToken = await this.mintUserAccessToken({
|
|
1523
1537
|
externalUserId: input.externalUserId,
|
|
1524
|
-
scope
|
|
1525
|
-
|
|
1538
|
+
scope
|
|
1539
|
+
});
|
|
1540
|
+
const exchange = await this.exchangeForSignerSession({
|
|
1541
|
+
userJwt: userToken.access_token,
|
|
1542
|
+
omitResource: true,
|
|
1543
|
+
scope
|
|
1526
1544
|
});
|
|
1527
1545
|
return parseSignerSessionExchange(exchange);
|
|
1528
1546
|
}
|