@symbiote-native/crypto 0.3.0 → 2.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.
Files changed (2) hide show
  1. package/README.md +99 -37
  2. 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, 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
 
@@ -51,16 +50,15 @@ 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 `./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/`).
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
 
60
59
  ```tsx
61
60
  // React
62
61
  import { useEffect, useState } from 'react';
63
- import { Pressable, Text, View } from '@symbiote-native/react';
64
62
  import {
65
63
  CryptoDigestAlgorithm,
66
64
  digestStringAsync,
@@ -82,13 +80,13 @@ function CryptoScreen() {
82
80
  };
83
81
 
84
82
  return (
85
- <View>
86
- <Text>UUID: {uuid}</Text>
87
- <Pressable onPress={handleHash}>
88
- <Text>Hash a string</Text>
89
- </Pressable>
90
- {hash && <Text>SHA-256: {hash}</Text>}
91
- </View>
83
+ <view>
84
+ <text>UUID: {uuid}</text>
85
+ <pressable onPress={handleHash}>
86
+ <text>Hash a string</text>
87
+ </pressable>
88
+ {hash && <text>SHA-256: {hash}</text>}
89
+ </view>
92
90
  );
93
91
  }
94
92
  ```
@@ -97,7 +95,6 @@ function CryptoScreen() {
97
95
  <!-- Vue -->
98
96
  <script setup lang="ts">
99
97
  import { onMounted, ref } from 'vue';
100
- import { Pressable, Text, View } from '@symbiote-native/vue';
101
98
  import {
102
99
  CryptoDigestAlgorithm,
103
100
  digestStringAsync,
@@ -122,20 +119,79 @@ function handleHash(): void {
122
119
  </script>
123
120
 
124
121
  <template>
125
- <View>
126
- <Text>UUID: {{ uuid }}</Text>
127
- <Pressable @press="handleHash">
128
- <Text>Hash a string</Text>
129
- </Pressable>
130
- <Text v-if="hash">SHA-256: {{ hash }}</Text>
131
- </View>
122
+ <view>
123
+ <text>UUID: {{ uuid }}</text>
124
+ <pressable @press="handleHash">
125
+ <text>Hash a string</text>
126
+ </pressable>
127
+ <text v-if="hash">SHA-256: {{ hash }}</text>
128
+ </view>
132
129
  </template>
133
130
  ```
134
131
 
132
+ ```svelte
133
+ <!-- Svelte -->
134
+ <script lang="ts">
135
+ import {
136
+ CryptoDigestAlgorithm,
137
+ digestStringAsync,
138
+ randomUUID,
139
+ } from '@symbiote-native/crypto/svelte';
140
+
141
+ const uuid = randomUUID();
142
+ let hash = $state('');
143
+
144
+ function handleHash(): void {
145
+ digestStringAsync(CryptoDigestAlgorithm.SHA256, 'Confirm it is you').then(
146
+ value => (hash = value),
147
+ );
148
+ }
149
+ </script>
150
+
151
+ <view>
152
+ <text>UUID: {uuid}</text>
153
+ <pressable onPress={handleHash}>
154
+ <text>Hash a string</text>
155
+ </pressable>
156
+ {#if hash}<text>SHA-256: {hash}</text>{/if}
157
+ </view>
158
+ ```
159
+
160
+ ```tsx
161
+ // Solid
162
+ import { createSignal } from 'solid-js';
163
+ import {
164
+ CryptoDigestAlgorithm,
165
+ digestStringAsync,
166
+ randomUUID,
167
+ } from '@symbiote-native/crypto';
168
+
169
+ function CryptoScreen() {
170
+ const [uuid] = createSignal(randomUUID());
171
+ const [hash, setHash] = createSignal('');
172
+
173
+ const handleHash = () => {
174
+ digestStringAsync(CryptoDigestAlgorithm.SHA256, 'Confirm it is you').then(
175
+ setHash,
176
+ );
177
+ };
178
+
179
+ return (
180
+ <view>
181
+ <text>UUID: {uuid()}</text>
182
+ <pressable onPress={handleHash}>
183
+ <text>Hash a string</text>
184
+ </pressable>
185
+ {hash() && <text>SHA-256: {hash()}</text>}
186
+ </view>
187
+ );
188
+ }
189
+ ```
190
+
135
191
  ```ts
136
192
  // Angular
137
193
  import { Component, signal } from '@angular/core';
138
- import { Pressable, Text, View } from '@symbiote-native/angular';
194
+ import { SYMBIOTE_ELEMENTS } from '@symbiote-native/angular';
139
195
  import {
140
196
  CryptoDigestAlgorithm,
141
197
  digestStringAsync,
@@ -144,17 +200,17 @@ import {
144
200
 
145
201
  @Component({
146
202
  standalone: true,
147
- imports: [Pressable, Text, View],
203
+ imports: [SYMBIOTE_ELEMENTS],
148
204
  template: `
149
- <View>
150
- <Text>UUID: {{ uuid() }}</Text>
151
- <Pressable (press)="handleHash()">
152
- <Text>Hash a string</Text>
153
- </Pressable>
205
+ <view>
206
+ <text>UUID: {{ uuid() }}</text>
207
+ <pressable (press)="handleHash()">
208
+ <text>Hash a string</text>
209
+ </pressable>
154
210
  @if (hash()) {
155
- <Text>SHA-256: {{ hash() }}</Text>
211
+ <text>SHA-256: {{ hash() }}</text>
156
212
  }
157
- </View>
213
+ </view>
158
214
  `,
159
215
  })
160
216
  export class CryptoScreen {
@@ -170,7 +226,11 @@ export class CryptoScreen {
170
226
  ```
171
227
 
172
228
  There's no per-instance service to `inject()` in the Angular case — every function is a plain
173
- free function off the core package.
229
+ free function off the core package, called straight from the component body (or the constructor,
230
+ on Angular). All five examples mirror the real canary demo screens —
231
+ `examples/expo-react/screens/CryptoScreen.tsx`, `examples/expo-vue-sfc/screens/CryptoScreen.vue`,
232
+ `examples/expo-vue-tsx/screens/CryptoScreen.tsx`, `examples/expo-svelte/screens/CryptoScreen.svelte`,
233
+ `examples/expo-solid/screens/CryptoScreen.tsx`, `examples/expo-angular/src/screens/CryptoScreen.ts`.
174
234
 
175
235
  ## API
176
236
 
@@ -200,6 +260,8 @@ import { digestStringAsync, randomUUID } from '@symbiote-native/crypto';
200
260
  // or the framework-scoped entry points — identical surface, re-exported verbatim:
201
261
  import { randomUUID } from '@symbiote-native/crypto/react';
202
262
  import { randomUUID } from '@symbiote-native/crypto/vue';
263
+ import { randomUUID } from '@symbiote-native/crypto/svelte';
264
+ import { randomUUID } from '@symbiote-native/crypto/solid';
203
265
  import { randomUUID } from '@symbiote-native/crypto/angular';
204
266
  ```
205
267
 
@@ -224,7 +286,7 @@ real `requireNativeModule` resolution (`src/core/crypto.test.ts`, `vitest`) —
224
286
  `installFabric()`, no ViewConfig. Native rendering itself is verified on-device (see the parent
225
287
  [README](../../README.md) for the project's testing model).
226
288
 
227
- Native autolinking wiring is expected to land in the four Expo canary apps
228
- (`examples/expo-react`, `examples/expo-vue-sfc`, `examples/expo-vue-tsx`, `examples/expo-angular`)
229
- following the same recipe already proven for `@symbiote-native/local-auth`/`@symbiote-native/sensors`
230
- — demo-screen wiring for this package is a follow-up, not part of this pass.
289
+ Native autolinking wiring is already done in all six Expo canary apps
290
+ (`examples/expo-react`, `examples/expo-vue-sfc`, `examples/expo-vue-tsx`, `examples/expo-svelte`,
291
+ `examples/expo-solid`, `examples/expo-angular`), each with its own `CryptoScreen` demo, following
292
+ 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.0",
3
+ "version": "2.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": "^2.0.0",
84
+ "@symbiote-native/engine": "^0.5.0",
85
+ "@symbiote-native/react": "^2.0.0",
86
+ "@symbiote-native/solid": "^2.0.0",
87
+ "@symbiote-native/svelte": "^2.0.0",
88
+ "@symbiote-native/vue": "^2.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.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"
136
+ "@symbiote-native/angular": "2.0.0",
137
+ "@symbiote-native/engine": "0.5.0",
138
+ "@symbiote-native/react": "2.0.0",
139
+ "@symbiote-native/solid": "2.0.0",
140
+ "@symbiote-native/svelte": "2.0.0",
141
+ "@symbiote-native/test-utils": "0.3.0",
142
+ "@symbiote-native/vue": "2.0.0"
131
143
  },
132
144
  "scripts": {
133
145
  "typecheck": "tsc --build",