Use UInt in kdf derivation, because that's the most js can support more or less. I'll try to figure out if we can use all 52bits lates. Also dont show arm build to intellij as it is checking if there is coroutines build for arm and fails with the most unusefull and misleading error I have seen so far.

This commit is contained in:
Ugljesa Jovanovic committed 2021-04-30 22:10:02 +02:00
1 parent cf00c17a64
commit da85fefb9b
6 files changed
+60 -52

No files matched your search

@@ -6,9 +6,9 @@ import ext.libsodium.com.ionspin.kotlin.crypto.toUInt8Array
actual object Kdf {
/**
* The crypto_kdf_derive_from_key() function derives a subkey_id-th subkey subkey of length subkey_len bytes using
* The deriveFromKey function derives a subkeyId-th subkey of length subkeyLenght bytes using
* the master key key and the context ctx.
* subkey_id can be any value up to (2^64)-1.
* subkey_id can be any value up to (2^32) because javascript doesn't support long types.
* subkey_len has to be between crypto_kdf_BYTES_MIN (inclusive) and crypto_kdf_BYTES_MAX (inclusive).
* Similar to a type, the context ctx is a 8 characters string describing what the key is going to be used for.
* Its purpose is to mitigate accidental bugs by separating domains. The same function used with the same key but
@@ -20,7 +20,7 @@ actual object Kdf {
* prevent the same keys from being mistakenly used by another application.
*/
actual fun deriveFromKey(
subkeyId: Int,
subkeyId: UInt,
subkeyLength: Int,
context: String,
masterKey: UByteArray
@@ -40,4 +40,4 @@ actual object Kdf {
return getSodium().crypto_kdf_keygen().toUByteArray()
}
}
}