@symbiote-native/crypto 0.1.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 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 | `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) |
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
- 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.
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(setHash);
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(CryptoDigestAlgorithm.SHA256, 'Confirm it is you').then(value => {
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(value =>
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
  }
@@ -106,6 +106,12 @@ const digestLengths = {
106
106
  [CryptoDigestAlgorithm.MD4]: 16,
107
107
  [CryptoDigestAlgorithm.MD5]: 16,
108
108
  };
109
+ // UPSTREAM-BUG(expo): .vendors/expo/packages/expo-crypto/src/Crypto.ts:205 - digest() has none
110
+ // of digestStringAsync's guards, so an unknown algorithm leaves digestLengths[algorithm]
111
+ // undefined and new Uint8Array(undefined) zero-length.
112
+ // The caller gets an empty ArrayBuffer resolved as SUCCESS - no throw, nothing to catch, a hash
113
+ // that silently is not one.
114
+ // Ported verbatim for parity; do NOT fix without recording a deliberate divergence.
109
115
  /**
110
116
  * Generates a digest of the supplied `TypedArray`/`ArrayBuffer` of bytes with the provided digest
111
117
  * `algorithm`. Prefers the native async `digestAsync` when present; otherwise falls back to
@@ -106,6 +106,12 @@ const digestLengths = {
106
106
  [CryptoDigestAlgorithm.MD4]: 16,
107
107
  [CryptoDigestAlgorithm.MD5]: 16,
108
108
  };
109
+ // UPSTREAM-BUG(expo): .vendors/expo/packages/expo-crypto/src/Crypto.ts:205 - digest() has none
110
+ // of digestStringAsync's guards, so an unknown algorithm leaves digestLengths[algorithm]
111
+ // undefined and new Uint8Array(undefined) zero-length.
112
+ // The caller gets an empty ArrayBuffer resolved as SUCCESS - no throw, nothing to catch, a hash
113
+ // that silently is not one.
114
+ // Ported verbatim for parity; do NOT fix without recording a deliberate divergence.
109
115
  /**
110
116
  * Generates a digest of the supplied `TypedArray`/`ArrayBuffer` of bytes with the provided digest
111
117
  * `algorithm`. Prefers the native async `digestAsync` when present; otherwise falls back to
@@ -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,CA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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.1.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,12 +23,20 @@
23
23
  "default": "./build/core/index.js"
24
24
  },
25
25
  "./vue": {
26
- "types": "./build/vue/index.d.ts",
27
- "default": "./build/vue/index.js"
26
+ "types": "./build/core/index.d.ts",
27
+ "default": "./build/core/index.js"
28
28
  },
29
29
  "./react": {
30
- "types": "./build/react/index.d.ts",
31
- "default": "./build/react/index.js"
30
+ "types": "./build/core/index.d.ts",
31
+ "default": "./build/core/index.js"
32
+ },
33
+ "./svelte": {
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"
32
40
  },
33
41
  "./angular": {
34
42
  "types": "./build-ngc/angular/index.d.ts",
@@ -53,15 +61,19 @@
53
61
  "expo-modules-core": "57.0.5"
54
62
  },
55
63
  "peerDependencies": {
64
+ "@symbiote-native/angular": ">=0.6.2",
56
65
  "@symbiote-native/engine": ">=0.1.7",
66
+ "@symbiote-native/react": ">=0.2.8",
67
+ "@symbiote-native/solid": ">=0.0.1",
68
+ "@symbiote-native/svelte": ">=0.1.0",
69
+ "@symbiote-native/vue": ">=0.3.8",
57
70
  "@angular/core": ">=20",
58
71
  "@vue/runtime-core": "^3.5.13",
59
72
  "react": ">=19.0.0",
60
73
  "react-native": ">=0.86",
61
- "vue": ">=3.5.0",
62
- "@symbiote-native/angular": "0.6.2",
63
- "@symbiote-native/react": "0.2.8",
64
- "@symbiote-native/vue": "0.3.8"
74
+ "solid-js": ">=1.9.0",
75
+ "svelte": ">=5.56.0",
76
+ "vue": ">=3.5.0"
65
77
  },
66
78
  "peerDependenciesMeta": {
67
79
  "@symbiote-native/angular": {
@@ -70,6 +82,12 @@
70
82
  "@symbiote-native/react": {
71
83
  "optional": true
72
84
  },
85
+ "@symbiote-native/solid": {
86
+ "optional": true
87
+ },
88
+ "@symbiote-native/svelte": {
89
+ "optional": true
90
+ },
73
91
  "@symbiote-native/vue": {
74
92
  "optional": true
75
93
  },
@@ -82,24 +100,34 @@
82
100
  "react": {
83
101
  "optional": true
84
102
  },
103
+ "solid-js": {
104
+ "optional": true
105
+ },
106
+ "svelte": {
107
+ "optional": true
108
+ },
85
109
  "vue": {
86
110
  "optional": true
87
111
  }
88
112
  },
89
113
  "devDependencies": {
90
- "@angular/compiler": "^22",
91
- "@angular/compiler-cli": "^22",
92
- "@angular/core": "^22",
114
+ "@angular/compiler": "~22.0.8",
115
+ "@angular/compiler-cli": "~22.0.8",
116
+ "@angular/core": "~22.0.8",
93
117
  "@types/node": "^26.0.0",
94
118
  "@types/react": "^19.2.0",
95
119
  "@vue/runtime-core": "^3.5.13",
96
120
  "react": "19.2.3",
121
+ "solid-js": "^1.9.14",
122
+ "svelte": "^5.56.0",
97
123
  "typescript": "~6.0.0",
98
- "@symbiote-native/angular": "0.6.2",
99
- "@symbiote-native/engine": "0.1.7",
100
- "@symbiote-native/react": "0.2.8",
101
- "@symbiote-native/test-utils": "0.1.6",
102
- "@symbiote-native/vue": "0.3.8"
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"
103
131
  },
104
132
  "scripts": {
105
133
  "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) {
@@ -140,12 +142,21 @@ const digestLengths: Record<CryptoDigestAlgorithm, number> = {
140
142
  [CryptoDigestAlgorithm.MD5]: 16,
141
143
  };
142
144
 
145
+ // UPSTREAM-BUG(expo): .vendors/expo/packages/expo-crypto/src/Crypto.ts:205 - digest() has none
146
+ // of digestStringAsync's guards, so an unknown algorithm leaves digestLengths[algorithm]
147
+ // undefined and new Uint8Array(undefined) zero-length.
148
+ // The caller gets an empty ArrayBuffer resolved as SUCCESS - no throw, nothing to catch, a hash
149
+ // that silently is not one.
150
+ // Ported verbatim for parity; do NOT fix without recording a deliberate divergence.
143
151
  /**
144
152
  * Generates a digest of the supplied `TypedArray`/`ArrayBuffer` of bytes with the provided digest
145
153
  * `algorithm`. Prefers the native async `digestAsync` when present; otherwise falls back to
146
154
  * allocating a fixed-size output buffer (sized via `digestLengths`) and the sync `digest`.
147
155
  */
148
- export function digest(algorithm: CryptoDigestAlgorithm, data: BufferSource): Promise<ArrayBuffer> {
156
+ export function digest(
157
+ algorithm: CryptoDigestAlgorithm,
158
+ data: BufferSource,
159
+ ): Promise<ArrayBuffer> {
149
160
  return new Promise((resolve, reject) => {
150
161
  try {
151
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,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';
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';