simple-hpke 0.1.5 → 0.2.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 +10 -8
- package/dist/constants.cjs +2 -22
- package/dist/constants.cjs.map +3 -3
- package/dist/constants.js +2 -22
- package/dist/constants.js.map +3 -3
- package/dist/constants.min.cjs +1 -1
- package/dist/constants.min.cjs.map +3 -3
- package/dist/constants.min.js +1 -1
- package/dist/constants.min.js.map +3 -3
- package/dist/index.cjs +6 -21
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +33 -22
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -21
- package/dist/index.js.map +3 -3
- package/dist/index.min.cjs +1 -1
- package/dist/index.min.cjs.map +3 -3
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +3 -3
- package/dist/meta.json +16 -16
- package/dist/util.cjs +2 -22
- package/dist/util.cjs.map +3 -3
- package/dist/util.d.ts +1 -1
- package/dist/util.d.ts.map +1 -1
- package/dist/util.js +2 -22
- package/dist/util.js.map +3 -3
- package/dist/util.min.cjs +1 -1
- package/dist/util.min.cjs.map +3 -3
- package/dist/util.min.js +1 -1
- package/dist/util.min.js.map +3 -3
- package/package.json +1 -1
package/dist/meta.json
CHANGED
|
@@ -691,7 +691,7 @@
|
|
|
691
691
|
"format": "esm"
|
|
692
692
|
},
|
|
693
693
|
"src/index.ts": {
|
|
694
|
-
"bytes":
|
|
694
|
+
"bytes": 12639,
|
|
695
695
|
"imports": [
|
|
696
696
|
{
|
|
697
697
|
"path": "node_modules/uint8arrays/dist/src/index.js",
|
|
@@ -717,7 +717,7 @@
|
|
|
717
717
|
"format": "esm"
|
|
718
718
|
},
|
|
719
719
|
"src/util.ts": {
|
|
720
|
-
"bytes":
|
|
720
|
+
"bytes": 13967,
|
|
721
721
|
"imports": [
|
|
722
722
|
{
|
|
723
723
|
"path": "node_modules/uint8arrays/dist/src/index.js",
|
|
@@ -759,7 +759,7 @@
|
|
|
759
759
|
"imports": [],
|
|
760
760
|
"exports": [],
|
|
761
761
|
"inputs": {},
|
|
762
|
-
"bytes":
|
|
762
|
+
"bytes": 112940
|
|
763
763
|
},
|
|
764
764
|
"dist/constants.js": {
|
|
765
765
|
"imports": [],
|
|
@@ -865,22 +865,22 @@
|
|
|
865
865
|
"bytesInOutput": 258
|
|
866
866
|
},
|
|
867
867
|
"src/index.ts": {
|
|
868
|
-
"bytesInOutput":
|
|
868
|
+
"bytesInOutput": 5486
|
|
869
869
|
},
|
|
870
870
|
"src/util.ts": {
|
|
871
|
-
"bytesInOutput":
|
|
871
|
+
"bytesInOutput": 6618
|
|
872
872
|
},
|
|
873
873
|
"src/constants.ts": {
|
|
874
874
|
"bytesInOutput": 452
|
|
875
875
|
}
|
|
876
876
|
},
|
|
877
|
-
"bytes":
|
|
877
|
+
"bytes": 50987
|
|
878
878
|
},
|
|
879
879
|
"dist/index.js.map": {
|
|
880
880
|
"imports": [],
|
|
881
881
|
"exports": [],
|
|
882
882
|
"inputs": {},
|
|
883
|
-
"bytes":
|
|
883
|
+
"bytes": 113074
|
|
884
884
|
},
|
|
885
885
|
"dist/index.js": {
|
|
886
886
|
"imports": [],
|
|
@@ -888,8 +888,8 @@
|
|
|
888
888
|
"create",
|
|
889
889
|
"decrypt",
|
|
890
890
|
"encrypt",
|
|
891
|
-
"
|
|
892
|
-
"
|
|
891
|
+
"encryptKey",
|
|
892
|
+
"open"
|
|
893
893
|
],
|
|
894
894
|
"entryPoint": "src/index.ts",
|
|
895
895
|
"inputs": {
|
|
@@ -981,19 +981,19 @@
|
|
|
981
981
|
"bytesInOutput": 452
|
|
982
982
|
},
|
|
983
983
|
"src/util.ts": {
|
|
984
|
-
"bytesInOutput":
|
|
984
|
+
"bytesInOutput": 6605
|
|
985
985
|
},
|
|
986
986
|
"src/index.ts": {
|
|
987
|
-
"bytesInOutput":
|
|
987
|
+
"bytesInOutput": 5649
|
|
988
988
|
}
|
|
989
989
|
},
|
|
990
|
-
"bytes":
|
|
990
|
+
"bytes": 51032
|
|
991
991
|
},
|
|
992
992
|
"dist/util.js.map": {
|
|
993
993
|
"imports": [],
|
|
994
994
|
"exports": [],
|
|
995
995
|
"inputs": {},
|
|
996
|
-
"bytes":
|
|
996
|
+
"bytes": 112937
|
|
997
997
|
},
|
|
998
998
|
"dist/util.js": {
|
|
999
999
|
"imports": [],
|
|
@@ -1101,13 +1101,13 @@
|
|
|
1101
1101
|
"bytesInOutput": 452
|
|
1102
1102
|
},
|
|
1103
1103
|
"src/index.ts": {
|
|
1104
|
-
"bytesInOutput":
|
|
1104
|
+
"bytesInOutput": 5486
|
|
1105
1105
|
},
|
|
1106
1106
|
"src/util.ts": {
|
|
1107
|
-
"bytesInOutput":
|
|
1107
|
+
"bytesInOutput": 6618
|
|
1108
1108
|
}
|
|
1109
1109
|
},
|
|
1110
|
-
"bytes":
|
|
1110
|
+
"bytes": 50995
|
|
1111
1111
|
}
|
|
1112
1112
|
}
|
|
1113
1113
|
}
|
package/dist/util.cjs
CHANGED
|
@@ -1339,16 +1339,6 @@ var HPKE_SUITE_ID = concat2(
|
|
|
1339
1339
|
|
|
1340
1340
|
// src/index.ts
|
|
1341
1341
|
var subtle = globalThis.crypto.subtle;
|
|
1342
|
-
async function create2(recipient, opts) {
|
|
1343
|
-
const { wrapped, key } = await encryptKey(recipient, null, opts);
|
|
1344
|
-
return { enc: wrapped, key };
|
|
1345
|
-
}
|
|
1346
|
-
__name(create2, "create");
|
|
1347
|
-
async function seal(recipient, aesKey, opts) {
|
|
1348
|
-
const { wrapped, key } = await encryptKey(recipient, aesKey, opts);
|
|
1349
|
-
return { enc: wrapped, key };
|
|
1350
|
-
}
|
|
1351
|
-
__name(seal, "seal");
|
|
1352
1342
|
var open = Object.assign(openBytes, {
|
|
1353
1343
|
raw: openRawBytes
|
|
1354
1344
|
});
|
|
@@ -1529,7 +1519,7 @@ async function encryptKey(recipient, aesKey, opts) {
|
|
|
1529
1519
|
const ciphertext = await aeadSeal(key, baseNonce, keyBytes);
|
|
1530
1520
|
const wrapped = concat2(enc, ciphertext);
|
|
1531
1521
|
const aesGcmKey = await importAesKey(keyBytes);
|
|
1532
|
-
return { wrapped, key: aesGcmKey };
|
|
1522
|
+
return { enc: wrapped, key: aesGcmKey };
|
|
1533
1523
|
}
|
|
1534
1524
|
__name(encryptKey, "encryptKey");
|
|
1535
1525
|
|
|
@@ -1569,17 +1559,7 @@ async function aeadOpen(key, nonce, ciphertext) {
|
|
|
1569
1559
|
__name(aeadOpen, "aeadOpen");
|
|
1570
1560
|
async function encryptBytes(recipient, message, aesKey, opts) {
|
|
1571
1561
|
const plaintext = typeof message === "string" ? new TextEncoder().encode(message) : message;
|
|
1572
|
-
|
|
1573
|
-
let key;
|
|
1574
|
-
if (!aesKey) {
|
|
1575
|
-
const keys = await create2(recipient, opts);
|
|
1576
|
-
enc = keys.enc;
|
|
1577
|
-
key = keys.key;
|
|
1578
|
-
} else {
|
|
1579
|
-
const keys = await seal(recipient, aesKey, opts);
|
|
1580
|
-
enc = keys.enc;
|
|
1581
|
-
key = keys.key;
|
|
1582
|
-
}
|
|
1562
|
+
const { enc, key } = await encryptKey(recipient, aesKey, opts);
|
|
1583
1563
|
const iv = globalThis.crypto.getRandomValues(new Uint8Array(NN));
|
|
1584
1564
|
const ct = new Uint8Array(await subtle2.encrypt(
|
|
1585
1565
|
{ name: "AES-GCM", iv },
|