encrypt()
Othent JS SDK encrypt() function
The encrypt()
function encrypts the data using the active user's private key so that, when stored on Arweave, it is only accessible to that specific user, similarly to the Web Crypto API's encrypt()
.
This is useful for applications such as private file storage apps or mail/messaging platforms.
Limitation: There's currently an 8KB limit in data size when using Othent, but this is currently being worked on. Track the progress on this GitHub issue.
Limitation: Also, the only currently available encryption/decryption algorithm is AES (AES256-GCM
).
This function assumes (and requires) a user is authenticated. See requireAuth()
.
API
plaintext: string | BinaryDataType
plaintext: string | BinaryDataType
The data to be encrypted with the user's private key, which can be of type string
, ArrayBuffer
, TypedArray
or DataView
.
return Promise<Uint8Array>
return Promise<Uint8Array>
A Promise
containing the encrypted data as Uint8Array
.
Example usage
Last updated