Skip to main content

ViewKey

Overview

Represents a view key for an Aleo account. The ViewKey class provides methods for creating view keys from private keys, deriving addresses, and decrypting record ciphertexts. View keys allow the holder to view all records associated with an account without being able to spend them.

Methods

from_private_key

Create a new view key from a private key

from_private_key(private_key)ViewKey
ParamTypeDescription
private_keyPrivateKeyPrivate key
returnViewKeyView key

from_string

Create a new view key from a string representation of a view key

from_string(view_key)ViewKey
ParamTypeDescription
view_keystringString representation of a view key
returnViewKeyView key

to_string

Get a string representation of a view key

to_string() ► string
ParamType
returnstring

to_address

Get the address corresponding to a view key

to_address()Address
ParamType
returnAddress

to_scalar

Get the underlying scalar of a view key

to_scalar()Scalar
ParamType
returnScalar

toField

Cast the view key to a field

toField()Field
ParamType
returnField

decrypt

Decrypt a record ciphertext with a view key

decrypt(ciphertext) ► string
ParamTypeDescription
ciphertextstringString representation of a record ciphertext
returnstringString representation of a record plaintext