@atproto/oauth-client-browser 0.4.0 → 0.4.1

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.
@@ -4,6 +4,6 @@ export declare class BrowserRuntimeImplementation implements RuntimeImplementati
4
4
  constructor();
5
5
  createKey(algs: string[]): Promise<Key>;
6
6
  getRandomValues(byteLength: number): Uint8Array;
7
- digest(data: Uint8Array<ArrayBuffer>, { name }: DigestAlgorithm): Promise<Uint8Array<ArrayBuffer>>;
7
+ digest(data: Uint8Array<ArrayBuffer>, { name }: DigestAlgorithm): Promise<Uint8Array>;
8
8
  }
9
9
  //# sourceMappingURL=browser-runtime-implementation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"browser-runtime-implementation.d.ts","sourceRoot":"","sources":["../src/browser-runtime-implementation.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EACf,GAAG,EACH,qBAAqB,EACrB,WAAW,EACZ,MAAM,uBAAuB,CAAA;AAW9B,qBAAa,4BAA6B,YAAW,qBAAqB;IACxE,WAAW,0BAAoB;;IAmBzB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC;IAI7C,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,UAAU;IAIzC,MAAM,CACV,IAAI,EAAE,UAAU,CAAC,WAAW,CAAC,EAC7B,EAAE,IAAI,EAAE,EAAE,eAAe,GACxB,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;CAYpC"}
1
+ {"version":3,"file":"browser-runtime-implementation.d.ts","sourceRoot":"","sources":["../src/browser-runtime-implementation.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EACf,GAAG,EACH,qBAAqB,EACrB,WAAW,EACZ,MAAM,uBAAuB,CAAA;AAW9B,qBAAa,4BAA6B,YAAW,qBAAqB;IACxE,WAAW,0BAAoB;;IAmBzB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC;IAI7C,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,UAAU;IAIzC,MAAM,CACV,IAAI,EAAE,UAAU,CAAC,WAAW,CAAC,EAC7B,EAAE,IAAI,EAAE,EAAE,eAAe,GACxB,OAAO,CAAC,UAAU,CAAC;CAYvB"}
@@ -1 +1 @@
1
- {"version":3,"file":"browser-runtime-implementation.js","sourceRoot":"","sources":["../src/browser-runtime-implementation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAQrD;;GAEG;AACH,MAAM,iBAAiB,GACrB,OAAO,SAAS,KAAK,WAAW,IAAI,SAAS,CAAC,KAAK,EAAE,OAAO;IAC1D,CAAC,CAAC,CAAI,IAAY,EAAE,EAA4B,EAAc,EAAE,CAC5D,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE,KAAK,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC;IAC1E,CAAC,CAAC,SAAS,CAAA;AAEf,MAAM,OAAO,4BAA4B;IAGvC;QAFA,gBAAW,GAAG,iBAAiB,CAAA;QAG7B,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC;YAClD,MAAM,IAAI,KAAK,CACb,iHAAiH,CAClH,CAAA;QACH,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACtB,wEAAwE;YACxE,yEAAyE;YACzE,qBAAqB;YACrB,OAAO,CAAC,IAAI,CACV,2EAA2E,CAC5E,CAAA;QACH,CAAC;IACH,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,IAAc;QAC5B,OAAO,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;IACpC,CAAC;IAED,eAAe,CAAC,UAAkB;QAChC,OAAO,MAAM,CAAC,eAAe,CAAC,IAAI,UAAU,CAAC,UAAU,CAAC,CAAC,CAAA;IAC3D,CAAC;IAED,KAAK,CAAC,MAAM,CACV,IAA6B,EAC7B,EAAE,IAAI,EAAmB;QAEzB,QAAQ,IAAI,EAAE,CAAC;YACb,KAAK,QAAQ,CAAC;YACd,KAAK,QAAQ,CAAC;YACd,KAAK,QAAQ,CAAC,CAAC,CAAC;gBACd,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,CAAC,CAAA;gBACpE,OAAO,IAAI,UAAU,CAAC,GAAG,CAAC,CAAA;YAC5B,CAAC;YACD;gBACE,MAAM,IAAI,KAAK,CAAC,iCAAiC,IAAI,EAAE,CAAC,CAAA;QAC5D,CAAC;IACH,CAAC;CACF","sourcesContent":["import { WebcryptoKey } from '@atproto/jwk-webcrypto'\nimport {\n DigestAlgorithm,\n Key,\n RuntimeImplementation,\n RuntimeLock,\n} from '@atproto/oauth-client'\n\n/**\n * @see {@link // https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request}\n */\nconst nativeRequestLock: undefined | RuntimeLock =\n typeof navigator !== 'undefined' && navigator.locks?.request\n ? <T>(name: string, fn: () => T | PromiseLike<T>): Promise<T> =>\n navigator.locks.request(name, { mode: 'exclusive' }, async () => fn())\n : undefined\n\nexport class BrowserRuntimeImplementation implements RuntimeImplementation {\n requestLock = nativeRequestLock\n\n constructor() {\n if (typeof crypto !== 'object' || !crypto?.subtle) {\n throw new Error(\n 'Crypto with CryptoSubtle is required. If running in a browser, make sure the current page is loaded over HTTPS.',\n )\n }\n\n if (!this.requestLock) {\n // There is no real need to polyfill this on older browsers. Indeed, the\n // oauth-client library will try and recover from concurrency issues when\n // refreshing tokens.\n console.warn(\n 'Locks API not available. You should consider using a more recent browser.',\n )\n }\n }\n\n async createKey(algs: string[]): Promise<Key> {\n return WebcryptoKey.generate(algs)\n }\n\n getRandomValues(byteLength: number): Uint8Array {\n return crypto.getRandomValues(new Uint8Array(byteLength))\n }\n\n async digest(\n data: Uint8Array<ArrayBuffer>,\n { name }: DigestAlgorithm,\n ): Promise<Uint8Array<ArrayBuffer>> {\n switch (name) {\n case 'sha256':\n case 'sha384':\n case 'sha512': {\n const buf = await crypto.subtle.digest(`SHA-${name.slice(3)}`, data)\n return new Uint8Array(buf)\n }\n default:\n throw new Error(`Unsupported digest algorithm: ${name}`)\n }\n }\n}\n"]}
1
+ {"version":3,"file":"browser-runtime-implementation.js","sourceRoot":"","sources":["../src/browser-runtime-implementation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAQrD;;GAEG;AACH,MAAM,iBAAiB,GACrB,OAAO,SAAS,KAAK,WAAW,IAAI,SAAS,CAAC,KAAK,EAAE,OAAO;IAC1D,CAAC,CAAC,CAAI,IAAY,EAAE,EAA4B,EAAc,EAAE,CAC5D,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE,KAAK,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC;IAC1E,CAAC,CAAC,SAAS,CAAA;AAEf,MAAM,OAAO,4BAA4B;IAGvC;QAFA,gBAAW,GAAG,iBAAiB,CAAA;QAG7B,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC;YAClD,MAAM,IAAI,KAAK,CACb,iHAAiH,CAClH,CAAA;QACH,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACtB,wEAAwE;YACxE,yEAAyE;YACzE,qBAAqB;YACrB,OAAO,CAAC,IAAI,CACV,2EAA2E,CAC5E,CAAA;QACH,CAAC;IACH,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,IAAc;QAC5B,OAAO,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;IACpC,CAAC;IAED,eAAe,CAAC,UAAkB;QAChC,OAAO,MAAM,CAAC,eAAe,CAAC,IAAI,UAAU,CAAC,UAAU,CAAC,CAAC,CAAA;IAC3D,CAAC;IAED,KAAK,CAAC,MAAM,CACV,IAA6B,EAC7B,EAAE,IAAI,EAAmB;QAEzB,QAAQ,IAAI,EAAE,CAAC;YACb,KAAK,QAAQ,CAAC;YACd,KAAK,QAAQ,CAAC;YACd,KAAK,QAAQ,CAAC,CAAC,CAAC;gBACd,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,CAAC,CAAA;gBACpE,OAAO,IAAI,UAAU,CAAC,GAAG,CAAC,CAAA;YAC5B,CAAC;YACD;gBACE,MAAM,IAAI,KAAK,CAAC,iCAAiC,IAAI,EAAE,CAAC,CAAA;QAC5D,CAAC;IACH,CAAC;CACF","sourcesContent":["import { WebcryptoKey } from '@atproto/jwk-webcrypto'\nimport {\n DigestAlgorithm,\n Key,\n RuntimeImplementation,\n RuntimeLock,\n} from '@atproto/oauth-client'\n\n/**\n * @see {@link // https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request}\n */\nconst nativeRequestLock: undefined | RuntimeLock =\n typeof navigator !== 'undefined' && navigator.locks?.request\n ? <T>(name: string, fn: () => T | PromiseLike<T>): Promise<T> =>\n navigator.locks.request(name, { mode: 'exclusive' }, async () => fn())\n : undefined\n\nexport class BrowserRuntimeImplementation implements RuntimeImplementation {\n requestLock = nativeRequestLock\n\n constructor() {\n if (typeof crypto !== 'object' || !crypto?.subtle) {\n throw new Error(\n 'Crypto with CryptoSubtle is required. If running in a browser, make sure the current page is loaded over HTTPS.',\n )\n }\n\n if (!this.requestLock) {\n // There is no real need to polyfill this on older browsers. Indeed, the\n // oauth-client library will try and recover from concurrency issues when\n // refreshing tokens.\n console.warn(\n 'Locks API not available. You should consider using a more recent browser.',\n )\n }\n }\n\n async createKey(algs: string[]): Promise<Key> {\n return WebcryptoKey.generate(algs)\n }\n\n getRandomValues(byteLength: number): Uint8Array {\n return crypto.getRandomValues(new Uint8Array(byteLength))\n }\n\n async digest(\n data: Uint8Array<ArrayBuffer>,\n { name }: DigestAlgorithm,\n ): Promise<Uint8Array> {\n switch (name) {\n case 'sha256':\n case 'sha384':\n case 'sha512': {\n const buf = await crypto.subtle.digest(`SHA-${name.slice(3)}`, data)\n return new Uint8Array(buf)\n }\n default:\n throw new Error(`Unsupported digest algorithm: ${name}`)\n }\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atproto/oauth-client-browser",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "engines": {
5
5
  "node": ">=22"
6
6
  },
@@ -33,14 +33,14 @@
33
33
  ],
34
34
  "dependencies": {
35
35
  "core-js": "^3",
36
- "@atproto-labs/did-resolver": "^0.3.0",
37
- "@atproto-labs/handle-resolver": "^0.4.0",
36
+ "@atproto-labs/did-resolver": "^0.3.1",
37
+ "@atproto-labs/handle-resolver": "^0.4.1",
38
38
  "@atproto-labs/simple-store": "^0.4.0",
39
+ "@atproto/did": "^0.5.0",
39
40
  "@atproto/jwk": "^0.7.0",
40
- "@atproto/did": "^0.4.0",
41
41
  "@atproto/jwk-webcrypto": "^0.3.0",
42
- "@atproto/oauth-client": "^0.7.0",
43
- "@atproto/oauth-types": "^0.7.0"
42
+ "@atproto/oauth-client": "^0.7.2",
43
+ "@atproto/oauth-types": "^0.7.1"
44
44
  },
45
45
  "devDependencies": {
46
46
  "typescript": "^6.0.3"