@substrate-system/keys 0.2.13 → 0.2.14
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/dist/_base.min.js.map +2 -2
- package/dist/aes/index.cjs +8 -1
- package/dist/aes/index.cjs.map +2 -2
- package/dist/aes/index.d.ts.map +1 -1
- package/dist/aes/index.js +8 -1
- package/dist/aes/index.js.map +2 -2
- package/dist/aes/index.min.cjs.map +2 -2
- package/dist/aes/index.min.js.map +2 -2
- package/dist/browser/index.js +19 -1
- package/dist/crypto.min.js.map +1 -1
- package/dist/ecc/index.cjs +11 -0
- package/dist/ecc/index.cjs.map +2 -2
- package/dist/ecc/index.d.ts +11 -0
- package/dist/ecc/index.d.ts.map +1 -1
- package/dist/ecc/index.js +11 -0
- package/dist/ecc/index.js.map +2 -2
- package/dist/ecc/index.min.cjs.map +2 -2
- package/dist/ecc/index.min.js.map +2 -2
- package/dist/index.min.js.map +2 -2
- package/dist/meta.json +12 -12
- package/dist/rsa/index.cjs.map +1 -1
- package/dist/rsa/index.d.ts +1 -1
- package/dist/rsa/index.js.map +1 -1
- package/dist/rsa/index.min.cjs.map +1 -1
- package/dist/rsa/index.min.js.map +2 -2
- package/dist/util.cjs.map +2 -2
- package/dist/util.d.ts.map +1 -1
- package/dist/util.js.map +2 -2
- package/dist/util.min.cjs.map +2 -2
- package/dist/util.min.js.map +2 -2
- package/package.json +1 -1
package/dist/browser/index.js
CHANGED
|
@@ -4202,7 +4202,14 @@
|
|
|
4202
4202
|
__name(importAesKey, "importAesKey");
|
|
4203
4203
|
async function encrypt(data, cryptoKey, format2, iv) {
|
|
4204
4204
|
const key = isCryptoKey(cryptoKey) ? cryptoKey : await importAesKey(cryptoKey);
|
|
4205
|
-
const encrypted = iv ? await webcrypto.subtle.encrypt(
|
|
4205
|
+
const encrypted = iv ? await webcrypto.subtle.encrypt(
|
|
4206
|
+
{
|
|
4207
|
+
name: AES_GCM,
|
|
4208
|
+
iv: toArrayBuffer2(iv)
|
|
4209
|
+
},
|
|
4210
|
+
key,
|
|
4211
|
+
toArrayBuffer2(data)
|
|
4212
|
+
) : await encryptBytes(data, key);
|
|
4206
4213
|
if (format2 && format2 === "arraybuffer") return encrypted;
|
|
4207
4214
|
return new Uint8Array(encrypted);
|
|
4208
4215
|
}
|
|
@@ -4932,6 +4939,8 @@
|
|
|
4932
4939
|
* @param {CryptoKey|string} [publicKey] The public key used to generate
|
|
4933
4940
|
* the AES key used on this message. If omitted, decrypt with our own
|
|
4934
4941
|
* public key.
|
|
4942
|
+
* @param {string} aesAlgorithm The algorithm. Default is AES-GCM.
|
|
4943
|
+
* @param {string} info Custom "info" parameter
|
|
4935
4944
|
* @returns {Promise<ArrayBuffer>} The decrypted content.
|
|
4936
4945
|
*/
|
|
4937
4946
|
async decrypt(msg, publicKey, aesAlgorithm, info) {
|
|
@@ -4960,6 +4969,15 @@
|
|
|
4960
4969
|
}
|
|
4961
4970
|
/**
|
|
4962
4971
|
* Decrypt and return as string.
|
|
4972
|
+
* The encrypted message should be salt + iv + cipher text.
|
|
4973
|
+
*
|
|
4974
|
+
* @param msg The encrypted content
|
|
4975
|
+
* @param {CryptoKey|string} [publicKey] The public key used to generate
|
|
4976
|
+
* the AES key used on this message. If omitted, decrypt with our own
|
|
4977
|
+
* public key.
|
|
4978
|
+
* @param {string} aesAlgorithm The algorithm. Default is AES-GCM.
|
|
4979
|
+
* @param {string} info Custom "info" parameter
|
|
4980
|
+
* @returns {Promise<ArrayBuffer>} The decrypted content.
|
|
4963
4981
|
*/
|
|
4964
4982
|
async decryptAsString(msg, publicKey, aesAlgorithm, info) {
|
|
4965
4983
|
const dec = await this.decrypt(msg, publicKey, aesAlgorithm, info);
|