Added auth doc

This commit is contained in:
Ugljesa Jovanovic 2020-11-18 22:36:55 +01:00
parent 1cfff4dd43
commit b261a341db
No known key found for this signature in database
GPG Key ID: 178E6DFCECCB0E0F
4 changed files with 43 additions and 6 deletions

View File

@ -610,7 +610,9 @@ tasks {
// displayName.set("common")
// platform.set(Platform.common)
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")
displayName.set("Kotlin multiplatform")
}

View File

@ -1,3 +1,10 @@
# 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

View File

@ -95,7 +95,7 @@ expect object AuthenticatedEncryptionWithAssociatedData {
/**
* 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 associatedData associated data the won't be encrypted, but will be authenticated
@ -165,7 +165,7 @@ expect object AuthenticatedEncryptionWithAssociatedData {
): UByteArray
/**
* 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 associatedData associated data the won't be encrypted, but will be authenticated
@ -235,7 +235,7 @@ expect object AuthenticatedEncryptionWithAssociatedData {
): UByteArray
/**
* 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 associatedData associated data the won't be encrypted, but will be authenticated

View File

@ -34,17 +34,45 @@ val crypto_auth_hmacsha512_BYTES = 64
* - verify - verify that the authenticatoin data (tag/mac) is correct
*/
expect object Auth {
/**
* Generate a secret key, meant to be used with auth function.
*/
fun authKeygen() : UByteArray
/**
* Generate a HMAC-SHA512-256 authentication data - Message Authentication Code - tag
*/
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
/**
* Generate a secret key, meant to be used with auth function.
*/
fun authHmacSha256Keygen() : UByteArray
/**
* Generate a HMAC-SHA256 authentication data - Message Authentication Code - tag
*/
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
/**
* Generate a secret key, meant to be used with auth function.
*/
fun authHmacSha512Keygen() : UByteArray
/**
* Generate a HMAC-SHA512 authentication data - Message Authentication Code - tag
*/
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
}