@symbiote-native/standard-web-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
@@ -28,20 +28,24 @@ No further native wiring is needed for this package itself — it has no native
28
28
  ## Shape
29
29
 
30
30
  ```
31
- src/core/ web-crypto.ts — the Crypto class + webCrypto singleton (default export) and
32
- polyfillWebCrypto(), delegating to @symbiote-native/crypto's getRandomValues.
33
- src/react/ @symbiote-native/standard-web-crypto/react — export * from '../core'
34
- src/vue/ @symbiote-native/standard-web-crypto/vue — export * from '../core'
31
+ src/core/ web-crypto.ts — the Crypto class + webCrypto singleton (default export, also
32
+ re-exported as the named `webCrypto`) and polyfillWebCrypto(), delegating to
33
+ @symbiote-native/crypto's getRandomValues.
35
34
  src/angular/ @symbiote-native/standard-web-crypto/angular — export * from '../core'
36
35
  ```
37
36
 
38
- No per-adapter lifecycle wrapper exists because there's nothing to subscribe to or clean up —
39
- each adapter entry is a single-file re-export.
37
+ `./react`, `./vue`, and `./svelte` are `exports`-map aliases straight onto `src/core/` — no
38
+ physical per-framework file, since there's nothing to subscribe to or clean up. (The `webCrypto`
39
+ named re-export used to live only in those three per-framework barrels; it now lives once in
40
+ `src/core/index.ts` instead.) `./angular` stays a physical file/subpath since Angular ships
41
+ through a separate `ngc`/AOT build (`build-ngc/`).
40
42
 
41
43
  ## Use it
42
44
 
43
45
  ```ts
44
- import webCrypto, { polyfillWebCrypto } from '@symbiote-native/standard-web-crypto';
46
+ import webCrypto, {
47
+ polyfillWebCrypto,
48
+ } from '@symbiote-native/standard-web-crypto';
45
49
 
46
50
  // Reach the polyfill (or a real globalThis.crypto, if one already exists) directly:
47
51
  const bytes = new Uint8Array(16);
@@ -56,9 +60,15 @@ crypto.getRandomValues(bytes);
56
60
  The React/Vue/Angular entry points re-export the identical surface:
57
61
 
58
62
  ```ts
59
- import webCrypto, { polyfillWebCrypto } from '@symbiote-native/standard-web-crypto/react';
60
- import webCrypto, { polyfillWebCrypto } from '@symbiote-native/standard-web-crypto/vue';
61
- import webCrypto, { polyfillWebCrypto } from '@symbiote-native/standard-web-crypto/angular';
63
+ import webCrypto, {
64
+ polyfillWebCrypto,
65
+ } from '@symbiote-native/standard-web-crypto/react';
66
+ import webCrypto, {
67
+ polyfillWebCrypto,
68
+ } from '@symbiote-native/standard-web-crypto/vue';
69
+ import webCrypto, {
70
+ polyfillWebCrypto,
71
+ } from '@symbiote-native/standard-web-crypto/angular';
62
72
  ```
63
73
 
64
74
  ## API
@@ -77,7 +87,7 @@ Plus the `IWebCrypto` type describing the shape above.
77
87
  ## Notes
78
88
 
79
89
  - **`webCrypto` is resolved once, at module-load time**: if `globalThis.crypto` already exists
80
- (a real Web Crypto implementation), `webCrypto` *is* that object; otherwise it's this package's
90
+ (a real Web Crypto implementation), `webCrypto` _is_ that object; otherwise it's this package's
81
91
  own `Crypto` class instance backed by `@symbiote-native/crypto`. React Native has no reliable
82
92
  `window` global, so this port checks/defines `globalThis.crypto` rather than upstream's `window`.
83
93
  - **`getRandomValues` only accepts the integer TypedArrays `@symbiote-native/crypto` can hand to
@@ -1,2 +1,2 @@
1
- export { default, polyfillWebCrypto } from './web-crypto';
1
+ export { default, default as webCrypto, polyfillWebCrypto } from './web-crypto';
2
2
  export type { IWebCrypto } from './web-crypto';
@@ -1 +1 @@
1
- export { default, polyfillWebCrypto } from './web-crypto.js';
1
+ export { default, default as webCrypto, polyfillWebCrypto } from './web-crypto.js';
@@ -30,7 +30,7 @@ function isWebCrypto(value) {
30
30
  if (typeof value !== 'object' || value === null) {
31
31
  return false;
32
32
  }
33
- return 'getRandomValues' in value && typeof value.getRandomValues === 'function';
33
+ return ('getRandomValues' in value && typeof value.getRandomValues === 'function');
34
34
  }
35
35
  // No ambient `declare global { var crypto }` here on purpose — it would collide with lib.dom.d.ts's
36
36
  // own `crypto` global the moment any consumer's tsconfig pulls in the DOM lib (as this package's
@@ -1,2 +1,2 @@
1
- export { default, polyfillWebCrypto } from './web-crypto';
1
+ export { default, default as webCrypto, polyfillWebCrypto } from './web-crypto';
2
2
  export type { IWebCrypto } from './web-crypto';
@@ -1,2 +1,2 @@
1
- export { default, polyfillWebCrypto } from './web-crypto';
1
+ export { default, default as webCrypto, polyfillWebCrypto } from './web-crypto';
2
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC"}
@@ -30,7 +30,7 @@ function isWebCrypto(value) {
30
30
  if (typeof value !== 'object' || value === null) {
31
31
  return false;
32
32
  }
33
- return 'getRandomValues' in value && typeof value.getRandomValues === 'function';
33
+ return ('getRandomValues' in value && typeof value.getRandomValues === 'function');
34
34
  }
35
35
  // No ambient `declare global { var crypto }` here on purpose — it would collide with lib.dom.d.ts's
36
36
  // own `crypto` global the moment any consumer's tsconfig pulls in the DOM lib (as this package's
@@ -1 +1 @@
1
- {"version":3,"file":"web-crypto.js","sourceRoot":"","sources":["../../src/core/web-crypto.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,+FAA+F;AAC/F,mGAAmG;AACnG,+FAA+F;AAC/F,kGAAkG;AAClG,4FAA4F;AAC5F,iBAAiB;AACjB,OAAO,EAAE,eAAe,IAAI,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAOnF,gGAAgG;AAChG,6FAA6F;AAC7F,6FAA6F;AAC7F,+EAA+E;AAC/E,SAAS,qBAAqB,CAAC,KAAsB;IACnD,OAAO,CACL,KAAK,YAAY,SAAS;QAC1B,KAAK,YAAY,UAAU;QAC3B,KAAK,YAAY,UAAU;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,IAAI,MAAM,EAAE,CAAC;AAEjE,eAAe,SAAS,CAAC;AAEzB,MAAM,UAAU,iBAAiB;IAC/B,IAAI,gBAAgB,EAAE,KAAK,SAAS,EAAE,CAAC;QACrC,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,QAAQ,EAAE;YAC1C,YAAY,EAAE,IAAI;YAClB,UAAU,EAAE,IAAI;YAChB,GAAG,EAAE,GAAG,EAAE,CAAC,SAAS;SACrB,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symbiote-native/standard-web-crypto",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "description": "expo-standard-web-crypto ported for SymbioteNative — a Web Crypto API getRandomValues polyfill built on @symbiote-native/crypto's native random source.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -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",
@@ -48,18 +56,22 @@
48
56
  "access": "public"
49
57
  },
50
58
  "dependencies": {
51
- "@symbiote-native/crypto": "0.1.0"
59
+ "@symbiote-native/crypto": "0.3.0"
52
60
  },
53
61
  "peerDependencies": {
62
+ "@symbiote-native/angular": ">=0.6.2",
54
63
  "@symbiote-native/engine": ">=0.1.7",
64
+ "@symbiote-native/react": ">=0.2.8",
65
+ "@symbiote-native/solid": ">=0.0.1",
66
+ "@symbiote-native/svelte": ">=0.1.0",
67
+ "@symbiote-native/vue": ">=0.3.8",
55
68
  "@angular/core": ">=20",
56
69
  "@vue/runtime-core": "^3.5.13",
57
70
  "react": ">=19.0.0",
58
71
  "react-native": ">=0.86",
59
- "vue": ">=3.5.0",
60
- "@symbiote-native/angular": "0.6.2",
61
- "@symbiote-native/react": "0.2.8",
62
- "@symbiote-native/vue": "0.3.8"
72
+ "solid-js": ">=1.9.0",
73
+ "svelte": ">=5.56.0",
74
+ "vue": ">=3.5.0"
63
75
  },
64
76
  "peerDependenciesMeta": {
65
77
  "@symbiote-native/angular": {
@@ -68,6 +80,12 @@
68
80
  "@symbiote-native/react": {
69
81
  "optional": true
70
82
  },
83
+ "@symbiote-native/solid": {
84
+ "optional": true
85
+ },
86
+ "@symbiote-native/svelte": {
87
+ "optional": true
88
+ },
71
89
  "@symbiote-native/vue": {
72
90
  "optional": true
73
91
  },
@@ -80,24 +98,34 @@
80
98
  "react": {
81
99
  "optional": true
82
100
  },
101
+ "solid-js": {
102
+ "optional": true
103
+ },
104
+ "svelte": {
105
+ "optional": true
106
+ },
83
107
  "vue": {
84
108
  "optional": true
85
109
  }
86
110
  },
87
111
  "devDependencies": {
88
- "@angular/compiler": "^22",
89
- "@angular/compiler-cli": "^22",
90
- "@angular/core": "^22",
112
+ "@angular/compiler": "~22.0.8",
113
+ "@angular/compiler-cli": "~22.0.8",
114
+ "@angular/core": "~22.0.8",
91
115
  "@types/node": "^26.0.0",
92
116
  "@types/react": "^19.2.0",
93
117
  "@vue/runtime-core": "^3.5.13",
94
118
  "react": "19.2.3",
119
+ "solid-js": "^1.9.14",
120
+ "svelte": "^5.56.0",
95
121
  "typescript": "~6.0.0",
96
- "@symbiote-native/angular": "0.6.2",
97
- "@symbiote-native/engine": "0.1.7",
98
- "@symbiote-native/react": "0.2.8",
99
- "@symbiote-native/test-utils": "0.1.6",
100
- "@symbiote-native/vue": "0.3.8"
122
+ "@symbiote-native/angular": "0.8.0",
123
+ "@symbiote-native/engine": "0.3.0",
124
+ "@symbiote-native/react": "0.4.0",
125
+ "@symbiote-native/solid": "0.1.0",
126
+ "@symbiote-native/svelte": "0.3.0",
127
+ "@symbiote-native/test-utils": "0.2.0",
128
+ "@symbiote-native/vue": "0.5.0"
101
129
  },
102
130
  "scripts": {
103
131
  "typecheck": "tsc --build",
package/src/core/index.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { default, polyfillWebCrypto } from './web-crypto';
1
+ export { default, default as webCrypto, polyfillWebCrypto } from './web-crypto';
2
2
  export type { IWebCrypto } from './web-crypto';
@@ -30,7 +30,9 @@ function isSupportedTypedArray(value: ArrayBufferView): value is ITypedArray {
30
30
  class Crypto implements IWebCrypto {
31
31
  getRandomValues<TArray extends ArrayBufferView>(values: TArray): TArray {
32
32
  if (!isSupportedTypedArray(values)) {
33
- throw new TypeError('The provided ArrayBuffer view is not a supported integer-typed array');
33
+ throw new TypeError(
34
+ 'The provided ArrayBuffer view is not a supported integer-typed array',
35
+ );
34
36
  }
35
37
  return getNativeRandomValues(values);
36
38
  }
@@ -40,7 +42,9 @@ function isWebCrypto(value: unknown): value is IWebCrypto {
40
42
  if (typeof value !== 'object' || value === null) {
41
43
  return false;
42
44
  }
43
- return 'getRandomValues' in value && typeof value.getRandomValues === 'function';
45
+ return (
46
+ 'getRandomValues' in value && typeof value.getRandomValues === 'function'
47
+ );
44
48
  }
45
49
 
46
50
  // No ambient `declare global { var crypto }` here on purpose — it would collide with lib.dom.d.ts's
@@ -1,2 +0,0 @@
1
- export * from '../core';
2
- export { default as webCrypto } from '../core';
@@ -1,7 +0,0 @@
1
- // @symbiote-native/standard-web-crypto/react: the React entry over the framework-agnostic core.
2
- // The polyfill has no per-instance state or event stream — nothing for a hook to wrap — so this
3
- // is a plain re-export, mirroring @symbiote-native/device's and @symbiote-native/crypto's React
4
- // entries. `export *` never forwards a default export (ES module semantics), so `webCrypto` needs
5
- // its own explicit named re-export alongside it.
6
- export * from '../core/index.js';
7
- export { default as webCrypto } from '../core/index.js';
@@ -1,2 +0,0 @@
1
- export * from '../core';
2
- export { default as webCrypto } from '../core';
@@ -1,6 +0,0 @@
1
- // @symbiote-native/standard-web-crypto/vue: the Vue entry over the framework-agnostic core. Same
2
- // reasoning as the React entry — no per-instance state or event stream to wire onto Vue's
3
- // reactivity, so this is a plain re-export. `export *` never forwards a default export (ES module
4
- // semantics), so `webCrypto` needs its own explicit named re-export alongside it.
5
- export * from '../core/index.js';
6
- export { default as webCrypto } from '../core/index.js';
@@ -1,7 +0,0 @@
1
- // @symbiote-native/standard-web-crypto/react: the React entry over the framework-agnostic core.
2
- // The polyfill has no per-instance state or event stream — nothing for a hook to wrap — so this
3
- // is a plain re-export, mirroring @symbiote-native/device's and @symbiote-native/crypto's React
4
- // entries. `export *` never forwards a default export (ES module semantics), so `webCrypto` needs
5
- // its own explicit named re-export alongside it.
6
- export * from '../core';
7
- export { default as webCrypto } from '../core';
package/src/vue/index.ts DELETED
@@ -1,6 +0,0 @@
1
- // @symbiote-native/standard-web-crypto/vue: the Vue entry over the framework-agnostic core. Same
2
- // reasoning as the React entry — no per-instance state or event stream to wire onto Vue's
3
- // reactivity, so this is a plain re-export. `export *` never forwards a default export (ES module
4
- // semantics), so `webCrypto` needs its own explicit named re-export alongside it.
5
- export * from '../core';
6
- export { default as webCrypto } from '../core';