@dxos/crypto 0.0.1 → 0.1.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 (73) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +9 -0
  3. package/dist/src/browser/subtle.d.ts +2 -0
  4. package/dist/src/browser/subtle.d.ts.map +1 -0
  5. package/dist/src/browser/subtle.js +9 -0
  6. package/dist/src/browser/subtle.js.map +1 -0
  7. package/dist/src/encrypt.d.ts +17 -0
  8. package/dist/src/encrypt.d.ts.map +1 -0
  9. package/dist/src/encrypt.js +40 -0
  10. package/dist/src/encrypt.js.map +1 -0
  11. package/dist/src/encrypt.test.d.ts +2 -0
  12. package/dist/src/encrypt.test.d.ts.map +1 -0
  13. package/dist/src/encrypt.test.js +45 -0
  14. package/dist/src/encrypt.test.js.map +1 -0
  15. package/dist/src/hash.d.ts +21 -0
  16. package/dist/src/hash.d.ts.map +1 -0
  17. package/dist/src/hash.js +46 -0
  18. package/dist/src/hash.js.map +1 -0
  19. package/dist/src/hash.test.d.ts +2 -0
  20. package/dist/src/hash.test.d.ts.map +1 -0
  21. package/dist/src/hash.test.js +26 -0
  22. package/dist/src/hash.test.js.map +1 -0
  23. package/dist/src/index.d.ts +8 -0
  24. package/dist/src/index.d.ts.map +1 -0
  25. package/dist/src/index.js +27 -0
  26. package/dist/src/index.js.map +1 -0
  27. package/dist/src/keys.d.ts +32 -0
  28. package/dist/src/keys.d.ts.map +1 -0
  29. package/dist/src/keys.js +70 -0
  30. package/dist/src/keys.js.map +1 -0
  31. package/dist/src/keys.test.d.ts +2 -0
  32. package/dist/src/keys.test.d.ts.map +1 -0
  33. package/dist/src/keys.test.js +11 -0
  34. package/dist/src/keys.test.js.map +1 -0
  35. package/dist/src/signer.d.ts +12 -0
  36. package/dist/src/signer.d.ts.map +1 -0
  37. package/dist/src/signer.js +6 -0
  38. package/dist/src/signer.js.map +1 -0
  39. package/dist/src/subtle.d.ts +4 -0
  40. package/dist/src/subtle.d.ts.map +1 -0
  41. package/dist/src/subtle.js +32 -0
  42. package/dist/src/subtle.js.map +1 -0
  43. package/dist/src/validator.d.ts +6 -0
  44. package/dist/src/validator.d.ts.map +1 -0
  45. package/dist/src/validator.js +15 -0
  46. package/dist/src/validator.js.map +1 -0
  47. package/dist/src/verify.d.ts +6 -0
  48. package/dist/src/verify.d.ts.map +1 -0
  49. package/dist/src/verify.js +28 -0
  50. package/dist/src/verify.js.map +1 -0
  51. package/package.json +30 -27
  52. package/src/browser/subtle.ts +7 -0
  53. package/src/{encrypt.test.js → encrypt.test.ts} +4 -6
  54. package/src/encrypt.ts +36 -0
  55. package/src/hash.test.ts +32 -0
  56. package/src/hash.ts +42 -0
  57. package/src/index.ts +11 -0
  58. package/src/keys.test.ts +11 -0
  59. package/src/keys.ts +71 -0
  60. package/src/signer.ts +16 -0
  61. package/src/subtle.ts +7 -0
  62. package/src/validator.ts +14 -0
  63. package/src/verify.ts +39 -0
  64. package/babel.config.js +0 -14
  65. package/dist/es/encrypt.js +0 -51
  66. package/dist/es/index.js +0 -42
  67. package/dist/es/keys.js +0 -125
  68. package/dist/es/validator.js +0 -27
  69. package/src/encrypt.js +0 -36
  70. package/src/index.js +0 -7
  71. package/src/keys.js +0 -98
  72. package/src/keys.test.js +0 -23
  73. package/src/validator.js +0 -14
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ //
3
+ // Copyright 2022 DXOS.org
4
+ //
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.verifySignature = void 0;
7
+ const subtle_1 = require("./subtle");
8
+ /**
9
+ * Verify a signature with the given key.
10
+ */
11
+ const verifySignature = async (key, message, signature) => {
12
+ let publicKey;
13
+ try {
14
+ publicKey = await subtle_1.subtleCrypto.importKey('raw', key.asUint8Array(), {
15
+ name: 'ECDSA',
16
+ namedCurve: 'P-256'
17
+ }, true, ['verify']);
18
+ }
19
+ catch (_a) {
20
+ return false;
21
+ }
22
+ return subtle_1.subtleCrypto.verify({
23
+ name: 'ECDSA',
24
+ hash: 'SHA-256'
25
+ }, publicKey, signature, message);
26
+ };
27
+ exports.verifySignature = verifySignature;
28
+ //# sourceMappingURL=verify.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verify.js","sourceRoot":"","sources":["../../src/verify.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;AAIF,qCAAwC;AAExC;;GAEG;AACI,MAAM,eAAe,GAAG,KAAK,EAAE,GAAc,EAAE,OAAmB,EAAE,SAAqB,EAAoB,EAAE;IACpH,IAAI,SAAqB,CAAC;IAE1B,IAAI;QACF,SAAS,GAAG,MAAM,qBAAY,CAAC,SAAS,CACtC,KAAK,EACL,GAAG,CAAC,YAAY,EAAE,EAClB;YACE,IAAI,EAAE,OAAO;YACb,UAAU,EAAE,OAAO;SACpB,EACD,IAAI,EACJ,CAAC,QAAQ,CAAC,CACX,CAAC;KACH;IAAC,WAAM;QACN,OAAO,KAAK,CAAC;KACd;IAED,OAAO,qBAAY,CAAC,MAAM,CACxB;QACE,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,SAAS;KAChB,EACD,SAAS,EACT,SAAS,EACT,OAAO,CACR,CAAC;AACJ,CAAC,CAAC;AA3BW,QAAA,eAAe,mBA2B1B"}
package/package.json CHANGED
@@ -1,35 +1,38 @@
1
1
  {
2
2
  "name": "@dxos/crypto",
3
- "version": "0.0.1",
4
- "description": "Basic crypto key utils",
5
- "main": "dist/es/index.js",
6
- "scripts": {
7
- "build": "babel ./src --out-dir ./dist/es --ignore \"**/*.test.js\" --source-maps inline",
8
- "build:watch": "yarn run build --watch",
9
- "clean": "rm -rf dist",
10
- "lint": "eslint ./src --ignore-path ../../.eslintignore",
11
- "test": "jest --rootDir ./src --verbose --passWithNoTests"
12
- },
13
- "keywords": [],
14
- "author": "",
15
- "license": "ISC",
16
- "jest": {
17
- "testEnvironment": "node"
3
+ "version": "0.1.0",
4
+ "description": "Basic cross-platform crypto utils.",
5
+ "homepage": "https://dxos.org",
6
+ "bugs": "https://github.com/dxos/dxos/issues",
7
+ "license": "MIT",
8
+ "author": "DXOS.org",
9
+ "main": "dist/src/index.js",
10
+ "browser": {
11
+ "node:assert": "assert",
12
+ "./dist/src/subtle.js": "./dist/src/browser/subtle.js"
18
13
  },
14
+ "types": "dist/src/index.d.ts",
15
+ "files": [
16
+ "dist",
17
+ "src"
18
+ ],
19
+ "browserslist": [
20
+ "> 5%"
21
+ ],
19
22
  "dependencies": {
23
+ "@dxos/keys": "0.1.0",
24
+ "assert": "^2.0.0",
20
25
  "crypto-js": "^3.1.9-1",
21
- "humanhash": "^1.0.4",
22
- "hypercore-crypto": "^1.0.0"
26
+ "hypercore-crypto": "^2.3.0"
23
27
  },
24
28
  "devDependencies": {
25
- "@babel/cli": "^7.0.0",
26
- "@babel/core": "^7.0.0",
27
- "@babel/plugin-proposal-class-properties": "^7.3.0",
28
- "@babel/plugin-proposal-export-default-from": "^7.2.0",
29
- "@babel/plugin-transform-runtime": "^7.0.0",
30
- "@babel/preset-env": "^7.0.0",
31
- "babel-jest": "^24.8.0",
32
- "babel-loader": "^8.0.0",
33
- "babel-plugin-add-module-exports": "^1.0.0"
29
+ "@types/crypto-js": "~4.0.2",
30
+ "@types/node": "^16.11.58"
31
+ },
32
+ "publishConfig": {
33
+ "access": "public"
34
+ },
35
+ "scripts": {
36
+ "check": "true"
34
37
  }
35
- }
38
+ }
@@ -0,0 +1,7 @@
1
+ //
2
+ // Copyright 2022 DXOS.org
3
+ //
4
+
5
+ // Replacement implementation for the browser (see package.json).
6
+
7
+ export const subtleCrypto = crypto.subtle;
@@ -1,8 +1,8 @@
1
1
  //
2
- // Copyright 2019 Wireline, Inc.
2
+ // Copyright 2020 DXOS.org
3
3
  //
4
4
 
5
- // dxos-testing-browser
5
+ import { expect } from 'chai';
6
6
 
7
7
  import { decrypt, encrypt } from './encrypt';
8
8
 
@@ -38,13 +38,11 @@ Key":"4f5e87626c62c5f61873d1e7c995c1b7e7e66e7600b454fa370a93d18f4a9a6f","secretK
38
38
  8c13d81376b61fb252db32d1002bba4f5e87626c62c5f61873d1e7c995c1b7e7e66e7600b454fa370a93d18f4a9a6f","trusted":true,"type":"
39
39
  UNKNOWN"}]}';`;
40
40
 
41
- test('Bulk encryption/decryption', () => {
42
-
41
+ it('Bulk encryption/decryption', function () {
43
42
  const original = testJsonData;
44
43
 
45
44
  const origCrypt = encrypt(original, 'secret12');
46
45
  const copy = decrypt(origCrypt, 'secret12');
47
46
 
48
- expect(original).toEqual(copy);
49
-
47
+ expect(original).to.equal(copy);
50
48
  });
package/src/encrypt.ts ADDED
@@ -0,0 +1,36 @@
1
+ //
2
+ // Copyright 2020 DXOS.org
3
+ //
4
+
5
+ import CryptoJS from 'crypto-js';
6
+ import assert from 'node:assert';
7
+
8
+ /**
9
+ * Encrypt string plaintext to a base64-encoded string ciphertext.
10
+ * @param plaintext
11
+ * @param passphrase
12
+ * @param cipher see https://cryptojs.gitbook.io/docs/#ciphers
13
+ * @returns ciphertext
14
+ */
15
+ export const encrypt = (plaintext: string, passphrase: string, cipher = 'AES') => {
16
+ assert(typeof passphrase === 'string');
17
+ assert(typeof cipher === 'string');
18
+
19
+ return (CryptoJS as any)[cipher].encrypt(plaintext, passphrase).toString();
20
+ };
21
+
22
+ /**
23
+ * Decrypt from a base64-encoded string ciphertext to string plaintext.
24
+ * @param ciphertext
25
+ * @param passphrase
26
+ * @param cipher see https://cryptojs.gitbook.io/docs/#ciphers
27
+ * @returns plaintext
28
+ */
29
+ export const decrypt = (ciphertext: string, passphrase: string, cipher = 'AES') => {
30
+ assert(typeof ciphertext === 'string');
31
+ assert(typeof passphrase === 'string');
32
+ assert(typeof cipher === 'string');
33
+
34
+ const bytes = (CryptoJS as any)[cipher].decrypt(ciphertext, passphrase);
35
+ return bytes.toString(CryptoJS.enc.Utf8);
36
+ };
@@ -0,0 +1,32 @@
1
+ // DXOS testing browser.
2
+
3
+ //
4
+ // Copyright 2020 DXOS.org
5
+ //
6
+
7
+ import { expect } from 'chai';
8
+
9
+ import { ripemd160, sha1, sha256, sha512 } from './hash';
10
+
11
+ it('SHA1', function () {
12
+ const hashed = sha1('Test message');
13
+ expect(hashed).to.equal('8de39b4722207f2da2a831e8734f02e740c15738');
14
+ });
15
+
16
+ it('SHA256', function () {
17
+ const hashed = sha256('Test message');
18
+ expect(hashed).to.equal('c0719e9a8d5d838d861dc6f675c899d2b309a3a65bb9fe6b11e5afcbf9a2c0b1');
19
+ });
20
+
21
+ it('SHA512', function () {
22
+ const hashed = sha512('Test message');
23
+ expect(hashed).to.equal(
24
+ '48418241a4d779508a6b98e623328a68f7f0bf27fd101bb2c89384827bfc0740' +
25
+ '3fefd5855576f1824fcd7acd233541514240c2bcf0fa9732ebb8f166a7c38bdf'
26
+ );
27
+ });
28
+
29
+ it('RIPEMD160', function () {
30
+ const hashed = ripemd160('Test message');
31
+ expect(hashed).to.equal('24b83e2457880c95d2e3c3c6b98e24ab170b1e11');
32
+ });
package/src/hash.ts ADDED
@@ -0,0 +1,42 @@
1
+ //
2
+ // Copyright 2020 DXOS.org
3
+ //
4
+
5
+ import CryptoJS from 'crypto-js';
6
+ import assert from 'node:assert';
7
+
8
+ /**
9
+ *
10
+ * @param algorithm
11
+ * @param plaintext
12
+ */
13
+ const _hash = (algorithm: string, plaintext: string): string => {
14
+ assert(typeof algorithm === 'string');
15
+ assert(typeof plaintext === 'string');
16
+
17
+ return (CryptoJS as any)[algorithm](plaintext).toString();
18
+ };
19
+
20
+ /**
21
+ * Creates a SHA-1 hash of the supplied string, returned as a hexadecimal string.
22
+ * @param text
23
+ */
24
+ export const sha1 = (text: string) => _hash('SHA1', text);
25
+
26
+ /**
27
+ * Creates a SHA-256 hash of the supplied string, returned as a hexadecimal string.
28
+ * @param text
29
+ */
30
+ export const sha256 = (text: string) => _hash('SHA256', text);
31
+
32
+ /**
33
+ * Creates a SHA-512 hash of the supplied string, returned as a hexadecimal string.
34
+ * @param text
35
+ */
36
+ export const sha512 = (text: string) => _hash('SHA512', text);
37
+
38
+ /**
39
+ * Creates a SHA-512 hash of the supplied string, returned as a hexadecimal string.
40
+ * @param text
41
+ */
42
+ export const ripemd160 = (text: string) => _hash('RIPEMD160', text);
package/src/index.ts ADDED
@@ -0,0 +1,11 @@
1
+ //
2
+ // Copyright 2020 DXOS.org
3
+ //
4
+
5
+ export * from './encrypt';
6
+ export * from './hash';
7
+ export * from './keys';
8
+ export * from './signer';
9
+ export * from './subtle';
10
+ export * from './validator';
11
+ export * from './verify';
@@ -0,0 +1,11 @@
1
+ //
2
+ // Copyright 2020 DXOS.org
3
+ //
4
+
5
+ import { expect } from 'chai';
6
+
7
+ import { createId } from './keys';
8
+
9
+ it('Create id is unique', function () {
10
+ expect(createId()).not.to.equal(createId());
11
+ });
package/src/keys.ts ADDED
@@ -0,0 +1,71 @@
1
+ //
2
+ // Copyright 2020 DXOS.org
3
+ //
4
+
5
+ import crypto from 'hypercore-crypto';
6
+ import assert from 'node:assert';
7
+
8
+ import { KeyPair, PublicKey, PublicKeyLike, PUBLIC_KEY_LENGTH, SECRET_KEY_LENGTH } from '@dxos/keys';
9
+
10
+ /**
11
+ * @deprecated
12
+ */
13
+ // TODO(burdon): Remove.
14
+ export const createId = (): string => PublicKey.stringify(randomBytes(32));
15
+
16
+ export const SIGNATURE_LENGTH = 64;
17
+
18
+ export const zeroKey = () => new Uint8Array(32); // TODO(burdon): Remove?
19
+
20
+ export const createKeyPair = (seed?: Buffer): KeyPair => {
21
+ if (seed) {
22
+ assert(seed.length >= 32, 'Seedphrase too sort. Expecting length of 32.');
23
+ return crypto.keyPair(seed.slice(0, 32));
24
+ }
25
+
26
+ // TODO(burdon): Enable seed for debugging.
27
+ return crypto.keyPair();
28
+ };
29
+
30
+ // TODO(burdon): Buffer.
31
+ export const validateKeyPair = (publicKey: PublicKey, secretKey: Buffer) =>
32
+ crypto.validateKeyPair({ publicKey: publicKey.asBuffer(), secretKey });
33
+
34
+ // TODO(dmaretskyi): Slicing because webcrypto keys are too long.
35
+ export const discoveryKey = (key: PublicKeyLike): Buffer =>
36
+ crypto.discoveryKey(PublicKey.from(key).asBuffer().slice(1));
37
+
38
+ /**
39
+ * Return random bytes of length.
40
+ * @param [length=32]
41
+ * @return {Buffer}
42
+ */
43
+ export const randomBytes = (length = 32): Buffer => crypto.randomBytes(length);
44
+
45
+ /**
46
+ * Sign the contents of message with secret_key
47
+ * @param {Buffer} message
48
+ * @param {Buffer} secretKey
49
+ * @returns {Buffer} signature
50
+ */
51
+ export const sign = (message: Buffer, secretKey: Buffer): Buffer => {
52
+ assert(Buffer.isBuffer(message));
53
+ assert(Buffer.isBuffer(secretKey) && secretKey.length === SECRET_KEY_LENGTH);
54
+
55
+ return crypto.sign(message, secretKey);
56
+ };
57
+
58
+ /**
59
+ * Verifies the signature against the message and public_key.
60
+ * @param {Buffer} message
61
+ * @param {Buffer} publicKey
62
+ * @param {Buffer} signature
63
+ * @return {boolean}
64
+ */
65
+ export const verify = (message: Buffer, signature: Buffer, publicKey: Buffer): boolean => {
66
+ assert(Buffer.isBuffer(message));
67
+ assert(Buffer.isBuffer(signature) && signature.length === SIGNATURE_LENGTH);
68
+ assert(Buffer.isBuffer(publicKey) && publicKey.length === PUBLIC_KEY_LENGTH);
69
+
70
+ return crypto.verify(message, signature, publicKey);
71
+ };
package/src/signer.ts ADDED
@@ -0,0 +1,16 @@
1
+ //
2
+ // Copyright 2022 DXOS.org
3
+ //
4
+
5
+ import { PublicKey } from '@dxos/keys';
6
+
7
+ /**
8
+ *
9
+ */
10
+ export interface Signer {
11
+ /**
12
+ * Sign a message with the given key.
13
+ * Key must be present in the keyring.
14
+ */
15
+ sign: (key: PublicKey, message: Uint8Array) => Promise<Uint8Array>;
16
+ }
package/src/subtle.ts ADDED
@@ -0,0 +1,7 @@
1
+ //
2
+ // Copyright 2022 DXOS.org
3
+ //
4
+
5
+ import * as nodeCrypto from 'node:crypto';
6
+
7
+ export const subtleCrypto = nodeCrypto.webcrypto.subtle;
@@ -0,0 +1,14 @@
1
+ //
2
+ // Copyright 2020 DXOS.org
3
+ //
4
+
5
+ import { verify } from 'hypercore-crypto';
6
+
7
+ import { PublicKey } from '@dxos/keys';
8
+
9
+ /**
10
+ * Generator for signature validation function.
11
+ * @param {String} publicKey
12
+ */
13
+ export const getSignatureValidator = (publicKey: string) => (message: Buffer, signature: Buffer) =>
14
+ verify(message, signature, PublicKey.bufferize(publicKey));
package/src/verify.ts ADDED
@@ -0,0 +1,39 @@
1
+ //
2
+ // Copyright 2022 DXOS.org
3
+ //
4
+
5
+ import { PublicKey } from '@dxos/keys';
6
+
7
+ import { subtleCrypto } from './subtle';
8
+
9
+ /**
10
+ * Verify a signature with the given key.
11
+ */
12
+ export const verifySignature = async (key: PublicKey, message: Uint8Array, signature: Uint8Array): Promise<boolean> => {
13
+ let publicKey!: CryptoKey;
14
+
15
+ try {
16
+ publicKey = await subtleCrypto.importKey(
17
+ 'raw',
18
+ key.asUint8Array(),
19
+ {
20
+ name: 'ECDSA',
21
+ namedCurve: 'P-256'
22
+ },
23
+ true,
24
+ ['verify']
25
+ );
26
+ } catch {
27
+ return false;
28
+ }
29
+
30
+ return subtleCrypto.verify(
31
+ {
32
+ name: 'ECDSA',
33
+ hash: 'SHA-256'
34
+ },
35
+ publicKey,
36
+ signature,
37
+ message
38
+ );
39
+ };
package/babel.config.js DELETED
@@ -1,14 +0,0 @@
1
- //
2
- // Copyright 2019 Wireline, Inc.
3
- //
4
-
5
- module.exports = {
6
- presets: [
7
- '@babel/preset-env'
8
- ],
9
- plugins: [
10
- 'add-module-exports',
11
- '@babel/plugin-proposal-class-properties',
12
- '@babel/plugin-proposal-export-default-from'
13
- ]
14
- };
@@ -1,51 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.encrypt = encrypt;
7
- exports.decrypt = decrypt;
8
-
9
- var _assert = _interopRequireDefault(require("assert"));
10
-
11
- var _cryptoJs = _interopRequireDefault(require("crypto-js"));
12
-
13
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
14
-
15
- //
16
- // Copyright 2020 Wireline, Inc.
17
- //
18
-
19
- /**
20
- * Encrypt string plaintext to a base64-encoded string ciphertext.
21
- * @param {string} plaintext
22
- * @param {string} passphrase
23
- * @param {string} cipher see https://cryptojs.gitbook.io/docs/#ciphers
24
- * @returns {string} ciphertext
25
- */
26
- function encrypt(plaintext, passphrase) {
27
- var cipher = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'AES';
28
- (0, _assert["default"])(typeof passphrase === 'string');
29
- (0, _assert["default"])(typeof cipher === 'string');
30
- return _cryptoJs["default"][cipher].encrypt(plaintext, passphrase).toString();
31
- }
32
- /**
33
- * Decrypt from a base64-encoded string ciphertext to string plaintext.
34
- * @param {string} ciphertext
35
- * @param {string} passphrase
36
- * @param {string} cipher see https://cryptojs.gitbook.io/docs/#ciphers
37
- * @returns {string} plaintext
38
- */
39
-
40
-
41
- function decrypt(ciphertext, passphrase) {
42
- var cipher = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'AES';
43
- (0, _assert["default"])(typeof ciphertext === 'string');
44
- (0, _assert["default"])(typeof passphrase === 'string');
45
- (0, _assert["default"])(typeof cipher === 'string');
46
-
47
- var bytes = _cryptoJs["default"][cipher].decrypt(ciphertext, passphrase);
48
-
49
- return bytes.toString(_cryptoJs["default"].enc.Utf8);
50
- }
51
- //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9lbmNyeXB0LmpzIl0sIm5hbWVzIjpbImVuY3J5cHQiLCJwbGFpbnRleHQiLCJwYXNzcGhyYXNlIiwiY2lwaGVyIiwiQ3J5cHRvSlMiLCJ0b1N0cmluZyIsImRlY3J5cHQiLCJjaXBoZXJ0ZXh0IiwiYnl0ZXMiLCJlbmMiLCJVdGY4Il0sIm1hcHBpbmdzIjoiOzs7Ozs7Ozt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3NwaHJhc2UgPT09ICdzdHJpbmcnKTtcbiAgYXNzZXJ0KHR5cGVvZiBjaXBoZXIgPT09ICdzdHJpbmcnKTtcblxuICBjb25zdCBieXRlcyA9IENyeXB0b0pTW2NpcGhlcl0uZGVjcnlwdChjaXBoZXJ0ZXh0LCBwYXNzcGhyYXNlKTtcbiAgcmV0dXJuIGJ5dGVzLnRvU3RyaW5nKENyeXB0b0pTLmVuYy5VdGY4KTtcbn1cbiJdfQ==
package/dist/es/index.js DELETED
@@ -1,42 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
-
7
- var _encrypt = require("./encrypt");
8
-
9
- Object.keys(_encrypt).forEach(function (key) {
10
- if (key === "default" || key === "__esModule") return;
11
- Object.defineProperty(exports, key, {
12
- enumerable: true,
13
- get: function get() {
14
- return _encrypt[key];
15
- }
16
- });
17
- });
18
-
19
- var _keys = require("./keys");
20
-
21
- Object.keys(_keys).forEach(function (key) {
22
- if (key === "default" || key === "__esModule") return;
23
- Object.defineProperty(exports, key, {
24
- enumerable: true,
25
- get: function get() {
26
- return _keys[key];
27
- }
28
- });
29
- });
30
-
31
- var _validator = require("./validator");
32
-
33
- Object.keys(_validator).forEach(function (key) {
34
- if (key === "default" || key === "__esModule") return;
35
- Object.defineProperty(exports, key, {
36
- enumerable: true,
37
- get: function get() {
38
- return _validator[key];
39
- }
40
- });
41
- });
42
- //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9pbmRleC5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7QUFJQTs7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7O0FBQ0E7O0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBOztBQUNBOztBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQSIsInNvdXJjZXNDb250ZW50IjpbIi8vXG4vLyBDb3B5cmlnaHQgMjAxOSBXaXJlbGluZSwgSW5jLlxuLy9cblxuZXhwb3J0ICogZnJvbSAnLi9lbmNyeXB0JztcbmV4cG9ydCAqIGZyb20gJy4va2V5cyc7XG5leHBvcnQgKiBmcm9tICcuL3ZhbGlkYXRvcic7XG4iXX0=