@atproto/oauth-client 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/README.md +12 -6
  3. package/dist/atproto-token-response.d.ts +110 -0
  4. package/dist/atproto-token-response.d.ts.map +1 -0
  5. package/dist/atproto-token-response.js +20 -0
  6. package/dist/atproto-token-response.js.map +1 -0
  7. package/dist/fetch-dpop.js +1 -2
  8. package/dist/fetch-dpop.js.map +1 -1
  9. package/dist/oauth-authorization-server-metadata-resolver.d.ts +6 -2
  10. package/dist/oauth-authorization-server-metadata-resolver.d.ts.map +1 -1
  11. package/dist/oauth-authorization-server-metadata-resolver.js +18 -9
  12. package/dist/oauth-authorization-server-metadata-resolver.js.map +1 -1
  13. package/dist/oauth-callback-error.d.ts.map +1 -1
  14. package/dist/oauth-client.d.ts +30 -15
  15. package/dist/oauth-client.d.ts.map +1 -1
  16. package/dist/oauth-client.js +24 -17
  17. package/dist/oauth-client.js.map +1 -1
  18. package/dist/oauth-protected-resource-metadata-resolver.d.ts +5 -1
  19. package/dist/oauth-protected-resource-metadata-resolver.d.ts.map +1 -1
  20. package/dist/oauth-protected-resource-metadata-resolver.js +18 -11
  21. package/dist/oauth-protected-resource-metadata-resolver.js.map +1 -1
  22. package/dist/oauth-resolver.d.ts +2 -2
  23. package/dist/oauth-server-agent.d.ts +15 -12
  24. package/dist/oauth-server-agent.d.ts.map +1 -1
  25. package/dist/oauth-server-agent.js +66 -47
  26. package/dist/oauth-server-agent.js.map +1 -1
  27. package/dist/oauth-session.d.ts +13 -8
  28. package/dist/oauth-session.d.ts.map +1 -1
  29. package/dist/oauth-session.js +12 -7
  30. package/dist/oauth-session.js.map +1 -1
  31. package/dist/runtime.d.ts +1 -1
  32. package/dist/runtime.js.map +1 -1
  33. package/dist/session-getter.d.ts +5 -4
  34. package/dist/session-getter.d.ts.map +1 -1
  35. package/dist/session-getter.js +52 -32
  36. package/dist/session-getter.js.map +1 -1
  37. package/dist/types.d.ts +98 -102
  38. package/dist/types.d.ts.map +1 -1
  39. package/dist/types.js.map +1 -1
  40. package/dist/util.d.ts +6 -1
  41. package/dist/util.d.ts.map +1 -1
  42. package/dist/util.js +56 -2
  43. package/dist/util.js.map +1 -1
  44. package/dist/validate-client-metadata.d.ts.map +1 -1
  45. package/dist/validate-client-metadata.js +17 -7
  46. package/dist/validate-client-metadata.js.map +1 -1
  47. package/package.json +9 -9
  48. package/src/atproto-token-response.ts +22 -0
  49. package/src/oauth-authorization-server-metadata-resolver.ts +22 -8
  50. package/src/oauth-client.ts +62 -32
  51. package/src/oauth-protected-resource-metadata-resolver.ts +22 -12
  52. package/src/oauth-server-agent.ts +89 -70
  53. package/src/oauth-session.ts +21 -13
  54. package/src/runtime.ts +1 -1
  55. package/src/session-getter.ts +53 -33
  56. package/src/types.ts +16 -11
  57. package/src/util.ts +78 -0
  58. package/src/validate-client-metadata.ts +23 -6
  59. package/tsconfig.build.tsbuildinfo +1 -0
@@ -1,28 +1,33 @@
1
1
  import { Fetch } from '@atproto-labs/fetch';
2
+ import { AtprotoDid } from '@atproto/did';
2
3
  import { OAuthAuthorizationServerMetadata } from '@atproto/oauth-types';
4
+ import { AtprotoScope } from './atproto-token-response.js';
3
5
  import { OAuthServerAgent, TokenSet } from './oauth-server-agent.js';
4
6
  import { SessionGetter } from './session-getter.js';
5
7
  export type TokenInfo = {
6
8
  expiresAt?: Date;
7
9
  expired?: boolean;
8
- scope?: string;
10
+ scope: AtprotoScope;
9
11
  iss: string;
10
12
  aud: string;
11
- sub: string;
13
+ sub: AtprotoDid;
12
14
  };
13
15
  export declare class OAuthSession {
14
16
  readonly server: OAuthServerAgent;
15
- readonly sub: string;
17
+ readonly sub: AtprotoDid;
16
18
  private readonly sessionGetter;
17
19
  protected dpopFetch: Fetch<unknown>;
18
- constructor(server: OAuthServerAgent, sub: string, sessionGetter: SessionGetter, fetch?: Fetch);
19
- get did(): `did:${string}:${string}`;
20
+ constructor(server: OAuthServerAgent, sub: AtprotoDid, sessionGetter: SessionGetter, fetch?: Fetch);
21
+ get did(): AtprotoDid;
20
22
  get serverMetadata(): Readonly<OAuthAuthorizationServerMetadata>;
21
23
  /**
22
- * @param refresh See {@link SessionGetter.getSession}
24
+ * @param refresh When `true`, the credentials will be refreshed even if they
25
+ * are not expired. When `false`, the credentials will not be refreshed even
26
+ * if they are expired. When `undefined`, the credentials will be refreshed
27
+ * if, and only if, they are (about to be) expired. Defaults to `undefined`.
23
28
  */
24
- getTokenSet(refresh?: boolean): Promise<TokenSet>;
25
- getTokenInfo(refresh?: boolean): Promise<TokenInfo>;
29
+ protected getTokenSet(refresh: boolean | 'auto'): Promise<TokenSet>;
30
+ getTokenInfo(refresh?: boolean | 'auto'): Promise<TokenInfo>;
26
31
  signOut(): Promise<void>;
27
32
  fetchHandler(pathname: string, init?: RequestInit): Promise<Response>;
28
33
  }
@@ -1 +1 @@
1
- {"version":3,"file":"oauth-session.d.ts","sourceRoot":"","sources":["../src/oauth-session.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAa,MAAM,qBAAqB,CAAA;AACtD,OAAO,EAAE,gCAAgC,EAAE,MAAM,sBAAsB,CAAA;AAKvE,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAMnD,MAAM,MAAM,SAAS,GAAG;IACtB,SAAS,CAAC,EAAE,IAAI,CAAA;IAChB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;CACZ,CAAA;AAED,qBAAa,YAAY;aAIL,MAAM,EAAE,gBAAgB;aACxB,GAAG,EAAE,MAAM;IAC3B,OAAO,CAAC,QAAQ,CAAC,aAAa;IALhC,SAAS,CAAC,SAAS,EAAE,KAAK,CAAC,O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QAAQ,CAAC,aAAa;IALhC,SAAS,CAAC,SAAS,EAAE,KAAK,CAAC,OAAO,CAAC,CAAA;gBAGjB,MAAM,EAAE,gBAAgB,EACxB,GAAG,EAAE,UAAU,EACd,aAAa,EAAE,aAAa,EAC7C,KAAK,GAAE,KAAwB;IAajC,IAAI,GAAG,IAAI,UAAU,CAEpB;IAED,IAAI,cAAc,IAAI,QAAQ,CAAC,gCAAgC,CAAC,CAE/D;IAED;;;;;OAKG;cACa,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;IASnE,YAAY,CAAC,OAAO,GAAE,OAAO,GAAG,MAAe,GAAG,OAAO,CAAC,SAAS,CAAC;IAmBpE,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAYxB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC;CA2D5E"}
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.OAuthSession = void 0;
4
- const did_1 = require("@atproto/did");
5
4
  const fetch_1 = require("@atproto-labs/fetch");
6
5
  const token_invalid_error_js_1 = require("./errors/token-invalid-error.js");
7
6
  const token_revoked_error_js_1 = require("./errors/token-revoked-error.js");
@@ -44,19 +43,25 @@ class OAuthSession {
44
43
  });
45
44
  }
46
45
  get did() {
47
- return (0, did_1.asDid)(this.sub);
46
+ return this.sub;
48
47
  }
49
48
  get serverMetadata() {
50
49
  return this.server.serverMetadata;
51
50
  }
52
51
  /**
53
- * @param refresh See {@link SessionGetter.getSession}
52
+ * @param refresh When `true`, the credentials will be refreshed even if they
53
+ * are not expired. When `false`, the credentials will not be refreshed even
54
+ * if they are expired. When `undefined`, the credentials will be refreshed
55
+ * if, and only if, they are (about to be) expired. Defaults to `undefined`.
54
56
  */
55
57
  async getTokenSet(refresh) {
56
- const { tokenSet } = await this.sessionGetter.getSession(this.sub, refresh);
58
+ const { tokenSet } = await this.sessionGetter.get(this.sub, {
59
+ noCache: refresh === true,
60
+ allowStale: refresh === false,
61
+ });
57
62
  return tokenSet;
58
63
  }
59
- async getTokenInfo(refresh) {
64
+ async getTokenInfo(refresh = 'auto') {
60
65
  const tokenSet = await this.getTokenSet(refresh);
61
66
  const expiresAt = tokenSet.expires_at == null ? undefined : new Date(tokenSet.expires_at);
62
67
  return {
@@ -74,7 +79,7 @@ class OAuthSession {
74
79
  }
75
80
  async signOut() {
76
81
  try {
77
- const { tokenSet } = await this.sessionGetter.getSession(this.sub, false);
82
+ const tokenSet = await this.getTokenSet(false);
78
83
  await this.server.revoke(tokenSet.access_token);
79
84
  }
80
85
  finally {
@@ -83,7 +88,7 @@ class OAuthSession {
83
88
  }
84
89
  async fetchHandler(pathname, init) {
85
90
  // This will try and refresh the token if it is known to be expired
86
- const tokenSet = await this.getTokenSet(undefined);
91
+ const tokenSet = await this.getTokenSet('auto');
87
92
  const initialUrl = new URL(pathname, tokenSet.aud);
88
93
  const initialAuth = `${tokenSet.token_type} ${tokenSet.access_token}`;
89
94
  const headers = new Headers(init?.headers);
@@ -1 +1 @@
1
- {"version":3,"file":"oauth-session.js","sourceRoot":"","sources":["../src/oauth-session.ts"],"names":[],"mappings":";;;AAAA,sCAAoC;AACpC,+CAAsD;AAGtD,4EAAmE;AACnE,4EAAmE;AACnE,mDAAkD;AAIlD,MAAM,cAAc,GAAG,UAAU,CAAC,cAErB,CAAA;AAWb,MAAa,YAAY;IAGvB,YACkB,MAAwB,EACxB,GAAW,EACV,aAA4B,EAC7C,QAAe,UAAU,CAAC,KAAK;QAH/B;;;;mBAAgB,MAAM;WAAkB;QACxC;;;;mBAAgB,GAAG;WAAQ;QAC3B;;;;mBAAiB,aAAa;WAAe;QALrC;;;;;WAAyB;QAQjC,IAAI,CAAC,SAAS,GAAG,IAAA,gCAAgB,EAAO;YACtC,KAAK,EAAE,IAAA,iBAAS,EAAC,KAAK,CAA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,MAAM,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,CAAC,CAAA;QAE1E,yEAAyE;QACzE,0EAA0E;QAC1E,yEAAyE;QACzE,iEAAiE;QACjE,IAAI,sBAAsB,CAAC,aAAa,CAAC,EAAE,CAAC;YAC1C,oEAAoE;YACpE,0EAA0E;YAC1E,kCAAkC;YAClC,MAAM,IAAI,CAAC,aAAa,CAAC,SAAS,CAChC,IAAI,CAAC,GAAG,EACR,IAAI,0CAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,CAChC,CAAA;QACH,CAAC;QAED,OAAO,aAAa,CAAA;IACtB,CAAC;CACF;AArID,oCAqIC;AAED;;;GAGG;AACH,SAAS,sBAAsB,CAAC,QAAkB;IAChD,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG;QAAE,OAAO,KAAK,CAAA;IACzC,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAA;IACxD,OAAO,CACL,OAAO,IAAI,IAAI;QACf,CAAC,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QAC9D,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAAC,CAC1C,CAAA;AACH,CAAC"}
package/dist/runtime.d.ts CHANGED
@@ -11,7 +11,7 @@ export declare class Runtime {
11
11
  generatePKCE(byteLength?: number): Promise<{
12
12
  verifier: string;
13
13
  challenge: string;
14
- method: string;
14
+ method: "S256";
15
15
  }>;
16
16
  calculateJwkThumbprint(jwk: any): Promise<string>;
17
17
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.js","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":";;;AACA,sDAAqD;AAErD,uCAA4C;AAG5C,MAAa,OAAO;IAIlB,YAAsB,cAAqC;QAA/C;;;;mBAAU,cAAc;WAAuB;QAHlD;;;;;WAA8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,EAAE,CAAC,CAAC,CAAC,CAAA;gBAEpC,6BAA6B;gBAC7B,OAAO,IAAI,GAAG,IAAI,CAAA;YACpB,CAAC;YACD,OAAO,CAAC,CAAC,CAAA;QACX,CAAC;aAAM,IAAI,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;YAChC,OAAO,CAAC,CAAA;QACV,CAAC;IACH,CAAC;IAED,iDAAiD;IACjD,OAAO,CAAC,CAAA;AACV,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import { CachedGetter, GetCachedOptions, SimpleStore } from '@atproto-labs/simple-store';
2
+ import { AtprotoDid } from '@atproto/did';
2
3
  import { Key } from '@atproto/jwk';
3
4
  import { TokenInvalidError } from './errors/token-invalid-error.js';
4
5
  import { TokenRefreshError } from './errors/token-refresh-error.js';
@@ -28,7 +29,7 @@ export type SessionEventListener<T extends keyof SessionEventMap = keyof Session
28
29
  * contains the logic for reading from the cache which, if the cache is based on
29
30
  * localStorage/indexedDB, will sync across multiple tabs (for a given sub).
30
31
  */
31
- export declare class SessionGetter extends CachedGetter<string, Session> {
32
+ export declare class SessionGetter extends CachedGetter<AtprotoDid, Session> {
32
33
  private readonly runtime;
33
34
  private readonly eventTarget;
34
35
  constructor(sessionStore: SessionStore, serverFactory: OAuthServerFactory, runtime: Runtime);
@@ -36,14 +37,14 @@ export declare class SessionGetter extends CachedGetter<string, Session> {
36
37
  removeEventListener<T extends keyof SessionEventMap>(type: T, callback: SessionEventListener<T>, options?: EventListenerOptions | boolean): void;
37
38
  dispatchEvent<T extends keyof SessionEventMap>(type: T, detail: SessionEventMap[T]): boolean;
38
39
  setStored(sub: string, session: Session): Promise<void>;
39
- delStored(sub: string, cause?: unknown): Promise<void>;
40
+ delStored(sub: AtprotoDid, cause?: unknown): Promise<void>;
40
41
  /**
41
42
  * @param refresh When `true`, the credentials will be refreshed even if they
42
43
  * are not expired. When `false`, the credentials will not be refreshed even
43
44
  * if they are expired. When `undefined`, the credentials will be refreshed
44
45
  * if, and only if, they are (about to be) expired. Defaults to `undefined`.
45
46
  */
46
- getSession(sub: string, refresh?: boolean): Promise<Session>;
47
- get(sub: string, options?: GetCachedOptions): Promise<Session>;
47
+ getSession(sub: AtprotoDid, refresh?: boolean): Promise<Session>;
48
+ get(sub: AtprotoDid, options?: GetCachedOptions): Promise<Session>;
48
49
  }
49
50
  //# sourceMappingURL=session-getter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"session-getter.d.ts","sourceRoot":"","sources":["../src/session-getter.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,WAAW,EACZ,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AAElC,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAA;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAA;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAA;AAEnE,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAGtC,MAAM,MAAM,OAAO,GAAG;IACpB,OAAO,EAAE,GAAG,CAAA;IACZ,QAAQ,EAAE,QAAQ,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,YAAY,GAAG,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;AAEvD,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE;QACP,GAAG,EAAE,MAAM,CAAA;KACZ,GAAG,OAAO,CAAA;IACX,OAAO,EAAE;QACP,GAAG,EAAE,MAAM,CAAA;QACX,KAAK,EAAE,iBAAiB,GAAG,iBAAiB,GAAG,iBAAiB,GAAG,OAAO,CAAA;KAC3E,CAAA;CACF,CAAA;AAED,MAAM,MAAM,oBAAoB,CAC9B,CAAC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E,YAAY,EAAE,YAAY,EAC1B,aAAa,EAAE,kBAAkB,EAChB,OAAO,EAAE,OAAO;IA4InC,gBAAgB,CAAC,CAAC,SAAS,MAAM,eAAe,EAC9C,IAAI,EAAE,CAAC,EACP,QAAQ,EAAE,oBAAoB,CAAC,CAAC,CAAC,EACjC,OAAO,CAAC,EAAE,uBAAuB,GAAG,OAAO;IAK7C,mBAAmB,CAAC,CAAC,SAAS,MAAM,eAAe,EACjD,IAAI,EAAE,CAAC,EACP,QAAQ,EAAE,oBAAoB,CAAC,CAAC,CAAC,EACjC,OAAO,CAAC,EAAE,oBAAoB,GAAG,OAAO;IAK1C,aAAa,CAAC,CAAC,SAAS,MAAM,eAAe,EAC3C,IAAI,EAAE,CAAC,EACP,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC,GACzB,OAAO;IAIJ,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO;IAS9B,SAAS,CAAC,GAAG,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAKzE;;;;;OAKG;IACG,UAAU,CAAC,GAAG,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,OAAO;IAO7C,GAAG,CAAC,GAAG,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC;CAwBzE"}
@@ -2,7 +2,7 @@
2
2
  var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {
3
3
  if (value !== null && value !== void 0) {
4
4
  if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
5
- var dispose;
5
+ var dispose, inner;
6
6
  if (async) {
7
7
  if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
8
8
  dispose = value[Symbol.asyncDispose];
@@ -10,8 +10,10 @@ var __addDisposableResource = (this && this.__addDisposableResource) || function
10
10
  if (dispose === void 0) {
11
11
  if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
12
12
  dispose = value[Symbol.dispose];
13
+ if (async) inner = dispose;
13
14
  }
14
15
  if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
16
+ if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
15
17
  env.stack.push({ value: value, dispose: dispose, async: async });
16
18
  }
17
19
  else if (async) {
@@ -25,17 +27,22 @@ var __disposeResources = (this && this.__disposeResources) || (function (Suppres
25
27
  env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
26
28
  env.hasError = true;
27
29
  }
30
+ var r, s = 0;
28
31
  function next() {
29
- while (env.stack.length) {
30
- var rec = env.stack.pop();
32
+ while (r = env.stack.pop()) {
31
33
  try {
32
- var result = rec.dispose && rec.dispose.call(rec.value);
33
- if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
34
+ if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
35
+ if (r.dispose) {
36
+ var result = r.dispose.call(r.value);
37
+ if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
38
+ }
39
+ else s |= 1;
34
40
  }
35
41
  catch (e) {
36
42
  fail(e);
37
43
  }
38
44
  }
45
+ if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
39
46
  if (env.hasError) throw env.error;
40
47
  }
41
48
  return next();
@@ -81,27 +88,28 @@ class SessionGetter extends simple_store_1.CachedGetter {
81
88
  // dispatched, even if the session was removed from the store through a
82
89
  // concurrent access (which, normally, should not happen if a proper
83
90
  // runtime lock was provided).
84
- if (sub !== storedSession.tokenSet.sub) {
91
+ const { dpopKey, tokenSet } = storedSession;
92
+ if (sub !== tokenSet.sub) {
85
93
  // Fool-proofing (e.g. against invalid session storage)
86
94
  throw new token_refresh_error_js_1.TokenRefreshError(sub, 'Stored session sub mismatch');
87
95
  }
96
+ if (!tokenSet.refresh_token) {
97
+ throw new token_refresh_error_js_1.TokenRefreshError(sub, 'No refresh token available');
98
+ }
88
99
  // Since refresh tokens can only be used once, we might run into
89
- // concurrency issues if multiple tabs/instances are trying to refresh
90
- // the same token. The chances of this happening when multiple instances
91
- // are started simultaneously is reduced by randomizing the expiry time
92
- // (see isStale() below). Even so, There still exist chances that
93
- // multiple tabs will try to refresh the token at the same time. The
94
- // best solution would be to use a mutex/lock to ensure that only one
95
- // instance is refreshing the token at a time. A simpler workaround is
96
- // to check if the value stored in the session store is the same as the
97
- // one in memory. If it isn't, then another instance has already
98
- // refreshed the token.
99
- const { tokenSet, dpopKey } = storedSession;
100
+ // concurrency issues if multiple instances (e.g. browser tabs) are
101
+ // trying to refresh the same token simultaneously. The chances of this
102
+ // happening when multiple instances are started simultaneously is
103
+ // reduced by randomizing the expiry time (see isStale() below). The
104
+ // best solution is to use a mutex/lock to ensure that only one instance
105
+ // is refreshing the token at a time (runtime.usingLock) but that is not
106
+ // always possible. If no lock implementation is provided, we will use
107
+ // the store to check if a concurrent refresh occurred.
100
108
  const server = await serverFactory.fromIssuer(tokenSet.iss, dpopKey);
101
109
  // Because refresh tokens can only be used once, we must not use the
102
110
  // "signal" to abort the refresh, or throw any abort error beyond this
103
111
  // point. Any thrown error beyond this point will prevent the
104
- // SessionGetter from obtaining, and storing, the new token set,
112
+ // TokenGetter from obtaining, and storing, the new token set,
105
113
  // effectively rendering the currently saved session unusable.
106
114
  options?.signal?.throwIfAborted();
107
115
  try {
@@ -138,7 +146,7 @@ class SessionGetter extends simple_store_1.CachedGetter {
138
146
  else if (stored.tokenSet.access_token !== tokenSet.access_token ||
139
147
  stored.tokenSet.refresh_token !== tokenSet.refresh_token) {
140
148
  // A concurrent refresh occurred. Pretend this one succeeded.
141
- return { dpopKey, tokenSet: stored.tokenSet };
149
+ return stored;
142
150
  }
143
151
  else {
144
152
  // There were no concurrent refresh. The token is (likely)
@@ -155,9 +163,13 @@ class SessionGetter extends simple_store_1.CachedGetter {
155
163
  isStale: (sub, { tokenSet }) => {
156
164
  return (tokenSet.expires_at != null &&
157
165
  new Date(tokenSet.expires_at).getTime() <
158
- // Add some lee way to ensure the token is not expired when it
159
- // reaches the server.
160
- Date.now() + 60e3);
166
+ Date.now() +
167
+ // Add some lee way to ensure the token is not expired when it
168
+ // reaches the server.
169
+ 10e3 +
170
+ // Add some randomness to reduce the chances of multiple
171
+ // instances trying to refresh the token at the same.
172
+ 30e3 * Math.random());
161
173
  },
162
174
  onStoreError: async (err, sub, { tokenSet, dpopKey }) => {
163
175
  // If the token data cannot be stored, let's revoke it
@@ -194,6 +206,10 @@ class SessionGetter extends simple_store_1.CachedGetter {
194
206
  return this.eventTarget.dispatchCustomEvent(type, detail);
195
207
  }
196
208
  async setStored(sub, session) {
209
+ // Prevent tampering with the stored value
210
+ if (sub !== session.tokenSet.sub) {
211
+ throw new TypeError('Token set does not match the expected sub');
212
+ }
197
213
  await super.setStored(sub, session);
198
214
  this.dispatchEvent('updated', { sub, ...session });
199
215
  }
@@ -208,24 +224,23 @@ class SessionGetter extends simple_store_1.CachedGetter {
208
224
  * if, and only if, they are (about to be) expired. Defaults to `undefined`.
209
225
  */
210
226
  async getSession(sub, refresh) {
211
- const session = await this.get(sub, {
227
+ return this.get(sub, {
212
228
  noCache: refresh === true,
213
229
  allowStale: refresh === false,
214
230
  });
215
- if (sub !== session.tokenSet.sub) {
216
- // Fool-proofing (e.g. against invalid session storage)
217
- throw new Error('Token set does not match the expected sub');
218
- }
219
- return session;
220
231
  }
221
232
  async get(sub, options) {
222
- return this.runtime.usingLock(`@atproto-oauth-client-${sub}`, async () => {
233
+ const session = await this.runtime.usingLock(`@atproto-oauth-client-${sub}`, async () => {
223
234
  const env_1 = { stack: [], error: void 0, hasError: false };
224
235
  try {
225
- // Make sure, even if there is no signal in the options, that the request
226
- // will be cancelled after at most 30 seconds.
236
+ // Make sure, even if there is no signal in the options, that the
237
+ // request will be cancelled after at most 30 seconds.
227
238
  const signal = __addDisposableResource(env_1, (0, util_js_1.timeoutSignal)(30e3, options), false);
228
- return await super.get(sub, { ...options, signal });
239
+ const abortController = __addDisposableResource(env_1, (0, util_js_1.combineSignals)([options?.signal, signal]), false);
240
+ return await super.get(sub, {
241
+ ...options,
242
+ signal: abortController.signal,
243
+ });
229
244
  }
230
245
  catch (e_1) {
231
246
  env_1.error = e_1;
@@ -235,6 +250,11 @@ class SessionGetter extends simple_store_1.CachedGetter {
235
250
  __disposeResources(env_1);
236
251
  }
237
252
  });
253
+ if (sub !== session.tokenSet.sub) {
254
+ // Fool-proofing (e.g. against invalid session storage)
255
+ throw new Error('Token set does not match the expected sub');
256
+ }
257
+ return session;
238
258
  }
239
259
  }
240
260
  exports.SessionGetter = SessionGetter;
@@ -1 +1 @@
1
- {"version":3,"file":"session-getter.js","sourceRoot":"","sources":["../src/session-getter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6DAImC;AAGnC,4EAAmE;AACnE,4EAAmE;AACnE,4EAAmE;AACnE,uEAA8D;AAI9D,uCAA4D;AAuB5D;;;;;;GAMG;AACH,MAAa,aAAc,SAAQ,2BAA6B;IAG9D,YACE,YAA0B,EAC1B,aAAiC,EAChB,OAAgB;QAEjC,KAAK,CACH,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,aAAa,EAAoB,EAAE;YACtD,iEAAiE;YACjE,uEAAuE;YACvE,+BAA+B;YAC/B,IAAI,aAAa,KAAK,SAAS,EAAE,CAAC;gBAChC,mEAAmE;gBACnE,iEAAiE;gBACjE,iEAAiE;gBACjE,mEAAmE;gBACnE,wDAAwD;gBACxD,MAAM,GAAG,GAAG,4CAA4C,CAAA;gBACxD,MAAM,KAAK,GAAG,IAAI,0CAAiB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;gBAC7C,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,CAAA;gBAC7C,MAAM,KAAK,CAAA;YACb,CAAC;YAED,uEAAuE;YACv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