@atproto/oauth-client-node 0.3.8 → 0.3.10
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.
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qEAAkD;AAClD,yDAAsC;AACtC,wDAAqC;AACrC,oDAAiC;AAEjC,yDAAsC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qEAAkD;AAClD,yDAAsC;AACtC,wDAAqC;AACrC,oDAAiC;AAEjC,yDAAsC","sourcesContent":["export * from '@atproto-labs/handle-resolver-node'\nexport * from '@atproto/jwk-webcrypto'\nexport * from '@atproto/oauth-client'\nexport * from '@atproto/jwk-jose'\n\nexport * from './node-oauth-client.js'\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-dpop-store.js","sourceRoot":"","sources":["../src/node-dpop-store.ts"],"names":[],"mappings":";;AAaA,wCAwBC;AApCD,gDAA2C;AAQ3C;;;GAGG;AACH,SAAgB,cAAc,CAG5B,KAAwC;IACxC,OAAO;QACL,KAAK,CAAC,GAAG,CAAC,GAAM,EAAE,EAAE,OAAO,EAAE,GAAG,IAAI,EAAK;YACvC,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAA;YAClC,IAAI,CAAC,OAAO;gBAAE,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAA;YAE7D,MAAM,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,CAAC,CAAA;QAC5C,CAAC;QAED,KAAK,CAAC,GAAG,CAAC,GAAM;YACd,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;YACnC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OAAO,EAAkB,CAAA;QAC7C,CAAC;QAED,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC;QAC1B,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC;KAChC,CAAA;AACH,CAAC","sourcesContent":["import { Jwk, Key } from '@atproto/jwk'\nimport { JoseKey } from '@atproto/jwk-jose'\nimport { InternalStateData, Session } from '@atproto/oauth-client'\nimport { SimpleStore } from '@atproto-labs/simple-store'\n\ntype ToDpopJwkValue<V extends { dpopKey: Key }> = Omit<V, 'dpopKey'> & {\n dpopJwk: Jwk\n}\n\n/**\n * Utility function that allows to simplify the store interface by exposing a\n * JWK (JSON) instead of a Key instance.\n */\nexport function toDpopKeyStore<\n K extends string,\n V extends { dpopKey: Key; dpopJwk?: never },\n>(store: SimpleStore<K, ToDpopJwkValue<V>>): SimpleStore<K, V> {\n return {\n async set(sub: K, { dpopKey, ...data }: V) {\n const dpopJwk = dpopKey.privateJwk\n if (!dpopJwk) throw new Error('Private DPoP JWK is missing.')\n\n await store.set(sub, { ...data, dpopJwk })\n },\n\n async get(sub: K) {\n const result = await store.get(sub)\n if (!result) return undefined\n\n const { dpopJwk, ...data } = result\n const dpopKey = await JoseKey.fromJWK(dpopJwk)\n return { ...data, dpopKey } as unknown as V\n },\n\n del: store.del.bind(store),\n clear: store.clear?.bind(store),\n }\n}\n\nexport type NodeSavedState = ToDpopJwkValue<InternalStateData>\nexport type NodeSavedStateStore = SimpleStore<string, NodeSavedState>\n\nexport type NodeSavedSession = ToDpopJwkValue<Session>\nexport type NodeSavedSessionStore = SimpleStore<string, NodeSavedSession>\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-oauth-client.js","sourceRoot":"","sources":["../src/node-oauth-client.ts"],"names":[],"mappings":";;;AAAA,6CAAqD;AACrD,gDAA2C;AAC3C,wDAO8B;AAE9B,6EAG2C;AAC3C,6DAI6B;AAqC7B,MAA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AAY,EAEZ,cAAc,GAAG,IAAI,gDAAyB,CAAC;QAC7C,KAAK;QACL,mBAAmB;KACpB,CAAC,EAEF,qBAAqB,GAAG;QACtB,WAAW;QACX,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,kBAAO,CAAC,QAAQ,CAAC,IAAI,CAAC;QAC3C,eAAe,EAAE,yBAAW;QAC5B,MAAM,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,CAC3B,IAAA,wBAAU,EAAC,SAAS,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE;KACpD,EAED,GAAG,OAAO,EACa;QACvB,IAAI,CAAC,qBAAqB,CAAC,WAAW,EAAE,CAAC;YACvC,8DAA8D;YAC9D,OAAO,CAAC,IAAI,CAAC,4DAA4D,CAAC,CAAA;QAC5E,CAAC;QAED,KAAK,CAAC;YACJ,GAAG,OAAO;YAEV,KAAK;YACL,YAAY;YACZ,cAAc;YACd,qBAAqB;YAErB,UAAU,EAAE,IAAA,mCAAc,EAAC,UAAU,CAAC;YACtC,YAAY,EAAE,IAAA,mCAAc,EAAC,YAAY,CAAC;SAC3C,CAAC,CAAA;IACJ,CAAC;CACF;AA3CD,0CA2CC","sourcesContent":["import { createHash, randomBytes } from 'node:crypto'\nimport { JoseKey } from '@atproto/jwk-jose'\nimport {\n HandleResolver,\n OAuthClient,\n OAuthClientFetchMetadataOptions,\n OAuthClientOptions,\n RuntimeImplementation,\n RuntimeLock,\n} from '@atproto/oauth-client'\nimport { OAuthResponseMode } from '@atproto/oauth-types'\nimport {\n AtprotoHandleResolverNode,\n AtprotoHandleResolverNodeOptions,\n} from '@atproto-labs/handle-resolver-node'\nimport {\n NodeSavedSessionStore,\n NodeSavedStateStore,\n toDpopKeyStore,\n} from './node-dpop-store.js'\nimport { Override } from './util.js'\n\nexport type * from './node-dpop-store.js'\nexport type { OAuthClientOptions, OAuthResponseMode, RuntimeLock }\n\nexport type NodeOAuthClientOptions = Override<\n OAuthClientOptions,\n {\n responseMode?: Exclude<OAuthResponseMode, 'fragment'>\n\n stateStore: NodeSavedStateStore\n sessionStore: NodeSavedSessionStore\n\n /**\n * Used to build a {@link NodeOAuthClientOptions.handleResolver} if none is\n * provided.\n */\n fallbackNameservers?: AtprotoHandleResolverNodeOptions['fallbackNameservers']\n\n handleResolver?: HandleResolver | string | URL\n\n /**\n * Used to build a {@link NodeOAuthClientOptions.runtimeImplementation} if\n * none is provided. Pass in `requestLocalLock` from `@atproto/oauth-client`\n * to mute warning.\n */\n requestLock?: RuntimeLock\n\n runtimeImplementation?: RuntimeImplementation\n }\n>\n\nexport type NodeOAuthClientFromMetadataOptions =\n OAuthClientFetchMetadataOptions &\n Omit<NodeOAuthClientOptions, 'clientMetadata'>\n\nexport class NodeOAuthClient extends OAuthClient {\n constructor({\n requestLock = undefined,\n fallbackNameservers = undefined,\n\n fetch,\n responseMode = 'query',\n\n stateStore,\n sessionStore,\n\n handleResolver = new AtprotoHandleResolverNode({\n fetch,\n fallbackNameservers,\n }),\n\n runtimeImplementation = {\n requestLock,\n createKey: (algs) => JoseKey.generate(algs),\n getRandomValues: randomBytes,\n digest: (bytes, algorithm) =>\n createHash(algorithm.name).update(bytes).digest(),\n },\n\n ...options\n }: NodeOAuthClientOptions) {\n if (!runtimeImplementation.requestLock) {\n // Ok if only one instance of the client is running at a time.\n console.warn('No lock mechanism provided. Credentials might get revoked.')\n }\n\n super({\n ...options,\n\n fetch,\n responseMode,\n handleResolver,\n runtimeImplementation,\n\n stateStore: toDpopKeyStore(stateStore),\n sessionStore: toDpopKeyStore(sessionStore),\n })\n }\n}\n"]}
|
package/dist/util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"","sourcesContent":["// eslint-disable-next-line @typescript-eslint/ban-types\nexport type Simplify<T> = { [K in keyof T]: T[K] } & {}\nexport type Override<T, V> = Simplify<V & Omit<T, keyof V>>\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atproto/oauth-client-node",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.10",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ATPROTO OAuth client for the NodeJS",
|
|
6
6
|
"keywords": [
|
|
@@ -31,15 +31,15 @@
|
|
|
31
31
|
"dist"
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@atproto-labs/did-resolver": "0.2.
|
|
35
|
-
"@atproto-labs/handle-resolver-node": "0.1.
|
|
34
|
+
"@atproto-labs/did-resolver": "0.2.2",
|
|
35
|
+
"@atproto-labs/handle-resolver-node": "0.1.21",
|
|
36
36
|
"@atproto-labs/simple-store": "0.3.0",
|
|
37
|
-
"@atproto/did": "0.2.
|
|
38
|
-
"@atproto/jwk": "0.
|
|
39
|
-
"@atproto/jwk-jose": "0.1.
|
|
40
|
-
"@atproto/jwk-webcrypto": "0.
|
|
41
|
-
"@atproto/oauth-client": "0.5.
|
|
42
|
-
"@atproto/oauth-types": "0.
|
|
37
|
+
"@atproto/did": "0.2.1",
|
|
38
|
+
"@atproto/jwk": "0.6.0",
|
|
39
|
+
"@atproto/jwk-jose": "0.1.11",
|
|
40
|
+
"@atproto/jwk-webcrypto": "0.2.0",
|
|
41
|
+
"@atproto/oauth-client": "0.5.8",
|
|
42
|
+
"@atproto/oauth-types": "0.5.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"typescript": "^5.6.3"
|