key doesn't need to be optional parameter as its always passed
This commit is contained in:
parent
01cc8ffe4d
commit
721f21cee8
|
@ -79,12 +79,10 @@ export async function decryptChunk(data: Uint8Array, pullState: StateAddress) {
|
||||||
return { decryptedData: pullResult.message, newTag };
|
return { decryptedData: pullResult.message, newTag };
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function encryptChaChaOneShot(data: Uint8Array, key?: string) {
|
export async function encryptChaChaOneShot(data: Uint8Array, key: string) {
|
||||||
await sodium.ready;
|
await sodium.ready;
|
||||||
|
|
||||||
const uintkey: Uint8Array = key
|
const uintkey: Uint8Array = await fromB64(key);
|
||||||
? await fromB64(key)
|
|
||||||
: sodium.crypto_secretstream_xchacha20poly1305_keygen();
|
|
||||||
const initPushResult =
|
const initPushResult =
|
||||||
sodium.crypto_secretstream_xchacha20poly1305_init_push(uintkey);
|
sodium.crypto_secretstream_xchacha20poly1305_init_push(uintkey);
|
||||||
const [pushState, header] = [initPushResult.state, initPushResult.header];
|
const [pushState, header] = [initPushResult.state, initPushResult.header];
|
||||||
|
|
Loading…
Reference in a new issue