@streamplace/atproto-oauth-client-react-native 0.7.6 → 0.7.25
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.
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { jwkValidator } from "@atproto/jwk";
|
|
2
1
|
import { JoseKey } from "@atproto/jwk-jose";
|
|
3
2
|
import { OAuthClient, } from "@atproto/oauth-client";
|
|
4
3
|
import QuickCrypto from "react-native-quick-crypto";
|
|
@@ -26,7 +25,6 @@ export class ReactNativeOAuthClient extends OAuthClient {
|
|
|
26
25
|
responseMode,
|
|
27
26
|
runtimeImplementation: {
|
|
28
27
|
createKey: async (algs) => {
|
|
29
|
-
console.log("GOT HEREEEE!");
|
|
30
28
|
const errors = [];
|
|
31
29
|
for (const alg of algs) {
|
|
32
30
|
try {
|
|
@@ -49,13 +47,25 @@ export class ReactNativeOAuthClient extends OAuthClient {
|
|
|
49
47
|
.update(JSON.stringify(ex))
|
|
50
48
|
.digest("hex");
|
|
51
49
|
const use = "sig";
|
|
52
|
-
|
|
50
|
+
const newKey = {
|
|
51
|
+
...ex,
|
|
52
|
+
kid,
|
|
53
|
+
use,
|
|
54
|
+
};
|
|
55
|
+
let joseKey = null;
|
|
56
|
+
try {
|
|
57
|
+
joseKey = new JoseKey(newKey);
|
|
58
|
+
}
|
|
59
|
+
catch (err) {
|
|
60
|
+
throw new Error(`error creating jose key: ${err}`);
|
|
61
|
+
}
|
|
62
|
+
return joseKey;
|
|
53
63
|
}
|
|
54
64
|
catch (err) {
|
|
55
65
|
errors.push(err);
|
|
56
66
|
}
|
|
57
67
|
}
|
|
58
|
-
throw new Error(
|
|
68
|
+
throw new Error(`None of the algorithms worked: ${errors.join(", ")}`);
|
|
59
69
|
},
|
|
60
70
|
getRandomValues: (length) => new Uint8Array(QuickCrypto.randomBytes(length)),
|
|
61
71
|
digest: (bytes, algorithm) => QuickCrypto.createHash(algorithm.name)
|
package/dist/sqlite-keystore.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { jwkValidator } from "@atproto/jwk";
|
|
2
1
|
import { JoseKey } from "@atproto/jwk-jose";
|
|
3
2
|
import Storage from "expo-sqlite/kv-store";
|
|
4
3
|
const NAMESPACE = `@@atproto/oauth-client-react-native`;
|
|
@@ -17,7 +16,7 @@ export class JoseKeyStore {
|
|
|
17
16
|
return undefined;
|
|
18
17
|
const item = JSON.parse(itemStr);
|
|
19
18
|
if (item.dpopKey) {
|
|
20
|
-
item.dpopKey = new JoseKey(
|
|
19
|
+
item.dpopKey = new JoseKey(item.dpopKey);
|
|
21
20
|
}
|
|
22
21
|
return item;
|
|
23
22
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamplace/atproto-oauth-client-react-native",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.25",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ATProto OAuth client for React Native",
|
|
6
6
|
"keywords": [
|
|
@@ -29,17 +29,17 @@
|
|
|
29
29
|
"src"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@atproto-labs/did-resolver": "0.1
|
|
33
|
-
"@atproto-labs/handle-resolver-node": "0.1.
|
|
34
|
-
"@atproto-labs/simple-store": "0.
|
|
35
|
-
"@atproto-labs/simple-store-memory": "0.1.
|
|
36
|
-
"@atproto/did": "0.
|
|
37
|
-
"@atproto/jwk": "0.
|
|
38
|
-
"@atproto/jwk-jose": "0.1.
|
|
39
|
-
"@atproto/jwk-webcrypto": "0.1.
|
|
40
|
-
"@atproto/oauth-client": "0.
|
|
41
|
-
"@atproto/oauth-client-browser": "0.3.
|
|
42
|
-
"@atproto/oauth-types": "0.
|
|
32
|
+
"@atproto-labs/did-resolver": "0.2.1",
|
|
33
|
+
"@atproto-labs/handle-resolver-node": "0.1.19",
|
|
34
|
+
"@atproto-labs/simple-store": "0.3.0",
|
|
35
|
+
"@atproto-labs/simple-store-memory": "0.1.4",
|
|
36
|
+
"@atproto/did": "0.2.0",
|
|
37
|
+
"@atproto/jwk": "0.5.0",
|
|
38
|
+
"@atproto/jwk-jose": "0.1.10",
|
|
39
|
+
"@atproto/jwk-webcrypto": "0.1.10",
|
|
40
|
+
"@atproto/oauth-client": "0.5.5",
|
|
41
|
+
"@atproto/oauth-client-browser": "0.3.31",
|
|
42
|
+
"@atproto/oauth-types": "0.4.1",
|
|
43
43
|
"abortcontroller-polyfill": "^1.7.6",
|
|
44
44
|
"event-target-shim": "^6.0.2",
|
|
45
45
|
"expo-sqlite": "^15.0.3",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"build": "tsc --build tsconfig.build.json",
|
|
55
55
|
"prepare": "pnpm run build"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "288afabcb270c01ae8012e2a5cd9d75d5e1aae28"
|
|
58
58
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { SimpleStore } from "@atproto-labs/simple-store";
|
|
2
|
-
import { jwkValidator } from "@atproto/jwk";
|
|
3
2
|
import { JoseKey } from "@atproto/jwk-jose";
|
|
4
3
|
import {
|
|
5
4
|
InternalStateData,
|
|
5
|
+
Jwk,
|
|
6
6
|
OAuthClient,
|
|
7
7
|
OAuthClientFetchMetadataOptions,
|
|
8
8
|
OAuthClientOptions,
|
|
@@ -74,7 +74,6 @@ export class ReactNativeOAuthClient extends OAuthClient {
|
|
|
74
74
|
responseMode,
|
|
75
75
|
runtimeImplementation: {
|
|
76
76
|
createKey: async (algs): Promise<JoseKey> => {
|
|
77
|
-
console.log("GOT HEREEEE!");
|
|
78
77
|
const errors: unknown[] = [];
|
|
79
78
|
for (const alg of algs) {
|
|
80
79
|
try {
|
|
@@ -103,12 +102,27 @@ export class ReactNativeOAuthClient extends OAuthClient {
|
|
|
103
102
|
.digest("hex");
|
|
104
103
|
const use = "sig";
|
|
105
104
|
|
|
106
|
-
|
|
105
|
+
const newKey = {
|
|
106
|
+
...ex,
|
|
107
|
+
kid,
|
|
108
|
+
use,
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
let joseKey: JoseKey | null = null;
|
|
112
|
+
try {
|
|
113
|
+
joseKey = new JoseKey(newKey as Jwk);
|
|
114
|
+
} catch (err) {
|
|
115
|
+
throw new Error(`error creating jose key: ${err}`);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return joseKey;
|
|
107
119
|
} catch (err) {
|
|
108
120
|
errors.push(err);
|
|
109
121
|
}
|
|
110
122
|
}
|
|
111
|
-
throw new Error(
|
|
123
|
+
throw new Error(
|
|
124
|
+
`None of the algorithms worked: ${errors.join(", ")}`,
|
|
125
|
+
);
|
|
112
126
|
},
|
|
113
127
|
getRandomValues: (length) =>
|
|
114
128
|
new Uint8Array(QuickCrypto.randomBytes(length)),
|
package/src/sqlite-keystore.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SimpleStore } from "@atproto-labs/simple-store";
|
|
2
|
-
import {
|
|
2
|
+
import { Jwk, Key } from "@atproto/jwk";
|
|
3
3
|
import { JoseKey } from "@atproto/jwk-jose";
|
|
4
4
|
import Storage from "expo-sqlite/kv-store";
|
|
5
5
|
|
|
@@ -25,7 +25,7 @@ export class JoseKeyStore<T extends HasDPoPKey> {
|
|
|
25
25
|
if (!itemStr) return undefined;
|
|
26
26
|
const item = JSON.parse(itemStr) as T;
|
|
27
27
|
if (item.dpopKey) {
|
|
28
|
-
item.dpopKey = new JoseKey(
|
|
28
|
+
item.dpopKey = new JoseKey(item.dpopKey as unknown as Jwk);
|
|
29
29
|
}
|
|
30
30
|
return item;
|
|
31
31
|
}
|