@lumoauth/agent 1.5.0 → 1.6.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/README.md +11 -9
- package/dist/index.d.mts +83 -27
- package/dist/index.d.ts +83 -27
- package/dist/index.js +19 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -684,7 +684,10 @@ var AAuthClient = class {
|
|
|
684
684
|
get publicJwk() {
|
|
685
685
|
return publicJwkFromPrivateKey(this.privateKeyPem, this.kid);
|
|
686
686
|
}
|
|
687
|
-
/**
|
|
687
|
+
/**
|
|
688
|
+
* RFC 7638 thumbprint of the agent's public key. A resource names this
|
|
689
|
+
* value as `agent_jkt` when it asks for a resource token for the agent.
|
|
690
|
+
*/
|
|
688
691
|
get publicJwkThumbprint() {
|
|
689
692
|
return jwkThumbprint(this.publicJwk);
|
|
690
693
|
}
|
|
@@ -701,10 +704,12 @@ var AAuthClient = class {
|
|
|
701
704
|
* Request an auth token (`request_type=auth` — direct authorization).
|
|
702
705
|
*
|
|
703
706
|
* Presents the resource token in the body and the agent token in the
|
|
704
|
-
* `Agent-Auth` header, signed with the
|
|
705
|
-
* requires user consent it
|
|
706
|
-
*
|
|
707
|
-
* `
|
|
707
|
+
* `Agent-Auth` header (never in the body), signed with the key in the
|
|
708
|
+
* agent token's `cnf`. If the server requires user consent it answers
|
|
709
|
+
* 200 with `request_token` and `authorization_uri`, returned here as
|
|
710
|
+
* `{ authorizationRequired: true, requestToken, authorizationUri }` —
|
|
711
|
+
* redirect the user, then call `exchangeCode()` with the code delivered
|
|
712
|
+
* to your `redirectUri`.
|
|
708
713
|
*/
|
|
709
714
|
async requestAuthToken(params) {
|
|
710
715
|
this.requireAgentToken(params.agentToken);
|
|
@@ -749,8 +754,9 @@ var AAuthClient = class {
|
|
|
749
754
|
/**
|
|
750
755
|
* Multi-hop token exchange (`request_type=exchange`): trade an upstream
|
|
751
756
|
* auth token plus a downstream resource token for a new auth token with
|
|
752
|
-
* an `act` actor chain.
|
|
753
|
-
*
|
|
757
|
+
* an `act` actor chain (`act.agent` names the upstream agent, `act.sub`
|
|
758
|
+
* the upstream user; at most 5 hops). Requires token exchange to be
|
|
759
|
+
* enabled for the agent.
|
|
754
760
|
*/
|
|
755
761
|
async exchangeToken(params) {
|
|
756
762
|
this.requireAgentToken(params.agentToken);
|
|
@@ -765,10 +771,12 @@ var AAuthClient = class {
|
|
|
765
771
|
return this.mapTokenResponse(data);
|
|
766
772
|
}
|
|
767
773
|
/**
|
|
768
|
-
* Refresh an auth token (`request_type=refresh`). A
|
|
769
|
-
*
|
|
770
|
-
*
|
|
771
|
-
*
|
|
774
|
+
* Refresh an auth token (`request_type=refresh`). A resource token from
|
|
775
|
+
* the same resource as the original grant is required. The scopes of
|
|
776
|
+
* that grant are the ceiling: the resource token's `scope` claim may
|
|
777
|
+
* narrow them, and `scope` narrows the result once more. A refresh never
|
|
778
|
+
* widens the scope. The response carries no new refresh token (refresh
|
|
779
|
+
* tokens are not rotated).
|
|
772
780
|
*/
|
|
773
781
|
async refresh(params) {
|
|
774
782
|
this.requireAgentToken(params.agentToken);
|