Helper Functions
These functions allow you to use SelfGuard’s functions without using SelfGuard as the encryption storage provider.
Encryption
These functions allow you to encrypt/decrypt data.
Encrypt Bytes
The byte array that you want to encrypt
Decrypt Bytes
The byte array returned from encryptBytes
The encryption key returned from encryptBytes
Encrypt Value
The value that you want to encrypt
Decrypt Value
The value that you want to encrypt
The encryption key returned from encryptValue
Files
These functions allow you to encrypt/decrypt files, where the encryption keys are stored with Lit Protocol if metamask is enabled in the use of these functions.
Stream Encrypt Web
The File you want to encrypt.
If this is set to metamask
, it will save the encryption key with Lit Protocol.
This function is called after each file shard is encrypted with three parameters encrypted_bytes
, encryption_key
, and shard_size
.
Decrypt Shard
The File you want to decrypt.
The encryption key for this file shard returned from the chunk_function within streamEncryptWeb
If this is set to metamask
, it will retrieve the encryption key with Lit Protocol. This meant that the encryption_key
provided in this function was the encrypted encryption key returned from Lit during streamEncryptWeb
.
Metamask
These functions allow you to perform encryption events with Metamask
Get Public Key
Encrypt Data
The address of the metamask user.
The public key of the metamask user retrieved with getPublicKey
The data you want to decrypt.
Decrypt Data
The address of the metamask user.
The data you want to decrypt.
Lit Protocol
These functions allow you to save and retrieve encryption keys stored with lit protocol. These will automatically trigger Metamask
to open and sign a condition ensuring the wallet owner is able to retrieve the encryption key.
The key which you want to save with an access control restriction. Currenty this is based upon the user’s wallet ownership.
The chain upon which you want to have the access condition be based on. This wil be leveraged for more complex access controls.
Save Lit Encryption Key
Get Lit Encryption Key
The encrypted key retrieved from saveLitEncryptionKey
The chain upon which you want to have the access condition be based on. This wil be leveraged for more complex access controls.