@symbiote-native/crypto 0.2.0 → 0.3.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.
- package/README.md +18 -14
- package/build-ngc/core/crypto.js.map +1 -1
- package/build-ngc/core/native-module.js.map +1 -1
- package/package.json +28 -14
- package/src/core/crypto.ts +7 -2
- package/src/core/native-module.ts +18 -4
- package/build/react/index.d.ts +0 -1
- package/build/react/index.js +0 -5
- package/build/svelte/index.d.ts +0 -1
- package/build/svelte/index.js +0 -6
- package/build/vue/index.d.ts +0 -1
- package/build/vue/index.js +0 -4
- package/src/react/index.ts +0 -5
- package/src/svelte/index.ts +0 -6
- package/src/vue/index.ts +0 -4
package/README.md
CHANGED
|
@@ -26,12 +26,12 @@ Unlike a plain RN native module, `expo-crypto`'s native code is discovered by
|
|
|
26
26
|
into the native host app **once**, covering this package and every other `expo-modules-core`
|
|
27
27
|
package with zero further changes:
|
|
28
28
|
|
|
29
|
-
| Platform | Touches
|
|
30
|
-
|
|
31
|
-
| iOS
|
|
32
|
-
| iOS
|
|
33
|
-
| Android
|
|
34
|
-
| Android
|
|
29
|
+
| Platform | Touches |
|
|
30
|
+
| -------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
31
|
+
| iOS | `ios/Podfile` — add `use_expo_modules!` |
|
|
32
|
+
| iOS | `AppDelegate.swift` — Expo's runtime-bootstrap hook |
|
|
33
|
+
| Android | `settings.gradle` / `app/build.gradle` — resolve and include the Expo Gradle projects |
|
|
34
|
+
| Android | `MainApplication.kt` — Expo's bootstrap hook, plus a hand-written native-module name map (there's no `expo` meta-package here to auto-generate one) |
|
|
35
35
|
|
|
36
36
|
Full mechanics live in the `symbiote-expo-native-module` project skill. Reference
|
|
37
37
|
implementation: `examples/expo-react/ios/Podfile` and
|
|
@@ -48,13 +48,12 @@ src/core/ getRandomBytes / getRandomBytesAsync / getRandomValues / randomUUI
|
|
|
48
48
|
option/result types, and the CryptoError validation-error class.
|
|
49
49
|
native-module.ts resolves the native module via expo-modules-core's
|
|
50
50
|
requireNativeModule.
|
|
51
|
-
src/react/ @symbiote-native/crypto/react — export * from '../core'
|
|
52
|
-
src/vue/ @symbiote-native/crypto/vue — export * from '../core'
|
|
53
51
|
src/angular/ @symbiote-native/crypto/angular — export * from '../core'
|
|
54
52
|
```
|
|
55
53
|
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
`./react`, `./vue`, and `./svelte` are `exports`-map aliases straight onto `src/core/` — no
|
|
55
|
+
physical per-framework file, since there's nothing to subscribe to or clean up. `./angular` stays
|
|
56
|
+
a physical file/subpath since Angular ships through a separate `ngc`/AOT build (`build-ngc/`).
|
|
58
57
|
|
|
59
58
|
## Use it
|
|
60
59
|
|
|
@@ -77,7 +76,9 @@ function CryptoScreen() {
|
|
|
77
76
|
}, []);
|
|
78
77
|
|
|
79
78
|
const handleHash = () => {
|
|
80
|
-
digestStringAsync(CryptoDigestAlgorithm.SHA256, 'Confirm it is you').then(
|
|
79
|
+
digestStringAsync(CryptoDigestAlgorithm.SHA256, 'Confirm it is you').then(
|
|
80
|
+
setHash,
|
|
81
|
+
);
|
|
81
82
|
};
|
|
82
83
|
|
|
83
84
|
return (
|
|
@@ -111,7 +112,10 @@ onMounted(() => {
|
|
|
111
112
|
});
|
|
112
113
|
|
|
113
114
|
function handleHash(): void {
|
|
114
|
-
void digestStringAsync(
|
|
115
|
+
void digestStringAsync(
|
|
116
|
+
CryptoDigestAlgorithm.SHA256,
|
|
117
|
+
'Confirm it is you',
|
|
118
|
+
).then(value => {
|
|
115
119
|
hash.value = value;
|
|
116
120
|
});
|
|
117
121
|
}
|
|
@@ -158,8 +162,8 @@ export class CryptoScreen {
|
|
|
158
162
|
readonly hash = signal('');
|
|
159
163
|
|
|
160
164
|
handleHash(): void {
|
|
161
|
-
digestStringAsync(CryptoDigestAlgorithm.SHA256, 'Confirm it is you').then(
|
|
162
|
-
this.hash.set(value),
|
|
165
|
+
digestStringAsync(CryptoDigestAlgorithm.SHA256, 'Confirm it is you').then(
|
|
166
|
+
value => this.hash.set(value),
|
|
163
167
|
);
|
|
164
168
|
}
|
|
165
169
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crypto.js","sourceRoot":"","sources":["../../src/core/crypto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAGhE,MAAM,kBAAkB,GAAG,aAAa,CAAC;AACzC,MAAM,cAAc,GAAG,CAAC,CAAC;AACzB,MAAM,cAAc,GAAG,IAAI,CAAC;AAE5B,MAAM,OAAO,WAAY,SAAQ,SAAS;IACxC,IAAI,GAAG,YAAY,CAAC;IAEpB,YAAY,OAAe;QACzB,KAAK,CAAC,gBAAgB,OAAO,EAAE,CAAC,CAAC;IACnC,CAAC;CACF;AAED,SAAS,eAAe,CAAC,KAAa,EAAE,UAAkB;IACxD,IACE,OAAO,KAAK,KAAK,QAAQ;QACzB,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC;QACnB,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,cAAc;QAClC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,cAAc,EAClC,CAAC;QACD,MAAM,IAAI,SAAS,CACjB,gBAAgB,UAAU,IAAI,KAAK,wCAAwC,cAAc,MAAM,cAAc,EAAE,CAChH,CAAC;IACJ,CAAC;AACH,CAAC;AAED,SAAS,eAAe,CAAC,SAAgC;IACvD,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;QAC9D,MAAM,IAAI,WAAW,CACnB,sEAAsE,MAAM,CAAC,IAAI,CAC/E,qBAAqB,CACtB,CAAC,IAAI,CAAC,0BAA0B,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;;;GAIG;AACH,MAAM,UAAU,MAAM,CACpB,SAAgC,EAChC,IAAkB;IAElB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,IAAI,CAAC;YACH,IAAI,OAAO,UAAU,CAAC,WAAW,KAAK,UAAU,EAAE,CAAC;gBACjD,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC;gBACjD,OAAO;YACT,CAAC;YACD,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;gBACvB,MAAM,IAAI,mBAAmB,CAAC,kBAAkB,EAAE,QAAQ,CAAC,CAAC;YAC9D,CAAC;YACD,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC;YACxD,UAAU,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;YAC3C,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACzB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,KAAK,CAAC,CAAC;QAChB,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native-module.js","sourceRoot":"","sources":["../../src/core/native-module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"native-module.js","sourceRoot":"","sources":["../../src/core/native-module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AASxD,MAAM,uBAAuB,GAAG,YAAY,CAAC;AA4B7C,MAAM,CAAC,MAAM,UAAU,GAAG,mBAAmB,CAC3C,uBAAuB,CACxB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbiote-native/crypto",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "expo-crypto wrapped for SymbioteNative — one framework-agnostic core, built once and reachable from the React, Vue, and Angular adapters. Cryptographically secure random bytes, randomUUID, and string/buffer digest hashing (SHA-1/256/384/512, MD2/MD4/MD5).",
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "expo-crypto wrapped for SymbioteNative — one framework-agnostic core, built once and reachable from the React, Vue, Svelte, Solid, and Angular adapters. Cryptographically secure random bytes, randomUUID, and string/buffer digest hashing (SHA-1/256/384/512, MD2/MD4/MD5).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -23,16 +23,20 @@
|
|
|
23
23
|
"default": "./build/core/index.js"
|
|
24
24
|
},
|
|
25
25
|
"./vue": {
|
|
26
|
-
"types": "./build/
|
|
27
|
-
"default": "./build/
|
|
26
|
+
"types": "./build/core/index.d.ts",
|
|
27
|
+
"default": "./build/core/index.js"
|
|
28
28
|
},
|
|
29
29
|
"./react": {
|
|
30
|
-
"types": "./build/
|
|
31
|
-
"default": "./build/
|
|
30
|
+
"types": "./build/core/index.d.ts",
|
|
31
|
+
"default": "./build/core/index.js"
|
|
32
32
|
},
|
|
33
33
|
"./svelte": {
|
|
34
|
-
"types": "./build/
|
|
35
|
-
"default": "./build/
|
|
34
|
+
"types": "./build/core/index.d.ts",
|
|
35
|
+
"default": "./build/core/index.js"
|
|
36
|
+
},
|
|
37
|
+
"./solid": {
|
|
38
|
+
"types": "./build/core/index.d.ts",
|
|
39
|
+
"default": "./build/core/index.js"
|
|
36
40
|
},
|
|
37
41
|
"./angular": {
|
|
38
42
|
"types": "./build-ngc/angular/index.d.ts",
|
|
@@ -60,12 +64,14 @@
|
|
|
60
64
|
"@symbiote-native/angular": ">=0.6.2",
|
|
61
65
|
"@symbiote-native/engine": ">=0.1.7",
|
|
62
66
|
"@symbiote-native/react": ">=0.2.8",
|
|
67
|
+
"@symbiote-native/solid": ">=0.0.1",
|
|
63
68
|
"@symbiote-native/svelte": ">=0.1.0",
|
|
64
69
|
"@symbiote-native/vue": ">=0.3.8",
|
|
65
70
|
"@angular/core": ">=20",
|
|
66
71
|
"@vue/runtime-core": "^3.5.13",
|
|
67
72
|
"react": ">=19.0.0",
|
|
68
73
|
"react-native": ">=0.86",
|
|
74
|
+
"solid-js": ">=1.9.0",
|
|
69
75
|
"svelte": ">=5.56.0",
|
|
70
76
|
"vue": ">=3.5.0"
|
|
71
77
|
},
|
|
@@ -76,6 +82,9 @@
|
|
|
76
82
|
"@symbiote-native/react": {
|
|
77
83
|
"optional": true
|
|
78
84
|
},
|
|
85
|
+
"@symbiote-native/solid": {
|
|
86
|
+
"optional": true
|
|
87
|
+
},
|
|
79
88
|
"@symbiote-native/svelte": {
|
|
80
89
|
"optional": true
|
|
81
90
|
},
|
|
@@ -91,6 +100,9 @@
|
|
|
91
100
|
"react": {
|
|
92
101
|
"optional": true
|
|
93
102
|
},
|
|
103
|
+
"solid-js": {
|
|
104
|
+
"optional": true
|
|
105
|
+
},
|
|
94
106
|
"svelte": {
|
|
95
107
|
"optional": true
|
|
96
108
|
},
|
|
@@ -106,14 +118,16 @@
|
|
|
106
118
|
"@types/react": "^19.2.0",
|
|
107
119
|
"@vue/runtime-core": "^3.5.13",
|
|
108
120
|
"react": "19.2.3",
|
|
121
|
+
"solid-js": "^1.9.14",
|
|
109
122
|
"svelte": "^5.56.0",
|
|
110
123
|
"typescript": "~6.0.0",
|
|
111
|
-
"@symbiote-native/angular": "0.
|
|
112
|
-
"@symbiote-native/engine": "0.
|
|
113
|
-
"@symbiote-native/react": "0.
|
|
114
|
-
"@symbiote-native/
|
|
115
|
-
"@symbiote-native/
|
|
116
|
-
"@symbiote-native/
|
|
124
|
+
"@symbiote-native/angular": "0.8.0",
|
|
125
|
+
"@symbiote-native/engine": "0.3.0",
|
|
126
|
+
"@symbiote-native/react": "0.4.0",
|
|
127
|
+
"@symbiote-native/solid": "0.1.0",
|
|
128
|
+
"@symbiote-native/svelte": "0.3.0",
|
|
129
|
+
"@symbiote-native/test-utils": "0.2.0",
|
|
130
|
+
"@symbiote-native/vue": "0.5.0"
|
|
117
131
|
},
|
|
118
132
|
"scripts": {
|
|
119
133
|
"typecheck": "tsc --build",
|
package/src/core/crypto.ts
CHANGED
|
@@ -74,7 +74,9 @@ export function getRandomBytes(byteCount: number): Uint8Array {
|
|
|
74
74
|
* Generates completely random bytes using native implementations. `byteCount` must be within
|
|
75
75
|
* `0`-`1024` (inclusive), anything else throws a `TypeError`.
|
|
76
76
|
*/
|
|
77
|
-
export async function getRandomBytesAsync(
|
|
77
|
+
export async function getRandomBytesAsync(
|
|
78
|
+
byteCount: number,
|
|
79
|
+
): Promise<Uint8Array> {
|
|
78
80
|
assertByteCount(byteCount, 'getRandomBytesAsync');
|
|
79
81
|
const validByteCount = Math.floor(byteCount);
|
|
80
82
|
if (!expoCrypto.getRandomValues) {
|
|
@@ -151,7 +153,10 @@ const digestLengths: Record<CryptoDigestAlgorithm, number> = {
|
|
|
151
153
|
* `algorithm`. Prefers the native async `digestAsync` when present; otherwise falls back to
|
|
152
154
|
* allocating a fixed-size output buffer (sized via `digestLengths`) and the sync `digest`.
|
|
153
155
|
*/
|
|
154
|
-
export function digest(
|
|
156
|
+
export function digest(
|
|
157
|
+
algorithm: CryptoDigestAlgorithm,
|
|
158
|
+
data: BufferSource,
|
|
159
|
+
): Promise<ArrayBuffer> {
|
|
155
160
|
return new Promise((resolve, reject) => {
|
|
156
161
|
try {
|
|
157
162
|
if (typeof expoCrypto.digestAsync === 'function') {
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { requireNativeModule } from 'expo-modules-core';
|
|
2
2
|
|
|
3
|
-
import type {
|
|
3
|
+
import type {
|
|
4
|
+
CryptoDigestAlgorithm,
|
|
5
|
+
ICryptoDigestOptions,
|
|
6
|
+
IDigest,
|
|
7
|
+
ITypedArray,
|
|
8
|
+
} from './types';
|
|
4
9
|
|
|
5
10
|
const EXPO_CRYPTO_MODULE_NAME = 'ExpoCrypto';
|
|
6
11
|
|
|
@@ -14,13 +19,22 @@ const EXPO_CRYPTO_MODULE_NAME = 'ExpoCrypto';
|
|
|
14
19
|
export type INativeCryptoModule = {
|
|
15
20
|
getRandomValues(typedArray: ITypedArray): void;
|
|
16
21
|
randomUUID(): string;
|
|
17
|
-
digest(
|
|
22
|
+
digest(
|
|
23
|
+
algorithm: CryptoDigestAlgorithm,
|
|
24
|
+
output: Uint8Array,
|
|
25
|
+
data: BufferSource,
|
|
26
|
+
): void;
|
|
18
27
|
digestStringAsync?(
|
|
19
28
|
algorithm: CryptoDigestAlgorithm,
|
|
20
29
|
data: string,
|
|
21
30
|
options: ICryptoDigestOptions,
|
|
22
31
|
): Promise<IDigest>;
|
|
23
|
-
digestAsync?(
|
|
32
|
+
digestAsync?(
|
|
33
|
+
algorithm: CryptoDigestAlgorithm,
|
|
34
|
+
data: BufferSource,
|
|
35
|
+
): Promise<ArrayBuffer>;
|
|
24
36
|
};
|
|
25
37
|
|
|
26
|
-
export const expoCrypto = requireNativeModule<INativeCryptoModule>(
|
|
38
|
+
export const expoCrypto = requireNativeModule<INativeCryptoModule>(
|
|
39
|
+
EXPO_CRYPTO_MODULE_NAME,
|
|
40
|
+
);
|
package/build/react/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '../core';
|
package/build/react/index.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
// @symbiote-native/crypto/react: the React entry over the framework-agnostic core.
|
|
2
|
-
// Upstream ships free sync/async functions and two enums, no per-instance state and no event
|
|
3
|
-
// stream — there is nothing for a hook to wrap, so this is a plain re-export, mirroring
|
|
4
|
-
// packages/local-auth/src/react/index.ts.
|
|
5
|
-
export * from '../core/index.js';
|
package/build/svelte/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '../core';
|
package/build/svelte/index.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
// @symbiote-native/crypto/svelte: the Svelte entry over the framework-agnostic core.
|
|
2
|
-
// Upstream ships free sync/async functions and two enums, no per-instance state and no event
|
|
3
|
-
// stream — there is nothing for a rune to wrap, so this is a plain re-export. Svelte's
|
|
4
|
-
// lifecycle bucket is `runes/` (adapters/svelte/src/runes — never React's `hooks` or Vue's
|
|
5
|
-
// `composables`), and this package has none to fill.
|
|
6
|
-
export * from '../core/index.js';
|
package/build/vue/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '../core';
|
package/build/vue/index.js
DELETED
package/src/react/index.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
// @symbiote-native/crypto/react: the React entry over the framework-agnostic core.
|
|
2
|
-
// Upstream ships free sync/async functions and two enums, no per-instance state and no event
|
|
3
|
-
// stream — there is nothing for a hook to wrap, so this is a plain re-export, mirroring
|
|
4
|
-
// packages/local-auth/src/react/index.ts.
|
|
5
|
-
export * from '../core';
|
package/src/svelte/index.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
// @symbiote-native/crypto/svelte: the Svelte entry over the framework-agnostic core.
|
|
2
|
-
// Upstream ships free sync/async functions and two enums, no per-instance state and no event
|
|
3
|
-
// stream — there is nothing for a rune to wrap, so this is a plain re-export. Svelte's
|
|
4
|
-
// lifecycle bucket is `runes/` (adapters/svelte/src/runes — never React's `hooks` or Vue's
|
|
5
|
-
// `composables`), and this package has none to fill.
|
|
6
|
-
export * from '../core';
|
package/src/vue/index.ts
DELETED