@atproto/oauth-client 0.2.2 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. package/CHANGELOG.md +27 -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 +22 -13
  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 +1 -1
  23. package/dist/oauth-server-agent.d.ts +14 -11
  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.js +1 -2
  45. package/dist/validate-client-metadata.js.map +1 -1
  46. package/package.json +7 -7
  47. package/src/atproto-token-response.ts +22 -0
  48. package/src/oauth-authorization-server-metadata-resolver.ts +22 -8
  49. package/src/oauth-client.ts +61 -27
  50. package/src/oauth-protected-resource-metadata-resolver.ts +22 -12
  51. package/src/oauth-server-agent.ts +87 -68
  52. package/src/oauth-session.ts +21 -13
  53. package/src/runtime.ts +1 -1
  54. package/src/session-getter.ts +53 -33
  55. package/src/types.ts +16 -11
  56. package/src/util.ts +78 -0
  57. package/tsconfig.build.tsbuildinfo +1 -0
@@ -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;;;;;WAA8B;QAC9B;;;;;WAAsB;QAG7B,MAAM,EAAE,WAAW,EAAE,GAAG,cAAc,CAAA;QAEtC,IAAI,CAAC,qBAAqB,GAAG,WAAW,IAAI,IAAI,CAAA;QAChD,IAAI,CAAC,SAAS;YACZ,WAAW,EAAE,IAAI,CAAC,cAAc,CAAC;gBACjC,+BAA+B;gBAC/B,0BAAgB,CAAA;IACpB,CAAC;IAEM,KAAK,CAAC,WAAW,CAAC,IAAc;QACrC,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;QACtD,OAAO,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,UAAU,CAAC,CAAA;IAClD,CAAC;IAEM,KAAK,CAAC,MAAM,CAAC,IAAY;QAC9B,M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K;YACR,OAAO,EAAE,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,KAAK,CAAC,EAAE,CAAA;QACzC;YACE,MAAM,IAAI,SAAS,CAAC,mDAAmD,CAAC,CAAA;IAC5E,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAS,YAAY,CAAC,CAAS,EAAE,CAAS;IACxC,IAAI,CAAC,KAAK,QAAQ;QAAE,OAAO,CAAC,CAAC,CAAA;IAC7B,IAAI,CAAC,KAAK,QAAQ;QAAE,OAAO,CAAC,CAAA;IAE5B,KAAK,MAAM,MAAM,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC;QACxC,IAAI,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;YACzB,IAAI,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;gBACzB,MAAM,IAAI,GAAG,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;gBACpC,MAAM,IAAI,GAAG,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,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,iCA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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":";;;;;;;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