@cardanowall/crypto-core 0.4.0 → 0.6.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/dist/index.cjs +10 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +10 -1
- package/dist/index.js.map +1 -1
- package/dist/sealed-poe.cjs +10 -0
- package/dist/sealed-poe.cjs.map +1 -1
- package/dist/sealed-poe.d.cts +2 -1
- package/dist/sealed-poe.d.ts +2 -1
- package/dist/sealed-poe.js +10 -1
- package/dist/sealed-poe.js.map +1 -1
- package/package.json +1 -1
package/dist/sealed-poe.cjs
CHANGED
|
@@ -150,6 +150,15 @@ var ChunkNonce = class {
|
|
|
150
150
|
throw new Error("STREAM: chunk counter overflow");
|
|
151
151
|
}
|
|
152
152
|
};
|
|
153
|
+
function streamSealedLength(plaintextLength) {
|
|
154
|
+
if (!Number.isInteger(plaintextLength) || plaintextLength < 0) {
|
|
155
|
+
throw new Error(
|
|
156
|
+
`STREAM: plaintextLength MUST be a non-negative integer, got ${plaintextLength}`
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
const chunkCount = Math.max(1, Math.ceil(plaintextLength / CHUNK_SIZE));
|
|
160
|
+
return plaintextLength + chunkCount * TAG_SIZE;
|
|
161
|
+
}
|
|
153
162
|
function assertPayloadKey(payloadKey) {
|
|
154
163
|
if (payloadKey.length !== PAYLOAD_KEY_LENGTH) {
|
|
155
164
|
throw new Error(
|
|
@@ -2652,6 +2661,7 @@ exports.sealedEnvelopeFromParsed = sealedEnvelopeFromParsed;
|
|
|
2652
2661
|
exports.slotsPayloadKey = slotsPayloadKey;
|
|
2653
2662
|
exports.streamOpen = streamOpen;
|
|
2654
2663
|
exports.streamSeal = streamSeal;
|
|
2664
|
+
exports.streamSealedLength = streamSealedLength;
|
|
2655
2665
|
exports.uniformIndexBelow = uniformIndexBelow;
|
|
2656
2666
|
exports.x25519KekSalt = x25519KekSalt;
|
|
2657
2667
|
exports.xwingKekSalt = xwingKekSalt;
|