Struct adapter::ethereum::ewt::Token

source ·
pub struct Token {
    pub header: Header,
    pub payload: Payload,
    pub message_hash: [u8; 32],
    pub signature: Vec<u8>,
    pub token: String,
}
Expand description

EWT Authentication Token

Fields

header: Headerpayload: Payloadmessage_hash: [u8; 32]

The hashed value of the message: keccak256(header_json_base64.payload_json_base64)

signature: Vec<u8>

The signature after signing the message to_ethereum_signed(keccak256("{header_base64}.{payload_base64}")) The signature is in the form of {r}{s}{v}{mode} where mode is 01 for Ethereum Signature

token: String

Will result in authentication token string in the format of: {header_base64_encoded}.{payload_base64_encoded}.{signature_base64_encoded} All fields are base64 encoded

Implementations

Signs a payload given a signer account & password. For the Header it uses ETH_HEADER.

Ethereum web token signing of payload with 1 difference: it’s not the JSON string representation that gets signed but the keccak256(payload_json).

Returns the EWT Token string ready to be used in an Authentication header.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

The EWT Token string is returned, ready to be used in an Authentication header.

Formats the value using the given formatter. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Compare self to key and return true if they are equal.

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more