Skip to main content

RecordCiphertext

Overview

Represents an encrypted Aleo record. The RecordCiphertext class provides methods for creating, decrypting, and inspecting encrypted records. Records can be decrypted using a view key or a record view key.

Methods

fromString

Create a record ciphertext from a string

fromString(record)RecordCiphertext
ParamTypeDescription
recordstringString representation of a record ciphertext
returnRecordCiphertextRecord ciphertext

toString

Return the string representation of the record ciphertext

toString() ► string
ParamType
returnstring

decrypt

Decrypt the record ciphertext into plaintext using the view key. The record will only decrypt if the record was encrypted by the account corresponding to the view key.

decrypt(view_key)RecordPlaintext
ParamTypeDescription
view_keyViewKeyView key used to decrypt the ciphertext
returnRecordPlaintextRecord plaintext object

recordViewKey

Generate the record view key. The record view key can only decrypt record if the supplied view key belongs to the record owner.

recordViewKey(view_key)Field
ParamTypeDescription
view_keyViewKeyView key used to generate the record view key
returnFieldRecord view key

isOwner

Determines if the account corresponding to the view key is the owner of the record

isOwner(view_key) ► boolean
ParamTypeDescription
view_keyViewKeyView key used to check ownership
returnbooleanTrue if the view key owner is the record owner

tag

Get the tag of the record using the graph key

tag(graph_key, commitment)Field
ParamTypeDescription
graph_keyGraphKeyGraph key of the account associated with the record
commitmentFieldCommitment of the record
returnFieldTag of the record

fromBytesLe

Get a record ciphertext object from a series of bytes

fromBytesLe(bytes)RecordCiphertext
ParamTypeDescription
bytesUint8ArrayA left endian byte array representing the record ciphertext
returnRecordCiphertextRecord ciphertext object

toBytesLe

Get the left endian byte array representation of the record ciphertext

toBytesLe()Uint8Array
ParamType
returnUint8Array

toBitsLe

Get the left endian boolean array representation of the record ciphertext bits

toBitsLe()Array
ParamType
returnArray

toFields

Get the field array representation of the record ciphertext

toFields()Array
ParamType
returnArray

decryptWithRecordViewKey

Decrypt the record ciphertext into plaintext using a record view key

decryptWithRecordViewKey(record_vk)RecordPlaintext
ParamTypeDescription
record_vkFieldRecord view key used to decrypt the record
returnRecordPlaintextRecord plaintext object

nonce

Get the record nonce

nonce()Group
ParamType
returnGroup

clone

Clone the RecordCiphertext WASM object

clone()RecordCiphertext
ParamType
returnRecordCiphertext