Update Secretbox.js

This commit is contained in:
Elysia
2024-09-16 20:44:04 +07:00
parent 7e5dd06c2b
commit e9d81ce25c

View File

@@ -7,10 +7,10 @@ const libs = {
/** @deprecated */ /** @deprecated */
close: sodium.api.crypto_secretbox_easy, close: sodium.api.crypto_secretbox_easy,
random: n => sodium.randombytes_buf(n), random: n => sodium.randombytes_buf(n),
crypto_aead_xchacha20poly1305_ietf_encrypt: (message, additionalData, nonce, key) => crypto_aead_xchacha20poly1305_ietf_encrypt: (plaintext, additionalData, nonce, key) =>
sodium.api.crypto_aead_xchacha20poly1305_ietf_encrypt(message, additionalData, null, nonce, key), sodium.api.crypto_aead_xchacha20poly1305_ietf_encrypt(plaintext, additionalData, null, nonce, key),
crypto_aead_xchacha20poly1305_ietf_decrypt: (message, additionalData, nonce, key) => crypto_aead_xchacha20poly1305_ietf_decrypt: (plaintext, additionalData, nonce, key) =>
sodium.api.crypto_aead_xchacha20poly1305_ietf_decrypt(message, additionalData, null, nonce, key), sodium.api.crypto_aead_xchacha20poly1305_ietf_decrypt(plaintext, additionalData, null, nonce, key),
}), }),
'libsodium-wrappers': sodium => ({ 'libsodium-wrappers': sodium => ({
/** @deprecated */ /** @deprecated */
@@ -18,10 +18,10 @@ const libs = {
/** @deprecated */ /** @deprecated */
close: sodium.crypto_secretbox_easy, close: sodium.crypto_secretbox_easy,
random: n => sodium.randombytes_buf(n), random: n => sodium.randombytes_buf(n),
crypto_aead_xchacha20poly1305_ietf_encrypt: (message, additionalData, nonce, key) => crypto_aead_xchacha20poly1305_ietf_encrypt: (plaintext, additionalData, nonce, key) =>
sodium.crypto_aead_xchacha20poly1305_ietf_encrypt(message, additionalData, null, nonce, key), sodium.crypto_aead_xchacha20poly1305_ietf_encrypt(plaintext, additionalData, null, nonce, key),
crypto_aead_xchacha20poly1305_ietf_decrypt: (message, additionalData, nonce, key) => crypto_aead_xchacha20poly1305_ietf_decrypt: (plaintext, additionalData, nonce, key) =>
sodium.crypto_aead_xchacha20poly1305_ietf_decrypt(null, message, additionalData, nonce, key), sodium.crypto_aead_xchacha20poly1305_ietf_decrypt(null, plaintext, additionalData, nonce, key),
}), }),
}; };