pub struct AccountPage { /* private fields */ }Expand description
One page of a replica’s account of what it holds in a space, signed by the replica and sealed with a space key.
In CBOR, a page is [1, header, body, signature], where the header is [space, epoch, author, page, issued] and the body an envelope (Envelope) sealed with the key derived
from the space key of epoch, with the header’s encoding as associated data; the
signature signs the encoding of [header, body].
Implementations§
Source§impl AccountPage
impl AccountPage
Sourcepub fn issue(
space: SpaceId,
keys: &SpaceKeys,
signing: &SigningKey,
(issued, body): (u64, &PageBody),
rng: &mut impl CryptoRng,
) -> Self
pub fn issue( space: SpaceId, keys: &SpaceKeys, signing: &SigningKey, (issued, body): (u64, &PageBody), rng: &mut impl CryptoRng, ) -> Self
Issues a page of the account of signing’s replica in space, telling body,
sealed with the space key that new changes are wrapped with, and issued at issued,
in milliseconds since 1970.
Sourcepub fn issue_about(
space: SpaceId,
keys: &SpaceKeys,
signing: &SigningKey,
backup: EntityId,
(issued, body): (u64, &PageBody),
rng: &mut impl CryptoRng,
) -> Self
pub fn issue_about( space: SpaceId, keys: &SpaceKeys, signing: &SigningKey, backup: EntityId, (issued, body): (u64, &PageBody), rng: &mut impl CryptoRng, ) -> Self
Issues a page of the account of a backup in space, which signing’s replica
updated, as AccountPage::issue issues one of its own.
Sourcepub fn from_bytes(bytes: &[u8]) -> Result<Self, LogError>
pub fn from_bytes(bytes: &[u8]) -> Result<Self, LogError>
Reads a page from its encoding, and checks its signature: one that does not read, is
longer than MAX_PAGE_LEN, or whose author did not sign it, is refused.
§Errors
Returns LogError::Account or LogError::Operations if the bytes are not a
page, and LogError::InvalidSignature if its signature does not check.
Sourcepub fn open(&self, keys: &SpaceKeys) -> Result<PageBody, LogError>
pub fn open(&self, keys: &SpaceKeys) -> Result<PageBody, LogError>
Opens what the page tells, with the space key it was sealed with.
§Errors
Returns LogError::UnknownEpoch if keys lack that key, LogError::Decryption
if the body does not open, and LogError::Account or LogError::Operations if
what it holds does not read.
The verifying key of the replica that issued it.