[][src]Trait concordium_std::HasPolicy

pub trait HasPolicy {
    pub fn identity_provider(&self) -> IdentityProvider;
pub fn created_at(&self) -> Timestamp;
pub fn valid_to(&self) -> Timestamp;
pub 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

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

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

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

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

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

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

pub 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

impl HasPolicy for Policy<AttributesCursor>[src]

impl HasPolicy for TestPolicy[src]

Loading content...