Adding pull secretstream definition

This commit is contained in:
Ugljesa Jovanovic authored and Ugljesa Jovanovic committed 2020-08-15 11:53:11 +02:00
1 parent 28995c065f
commit df87dae376
11 files changed
+223 -30

No files matched your search

@@ -38,10 +38,16 @@ expect class Crypto internal constructor() {
/**
* Initialize a state and generate a random header. Both are returned inside
* `SecretStreamStateAndHeader` object
* `SecretStreamStateAndHeader` object.
*/
fun crypto_secretstream_xchacha20poly1305_init_push(key: UByteArray): SecretStreamStateAndHeader
/**
* Initialize state from header and key. The state can then be used for decryption.
*/
fun crypto_secretstream_xchacha20poly1305_init_pull(header: UByteArray, key: UByteArray):
SecretStreamState
/**
* Encrypt next block of data using the previously initialized state. Returns encrypted block.
*/
@@ -51,4 +57,13 @@ expect class Crypto internal constructor() {
ad: UByteArray,
tag: UByte
): UByteArray
/**
* Decrypt next block of data using the previously initialized state. Returns decrypted block.
*/
fun crypto_secretstream_xchacha20poly1305_pull(
state: SecretStreamState,
c: UByteArray,
ad: UByteArray
): UByteArray
}