Trait concordium_std::HasPolicy[][src]

pub trait HasPolicy {
    fn identity_provider(&self) -> IdentityProvider;
fn created_at(&self) -> Timestamp;
fn valid_to(&self) -> Timestamp;
fn next_item(&mut self, buf: &mut [u8; 31]) -> Option<(AttributeTag, u8)>; }

A type which has access to a policy of a credential. Since policies can be large this is deliberately written in a relatively low-level style to enable efficient traversal of all the attributes without any allocations.

Required methods

fn identity_provider(&self) -> IdentityProvider[src]

Identity provider who signed the identity object the credential is derived from.

fn created_at(&self) -> Timestamp[src]

Beginning of the month in milliseconds since unix epoch when the credential was created.

fn valid_to(&self) -> Timestamp[src]

Beginning of the month where the credential is no longer valid, in milliseconds since unix epoch.

fn next_item(&mut self, buf: &mut [u8; 31]) -> Option<(AttributeTag, u8)>[src]

Get the next attribute, storing it in the provided buffer. The return value, if Some, is a pair of an attribute tag, and the length, n of the attribute value. In this case, the attribute value is written in the first n bytes of the provided buffer. The rest of the buffer is unchanged.

The reason this function is added here, and we don't simply implement an Iterator for this type is that with the supplied buffer we can iterate through the elements more efficiently, without any allocations, the consumer being responsible for allocating the buffer.

Loading content...

Implementors

Loading content...