@xylabs/crypto 2.12.24 β 2.12.26
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 +25 -31
- package/dist/browser/cryptoPolyfill.d.cts.map +1 -1
- package/dist/browser/cryptoPolyfill.d.mts.map +1 -1
- package/dist/browser/cryptoPolyfill.d.ts.map +1 -1
- package/dist/browser/index.cjs +2 -7
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.js +2 -7
- package/dist/browser/index.js.map +1 -1
- package/package.json +6 -8
- package/src/browser/cryptoPolyfill.ts +3 -9
package/README.md
CHANGED
|
@@ -1,50 +1,49 @@
|
|
|
1
1
|
[![logo][]](https://xylabs.com)
|
|
2
2
|
|
|
3
|
-
# @xylabs/
|
|
3
|
+
# @xylabs/crypto
|
|
4
4
|
|
|
5
|
-
[![main-build][]][main-build-link]
|
|
6
|
-
[![beta-build][]][beta-build-link]
|
|
7
5
|
[![npm-badge][]][npm-link]
|
|
8
|
-
[![
|
|
9
|
-
[![
|
|
10
|
-
[![
|
|
11
|
-
|
|
6
|
+
[![npm-downloads-badge][]][npm-link]
|
|
7
|
+
[![jsdelivr-badge][]][jsdelivr-link]
|
|
8
|
+
[![npm-license-badge][]](LICENSE)
|
|
9
|
+
|
|
10
|
+
> XY Labs generalized Javascript library
|
|
12
11
|
|
|
13
12
|
## Table of Contents
|
|
14
13
|
|
|
15
14
|
- [Description](#description)
|
|
16
15
|
- [Install](#install)
|
|
17
|
-
- [Scripts](#scripts)
|
|
18
16
|
- [Maintainers](#maintainers)
|
|
19
17
|
- [License](#license)
|
|
20
18
|
- [Credits](#credits)
|
|
21
19
|
|
|
22
20
|
## Description
|
|
23
21
|
|
|
24
|
-
|
|
22
|
+
Common Javascript code that is used throughout XYO projects that use React.
|
|
25
23
|
|
|
26
24
|
## Install
|
|
27
25
|
|
|
28
26
|
Using npm:
|
|
29
27
|
|
|
30
28
|
```sh
|
|
31
|
-
npm i --save @xylabs/
|
|
29
|
+
npm i --save @xylabs/crypto
|
|
32
30
|
```
|
|
33
31
|
|
|
34
32
|
Using yarn:
|
|
35
33
|
|
|
36
34
|
```sh
|
|
37
|
-
yarn add @xylabs/
|
|
35
|
+
yarn add @xylabs/crypto
|
|
38
36
|
```
|
|
39
37
|
|
|
40
|
-
##
|
|
41
|
-
|
|
42
|
-
See [ts-scripts](https://github.com/xylabs/ts-scripts/blob/main/README.md)
|
|
43
|
-
for list of shared scripts.
|
|
38
|
+
## Documentation
|
|
39
|
+
[Developer Reference](https://xylabs.github.io/sdk-js)
|
|
44
40
|
|
|
45
41
|
## Maintainers
|
|
46
42
|
|
|
47
|
-
- [Arie Trouw](https://github.com/arietrouw) (
|
|
43
|
+
- [Arie Trouw](https://github.com/arietrouw) ([arietrouw.com](https://arietrouw.com))
|
|
44
|
+
- [Joel Carter](https://github.com/JoelBCarter)
|
|
45
|
+
- [Matt Jones](https://github.com/jonesmac)
|
|
46
|
+
- [Jordan Trouw](https://github.com/jordantrouw)
|
|
48
47
|
|
|
49
48
|
## License
|
|
50
49
|
|
|
@@ -52,20 +51,15 @@ See the [LICENSE](LICENSE) file for license details
|
|
|
52
51
|
|
|
53
52
|
## Credits
|
|
54
53
|
|
|
55
|
-
[Made with π₯
|
|
54
|
+
[Made with π₯and βοΈ by XY Labs](https://xylabs.com)
|
|
56
55
|
|
|
57
56
|
[logo]: https://cdn.xy.company/img/brand/XYPersistentCompany_Logo_Icon_Colored.svg
|
|
58
|
-
|
|
59
|
-
[
|
|
60
|
-
[
|
|
61
|
-
|
|
62
|
-
[npm-badge]: https://img.shields.io/npm/
|
|
63
|
-
[npm-
|
|
64
|
-
|
|
65
|
-
[
|
|
66
|
-
[
|
|
67
|
-
[codacy-link]: https://www.codacy.com/gh/xylabs/sdk-js/dashboard?utm_source=github.com&utm_medium=referral&utm_content=xylabs/sdk-js&utm_campaign=Badge_Grade
|
|
68
|
-
[codeclimate-badge]: https://api.codeclimate.com/v1/badges/c5eb068f806f0b047ea7/maintainability
|
|
69
|
-
[codeclimate-link]: https://codeclimate.com/github/xylabs/sdk-js/maintainability
|
|
70
|
-
[snyk-badge]: https://snyk.io/test/github/xylabs/sdk-js/badge.svg?targetFile=package.json
|
|
71
|
-
[snyk-link]: https://snyk.io/test/github/xylabs/sdk-js?targetFile=package.json
|
|
57
|
+
|
|
58
|
+
[npm-badge]: https://img.shields.io/npm/v/@xylabs/crypto.svg
|
|
59
|
+
[npm-link]: https://www.npmjs.com/package/@xylabs/crypto
|
|
60
|
+
|
|
61
|
+
[npm-downloads-badge]: https://img.shields.io/npm/dw/@xylabs/crypto
|
|
62
|
+
[npm-license-badge]: https://img.shields.io/npm/l/@xylabs/crypto
|
|
63
|
+
|
|
64
|
+
[jsdelivr-badge]: https://data.jsdelivr.com/v1/package/npm/@xylabs/crypto/badge
|
|
65
|
+
[jsdelivr-link]: https://www.jsdelivr.com/package/npm/@xylabs/crypto
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cryptoPolyfill.d.ts","sourceRoot":"","sources":["../../src/browser/cryptoPolyfill.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cryptoPolyfill.d.ts","sourceRoot":"","sources":["../../src/browser/cryptoPolyfill.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,cAAc,YAS1B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cryptoPolyfill.d.ts","sourceRoot":"","sources":["../../src/browser/cryptoPolyfill.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cryptoPolyfill.d.ts","sourceRoot":"","sources":["../../src/browser/cryptoPolyfill.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,cAAc,YAS1B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cryptoPolyfill.d.ts","sourceRoot":"","sources":["../../src/browser/cryptoPolyfill.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cryptoPolyfill.d.ts","sourceRoot":"","sources":["../../src/browser/cryptoPolyfill.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,cAAc,YAS1B,CAAA"}
|
package/dist/browser/index.cjs
CHANGED
|
@@ -39,14 +39,9 @@ module.exports = __toCommonJS(browser_exports);
|
|
|
39
39
|
var import_crypto_js = __toESM(require("crypto-js"), 1);
|
|
40
40
|
|
|
41
41
|
// src/browser/cryptoPolyfill.ts
|
|
42
|
-
var
|
|
43
|
-
return typeof window !== "undefined" && typeof window?.document !== "undefined";
|
|
44
|
-
};
|
|
45
|
-
var isWebworker = () => {
|
|
46
|
-
return typeof self === "object" && self.constructor?.name === "DedicatedWorkerGlobalScope";
|
|
47
|
-
};
|
|
42
|
+
var import_platform = require("@xylabs/platform");
|
|
48
43
|
var cryptoPolyfill = () => {
|
|
49
|
-
const global =
|
|
44
|
+
const global = (0, import_platform.getGlobal)();
|
|
50
45
|
if (global) {
|
|
51
46
|
if (global.Crypto === void 0) {
|
|
52
47
|
global.Crypto = import_crypto_js.default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/browser/index.ts","../../src/browser/Crypto.ts","../../src/browser/cryptoPolyfill.ts"],"sourcesContent":["export * from './Crypto'\nexport * from './cryptoPolyfill'\n","import Crypto from 'crypto-js'\n\nexport { Crypto }\n","import {
|
|
1
|
+
{"version":3,"sources":["../../src/browser/index.ts","../../src/browser/Crypto.ts","../../src/browser/cryptoPolyfill.ts"],"sourcesContent":["export * from './Crypto'\nexport * from './cryptoPolyfill'\n","import Crypto from 'crypto-js'\n\nexport { Crypto }\n","import { getGlobal } from '@xylabs/platform'\n\nimport { Crypto } from './Crypto'\n\ntype WithOptionalCrypto = { Crypto?: typeof Crypto }\n\nexport const cryptoPolyfill = () => {\n const global = getGlobal<WithOptionalCrypto>()\n if (global) {\n if (global.Crypto === undefined) {\n global.Crypto = Crypto\n } else {\n global.Crypto = { ...Crypto, ...global.Crypto }\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,iCAAAA;AAAA,EAAA;AAAA;AAAA;;;ACAA,uBAAmB;;;ACAnB,sBAA0B;AAMnB,IAAM,iBAAiB,MAAM;AAClC,QAAM,aAAS,2BAA8B;AAC7C,MAAI,QAAQ;AACV,QAAI,OAAO,WAAW,QAAW;AAC/B,aAAO,SAAS,iBAAAC;AAAA,IAClB,OAAO;AACL,aAAO,SAAS,EAAE,GAAG,iBAAAA,SAAQ,GAAG,OAAO,OAAO;AAAA,IAChD;AAAA,EACF;AACF;","names":["Crypto","Crypto"]}
|
package/dist/browser/index.js
CHANGED
|
@@ -2,14 +2,9 @@
|
|
|
2
2
|
import Crypto from "crypto-js";
|
|
3
3
|
|
|
4
4
|
// src/browser/cryptoPolyfill.ts
|
|
5
|
-
|
|
6
|
-
return typeof window !== "undefined" && typeof window?.document !== "undefined";
|
|
7
|
-
};
|
|
8
|
-
var isWebworker = () => {
|
|
9
|
-
return typeof self === "object" && self.constructor?.name === "DedicatedWorkerGlobalScope";
|
|
10
|
-
};
|
|
5
|
+
import { getGlobal } from "@xylabs/platform";
|
|
11
6
|
var cryptoPolyfill = () => {
|
|
12
|
-
const global =
|
|
7
|
+
const global = getGlobal();
|
|
13
8
|
if (global) {
|
|
14
9
|
if (global.Crypto === void 0) {
|
|
15
10
|
global.Crypto = Crypto;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/browser/Crypto.ts","../../src/browser/cryptoPolyfill.ts"],"sourcesContent":["import Crypto from 'crypto-js'\n\nexport { Crypto }\n","import {
|
|
1
|
+
{"version":3,"sources":["../../src/browser/Crypto.ts","../../src/browser/cryptoPolyfill.ts"],"sourcesContent":["import Crypto from 'crypto-js'\n\nexport { Crypto }\n","import { getGlobal } from '@xylabs/platform'\n\nimport { Crypto } from './Crypto'\n\ntype WithOptionalCrypto = { Crypto?: typeof Crypto }\n\nexport const cryptoPolyfill = () => {\n const global = getGlobal<WithOptionalCrypto>()\n if (global) {\n if (global.Crypto === undefined) {\n global.Crypto = Crypto\n } else {\n global.Crypto = { ...Crypto, ...global.Crypto }\n }\n }\n}\n"],"mappings":";AAAA,OAAO,YAAY;;;ACAnB,SAAS,iBAAiB;AAMnB,IAAM,iBAAiB,MAAM;AAClC,QAAM,SAAS,UAA8B;AAC7C,MAAI,QAAQ;AACV,QAAI,OAAO,WAAW,QAAW;AAC/B,aAAO,SAAS;AAAA,IAClB,OAAO;AACL,aAAO,SAAS,EAAE,GAAG,QAAQ,GAAG,OAAO,OAAO;AAAA,IAChD;AAAA,EACF;AACF;","names":[]}
|
package/package.json
CHANGED
|
@@ -33,9 +33,6 @@
|
|
|
33
33
|
"default": "./dist/node/index.js"
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
|
-
"./docs": {
|
|
37
|
-
"default": "./dist/docs.json"
|
|
38
|
-
},
|
|
39
36
|
"./package.json": "./package.json"
|
|
40
37
|
},
|
|
41
38
|
"main": "./dist/node/index.cjs",
|
|
@@ -50,14 +47,15 @@
|
|
|
50
47
|
"crypto"
|
|
51
48
|
],
|
|
52
49
|
"dependencies": {
|
|
50
|
+
"@xylabs/platform": "~2.12.26",
|
|
53
51
|
"crypto-js": "^4.1.1"
|
|
54
52
|
},
|
|
55
53
|
"devDependencies": {
|
|
56
54
|
"@types/crypto-js": "^4.1.2",
|
|
57
|
-
"@types/node": "^20.8.
|
|
58
|
-
"@xylabs/ts-scripts-yarn3": "^3.1.
|
|
59
|
-
"@xylabs/tsconfig": "^3.1.
|
|
60
|
-
"@xylabs/tsconfig-dom": "^3.1.
|
|
55
|
+
"@types/node": "^20.8.6",
|
|
56
|
+
"@xylabs/ts-scripts-yarn3": "^3.1.11",
|
|
57
|
+
"@xylabs/tsconfig": "^3.1.11",
|
|
58
|
+
"@xylabs/tsconfig-dom": "^3.1.11",
|
|
61
59
|
"typescript": "^5.2.2"
|
|
62
60
|
},
|
|
63
61
|
"publishConfig": {
|
|
@@ -68,6 +66,6 @@
|
|
|
68
66
|
"url": "https://github.com/xylabs/sdk-js.git"
|
|
69
67
|
},
|
|
70
68
|
"sideEffects": false,
|
|
71
|
-
"version": "2.12.
|
|
69
|
+
"version": "2.12.26",
|
|
72
70
|
"type": "module"
|
|
73
71
|
}
|
|
@@ -1,17 +1,11 @@
|
|
|
1
|
+
import { getGlobal } from '@xylabs/platform'
|
|
2
|
+
|
|
1
3
|
import { Crypto } from './Crypto'
|
|
2
4
|
|
|
3
5
|
type WithOptionalCrypto = { Crypto?: typeof Crypto }
|
|
4
6
|
|
|
5
|
-
const isBrowser = () => {
|
|
6
|
-
return typeof window !== 'undefined' && typeof window?.document !== 'undefined'
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
const isWebworker = () => {
|
|
10
|
-
return typeof self === 'object' && self.constructor?.name === 'DedicatedWorkerGlobalScope'
|
|
11
|
-
}
|
|
12
|
-
|
|
13
7
|
export const cryptoPolyfill = () => {
|
|
14
|
-
const global =
|
|
8
|
+
const global = getGlobal<WithOptionalCrypto>()
|
|
15
9
|
if (global) {
|
|
16
10
|
if (global.Crypto === undefined) {
|
|
17
11
|
global.Crypto = Crypto
|