@symbiote-native/crypto 0.3.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 +78 -12
- package/package.json +27 -15
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,
|
|
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 —
|
|
9
|
-
|
|
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
|
|
|
@@ -51,9 +50,9 @@ src/core/ getRandomBytes / getRandomBytesAsync / getRandomValues / randomUUI
|
|
|
51
50
|
src/angular/ @symbiote-native/crypto/angular — export * from '../core'
|
|
52
51
|
```
|
|
53
52
|
|
|
54
|
-
`./react`, `./vue`, and `./
|
|
55
|
-
physical per-framework file, since there's nothing to subscribe to or clean up. `./angular`
|
|
56
|
-
a physical file/subpath since Angular ships through a separate `ngc`/AOT build (`build-ngc/`).
|
|
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/`).
|
|
57
56
|
|
|
58
57
|
## Use it
|
|
59
58
|
|
|
@@ -132,6 +131,67 @@ function handleHash(): void {
|
|
|
132
131
|
</template>
|
|
133
132
|
```
|
|
134
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
|
+
|
|
135
195
|
```ts
|
|
136
196
|
// Angular
|
|
137
197
|
import { Component, signal } from '@angular/core';
|
|
@@ -170,7 +230,11 @@ export class CryptoScreen {
|
|
|
170
230
|
```
|
|
171
231
|
|
|
172
232
|
There's no per-instance service to `inject()` in the Angular case — every function is a plain
|
|
173
|
-
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`.
|
|
174
238
|
|
|
175
239
|
## API
|
|
176
240
|
|
|
@@ -200,6 +264,8 @@ import { digestStringAsync, randomUUID } from '@symbiote-native/crypto';
|
|
|
200
264
|
// or the framework-scoped entry points — identical surface, re-exported verbatim:
|
|
201
265
|
import { randomUUID } from '@symbiote-native/crypto/react';
|
|
202
266
|
import { randomUUID } from '@symbiote-native/crypto/vue';
|
|
267
|
+
import { randomUUID } from '@symbiote-native/crypto/svelte';
|
|
268
|
+
import { randomUUID } from '@symbiote-native/crypto/solid';
|
|
203
269
|
import { randomUUID } from '@symbiote-native/crypto/angular';
|
|
204
270
|
```
|
|
205
271
|
|
|
@@ -224,7 +290,7 @@ real `requireNativeModule` resolution (`src/core/crypto.test.ts`, `vitest`) —
|
|
|
224
290
|
`installFabric()`, no ViewConfig. Native rendering itself is verified on-device (see the parent
|
|
225
291
|
[README](../../README.md) for the project's testing model).
|
|
226
292
|
|
|
227
|
-
Native autolinking wiring is
|
|
228
|
-
(`examples/expo-react`, `examples/expo-vue-sfc`, `examples/expo-vue-tsx`, `examples/expo-
|
|
229
|
-
|
|
230
|
-
|
|
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`/`@symbiote-native/sensors`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbiote-native/crypto",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
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": {
|
|
@@ -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",
|
|
@@ -61,19 +73,19 @@
|
|
|
61
73
|
"expo-modules-core": "57.0.5"
|
|
62
74
|
},
|
|
63
75
|
"peerDependencies": {
|
|
64
|
-
"@symbiote-native/angular": ">=0.6.2",
|
|
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",
|
|
70
76
|
"@angular/core": ">=20",
|
|
71
77
|
"@vue/runtime-core": "^3.5.13",
|
|
72
78
|
"react": ">=19.0.0",
|
|
73
79
|
"react-native": ">=0.86",
|
|
74
80
|
"solid-js": ">=1.9.0",
|
|
75
81
|
"svelte": ">=5.56.0",
|
|
76
|
-
"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"
|
|
77
89
|
},
|
|
78
90
|
"peerDependenciesMeta": {
|
|
79
91
|
"@symbiote-native/angular": {
|
|
@@ -121,13 +133,13 @@
|
|
|
121
133
|
"solid-js": "^1.9.14",
|
|
122
134
|
"svelte": "^5.56.0",
|
|
123
135
|
"typescript": "~6.0.0",
|
|
124
|
-
"@symbiote-native/angular": "0.
|
|
125
|
-
"@symbiote-native/engine": "0.
|
|
126
|
-
"@symbiote-native/react": "0.
|
|
127
|
-
"@symbiote-native/solid": "
|
|
128
|
-
"@symbiote-native/svelte": "0.
|
|
129
|
-
"@symbiote-native/test-utils": "0.
|
|
130
|
-
"@symbiote-native/vue": "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"
|
|
131
143
|
},
|
|
132
144
|
"scripts": {
|
|
133
145
|
"typecheck": "tsc --build",
|