XChaChaPoly1305AuthenticationData

constructor(passphrase: String, salt: <Error class: unknown class>, additionalData: <Error class: unknown class> = ubyteArrayOf(), hashOpsLimit: <Error class: unknown class> = HASH_OPS_LIMIT, hashMemLimit: Int = HASH_MEM_LIMIT)

Parameters

passphrase

the password created by the user when encrypting

salt

the random bytes to spice things up, can be created with XChaChaPoly1305AuthenticationData.newSalt.

additionalData

extra data that can be used and can be validated together with the encrypted data.

It is optional and an empty array can be used, if no extra plaintext data needs to be validated.

For the purposes of backup, we can use a hash of the non-encrypted bytes of the file as additional data. This way, if these bytes were tempered with, the decryption will also fail. The idea is to do not trust any fruit from the poisoned tree.