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
| Param | Type | Description |
|---|---|---|
| record | string | String representation of a record ciphertext |
| return | RecordCiphertext | Record ciphertext |
toString
Return the string representation of the record ciphertext
toString() ► string
| Param | Type |
|---|---|
| return | string |
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
| Param | Type | Description |
|---|---|---|
| view_key | ViewKey | View key used to decrypt the ciphertext |
| return | RecordPlaintext | Record 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
| Param | Type | Description |
|---|---|---|
| view_key | ViewKey | View key used to generate the record view key |
| return | Field | Record view key |
isOwner
Determines if the account corresponding to the view key is the owner of the record
isOwner(view_key) ► boolean
| Param | Type | Description |
|---|---|---|
| view_key | ViewKey | View key used to check ownership |
| return | boolean | True 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
| Param | Type | Description |
|---|---|---|
| graph_key | GraphKey | Graph key of the account associated with the record |
| commitment | Field | Commitment of the record |
| return | Field | Tag of the record |
fromBytesLe
Get a record ciphertext object from a series of bytes
fromBytesLe(bytes) ► RecordCiphertext
| Param | Type | Description |
|---|---|---|
| bytes | Uint8Array | A left endian byte array representing the record ciphertext |
| return | RecordCiphertext | Record ciphertext object |
toBytesLe
Get the left endian byte array representation of the record ciphertext
toBytesLe() ► Uint8Array
| Param | Type |
|---|---|
| return | Uint8Array |
toBitsLe
Get the left endian boolean array representation of the record ciphertext bits
toBitsLe() ► Array
| Param | Type |
|---|---|
| return | Array |
toFields
Get the field array representation of the record ciphertext
toFields() ► Array
| Param | Type |
|---|---|
| return | Array |
decryptWithRecordViewKey
Decrypt the record ciphertext into plaintext using a record view key
decryptWithRecordViewKey(record_vk) ► RecordPlaintext
| Param | Type | Description |
|---|---|---|
| record_vk | Field | Record view key used to decrypt the record |
| return | RecordPlaintext | Record plaintext object |
nonce
Get the record nonce
nonce() ► Group
| Param | Type |
|---|---|
| return | Group |
clone
Clone the RecordCiphertext WASM object
clone() ► RecordCiphertext
| Param | Type |
|---|---|
| return | RecordCiphertext |