Struct rjwt::Actor [−][src]
An actor with an identifier of type T
and an ECDSA keypair used to sign tokens.
IMPORTANT NOTE: for security reasons, although Actor
implements Clone
, its secret key will
NOT be cloned. For example:
let actor = Actor::<String>::new("id".to_string()); // this has a new secret key let cloned = actor.clone(); // this does NOT have a secret key, only a public key
Implementations
impl<A> Actor<A>
[src]
pub fn new_keypair() -> Keypair
[src]
Generate a new ECDSA keypair.
pub fn new(id: A) -> Self
[src]
Return an Actor
with a newly-generated keypair.
pub fn with_keypair(id: A, 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: A, 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) -> &A
[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<H: Serialize, C: Serialize>(
&self,
token: &Token<H, A, C>
) -> Result<String> where
A: Serialize,
[src]
&self,
token: &Token<H, A, C>
) -> Result<String> where
A: Serialize,
Encode and sign the given token.
Trait Implementations
impl<A: Clone> Clone for Actor<A>
[src]
fn clone(&self) -> Self
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
Auto Trait Implementations
impl<A> RefUnwindSafe for Actor<A> where
A: RefUnwindSafe,
[src]
A: RefUnwindSafe,
impl<A> Send for Actor<A> where
A: Send,
[src]
A: Send,
impl<A> Sync for Actor<A> where
A: Sync,
[src]
A: Sync,
impl<A> Unpin for Actor<A> where
A: Unpin,
[src]
A: Unpin,
impl<A> UnwindSafe for Actor<A> where
A: UnwindSafe,
[src]
A: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,