@atproto/oauth-client-expo 0.0.10 → 0.1.0-next.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.
Files changed (39) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/ExpoAtprotoOAuthClientModule.d.ts +1 -1
  3. package/dist/ExpoAtprotoOAuthClientModule.d.ts.map +1 -1
  4. package/dist/ExpoAtprotoOAuthClientModule.js.map +1 -1
  5. package/dist/ExpoAtprotoOAuthClientModule.types.js.map +1 -1
  6. package/dist/expo-oauth-client.native.d.ts +2 -2
  7. package/dist/expo-oauth-client.native.d.ts.map +1 -1
  8. package/dist/expo-oauth-client.native.js +3 -3
  9. package/dist/expo-oauth-client.native.js.map +1 -1
  10. package/dist/expo-oauth-client.web.d.ts +2 -2
  11. package/dist/expo-oauth-client.web.d.ts.map +1 -1
  12. package/dist/expo-oauth-client.web.js.map +1 -1
  13. package/dist/index.d.ts +3 -3
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +1 -1
  16. package/dist/index.js.map +1 -1
  17. package/dist/utils/expo-key.d.ts +1 -1
  18. package/dist/utils/expo-key.d.ts.map +1 -1
  19. package/dist/utils/expo-key.js +1 -1
  20. package/dist/utils/expo-key.js.map +1 -1
  21. package/dist/utils/mmkv-simple-store-ttl.d.ts +1 -1
  22. package/dist/utils/mmkv-simple-store-ttl.d.ts.map +1 -1
  23. package/dist/utils/mmkv-simple-store-ttl.js +1 -1
  24. package/dist/utils/mmkv-simple-store-ttl.js.map +1 -1
  25. package/dist/utils/stores.d.ts +2 -2
  26. package/dist/utils/stores.d.ts.map +1 -1
  27. package/dist/utils/stores.js +2 -2
  28. package/dist/utils/stores.js.map +1 -1
  29. package/package.json +8 -6
  30. package/src/ExpoAtprotoOAuthClientModule.ts +1 -1
  31. package/src/ExpoAtprotoOAuthClientModule.types.ts +1 -1
  32. package/src/expo-oauth-client.d.ts +2 -2
  33. package/src/expo-oauth-client.native.ts +7 -6
  34. package/src/expo-oauth-client.web.ts +2 -2
  35. package/src/index.ts +3 -3
  36. package/src/utils/expo-key.ts +2 -2
  37. package/src/utils/mmkv-simple-store-ttl.ts +1 -1
  38. package/src/utils/stores.ts +3 -3
  39. package/tsconfig.build.tsbuildinfo +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # @atproto/oauth-client-expo
2
2
 
3
+ ## 0.1.0-next.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#4929](https://github.com/bluesky-social/atproto/pull/4929) [`bb7491c`](https://github.com/bluesky-social/atproto/commit/bb7491c29e06181e1d2f8cf6eb454f9bb8ab961b) Thanks [@devinivy](https://github.com/devinivy)! - **BREAKING:** Drop support for Node.js 18 and 20. Node.js 22 is now the minimum supported version. Docker images now use Node.js 24.
8
+
9
+ - [#4943](https://github.com/bluesky-social/atproto/pull/4943) [`07ae5d4`](https://github.com/bluesky-social/atproto/commit/07ae5d4452df51e045e0239da7a04cf0bc154028) Thanks [@devinivy](https://github.com/devinivy)! - **BREAKING:** Convert to pure ESM. All packages now ship `"type": "module"` with ES module output and Node16 module resolution.
10
+
11
+ Node.js 22's `require()` compatibility layer can still load these packages in CommonJS code.
12
+
13
+ - [#4930](https://github.com/bluesky-social/atproto/pull/4930) [`042df15`](https://github.com/bluesky-social/atproto/commit/042df15087c0e62cd1e715fcbf58852fab875af9) Thanks [@devinivy](https://github.com/devinivy)! - Build with TypeScript 6.0. Emitted `.d.ts` files now use TypeScript 6's stricter `Uint8Array<ArrayBuffer>` typing in places where Web/Node APIs require buffer-backed (not shared-memory) byte arrays. Consumers compiling against these types on older TypeScript should see no runtime impact, but may need to widen or cast in spots that previously relied on `Uint8Array` defaulting to `<ArrayBufferLike>`.
14
+
15
+ Internal: tsconfig `moduleResolution: "node"` is silenced via `ignoreDeprecations: "6.0"` for now; the proper migration to `node16`/`bundler` resolution is deferred.
16
+
17
+ ### Patch Changes
18
+
19
+ - Updated dependencies [[`bb7491c`](https://github.com/bluesky-social/atproto/commit/bb7491c29e06181e1d2f8cf6eb454f9bb8ab961b), [`07ae5d4`](https://github.com/bluesky-social/atproto/commit/07ae5d4452df51e045e0239da7a04cf0bc154028), [`042df15`](https://github.com/bluesky-social/atproto/commit/042df15087c0e62cd1e715fcbf58852fab875af9)]:
20
+ - @atproto/oauth-client@0.7.0-next.0
21
+ - @atproto/oauth-client-browser@0.4.0-next.0
22
+ - @atproto-labs/simple-store@0.4.0-next.0
23
+
3
24
  ## 0.0.10
4
25
 
5
26
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  import { NativeModule } from 'expo';
2
2
  import { SignedJwt, VerifyOptions, VerifyResult } from '@atproto/oauth-client';
3
- import { ExpoAtprotoOAuthClientModuleEvents } from './ExpoAtprotoOAuthClientModule.types';
3
+ import { ExpoAtprotoOAuthClientModuleEvents } from './ExpoAtprotoOAuthClientModule.types.js';
4
4
  export type NativeJwk = {
5
5
  kty: 'EC';
6
6
  crv: 'P-256';
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoAtprotoOAuthClientModule.d.ts","sourceRoot":"","sources":["../src/ExpoAtprotoOAuthClientModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuB,MAAM,MAAM,CAAA;AACxD,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAC9E,OAAO,EAAE,kCAAkC,EAAE,MAAM,sCAAsC,CAAA;AAEzF,MAAM,MAAM,SAAS,GAAG;IACtB,GAAG,EAAE,IAAI,CAAA;IACT,GAAG,EAAE,OAAO,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,GAAG,EAAE,OAAO,CAAA;CACb,CAAA;AAED,OAAO,OAAO,4BAA6B,SAAQ,YAAY,CAAC,kCAAkC,CAAC;IACjG,MAAM,CAAC,IAAI,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AE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAExD,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IAEzD,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;IAE9E,SAAS,CAAC,CAAC,SAAS,MAAM,GAAG,KAAK,EAChC,KAAK,EAAE,SAAS,EAChB,GAAG,EAAE,SAAS,EACd,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,GACxB,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;CAC5B;;AAED,wBAEC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoAtprotoOAuthClientModule.js","sourceRoot":"","sources":["../src/ExpoAtprotoOAuthClientModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,mBAAmB,EAAE,MAAM,MAAM,CAAA;AA8BxD,eAAe,mBAAmB,CAChC,wBAAwB,CACzB,CAAA","sourcesContent":["import { NativeModule, requireNativeModule } from 'expo'\nimport { SignedJwt, VerifyOptions, VerifyResult } from '@atproto/oauth-client'\nimport { ExpoAtprotoOAuthClientModuleEvents } from './ExpoAtprotoOAuthClientModule.types'\n\nexport type NativeJwk = {\n kty: 'EC'\n crv: 'P-256'\n kid: string\n x: string\n y: string\n d: string\n alg: 'ES256'\n}\n\ndeclare class ExpoAtprotoOAuthClientModule extends NativeModule<ExpoAtprotoOAuthClientModuleEvents> {\n digest(data: Uint8Array, algo: string): Promise<Uint8Array>\n\n getRandomValues(byteLength: number): Promise<Uint8Array>\n\n generatePrivateJwk(algorithm: string): Promise<NativeJwk>\n\n createJwt(header: string, payload: string, jwk: NativeJwk): Promise<SignedJwt>\n\n verifyJwt<C extends string = never>(\n token: SignedJwt,\n jwk: NativeJwk,\n options: VerifyOptions<C>,\n ): Promise<VerifyResult<C>>\n}\n\nexport default requireNativeModule<ExpoAtprotoOAuthClientModule>(\n 'ExpoAtprotoOAuthClient',\n)\n"]}
1
+ {"version":3,"file":"ExpoAtprotoOAuthClientModule.js","sourceRoot":"","sources":["../src/ExpoAtprotoOAuthClientModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,mBAAmB,EAAE,MAAM,MAAM,CAAA;AA8BxD,eAAe,mBAAmB,CAChC,wBAAwB,CACzB,CAAA","sourcesContent":["import { NativeModule, requireNativeModule } from 'expo'\nimport { SignedJwt, VerifyOptions, VerifyResult } from '@atproto/oauth-client'\nimport { ExpoAtprotoOAuthClientModuleEvents } from './ExpoAtprotoOAuthClientModule.types.js'\n\nexport type NativeJwk = {\n kty: 'EC'\n crv: 'P-256'\n kid: string\n x: string\n y: string\n d: string\n alg: 'ES256'\n}\n\ndeclare class ExpoAtprotoOAuthClientModule extends NativeModule<ExpoAtprotoOAuthClientModuleEvents> {\n digest(data: Uint8Array, algo: string): Promise<Uint8Array>\n\n getRandomValues(byteLength: number): Promise<Uint8Array>\n\n generatePrivateJwk(algorithm: string): Promise<NativeJwk>\n\n createJwt(header: string, payload: string, jwk: NativeJwk): Promise<SignedJwt>\n\n verifyJwt<C extends string = never>(\n token: SignedJwt,\n jwk: NativeJwk,\n options: VerifyOptions<C>,\n ): Promise<VerifyResult<C>>\n}\n\nexport default requireNativeModule<ExpoAtprotoOAuthClientModule>(\n 'ExpoAtprotoOAuthClient',\n)\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoAtprotoOAuthClientModule.types.js","sourceRoot":"","sources":["../src/ExpoAtprotoOAuthClientModule.types.ts"],"names":[],"mappings":"","sourcesContent":["// eslint-disable-next-line @typescript-eslint/ban-types\nexport type ExpoAtprotoOAuthClientModuleEvents = {}\n"]}
1
+ {"version":3,"file":"ExpoAtprotoOAuthClientModule.types.js","sourceRoot":"","sources":["../src/ExpoAtprotoOAuthClientModule.types.ts"],"names":[],"mappings":"","sourcesContent":["// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport type ExpoAtprotoOAuthClientModuleEvents = {}\n"]}
@@ -1,6 +1,6 @@
1
1
  import { AuthorizeOptions, OAuthClient, OAuthSession } from '@atproto/oauth-client';
2
- import { ExpoOAuthClientInterface } from './expo-oauth-client-interface';
3
- import { ExpoOAuthClientOptions } from './expo-oauth-client-options';
2
+ import { ExpoOAuthClientInterface } from './expo-oauth-client-interface.js';
3
+ import { ExpoOAuthClientOptions } from './expo-oauth-client-options.js';
4
4
  export declare const CUSTOM_URI_SCHEME_REGEX: RegExp;
5
5
  export declare class ExpoOAuthClient extends OAuthClient implements ExpoOAuthClientInterface {
6
6
  #private;
@@ -1 +1 @@
1
- {"version":3,"file":"expo-oauth-client.native.d.ts","sourceRoot":"","sources":["../src/expo-oauth-client.native.ts"],"names":[],"mappings":"AACA,OAAO,EACL,gBAAgB,EAChB,WAAW,EACX,YAAY,EAEb,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAA;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AAYpE,eAAO,MAAM,uBAAuB,QAA0C,CAAA;AAS9E,qBAAa,eACX,SAAQ,WACR,YAAW,wBAAwB;;gBAIvB,OAAO,EAAE,sBAAsB;IAwBrC,cAAc,IAAI,OAAO,CAAC,IAAI,GAAG,YAAY,CAAC;IAI9C,MAAM,CACV,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,YAAY,CAAC;IAsClB,CAAC,MAAM,CAAC,YAAY,CAAC;CAG5B"}
1
+ {"version":3,"file":"expo-oauth-client.native.d.ts","sourceRoot":"","sources":["../src/expo-oauth-client.native.ts"],"names":[],"mappings":"AACA,OAAO,EACL,gBAAgB,EAChB,WAAW,EACX,YAAY,EAEb,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAA;AAC3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAA;AAYvE,eAAO,MAAM,uBAAuB,QAA0C,CAAA;AAU9E,qBAAa,eACX,SAAQ,WACR,YAAW,wBAAwB;;gBAIvB,OAAO,EAAE,sBAAsB;IAwBrC,cAAc,IAAI,OAAO,CAAC,IAAI,GAAG,YAAY,CAAC;IAI9C,MAAM,CACV,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,YAAY,CAAC;IAsClB,CAAC,MAAM,CAAC,YAAY,CAAC;CAG5B"}
@@ -52,9 +52,9 @@ var __disposeResources = (this && this.__disposeResources) || (function (Suppres
52
52
  });
53
53
  import { openAuthSessionAsync } from 'expo-web-browser';
54
54
  import { OAuthClient, } from '@atproto/oauth-client';
55
- import { default as NativeModule } from './ExpoAtprotoOAuthClientModule';
56
- import { ExpoKey } from './utils/expo-key';
57
- import { AuthorizationServerMetadataCache, DidCache, DpopNonceCache, HandleCache, ProtectedResourceMetadataCache, SessionStore, StateStore, } from './utils/stores';
55
+ import { default as NativeModule } from './ExpoAtprotoOAuthClientModule.js';
56
+ import { ExpoKey } from './utils/expo-key.js';
57
+ import { AuthorizationServerMetadataCache, DidCache, DpopNonceCache, HandleCache, ProtectedResourceMetadataCache, SessionStore, StateStore, } from './utils/stores.js';
58
58
  export const CUSTOM_URI_SCHEME_REGEX = /^(?:[^.]+(?:\.[^.]+)+):\/(?:[^/].*)?$/;
59
59
  const isCustomUriScheme = (uri) => CUSTOM_URI_SCHEME_REGEX.test(uri);
60
60
  const runtimeImplementation = {
@@ -1 +1 @@
1
- {"version":3,"file":"expo-oauth-client.native.js","sourceRoot":"","sources":["../src/expo-oauth-client.native.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,EAEL,WAAW,GAGZ,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAA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AAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;gBAChD,CAAC,CAAC,WAAW,CAAC,YAAY,CAAA;YAE9B,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE;gBAC9C,YAAY,EAAE,WAAW;aAC1B,CAAC,CAAA;YACF,OAAO,OAAO,CAAA;QAChB,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,6BAA6B,MAAM,CAAC,IAAI,EAAE,CAAC,CAAA;QAC7D,CAAC;IACH,CAAC;IAED,KAAK,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC;QACzB,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAA;IAC7B,CAAC;CACF","sourcesContent":["import { openAuthSessionAsync } from 'expo-web-browser'\nimport {\n AuthorizeOptions,\n OAuthClient,\n OAuthSession,\n RuntimeImplementation,\n} from '@atproto/oauth-client'\nimport { default as NativeModule } from './ExpoAtprotoOAuthClientModule'\nimport { ExpoOAuthClientInterface } from './expo-oauth-client-interface'\nimport { ExpoOAuthClientOptions } from './expo-oauth-client-options'\nimport { ExpoKey } from './utils/expo-key'\nimport {\n AuthorizationServerMetadataCache,\n DidCache,\n DpopNonceCache,\n HandleCache,\n ProtectedResourceMetadataCache,\n SessionStore,\n StateStore,\n} from './utils/stores'\n\nexport const CUSTOM_URI_SCHEME_REGEX = /^(?:[^.]+(?:\\.[^.]+)+):\\/(?:[^/].*)?$/\nconst isCustomUriScheme = (uri: string) => CUSTOM_URI_SCHEME_REGEX.test(uri)\n\nconst runtimeImplementation: RuntimeImplementation = {\n createKey: async (algs) => ExpoKey.generate(algs),\n digest: async (bytes, { name }) => NativeModule.digest(bytes, name),\n getRandomValues: async (length) => NativeModule.getRandomValues(length),\n}\n\nexport class ExpoOAuthClient\n extends OAuthClient\n implements ExpoOAuthClientInterface\n{\n readonly #disposables: DisposableStack\n\n constructor(options: ExpoOAuthClientOptions) {\n using stack = new DisposableStack()\n\n super({\n ...options,\n responseMode: options.responseMode ?? 'query',\n keyset: undefined,\n runtimeImplementation,\n sessionStore: stack.use(new SessionStore()),\n stateStore: stack.use(new StateStore()),\n didCache: stack.use(new DidCache()),\n handleCache: stack.use(new HandleCache()),\n dpopNonceCache: stack.use(new DpopNonceCache()),\n authorizationServerMetadataCache: stack.use(\n new AuthorizationServerMetadataCache(),\n ),\n protectedResourceMetadataCache: stack.use(\n new ProtectedResourceMetadataCache(),\n ),\n })\n\n this.#disposables = stack.move()\n }\n\n async handleCallback(): Promise<null | OAuthSession> {\n return null\n }\n\n async signIn(\n input: string,\n options?: AuthorizeOptions,\n ): Promise<OAuthSession> {\n const redirectUri =\n options?.redirect_uri ??\n this.clientMetadata.redirect_uris.find(isCustomUriScheme)\n\n if (!redirectUri) {\n throw new TypeError(\n 'A redirect URI with a custom scheme is required for Expo OAuth.',\n )\n }\n\n const url = await this.authorize(input, {\n ...options,\n redirect_uri: redirectUri,\n display: options?.display ?? 'touch',\n })\n\n const result = await openAuthSessionAsync(url.toString(), redirectUri, {\n dismissButtonStyle: 'cancel', // iOS only\n preferEphemeralSession: false, // iOS only\n })\n\n if (result.type === 'success') {\n const callbackUrl = new URL(result.url)\n const params =\n this.responseMode === 'fragment'\n ? new URLSearchParams(callbackUrl.hash.slice(1))\n : callbackUrl.searchParams\n\n const { session } = await this.callback(params, {\n redirect_uri: redirectUri,\n })\n return session\n } else {\n throw new Error(`Authentication cancelled: ${result.type}`)\n }\n }\n\n async [Symbol.asyncDispose]() {\n this.#disposables.dispose()\n }\n}\n"]}
1
+ {"version":3,"file":"expo-oauth-client.native.js","sourceRoot":"","sources":["../src/expo-oauth-client.native.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,EAEL,WAAW,GAGZ,MAAM,uBAAuB,CAAA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IAAI,eAAe,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;gBAChD,CAAC,CAAC,WAAW,CAAC,YAAY,CAAA;YAE9B,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE;gBAC9C,YAAY,EAAE,WAAW;aAC1B,CAAC,CAAA;YACF,OAAO,OAAO,CAAA;QAChB,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,6BAA6B,MAAM,CAAC,IAAI,EAAE,CAAC,CAAA;QAC7D,CAAC;IACH,CAAC;IAED,KAAK,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC;QACzB,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAA;IAC7B,CAAC;CACF","sourcesContent":["import { openAuthSessionAsync } from 'expo-web-browser'\nimport {\n AuthorizeOptions,\n OAuthClient,\n OAuthSession,\n RuntimeImplementation,\n} from '@atproto/oauth-client'\nimport { default as NativeModule } from './ExpoAtprotoOAuthClientModule.js'\nimport { ExpoOAuthClientInterface } from './expo-oauth-client-interface.js'\nimport { ExpoOAuthClientOptions } from './expo-oauth-client-options.js'\nimport { ExpoKey } from './utils/expo-key.js'\nimport {\n AuthorizationServerMetadataCache,\n DidCache,\n DpopNonceCache,\n HandleCache,\n ProtectedResourceMetadataCache,\n SessionStore,\n StateStore,\n} from './utils/stores.js'\n\nexport const CUSTOM_URI_SCHEME_REGEX = /^(?:[^.]+(?:\\.[^.]+)+):\\/(?:[^/].*)?$/\nconst isCustomUriScheme = (uri: string) => CUSTOM_URI_SCHEME_REGEX.test(uri)\n\nconst runtimeImplementation: RuntimeImplementation = {\n createKey: async (algs) => ExpoKey.generate(algs),\n digest: async (bytes, { name }) =>\n NativeModule.digest(bytes, name) as Promise<Uint8Array<ArrayBuffer>>,\n getRandomValues: async (length) => NativeModule.getRandomValues(length),\n}\n\nexport class ExpoOAuthClient\n extends OAuthClient\n implements ExpoOAuthClientInterface\n{\n readonly #disposables: DisposableStack\n\n constructor(options: ExpoOAuthClientOptions) {\n using stack = new DisposableStack()\n\n super({\n ...options,\n responseMode: options.responseMode ?? 'query',\n keyset: undefined,\n runtimeImplementation,\n sessionStore: stack.use(new SessionStore()),\n stateStore: stack.use(new StateStore()),\n didCache: stack.use(new DidCache()),\n handleCache: stack.use(new HandleCache()),\n dpopNonceCache: stack.use(new DpopNonceCache()),\n authorizationServerMetadataCache: stack.use(\n new AuthorizationServerMetadataCache(),\n ),\n protectedResourceMetadataCache: stack.use(\n new ProtectedResourceMetadataCache(),\n ),\n })\n\n this.#disposables = stack.move()\n }\n\n async handleCallback(): Promise<null | OAuthSession> {\n return null\n }\n\n async signIn(\n input: string,\n options?: AuthorizeOptions,\n ): Promise<OAuthSession> {\n const redirectUri =\n options?.redirect_uri ??\n this.clientMetadata.redirect_uris.find(isCustomUriScheme)\n\n if (!redirectUri) {\n throw new TypeError(\n 'A redirect URI with a custom scheme is required for Expo OAuth.',\n )\n }\n\n const url = await this.authorize(input, {\n ...options,\n redirect_uri: redirectUri,\n display: options?.display ?? 'touch',\n })\n\n const result = await openAuthSessionAsync(url.toString(), redirectUri, {\n dismissButtonStyle: 'cancel', // iOS only\n preferEphemeralSession: false, // iOS only\n })\n\n if (result.type === 'success') {\n const callbackUrl = new URL(result.url)\n const params =\n this.responseMode === 'fragment'\n ? new URLSearchParams(callbackUrl.hash.slice(1))\n : callbackUrl.searchParams\n\n const { session } = await this.callback(params, {\n redirect_uri: redirectUri,\n })\n return session\n } else {\n throw new Error(`Authentication cancelled: ${result.type}`)\n }\n }\n\n async [Symbol.asyncDispose]() {\n this.#disposables.dispose()\n }\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import { AuthorizeOptions, BrowserOAuthClient, OAuthSession } from '@atproto/oauth-client-browser';
2
- import { ExpoOAuthClientInterface } from './expo-oauth-client-interface';
3
- import { ExpoOAuthClientOptions } from './expo-oauth-client-options';
2
+ import { ExpoOAuthClientInterface } from './expo-oauth-client-interface.js';
3
+ import { ExpoOAuthClientOptions } from './expo-oauth-client-options.js';
4
4
  export declare class ExpoOAuthClient extends BrowserOAuthClient implements ExpoOAuthClientInterface {
5
5
  constructor({ clientMetadata, responseMode, ...options }: ExpoOAuthClientOptions);
6
6
  signIn(input: string, options?: AuthorizeOptions): Promise<OAuthSession>;
@@ -1 +1 @@
1
- {"version":3,"file":"expo-oauth-client.web.d.ts","sourceRoot":"","sources":["../src/expo-oauth-client.web.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,YAAY,EACb,MAAM,+BAA+B,CAAA;AACtC,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAA;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AAEpE,qBAAa,eACX,SAAQ,kBACR,YAAW,wBAAwB;gBAEvB,EACV,cAAc,EACd,YAAyB,EACzB,GAAG,OAAO,EACX,EAAE,sBAAsB;IAIV,MAAM,CACnB,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,YAAY,CAAC;IAQlB,cAAc,IAAI,OAAO,CAAC,IAAI,GAAG,YAAY,CAAC;CAUrD"}
1
+ {"version":3,"file":"expo-oauth-client.web.d.ts","sourceRoot":"","sources":["../src/expo-oauth-client.web.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,YAAY,EACb,MAAM,+BAA+B,CAAA;AACtC,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAA;AAC3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAA;AAEvE,qBAAa,eACX,SAAQ,kBACR,YAAW,wBAAwB;gBAEvB,EACV,cAAc,EACd,YAAyB,EACzB,GAAG,OAAO,EACX,EAAE,sBAAsB;IAIV,MAAM,CACnB,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,YAAY,CAAC;IAQlB,cAAc,IAAI,OAAO,CAAC,IAAI,GAAG,YAAY,CAAC;CAUrD"}
@@ -1 +1 @@
1
- {"version":3,"file":"expo-oauth-client.web.js","sourceRoot":"","sources":["../src/expo-oauth-client.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,kBAAkB,GAEnB,MAAM,+BAA+B,CAAA;AAItC,MAAM,OAAO,eACX,SAAQ,kBAAkB;IAG1B,YAAY,EACV,cAAc,EACd,YAAY,GAAG,UAAU,EACzB,GAAG,OAAO,EACa;QACvB,KAAK,CAAC,EAAE,GAAG,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,CAAC,CAAA;IACrD,CAAC;IAEQ,KAAK,CAAC,MAAM,CACnB,KAAa,EACb,OAA0B;QAE1B,mBAAmB;QACnB,OAAO,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE;YAC7B,GAAG,OAAO;YACV,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,OAAO;SACrC,CAAC,CAAA;IACJ,CAAC;IAED,KAAK,CAAC,cAAc;QAClB,MAAM,MAAM,GAAG,IAAI,CAAC,kBAAkB,EAAE,CAAA;QACxC,IAAI,CAAC,MAAM;YAAE,OAAO,IAAI,CAAA;QAExB,MAAM,GAAG,GAAG,IAAI,CAAC,eAAe,EAAE,CAAA;QAClC,IAAI,CAAC,GAAG;YAAE,OAAO,IAAI,CAAA;QAErB,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;QACxD,OAAO,OAAO,CAAA;IAChB,CAAC;CACF","sourcesContent":["import {\n AuthorizeOptions,\n BrowserOAuthClient,\n OAuthSession,\n} from '@atproto/oauth-client-browser'\nimport { ExpoOAuthClientInterface } from './expo-oauth-client-interface'\nimport { ExpoOAuthClientOptions } from './expo-oauth-client-options'\n\nexport class ExpoOAuthClient\n extends BrowserOAuthClient\n implements ExpoOAuthClientInterface\n{\n constructor({\n clientMetadata,\n responseMode = 'fragment',\n ...options\n }: ExpoOAuthClientOptions) {\n super({ ...options, clientMetadata, responseMode })\n }\n\n override async signIn(\n input: string,\n options?: AuthorizeOptions,\n ): Promise<OAuthSession> {\n // Force popup mode\n return this.signInPopup(input, {\n ...options,\n display: options?.display ?? 'touch',\n })\n }\n\n async handleCallback(): Promise<null | OAuthSession> {\n const params = this.readCallbackParams()\n if (!params) return null\n\n const url = this.findRedirectUrl()\n if (!url) return null\n\n const { session } = await this.initCallback(params, url)\n return session\n }\n}\n"]}
1
+ {"version":3,"file":"expo-oauth-client.web.js","sourceRoot":"","sources":["../src/expo-oauth-client.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,kBAAkB,GAEnB,MAAM,+BAA+B,CAAA;AAItC,MAAM,OAAO,eACX,SAAQ,kBAAkB;IAG1B,YAAY,EACV,cAAc,EACd,YAAY,GAAG,UAAU,EACzB,GAAG,OAAO,EACa;QACvB,KAAK,CAAC,EAAE,GAAG,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,CAAC,CAAA;IACrD,CAAC;IAEQ,KAAK,CAAC,MAAM,CACnB,KAAa,EACb,OAA0B;QAE1B,mBAAmB;QACnB,OAAO,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE;YAC7B,GAAG,OAAO;YACV,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,OAAO;SACrC,CAAC,CAAA;IACJ,CAAC;IAED,KAAK,CAAC,cAAc;QAClB,MAAM,MAAM,GAAG,IAAI,CAAC,kBAAkB,EAAE,CAAA;QACxC,IAAI,CAAC,MAAM;YAAE,OAAO,IAAI,CAAA;QAExB,MAAM,GAAG,GAAG,IAAI,CAAC,eAAe,EAAE,CAAA;QAClC,IAAI,CAAC,GAAG;YAAE,OAAO,IAAI,CAAA;QAErB,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;QACxD,OAAO,OAAO,CAAA;IAChB,CAAC;CACF","sourcesContent":["import {\n AuthorizeOptions,\n BrowserOAuthClient,\n OAuthSession,\n} from '@atproto/oauth-client-browser'\nimport { ExpoOAuthClientInterface } from './expo-oauth-client-interface.js'\nimport { ExpoOAuthClientOptions } from './expo-oauth-client-options.js'\n\nexport class ExpoOAuthClient\n extends BrowserOAuthClient\n implements ExpoOAuthClientInterface\n{\n constructor({\n clientMetadata,\n responseMode = 'fragment',\n ...options\n }: ExpoOAuthClientOptions) {\n super({ ...options, clientMetadata, responseMode })\n }\n\n override async signIn(\n input: string,\n options?: AuthorizeOptions,\n ): Promise<OAuthSession> {\n // Force popup mode\n return this.signInPopup(input, {\n ...options,\n display: options?.display ?? 'touch',\n })\n }\n\n async handleCallback(): Promise<null | OAuthSession> {\n const params = this.readCallbackParams()\n if (!params) return null\n\n const url = this.findRedirectUrl()\n if (!url) return null\n\n const { session } = await this.initCallback(params, url)\n return session\n }\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import './polyfill';
2
2
  export * from '@atproto/oauth-client';
3
- export type { ExpoOAuthClientInterface } from './expo-oauth-client-interface';
4
- export type { ExpoOAuthClientOptions } from './expo-oauth-client-options';
5
- export { ExpoOAuthClient } from './expo-oauth-client';
3
+ export type { ExpoOAuthClientInterface } from './expo-oauth-client-interface.js';
4
+ export type { ExpoOAuthClientOptions } from './expo-oauth-client-options.js';
5
+ export { ExpoOAuthClient } from './expo-oauth-client.js';
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,CAAA;AAEnB,cAAc,uBAAuB,CAAA;AAErC,YAAY,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAA;AAC7E,YAAY,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AAEzE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,CAAA;AAEnB,cAAc,uBAAuB,CAAA;AAErC,YAAY,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAA;AAChF,YAAY,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAA;AAE5E,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA"}
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  import './polyfill';
2
2
  export * from '@atproto/oauth-client';
3
- export { ExpoOAuthClient } from './expo-oauth-client';
3
+ export { ExpoOAuthClient } from './expo-oauth-client.js';
4
4
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,CAAA;AAEnB,cAAc,uBAAuB,CAAA;AAKrC,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA","sourcesContent":["import './polyfill'\n\nexport * from '@atproto/oauth-client'\n\nexport type { ExpoOAuthClientInterface } from './expo-oauth-client-interface'\nexport type { ExpoOAuthClientOptions } from './expo-oauth-client-options'\n\nexport { ExpoOAuthClient } from './expo-oauth-client'\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,CAAA;AAEnB,cAAc,uBAAuB,CAAA;AAKrC,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA","sourcesContent":["import './polyfill'\n\nexport * from '@atproto/oauth-client'\n\nexport type { ExpoOAuthClientInterface } from './expo-oauth-client-interface.js'\nexport type { ExpoOAuthClientOptions } from './expo-oauth-client-options.js'\n\nexport { ExpoOAuthClient } from './expo-oauth-client.js'\n"]}
@@ -1,5 +1,5 @@
1
1
  import { type Jwk, type JwtHeader, type JwtPayload, Key, type SignedJwt, type VerifyOptions, type VerifyResult } from '@atproto/oauth-client';
2
- import type { NativeJwk } from '../ExpoAtprotoOAuthClientModule';
2
+ import type { NativeJwk } from '../ExpoAtprotoOAuthClientModule.js';
3
3
  export type ExpoJwk = Jwk & NativeJwk & {
4
4
  key_ops: ['sign'];
5
5
  };
@@ -1 +1 @@
1
- {"version":3,"file":"expo-key.d.ts","sourceRoot":"","sources":["../../src/utils/expo-key.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,GAAG,EACR,KAAK,SAAS,EACd,KAAK,UAAU,EACf,GAAG,EACH,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,YAAY,EAClB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAA;AAGhE,MAAM,MAAM,OAAO,GAAG,GAAG,GAAG,SAAS,GAAG;IAAE,OAAO,EAAE,CAAC,MAAM,CAAC,CAAA;CAAE,CAAA;AAC7D,qBAAa,OAAQ,SAAQ,GAAG,CAAC,OAAO,CAAC;IACjC,SAAS,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC;IAQrE,SAAS,CAAC,CAAC,SAAS,MAAM,GAAG,KAAK,EACtC,KAAK,EAAE,SAAS,EAChB,OAAO,GAAE,aAAa,CAAC,CAAC,CAAM,GAC7B,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;WAId,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;CAQxD"}
1
+ {"version":3,"file":"expo-key.d.ts","sourceRoot":"","sources":["../../src/utils/expo-key.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,GAAG,EACR,KAAK,SAAS,EACd,KAAK,UAAU,EACf,GAAG,EACH,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,YAAY,EAClB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAA;AAGnE,MAAM,MAAM,OAAO,GAAG,GAAG,GAAG,SAAS,GAAG;IAAE,OAAO,EAAE,CAAC,MAAM,CAAC,CAAA;CAAE,CAAA;AAC7D,qBAAa,OAAQ,SAAQ,GAAG,CAAC,OAAO,CAAC;IACjC,SAAS,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC;IAQrE,SAAS,CAAC,CAAC,SAAS,MAAM,GAAG,KAAK,EACtC,KAAK,EAAE,SAAS,EAChB,OAAO,GAAE,aAAa,CAAC,CAAC,CAAM,GAC7B,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;WAId,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC;CAQxD"}
@@ -1,5 +1,5 @@
1
1
  import { Key, } from '@atproto/oauth-client';
2
- import { default as NativeModule } from '../ExpoAtprotoOAuthClientModule';
2
+ import { default as NativeModule } from '../ExpoAtprotoOAuthClientModule.js';
3
3
  export class ExpoKey extends Key {
4
4
  async createJwt(header, payload) {
5
5
  return NativeModule.createJwt(JSON.stringify(header), JSON.stringify(payload), toNativeJwk(this.jwk));
@@ -1 +1 @@
1
- {"version":3,"file":"expo-key.js","sourceRoot":"","sources":["../../src/utils/expo-key.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,GAAG,GAIJ,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,iCAAiC,CAAA;AAGzE,MAAM,OAAO,OAAQ,SAAQ,GAAY;IACvC,KAAK,CAAC,SAAS,CAAC,MAAiB,EAAE,OAAmB;QACpD,OAAO,YAAY,CAAC,SAAS,CAC3B,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EACtB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EACvB,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CACtB,CAAA;IACH,CAAC;IAED,KAAK,CAAC,SAAS,CACb,KAAgB,EAChB,UAA4B,EAAE;QAE9B,OAAO,YAAY,CAAC,SAAS,CAAC,KAAK,EAAE,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAA;IACtE,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAc;QAClC,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;YAC3B,MAAM,GAAG,GAAG,MAAM,YAAY,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAA;YAC1D,OAAO,IAAI,OAAO,CAAC,EAAE,GAAG,GAAG,EAAE,OAAO,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;QACnD,CAAC;QAED,MAAM,SAAS,CAAC,oCAAoC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACxE,CAAC;CACF;AAED,SAAS,WAAW,CAAC,GAAY;IAC/B,OAAO;QACL,GAAG,EAAE,GAAG,CAAC,GAAG;QACZ,GAAG,EAAE,GAAG,CAAC,GAAG;QACZ,GAAG,EAAE,GAAG,CAAC,GAAG;QACZ,CAAC,EAAE,GAAG,CAAC,CAAC;QACR,CAAC,EAAE,GAAG,CAAC,CAAC;QACR,CAAC,EAAE,GAAG,CAAC,CAAC;QACR,GAAG,EAAE,GAAG,CAAC,GAAG;KACb,CAAA;AACH,CAAC","sourcesContent":["import {\n type Jwk,\n type JwtHeader,\n type JwtPayload,\n Key,\n type SignedJwt,\n type VerifyOptions,\n type VerifyResult,\n} from '@atproto/oauth-client'\nimport type { NativeJwk } from '../ExpoAtprotoOAuthClientModule'\nimport { default as NativeModule } from '../ExpoAtprotoOAuthClientModule'\n\nexport type ExpoJwk = Jwk & NativeJwk & { key_ops: ['sign'] }\nexport class ExpoKey extends Key<ExpoJwk> {\n async createJwt(header: JwtHeader, payload: JwtPayload): Promise<SignedJwt> {\n return NativeModule.createJwt(\n JSON.stringify(header),\n JSON.stringify(payload),\n toNativeJwk(this.jwk),\n )\n }\n\n async verifyJwt<C extends string = never>(\n token: SignedJwt,\n options: VerifyOptions<C> = {},\n ): Promise<VerifyResult<C>> {\n return NativeModule.verifyJwt(token, toNativeJwk(this.jwk), options)\n }\n\n static async generate(algs: string[]): Promise<ExpoKey> {\n if (algs.includes('ES256')) {\n const jwk = await NativeModule.generatePrivateJwk('ES256')\n return new ExpoKey({ ...jwk, key_ops: ['sign'] })\n }\n\n throw TypeError(`No supported algorithm found in: ${algs.join(', ')}`)\n }\n}\n\nfunction toNativeJwk(jwk: ExpoJwk): NativeJwk {\n return {\n kty: jwk.kty,\n crv: jwk.crv,\n kid: jwk.kid,\n x: jwk.x,\n y: jwk.y,\n d: jwk.d,\n alg: jwk.alg,\n }\n}\n"]}
1
+ {"version":3,"file":"expo-key.js","sourceRoot":"","sources":["../../src/utils/expo-key.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,GAAG,GAIJ,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,oCAAoC,CAAA;AAG5E,MAAM,OAAO,OAAQ,SAAQ,GAAY;IACvC,KAAK,CAAC,SAAS,CAAC,MAAiB,EAAE,OAAmB;QACpD,OAAO,YAAY,CAAC,SAAS,CAC3B,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EACtB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EACvB,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CACtB,CAAA;IACH,CAAC;IAED,KAAK,CAAC,SAAS,CACb,KAAgB,EAChB,UAA4B,EAAE;QAE9B,OAAO,YAAY,CAAC,SAAS,CAAC,KAAK,EAAE,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAA;IACtE,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAc;QAClC,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;YAC3B,MAAM,GAAG,GAAG,MAAM,YAAY,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAA;YAC1D,OAAO,IAAI,OAAO,CAAC,EAAE,GAAG,GAAG,EAAE,OAAO,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;QACnD,CAAC;QAED,MAAM,SAAS,CAAC,oCAAoC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACxE,CAAC;CACF;AAED,SAAS,WAAW,CAAC,GAAY;IAC/B,OAAO;QACL,GAAG,EAAE,GAAG,CAAC,GAAG;QACZ,GAAG,EAAE,GAAG,CAAC,GAAG;QACZ,GAAG,EAAE,GAAG,CAAC,GAAG;QACZ,CAAC,EAAE,GAAG,CAAC,CAAC;QACR,CAAC,EAAE,GAAG,CAAC,CAAC;QACR,CAAC,EAAE,GAAG,CAAC,CAAC;QACR,GAAG,EAAE,GAAG,CAAC,GAAG;KACb,CAAA;AACH,CAAC","sourcesContent":["import {\n type Jwk,\n type JwtHeader,\n type JwtPayload,\n Key,\n type SignedJwt,\n type VerifyOptions,\n type VerifyResult,\n} from '@atproto/oauth-client'\nimport type { NativeJwk } from '../ExpoAtprotoOAuthClientModule.js'\nimport { default as NativeModule } from '../ExpoAtprotoOAuthClientModule.js'\n\nexport type ExpoJwk = Jwk & NativeJwk & { key_ops: ['sign'] }\nexport class ExpoKey extends Key<ExpoJwk> {\n async createJwt(header: JwtHeader, payload: JwtPayload): Promise<SignedJwt> {\n return NativeModule.createJwt(\n JSON.stringify(header),\n JSON.stringify(payload),\n toNativeJwk(this.jwk),\n )\n }\n\n async verifyJwt<C extends string = never>(\n token: SignedJwt,\n options: VerifyOptions<C> = {},\n ): Promise<VerifyResult<C>> {\n return NativeModule.verifyJwt(token, toNativeJwk(this.jwk), options)\n }\n\n static async generate(algs: string[]): Promise<ExpoKey> {\n if (algs.includes('ES256')) {\n const jwk = await NativeModule.generatePrivateJwk('ES256')\n return new ExpoKey({ ...jwk, key_ops: ['sign'] })\n }\n\n throw TypeError(`No supported algorithm found in: ${algs.join(', ')}`)\n }\n}\n\nfunction toNativeJwk(jwk: ExpoJwk): NativeJwk {\n return {\n kty: jwk.kty,\n crv: jwk.crv,\n kid: jwk.kid,\n x: jwk.x,\n y: jwk.y,\n d: jwk.d,\n alg: jwk.alg,\n }\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import { Configuration } from 'react-native-mmkv';
2
2
  import type { SimpleStore, Value } from '@atproto-labs/simple-store';
3
- import { MMKVSimpleStore, MMKVSimpleStoreOptions } from './mmkv-simple-store';
3
+ import { MMKVSimpleStore, MMKVSimpleStoreOptions } from './mmkv-simple-store.js';
4
4
  export type MMKVSimpleStoreTTLOptions<V extends Value> = MMKVSimpleStoreOptions<V> & {
5
5
  clearInterval?: null | false | number;
6
6
  expiresAt: (value: V) => null | number;
@@ -1 +1 @@
1
- {"version":3,"file":"mmkv-simple-store-ttl.d.ts","sourceRoot":"","sources":["../../src/utils/mmkv-simple-store-ttl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAQ,MAAM,mBAAmB,CAAA;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAA;AACpE,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAA;AAE7E,MAAM,MAAM,yBAAyB,CAAC,CAAC,SAAS,KAAK,IACnD,sBAAsB,CAAC,CAAC,CAAC,GAAG;IAC1B,aAAa,CAAC,EAAE,IAAI,GAAG,KAAK,GAAG,MAAM,CAAA;IACrC,SAAS,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,GAAG,MAAM,CAAA;CACvC,CAAA;AAEH;;;GAGG;AACH,qBAAa,kBAAkB,CAAC,CAAC,SAAS,KAAK,CAC7C,SAAQ,eAAe,CAAC,CAAC,CACzB,YAAW,UAAU,EAAE,WAAW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,SAAS,EACT,MAAM,EACN,MAAM,EAEN,GAAG,MAAM,EACV,EAAE,yBAAyB,CAAC,CAAC,CAAC,GAAG,aAAa;IAY/C,CAAC,MAAM,CAAC,OAAO,CAAC;IAKP,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI;IAQhC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IAS/B,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAKtB,KAAK,IAAI,IAAI;IAKtB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAIlD,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAK/B,YAAY;CAOb"}
@@ -1,5 +1,5 @@
1
1
  import { MMKV } from 'react-native-mmkv';
2
- import { MMKVSimpleStore } from './mmkv-simple-store';
2
+ import { MMKVSimpleStore } from './mmkv-simple-store.js';
3
3
  /**
4
4
  * A {@link SimpleStore} implementation based on {@link MMKVSimpleStore} that
5
5
  * supports expiring entries after a certain time.
@@ -1 +1 @@
1
- {"version":3,"file":"mmkv-simple-store-ttl.js","sourceRoot":"","sources":["../../src/utils/mmkv-simple-store-ttl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAEvD,OAAO,EAAE,eAAe,EAA0B,MAAM,qBAAqB,CAAA;AAQ7E;;;GAGG;AACH,MAAM,OAAO,kBACX,SAAQ,eAAkB;IAGjB,MAAM,CAAM;IACZ,UAAU,CAA6B;IACvC,WAAW,CAAiC;IAErD,YAAY,EACV,aAAa,GAAG,EAAE,GAAG,GAAG,EACxB,SAAS,EACT,MAAM,EACN,MAAM,EAEN,GAAG,MAAM,EACoC;QAC7C,KAAK,CAAC,EAAE,GAAG,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;QAEpC,IAAI,CAAC,MAAM,GAAG,IAAI,IAAI,C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,CAAC,KAAK,EAAE,CAAA;QACb,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAA;IACxB,CAAC;IAED,iBAAiB,CAAC,GAAW;QAC3B,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,SAAS,CAAA;IAChD,CAAC;IAED,SAAS,CAAC,GAAW;QACnB,MAAM,cAAc,GAAG,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAA;QAClD,OAAO,cAAc,IAAI,IAAI,IAAI,cAAc,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;IAC9D,CAAC;IAED,YAAY;QACV,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,IAAI,EAAE,EAAE,CAAC;YACjD,IAAI,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC;gBACxB,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;YACf,CAAC;QACH,CAAC;IACH,CAAC;CACF","sourcesContent":["import { Configuration, MMKV } from 'react-native-mmkv'\nimport type { SimpleStore, Value } from '@atproto-labs/simple-store'\nimport { MMKVSimpleStore, MMKVSimpleStoreOptions } from './mmkv-simple-store'\n\nexport type MMKVSimpleStoreTTLOptions<V extends Value> =\n MMKVSimpleStoreOptions<V> & {\n clearInterval?: null | false | number\n expiresAt: (value: V) => null | number\n }\n\n/**\n * A {@link SimpleStore} implementation based on {@link MMKVSimpleStore} that\n * supports expiring entries after a certain time.\n */\nexport class MMKVSimpleStoreTTL<V extends Value>\n extends MMKVSimpleStore<V>\n implements Disposable, SimpleStore<string, V>\n{\n readonly #store: MMKV\n readonly #expiresAt: (value: V) => null | number\n readonly #clearTimer?: ReturnType<typeof setInterval>\n\n constructor({\n clearInterval = 60 * 1e3,\n expiresAt,\n encode,\n decode,\n\n ...config\n }: MMKVSimpleStoreTTLOptions<V> & Configuration) {\n super({ ...config, encode, decode })\n\n this.#store = new MMKV({ ...config, id: `${config.id}.exp` })\n this.#expiresAt = expiresAt\n if (clearInterval) {\n this.#clearTimer = setInterval(() => this.clearExpired(), clearInterval)\n }\n\n this.clearExpired()\n }\n\n [Symbol.dispose]() {\n clearInterval(this.#clearTimer)\n this.clearExpired()\n }\n\n override set(key: string, value: V): void {\n super.set(key, value)\n\n const expirationDate = this.#expiresAt.call(null, value)\n if (expirationDate == null) this.#store.delete(key)\n else this.#store.set(key, expirationDate)\n }\n\n override get(key: string): V | undefined {\n if (this.isExpired(key)) {\n this.del(key)\n return undefined\n }\n\n return super.get(key)\n }\n\n override del(key: string): void {\n super.del(key)\n this.#store.delete(key)\n }\n\n override clear(): void {\n super.clear()\n this.#store.clearAll()\n }\n\n getExpirationTime(key: string): number | undefined {\n return this.#store.getNumber(key) ?? undefined\n }\n\n isExpired(key: string): boolean {\n const expirationTime = this.getExpirationTime(key)\n return expirationTime != null && expirationTime < Date.now()\n }\n\n clearExpired() {\n for (const key of this.#store.getAllKeys() ?? []) {\n if (this.isExpired(key)) {\n this.del(key)\n }\n }\n }\n}\n"]}
1
+ {"version":3,"file":"mmkv-simple-store-ttl.js","sourceRoot":"","sources":["../../src/utils/mmkv-simple-store-ttl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAEvD,OAAO,EAAE,eAAe,EAA0B,MAAM,wBAAwB,CAAA;AAQhF;;;GAGG;AACH,MAAM,OAAO,kBACX,SAAQ,eAAkB;IAGjB,MAAM,CAAM;IACZ,UAAU,CAA6B;IACvC,WAAW,CAAiC;IAErD,YAAY,EACV,aAAa,GAAG,EAAE,GAAG,GAAG,EACxB,SAAS,EACT,MAAM,EACN,MAAM,EAEN,GAAG,MAAM,EACoC;QAC7C,KAAK,CAAC,EAAE,GAAG,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;QAEpC,IAAI,CAAC,MAAM,GAAG,IAAI,IAAI,CAAC,EAAE,GAAG,MAAM,EAAE,EAAE,E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CAAC,MAAM,CAAC,QAAQ,EAAE,CAAA;IACxB,CAAC;IAED,iBAAiB,CAAC,GAAW;QAC3B,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,SAAS,CAAA;IAChD,CAAC;IAED,SAAS,CAAC,GAAW;QACnB,MAAM,cAAc,GAAG,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAA;QAClD,OAAO,cAAc,IAAI,IAAI,IAAI,cAAc,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;IAC9D,CAAC;IAED,YAAY;QACV,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,IAAI,EAAE,EAAE,CAAC;YACjD,IAAI,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC;gBACxB,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;YACf,CAAC;QACH,CAAC;IACH,CAAC;CACF","sourcesContent":["import { Configuration, MMKV } from 'react-native-mmkv'\nimport type { SimpleStore, Value } from '@atproto-labs/simple-store'\nimport { MMKVSimpleStore, MMKVSimpleStoreOptions } from './mmkv-simple-store.js'\n\nexport type MMKVSimpleStoreTTLOptions<V extends Value> =\n MMKVSimpleStoreOptions<V> & {\n clearInterval?: null | false | number\n expiresAt: (value: V) => null | number\n }\n\n/**\n * A {@link SimpleStore} implementation based on {@link MMKVSimpleStore} that\n * supports expiring entries after a certain time.\n */\nexport class MMKVSimpleStoreTTL<V extends Value>\n extends MMKVSimpleStore<V>\n implements Disposable, SimpleStore<string, V>\n{\n readonly #store: MMKV\n readonly #expiresAt: (value: V) => null | number\n readonly #clearTimer?: ReturnType<typeof setInterval>\n\n constructor({\n clearInterval = 60 * 1e3,\n expiresAt,\n encode,\n decode,\n\n ...config\n }: MMKVSimpleStoreTTLOptions<V> & Configuration) {\n super({ ...config, encode, decode })\n\n this.#store = new MMKV({ ...config, id: `${config.id}.exp` })\n this.#expiresAt = expiresAt\n if (clearInterval) {\n this.#clearTimer = setInterval(() => this.clearExpired(), clearInterval)\n }\n\n this.clearExpired()\n }\n\n [Symbol.dispose]() {\n clearInterval(this.#clearTimer)\n this.clearExpired()\n }\n\n override set(key: string, value: V): void {\n super.set(key, value)\n\n const expirationDate = this.#expiresAt.call(null, value)\n if (expirationDate == null) this.#store.delete(key)\n else this.#store.set(key, expirationDate)\n }\n\n override get(key: string): V | undefined {\n if (this.isExpired(key)) {\n this.del(key)\n return undefined\n }\n\n return super.get(key)\n }\n\n override del(key: string): void {\n super.del(key)\n this.#store.delete(key)\n }\n\n override clear(): void {\n super.clear()\n this.#store.clearAll()\n }\n\n getExpirationTime(key: string): number | undefined {\n return this.#store.getNumber(key) ?? undefined\n }\n\n isExpired(key: string): boolean {\n const expirationTime = this.getExpirationTime(key)\n return expirationTime != null && expirationTime < Date.now()\n }\n\n clearExpired() {\n for (const key of this.#store.getAllKeys() ?? []) {\n if (this.isExpired(key)) {\n this.del(key)\n }\n }\n }\n}\n"]}
@@ -1,9 +1,9 @@
1
1
  import type { DidDocument, InternalStateData, OAuthAuthorizationServerMetadata, OAuthProtectedResourceMetadata, ResolvedHandle, Session } from '@atproto/oauth-client';
2
- import { MMKVSimpleStoreTTL } from './mmkv-simple-store-ttl';
2
+ import { MMKVSimpleStoreTTL } from './mmkv-simple-store-ttl.js';
3
3
  export declare class AuthorizationServerMetadataCache extends MMKVSimpleStoreTTL<OAuthAuthorizationServerMetadata> {
4
4
  constructor();
5
5
  }
6
- export declare class ProtectedResourceMetadataCache extends MMKVSimpleStoreTTL<OAuthProtectedResourceMetadata> {
6
+ export declare class ProtectedResourceMetadataCache extends MMKVSimpleStoreTTL<OAuthProtectedResourceMetadata | null> {
7
7
  constructor();
8
8
  }
9
9
  export declare class DpopNonceCache extends MMKVSimpleStoreTTL<string> {
@@ -1 +1 @@
1
- {"version":3,"file":"stores.d.ts","sourceRoot":"","sources":["../../src/utils/stores.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,E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a,YAAa,SAAQ,kBAAkB,CAAC,OAAO,CAAC;;CAkB5D"}
@@ -1,5 +1,5 @@
1
- import { ExpoKey } from './expo-key';
2
- import { MMKVSimpleStoreTTL } from './mmkv-simple-store-ttl';
1
+ import { ExpoKey } from './expo-key.js';
2
+ import { MMKVSimpleStoreTTL } from './mmkv-simple-store-ttl.js';
3
3
  const MMKV_ID = 'expo-atproto-oauth-client';
4
4
  export class AuthorizationServerMetadataCache extends MMKVSimpleStoreTTL {
5
5
  constructor() {
@@ -1 +1 @@
1
- {"version":3,"file":"stores.js","sourceRoot":"","sources":["../../src/utils/stores.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAE5D,MAAM,OAAO,GAAG,2BAA2B,CAAA;AAE3C,MAAM,OAAO,gCAAiC,SAAQ,kBAAoD;IACxG;QACE,KAAK,CAAC;YACJ,EAAE,EAAE,GAAG,OAAO,8BAA8B;YAC5C,SAAS,EAAE,gBAAgB;YAC3B,MAAM,EAAE,IAAI,CAAC,KAAK;YAClB,MAAM,EAAE,IAAI,CAAC,SAAS;SACvB,CAAC,CAAA;IACJ,CAAC;CACF;AAED,MAAM,OAAO,8BAA+B,SAAQ,kBAAkD;IACpG;QACE,KAAK,CAAC;YACJ,EAAE,EAAE,GAAG,OAAO,4BAA4B;YAC1C,SAAS,EAAE,gBAAgB;YAC3B,MAAM,EAAE,IAAI,CAAC,KAAK;YAClB,MAAM,EAAE,IAAI,CAAC,SAAS;SACvB,CAAC,CAAA;IACJ,CAAC;CACF;AAED,MAAM,OAAO,cAAe,SAAQ,kBAA0B;IAC5D;QACE,KAAK,CAAC;YACJ,EAAE,EAAE,GAAG,OAAO,YAAY;YAC1B,SAAS,EAAE,iBAAiB;YAC5B,MAAM,EAAE,QAAQ;YAChB,MAAM,EAAE,QAAQ;SACjB,CAAC,CAAA;IACJ,CAAC;CACF;AAED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AA;gBACvC,IAAI,QAAQ,CAAC,UAAU;oBAAE,OAAO,IAAI,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,OAAO,EAAE,CAAA;gBACvE,OAAO,IAAI,CAAA;YACb,CAAC;YACD,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE;gBAChB,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;gBAChC,OAAO,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,IAAI,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAA;YAC5D,CAAC;YACD,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE;gBAChB,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAA;YACjE,CAAC;SACF,CAAC,CAAA;IACJ,CAAC;CACF;AAED,SAAS,QAAQ,CAAI,CAAI;IACvB,OAAO,CAAC,CAAA;AACV,CAAC;AAED,SAAS,iBAAiB;IACxB,OAAO,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAA;AAC/B,CAAC;AAED,SAAS,gBAAgB;IACvB,OAAO,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAA;AAC1B,CAAC","sourcesContent":["import type {\n DidDocument,\n InternalStateData,\n OAuthAuthorizationServerMetadata,\n OAuthProtectedResourceMetadata,\n ResolvedHandle,\n Session,\n} from '@atproto/oauth-client'\nimport { ExpoKey } from './expo-key'\nimport { MMKVSimpleStoreTTL } from './mmkv-simple-store-ttl'\n\nconst MMKV_ID = 'expo-atproto-oauth-client'\n\nexport class AuthorizationServerMetadataCache extends MMKVSimpleStoreTTL<OAuthAuthorizationServerMetadata> {\n constructor() {\n super({\n id: `${MMKV_ID}.authorizationServerMetadata`,\n expiresAt: oneMinuteFromNow,\n decode: JSON.parse,\n encode: JSON.stringify,\n })\n }\n}\n\nexport class ProtectedResourceMetadataCache extends MMKVSimpleStoreTTL<OAuthProtectedResourceMetadata> {\n constructor() {\n super({\n id: `${MMKV_ID}.protectedResourceMetadata`,\n expiresAt: oneMinuteFromNow,\n decode: JSON.parse,\n encode: JSON.stringify,\n })\n }\n}\n\nexport class DpopNonceCache extends MMKVSimpleStoreTTL<string> {\n constructor() {\n super({\n id: `${MMKV_ID}.dpopNonce`,\n expiresAt: tenMinutesFromNow,\n decode: identity,\n encode: identity,\n })\n }\n}\n\nexport class DidCache extends MMKVSimpleStoreTTL<DidDocument> {\n constructor() {\n super({\n id: `${MMKV_ID}.did`,\n expiresAt: oneMinuteFromNow,\n decode: JSON.parse,\n encode: JSON.stringify,\n })\n }\n}\n\nexport class HandleCache extends MMKVSimpleStoreTTL<ResolvedHandle> {\n constructor() {\n super({\n id: `${MMKV_ID}.handle`,\n expiresAt: oneMinuteFromNow,\n decode: JSON.parse,\n encode: JSON.stringify,\n })\n }\n}\n\nexport class StateStore extends MMKVSimpleStoreTTL<InternalStateData> {\n constructor() {\n super({\n id: `${MMKV_ID}.state`,\n expiresAt: tenMinutesFromNow,\n decode: (value) => {\n const parsed = JSON.parse(value)\n return { ...parsed, dpopKey: new ExpoKey(parsed.dpopKey) }\n },\n encode: (value) => {\n return JSON.stringify({ ...value, dpopKey: value.dpopKey.jwk })\n },\n })\n }\n}\n\nexport class SessionStore extends MMKVSimpleStoreTTL<Session> {\n constructor() {\n super({\n id: `${MMKV_ID}.session`,\n expiresAt: ({ tokenSet }) => {\n if (tokenSet.refresh_token) return null\n if (tokenSet.expires_at) return new Date(tokenSet.expires_at).valueOf()\n return null\n },\n decode: (value) => {\n const parsed = JSON.parse(value)\n return { ...parsed, dpopKey: new ExpoKey(parsed.dpopKey) }\n },\n encode: (value) => {\n return JSON.stringify({ ...value, dpopKey: value.dpopKey.jwk })\n },\n })\n }\n}\n\nfunction identity<T>(x: T): T {\n return x\n}\n\nfunction tenMinutesFromNow() {\n return Date.now() + 10 * 60e3\n}\n\nfunction oneMinuteFromNow() {\n return Date.now() + 60e3\n}\n"]}
1
+ {"version":3,"file":"stores.js","sourceRoot":"","sources":["../../src/utils/stores.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAE/D,MAAM,OAAO,GAAG,2BAA2B,CAAA;AAE3C,MAAM,OAAO,gCAAiC,SAAQ,kBAAoD;IACxG;QACE,KAAK,CAAC;YACJ,EAAE,EAAE,GAAG,OAAO,8BAA8B;YAC5C,SAAS,EAAE,gBAAgB;YAC3B,MAAM,EAAE,IAAI,CAAC,KAAK;YAClB,MAAM,EAAE,IAAI,CAAC,SAAS;SACvB,CAAC,CAAA;IACJ,CAAC;CACF;AAED,MAAM,OAAO,8BAA+B,SAAQ,kBAAyD;IAC3G;QACE,KAAK,CAAC;YACJ,EAAE,EAAE,GAAG,OAAO,4BAA4B;YAC1C,SAAS,EAAE,gBAAgB;YAC3B,MAAM,EAAE,IAAI,CAAC,KAAK;YAClB,MAAM,EAAE,IAAI,CAAC,SAAS;SACvB,CAAC,CAAA;IACJ,CAAC;CACF;AAED,MAAM,OAAO,cAAe,SAAQ,kBAA0B;IAC5D;QACE,KAAK,CAAC;YACJ,EAAE,EAAE,GAAG,OAAO,YAAY;YAC1B,SAAS,EAAE,iBAAiB;YAC5B,MAAM,EAAE,QAAQ;YAChB,MAAM,EAAE,QAAQ;SACjB,CAAC,CAAA;IACJ,CAAC;CACF;AAED,MAAM,OAAO,QAAS,SAAQ,kBAA+B;IAC3D;QACE,KAAK,CAAC;YACJ,EAAE,EAAE,GAAG,OAAO,MAAM;YACpB,SAAS,EAAE,gBAAgB;YAC3B,MAAM,EAAE,IAAI,CAAC,KAAK;YAClB,MAAM,EAAE,IAAI,CAAC,SAAS;SACvB,CAAC,CAAA;IACJ,CAAC;CACF;AAED,MAAM,OAAO,WAAY,SAAQ,kBAAkC;IAC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AO,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,IAAI,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAA;YAC5D,CAAC;YACD,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE;gBAChB,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAA;YACjE,CAAC;SACF,CAAC,CAAA;IACJ,CAAC;CACF;AAED,SAAS,QAAQ,CAAI,CAAI;IACvB,OAAO,CAAC,CAAA;AACV,CAAC;AAED,SAAS,iBAAiB;IACxB,OAAO,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAA;AAC/B,CAAC;AAED,SAAS,gBAAgB;IACvB,OAAO,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAA;AAC1B,CAAC","sourcesContent":["import type {\n DidDocument,\n InternalStateData,\n OAuthAuthorizationServerMetadata,\n OAuthProtectedResourceMetadata,\n ResolvedHandle,\n Session,\n} from '@atproto/oauth-client'\nimport { ExpoKey } from './expo-key.js'\nimport { MMKVSimpleStoreTTL } from './mmkv-simple-store-ttl.js'\n\nconst MMKV_ID = 'expo-atproto-oauth-client'\n\nexport class AuthorizationServerMetadataCache extends MMKVSimpleStoreTTL<OAuthAuthorizationServerMetadata> {\n constructor() {\n super({\n id: `${MMKV_ID}.authorizationServerMetadata`,\n expiresAt: oneMinuteFromNow,\n decode: JSON.parse,\n encode: JSON.stringify,\n })\n }\n}\n\nexport class ProtectedResourceMetadataCache extends MMKVSimpleStoreTTL<OAuthProtectedResourceMetadata | null> {\n constructor() {\n super({\n id: `${MMKV_ID}.protectedResourceMetadata`,\n expiresAt: oneMinuteFromNow,\n decode: JSON.parse,\n encode: JSON.stringify,\n })\n }\n}\n\nexport class DpopNonceCache extends MMKVSimpleStoreTTL<string> {\n constructor() {\n super({\n id: `${MMKV_ID}.dpopNonce`,\n expiresAt: tenMinutesFromNow,\n decode: identity,\n encode: identity,\n })\n }\n}\n\nexport class DidCache extends MMKVSimpleStoreTTL<DidDocument> {\n constructor() {\n super({\n id: `${MMKV_ID}.did`,\n expiresAt: oneMinuteFromNow,\n decode: JSON.parse,\n encode: JSON.stringify,\n })\n }\n}\n\nexport class HandleCache extends MMKVSimpleStoreTTL<ResolvedHandle> {\n constructor() {\n super({\n id: `${MMKV_ID}.handle`,\n expiresAt: oneMinuteFromNow,\n decode: JSON.parse,\n encode: JSON.stringify,\n })\n }\n}\n\nexport class StateStore extends MMKVSimpleStoreTTL<InternalStateData> {\n constructor() {\n super({\n id: `${MMKV_ID}.state`,\n expiresAt: tenMinutesFromNow,\n decode: (value) => {\n const parsed = JSON.parse(value)\n return { ...parsed, dpopKey: new ExpoKey(parsed.dpopKey) }\n },\n encode: (value) => {\n return JSON.stringify({ ...value, dpopKey: value.dpopKey.jwk })\n },\n })\n }\n}\n\nexport class SessionStore extends MMKVSimpleStoreTTL<Session> {\n constructor() {\n super({\n id: `${MMKV_ID}.session`,\n expiresAt: ({ tokenSet }) => {\n if (tokenSet.refresh_token) return null\n if (tokenSet.expires_at) return new Date(tokenSet.expires_at).valueOf()\n return null\n },\n decode: (value) => {\n const parsed = JSON.parse(value)\n return { ...parsed, dpopKey: new ExpoKey(parsed.dpopKey) }\n },\n encode: (value) => {\n return JSON.stringify({ ...value, dpopKey: value.dpopKey.jwk })\n },\n })\n }\n}\n\nfunction identity<T>(x: T): T {\n return x\n}\n\nfunction tenMinutesFromNow() {\n return Date.now() + 10 * 60e3\n}\n\nfunction oneMinuteFromNow() {\n return Date.now() + 60e3\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,9 @@
1
1
  {
2
2
  "name": "@atproto/oauth-client-expo",
3
- "version": "0.0.10",
3
+ "version": "0.1.0-next.0",
4
+ "engines": {
5
+ "node": ">=22"
6
+ },
4
7
  "license": "MIT",
5
8
  "description": "ATPROTO OAuth client for Expo applications",
6
9
  "authors": [
@@ -23,8 +26,6 @@
23
26
  "url": "https://github.com/bluesky-social/atproto",
24
27
  "directory": "packages/oauth/oauth-client-expo"
25
28
  },
26
- "main": "dist/index.js",
27
- "types": "dist/index.d.ts",
28
29
  "exports": {
29
30
  ".": {
30
31
  "types": "./dist/index.d.ts",
@@ -36,14 +37,15 @@
36
37
  "expo-web-browser": "^15.0.8",
37
38
  "react-native-mmkv": "^3.3.3",
38
39
  "react-native-url-polyfill": "^3.0.0",
39
- "@atproto-labs/simple-store": "^0.3.0",
40
- "@atproto/oauth-client": "^0.6.0",
41
- "@atproto/oauth-client-browser": "^0.3.41"
40
+ "@atproto-labs/simple-store": "^0.4.0-next.0",
41
+ "@atproto/oauth-client": "^0.7.0-next.0",
42
+ "@atproto/oauth-client-browser": "^0.4.0-next.0"
42
43
  },
43
44
  "peerDependencies": {
44
45
  "expo": "*",
45
46
  "react-native": "*"
46
47
  },
48
+ "type": "module",
47
49
  "scripts": {
48
50
  "build": "tsc --build tsconfig.build.json"
49
51
  }
@@ -1,6 +1,6 @@
1
1
  import { NativeModule, requireNativeModule } from 'expo'
2
2
  import { SignedJwt, VerifyOptions, VerifyResult } from '@atproto/oauth-client'
3
- import { ExpoAtprotoOAuthClientModuleEvents } from './ExpoAtprotoOAuthClientModule.types'
3
+ import { ExpoAtprotoOAuthClientModuleEvents } from './ExpoAtprotoOAuthClientModule.types.js'
4
4
 
5
5
  export type NativeJwk = {
6
6
  kty: 'EC'
@@ -1,2 +1,2 @@
1
- // eslint-disable-next-line @typescript-eslint/ban-types
1
+ // eslint-disable-next-line @typescript-eslint/no-empty-object-type
2
2
  export type ExpoAtprotoOAuthClientModuleEvents = {}
@@ -1,5 +1,5 @@
1
- import { ExpoOAuthClientInterface } from './expo-oauth-client-interface'
2
- import { ExpoOAuthClientOptions } from './expo-oauth-client-options'
1
+ import { ExpoOAuthClientInterface } from './expo-oauth-client-interface.js'
2
+ import { ExpoOAuthClientOptions } from './expo-oauth-client-options.js'
3
3
 
4
4
  export declare class ExpoOAuthClient implements ExpoOAuthClientInterface {
5
5
  constructor(options: ExpoOAuthClientOptions)
@@ -5,10 +5,10 @@ import {
5
5
  OAuthSession,
6
6
  RuntimeImplementation,
7
7
  } from '@atproto/oauth-client'
8
- import { default as NativeModule } from './ExpoAtprotoOAuthClientModule'
9
- import { ExpoOAuthClientInterface } from './expo-oauth-client-interface'
10
- import { ExpoOAuthClientOptions } from './expo-oauth-client-options'
11
- import { ExpoKey } from './utils/expo-key'
8
+ import { default as NativeModule } from './ExpoAtprotoOAuthClientModule.js'
9
+ import { ExpoOAuthClientInterface } from './expo-oauth-client-interface.js'
10
+ import { ExpoOAuthClientOptions } from './expo-oauth-client-options.js'
11
+ import { ExpoKey } from './utils/expo-key.js'
12
12
  import {
13
13
  AuthorizationServerMetadataCache,
14
14
  DidCache,
@@ -17,14 +17,15 @@ import {
17
17
  ProtectedResourceMetadataCache,
18
18
  SessionStore,
19
19
  StateStore,
20
- } from './utils/stores'
20
+ } from './utils/stores.js'
21
21
 
22
22
  export const CUSTOM_URI_SCHEME_REGEX = /^(?:[^.]+(?:\.[^.]+)+):\/(?:[^/].*)?$/
23
23
  const isCustomUriScheme = (uri: string) => CUSTOM_URI_SCHEME_REGEX.test(uri)
24
24
 
25
25
  const runtimeImplementation: RuntimeImplementation = {
26
26
  createKey: async (algs) => ExpoKey.generate(algs),
27
- digest: async (bytes, { name }) => NativeModule.digest(bytes, name),
27
+ digest: async (bytes, { name }) =>
28
+ NativeModule.digest(bytes, name) as Promise<Uint8Array<ArrayBuffer>>,
28
29
  getRandomValues: async (length) => NativeModule.getRandomValues(length),
29
30
  }
30
31
 
@@ -3,8 +3,8 @@ import {
3
3
  BrowserOAuthClient,
4
4
  OAuthSession,
5
5
  } from '@atproto/oauth-client-browser'
6
- import { ExpoOAuthClientInterface } from './expo-oauth-client-interface'
7
- import { ExpoOAuthClientOptions } from './expo-oauth-client-options'
6
+ import { ExpoOAuthClientInterface } from './expo-oauth-client-interface.js'
7
+ import { ExpoOAuthClientOptions } from './expo-oauth-client-options.js'
8
8
 
9
9
  export class ExpoOAuthClient
10
10
  extends BrowserOAuthClient
package/src/index.ts CHANGED
@@ -2,7 +2,7 @@ import './polyfill'
2
2
 
3
3
  export * from '@atproto/oauth-client'
4
4
 
5
- export type { ExpoOAuthClientInterface } from './expo-oauth-client-interface'
6
- export type { ExpoOAuthClientOptions } from './expo-oauth-client-options'
5
+ export type { ExpoOAuthClientInterface } from './expo-oauth-client-interface.js'
6
+ export type { ExpoOAuthClientOptions } from './expo-oauth-client-options.js'
7
7
 
8
- export { ExpoOAuthClient } from './expo-oauth-client'
8
+ export { ExpoOAuthClient } from './expo-oauth-client.js'
@@ -7,8 +7,8 @@ import {
7
7
  type VerifyOptions,
8
8
  type VerifyResult,
9
9
  } from '@atproto/oauth-client'
10
- import type { NativeJwk } from '../ExpoAtprotoOAuthClientModule'
11
- import { default as NativeModule } from '../ExpoAtprotoOAuthClientModule'
10
+ import type { NativeJwk } from '../ExpoAtprotoOAuthClientModule.js'
11
+ import { default as NativeModule } from '../ExpoAtprotoOAuthClientModule.js'
12
12
 
13
13
  export type ExpoJwk = Jwk & NativeJwk & { key_ops: ['sign'] }
14
14
  export class ExpoKey extends Key<ExpoJwk> {
@@ -1,6 +1,6 @@
1
1
  import { Configuration, MMKV } from 'react-native-mmkv'
2
2
  import type { SimpleStore, Value } from '@atproto-labs/simple-store'
3
- import { MMKVSimpleStore, MMKVSimpleStoreOptions } from './mmkv-simple-store'
3
+ import { MMKVSimpleStore, MMKVSimpleStoreOptions } from './mmkv-simple-store.js'
4
4
 
5
5
  export type MMKVSimpleStoreTTLOptions<V extends Value> =
6
6
  MMKVSimpleStoreOptions<V> & {
@@ -6,8 +6,8 @@ import type {
6
6
  ResolvedHandle,
7
7
  Session,
8
8
  } from '@atproto/oauth-client'
9
- import { ExpoKey } from './expo-key'
10
- import { MMKVSimpleStoreTTL } from './mmkv-simple-store-ttl'
9
+ import { ExpoKey } from './expo-key.js'
10
+ import { MMKVSimpleStoreTTL } from './mmkv-simple-store-ttl.js'
11
11
 
12
12
  const MMKV_ID = 'expo-atproto-oauth-client'
13
13
 
@@ -22,7 +22,7 @@ export class AuthorizationServerMetadataCache extends MMKVSimpleStoreTTL<OAuthAu
22
22
  }
23
23
  }
24
24
 
25
- export class ProtectedResourceMetadataCache extends MMKVSimpleStoreTTL<OAuthProtectedResourceMetadata> {
25
+ export class ProtectedResourceMetadataCache extends MMKVSimpleStoreTTL<OAuthProtectedResourceMetadata | null> {
26
26
  constructor() {
27
27
  super({
28
28
  id: `${MMKV_ID}.protectedResourceMetadata`,
@@ -1 +1 @@
1
- {"root":["./src/ExpoAtprotoOAuthClientModule.ts","./src/ExpoAtprotoOAuthClientModule.types.ts","./src/expo-oauth-client-interface.ts","./src/expo-oauth-client-options.ts","./src/expo-oauth-client.d.ts","./src/expo-oauth-client.native.ts","./src/expo-oauth-client.web.ts","./src/index.ts","./src/polyfill.d.ts","./src/polyfill.native.ts","./src/polyfill.web.ts","./src/utils/expo-key.ts","./src/utils/mmkv-simple-store-ttl.ts","./src/utils/mmkv-simple-store.ts","./src/utils/stores.ts"],"version":"5.8.3"}
1
+ {"root":["./src/expoatprotooauthclientmodule.ts","./src/expoatprotooauthclientmodule.types.ts","./src/expo-oauth-client-interface.ts","./src/expo-oauth-client-options.ts","./src/expo-oauth-client.d.ts","./src/expo-oauth-client.native.ts","./src/expo-oauth-client.web.ts","./src/index.ts","./src/polyfill.d.ts","./src/polyfill.native.ts","./src/polyfill.web.ts","./src/utils/expo-key.ts","./src/utils/mmkv-simple-store-ttl.ts","./src/utils/mmkv-simple-store.ts","./src/utils/stores.ts"],"version":"6.0.3"}