Started adding Auth doc, added aead doc for specific functions
This commit is contained in:
10 files changed
+242
-72
No files matched your search
+6
-6
@@ -26,7 +26,7 @@ actual object AuthenticatedEncryptionWithAssociatedData {
|
||||
}
|
||||
|
||||
actual fun xChaCha20Poly1305IetfDecrypt(
|
||||
ciphertext: UByteArray,
|
||||
ciphertextAndTag: UByteArray,
|
||||
associatedData: UByteArray,
|
||||
nonce: UByteArray,
|
||||
key: UByteArray
|
||||
@@ -34,7 +34,7 @@ actual object AuthenticatedEncryptionWithAssociatedData {
|
||||
try {
|
||||
return getSodium().crypto_aead_xchacha20poly1305_ietf_decrypt(
|
||||
null,
|
||||
ciphertext.toUInt8Array(),
|
||||
ciphertextAndTag.toUInt8Array(),
|
||||
associatedData.toUInt8Array(),
|
||||
nonce.toUInt8Array(),
|
||||
key.toUInt8Array()
|
||||
@@ -100,7 +100,7 @@ actual object AuthenticatedEncryptionWithAssociatedData {
|
||||
}
|
||||
|
||||
actual fun chaCha20Poly1305IetfDecrypt(
|
||||
ciphertext: UByteArray,
|
||||
ciphertextAndTag: UByteArray,
|
||||
associatedData: UByteArray,
|
||||
nonce: UByteArray,
|
||||
key: UByteArray
|
||||
@@ -108,7 +108,7 @@ actual object AuthenticatedEncryptionWithAssociatedData {
|
||||
try {
|
||||
return getSodium().crypto_aead_chacha20poly1305_ietf_decrypt(
|
||||
null,
|
||||
ciphertext.toUInt8Array(),
|
||||
ciphertextAndTag.toUInt8Array(),
|
||||
associatedData.toUInt8Array(),
|
||||
nonce.toUInt8Array(),
|
||||
key.toUInt8Array()
|
||||
@@ -174,7 +174,7 @@ actual object AuthenticatedEncryptionWithAssociatedData {
|
||||
}
|
||||
|
||||
actual fun chaCha20Poly1305Decrypt(
|
||||
ciphertext: UByteArray,
|
||||
ciphertextAndTag: UByteArray,
|
||||
associatedData: UByteArray,
|
||||
nonce: UByteArray,
|
||||
key: UByteArray
|
||||
@@ -182,7 +182,7 @@ actual object AuthenticatedEncryptionWithAssociatedData {
|
||||
try {
|
||||
return getSodium().crypto_aead_chacha20poly1305_decrypt(
|
||||
null,
|
||||
ciphertext.toUInt8Array(),
|
||||
ciphertextAndTag.toUInt8Array(),
|
||||
associatedData.toUInt8Array(),
|
||||
nonce.toUInt8Array(),
|
||||
key.toUInt8Array()
|
||||
|
||||
+6
-7
@@ -3,7 +3,6 @@ package com.ionspin.kotlin.crypto.auth
|
||||
import com.ionspin.kotlin.crypto.getSodium
|
||||
import ext.libsodium.com.ionspin.kotlin.crypto.toUByteArray
|
||||
import ext.libsodium.com.ionspin.kotlin.crypto.toUInt8Array
|
||||
import org.khronos.webgl.Uint8Array
|
||||
|
||||
actual object Auth {
|
||||
actual fun authKeygen(): UByteArray {
|
||||
@@ -18,9 +17,9 @@ actual object Auth {
|
||||
|
||||
}
|
||||
|
||||
actual fun authVerify(mac: UByteArray, message: UByteArray, key: UByteArray): Boolean {
|
||||
actual fun authVerify(tag: UByteArray, message: UByteArray, key: UByteArray): Boolean {
|
||||
return getSodium().crypto_auth_verify(
|
||||
mac.toUInt8Array(),
|
||||
tag.toUInt8Array(),
|
||||
message.toUInt8Array(),
|
||||
key.toUInt8Array()
|
||||
)
|
||||
@@ -38,12 +37,12 @@ actual object Auth {
|
||||
}
|
||||
|
||||
actual fun authHmacSha256Verify(
|
||||
mac: UByteArray,
|
||||
tag: UByteArray,
|
||||
message: UByteArray,
|
||||
key: UByteArray
|
||||
): Boolean {
|
||||
return getSodium().crypto_auth_hmacsha256_verify(
|
||||
mac.toUInt8Array(),
|
||||
tag.toUInt8Array(),
|
||||
message.toUInt8Array(),
|
||||
key.toUInt8Array()
|
||||
)
|
||||
@@ -61,12 +60,12 @@ actual object Auth {
|
||||
}
|
||||
|
||||
actual fun authHmacSha512Verify(
|
||||
mac: UByteArray,
|
||||
tag: UByteArray,
|
||||
message: UByteArray,
|
||||
key: UByteArray
|
||||
): Boolean {
|
||||
return getSodium().crypto_auth_hmacsha512_verify(
|
||||
mac.toUInt8Array(),
|
||||
tag.toUInt8Array(),
|
||||
message.toUInt8Array(),
|
||||
key.toUInt8Array()
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user