jazz-react-native 0.8.44 → 0.8.47
Sign up to get free protection for your applications and to get access to all the features.
- package/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +26 -0
- package/dist/auth/DemoAuthMethod.d.ts +2 -1
- package/dist/auth/DemoAuthMethod.js +60 -25
- package/dist/auth/DemoAuthMethod.js.map +1 -1
- package/dist/auth/DemoAuthUI.d.ts +3 -1
- package/dist/auth/DemoAuthUI.js +13 -4
- package/dist/auth/DemoAuthUI.js.map +1 -1
- package/dist/crypto/RNQuickCrypto.d.ts +12 -0
- package/dist/crypto/RNQuickCrypto.js +31 -0
- package/dist/crypto/RNQuickCrypto.js.map +1 -0
- package/dist/crypto/index.d.ts +1 -0
- package/dist/crypto/index.js +2 -0
- package/dist/crypto/index.js.map +1 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +52 -21
- package/dist/index.js.map +1 -1
- package/dist/provider.d.ts +5 -5
- package/dist/provider.js +3 -1
- package/dist/provider.js.map +1 -1
- package/dist/tests/DemoAuthMethod.test.d.ts +1 -0
- package/dist/tests/DemoAuthMethod.test.js +186 -0
- package/dist/tests/DemoAuthMethod.test.js.map +1 -0
- package/package.json +11 -6
- package/src/auth/DemoAuthMethod.ts +79 -42
- package/src/auth/DemoAuthUI.tsx +14 -2
- package/src/crypto/RNQuickCrypto.ts +58 -0
- package/src/crypto/index.ts +1 -0
- package/src/index.ts +60 -25
- package/src/provider.tsx +8 -0
- package/src/tests/DemoAuthMethod.test.ts +282 -0
package/.turbo/turbo-build.log
CHANGED
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,31 @@
|
|
1
1
|
# jazz-browser
|
2
2
|
|
3
|
+
## 0.8.47
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- 33ef9c4: Bring Your Own Store to demo auth
|
8
|
+
|
9
|
+
## 0.8.46
|
10
|
+
|
11
|
+
### Patch Changes
|
12
|
+
|
13
|
+
- ab4ffbd: Demo Auth: fix the user credentials storage when the username contains non aplhanumeric characters
|
14
|
+
|
15
|
+
## 0.8.45
|
16
|
+
|
17
|
+
### Patch Changes
|
18
|
+
|
19
|
+
- 7701307: Added RNQuickCrypto, an optional crypto provider that provides faster signatures and removed expo-linking dependency
|
20
|
+
- Updated dependencies [6f0bd7f]
|
21
|
+
- Updated dependencies [fca6a0b]
|
22
|
+
- Updated dependencies [fa41f8e]
|
23
|
+
- Updated dependencies [88d7d9a]
|
24
|
+
- Updated dependencies [60e35ea]
|
25
|
+
- cojson@0.8.45
|
26
|
+
- jazz-tools@0.8.45
|
27
|
+
- cojson-transport-ws@0.8.45
|
28
|
+
|
3
29
|
## 0.8.44
|
4
30
|
|
5
31
|
### Patch Changes
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { AgentSecret } from "cojson";
|
2
2
|
import { Account, AuthMethod, AuthResult, ID } from "jazz-tools";
|
3
|
+
import { KvStore } from "../storage/kv-store-context.js";
|
3
4
|
/** @category Auth Providers */
|
4
5
|
export declare namespace RNDemoAuth {
|
5
6
|
interface Driver {
|
@@ -23,6 +24,6 @@ export declare class RNDemoAuth implements AuthMethod {
|
|
23
24
|
accountID: ID<Account>;
|
24
25
|
accountSecret: AgentSecret;
|
25
26
|
};
|
26
|
-
}): Promise<RNDemoAuth>;
|
27
|
+
}, store?: KvStore | undefined): Promise<RNDemoAuth>;
|
27
28
|
start(): Promise<AuthResult>;
|
28
29
|
}
|
@@ -1,5 +1,54 @@
|
|
1
1
|
import { KvStoreContext } from "../storage/kv-store-context.js";
|
2
2
|
const localStorageKey = "demo-auth-logged-in-secret";
|
3
|
+
function getUserStorageKey(username) {
|
4
|
+
return `demo-auth-existing-users-${btoa(username)}`;
|
5
|
+
}
|
6
|
+
function getLegacyUserStorageKey(username) {
|
7
|
+
return `demo-auth-existing-users-${username}`;
|
8
|
+
}
|
9
|
+
async function getStorageVersion(kvStore) {
|
10
|
+
try {
|
11
|
+
const version = await kvStore.get("demo-auth-storage-version");
|
12
|
+
return version ? parseInt(version) : 1;
|
13
|
+
}
|
14
|
+
catch (error) {
|
15
|
+
return 1;
|
16
|
+
}
|
17
|
+
}
|
18
|
+
async function setStorageVersion(kvStore, version) {
|
19
|
+
await kvStore.set("demo-auth-storage-version", version.toString());
|
20
|
+
}
|
21
|
+
async function getExistingUsers(kvStore) {
|
22
|
+
const existingUsers = await kvStore.get("demo-auth-existing-users");
|
23
|
+
return existingUsers ? existingUsers.split(",") : [];
|
24
|
+
}
|
25
|
+
async function addUserToExistingUsers(username, kvStore) {
|
26
|
+
const existingUsers = await getExistingUsers(kvStore);
|
27
|
+
if (existingUsers.includes(username)) {
|
28
|
+
return;
|
29
|
+
}
|
30
|
+
await kvStore.set("demo-auth-existing-users", existingUsers.concat(username).join(","));
|
31
|
+
}
|
32
|
+
/**
|
33
|
+
* Migrates existing users keys to use a base64 encoded username.
|
34
|
+
*
|
35
|
+
* This is done to avoid issues with special characters in the username.
|
36
|
+
*/
|
37
|
+
async function migrateExistingUsersKeys(kvStore) {
|
38
|
+
if ((await getStorageVersion(kvStore)) >= 2) {
|
39
|
+
return;
|
40
|
+
}
|
41
|
+
await setStorageVersion(kvStore, 2);
|
42
|
+
const existingUsers = await getExistingUsers(kvStore);
|
43
|
+
for (const existingUsername of existingUsers) {
|
44
|
+
const legacyKey = getLegacyUserStorageKey(existingUsername);
|
45
|
+
const storageData = await kvStore.get(legacyKey);
|
46
|
+
if (storageData) {
|
47
|
+
await kvStore.set(getUserStorageKey(existingUsername), storageData);
|
48
|
+
await kvStore.delete(legacyKey);
|
49
|
+
}
|
50
|
+
}
|
51
|
+
}
|
3
52
|
export class RNDemoAuth {
|
4
53
|
driver;
|
5
54
|
kvStore;
|
@@ -7,20 +56,13 @@ export class RNDemoAuth {
|
|
7
56
|
this.driver = driver;
|
8
57
|
this.kvStore = kvStore;
|
9
58
|
}
|
10
|
-
static async init(driver, seedAccounts) {
|
11
|
-
const kvStore = KvStoreContext.getInstance().getStorage();
|
59
|
+
static async init(driver, seedAccounts, store) {
|
60
|
+
const kvStore = store ? store : KvStoreContext.getInstance().getStorage();
|
61
|
+
await migrateExistingUsersKeys(kvStore);
|
12
62
|
for (const [name, credentials] of Object.entries(seedAccounts || {})) {
|
13
63
|
const storageData = JSON.stringify(credentials);
|
14
|
-
|
15
|
-
|
16
|
-
if (existingUsers) {
|
17
|
-
await kvStore.set("demo-auth-existing-users", existingUsers + "," + name);
|
18
|
-
}
|
19
|
-
else {
|
20
|
-
await kvStore.set("demo-auth-existing-users", name);
|
21
|
-
}
|
22
|
-
}
|
23
|
-
await kvStore.set("demo-auth-existing-users-" + name, storageData);
|
64
|
+
await addUserToExistingUsers(name, kvStore);
|
65
|
+
await kvStore.set(getUserStorageKey(name), storageData);
|
24
66
|
}
|
25
67
|
return new RNDemoAuth(driver, kvStore);
|
26
68
|
}
|
@@ -57,11 +99,7 @@ export class RNDemoAuth {
|
|
57
99
|
accountID: credentials.accountID,
|
58
100
|
accountSecret: credentials.secret,
|
59
101
|
});
|
60
|
-
|
61
|
-
const existingUsers = await this.kvStore.get("demo-auth-existing-users");
|
62
|
-
const existingUsernames = existingUsers
|
63
|
-
? existingUsers.split(",")
|
64
|
-
: [];
|
102
|
+
const existingUsernames = await getExistingUsers(this.kvStore);
|
65
103
|
// Determine if the username already exists and generate a unique username
|
66
104
|
let uniqueUsername = username;
|
67
105
|
let counter = 1;
|
@@ -71,12 +109,8 @@ export class RNDemoAuth {
|
|
71
109
|
}
|
72
110
|
// Save credentials using the unique username
|
73
111
|
await this.kvStore.set(localStorageKey, storageData);
|
74
|
-
await this.kvStore.set(
|
75
|
-
|
76
|
-
const updatedUsers = existingUsers
|
77
|
-
? `${existingUsers},${uniqueUsername}`
|
78
|
-
: uniqueUsername;
|
79
|
-
await this.kvStore.set("demo-auth-existing-users", updatedUsers);
|
112
|
+
await this.kvStore.set(getUserStorageKey(uniqueUsername), storageData);
|
113
|
+
await addUserToExistingUsers(uniqueUsername, this.kvStore);
|
80
114
|
},
|
81
115
|
onSuccess: () => {
|
82
116
|
this.driver.onSignedIn({ logOut });
|
@@ -92,10 +126,11 @@ export class RNDemoAuth {
|
|
92
126
|
});
|
93
127
|
},
|
94
128
|
getExistingUsers: async () => {
|
95
|
-
return
|
129
|
+
return await getExistingUsers(this.kvStore);
|
96
130
|
},
|
97
131
|
logInAs: async (existingUser) => {
|
98
|
-
const storageData = JSON.parse((await this.kvStore.get(
|
132
|
+
const storageData = JSON.parse((await this.kvStore.get(getUserStorageKey(existingUser))) ??
|
133
|
+
"{}");
|
99
134
|
await this.kvStore.set(localStorageKey, JSON.stringify(storageData));
|
100
135
|
resolve({
|
101
136
|
type: "existing",
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"DemoAuthMethod.js","sourceRoot":"","sources":["../../src/auth/DemoAuthMethod.ts"],"names":[],"mappings":"AAEA,OAAO,EAAW,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAqBzE,MAAM,eAAe,GAAG,4BAA4B,CAAC;AAErD,
|
1
|
+
{"version":3,"file":"DemoAuthMethod.js","sourceRoot":"","sources":["../../src/auth/DemoAuthMethod.ts"],"names":[],"mappings":"AAEA,OAAO,EAAW,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAqBzE,MAAM,eAAe,GAAG,4BAA4B,CAAC;AAErD,SAAS,iBAAiB,CAAC,QAAgB;IACzC,OAAO,4BAA4B,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;AACtD,CAAC;AAED,SAAS,uBAAuB,CAAC,QAAgB;IAC/C,OAAO,4BAA4B,QAAQ,EAAE,CAAC;AAChD,CAAC;AAED,KAAK,UAAU,iBAAiB,CAAC,OAAgB;IAC/C,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;QAC/D,OAAO,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACzC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAA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D,IAAI,CACQ,CAAC;4BAEjB,MAAM,IAAI,CAAC,OAAO,CAAC,GAAG,CACpB,eAAe,EACf,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAC5B,CAAC;4BAEF,OAAO,CAAC;gCACN,IAAI,EAAE,UAAU;gCAChB,WAAW,EAAE;oCACX,SAAS,EAAE,WAAW,CAAC,SAAS;oCAChC,MAAM,EAAE,WAAW,CAAC,aAAa;iCAClC;gCACD,SAAS,EAAE,GAAG,EAAE;oCACd,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;gCACrC,CAAC;gCACD,OAAO,EAAE,CAAC,KAAqB,EAAE,EAAE;oCACjC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;gCAC7B,CAAC;gCACD,MAAM,EAAE,KAAK,IAAI,EAAE;oCACjB,KAAK,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC;gCACpD,CAAC;6BACF,CAAC,CAAC;wBACL,CAAC;qBACF,CAAC,CAAC;gBACL,CAAC,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;YAC9B,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF;AAED,KAAK,UAAU,MAAM;IACnB,MAAM,OAAO,GAAG,cAAc,CAAC,WAAW,EAAE,CAAC,UAAU,EAAE,CAAC;IAC1D,KAAK,CAAC,MAAM,OAAO,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC;AAC/C,CAAC"}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { AgentSecret } from "cojson";
|
2
2
|
import { Account, ID } from "jazz-tools";
|
3
3
|
import React from "react";
|
4
|
+
import { KvStore } from "../storage/kv-store-context.js";
|
4
5
|
import { RNDemoAuth } from "./DemoAuthMethod.js";
|
5
6
|
type DemoAuthState = ({
|
6
7
|
state: "uninitialized";
|
@@ -18,13 +19,14 @@ type DemoAuthState = ({
|
|
18
19
|
errors: string[];
|
19
20
|
};
|
20
21
|
/** @category Auth Providers */
|
21
|
-
export declare function useDemoAuth({ seedAccounts, }?: {
|
22
|
+
export declare function useDemoAuth({ seedAccounts, store, }?: {
|
22
23
|
seedAccounts?: {
|
23
24
|
[name: string]: {
|
24
25
|
accountID: ID<Account>;
|
25
26
|
accountSecret: AgentSecret;
|
26
27
|
};
|
27
28
|
};
|
29
|
+
store?: KvStore;
|
28
30
|
}): readonly [RNDemoAuth | null, DemoAuthState];
|
29
31
|
export declare const DemoAuthBasicUI: ({ appName, state, }: {
|
30
32
|
appName: string;
|
package/dist/auth/DemoAuthUI.js
CHANGED
@@ -2,7 +2,7 @@ import React, { useMemo, useState, useEffect } from "react";
|
|
2
2
|
import { StyleSheet, Text, TextInput, TouchableOpacity, View, } from "react-native";
|
3
3
|
import { RNDemoAuth } from "./DemoAuthMethod.js";
|
4
4
|
/** @category Auth Providers */
|
5
|
-
export function useDemoAuth({ seedAccounts, } = {}) {
|
5
|
+
export function useDemoAuth({ seedAccounts, store, } = {}) {
|
6
6
|
const [state, setState] = useState({
|
7
7
|
state: "loading",
|
8
8
|
errors: [],
|
@@ -29,12 +29,21 @@ export function useDemoAuth({ seedAccounts, } = {}) {
|
|
29
29
|
errors: [...current.errors, error.toString()],
|
30
30
|
}));
|
31
31
|
},
|
32
|
-
}, seedAccounts);
|
32
|
+
}, seedAccounts, store);
|
33
33
|
}, [seedAccounts]);
|
34
34
|
useEffect(() => {
|
35
35
|
async function init() {
|
36
|
-
|
37
|
-
|
36
|
+
try {
|
37
|
+
const auth = await authMethodPromise;
|
38
|
+
setAuthMethod(auth);
|
39
|
+
}
|
40
|
+
catch (e) {
|
41
|
+
const err = e;
|
42
|
+
setState((current) => ({
|
43
|
+
...current,
|
44
|
+
errors: [...current.errors, err.toString()],
|
45
|
+
}));
|
46
|
+
}
|
38
47
|
}
|
39
48
|
if (authMethod)
|
40
49
|
return;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"DemoAuthUI.js","sourceRoot":"","sources":["../../src/auth/DemoAuthUI.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC5D,OAAO,EACL,UAAU,EACV,IAAI,EACJ,SAAS,EACT,gBAAgB,EAChB,IAAI,GACL,MAAM,cAAc,CAAC;
|
1
|
+
{"version":3,"file":"DemoAuthUI.js","sourceRoot":"","sources":["../../src/auth/DemoAuthUI.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC5D,OAAO,EACL,UAAU,EACV,IAAI,EACJ,SAAS,EACT,gBAAgB,EAChB,IAAI,GACL,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAuBjD,+BAA+B;AAC/B,MAAM,UAAU,WAAW,CAAC,EAC1B,YAAY,EACZ,KAAK,MAMH,EAAE;IACJ,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAgB;QAChD,KAAK,EAAE,SAAS;QAChB,MAAM,EAAE,EAAE;KACX,CAAC,CAAC;IAEH,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAoB,IAAI,CAAC,CAAC;IAEtE,MAAM,iBAAiB,GAAG,OAAO,CAAC,GAAG,EAAE;QACrC,OAAO,UAAU,CAAC,IAAI,CACpB;YACE,OAAO,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,gBAAgB,EAAE,OAAO,EAAE,EAAE,EAAE;gBACvD,MAAM,aAAa,GAAG,MAAM,gBAAgB,EAAE,CAAC;gBAC/C,QAAQ,CAAC;oBACP,KAAK,EAAE,OA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
|
|
1
|
+
import { JsonValue, PureJSCrypto } from "cojson/native";
|
2
|
+
import { CojsonInternalTypes } from "cojson/native";
|
3
|
+
import { Ed } from "react-native-quick-crypto";
|
4
|
+
export declare class RNQuickCrypto extends PureJSCrypto {
|
5
|
+
ed: Ed;
|
6
|
+
constructor();
|
7
|
+
static create(): Promise<RNQuickCrypto>;
|
8
|
+
newEd25519SigningKey(): Uint8Array;
|
9
|
+
getSignerID(secret: CojsonInternalTypes.SignerSecret): CojsonInternalTypes.SignerID;
|
10
|
+
sign(secret: CojsonInternalTypes.SignerSecret, message: JsonValue): CojsonInternalTypes.Signature;
|
11
|
+
verify(signature: CojsonInternalTypes.Signature, message: JsonValue, id: CojsonInternalTypes.SignerID): boolean;
|
12
|
+
}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import { base58 } from "@scure/base";
|
2
|
+
import { PureJSCrypto } from "cojson/native";
|
3
|
+
import { cojsonInternals } from "cojson/native";
|
4
|
+
import { Ed } from "react-native-quick-crypto";
|
5
|
+
const { stableStringify } = cojsonInternals;
|
6
|
+
const textEncoder = new TextEncoder();
|
7
|
+
export class RNQuickCrypto extends PureJSCrypto {
|
8
|
+
ed;
|
9
|
+
constructor() {
|
10
|
+
super();
|
11
|
+
this.ed = new Ed("ed25519", {});
|
12
|
+
}
|
13
|
+
static async create() {
|
14
|
+
return new RNQuickCrypto();
|
15
|
+
}
|
16
|
+
newEd25519SigningKey() {
|
17
|
+
this.ed.generateKeyPairSync();
|
18
|
+
return new Uint8Array(this.ed.getPrivateKey());
|
19
|
+
}
|
20
|
+
getSignerID(secret) {
|
21
|
+
return `signer_z${base58.encode(base58.decode(secret.substring("signerSecret_z".length)))}`;
|
22
|
+
}
|
23
|
+
sign(secret, message) {
|
24
|
+
const signature = new Uint8Array(this.ed.signSync(textEncoder.encode(stableStringify(message)), base58.decode(secret.substring("signerSecret_z".length))));
|
25
|
+
return `signature_z${base58.encode(signature)}`;
|
26
|
+
}
|
27
|
+
verify(signature, message, id) {
|
28
|
+
return this.ed.verifySync(base58.decode(signature.substring("signature_z".length)), textEncoder.encode(stableStringify(message)), base58.decode(id.substring("signer_z".length)));
|
29
|
+
}
|
30
|
+
}
|
31
|
+
//# sourceMappingURL=RNQuickCrypto.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"RNQuickCrypto.js","sourceRoot":"","sources":["../../src/crypto/RNQuickCrypto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAa,YAAY,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAuB,eAAe,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,EAAE,EAAE,EAAE,MAAM,2BAA2B,CAAC;AAC/C,MAAM,EAAE,eAAe,EAAE,GAAG,eAAe,CAAC;AAE5C,MAAM,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC;AAEtC,MAAM,OAAO,aAAc,SAAQ,YAAY;IAC7C,EAAE,CAAK;IAEP;QACE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;IAClC,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,MAAM;QACjB,OAAO,IAAI,aAAa,EAAE,CAAC;IAC7B,CAAC;IAED,oBAAoB;QAClB,IAAI,CAAC,EAAE,CAAC,mBAAmB,EAAE,CAAC;QAC9B,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC,CAAC;IACjD,CAAC;IAED,WAAW,CACT,MAAwC;QAExC,OAAO,WAAW,MAAM,CAAC,MAAM,CAC7B,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,CACzD,EAAE,CAAC;IACN,CAAC;IAED,IAAI,CACF,MAAwC,EACxC,OAAkB;QAElB,MAAM,SAAS,GAAG,IAAI,UAAU,CAC9B,IAAI,CAAC,EAAE,CAAC,QAAQ,CACd,WAAW,CAAC,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,EAC5C,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,CACzD,CACF,CAAC;QACF,OAAO,cAAc,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC;IAClD,CAAC;IAED,MAAM,CACJ,SAAwC,EACxC,OAAkB,EAClB,EAAgC;QAEhC,OAAO,IAAI,CAAC,EAAE,CAAC,UAAU,CACvB,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,EACxD,WAAW,CAAC,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,EAC5C,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAC/C,CAAC;IACJ,CAAC;CACF"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export { RNQuickCrypto } from "./RNQuickCrypto.js";
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/crypto/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/index.d.ts
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
import { Account, AgentID, AnonymousJazzAgent, AuthMethod, CoValue, CoValueClass, CryptoProvider, ID, InviteSecret, SessionID } from "jazz-tools";
|
2
2
|
import { RawAccountID } from "cojson";
|
3
3
|
export { RNDemoAuth } from "./auth/DemoAuthMethod.js";
|
4
|
+
import { PureJSCrypto } from "cojson/native";
|
5
|
+
import type { RNQuickCrypto } from "./crypto/RNQuickCrypto.js";
|
4
6
|
/** @category Context Creation */
|
5
7
|
export type ReactNativeContext<Acc extends Account> = {
|
6
8
|
me: Acc;
|
@@ -22,7 +24,7 @@ export type BaseReactNativeContextOptions = {
|
|
22
24
|
peer: `wss://${string}` | `ws://${string}`;
|
23
25
|
reconnectionTimeout?: number;
|
24
26
|
storage?: "indexedDB" | "singleTabOPFS";
|
25
|
-
|
27
|
+
CryptoProvider?: typeof PureJSCrypto | typeof RNQuickCrypto;
|
26
28
|
};
|
27
29
|
/** @category Context Creation */
|
28
30
|
export declare function createJazzRNContext<Acc extends Account>(options: ReactNativeContextOptions<Acc>): Promise<ReactNativeContext<Acc>>;
|
package/dist/index.js
CHANGED
@@ -1,25 +1,25 @@
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
2
2
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
3
3
|
import { cojsonInternals, createJazzContext, } from "jazz-tools";
|
4
|
-
import * as Linking from "expo-linking";
|
5
|
-
import { PureJSCrypto } from "jazz-tools/native";
|
6
4
|
export { RNDemoAuth } from "./auth/DemoAuthMethod.js";
|
5
|
+
import { PureJSCrypto } from "cojson/native";
|
7
6
|
import { createWebSocketPeerWithReconnection } from "./createWebSocketPeerWithReconnection.js";
|
8
7
|
import { KvStoreContext } from "./storage/kv-store-context.js";
|
9
8
|
export async function createJazzRNContext(options) {
|
10
9
|
const websocketPeer = createWebSocketPeerWithReconnection(options.peer, options.reconnectionTimeout, (peer) => {
|
11
10
|
node.syncManager.addPeer(peer);
|
12
11
|
});
|
12
|
+
const CryptoProvider = options.CryptoProvider || PureJSCrypto;
|
13
13
|
const context = "auth" in options
|
14
14
|
? await createJazzContext({
|
15
15
|
AccountSchema: options.AccountSchema,
|
16
16
|
auth: options.auth,
|
17
|
-
crypto: await
|
17
|
+
crypto: await CryptoProvider.create(),
|
18
18
|
peersToLoadFrom: [websocketPeer.peer],
|
19
19
|
sessionProvider: provideLockSession,
|
20
20
|
})
|
21
21
|
: await createJazzContext({
|
22
|
-
crypto: await
|
22
|
+
crypto: await CryptoProvider.create(),
|
23
23
|
peersToLoadFrom: [websocketPeer.peer],
|
24
24
|
});
|
25
25
|
const node = "account" in context ? context.account._raw.core.node : context.agent.node;
|
@@ -71,29 +71,60 @@ export function createInviteLink(value, role, { baseURL, valueHint } = {}) {
|
|
71
71
|
return `${baseURL}/invite/${valueHint ? valueHint + "/" : ""}${value.id}/${inviteSecret}`;
|
72
72
|
}
|
73
73
|
/** @category Invite Links */
|
74
|
+
// TODO: copied from jazz-browser, should be shared
|
74
75
|
export function parseInviteLink(inviteURL) {
|
75
|
-
const url =
|
76
|
-
const parts = url.
|
77
|
-
if (!parts || parts[0] !== "invite") {
|
78
|
-
return undefined;
|
79
|
-
}
|
76
|
+
const url = new URL(inviteURL);
|
77
|
+
const parts = url.hash.split("/");
|
80
78
|
let valueHint;
|
81
79
|
let valueID;
|
82
80
|
let inviteSecret;
|
83
|
-
if (parts
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
81
|
+
if (parts[0] === "#" && parts[1] === "invite") {
|
82
|
+
if (parts.length === 5) {
|
83
|
+
valueHint = parts[2];
|
84
|
+
valueID = parts[3];
|
85
|
+
inviteSecret = parts[4];
|
86
|
+
}
|
87
|
+
else if (parts.length === 4) {
|
88
|
+
valueID = parts[2];
|
89
|
+
inviteSecret = parts[3];
|
90
|
+
}
|
91
|
+
if (!valueID || !inviteSecret) {
|
92
|
+
return undefined;
|
93
|
+
}
|
94
|
+
return { valueID, inviteSecret, valueHint };
|
94
95
|
}
|
95
|
-
return { valueID, inviteSecret, valueHint };
|
96
96
|
}
|
97
|
+
// getting out of the `expo` business 🤞
|
98
|
+
// export function parseInviteLink<C extends CoValue>(
|
99
|
+
// inviteURL: string,
|
100
|
+
// ):
|
101
|
+
// | {
|
102
|
+
// valueID: ID<C>;
|
103
|
+
// valueHint?: string;
|
104
|
+
// inviteSecret: InviteSecret;
|
105
|
+
// }
|
106
|
+
// | undefined {
|
107
|
+
// const url = Linking.parse(inviteURL);
|
108
|
+
// const parts = url.path?.split("/");
|
109
|
+
// if (!parts || parts[0] !== "invite") {
|
110
|
+
// return undefined;
|
111
|
+
// }
|
112
|
+
// let valueHint: string | undefined;
|
113
|
+
// let valueID: ID<C> | undefined;
|
114
|
+
// let inviteSecret: InviteSecret | undefined;
|
115
|
+
// if (parts.length === 4) {
|
116
|
+
// valueHint = parts[1];
|
117
|
+
// valueID = parts[2] as ID<C>;
|
118
|
+
// inviteSecret = parts[3] as InviteSecret;
|
119
|
+
// } else if (parts.length === 3) {
|
120
|
+
// valueID = parts[1] as ID<C>;
|
121
|
+
// inviteSecret = parts[2] as InviteSecret;
|
122
|
+
// }
|
123
|
+
// if (!valueID || !inviteSecret) {
|
124
|
+
// return undefined;
|
125
|
+
// }
|
126
|
+
// return { valueID, inviteSecret, valueHint };
|
127
|
+
// }
|
97
128
|
/////////
|
98
129
|
export * from "./provider.js";
|
99
130
|
export * from "./auth/auth.js";
|
package/dist/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,sDAAsD;AACtD,OAAO,EAWL,eAAe,EACf,iBAAiB,GAClB,MAAM,YAAY,CAAC;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,sDAAsD;AACtD,OAAO,EAWL,eAAe,EACf,iBAAiB,GAClB,MAAM,YAAY,CAAC;AAIpB,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,mCAAmC,EAAE,MAAM,0CAA0C,CAAC;AAE/F,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAwC/D,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,OAAuE;IAEvE,MAAM,aAAa,GAAG,mCAAmC,CACvD,OAA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;AAC5B,oCAAoC;AACpC,QAAQ;AACR,kBAAkB;AAClB,0CAA0C;AAC1C,wCAAwC;AAExC,2CAA2C;AAC3C,wBAAwB;AACxB,MAAM;AAEN,uCAAuC;AACvC,oCAAoC;AACpC,gDAAgD;AAEhD,8BAA8B;AAC9B,4BAA4B;AAC5B,mCAAmC;AACnC,+CAA+C;AAC/C,qCAAqC;AACrC,mCAAmC;AACnC,+CAA+C;AAC/C,MAAM;AAEN,qCAAqC;AACrC,wBAAwB;AACxB,MAAM;AAEN,iDAAiD;AACjD,IAAI;AAEJ,SAAS;AAET,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,+BAA+B,CAAC"}
|
package/dist/provider.d.ts
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
import React from "react";
|
2
2
|
import { Account, AccountClass, AnonymousJazzAgent, AuthMethod, CoValue, CoValueClass, DeeplyLoaded, DepthsIn, ID } from "jazz-tools";
|
3
|
-
import { KvStore } from "./index.js";
|
4
|
-
import { ExpoSecureStoreAdapter } from "./storage/expo-secure-store-adapter.js";
|
3
|
+
import { BaseReactNativeContextOptions, KvStore } from "./index.js";
|
5
4
|
/** @category Context & Hooks */
|
6
|
-
export declare function createJazzRNApp<Acc extends Account>({ kvStore, AccountSchema, }?: {
|
7
|
-
kvStore?:
|
8
|
-
AccountSchema?: AccountClass<Acc
|
5
|
+
export declare function createJazzRNApp<Acc extends Account>({ kvStore, AccountSchema, CryptoProvider, }?: {
|
6
|
+
kvStore?: KvStore;
|
7
|
+
AccountSchema?: AccountClass<Acc>;
|
8
|
+
CryptoProvider?: BaseReactNativeContextOptions["CryptoProvider"];
|
9
9
|
}): JazzReactApp<Acc>;
|
10
10
|
/** @category Context & Hooks */
|
11
11
|
export interface JazzReactApp<Acc extends Account> {
|
package/dist/provider.js
CHANGED
@@ -4,7 +4,7 @@ import { Linking } from "react-native";
|
|
4
4
|
import { KvStoreContext, createJazzRNContext, parseInviteLink, } from "./index.js";
|
5
5
|
import { ExpoSecureStoreAdapter } from "./storage/expo-secure-store-adapter.js";
|
6
6
|
/** @category Context & Hooks */
|
7
|
-
export function createJazzRNApp({ kvStore = new ExpoSecureStoreAdapter(), AccountSchema = Account, } = {}) {
|
7
|
+
export function createJazzRNApp({ kvStore = new ExpoSecureStoreAdapter(), AccountSchema = Account, CryptoProvider, } = {}) {
|
8
8
|
const JazzContext = React.createContext(undefined);
|
9
9
|
if (!kvStore) {
|
10
10
|
throw new Error("kvStore is required");
|
@@ -18,12 +18,14 @@ export function createJazzRNApp({ kvStore = new ExpoSecureStoreAdapter(), Accoun
|
|
18
18
|
? {
|
19
19
|
peer,
|
20
20
|
storage,
|
21
|
+
CryptoProvider,
|
21
22
|
}
|
22
23
|
: {
|
23
24
|
AccountSchema,
|
24
25
|
auth: auth,
|
25
26
|
peer,
|
26
27
|
storage,
|
28
|
+
CryptoProvider,
|
27
29
|
}).then((context) => {
|
28
30
|
setCtx({
|
29
31
|
...context,
|
package/dist/provider.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../src/provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEnD,OAAO,EACL,OAAO,EASP,kBAAkB,GACnB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,
|
1
|
+
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../src/provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEnD,OAAO,EACL,OAAO,EASP,kBAAkB,GACnB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAGL,cAAc,EAGd,mBAAmB,EACnB,eAAe,GAChB,MAA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