Skip to main content

StoredKeys

This struct represents how public keys are stored in the key registry. We store not just the keys themselves but also their hash, so that when reading in private we can perform a historical read for the hash and then show that it corresponds to a preimage obtained from an unconstrained hint. We do store the keys keys regardless as they might be needed during public execution, and since we need to broadcast and produce hints in some standardized way. While it might seem odd to create a struct for what is effectively some data and a pure function called on it, state variables rely on serializable structs in order to persist data to storage, so we must use this abstraction.

Fields

FieldType
public_keysPublicKeys
hashField

Methods

new

Instances of StoredKeys are expected to only be created by calling this function so that we guarantee that the hash field does indeed correspond to the hash of the keys. Ideally we'd forbid direct access to the struct, but Noir doesn't yet support private members.

StoredKeys::new(public_keys);

Parameters

NameType
public_keysPublicKeys

Standalone Functions

serialize

serialize(self);

Parameters

NameType
self

deserialize

deserialize(array);

Parameters

NameType
array[Field; STORED_KEYS_LENGTH]