Struct rjwt::Actor[][src]

pub struct Actor<I> { /* fields omitted */ }

An actor with an identifier of type T and an ECDSA keypair used to sign tokens.

Implementations

impl<I> Actor<I>[src]

pub fn new_keypair() -> Keypair[src]

Generate a new ECDSA keypair.

pub fn new(id: I) -> Self[src]

Return an Actor with a newly-generated keypair.

pub fn with_keypair(id: I, public_key: &[u8], secret: &[u8]) -> Result<Self>[src]

Return an Actor with the given keypair, or an error if the keypair is invalid.

pub fn with_public_key(id: I, public_key: &[u8]) -> Result<Self>[src]

Return an Actor with the given public key, or an error if the key is invalid.

pub fn id(&self) -> &I[src]

The identifier of this actor.

pub fn public_key(&self) -> &PublicKey[src]

The public key of this actor, which a client can use to verify a signature.

pub fn sign_token<C: Serialize>(&self, token: &Token<I, C>) -> Result<String> where
    I: Serialize
[src]

Encode and sign the given token.

pub fn validate<C: DeserializeOwned>(
    &self,
    encoded: &str
) -> Result<Token<I, C>> where
    I: Eq,
    Token<I, C>: DeserializeOwned
[src]

Decode and validate the given token string.

Auto Trait Implementations

impl<I> RefUnwindSafe for Actor<I> where
    I: RefUnwindSafe
[src]

impl<I> Send for Actor<I> where
    I: Send
[src]

impl<I> Sync for Actor<I> where
    I: Sync
[src]

impl<I> Unpin for Actor<I> where
    I: Unpin
[src]

impl<I> UnwindSafe for Actor<I> where
    I: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,