@substrate-system/keys 0.2.1 → 0.2.4

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 (77) hide show
  1. package/README.md +279 -160
  2. package/dist/_base.d.ts +182 -0
  3. package/dist/_base.d.ts.map +1 -0
  4. package/dist/aes/index.cjs +119 -0
  5. package/dist/aes/index.cjs.map +7 -0
  6. package/dist/aes/index.d.ts +20 -0
  7. package/dist/aes/index.d.ts.map +1 -0
  8. package/dist/aes/index.js +115 -0
  9. package/dist/aes/index.js.map +7 -0
  10. package/dist/aes/index.min.cjs +2 -0
  11. package/dist/aes/index.min.cjs.map +7 -0
  12. package/dist/aes/index.min.js +4 -0
  13. package/dist/aes/index.min.js.map +7 -0
  14. package/dist/constants.d.ts +15 -4
  15. package/dist/constants.d.ts.map +1 -1
  16. package/dist/ecc/index.cjs +408 -0
  17. package/dist/ecc/index.cjs.map +7 -0
  18. package/dist/ecc/index.d.ts +111 -0
  19. package/dist/ecc/index.d.ts.map +1 -0
  20. package/dist/ecc/index.js +410 -0
  21. package/dist/ecc/index.js.map +7 -0
  22. package/dist/ecc/index.min.cjs +2 -0
  23. package/dist/ecc/index.min.cjs.map +7 -0
  24. package/dist/ecc/index.min.js +4 -0
  25. package/dist/ecc/index.min.js.map +7 -0
  26. package/dist/errors.d.ts +27 -0
  27. package/dist/errors.d.ts.map +1 -0
  28. package/dist/index.d.ts +3 -190
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/meta.json +93 -120
  31. package/dist/rsa/index.cjs +279 -0
  32. package/dist/rsa/index.cjs.map +7 -0
  33. package/dist/rsa/index.d.ts +118 -0
  34. package/dist/rsa/index.d.ts.map +1 -0
  35. package/dist/rsa/index.js +283 -0
  36. package/dist/rsa/index.js.map +7 -0
  37. package/dist/rsa/index.min.cjs +2 -0
  38. package/dist/rsa/index.min.cjs.map +7 -0
  39. package/dist/rsa/index.min.js +4 -0
  40. package/dist/rsa/index.min.js.map +7 -0
  41. package/dist/types.d.ts +20 -2
  42. package/dist/types.d.ts.map +1 -1
  43. package/dist/util.d.ts +13 -8
  44. package/dist/util.d.ts.map +1 -1
  45. package/package.json +41 -15
  46. package/dist/constants.cjs +0 -64
  47. package/dist/constants.cjs.map +0 -7
  48. package/dist/constants.js +0 -44
  49. package/dist/constants.js.map +0 -7
  50. package/dist/constants.min.cjs +0 -2
  51. package/dist/constants.min.cjs.map +0 -7
  52. package/dist/constants.min.js +0 -2
  53. package/dist/constants.min.js.map +0 -7
  54. package/dist/index.cjs +0 -480
  55. package/dist/index.cjs.map +0 -7
  56. package/dist/index.js +0 -493
  57. package/dist/index.js.map +0 -7
  58. package/dist/index.min.cjs +0 -2
  59. package/dist/index.min.cjs.map +0 -7
  60. package/dist/index.min.js +0 -4
  61. package/dist/index.min.js.map +0 -7
  62. package/dist/types.cjs +0 -57
  63. package/dist/types.cjs.map +0 -7
  64. package/dist/types.js +0 -37
  65. package/dist/types.js.map +0 -7
  66. package/dist/types.min.cjs +0 -2
  67. package/dist/types.min.cjs.map +0 -7
  68. package/dist/types.min.js +0 -2
  69. package/dist/types.min.js.map +0 -7
  70. package/dist/util.cjs +0 -375
  71. package/dist/util.cjs.map +0 -7
  72. package/dist/util.js +0 -373
  73. package/dist/util.js.map +0 -7
  74. package/dist/util.min.cjs +0 -4
  75. package/dist/util.min.cjs.map +0 -7
  76. package/dist/util.min.js +0 -4
  77. package/dist/util.min.js.map +0 -7
@@ -0,0 +1,27 @@
1
+ import { KeyUse, CryptoSystem } from './types.js';
2
+ export declare const KeyDoesNotExist: Error;
3
+ export declare const NotKeyPair: Error;
4
+ export declare const NotKey: Error;
5
+ export declare const ECCNotEnabled: Error;
6
+ export declare const UnsupportedCrypto: Error;
7
+ export declare const InvalidKeyUse: Error;
8
+ export declare const InvalidMaxValue: Error;
9
+ export declare function checkIsKeyPair(keypair: any): CryptoKeyPair;
10
+ export declare function checkIsKey(key: any): CryptoKey;
11
+ export declare function checkValidCryptoSystem(type: CryptoSystem): void;
12
+ export declare function checkValidKeyUse(use: KeyUse): void;
13
+ declare const _default: {
14
+ KeyDoesNotExist: Error;
15
+ NotKeyPair: Error;
16
+ NotKey: Error;
17
+ ECCNotEnabled: Error;
18
+ UnsupportedCrypto: Error;
19
+ InvalidKeyUse: Error;
20
+ checkIsKeyPair: typeof checkIsKeyPair;
21
+ checkIsKey: typeof checkIsKey;
22
+ checkValidCryptoSystem: typeof checkValidCryptoSystem;
23
+ checkValidKeyUse: typeof checkValidKeyUse;
24
+ InvalidMaxValue: Error;
25
+ };
26
+ export default _default;
27
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAEjD,eAAO,MAAM,eAAe,OACc,CAAA;AAC1C,eAAO,MAAM,UAAU,OACiD,CAAA;AACxE,eAAO,MAAM,MAAM,OACgD,CAAA;AACnE,eAAO,MAAM,aAAa,OACK,CAAA;AAC/B,eAAO,MAAM,iBAAiB,OACF,CAAA;AAC5B,eAAO,MAAM,aAAa,OACE,CAAA;AAC5B,eAAO,MAAM,eAAe,OACN,CAAA;AAEtB,wBAAgB,cAAc,CAAE,OAAO,EAAE,GAAG,GAAG,aAAa,CAO3D;AAED,wBAAgB,UAAU,CAAE,GAAG,EAAE,GAAG,GAAG,SAAS,CAO/C;AAED,wBAAgB,sBAAsB,CAAE,IAAI,EAAC,YAAY,GAAG,IAAI,CAE/D;AAED,wBAAgB,gBAAgB,CAAE,GAAG,EAAC,MAAM,GAAG,IAAI,CAElD;;;;;;;;;;;;;;AASD,wBAYC"}
package/dist/index.d.ts CHANGED
@@ -1,191 +1,4 @@
1
- import { type SupportedEncodings } from 'uint8arrays';
2
- import { SymmKeyLength, type DID, type Msg, type CharSize, type SymmKey } from './types.js';
3
- import { publicKeyToDid, getPublicKeyAsArrayBuffer } from './util.js';
4
- export { publicKeyToDid, getPublicKeyAsArrayBuffer };
5
- export * from './constants.js';
6
- export type { DID };
7
- export { getPublicKeyAsUint8Array } from './util.js';
8
- export type SerializedKeys = {
9
- DID: DID;
10
- publicEncryptKey: string;
11
- };
12
- /**
13
- * Expose RSA keys only for now, because we are
14
- * waiting for more browsers to support ECC.
15
- *
16
- * Create an instance with `Keys.create` b/c async.
17
- */
18
- export declare class Keys {
19
- private _encryptKey;
20
- private _signKey;
21
- static _instance: any;
22
- persisted: boolean;
23
- ENCRYPTION_KEY_NAME: string;
24
- SIGNING_KEY_NAME: string;
25
- DID: DID;
26
- session: boolean;
27
- constructor(opts: {
28
- keys: {
29
- encrypt: CryptoKeyPair;
30
- sign: CryptoKeyPair;
31
- };
32
- did: DID;
33
- persisted: boolean;
34
- session: boolean;
35
- });
36
- get signKeypair(): CryptoKeyPair;
37
- get encryptKeypair(): CryptoKeyPair;
38
- get publicSignKey(): CryptoKey;
39
- get privateSignKey(): CryptoKey;
40
- get privateEncryptKey(): CryptoKey;
41
- get publicEncryptKey(): CryptoKey;
42
- get deviceName(): Promise<string>;
43
- /**
44
- * Delete the keys stored in indexedDB.
45
- */
46
- delete(): Promise<void>;
47
- /**
48
- * Get the public encryption key as a string.
49
- *
50
- * @param {SupportedEncodings} [format] Optional string format for
51
- * `uint8arrays`. Defaults to base64.
52
- * @returns {string} Return a string b/c mostly would use this for
53
- * serializing the public encryption key.
54
- */
55
- getPublicEncryptKey: ((format?: SupportedEncodings) => Promise<string>) & {
56
- uint8Array: () => Promise<Uint8Array>;
57
- };
58
- /**
59
- * Return a 32-character, DNS-friendly hash of the given DID.
60
- *
61
- * @param {DID} did a DID format string
62
- * @returns {string} 32 character, base32 hash of the DID
63
- */
64
- static deviceName(did: DID): Promise<string>;
65
- /**
66
- * Create a new `Keys` instance.
67
- *
68
- * @returns {Promise<Keys>}
69
- */
70
- static create(opts?: {
71
- session: boolean;
72
- }): Promise<Keys>;
73
- /**
74
- * Save this keys instance to `indexedDB`.
75
- */
76
- persist(): Promise<void>;
77
- /**
78
- * Return a 32-character, DNS friendly hash of the public signing key.
79
- *
80
- * @returns {Promise<string>}
81
- */
82
- getDeviceName(): Promise<string>;
83
- /**
84
- * Restore some keys from indexedDB, or create a new keypair if it doesn't
85
- * exist yet.
86
- *
87
- * @param {{ encryptionKeyName, signingKeyName }} opts Strings to use as
88
- * keys in indexedDB.
89
- * @returns {Promise<Keys>}
90
- */
91
- static load(opts?: Partial<{
92
- encryptionKeyName: string;
93
- signingKeyName: string;
94
- session: boolean;
95
- }>): Promise<InstanceType<typeof Keys>>;
96
- decrypt: ((msg: string | Uint8Array | ArrayBuffer, keysize?: SymmKeyLength) => Promise<Uint8Array>) & {
97
- asString: (msg: string, keysize?: SymmKeyLength) => Promise<string>;
98
- };
99
- sign: ((msg: Msg, charsize?: CharSize) => Promise<Uint8Array>) & {
100
- /**
101
- * Sign a message, return the signature as a base64 encoded string.
102
- *
103
- * @param {Msg} msg The message to sign
104
- * @param {CharSize} [charsize] Character size
105
- * @returns {Promise<string>}
106
- */
107
- asString: (msg: Msg, charsize?: CharSize) => Promise<string>;
108
- };
109
- /**
110
- * Decrypt the given encrypted AES key.
111
- * Return the key as `Uint8Array`.
112
- */
113
- decryptKey: ((key: string | Uint8Array | ArrayBuffer) => Promise<Uint8Array>) & {
114
- /**
115
- * Decrypt the given AES key, return the result as a string.
116
- */
117
- asString: (msg: string | Uint8Array, format?: SupportedEncodings) => Promise<string>;
118
- };
119
- /**
120
- * Serialize this keys instance. Will return an object of
121
- * { DID, publicEncryptionKey }, where DID is the public signature key,
122
- * and `publicEncryptKey` is the encryption key, `base64` encoded.
123
- * @returns {Promise<{ DID:DID, publicEncryptKey:string }>}
124
- */
125
- toJson(): Promise<{
126
- DID: DID;
127
- publicEncryptKey: string;
128
- }>;
129
- }
130
- /**
131
- * Check that the given signature is valid with the given message.
132
- */
133
- export declare function verify(msg: string | Uint8Array, sig: string | Uint8Array, signingDid: DID): Promise<boolean>;
134
- /**
135
- * Encrypt the given message to the given public key. If an AES key is not
136
- * provided, one will be created. Use an AES key to encrypt the given
137
- * content, then we encrypt the AES key to the given public key.
138
- *
139
- * @param {{ content, publicKey }} opts The content to encrypt and
140
- * public key to encrypt to
141
- * @param {SymmKey|Uint8Array|string} [aesKey] An optional AES key to encrypt
142
- * to the given public key
143
- * @returns {Promise<ArrayBuffer>} The encrypted AES key, concattenated with
144
- * the encrypted content.
145
- */
146
- export declare function encryptTo(opts: {
147
- content: string | Uint8Array;
148
- publicKey: CryptoKey | string;
149
- }, aesKey?: SymmKey | Uint8Array | string): Promise<ArrayBuffer>;
150
- export declare namespace encryptTo {
151
- var asString: (opts: {
152
- content: string | Uint8Array;
153
- publicKey: CryptoKey | string;
154
- }, aesKey?: SymmKey | Uint8Array | string) => Promise<string>;
155
- }
156
- export declare const AES: {
157
- create(opts?: {
158
- alg: string;
159
- length: number;
160
- }): Promise<CryptoKey>;
161
- export: ((key: CryptoKey) => Promise<Uint8Array>) & {
162
- asString: (key: CryptoKey, format?: SupportedEncodings) => Promise<string>;
163
- };
164
- import(key: Uint8Array | string): Promise<CryptoKey>;
165
- exportAsString(key: CryptoKey): Promise<string>;
166
- encrypt: typeof encrypt;
167
- decrypt(encryptedData: Uint8Array | string | ArrayBuffer, cryptoKey: CryptoKey | Uint8Array | ArrayBuffer, iv?: Uint8Array): Promise<Uint8Array>;
168
- };
169
- export declare function encryptKeyTo({ key, publicKey }: {
170
- key: string | Uint8Array | CryptoKey;
171
- publicKey: CryptoKey | Uint8Array | string;
172
- }, format: 'arraybuffer'): Promise<ArrayBuffer>;
173
- export declare function encryptKeyTo({ key, publicKey }: {
174
- key: string | Uint8Array | CryptoKey;
175
- publicKey: CryptoKey | Uint8Array | string;
176
- }, format: 'uint8array'): Promise<Uint8Array>;
177
- export declare function encryptKeyTo({ key, publicKey }: {
178
- key: string | Uint8Array | CryptoKey;
179
- publicKey: CryptoKey | Uint8Array | string;
180
- }, format?: undefined): Promise<Uint8Array>;
181
- export declare namespace encryptKeyTo {
182
- var asString: ({ key, publicKey }: {
183
- key: string | Uint8Array | CryptoKey;
184
- publicKey: CryptoKey | string | Uint8Array;
185
- }, format?: SupportedEncodings) => Promise<string>;
186
- }
187
- declare function encrypt(data: Uint8Array, cryptoKey: CryptoKey | Uint8Array, format?: undefined, iv?: Uint8Array): Promise<Uint8Array>;
188
- declare function encrypt(data: Uint8Array, cryptoKey: CryptoKey | Uint8Array, format: 'uint8array', iv?: Uint8Array): Promise<Uint8Array>;
189
- declare function encrypt(data: Uint8Array, cryptoKey: CryptoKey | Uint8Array, format: 'arraybuffer', iv?: Uint8Array): Promise<ArrayBuffer>;
190
- export declare function getDeviceName(did: DID | string): Promise<string>;
1
+ export * as rsa from './rsa/index.js';
2
+ export * as ecc from './ecc/index.js';
3
+ export * as aes from './aes/index.js';
191
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,KAAK,kBAAkB,EAAY,MAAM,aAAa,CAAA;AAe3E,OAAO,EACH,aAAa,EAKb,KAAK,GAAG,EACR,KAAK,GAAG,EACR,KAAK,QAAQ,EACb,KAAK,OAAO,EACf,MAAM,YAAY,CAAA;AACnB,OAAO,EACH,cAAc,EACd,yBAAyB,EAe5B,MAAM,WAAW,CAAA;AAElB,OAAO,EAAE,cAAc,EAAE,yBAAyB,EAAE,CAAA;AACpD,cAAc,gBAAgB,CAAA;AAE9B,YAAY,EAAE,GAAG,EAAE,CAAA;AAEnB,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAA;AAEpD,MAAM,MAAM,cAAc,GAAG;IACzB,GAAG,EAAC,GAAG,CAAC;IACR,gBAAgB,EAAC,MAAM,CAAC;CAC3B,CAAA;AAED;;;;;GAKG;AACH,qBAAa,IAAI;IACb,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,QAAQ,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SAAS,GAAE,OAAO,CAAC,UAAU,CAAC,CAAA;yBAHnB,YAAY;uCA6ByB;QACvD,GAAG,EAAC,MAAM,GAAC,UAAU,GAAC,SAAS,CAAC;QAChC,SAAS,EAAC,SAAS,GAAC,MAAM,GAAC,UAAU,CAAC;KACzC,WAAU,kBAAkB,KAAE,OAAO,CAAC,MAAM,CAAC;;AAuE9C,iBAAe,OAAO,CAClB,IAAI,EAAC,UAAU,EACf,SAAS,EAAC,SAAS,GAAC,UAAU,EAC9B,MAAM,CAAC,EAAC,SAAS,EACjB,EAAE,CAAC,EAAC,UAAU,GAChB,OAAO,CAAC,UAAU,CAAC,CAAA;AAErB,iBAAe,OAAO,CAClB,IAAI,EAAC,UAAU,EACf,SAAS,EAAC,SAAS,GAAC,UAAU,EAC9B,MAAM,EAAC,YAAY,EACnB,EAAE,CAAC,EAAC,UAAU,GAChB,OAAO,CAAC,UAAU,CAAC,CAAA;AAErB,iBAAe,OAAO,CAClB,IAAI,EAAC,UAAU,EACf,SAAS,EAAC,SAAS,GAAC,UAAU,EAC9B,MAAM,EAAC,aAAa,EACpB,EAAE,CAAC,EAAC,UAAU,GAChB,OAAO,CAAC,WAAW,CAAC,CAAA;AAwBtB,wBAAsB,aAAa,CAAE,GAAG,EAAC,GAAG,GAAC,MAAM,mBAMlD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,gBAAgB,CAAA;AACrC,OAAO,KAAK,GAAG,MAAM,gBAAgB,CAAA;AACrC,OAAO,KAAK,GAAG,MAAM,gBAAgB,CAAA"}
package/dist/meta.json CHANGED
@@ -1,79 +1,78 @@
1
1
  {
2
2
  "inputs": {
3
- "src/constants.ts": {
4
- "bytes": 996,
3
+ "src/aes/index.ts": {
4
+ "bytes": 5305,
5
5
  "imports": [],
6
6
  "format": "esm"
7
7
  },
8
- "src/index.ts": {
9
- "bytes": 20745,
8
+ "src/ecc/index.ts": {
9
+ "bytes": 17035,
10
10
  "imports": [],
11
11
  "format": "esm"
12
12
  },
13
- "src/types.ts": {
14
- "bytes": 803,
15
- "imports": [],
16
- "format": "esm"
17
- },
18
- "src/util.ts": {
19
- "bytes": 13695,
13
+ "src/rsa/index.ts": {
14
+ "bytes": 14811,
20
15
  "imports": [],
21
16
  "format": "esm"
22
17
  }
23
18
  },
24
19
  "outputs": {
25
- "dist/constants.js.map": {
20
+ "dist/aes/index.js.map": {
26
21
  "imports": [],
27
22
  "exports": [],
28
23
  "inputs": {},
29
- "bytes": 1647
24
+ "bytes": 7890
30
25
  },
31
- "dist/constants.js": {
26
+ "dist/aes/index.js": {
32
27
  "imports": [
33
28
  {
34
- "path": "./types.js",
29
+ "path": "@substrate-system/one-webcrypto",
30
+ "kind": "import-statement",
31
+ "external": true
32
+ },
33
+ {
34
+ "path": "uint8arrays",
35
+ "kind": "import-statement",
36
+ "external": true
37
+ },
38
+ {
39
+ "path": "../util.js",
40
+ "kind": "import-statement",
41
+ "external": true
42
+ },
43
+ {
44
+ "path": "../types.js",
45
+ "kind": "import-statement",
46
+ "external": true
47
+ },
48
+ {
49
+ "path": "../constants.js",
35
50
  "kind": "import-statement",
36
51
  "external": true
37
52
  }
38
53
  ],
39
54
  "exports": [
40
- "AES_GCM",
41
- "BASE58_DID_PREFIX",
42
- "BLS_DID_PREFIX",
43
- "DEFAULT_CHAR_SIZE",
44
- "DEFAULT_ENC_NAME",
45
- "DEFAULT_HASH_ALGORITHM",
46
- "DEFAULT_RSA_SIZE",
47
- "DEFAULT_SIG_NAME",
48
- "DEFAULT_SYMM_ALGORITHM",
49
- "DEFAULT_SYMM_LENGTH",
50
- "EDWARDS_DID_PREFIX",
51
- "IV_LENGTH",
52
- "KEY_TYPE",
53
- "RSA_ALGORITHM",
54
- "RSA_DID_PREFIX",
55
- "RSA_HASHING_ALGORITHM",
56
- "RSA_SIGN_ALGORITHM",
57
- "SALT_LENGTH"
55
+ "AES",
56
+ "importAesKey"
58
57
  ],
59
- "entryPoint": "src/constants.ts",
58
+ "entryPoint": "src/aes/index.ts",
60
59
  "inputs": {
61
- "src/constants.ts": {
62
- "bytesInOutput": 807
60
+ "src/aes/index.ts": {
61
+ "bytesInOutput": 3297
63
62
  }
64
63
  },
65
- "bytes": 1206
64
+ "bytes": 3494
66
65
  },
67
- "dist/index.js.map": {
66
+ "dist/ecc/index.js.map": {
68
67
  "imports": [],
69
68
  "exports": [],
70
69
  "inputs": {},
71
- "bytes": 30156
70
+ "bytes": 24772
72
71
  },
73
- "dist/index.js": {
72
+ "dist/ecc/index.js": {
74
73
  "imports": [
75
74
  {
76
- "path": "@bicycle-codes/one-webcrypto",
75
+ "path": "@substrate-system/one-webcrypto",
77
76
  "kind": "import-statement",
78
77
  "external": true
79
78
  },
@@ -83,88 +82,56 @@
83
82
  "external": true
84
83
  },
85
84
  {
86
- "path": "idb-keyval",
85
+ "path": "../constants.js",
87
86
  "kind": "import-statement",
88
87
  "external": true
89
88
  },
90
89
  {
91
- "path": "./constants.js",
90
+ "path": "../types.js",
92
91
  "kind": "import-statement",
93
92
  "external": true
94
93
  },
95
94
  {
96
- "path": "./types.js",
95
+ "path": "../util.js",
97
96
  "kind": "import-statement",
98
97
  "external": true
99
98
  },
100
99
  {
101
- "path": "./util.js",
100
+ "path": "../errors.js",
102
101
  "kind": "import-statement",
103
102
  "external": true
104
103
  },
105
104
  {
106
- "path": "./constants.js",
107
- "kind": "import-statement",
108
- "external": true
109
- },
110
- {
111
- "path": "./util.js",
105
+ "path": "../_base.js",
112
106
  "kind": "import-statement",
113
107
  "external": true
114
108
  }
115
109
  ],
116
110
  "exports": [
117
- "AES",
118
- "Keys",
119
- "encryptKeyTo",
120
- "encryptTo",
121
- "getDeviceName",
122
- "getPublicKeyAsArrayBuffer",
123
- "getPublicKeyAsUint8Array",
124
- "publicKeyToDid",
111
+ "EccKeys",
112
+ "default",
113
+ "exportPublicKey",
114
+ "importPublicKey",
125
115
  "verify"
126
116
  ],
127
- "entryPoint": "src/index.ts",
117
+ "entryPoint": "src/ecc/index.ts",
128
118
  "inputs": {
129
- "src/index.ts": {
130
- "bytesInOutput": 14288
119
+ "src/ecc/index.ts": {
120
+ "bytesInOutput": 12188
131
121
  }
132
122
  },
133
- "bytes": 14910
123
+ "bytes": 12720
134
124
  },
135
- "dist/types.js.map": {
125
+ "dist/rsa/index.js.map": {
136
126
  "imports": [],
137
127
  "exports": [],
138
128
  "inputs": {},
139
- "bytes": 1604
129
+ "bytes": 20772
140
130
  },
141
- "dist/types.js": {
142
- "imports": [],
143
- "exports": [
144
- "CharSize",
145
- "HashAlg",
146
- "KeyUse",
147
- "RsaSize",
148
- "SymmKeyLength"
149
- ],
150
- "entryPoint": "src/types.ts",
151
- "inputs": {
152
- "src/types.ts": {
153
- "bytesInOutput": 1053
154
- }
155
- },
156
- "bytes": 1159
157
- },
158
- "dist/util.js.map": {
159
- "imports": [],
160
- "exports": [],
161
- "inputs": {},
162
- "bytes": 21319
163
- },
164
- "dist/util.js": {
131
+ "dist/rsa/index.js": {
165
132
  "imports": [
166
133
  {
167
- "path": "@bicycle-codes/one-webcrypto",
134
+ "path": "@substrate-system/one-webcrypto",
168
135
  "kind": "import-statement",
169
136
  "external": true
170
137
  },
@@ -174,52 +141,58 @@
174
141
  "external": true
175
142
  },
176
143
  {
177
- "path": "./types.js",
144
+ "path": "../aes/index.js",
145
+ "kind": "import-statement",
146
+ "external": true
147
+ },
148
+ {
149
+ "path": "../constants.js",
150
+ "kind": "import-statement",
151
+ "external": true
152
+ },
153
+ {
154
+ "path": "../_base.js",
178
155
  "kind": "import-statement",
179
156
  "external": true
180
157
  },
181
158
  {
182
- "path": "./constants.js",
159
+ "path": "../types.js",
160
+ "kind": "import-statement",
161
+ "external": true
162
+ },
163
+ {
164
+ "path": "../util.js",
165
+ "kind": "import-statement",
166
+ "external": true
167
+ },
168
+ {
169
+ "path": "../constants.js",
170
+ "kind": "import-statement",
171
+ "external": true
172
+ },
173
+ {
174
+ "path": "../util.js",
183
175
  "kind": "import-statement",
184
176
  "external": true
185
177
  }
186
178
  ],
187
179
  "exports": [
188
- "InvalidKeyUse",
189
- "InvalidMaxValue",
190
- "base64ToArrBuf",
191
- "checkValidKeyUse",
192
- "createDeviceName",
193
- "did",
194
- "didToPublicKey",
195
- "fromBase64",
180
+ "RsaKeys",
181
+ "encrypt",
182
+ "encryptKeyTo",
183
+ "encryptTo",
196
184
  "getPublicKeyAsArrayBuffer",
197
185
  "getPublicKeyAsUint8Array",
198
- "importKey",
199
- "importPublicKey",
200
- "importRsaKey",
201
- "isCryptoKey",
202
- "joinBufs",
203
- "normalizeBase64ToBuf",
204
- "normalizeToBuf",
205
- "normalizeUnicodeToBuf",
206
- "normalizeUtf16ToBuf",
207
- "normalizeUtf8ToBuf",
208
186
  "publicKeyToDid",
209
- "randomBuf",
210
- "rsaOperations",
211
- "rsaVerify",
212
- "sha256",
213
- "strToArrBuf",
214
- "toBase64"
187
+ "verify"
215
188
  ],
216
- "entryPoint": "src/util.ts",
189
+ "entryPoint": "src/rsa/index.ts",
217
190
  "inputs": {
218
- "src/util.ts": {
219
- "bytesInOutput": 10782
191
+ "src/rsa/index.ts": {
192
+ "bytesInOutput": 8892
220
193
  }
221
194
  },
222
- "bytes": 11444
195
+ "bytes": 9475
223
196
  }
224
197
  }
225
198
  }