pub trait AuthorisationToken<const MCL: usize, const MCC: usize, const MPL: usize, N, S, PD>: Sized {
type Ingredients;
type CreationError;
// Required methods
fn new_for_entry<E>(
entry: &E,
ingredients: &Self::Ingredients,
) -> Result<Self, Self::CreationError>
where E: EntrylikeExt<MCL, MCC, MPL, N, S, PD> + ?Sized;
fn does_authorise<E>(&self, entry: &E) -> bool
where E: EntrylikeExt<MCL, MCC, MPL, N, S, PD> + ?Sized;
}Expand description
A trait for AuthorisationTokens.
This trait serves a dual role: it describes both how to authorise entries (i.e., how to create valid authorisation tokens) and how to verify authorisation tokens (i.e., how to compute the is_authorised_write function of the spec).
Required Associated Types§
Sourcetype Ingredients
type Ingredients
The type of the information you need in order to authorise an entry. For example, in Meadowcap, this would be a pair of a capability and a secret key.
Sourcetype CreationError
type CreationError
Everything that can go wrong when trying to create a new authorisation token from some Ingredients for some entry.
Required Methods§
Sourcefn new_for_entry<E>(
entry: &E,
ingredients: &Self::Ingredients,
) -> Result<Self, Self::CreationError>where
E: EntrylikeExt<MCL, MCC, MPL, N, S, PD> + ?Sized,
fn new_for_entry<E>(
entry: &E,
ingredients: &Self::Ingredients,
) -> Result<Self, Self::CreationError>where
E: EntrylikeExt<MCL, MCC, MPL, N, S, PD> + ?Sized,
Creates an authorisation token for the given entry, if possible.
Determines whether self authorises the given entry.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.