@atproto/oauth-client 0.1.1 → 0.1.2-rc.0

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @atproto/oauth-client
2
2
 
3
+ ## 0.1.2-rc.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`2ded0156b`](https://github.com/bluesky-social/atproto/commit/2ded0156b9adf33b9cce66583a375bff922d383b), [`2ded0156b`](https://github.com/bluesky-social/atproto/commit/2ded0156b9adf33b9cce66583a375bff922d383b)]:
8
+ - @atproto/xrpc@0.6.0-rc.0
9
+ - @atproto/api@0.13.0-rc.0
10
+
3
11
  ## 0.1.1
4
12
 
5
13
  ### Patch Changes
package/README.md CHANGED
@@ -142,14 +142,18 @@ Make user visit `url`. Then, once it was redirected to the callback URI, perform
142
142
  const params = new URLSearchParams('code=...&state=...')
143
143
 
144
144
  // Process the callback using the OAuth client
145
- const { agent, state } = await client.callback(params)
145
+ const result = await client.callback(params)
146
146
 
147
147
  // Verify the state (e.g. to link to an internal user)
148
- state === '434321' // true
148
+ result.state === '434321' // true
149
+
150
+ const agent = result.agent
149
151
 
150
152
  // Make an authenticated request to the server. New credentials will be
151
153
  // automatically fetched if needed (causing sessionStore.set() to be called).
152
- await result.agent.request('/xrpc/foo.bar')
154
+ await agent.post({
155
+ text: 'Hello, world!',
156
+ })
153
157
 
154
158
  // revoke credentials on the server (causing sessionStore.del() to be called)
155
159
  await agent.signOut()
package/dist/index.d.ts CHANGED
@@ -4,6 +4,7 @@ export * from '@atproto-labs/handle-resolver';
4
4
  export * from '@atproto/did';
5
5
  export * from '@atproto/oauth-types';
6
6
  export * from './oauth-agent.js';
7
+ export * from './oauth-atp-agent.js';
7
8
  export * from './oauth-authorization-server-metadata-resolver.js';
8
9
  export * from './oauth-callback-error.js';
9
10
  export * from './oauth-client.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,4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cAAc,iCAAiC,CAAA;AAC/C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,iCAAiC,CAAA"}
package/dist/index.js CHANGED
@@ -24,6 +24,7 @@ __exportStar(require("@atproto-labs/handle-resolver"), exports);
24
24
  __exportStar(require("@atproto/did"), exports);
25
25
  __exportStar(require("@atproto/oauth-types"), exports);
26
26
  __exportStar(require("./oauth-agent.js"), exports);
27
+ __exportStar(require("./oauth-atp-agent.js"), exports);
27
28
  __exportStar(require("./oauth-authorization-server-metadata-resolver.js"), exports);
28
29
  __exportStar(require("./oauth-callback-error.js"), exports);
29
30
  __exportStar(require("./oauth-client.js"), exports);
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,6DAA0C;AAC1C,6CAI4B;AAH1B,mGAAA,UAAU,OAAA;AACV,0GAAA,iBAAiB,OAAA;AACjB,2GAAA,kBAAkB,OAAA;AAEpB,gEAA6C;AAE7C,+CAA4B;AAC5B,uDAAoC;AAEpC,mDAAgC;AAChC,oFAAiE;AACjE,4DAAyC;AACzC,oDAAiC;AACjC,kFAA+D;AAC/D,4DAAyC;AACzC,4DAAyC;AACzC,0DAAuC;AACvC,4DAAyC;AACzC,8DAA2C;AAC3C,sDAAmC;AACnC,mDAAgC;AAChC,6CAA0B;AAE1B,kEAA+C;AAC/C,kEAA+C;AAC/C,kEAA+C"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,6DAA0C;AAC1C,6CAI4B;AAH1B,mGAAA,UAAU,OAAA;AACV,0GAAA,iBAAiB,OAAA;AACjB,2GAAA,kBAAkB,OAAA;AAEpB,gEAA6C;AAE7C,+CAA4B;AAC5B,uDAAoC;AAEpC,mDAAgC;AAChC,uDAAoC;AACpC,oFAAiE;AACjE,4DAAyC;AACzC,oDAAiC;AACjC,kFAA+D;AAC/D,4DAAyC;AACzC,4DAAyC;AACzC,0DAAuC;AACvC,4DAAyC;AACzC,8DAA2C;AAC3C,sDAAmC;AACnC,mDAAgC;AAChC,6CAA0B;AAE1B,kEAA+C;AAC/C,kEAA+C;AAC/C,kEAA+C"}
@@ -0,0 +1,11 @@
1
+ import { Agent } from '@atproto/api';
2
+ import { OAuthAgent } from './oauth-agent.js';
3
+ export declare class OAuthAtpAgent extends Agent {
4
+ readonly oauthAgent: OAuthAgent;
5
+ constructor(oauthAgent: OAuthAgent);
6
+ clone(): this;
7
+ get did(): string;
8
+ signOut(): Promise<void>;
9
+ refreshIfNeeded(): Promise<void>;
10
+ }
11
+ //# sourceMappingURL=oauth-atp-agent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth-atp-agent.d.ts","sourceRoot":"","sources":["../src/oauth-atp-agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AAIpC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAE7C,qBAAa,aAAc,SAAQ,KAAK;IAC1B,QAAQ,CAAC,UAAU,EAAE,UAAU;gBAAtB,UAAU,EAAE,UAAU;IAyB3C,KAAK,IAAI,IAAI;IAKb,IAAI,GAAG,IAAI,MAAM,CAEhB;IAEK,OAAO;IAIA,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC;CAG9C"}
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OAuthAtpAgent = void 0;
4
+ const api_1 = require("@atproto/api");
5
+ const xrpc_1 = require("@atproto/xrpc");
6
+ const fetch_1 = require("@atproto-labs/fetch");
7
+ class OAuthAtpAgent extends api_1.Agent {
8
+ constructor(oauthAgent) {
9
+ super(async (url, init) => {
10
+ try {
11
+ return await this.oauthAgent.request(url, init);
12
+ }
13
+ catch (cause) {
14
+ if (cause instanceof fetch_1.FetchError) {
15
+ const { statusCode, message } = cause;
16
+ throw new xrpc_1.XRPCError(statusCode, undefined, message, undefined, {
17
+ cause,
18
+ });
19
+ }
20
+ if (cause instanceof fetch_1.FetchResponseError) {
21
+ const { statusCode, message, response } = cause;
22
+ const headers = Object.fromEntries(response.headers.entries());
23
+ throw new xrpc_1.XRPCError(statusCode, undefined, message, headers, {
24
+ cause,
25
+ });
26
+ }
27
+ throw cause;
28
+ }
29
+ });
30
+ Object.defineProperty(this, "oauthAgent", {
31
+ enumerable: true,
32
+ configurable: true,
33
+ writable: true,
34
+ value: oauthAgent
35
+ });
36
+ }
37
+ clone() {
38
+ const agent = new OAuthAtpAgent(this.oauthAgent);
39
+ return this.copyInto(agent);
40
+ }
41
+ get did() {
42
+ return this.oauthAgent.sub;
43
+ }
44
+ async signOut() {
45
+ await this.oauthAgent.signOut();
46
+ }
47
+ async refreshIfNeeded() {
48
+ await this.oauthAgent.refreshIfNeeded();
49
+ }
50
+ }
51
+ exports.OAuthAtpAgent = OAuthAtpAgent;
52
+ //# sourceMappingURL=oauth-atp-agent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth-atp-agent.js","sourceRoot":"","sources":["../src/oauth-atp-agent.ts"],"names":[],"mappings":";;;AAAA,sCAAoC;AACpC,wCAAyC;AACzC,+CAAoE;AAIpE,MAAa,aAAc,SAAQ,WAAK;IACtC,YAAqB,UAAsB;QACzC,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;YACxB,IAAI,CAAC;gBACH,OAAO,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;YACjD,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAI,KAAK,YAAY,kBAAU,EAAE,CAAC;oBAChC,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,KAAK,CAAA;oBACrC,MAAM,IAAI,gBAAS,CAAC,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE;wBAC7D,KAAK;qBACN,CAAC,CAAA;gBACJ,CAAC;gBAED,IAAI,KAAK,YAAY,0BAAkB,EAAE,CAAC;oBACxC,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAA;oBAC/C,MAAM,OAAO,GAAG,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAA;oBAC9D,MAAM,IAAI,gBAAS,CAAC,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE;wBAC3D,KAAK;qBACN,CAAC,CAAA;gBACJ,CAAC;gBAED,MAAM,KAAK,CAAA;YACb,CAAC;QACH,CAAC,CAAC,CAAA;QAtBQ;;;;mBAAS,UAAU;WAAY;IAuB3C,CAAC;IAED,KAAK;QACH,MAAM,KAAK,GAAG,IAAI,aAAa,CAAC,IAAI,CAAC,UAAU,CAAS,CAAA;QACxD,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;IAC7B,CAAC;IAED,IAAI,GAAG;QACL,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAA;IAC5B,CAAC;IAED,KAAK,CAAC,OAAO;QACX,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAA;IACjC,CAAC;IAEM,KAAK,CAAC,eAAe;QAC1B,MAAM,IAAI,CAAC,UAAU,CAAC,eAAe,EAAE,CAAA;IACzC,CAAC;CACF;AA1CD,sCA0CC"}
@@ -4,7 +4,7 @@ import { HandleCache, HandleResolver } from '@atproto-labs/handle-resolver';
4
4
  import { IdentityResolver } from '@atproto-labs/identity-resolver';
5
5
  import { Key, Keyset } from '@atproto/jwk';
6
6
  import { OAuthClientIdDiscoverable, OAuthClientMetadata, OAuthClientMetadataInput, OAuthResponseMode } from '@atproto/oauth-types';
7
- import { OAuthAgent } from './oauth-agent.js';
7
+ import { OAuthAtpAgent } from './oauth-atp-agent.js';
8
8
  import { AuthorizationServerMetadataCache } from './oauth-authorization-server-metadata-resolver.js';
9
9
  import { ProtectedResourceMetadataCache } from './oauth-protected-resource-metadata-resolver.js';
10
10
  import { OAuthResolver } from './oauth-resolver.js';
@@ -292,7 +292,7 @@ export declare class OAuthClient extends CustomEventTarget<OAuthClientEventMap>
292
292
  */
293
293
  abortRequest(authorizeUrl: URL): Promise<void>;
294
294
  callback(params: URLSearchParams): Promise<{
295
- agent: OAuthAgent;
295
+ agent: OAuthAtpAgent;
296
296
  state: string | null;
297
297
  }>;
298
298
  /**
@@ -301,8 +301,8 @@ export declare class OAuthClient extends CustomEventTarget<OAuthClientEventMap>
301
301
  *
302
302
  * @param refresh See {@link SessionGetter.getSession}
303
303
  */
304
- restore(sub: string, refresh?: boolean): Promise<OAuthAgent>;
304
+ restore(sub: string, refresh?: boolean): Promise<OAuthAtpAgent>;
305
305
  revoke(sub: string): Promise<void>;
306
- createAgent(server: OAuthServerAgent, sub: string): OAuthAgent;
306
+ createAgent(server: OAuthServerAgent, sub: string): OAuthAtpAgent;
307
307
  }
308
308
  //# sourceMappingURL=oauth-client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"oauth-client.d.ts","sourceRoot":"","sources":["../src/oauth-client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAGT,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAC3C,OAAO,EAGL,WAAW,EACX,cAAc,EACf,MAAM,+BAA+B,CAAA;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAA;AAElE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,EACL,yBAAyB,EACzB,mBAAmB,EACnB,wBAAwB,EAExB,iBAAiB,EAClB,MAAM,sBAAsB,CAAA;AAI7B,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EACL,gCAAgC,EAEjC,MAAM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Q,CAAC,aAAa,EAAE,aAAa,CAAA;IACrC,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAA;gBAEnB,EACV,KAAwB,EAExB,UAAU,EACV,YAAY,EAEZ,QAAoB,EACpB,cAA+D,EAC/D,WAAuB,EACvB,gCAGE,EACF,8BAGE,EAEF,YAAY,EACZ,cAAc,EACd,cAAc,EACd,eAAe,EACf,qBAAqB,EACrB,MAAM,GACP,EAAE,kBAAkB;IA4DrB,IAAI,gBAAgB,qBAEnB;IAGD,IAAI,WAAW,oEAEd;IAGD,IAAI,cAAc,mBAEjB;IAED,IAAI,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAEP;IAEK,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,GAAG,CAAC;IAsGxE;;;OAGG;IACG,YAAY,CAAC,YAAY,EAAE,GAAG;IAY9B,QAAQ,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC;QAC/C,KAAK,EAAE,aAAa,CAAA;QACpB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;KACrB,CAAC;IAuGF;;;;;OAKG;IACG,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC;IAc/D,MAAM,CAAC,GAAG,EAAE,MAAM;IAiBxB,WAAW,CAAC,MAAM,EAAE,gBAAgB,EAAE,GAAG,EAAE,MAAM,GAAG,aAAa;CAUlE"}
@@ -10,6 +10,7 @@ const oauth_types_1 = require("@atproto/oauth-types");
10
10
  const constants_js_1 = require("./constants.js");
11
11
  const token_revoked_error_js_1 = require("./errors/token-revoked-error.js");
12
12
  const oauth_agent_js_1 = require("./oauth-agent.js");
13
+ const oauth_atp_agent_js_1 = require("./oauth-atp-agent.js");
13
14
  const oauth_authorization_server_metadata_resolver_js_1 = require("./oauth-authorization-server-metadata-resolver.js");
14
15
  const oauth_callback_error_js_1 = require("./oauth-callback-error.js");
15
16
  const oauth_protected_resource_metadata_resolver_js_1 = require("./oauth-protected-resource-metadata-resolver.js");
@@ -329,7 +330,7 @@ class OAuthClient extends util_js_1.CustomEventTarget {
329
330
  }
330
331
  createAgent(server, sub) {
331
332
  const oauthAgent = new oauth_agent_js_1.OAuthAgent(server, sub, this.sessionGetter, this.fetch);
332
- return oauthAgent;
333
+ return new oauth_atp_agent_js_1.OAuthAtpAgent(oauthAgent);
333
334
  }
334
335
  }
335
336
  exports.OAuthClient = OAuthClient;
@@ -1 +1 @@
1
- {"version":3,"file":"oauth-client.js","sourceRoot":"","sources":["../src/oauth-client.ts"],"names":[],"mappings":";;;AAAA,6DAImC;AAEnC,mEAKsC;AACtC,uEAAkE;AAClE,2EAAqE;AACrE,sCAA0C;AAC1C,sDAM6B;AAE7B,iDAA6C;AAC7C,4EAAmE;AACnE,qDAA6C;AAC7C,uHAG0D;AAC1D,uEAA8D;AAC9D,mHAGwD;AACxD,2DAAmD;AAEnD,uEAA8D;AAE9D,6CAAsC;AACtC,2DAI4B;AAG5B,uCAA6C;AAC7C,+EAAsE;AAoDtE,MAAa,WAAY,SAAQ,2BAAsC;IACrE,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,EACzB,QAAQ,EACR,KAAK,GAAG,UAAU,CAAC,KAAK,EACxB,MAAM,GAC0B;QAChC,MAAM,EAAE,cAAc,EAAE,CAAA;QAExB,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,QAAQ,EAAE;YACpC,QAAQ,EAAE,OAAO;YACjB,MAAM,EAAE,MAAM;SACf,CAAC,CAAA;QACF,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,CAAA;QAErC,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;YAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,E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,UAAU,CAAC,QAAQ,CAAC,GAAG,EAAE,OAAO,EAAE;YACxE,OAAO,EAAE,OAAO,KAAK,IAAI;YACzB,UAAU,EAAE,OAAO,KAAK,KAAK;SAC9B,CAAC,CAAA;QAEF,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACtC,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,GAAW;QACtB,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,UAAU,CAC/D,GAAG,EACH,KAAK,CACN,CAAA;QAED,0EAA0E;QAC1E,2EAA2E;QAC3E,QAAQ;QACR,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC,CAAA;YACzE,MAAM,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAA;QAC5C,CAAC;gBAAS,CAAC;YACT,MAAM,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,0CAAiB,CAAC,GAAG,CAAC,CAAC,CAAA;QACrE,CAAC;IACH,CAAC;IAED,WAAW,CAAC,MAAwB,EAAE,GAAW;QAC/C,MAAM,UAAU,GAAG,IAAI,2BAAU,CAC/B,MAAM,EACN,GAAG,EACH,IAAI,CAAC,aAAa,EAClB,IAAI,CAAC,KAAK,CACX,CAAA;QAED,OAAO,IAAI,kCAAa,CAAC,UAAU,CAAC,CAAA;IACtC,CAAC;CACF;AAraD,kCAqaC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atproto/oauth-client",
3
- "version": "0.1.1",
3
+ "version": "0.1.2-rc.0",
4
4
  "license": "MIT",
5
5
  "description": "OAuth client for ATPROTO PDS. This package serves as common base for environment-specific implementations (NodeJS, Browser, React-Native).",
6
6
  "keywords": [
@@ -29,12 +29,14 @@
29
29
  "zod": "^3.23.8",
30
30
  "@atproto-labs/did-resolver": "0.1.1",
31
31
  "@atproto-labs/fetch": "0.1.0",
32
- "@atproto-labs/handle-resolver": "0.1.1",
33
32
  "@atproto-labs/identity-resolver": "0.1.1",
33
+ "@atproto-labs/handle-resolver": "0.1.1",
34
34
  "@atproto-labs/simple-store": "0.1.1",
35
35
  "@atproto-labs/simple-store-memory": "0.1.1",
36
- "@atproto/did": "0.1.0",
36
+ "@atproto/api": "0.13.0-rc.0",
37
37
  "@atproto/jwk": "0.1.1",
38
+ "@atproto/did": "0.1.0",
39
+ "@atproto/xrpc": "0.6.0-rc.0",
38
40
  "@atproto/oauth-types": "0.1.1"
39
41
  },
40
42
  "devDependencies": {
package/src/index.ts CHANGED
@@ -10,6 +10,7 @@ export * from '@atproto/did'
10
10
  export * from '@atproto/oauth-types'
11
11
 
12
12
  export * from './oauth-agent.js'
13
+ export * from './oauth-atp-agent.js'
13
14
  export * from './oauth-authorization-server-metadata-resolver.js'
14
15
  export * from './oauth-callback-error.js'
15
16
  export * from './oauth-client.js'
@@ -0,0 +1,49 @@
1
+ import { Agent } from '@atproto/api'
2
+ import { XRPCError } from '@atproto/xrpc'
3
+ import { FetchError, FetchResponseError } from '@atproto-labs/fetch'
4
+
5
+ import { OAuthAgent } from './oauth-agent.js'
6
+
7
+ export class OAuthAtpAgent extends Agent {
8
+ constructor(readonly oauthAgent: OAuthAgent) {
9
+ super(async (url, init) => {
10
+ try {
11
+ return await this.oauthAgent.request(url, init)
12
+ } catch (cause) {
13
+ if (cause instanceof FetchError) {
14
+ const { statusCode, message } = cause
15
+ throw new XRPCError(statusCode, undefined, message, undefined, {
16
+ cause,
17
+ })
18
+ }
19
+
20
+ if (cause instanceof FetchResponseError) {
21
+ const { statusCode, message, response } = cause
22
+ const headers = Object.fromEntries(response.headers.entries())
23
+ throw new XRPCError(statusCode, undefined, message, headers, {
24
+ cause,
25
+ })
26
+ }
27
+
28
+ throw cause
29
+ }
30
+ })
31
+ }
32
+
33
+ clone(): this {
34
+ const agent = new OAuthAtpAgent(this.oauthAgent) as this
35
+ return this.copyInto(agent)
36
+ }
37
+
38
+ get did(): string {
39
+ return this.oauthAgent.sub
40
+ }
41
+
42
+ async signOut() {
43
+ await this.oauthAgent.signOut()
44
+ }
45
+
46
+ public async refreshIfNeeded(): Promise<void> {
47
+ await this.oauthAgent.refreshIfNeeded()
48
+ }
49
+ }
@@ -24,6 +24,7 @@ import {
24
24
  import { FALLBACK_ALG } from './constants.js'
25
25
  import { TokenRevokedError } from './errors/token-revoked-error.js'
26
26
  import { OAuthAgent } from './oauth-agent.js'
27
+ import { OAuthAtpAgent } from './oauth-atp-agent.js'
27
28
  import {
28
29
  AuthorizationServerMetadataCache,
29
30
  OAuthAuthorizationServerMetadataResolver,
@@ -367,7 +368,7 @@ export class OAuthClient extends CustomEventTarget<OAuthClientEventMap> {
367
368
  }
368
369
 
369
370
  async callback(params: URLSearchParams): Promise<{
370
- agent: OAuthAgent
371
+ agent: OAuthAtpAgent
371
372
  state: string | null
372
373
  }> {
373
374
  const responseJwt = params.get('response')
@@ -478,7 +479,7 @@ export class OAuthClient extends CustomEventTarget<OAuthClientEventMap> {
478
479
  *
479
480
  * @param refresh See {@link SessionGetter.getSession}
480
481
  */
481
- async restore(sub: string, refresh?: boolean): Promise<OAuthAgent> {
482
+ async restore(sub: string, refresh?: boolean): Promise<OAuthAtpAgent> {
482
483
  const { dpopKey, tokenSet } = await this.sessionGetter.getSession(
483
484
  sub,
484
485
  refresh,
@@ -509,7 +510,7 @@ export class OAuthClient extends CustomEventTarget<OAuthClientEventMap> {
509
510
  }
510
511
  }
511
512
 
512
- createAgent(server: OAuthServerAgent, sub: string): OAuthAgent {
513
+ createAgent(server: OAuthServerAgent, sub: string): OAuthAtpAgent {
513
514
  const oauthAgent = new OAuthAgent(
514
515
  server,
515
516
  sub,
@@ -517,6 +518,6 @@ export class OAuthClient extends CustomEventTarget<OAuthClientEventMap> {
517
518
  this.fetch,
518
519
  )
519
520
 
520
- return oauthAgent
521
+ return new OAuthAtpAgent(oauthAgent)
521
522
  }
522
523
  }
@@ -1,9 +0,0 @@
1
- export class RefreshError extends Error {
2
- constructor(
3
- public readonly sub: string,
4
- message: string,
5
- options?: { cause?: unknown },
6
- ) {
7
- super(message, options)
8
- }
9
- }