@symbiote-native/crypto 0.2.0 → 1.0.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 CHANGED
@@ -3,11 +3,10 @@
3
3
  A wrapper package for [SymbioteNative](../../README.md) that makes
4
4
  [`expo-crypto`](https://github.com/expo/expo/tree/main/packages/expo-crypto) — cryptographically
5
5
  secure random bytes, `randomUUID`, and string/buffer digest hashing — usable from **every**
6
- adapter, React, Vue, and Angular, not just React. Like `@symbiote-native/local-auth`, every
6
+ adapter, React, Vue, Svelte, Solid, and Angular. Like `@symbiote-native/local-auth`, every
7
7
  function here is a plain sync/async call with no per-instance state or event stream, so there is
8
- no hook/composable/service to wrap — the React, Vue, and Angular entry points are plain
9
- re-exports of the same `core`. AES encryption (`expo-crypto`'s `aes/` subfolder) is out of scope
10
- for this pass.
8
+ no hook/composable/service to wrap — every adapter's entry point is a plain re-export of the same
9
+ `core`. AES encryption (`expo-crypto`'s `aes/` subfolder) is out of scope for this pass.
11
10
 
12
11
  ## Install
13
12
 
@@ -26,12 +25,12 @@ Unlike a plain RN native module, `expo-crypto`'s native code is discovered by
26
25
  into the native host app **once**, covering this package and every other `expo-modules-core`
27
26
  package with zero further changes:
28
27
 
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) |
28
+ | Platform | Touches |
29
+ | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
30
+ | iOS | `ios/Podfile` — add `use_expo_modules!` |
31
+ | iOS | `AppDelegate.swift` — Expo's runtime-bootstrap hook |
32
+ | Android | `settings.gradle` / `app/build.gradle` — resolve and include the Expo Gradle projects |
33
+ | 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
34
 
36
35
  Full mechanics live in the `symbiote-expo-native-module` project skill. Reference
37
36
  implementation: `examples/expo-react/ios/Podfile` and
@@ -48,13 +47,12 @@ src/core/ getRandomBytes / getRandomBytesAsync / getRandomValues / randomUUI
48
47
  option/result types, and the CryptoError validation-error class.
49
48
  native-module.ts resolves the native module via expo-modules-core's
50
49
  requireNativeModule.
51
- src/react/ @symbiote-native/crypto/react — export * from '../core'
52
- src/vue/ @symbiote-native/crypto/vue — export * from '../core'
53
50
  src/angular/ @symbiote-native/crypto/angular — export * from '../core'
54
51
  ```
55
52
 
56
- No per-adapter lifecycle wrapper exists because there's nothing to subscribe to or clean up —
57
- each adapter entry is a single-file re-export.
53
+ `./react`, `./vue`, `./svelte`, and `./solid` are `exports`-map aliases straight onto `src/core/`
54
+ — no physical per-framework file, since there's nothing to subscribe to or clean up. `./angular`
55
+ stays a physical file/subpath since Angular ships through a separate `ngc`/AOT build (`build-ngc/`).
58
56
 
59
57
  ## Use it
60
58
 
@@ -77,7 +75,9 @@ function CryptoScreen() {
77
75
  }, []);
78
76
 
79
77
  const handleHash = () => {
80
- digestStringAsync(CryptoDigestAlgorithm.SHA256, 'Confirm it is you').then(setHash);
78
+ digestStringAsync(CryptoDigestAlgorithm.SHA256, 'Confirm it is you').then(
79
+ setHash,
80
+ );
81
81
  };
82
82
 
83
83
  return (
@@ -111,7 +111,10 @@ onMounted(() => {
111
111
  });
112
112
 
113
113
  function handleHash(): void {
114
- void digestStringAsync(CryptoDigestAlgorithm.SHA256, 'Confirm it is you').then(value => {
114
+ void digestStringAsync(
115
+ CryptoDigestAlgorithm.SHA256,
116
+ 'Confirm it is you',
117
+ ).then(value => {
115
118
  hash.value = value;
116
119
  });
117
120
  }
@@ -128,6 +131,67 @@ function handleHash(): void {
128
131
  </template>
129
132
  ```
130
133
 
134
+ ```svelte
135
+ <!-- Svelte -->
136
+ <script lang="ts">
137
+ import { Pressable, Text, View } from '@symbiote-native/svelte';
138
+ import {
139
+ CryptoDigestAlgorithm,
140
+ digestStringAsync,
141
+ randomUUID,
142
+ } from '@symbiote-native/crypto/svelte';
143
+
144
+ const uuid = randomUUID();
145
+ let hash = $state('');
146
+
147
+ function handleHash(): void {
148
+ digestStringAsync(CryptoDigestAlgorithm.SHA256, 'Confirm it is you').then(
149
+ value => (hash = value),
150
+ );
151
+ }
152
+ </script>
153
+
154
+ <View>
155
+ <Text>UUID: {uuid}</Text>
156
+ <Pressable onPress={handleHash}>
157
+ <Text>Hash a string</Text>
158
+ </Pressable>
159
+ {#if hash}<Text>SHA-256: {hash}</Text>{/if}
160
+ </View>
161
+ ```
162
+
163
+ ```tsx
164
+ // Solid
165
+ import { createSignal } from 'solid-js';
166
+ import { Pressable, Text, View } from '@symbiote-native/solid';
167
+ import {
168
+ CryptoDigestAlgorithm,
169
+ digestStringAsync,
170
+ randomUUID,
171
+ } from '@symbiote-native/crypto';
172
+
173
+ function CryptoScreen() {
174
+ const [uuid] = createSignal(randomUUID());
175
+ const [hash, setHash] = createSignal('');
176
+
177
+ const handleHash = () => {
178
+ digestStringAsync(CryptoDigestAlgorithm.SHA256, 'Confirm it is you').then(
179
+ setHash,
180
+ );
181
+ };
182
+
183
+ return (
184
+ <View>
185
+ <Text>UUID: {uuid()}</Text>
186
+ <Pressable onPress={handleHash}>
187
+ <Text>Hash a string</Text>
188
+ </Pressable>
189
+ {hash() && <Text>SHA-256: {hash()}</Text>}
190
+ </View>
191
+ );
192
+ }
193
+ ```
194
+
131
195
  ```ts
132
196
  // Angular
133
197
  import { Component, signal } from '@angular/core';
@@ -158,15 +222,19 @@ export class CryptoScreen {
158
222
  readonly hash = signal('');
159
223
 
160
224
  handleHash(): void {
161
- digestStringAsync(CryptoDigestAlgorithm.SHA256, 'Confirm it is you').then(value =>
162
- this.hash.set(value),
225
+ digestStringAsync(CryptoDigestAlgorithm.SHA256, 'Confirm it is you').then(
226
+ value => this.hash.set(value),
163
227
  );
164
228
  }
165
229
  }
166
230
  ```
167
231
 
168
232
  There's no per-instance service to `inject()` in the Angular case — every function is a plain
169
- free function off the core package.
233
+ free function off the core package, called straight from the component body (or the constructor,
234
+ on Angular). All five examples mirror the real canary demo screens —
235
+ `examples/expo-react/screens/CryptoScreen.tsx`, `examples/expo-vue-sfc/screens/CryptoScreen.vue`,
236
+ `examples/expo-vue-tsx/screens/CryptoScreen.tsx`, `examples/expo-svelte/screens/CryptoScreen.svelte`,
237
+ `examples/expo-solid/screens/CryptoScreen.tsx`, `examples/expo-angular/src/screens/CryptoScreen.ts`.
170
238
 
171
239
  ## API
172
240
 
@@ -196,6 +264,8 @@ import { digestStringAsync, randomUUID } from '@symbiote-native/crypto';
196
264
  // or the framework-scoped entry points — identical surface, re-exported verbatim:
197
265
  import { randomUUID } from '@symbiote-native/crypto/react';
198
266
  import { randomUUID } from '@symbiote-native/crypto/vue';
267
+ import { randomUUID } from '@symbiote-native/crypto/svelte';
268
+ import { randomUUID } from '@symbiote-native/crypto/solid';
199
269
  import { randomUUID } from '@symbiote-native/crypto/angular';
200
270
  ```
201
271
 
@@ -220,7 +290,7 @@ real `requireNativeModule` resolution (`src/core/crypto.test.ts`, `vitest`) —
220
290
  `installFabric()`, no ViewConfig. Native rendering itself is verified on-device (see the parent
221
291
  [README](../../README.md) for the project's testing model).
222
292
 
223
- Native autolinking wiring is expected to land in the four Expo canary apps
224
- (`examples/expo-react`, `examples/expo-vue-sfc`, `examples/expo-vue-tsx`, `examples/expo-angular`)
225
- following the same recipe already proven for `@symbiote-native/local-auth`/`@symbiote-native/sensors`
226
- — demo-screen wiring for this package is a follow-up, not part of this pass.
293
+ Native autolinking wiring is already done in all six Expo canary apps
294
+ (`examples/expo-react`, `examples/expo-vue-sfc`, `examples/expo-vue-tsx`, `examples/expo-svelte`,
295
+ `examples/expo-solid`, `examples/expo-angular`), each with its own `CryptoScreen` demo, following
296
+ the same recipe already proven for `@symbiote-native/local-auth`/`@sym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uDAAuD;AACvD,gGAAgG;AAChG,4BAA4B;AAC5B,oFAAoF;AACpF;;;;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;AAIxD,MAAM,uBAAuB,GAAG,YAAY,CAAC;AAqB7C,MAAM,CAAC,MAAM,UAAU,GAAG,mBAAmB,CAAsB,uBAAuB,CAAC,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.2.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": "1.0.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",
@@ -13,6 +13,18 @@
13
13
  "url": "https://github.com/OneEyed1366/symbiote-native/issues"
14
14
  },
15
15
  "author": "Andrey Prokopenko <psevdoproger@gmail.com>",
16
+ "keywords": [
17
+ "react-native",
18
+ "symbiote-native",
19
+ "expo-crypto",
20
+ "react",
21
+ "vue",
22
+ "svelte",
23
+ "solid",
24
+ "angular",
25
+ "random-bytes",
26
+ "hashing"
27
+ ],
16
28
  "type": "module",
17
29
  "main": "./build/core/index.js",
18
30
  "module": "./build/core/index.js",
@@ -23,16 +35,20 @@
23
35
  "default": "./build/core/index.js"
24
36
  },
25
37
  "./vue": {
26
- "types": "./build/vue/index.d.ts",
27
- "default": "./build/vue/index.js"
38
+ "types": "./build/core/index.d.ts",
39
+ "default": "./build/core/index.js"
28
40
  },
29
41
  "./react": {
30
- "types": "./build/react/index.d.ts",
31
- "default": "./build/react/index.js"
42
+ "types": "./build/core/index.d.ts",
43
+ "default": "./build/core/index.js"
32
44
  },
33
45
  "./svelte": {
34
- "types": "./build/svelte/index.d.ts",
35
- "default": "./build/svelte/index.js"
46
+ "types": "./build/core/index.d.ts",
47
+ "default": "./build/core/index.js"
48
+ },
49
+ "./solid": {
50
+ "types": "./build/core/index.d.ts",
51
+ "default": "./build/core/index.js"
36
52
  },
37
53
  "./angular": {
38
54
  "types": "./build-ngc/angular/index.d.ts",
@@ -57,17 +73,19 @@
57
73
  "expo-modules-core": "57.0.5"
58
74
  },
59
75
  "peerDependencies": {
60
- "@symbiote-native/angular": ">=0.6.2",
61
- "@symbiote-native/engine": ">=0.1.7",
62
- "@symbiote-native/react": ">=0.2.8",
63
- "@symbiote-native/svelte": ">=0.1.0",
64
- "@symbiote-native/vue": ">=0.3.8",
65
76
  "@angular/core": ">=20",
66
77
  "@vue/runtime-core": "^3.5.13",
67
78
  "react": ">=19.0.0",
68
79
  "react-native": ">=0.86",
80
+ "solid-js": ">=1.9.0",
69
81
  "svelte": ">=5.56.0",
70
- "vue": ">=3.5.0"
82
+ "vue": ">=3.5.0",
83
+ "@symbiote-native/angular": "^1.0.0",
84
+ "@symbiote-native/engine": "^0.4.0",
85
+ "@symbiote-native/react": "^1.0.0",
86
+ "@symbiote-native/solid": "^1.0.0",
87
+ "@symbiote-native/svelte": "^1.0.0",
88
+ "@symbiote-native/vue": "^1.0.0"
71
89
  },
72
90
  "peerDependenciesMeta": {
73
91
  "@symbiote-native/angular": {
@@ -76,6 +94,9 @@
76
94
  "@symbiote-native/react": {
77
95
  "optional": true
78
96
  },
97
+ "@symbiote-native/solid": {
98
+ "optional": true
99
+ },
79
100
  "@symbiote-native/svelte": {
80
101
  "optional": true
81
102
  },
@@ -91,6 +112,9 @@
91
112
  "react": {
92
113
  "optional": true
93
114
  },
115
+ "solid-js": {
116
+ "optional": true
117
+ },
94
118
  "svelte": {
95
119
  "optional": true
96
120
  },
@@ -106,14 +130,16 @@
106
130
  "@types/react": "^19.2.0",
107
131
  "@vue/runtime-core": "^3.5.13",
108
132
  "react": "19.2.3",
133
+ "solid-js": "^1.9.14",
109
134
  "svelte": "^5.56.0",
110
135
  "typescript": "~6.0.0",
111
- "@symbiote-native/angular": "0.7.0",
112
- "@symbiote-native/engine": "0.2.0",
113
- "@symbiote-native/react": "0.3.0",
114
- "@symbiote-native/svelte": "0.2.0",
115
- "@symbiote-native/test-utils": "0.1.6",
116
- "@symbiote-native/vue": "0.4.0"
136
+ "@symbiote-native/angular": "1.0.0",
137
+ "@symbiote-native/engine": "0.4.0",
138
+ "@symbiote-native/react": "1.0.0",
139
+ "@symbiote-native/solid": "1.0.0",
140
+ "@symbiote-native/svelte": "1.0.0",
141
+ "@symbiote-native/test-utils": "0.3.0",
142
+ "@symbiote-native/vue": "1.0.0"
117
143
  },
118
144
  "scripts": {
119
145
  "typecheck": "tsc --build",
@@ -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(byteCount: number): Promise<Uint8Array> {
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(algorithm: CryptoDigestAlgorithm, data: BufferSource): Promise<ArrayBuffer> {
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 { CryptoDigestAlgorithm, ICryptoDigestOptions, IDigest, ITypedArray } from './types';
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(algorithm: CryptoDigestAlgorithm, output: Uint8Array, data: BufferSource): void;
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?(algorithm: CryptoDigestAlgorithm, data: BufferSource): Promise<ArrayBuffer>;
32
+ digestAsync?(
33
+ algorithm: CryptoDigestAlgorithm,
34
+ data: BufferSource,
35
+ ): Promise<ArrayBuffer>;
24
36
  };
25
37
 
26
- export const expoCrypto = requireNativeModule<INativeCryptoModule>(EXPO_CRYPTO_MODULE_NAME);
38
+ export const expoCrypto = requireNativeModule<INativeCryptoModule>(
39
+ EXPO_CRYPTO_MODULE_NAME,
40
+ );
@@ -1 +0,0 @@
1
- export * from '../core';
@@ -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';
@@ -1 +0,0 @@
1
- export * from '../core';
@@ -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';
@@ -1 +0,0 @@
1
- export * from '../core';
@@ -1,4 +0,0 @@
1
- // @symbiote-native/crypto/vue: the Vue entry over the framework-agnostic core. Same reasoning
2
- // as the React entry — no per-instance state or event stream to wire onto Vue's reactivity, so
3
- // this is a plain re-export.
4
- export * from '../core/index.js';
@@ -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';
@@ -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
@@ -1,4 +0,0 @@
1
- // @symbiote-native/crypto/vue: the Vue entry over the framework-agnostic core. Same reasoning
2
- // as the React entry — no per-instance state or event stream to wire onto Vue's reactivity, so
3
- // this is a plain re-export.
4
- export * from '../core';