Added auth doc
This commit is contained in:
parent
1cfff4dd43
commit
b261a341db
@ -610,7 +610,9 @@ tasks {
|
|||||||
// displayName.set("common")
|
// displayName.set("common")
|
||||||
// platform.set(Platform.common)
|
// platform.set(Platform.common)
|
||||||
moduleDisplayName.set("Kotlin Multiplatform Libsodium Bindings")
|
moduleDisplayName.set("Kotlin Multiplatform Libsodium Bindings")
|
||||||
includes.from("src/commonMain/kotlin/com.ionspin.kotlin.crypto/aead/Aead.md",
|
includes.from(
|
||||||
|
"src/commonMain/kotlin/com.ionspin.kotlin.crypto/aead/Aead.md",
|
||||||
|
"src/commonMain/kotlin/com.ionspin.kotlin.crypto/auth/Auth.md",
|
||||||
"src/commonMain/kotlin/com.ionspin.kotlin.crypto/CryptoModule.md")
|
"src/commonMain/kotlin/com.ionspin.kotlin.crypto/CryptoModule.md")
|
||||||
displayName.set("Kotlin multiplatform")
|
displayName.set("Kotlin multiplatform")
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
# Module Kotlin Multiplatform Libsodium Bindings
|
# Module Kotlin Multiplatform Libsodium Bindings
|
||||||
|
|
||||||
Test test test
|
### What
|
||||||
|
Kotlin Multiplatform Libsodium Bindings is a library providing kotlin idiomatic API to libsodium implementations on various platforms
|
||||||
|
|
||||||
|
### Why
|
||||||
|
To provide easy to use cryptographic library, based on a well-known and audited libsodium library. T
|
||||||
|
### How
|
||||||
|
By using built from source libsodium to provide native implementations, LazySodium (JNA wrapper around libsodium) to provide
|
||||||
|
JVM and Android implementations and libsodium.js to provide node and browser implementation
|
||||||
|
@ -95,7 +95,7 @@ expect object AuthenticatedEncryptionWithAssociatedData {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Encrypt the message and return encrypted data and tag using xChaChaPoly1305 (192 bit nonce) as
|
* Encrypt the message and return encrypted data and tag using xChaChaPoly1305 (192 bit nonce) as
|
||||||
* separate arrays (but wrapped inside [AeadEncryptedDataAndTag]
|
* separate arrays (but wrapped inside [AeadEncryptedDataAndTag])
|
||||||
*
|
*
|
||||||
* @param message message to encrypt
|
* @param message message to encrypt
|
||||||
* @param associatedData associated data the won't be encrypted, but will be authenticated
|
* @param associatedData associated data the won't be encrypted, but will be authenticated
|
||||||
@ -165,7 +165,7 @@ expect object AuthenticatedEncryptionWithAssociatedData {
|
|||||||
): UByteArray
|
): UByteArray
|
||||||
/**
|
/**
|
||||||
* Encrypt the message and return encrypted data and tag using ChaChaPoly1305-IETF (96 bit nonce) as
|
* Encrypt the message and return encrypted data and tag using ChaChaPoly1305-IETF (96 bit nonce) as
|
||||||
* separate arrays (but wrapped inside [AeadEncryptedDataAndTag]
|
* separate arrays (but wrapped inside [AeadEncryptedDataAndTag])
|
||||||
*
|
*
|
||||||
* @param message message to encrypt
|
* @param message message to encrypt
|
||||||
* @param associatedData associated data the won't be encrypted, but will be authenticated
|
* @param associatedData associated data the won't be encrypted, but will be authenticated
|
||||||
@ -235,7 +235,7 @@ expect object AuthenticatedEncryptionWithAssociatedData {
|
|||||||
): UByteArray
|
): UByteArray
|
||||||
/**
|
/**
|
||||||
* Encrypt the message and return encrypted data and tag using ChaChaPoly1305 (64 bit nonce) as
|
* Encrypt the message and return encrypted data and tag using ChaChaPoly1305 (64 bit nonce) as
|
||||||
* separate arrays (but wrapped inside [AeadEncryptedDataAndTag]
|
* separate arrays (but wrapped inside [AeadEncryptedDataAndTag])
|
||||||
*
|
*
|
||||||
* @param message message to encrypt
|
* @param message message to encrypt
|
||||||
* @param associatedData associated data the won't be encrypted, but will be authenticated
|
* @param associatedData associated data the won't be encrypted, but will be authenticated
|
||||||
|
@ -34,17 +34,45 @@ val crypto_auth_hmacsha512_BYTES = 64
|
|||||||
* - verify - verify that the authenticatoin data (tag/mac) is correct
|
* - verify - verify that the authenticatoin data (tag/mac) is correct
|
||||||
*/
|
*/
|
||||||
expect object Auth {
|
expect object Auth {
|
||||||
|
/**
|
||||||
|
* Generate a secret key, meant to be used with auth function.
|
||||||
|
*/
|
||||||
fun authKeygen() : UByteArray
|
fun authKeygen() : UByteArray
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate a HMAC-SHA512-256 authentication data - Message Authentication Code - tag
|
||||||
|
*/
|
||||||
fun auth(message: UByteArray, key: UByteArray) : UByteArray
|
fun auth(message: UByteArray, key: UByteArray) : UByteArray
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verify that given message, secret key and tag, a newly calculated tag matches the received HMAC-SHA512-256 tag.
|
||||||
|
*/
|
||||||
fun authVerify(tag: UByteArray, message: UByteArray, key: UByteArray) : Boolean
|
fun authVerify(tag: UByteArray, message: UByteArray, key: UByteArray) : Boolean
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate a secret key, meant to be used with auth function.
|
||||||
|
*/
|
||||||
fun authHmacSha256Keygen() : UByteArray
|
fun authHmacSha256Keygen() : UByteArray
|
||||||
|
/**
|
||||||
|
* Generate a HMAC-SHA256 authentication data - Message Authentication Code - tag
|
||||||
|
*/
|
||||||
fun authHmacSha256(message: UByteArray, key: UByteArray) : UByteArray
|
fun authHmacSha256(message: UByteArray, key: UByteArray) : UByteArray
|
||||||
|
/**
|
||||||
|
* Verify that given message, secret key and tag, a newly calculated tag matches the received HMAC-SHA256 tag.
|
||||||
|
*/
|
||||||
fun authHmacSha256Verify(tag: UByteArray, message: UByteArray, key: UByteArray) : Boolean
|
fun authHmacSha256Verify(tag: UByteArray, message: UByteArray, key: UByteArray) : Boolean
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate a secret key, meant to be used with auth function.
|
||||||
|
*/
|
||||||
fun authHmacSha512Keygen() : UByteArray
|
fun authHmacSha512Keygen() : UByteArray
|
||||||
|
/**
|
||||||
|
* Generate a HMAC-SHA512 authentication data - Message Authentication Code - tag
|
||||||
|
*/
|
||||||
fun authHmacSha512(message: UByteArray, key: UByteArray) : UByteArray
|
fun authHmacSha512(message: UByteArray, key: UByteArray) : UByteArray
|
||||||
|
/**
|
||||||
|
* Verify that given message, secret key and tag, a newly calculated tag matches the received HMAC-SHA512 tag.
|
||||||
|
*/
|
||||||
fun authHmacSha512Verify(tag: UByteArray, message: UByteArray, key: UByteArray) : Boolean
|
fun authHmacSha512Verify(tag: UByteArray, message: UByteArray, key: UByteArray) : Boolean
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user