@symbiote-native/standard-web-crypto 0.2.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 +21 -11
- package/build/core/index.d.ts +1 -1
- package/build/core/index.js +1 -1
- package/build/core/web-crypto.js +1 -1
- package/build-ngc/core/index.d.ts +1 -1
- package/build-ngc/core/index.js +1 -1
- package/build-ngc/core/index.js.map +1 -1
- package/build-ngc/core/web-crypto.js +1 -1
- package/build-ngc/core/web-crypto.js.map +1 -1
- package/package.json +28 -14
- package/src/core/index.ts +1 -1
- package/src/core/web-crypto.ts +6 -2
- package/build/react/index.d.ts +0 -2
- package/build/react/index.js +0 -7
- package/build/svelte/index.d.ts +0 -2
- package/build/svelte/index.js +0 -8
- package/build/vue/index.d.ts +0 -2
- package/build/vue/index.js +0 -6
- package/src/react/index.ts +0 -7
- package/src/svelte/index.ts +0 -8
- package/src/vue/index.ts +0 -6
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
|
|
32
|
-
polyfillWebCrypto(), delegating to
|
|
33
|
-
|
|
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
|
-
|
|
39
|
-
|
|
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, {
|
|
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, {
|
|
60
|
-
|
|
61
|
-
|
|
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`
|
|
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
|
package/build/core/index.d.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';
|
package/build/core/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default, polyfillWebCrypto } from './web-crypto.js';
|
|
1
|
+
export { default, default as webCrypto, polyfillWebCrypto } from './web-crypto.js';
|
package/build/core/web-crypto.js
CHANGED
|
@@ -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';
|
package/build-ngc/core/index.js
CHANGED
|
@@ -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;QAC3B,KAAK,YAAY,WAAW;QAC5B,KAAK,YAAY,UAAU;QAC3B,KAAK,YAAY,WAAW,CAC7B,CAAC;AACJ,CAAC;AAED,MAAM,MAAM;IACV,eAAe,CAAiC,MAAc;QAC5D,IAAI,CAAC,qBAAqB,CAAC,MAAM,CAAC,EAAE,CAAC;YACnC,MAAM,IAAI,SAAS,
|
|
1
|
+
{"version":3,"file":"web-crypto.js","sourceRoot":"","sources":["../../src/core/web-crypto.ts"],"names":[],"mappings":"AAAA,kGAAkG;A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,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.
|
|
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,16 +23,20 @@
|
|
|
23
23
|
"default": "./build/core/index.js"
|
|
24
24
|
},
|
|
25
25
|
"./vue": {
|
|
26
|
-
"types": "./build/
|
|
27
|
-
"default": "./build/
|
|
26
|
+
"types": "./build/core/index.d.ts",
|
|
27
|
+
"default": "./build/core/index.js"
|
|
28
28
|
},
|
|
29
29
|
"./react": {
|
|
30
|
-
"types": "./build/
|
|
31
|
-
"default": "./build/
|
|
30
|
+
"types": "./build/core/index.d.ts",
|
|
31
|
+
"default": "./build/core/index.js"
|
|
32
32
|
},
|
|
33
33
|
"./svelte": {
|
|
34
|
-
"types": "./build/
|
|
35
|
-
"default": "./build/
|
|
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"
|
|
36
40
|
},
|
|
37
41
|
"./angular": {
|
|
38
42
|
"types": "./build-ngc/angular/index.d.ts",
|
|
@@ -52,18 +56,20 @@
|
|
|
52
56
|
"access": "public"
|
|
53
57
|
},
|
|
54
58
|
"dependencies": {
|
|
55
|
-
"@symbiote-native/crypto": "0.
|
|
59
|
+
"@symbiote-native/crypto": "0.3.0"
|
|
56
60
|
},
|
|
57
61
|
"peerDependencies": {
|
|
58
62
|
"@symbiote-native/angular": ">=0.6.2",
|
|
59
63
|
"@symbiote-native/engine": ">=0.1.7",
|
|
60
64
|
"@symbiote-native/react": ">=0.2.8",
|
|
65
|
+
"@symbiote-native/solid": ">=0.0.1",
|
|
61
66
|
"@symbiote-native/svelte": ">=0.1.0",
|
|
62
67
|
"@symbiote-native/vue": ">=0.3.8",
|
|
63
68
|
"@angular/core": ">=20",
|
|
64
69
|
"@vue/runtime-core": "^3.5.13",
|
|
65
70
|
"react": ">=19.0.0",
|
|
66
71
|
"react-native": ">=0.86",
|
|
72
|
+
"solid-js": ">=1.9.0",
|
|
67
73
|
"svelte": ">=5.56.0",
|
|
68
74
|
"vue": ">=3.5.0"
|
|
69
75
|
},
|
|
@@ -74,6 +80,9 @@
|
|
|
74
80
|
"@symbiote-native/react": {
|
|
75
81
|
"optional": true
|
|
76
82
|
},
|
|
83
|
+
"@symbiote-native/solid": {
|
|
84
|
+
"optional": true
|
|
85
|
+
},
|
|
77
86
|
"@symbiote-native/svelte": {
|
|
78
87
|
"optional": true
|
|
79
88
|
},
|
|
@@ -89,6 +98,9 @@
|
|
|
89
98
|
"react": {
|
|
90
99
|
"optional": true
|
|
91
100
|
},
|
|
101
|
+
"solid-js": {
|
|
102
|
+
"optional": true
|
|
103
|
+
},
|
|
92
104
|
"svelte": {
|
|
93
105
|
"optional": true
|
|
94
106
|
},
|
|
@@ -104,14 +116,16 @@
|
|
|
104
116
|
"@types/react": "^19.2.0",
|
|
105
117
|
"@vue/runtime-core": "^3.5.13",
|
|
106
118
|
"react": "19.2.3",
|
|
119
|
+
"solid-js": "^1.9.14",
|
|
107
120
|
"svelte": "^5.56.0",
|
|
108
121
|
"typescript": "~6.0.0",
|
|
109
|
-
"@symbiote-native/angular": "0.
|
|
110
|
-
"@symbiote-native/engine": "0.
|
|
111
|
-
"@symbiote-native/react": "0.
|
|
112
|
-
"@symbiote-native/
|
|
113
|
-
"@symbiote-native/
|
|
114
|
-
"@symbiote-native/
|
|
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"
|
|
115
129
|
},
|
|
116
130
|
"scripts": {
|
|
117
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';
|
package/src/core/web-crypto.ts
CHANGED
|
@@ -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(
|
|
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
|
|
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
|
package/build/react/index.d.ts
DELETED
package/build/react/index.js
DELETED
|
@@ -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';
|
package/build/svelte/index.d.ts
DELETED
package/build/svelte/index.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
// @symbiote-native/standard-web-crypto/svelte: the Svelte entry over the framework-agnostic
|
|
2
|
-
// core. The polyfill has no per-instance state or event stream — nothing for a rune to wrap —
|
|
3
|
-
// so this is a plain re-export. Svelte's lifecycle bucket is `runes/` (adapters/svelte/src/runes
|
|
4
|
-
// — never React's `hooks` or Vue's `composables`), and this package has none to fill.
|
|
5
|
-
// `export *` never forwards a default export (ES module semantics), so `webCrypto` needs its own
|
|
6
|
-
// explicit named re-export alongside it.
|
|
7
|
-
export * from '../core/index.js';
|
|
8
|
-
export { default as webCrypto } from '../core/index.js';
|
package/build/vue/index.d.ts
DELETED
package/build/vue/index.js
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/index.js';
|
|
6
|
-
export { default as webCrypto } from '../core/index.js';
|
package/src/react/index.ts
DELETED
|
@@ -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/svelte/index.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
// @symbiote-native/standard-web-crypto/svelte: the Svelte entry over the framework-agnostic
|
|
2
|
-
// core. The polyfill has no per-instance state or event stream — nothing for a rune to wrap —
|
|
3
|
-
// so this is a plain re-export. Svelte's lifecycle bucket is `runes/` (adapters/svelte/src/runes
|
|
4
|
-
// — never React's `hooks` or Vue's `composables`), and this package has none to fill.
|
|
5
|
-
// `export *` never forwards a default export (ES module semantics), so `webCrypto` needs its own
|
|
6
|
-
// explicit named re-export alongside it.
|
|
7
|
-
export * from '../core';
|
|
8
|
-
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';
|