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
| Param | Type | Description |
|---|---|---|
| private_key | PrivateKey | Private key |
| return | ViewKey | View key |
from_string
Create a new view key from a string representation of a view key
from_string(view_key) ► ViewKey
| Param | Type | Description |
|---|---|---|
| view_key | string | String representation of a view key |
| return | ViewKey | View key |
to_string
Get a string representation of a view key
to_string() ► string
| Param | Type |
|---|---|
| return | string |
to_address
Get the address corresponding to a view key
to_address() ► Address
| Param | Type |
|---|---|
| return | Address |
to_scalar
Get the underlying scalar of a view key
to_scalar() ► Scalar
| Param | Type |
|---|---|
| return | Scalar |
toField
Cast the view key to a field
toField() ► Field
| Param | Type |
|---|---|
| return | Field |
decrypt
Decrypt a record ciphertext with a view key
decrypt(ciphertext) ► string
| Param | Type | Description |
|---|---|---|
| ciphertext | string | String representation of a record ciphertext |
| return | string | String representation of a record plaintext |