Files
blackwriter-server/doc/jsonwebtoken.md

3075 lines
60 KiB
Markdown
Raw Permalink Normal View History

2025-12-13 21:43:14 +03:00
# Crate Documentation
**Version:** 10.2.0
**Format Version:** 56
# Module `jsonwebtoken`
Create and parses JWT (JSON Web Tokens)
Documentation: [stable](https://docs.rs/jsonwebtoken)
## Modules
## Module `dangerous`
Dangerous decoding functions that should be audited and used with extreme care.
```rust
pub mod dangerous { /* ... */ }
```
### Re-exports
#### Re-export `insecure_decode`
```rust
pub use super::decoding::insecure_decode;
```
## Module `crypto`
Lower level functions, if you want to do something other than JWTs
The cryptography of the `jsonwebtoken` crate is decoupled behind
[`JwtSigner`] and [`JwtVerifier`] traits. These make use of `RustCrypto`'s
[`Signer`] and [`Verifier`] traits respectively.
[`JwtSigner`]: crate::crypto::JwtSigner
[`JwtVerifier`]: crate::crypto::JwtVerifier
[`Signer`]: signature::Signer
[`Verifier`]: signature::Verifier
```rust
pub mod crypto { /* ... */ }
```
### Traits
#### Trait `JwtSigner`
Trait providing the functionality to sign a JWT.
Allows an arbitrary crypto backend to be provided.
```rust
pub trait JwtSigner: Signer<Vec<u8>> {
/* Associated items */
}
```
##### Required Items
###### Required Methods
- `algorithm`: Return the [`Algorithm`] corresponding to the signing module.
#### Trait `JwtVerifier`
Trait providing the functionality to verify a JWT.
Allows an arbitrary crypto backend to be provided.
```rust
pub trait JwtVerifier: Verifier<Vec<u8>> {
/* Associated items */
}
```
##### Required Items
###### Required Methods
- `algorithm`: Return the [`Algorithm`] corresponding to the signing module.
### Functions
#### Function `sign`
Take the payload of a JWT, sign it using the algorithm given and return
the base64 url safe encoded of the result.
If you just want to encode a JWT, use `encode` instead.
```rust
pub fn sign(message: &[u8], key: &crate::EncodingKey, algorithm: crate::algorithms::Algorithm) -> crate::errors::Result<String> { /* ... */ }
```
#### Function `verify`
Compares the signature given with a re-computed signature for HMAC or using the public key
for RSA/EC.
If you just want to decode a JWT, use `decode` instead.
`signature` is the signature part of a jwt (text after the second '.')
`message` is base64(header) + "." + base64(claims)
```rust
pub fn verify(signature: &str, message: &[u8], key: &crate::DecodingKey, algorithm: crate::algorithms::Algorithm) -> crate::errors::Result<bool> { /* ... */ }
```
## Module `errors`
All the errors that can be encountered while encoding/decoding JWTs
```rust
pub mod errors { /* ... */ }
```
### Types
#### Type Alias `Result`
A type alias for `Result<T, jsonwebtoken::errors::Error>`.
```rust
pub type Result<T> = result::Result<T, Error>;
```
#### Struct `Error`
An error that can occur when encoding/decoding JWTs
```rust
pub struct Error(/* private field */);
```
##### Fields
| Index | Type | Documentation |
|-------|------|---------------|
| 0 | `private` | *Private field* |
##### Implementations
###### Methods
- ```rust
pub fn kind(self: &Self) -> &ErrorKind { /* ... */ }
```
Return the specific type of this error.
- ```rust
pub fn into_kind(self: Self) -> ErrorKind { /* ... */ }
```
Unwrap this error into its underlying type.
###### Trait Implementations
- **Any**
- ```rust
fn type_id(self: &Self) -> TypeId { /* ... */ }
```
- **Borrow**
- ```rust
fn borrow(self: &Self) -> &T { /* ... */ }
```
- **BorrowMut**
- ```rust
fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
```
- **Clone**
- ```rust
fn clone(self: &Self) -> Error { /* ... */ }
```
- **CloneToUninit**
- ```rust
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8) { /* ... */ }
```
- **Debug**
- ```rust
fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<''_>) -> $crate::fmt::Result { /* ... */ }
```
- **Display**
- ```rust
fn fmt(self: &Self, f: &mut fmt::Formatter<''_>) -> fmt::Result { /* ... */ }
```
- **Eq**
- **Error**
- ```rust
fn cause(self: &Self) -> Option<&dyn StdError> { /* ... */ }
```
- **Freeze**
- **From**
- ```rust
fn from(t: T) -> T { /* ... */ }
```
Returns the argument unchanged.
- ```rust
fn from(err: base64::DecodeError) -> Error { /* ... */ }
```
- ```rust
fn from(err: serde_json::Error) -> Error { /* ... */ }
```
- ```rust
fn from(err: ::std::string::FromUtf8Error) -> Error { /* ... */ }
```
- ```rust
fn from(kind: ErrorKind) -> Error { /* ... */ }
```
- **Into**
- ```rust
fn into(self: Self) -> U { /* ... */ }
```
Calls `U::from(self)`.
- **PartialEq**
- ```rust
fn eq(self: &Self, other: &Error) -> bool { /* ... */ }
```
- **RefUnwindSafe**
- **Same**
- **Send**
- **StructuralPartialEq**
- **Sync**
- **ToOwned**
- ```rust
fn to_owned(self: &Self) -> T { /* ... */ }
```
- ```rust
fn clone_into(self: &Self, target: &mut T) { /* ... */ }
```
- **ToString**
- ```rust
fn to_string(self: &Self) -> String { /* ... */ }
```
- **TryFrom**
- ```rust
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
```
- **TryInto**
- ```rust
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
```
- **Unpin**
- **UnwindSafe**
- **VZip**
- ```rust
fn vzip(self: Self) -> V { /* ... */ }
```
#### Enum `ErrorKind`
**Attributes:**
- `NonExhaustive`
The specific type of an error.
This enum may grow additional variants, the `#[non_exhaustive]`
attribute makes sure clients don't count on exhaustive matching.
(Otherwise, adding a new variant could break existing code.)
```rust
pub enum ErrorKind {
InvalidToken,
InvalidSignature,
InvalidEcdsaKey,
InvalidEddsaKey,
InvalidRsaKey(String),
RsaFailedSigning,
InvalidAlgorithmName,
InvalidKeyFormat,
MissingRequiredClaim(String),
ExpiredSignature,
InvalidIssuer,
InvalidAudience,
InvalidSubject,
ImmatureSignature,
InvalidAlgorithm,
MissingAlgorithm,
Base64(base64::DecodeError),
Json(std::sync::Arc<serde_json::Error>),
Utf8(::std::string::FromUtf8Error),
}
```
##### Variants
###### `InvalidToken`
When a token doesn't have a valid JWT shape
###### `InvalidSignature`
When the signature doesn't match
###### `InvalidEcdsaKey`
When the secret given is not a valid ECDSA key
###### `InvalidEddsaKey`
When the secret given is not a valid EdDSA key
###### `InvalidRsaKey`
When the secret given is not a valid RSA key
Fields:
| Index | Type | Documentation |
|-------|------|---------------|
| 0 | `String` | |
###### `RsaFailedSigning`
We could not sign with the given key
###### `InvalidAlgorithmName`
When the algorithm from string doesn't match the one passed to `from_str`
###### `InvalidKeyFormat`
When a key is provided with an invalid format
###### `MissingRequiredClaim`
When a claim required by the validation is not present
Fields:
| Index | Type | Documentation |
|-------|------|---------------|
| 0 | `String` | |
###### `ExpiredSignature`
When a tokens `exp` claim indicates that it has expired
###### `InvalidIssuer`
When a tokens `iss` claim does not match the expected issuer
###### `InvalidAudience`
When a tokens `aud` claim does not match one of the expected audience values
###### `InvalidSubject`
When a tokens `sub` claim does not match one of the expected subject values
###### `ImmatureSignature`
When a tokens `nbf` claim represents a time in the future
###### `InvalidAlgorithm`
When the algorithm in the header doesn't match the one passed to `decode` or the encoding/decoding key
used doesn't match the alg requested
###### `MissingAlgorithm`
When the Validation struct does not contain at least 1 algorithm
###### `Base64`
An error happened when decoding some base64 text
Fields:
| Index | Type | Documentation |
|-------|------|---------------|
| 0 | `base64::DecodeError` | |
###### `Json`
An error happened while serializing/deserializing JSON
Fields:
| Index | Type | Documentation |
|-------|------|---------------|
| 0 | `std::sync::Arc<serde_json::Error>` | |
###### `Utf8`
Some of the text was invalid UTF-8
Fields:
| Index | Type | Documentation |
|-------|------|---------------|
| 0 | `::std::string::FromUtf8Error` | |
##### Implementations
###### Trait Implementations
- **Any**
- ```rust
fn type_id(self: &Self) -> TypeId { /* ... */ }
```
- **Borrow**
- ```rust
fn borrow(self: &Self) -> &T { /* ... */ }
```
- **BorrowMut**
- ```rust
fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
```
- **Clone**
- ```rust
fn clone(self: &Self) -> ErrorKind { /* ... */ }
```
- **CloneToUninit**
- ```rust
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8) { /* ... */ }
```
- **Debug**
- ```rust
fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<''_>) -> $crate::fmt::Result { /* ... */ }
```
- **Eq**
- **Freeze**
- **From**
- ```rust
fn from(t: T) -> T { /* ... */ }
```
Returns the argument unchanged.
- ```rust
fn from(kind: ErrorKind) -> Error { /* ... */ }
```
- **Into**
- ```rust
fn into(self: Self) -> U { /* ... */ }
```
Calls `U::from(self)`.
- **PartialEq**
- ```rust
fn eq(self: &Self, other: &Self) -> bool { /* ... */ }
```
- **RefUnwindSafe**
- **Same**
- **Send**
- **Sync**
- **ToOwned**
- ```rust
fn to_owned(self: &Self) -> T { /* ... */ }
```
- ```rust
fn clone_into(self: &Self, target: &mut T) { /* ... */ }
```
- **TryFrom**
- ```rust
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
```
- **TryInto**
- ```rust
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
```
- **Unpin**
- **UnwindSafe**
- **VZip**
- ```rust
fn vzip(self: Self) -> V { /* ... */ }
```
## Module `jwk`
**Attributes:**
- `Other("#[allow(missing_docs)]")`
This crate contains types only for working JWK and JWK Sets
This is only meant to be used to deal with public JWK, not generate ones.
Most of the code in this file is taken from <https://github.com/lawliet89/biscuit> but
tweaked to remove the private bits as it's not the goal for this crate currently.
```rust
pub mod jwk { /* ... */ }
```
### Types
#### Enum `PublicKeyUse`
The intended usage of the public `KeyType`. This enum is serialized `untagged`
```rust
pub enum PublicKeyUse {
Signature,
Encryption,
Other(String),
}
```
##### Variants
###### `Signature`
Indicates a public key is meant for signature verification
###### `Encryption`
Indicates a public key is meant for encryption
###### `Other`
Other usage
Fields:
| Index | Type | Documentation |
|-------|------|---------------|
| 0 | `String` | |
##### Implementations
###### Trait Implementations
- **Any**
- ```rust
fn type_id(self: &Self) -> TypeId { /* ... */ }
```
- **Borrow**
- ```rust
fn borrow(self: &Self) -> &T { /* ... */ }
```
- **BorrowMut**
- ```rust
fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
```
- **Clone**
- ```rust
fn clone(self: &Self) -> PublicKeyUse { /* ... */ }
```
- **CloneToUninit**
- ```rust
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8) { /* ... */ }
```
- **Debug**
- ```rust
fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<''_>) -> $crate::fmt::Result { /* ... */ }
```
- **Deserialize**
- ```rust
fn deserialize<D>(deserializer: D) -> Result<Self, <D as >::Error>
where
D: Deserializer<''de> { /* ... */ }
```
- **DeserializeOwned**
- **Eq**
- **Freeze**
- **From**
- ```rust
fn from(t: T) -> T { /* ... */ }
```
Returns the argument unchanged.
- **Hash**
- ```rust
fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H) { /* ... */ }
```
- **Into**
- ```rust
fn into(self: Self) -> U { /* ... */ }
```
Calls `U::from(self)`.
- **PartialEq**
- ```rust
fn eq(self: &Self, other: &PublicKeyUse) -> bool { /* ... */ }
```
- **RefUnwindSafe**
- **Same**
- **Send**
- **Serialize**
- ```rust
fn serialize<S>(self: &Self, serializer: S) -> Result<<S as >::Ok, <S as >::Error>
where
S: Serializer { /* ... */ }
```
- **StructuralPartialEq**
- **Sync**
- **ToOwned**
- ```rust
fn to_owned(self: &Self) -> T { /* ... */ }
```
- ```rust
fn clone_into(self: &Self, target: &mut T) { /* ... */ }
```
- **TryFrom**
- ```rust
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
```
- **TryInto**
- ```rust
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
```
- **Unpin**
- **UnwindSafe**
- **VZip**
- ```rust
fn vzip(self: Self) -> V { /* ... */ }
```
#### Enum `KeyOperations`
Operations that the key is intended to be used for. This enum is serialized `untagged`
```rust
pub enum KeyOperations {
Sign,
Verify,
Encrypt,
Decrypt,
WrapKey,
UnwrapKey,
DeriveKey,
DeriveBits,
Other(String),
}
```
##### Variants
###### `Sign`
Computer digital signature or MAC
###### `Verify`
Verify digital signature or MAC
###### `Encrypt`
Encrypt content
###### `Decrypt`
Decrypt content and validate decryption, if applicable
###### `WrapKey`
Encrypt key
###### `UnwrapKey`
Decrypt key and validate decryption, if applicable
###### `DeriveKey`
Derive key
###### `DeriveBits`
Derive bits not to be used as a key
###### `Other`
Other operation
Fields:
| Index | Type | Documentation |
|-------|------|---------------|
| 0 | `String` | |
##### Implementations
###### Trait Implementations
- **Any**
- ```rust
fn type_id(self: &Self) -> TypeId { /* ... */ }
```
- **Borrow**
- ```rust
fn borrow(self: &Self) -> &T { /* ... */ }
```
- **BorrowMut**
- ```rust
fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
```
- **Clone**
- ```rust
fn clone(self: &Self) -> KeyOperations { /* ... */ }
```
- **CloneToUninit**
- ```rust
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8) { /* ... */ }
```
- **Debug**
- ```rust
fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<''_>) -> $crate::fmt::Result { /* ... */ }
```
- **Deserialize**
- ```rust
fn deserialize<D>(deserializer: D) -> Result<Self, <D as >::Error>
where
D: Deserializer<''de> { /* ... */ }
```
- **DeserializeOwned**
- **Eq**
- **Freeze**
- **From**
- ```rust
fn from(t: T) -> T { /* ... */ }
```
Returns the argument unchanged.
- **Hash**
- ```rust
fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H) { /* ... */ }
```
- **Into**
- ```rust
fn into(self: Self) -> U { /* ... */ }
```
Calls `U::from(self)`.
- **PartialEq**
- ```rust
fn eq(self: &Self, other: &KeyOperations) -> bool { /* ... */ }
```
- **RefUnwindSafe**
- **Same**
- **Send**
- **Serialize**
- ```rust
fn serialize<S>(self: &Self, serializer: S) -> Result<<S as >::Ok, <S as >::Error>
where
S: Serializer { /* ... */ }
```
- **StructuralPartialEq**
- **Sync**
- **ToOwned**
- ```rust
fn to_owned(self: &Self) -> T { /* ... */ }
```
- ```rust
fn clone_into(self: &Self, target: &mut T) { /* ... */ }
```
- **TryFrom**
- ```rust
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
```
- **TryInto**
- ```rust
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
```
- **Unpin**
- **UnwindSafe**
- **VZip**
- ```rust
fn vzip(self: Self) -> V { /* ... */ }
```
#### Enum `KeyAlgorithm`
**Attributes:**
- `Other("#[allow(non_camel_case_types, clippy::upper_case_acronyms)]")`
The algorithms of the keys
```rust
pub enum KeyAlgorithm {
HS256,
HS384,
HS512,
ES256,
ES384,
RS256,
RS384,
RS512,
PS256,
PS384,
PS512,
EdDSA,
RSA1_5,
RSA_OAEP,
RSA_OAEP_256,
UNKNOWN_ALGORITHM,
}
```
##### Variants
###### `HS256`
HMAC using SHA-256
###### `HS384`
HMAC using SHA-384
###### `HS512`
HMAC using SHA-512
###### `ES256`
ECDSA using SHA-256
###### `ES384`
ECDSA using SHA-384
###### `RS256`
RSASSA-PKCS1-v1_5 using SHA-256
###### `RS384`
RSASSA-PKCS1-v1_5 using SHA-384
###### `RS512`
RSASSA-PKCS1-v1_5 using SHA-512
###### `PS256`
RSASSA-PSS using SHA-256
###### `PS384`
RSASSA-PSS using SHA-384
###### `PS512`
RSASSA-PSS using SHA-512
###### `EdDSA`
Edwards-curve Digital Signature Algorithm (EdDSA)
###### `RSA1_5`
RSAES-PKCS1-V1_5
###### `RSA_OAEP`
RSAES-OAEP using SHA-1
###### `RSA_OAEP_256`
RSAES-OAEP-256 using SHA-2
###### `UNKNOWN_ALGORITHM`
Catch-All for when the key algorithm can not be determined or is not supported
##### Implementations
###### Trait Implementations
- **Any**
- ```rust
fn type_id(self: &Self) -> TypeId { /* ... */ }
```
- **Borrow**
- ```rust
fn borrow(self: &Self) -> &T { /* ... */ }
```
- **BorrowMut**
- ```rust
fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
```
- **Clone**
- ```rust
fn clone(self: &Self) -> KeyAlgorithm { /* ... */ }
```
- **CloneToUninit**
- ```rust
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8) { /* ... */ }
```
- **Copy**
- **Debug**
- ```rust
fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<''_>) -> $crate::fmt::Result { /* ... */ }
```
- **Deserialize**
- ```rust
fn deserialize<__D>(__deserializer: __D) -> _serde::__private228::Result<Self, <__D as >::Error>
where
__D: _serde::Deserializer<''de> { /* ... */ }
```
- **DeserializeOwned**
- **Display**
- ```rust
fn fmt(self: &Self, f: &mut fmt::Formatter<''_>) -> fmt::Result { /* ... */ }
```
- **Eq**
- **Freeze**
- **From**
- ```rust
fn from(t: T) -> T { /* ... */ }
```
Returns the argument unchanged.
- **FromStr**
- ```rust
fn from_str(s: &str) -> errors::Result<Self> { /* ... */ }
```
- **Hash**
- ```rust
fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H) { /* ... */ }
```
- **Into**
- ```rust
fn into(self: Self) -> U { /* ... */ }
```
Calls `U::from(self)`.
- **PartialEq**
- ```rust
fn eq(self: &Self, other: &KeyAlgorithm) -> bool { /* ... */ }
```
- **RefUnwindSafe**
- **Same**
- **Send**
- **Serialize**
- ```rust
fn serialize<__S>(self: &Self, __serializer: __S) -> _serde::__private228::Result<<__S as >::Ok, <__S as >::Error>
where
__S: _serde::Serializer { /* ... */ }
```
- **StructuralPartialEq**
- **Sync**
- **ToOwned**
- ```rust
fn to_owned(self: &Self) -> T { /* ... */ }
```
- ```rust
fn clone_into(self: &Self, target: &mut T) { /* ... */ }
```
- **ToString**
- ```rust
fn to_string(self: &Self) -> String { /* ... */ }
```
- **TryFrom**
- ```rust
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
```
- **TryInto**
- ```rust
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
```
- **Unpin**
- **UnwindSafe**
- **VZip**
- ```rust
fn vzip(self: Self) -> V { /* ... */ }
```
#### Struct `CommonParameters`
Common JWK parameters
```rust
pub struct CommonParameters {
pub public_key_use: Option<PublicKeyUse>,
pub key_operations: Option<Vec<KeyOperations>>,
pub key_algorithm: Option<KeyAlgorithm>,
pub key_id: Option<String>,
pub x509_url: Option<String>,
pub x509_chain: Option<Vec<String>>,
pub x509_sha1_fingerprint: Option<String>,
pub x509_sha256_fingerprint: Option<String>,
}
```
##### Fields
| Name | Type | Documentation |
|------|------|---------------|
| `public_key_use` | `Option<PublicKeyUse>` | The intended use of the public key. Should not be specified with `key_operations`.<br>See sections 4.2 and 4.3 of [RFC7517](https://tools.ietf.org/html/rfc7517). |
| `key_operations` | `Option<Vec<KeyOperations>>` | The "key_ops" (key operations) parameter identifies the operation(s)<br>for which the key is intended to be used. The "key_ops" parameter is<br>intended for use cases in which public, private, or symmetric keys<br>may be present.<br>Should not be specified with `public_key_use`.<br>See sections 4.2 and 4.3 of [RFC7517](https://tools.ietf.org/html/rfc7517). |
| `key_algorithm` | `Option<KeyAlgorithm>` | The algorithm keys intended for use with the key. |
| `key_id` | `Option<String>` | The case sensitive Key ID for the key |
| `x509_url` | `Option<String>` | X.509 Public key certificate URL. This is currently not implemented (correctly).<br><br>Serialized to `x5u`. |
| `x509_chain` | `Option<Vec<String>>` | X.509 public key certificate chain. This is currently not implemented (correctly).<br><br>Serialized to `x5c`. |
| `x509_sha1_fingerprint` | `Option<String>` | X.509 Certificate SHA1 thumbprint. This is currently not implemented (correctly).<br><br>Serialized to `x5t`. |
| `x509_sha256_fingerprint` | `Option<String>` | X.509 Certificate SHA256 thumbprint. This is currently not implemented (correctly).<br><br>Serialized to `x5t#S256`. |
##### Implementations
###### Trait Implementations
- **Any**
- ```rust
fn type_id(self: &Self) -> TypeId { /* ... */ }
```
- **Borrow**
- ```rust
fn borrow(self: &Self) -> &T { /* ... */ }
```
- **BorrowMut**
- ```rust
fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
```
- **Clone**
- ```rust
fn clone(self: &Self) -> CommonParameters { /* ... */ }
```
- **CloneToUninit**
- ```rust
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8) { /* ... */ }
```
- **Debug**
- ```rust
fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<''_>) -> $crate::fmt::Result { /* ... */ }
```
- **Default**
- ```rust
fn default() -> CommonParameters { /* ... */ }
```
- **Deserialize**
- ```rust
fn deserialize<__D>(__deserializer: __D) -> _serde::__private228::Result<Self, <__D as >::Error>
where
__D: _serde::Deserializer<''de> { /* ... */ }
```
- **DeserializeOwned**
- **Eq**
- **Freeze**
- **From**
- ```rust
fn from(t: T) -> T { /* ... */ }
```
Returns the argument unchanged.
- **Hash**
- ```rust
fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H) { /* ... */ }
```
- **Into**
- ```rust
fn into(self: Self) -> U { /* ... */ }
```
Calls `U::from(self)`.
- **PartialEq**
- ```rust
fn eq(self: &Self, other: &CommonParameters) -> bool { /* ... */ }
```
- **RefUnwindSafe**
- **Same**
- **Send**
- **Serialize**
- ```rust
fn serialize<__S>(self: &Self, __serializer: __S) -> _serde::__private228::Result<<__S as >::Ok, <__S as >::Error>
where
__S: _serde::Serializer { /* ... */ }
```
- **StructuralPartialEq**
- **Sync**
- **ToOwned**
- ```rust
fn to_owned(self: &Self) -> T { /* ... */ }
```
- ```rust
fn clone_into(self: &Self, target: &mut T) { /* ... */ }
```
- **TryFrom**
- ```rust
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
```
- **TryInto**
- ```rust
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
```
- **Unpin**
- **UnwindSafe**
- **VZip**
- ```rust
fn vzip(self: Self) -> V { /* ... */ }
```
#### Enum `EllipticCurveKeyType`
Key type value for an Elliptic Curve Key.
This single value enum is a workaround for Rust not supporting associated constants.
```rust
pub enum EllipticCurveKeyType {
EC,
}
```
##### Variants
###### `EC`
Key type value for an Elliptic Curve Key.
##### Implementations
###### Trait Implementations
- **Any**
- ```rust
fn type_id(self: &Self) -> TypeId { /* ... */ }
```
- **Borrow**
- ```rust
fn borrow(self: &Self) -> &T { /* ... */ }
```
- **BorrowMut**
- ```rust
fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
```
- **Clone**
- ```rust
fn clone(self: &Self) -> EllipticCurveKeyType { /* ... */ }
```
- **CloneToUninit**
- ```rust
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8) { /* ... */ }
```
- **Copy**
- **Debug**
- ```rust
fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<''_>) -> $crate::fmt::Result { /* ... */ }
```
- **Default**
- ```rust
fn default() -> EllipticCurveKeyType { /* ... */ }
```
- **Deserialize**
- ```rust
fn deserialize<__D>(__deserializer: __D) -> _serde::__private228::Result<Self, <__D as >::Error>
where
__D: _serde::Deserializer<''de> { /* ... */ }
```
- **DeserializeOwned**
- **Eq**
- **Freeze**
- **From**
- ```rust
fn from(t: T) -> T { /* ... */ }
```
Returns the argument unchanged.
- **Hash**
- ```rust
fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H) { /* ... */ }
```
- **Into**
- ```rust
fn into(self: Self) -> U { /* ... */ }
```
Calls `U::from(self)`.
- **PartialEq**
- ```rust
fn eq(self: &Self, other: &EllipticCurveKeyType) -> bool { /* ... */ }
```
- **RefUnwindSafe**
- **Same**
- **Send**
- **Serialize**
- ```rust
fn serialize<__S>(self: &Self, __serializer: __S) -> _serde::__private228::Result<<__S as >::Ok, <__S as >::Error>
where
__S: _serde::Serializer { /* ... */ }
```
- **StructuralPartialEq**
- **Sync**
- **ToOwned**
- ```rust
fn to_owned(self: &Self) -> T { /* ... */ }
```
- ```rust
fn clone_into(self: &Self, target: &mut T) { /* ... */ }
```
- **TryFrom**
- ```rust
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
```
- **TryInto**
- ```rust
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
```
- **Unpin**
- **UnwindSafe**
- **VZip**
- ```rust
fn vzip(self: Self) -> V { /* ... */ }
```
#### Enum `EllipticCurve`
Type of cryptographic curve used by a key. This is defined in
[RFC 7518 #7.6](https://tools.ietf.org/html/rfc7518#section-7.6)
```rust
pub enum EllipticCurve {
P256,
P384,
P521,
Ed25519,
}
```
##### Variants
###### `P256`
P-256 curve
###### `P384`
P-384 curve
###### `P521`
P-521 curve -- unsupported by `ring`.
###### `Ed25519`
Ed25519 curve
##### Implementations
###### Trait Implementations
- **Any**
- ```rust
fn type_id(self: &Self) -> TypeId { /* ... */ }
```
- **Borrow**
- ```rust
fn borrow(self: &Self) -> &T { /* ... */ }
```
- **BorrowMut**
- ```rust
fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
```
- **Clone**
- ```rust
fn clone(self: &Self) -> EllipticCurve { /* ... */ }
```
- **CloneToUninit**
- ```rust
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8) { /* ... */ }
```
- **Debug**
- ```rust
fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<''_>) -> $crate::fmt::Result { /* ... */ }
```
- **Default**
- ```rust
fn default() -> EllipticCurve { /* ... */ }
```
- **Deserialize**
- ```rust
fn deserialize<__D>(__deserializer: __D) -> _serde::__private228::Result<Self, <__D as >::Error>
where
__D: _serde::Deserializer<''de> { /* ... */ }
```
- **DeserializeOwned**
- **Eq**
- **Freeze**
- **From**
- ```rust
fn from(t: T) -> T { /* ... */ }
```
Returns the argument unchanged.
- **Hash**
- ```rust
fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H) { /* ... */ }
```
- **Into**
- ```rust
fn into(self: Self) -> U { /* ... */ }
```
Calls `U::from(self)`.
- **PartialEq**
- ```rust
fn eq(self: &Self, other: &EllipticCurve) -> bool { /* ... */ }
```
- **RefUnwindSafe**
- **Same**
- **Send**
- **Serialize**
- ```rust
fn serialize<__S>(self: &Self, __serializer: __S) -> _serde::__private228::Result<<__S as >::Ok, <__S as >::Error>
where
__S: _serde::Serializer { /* ... */ }
```
- **StructuralPartialEq**
- **Sync**
- **ToOwned**
- ```rust
fn to_owned(self: &Self) -> T { /* ... */ }
```
- ```rust
fn clone_into(self: &Self, target: &mut T) { /* ... */ }
```
- **TryFrom**
- ```rust
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
```
- **TryInto**
- ```rust
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
```
- **Unpin**
- **UnwindSafe**
- **VZip**
- ```rust
fn vzip(self: Self) -> V { /* ... */ }
```
#### Struct `EllipticCurveKeyParameters`
Parameters for an Elliptic Curve Key
```rust
pub struct EllipticCurveKeyParameters {
pub key_type: EllipticCurveKeyType,
pub curve: EllipticCurve,
pub x: String,
pub y: String,
}
```
##### Fields
| Name | Type | Documentation |
|------|------|---------------|
| `key_type` | `EllipticCurveKeyType` | Key type value for an Elliptic Curve Key. |
| `curve` | `EllipticCurve` | The "crv" (curve) parameter identifies the cryptographic curve used<br>with the key. |
| `x` | `String` | The "x" (x coordinate) parameter contains the x coordinate for the<br>Elliptic Curve point. |
| `y` | `String` | The "y" (y coordinate) parameter contains the y coordinate for the<br>Elliptic Curve point. |
##### Implementations
###### Trait Implementations
- **Any**
- ```rust
fn type_id(self: &Self) -> TypeId { /* ... */ }
```
- **Borrow**
- ```rust
fn borrow(self: &Self) -> &T { /* ... */ }
```
- **BorrowMut**
- ```rust
fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
```
- **Clone**
- ```rust
fn clone(self: &Self) -> EllipticCurveKeyParameters { /* ... */ }
```
- **CloneToUninit**
- ```rust
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8) { /* ... */ }
```
- **Debug**
- ```rust
fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<''_>) -> $crate::fmt::Result { /* ... */ }
```
- **Default**
- ```rust
fn default() -> EllipticCurveKeyParameters { /* ... */ }
```
- **Deserialize**
- ```rust
fn deserialize<__D>(__deserializer: __D) -> _serde::__private228::Result<Self, <__D as >::Error>
where
__D: _serde::Deserializer<''de> { /* ... */ }
```
- **DeserializeOwned**
- **Eq**
- **Freeze**
- **From**
- ```rust
fn from(t: T) -> T { /* ... */ }
```
Returns the argument unchanged.
- **Hash**
- ```rust
fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H) { /* ... */ }
```
- **Into**
- ```rust
fn into(self: Self) -> U { /* ... */ }
```
Calls `U::from(self)`.
- **PartialEq**
- ```rust
fn eq(self: &Self, other: &EllipticCurveKeyParameters) -> bool { /* ... */ }
```
- **RefUnwindSafe**
- **Same**
- **Send**
- **Serialize**
- ```rust
fn serialize<__S>(self: &Self, __serializer: __S) -> _serde::__private228::Result<<__S as >::Ok, <__S as >::Error>
where
__S: _serde::Serializer { /* ... */ }
```
- **StructuralPartialEq**
- **Sync**
- **ToOwned**
- ```rust
fn to_owned(self: &Self) -> T { /* ... */ }
```
- ```rust
fn clone_into(self: &Self, target: &mut T) { /* ... */ }
```
- **TryFrom**
- ```rust
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
```
- **TryInto**
- ```rust
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
```
- **Unpin**
- **UnwindSafe**
- **VZip**
- ```rust
fn vzip(self: Self) -> V { /* ... */ }
```
#### Enum `RSAKeyType`
Key type value for an RSA Key.
This single value enum is a workaround for Rust not supporting associated constants.
```rust
pub enum RSAKeyType {
RSA,
}
```
##### Variants
###### `RSA`
Key type value for an RSA Key.
##### Implementations
###### Trait Implementations
- **Any**
- ```rust
fn type_id(self: &Self) -> TypeId { /* ... */ }
```
- **Borrow**
- ```rust
fn borrow(self: &Self) -> &T { /* ... */ }
```
- **BorrowMut**
- ```rust
fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
```
- **Clone**
- ```rust
fn clone(self: &Self) -> RSAKeyType { /* ... */ }
```
- **CloneToUninit**
- ```rust
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8) { /* ... */ }
```
- **Copy**
- **Debug**
- ```rust
fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<''_>) -> $crate::fmt::Result { /* ... */ }
```
- **Default**
- ```rust
fn default() -> RSAKeyType { /* ... */ }
```
- **Deserialize**
- ```rust
fn deserialize<__D>(__deserializer: __D) -> _serde::__private228::Result<Self, <__D as >::Error>
where
__D: _serde::Deserializer<''de> { /* ... */ }
```
- **DeserializeOwned**
- **Eq**
- **Freeze**
- **From**
- ```rust
fn from(t: T) -> T { /* ... */ }
```
Returns the argument unchanged.
- **Hash**
- ```rust
fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H) { /* ... */ }
```
- **Into**
- ```rust
fn into(self: Self) -> U { /* ... */ }
```
Calls `U::from(self)`.
- **PartialEq**
- ```rust
fn eq(self: &Self, other: &RSAKeyType) -> bool { /* ... */ }
```
- **RefUnwindSafe**
- **Same**
- **Send**
- **Serialize**
- ```rust
fn serialize<__S>(self: &Self, __serializer: __S) -> _serde::__private228::Result<<__S as >::Ok, <__S as >::Error>
where
__S: _serde::Serializer { /* ... */ }
```
- **StructuralPartialEq**
- **Sync**
- **ToOwned**
- ```rust
fn to_owned(self: &Self) -> T { /* ... */ }
```
- ```rust
fn clone_into(self: &Self, target: &mut T) { /* ... */ }
```
- **TryFrom**
- ```rust
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
```
- **TryInto**
- ```rust
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
```
- **Unpin**
- **UnwindSafe**
- **VZip**
- ```rust
fn vzip(self: Self) -> V { /* ... */ }
```
#### Struct `RSAKeyParameters`
Parameters for a RSA Key
```rust
pub struct RSAKeyParameters {
pub key_type: RSAKeyType,
pub n: String,
pub e: String,
}
```
##### Fields
| Name | Type | Documentation |
|------|------|---------------|
| `key_type` | `RSAKeyType` | Key type value for a RSA Key |
| `n` | `String` | The "n" (modulus) parameter contains the modulus value for the RSA<br>public key. |
| `e` | `String` | The "e" (exponent) parameter contains the exponent value for the RSA<br>public key. |
##### Implementations
###### Trait Implementations
- **Any**
- ```rust
fn type_id(self: &Self) -> TypeId { /* ... */ }
```
- **Borrow**
- ```rust
fn borrow(self: &Self) -> &T { /* ... */ }
```
- **BorrowMut**
- ```rust
fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
```
- **Clone**
- ```rust
fn clone(self: &Self) -> RSAKeyParameters { /* ... */ }
```
- **CloneToUninit**
- ```rust
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8) { /* ... */ }
```
- **Debug**
- ```rust
fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<''_>) -> $crate::fmt::Result { /* ... */ }
```
- **Default**
- ```rust
fn default() -> RSAKeyParameters { /* ... */ }
```
- **Deserialize**
- ```rust
fn deserialize<__D>(__deserializer: __D) -> _serde::__private228::Result<Self, <__D as >::Error>
where
__D: _serde::Deserializer<''de> { /* ... */ }
```
- **DeserializeOwned**
- **Eq**
- **Freeze**
- **From**
- ```rust
fn from(t: T) -> T { /* ... */ }
```
Returns the argument unchanged.
- **Hash**
- ```rust
fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H) { /* ... */ }
```
- **Into**
- ```rust
fn into(self: Self) -> U { /* ... */ }
```
Calls `U::from(self)`.
- **PartialEq**
- ```rust
fn eq(self: &Self, other: &RSAKeyParameters) -> bool { /* ... */ }
```
- **RefUnwindSafe**
- **Same**
- **Send**
- **Serialize**
- ```rust
fn serialize<__S>(self: &Self, __serializer: __S) -> _serde::__private228::Result<<__S as >::Ok, <__S as >::Error>
where
__S: _serde::Serializer { /* ... */ }
```
- **StructuralPartialEq**
- **Sync**
- **ToOwned**
- ```rust
fn to_owned(self: &Self) -> T { /* ... */ }
```
- ```rust
fn clone_into(self: &Self, target: &mut T) { /* ... */ }
```
- **TryFrom**
- ```rust
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
```
- **TryInto**
- ```rust
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
```
- **Unpin**
- **UnwindSafe**
- **VZip**
- ```rust
fn vzip(self: Self) -> V { /* ... */ }
```
#### Enum `OctetKeyType`
Key type value for an Octet symmetric key.
This single value enum is a workaround for Rust not supporting associated constants.
```rust
pub enum OctetKeyType {
Octet,
}
```
##### Variants
###### `Octet`
Key type value for an Octet symmetric key.
##### Implementations
###### Trait Implementations
- **Any**
- ```rust
fn type_id(self: &Self) -> TypeId { /* ... */ }
```
- **Borrow**
- ```rust
fn borrow(self: &Self) -> &T { /* ... */ }
```
- **BorrowMut**
- ```rust
fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
```
- **Clone**
- ```rust
fn clone(self: &Self) -> OctetKeyType { /* ... */ }
```
- **CloneToUninit**
- ```rust
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8) { /* ... */ }
```
- **Copy**
- **Debug**
- ```rust
fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<''_>) -> $crate::fmt::Result { /* ... */ }
```
- **Default**
- ```rust
fn default() -> OctetKeyType { /* ... */ }
```
- **Deserialize**
- ```rust
fn deserialize<__D>(__deserializer: __D) -> _serde::__private228::Result<Self, <__D as >::Error>
where
__D: _serde::Deserializer<''de> { /* ... */ }
```
- **DeserializeOwned**
- **Eq**
- **Freeze**
- **From**
- ```rust
fn from(t: T) -> T { /* ... */ }
```
Returns the argument unchanged.
- **Hash**
- ```rust
fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H) { /* ... */ }
```
- **Into**
- ```rust
fn into(self: Self) -> U { /* ... */ }
```
Calls `U::from(self)`.
- **PartialEq**
- ```rust
fn eq(self: &Self, other: &OctetKeyType) -> bool { /* ... */ }
```
- **RefUnwindSafe**
- **Same**
- **Send**
- **Serialize**
- ```rust
fn serialize<__S>(self: &Self, __serializer: __S) -> _serde::__private228::Result<<__S as >::Ok, <__S as >::Error>
where
__S: _serde::Serializer { /* ... */ }
```
- **StructuralPartialEq**
- **Sync**
- **ToOwned**
- ```rust
fn to_owned(self: &Self) -> T { /* ... */ }
```
- ```rust
fn clone_into(self: &Self, target: &mut T) { /* ... */ }
```
- **TryFrom**
- ```rust
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
```
- **TryInto**
- ```rust
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
```
- **Unpin**
- **UnwindSafe**
- **VZip**
- ```rust
fn vzip(self: Self) -> V { /* ... */ }
```
#### Struct `OctetKeyParameters`
Parameters for an Octet Key
```rust
pub struct OctetKeyParameters {
pub key_type: OctetKeyType,
pub value: String,
}
```
##### Fields
| Name | Type | Documentation |
|------|------|---------------|
| `key_type` | `OctetKeyType` | Key type value for an Octet Key |
| `value` | `String` | The octet key value |
##### Implementations
###### Trait Implementations
- **Any**
- ```rust
fn type_id(self: &Self) -> TypeId { /* ... */ }
```
- **Borrow**
- ```rust
fn borrow(self: &Self) -> &T { /* ... */ }
```
- **BorrowMut**
- ```rust
fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
```
- **Clone**
- ```rust
fn clone(self: &Self) -> OctetKeyParameters { /* ... */ }
```
- **CloneToUninit**
- ```rust
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8) { /* ... */ }
```
- **Debug**
- ```rust
fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<''_>) -> $crate::fmt::Result { /* ... */ }
```
- **Default**
- ```rust
fn default() -> OctetKeyParameters { /* ... */ }
```
- **Deserialize**
- ```rust
fn deserialize<__D>(__deserializer: __D) -> _serde::__private228::Result<Self, <__D as >::Error>
where
__D: _serde::Deserializer<''de> { /* ... */ }
```
- **DeserializeOwned**
- **Eq**
- **Freeze**
- **From**
- ```rust
fn from(t: T) -> T { /* ... */ }
```
Returns the argument unchanged.
- **Hash**
- ```rust
fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H) { /* ... */ }
```
- **Into**
- ```rust
fn into(self: Self) -> U { /* ... */ }
```
Calls `U::from(self)`.
- **PartialEq**
- ```rust
fn eq(self: &Self, other: &OctetKeyParameters) -> bool { /* ... */ }
```
- **RefUnwindSafe**
- **Same**
- **Send**
- **Serialize**
- ```rust
fn serialize<__S>(self: &Self, __serializer: __S) -> _serde::__private228::Result<<__S as >::Ok, <__S as >::Error>
where
__S: _serde::Serializer { /* ... */ }
```
- **StructuralPartialEq**
- **Sync**
- **ToOwned**
- ```rust
fn to_owned(self: &Self) -> T { /* ... */ }
```
- ```rust
fn clone_into(self: &Self, target: &mut T) { /* ... */ }
```
- **TryFrom**
- ```rust
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
```
- **TryInto**
- ```rust
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
```
- **Unpin**
- **UnwindSafe**
- **VZip**
- ```rust
fn vzip(self: Self) -> V { /* ... */ }
```
#### Enum `OctetKeyPairType`
Key type value for an Octet Key Pair.
This single value enum is a workaround for Rust not supporting associated constants.
```rust
pub enum OctetKeyPairType {
OctetKeyPair,
}
```
##### Variants
###### `OctetKeyPair`
Key type value for an Octet Key Pair.
##### Implementations
###### Trait Implementations
- **Any**
- ```rust
fn type_id(self: &Self) -> TypeId { /* ... */ }
```
- **Borrow**
- ```rust
fn borrow(self: &Self) -> &T { /* ... */ }
```
- **BorrowMut**
- ```rust
fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
```
- **Clone**
- ```rust
fn clone(self: &Self) -> OctetKeyPairType { /* ... */ }
```
- **CloneToUninit**
- ```rust
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8) { /* ... */ }
```
- **Copy**
- **Debug**
- ```rust
fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<''_>) -> $crate::fmt::Result { /* ... */ }
```
- **Default**
- ```rust
fn default() -> OctetKeyPairType { /* ... */ }
```
- **Deserialize**
- ```rust
fn deserialize<__D>(__deserializer: __D) -> _serde::__private228::Result<Self, <__D as >::Error>
where
__D: _serde::Deserializer<''de> { /* ... */ }
```
- **DeserializeOwned**
- **Eq**
- **Freeze**
- **From**
- ```rust
fn from(t: T) -> T { /* ... */ }
```
Returns the argument unchanged.
- **Hash**
- ```rust
fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H) { /* ... */ }
```
- **Into**
- ```rust
fn into(self: Self) -> U { /* ... */ }
```
Calls `U::from(self)`.
- **PartialEq**
- ```rust
fn eq(self: &Self, other: &OctetKeyPairType) -> bool { /* ... */ }
```
- **RefUnwindSafe**
- **Same**
- **Send**
- **Serialize**
- ```rust
fn serialize<__S>(self: &Self, __serializer: __S) -> _serde::__private228::Result<<__S as >::Ok, <__S as >::Error>
where
__S: _serde::Serializer { /* ... */ }
```
- **StructuralPartialEq**
- **Sync**
- **ToOwned**
- ```rust
fn to_owned(self: &Self) -> T { /* ... */ }
```
- ```rust
fn clone_into(self: &Self, target: &mut T) { /* ... */ }
```
- **TryFrom**
- ```rust
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
```
- **TryInto**
- ```rust
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
```
- **Unpin**
- **UnwindSafe**
- **VZip**
- ```rust
fn vzip(self: Self) -> V { /* ... */ }
```
#### Struct `OctetKeyPairParameters`
Parameters for an Octet Key Pair
```rust
pub struct OctetKeyPairParameters {
pub key_type: OctetKeyPairType,
pub curve: EllipticCurve,
pub x: String,
}
```
##### Fields
| Name | Type | Documentation |
|------|------|---------------|
| `key_type` | `OctetKeyPairType` | Key type value for an Octet Key Pair |
| `curve` | `EllipticCurve` | The "crv" (curve) parameter identifies the cryptographic curve used<br>with the key. |
| `x` | `String` | The "x" parameter contains the base64 encoded public key |
##### Implementations
###### Trait Implementations
- **Any**
- ```rust
fn type_id(self: &Self) -> TypeId { /* ... */ }
```
- **Borrow**
- ```rust
fn borrow(self: &Self) -> &T { /* ... */ }
```
- **BorrowMut**
- ```rust
fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
```
- **Clone**
- ```rust
fn clone(self: &Self) -> OctetKeyPairParameters { /* ... */ }
```
- **CloneToUninit**
- ```rust
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8) { /* ... */ }
```
- **Debug**
- ```rust
fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<''_>) -> $crate::fmt::Result { /* ... */ }
```
- **Default**
- ```rust
fn default() -> OctetKeyPairParameters { /* ... */ }
```
- **Deserialize**
- ```rust
fn deserialize<__D>(__deserializer: __D) -> _serde::__private228::Result<Self, <__D as >::Error>
where
__D: _serde::Deserializer<''de> { /* ... */ }
```
- **DeserializeOwned**
- **Eq**
- **Freeze**
- **From**
- ```rust
fn from(t: T) -> T { /* ... */ }
```
Returns the argument unchanged.
- **Hash**
- ```rust
fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H) { /* ... */ }
```
- **Into**
- ```rust
fn into(self: Self) -> U { /* ... */ }
```
Calls `U::from(self)`.
- **PartialEq**
- ```rust
fn eq(self: &Self, other: &OctetKeyPairParameters) -> bool { /* ... */ }
```
- **RefUnwindSafe**
- **Same**
- **Send**
- **Serialize**
- ```rust
fn serialize<__S>(self: &Self, __serializer: __S) -> _serde::__private228::Result<<__S as >::Ok, <__S as >::Error>
where
__S: _serde::Serializer { /* ... */ }
```
- **StructuralPartialEq**
- **Sync**
- **ToOwned**
- ```rust
fn to_owned(self: &Self) -> T { /* ... */ }
```
- ```rust
fn clone_into(self: &Self, target: &mut T) { /* ... */ }
```
- **TryFrom**
- ```rust
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
```
- **TryInto**
- ```rust
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
```
- **Unpin**
- **UnwindSafe**
- **VZip**
- ```rust
fn vzip(self: Self) -> V { /* ... */ }
```
#### Enum `AlgorithmParameters`
**Attributes:**
- `Other("#[serde(untagged)]")`
Algorithm specific parameters
```rust
pub enum AlgorithmParameters {
EllipticCurve(EllipticCurveKeyParameters),
RSA(RSAKeyParameters),
OctetKey(OctetKeyParameters),
OctetKeyPair(OctetKeyPairParameters),
}
```
##### Variants
###### `EllipticCurve`
Fields:
| Index | Type | Documentation |
|-------|------|---------------|
| 0 | `EllipticCurveKeyParameters` | |
###### `RSA`
Fields:
| Index | Type | Documentation |
|-------|------|---------------|
| 0 | `RSAKeyParameters` | |
###### `OctetKey`
Fields:
| Index | Type | Documentation |
|-------|------|---------------|
| 0 | `OctetKeyParameters` | |
###### `OctetKeyPair`
Fields:
| Index | Type | Documentation |
|-------|------|---------------|
| 0 | `OctetKeyPairParameters` | |
##### Implementations
###### Trait Implementations
- **Any**
- ```rust
fn type_id(self: &Self) -> TypeId { /* ... */ }
```
- **Borrow**
- ```rust
fn borrow(self: &Self) -> &T { /* ... */ }
```
- **BorrowMut**
- ```rust
fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
```
- **Clone**
- ```rust
fn clone(self: &Self) -> AlgorithmParameters { /* ... */ }
```
- **CloneToUninit**
- ```rust
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8) { /* ... */ }
```
- **Debug**
- ```rust
fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<''_>) -> $crate::fmt::Result { /* ... */ }
```
- **Deserialize**
- ```rust
fn deserialize<__D>(__deserializer: __D) -> _serde::__private228::Result<Self, <__D as >::Error>
where
__D: _serde::Deserializer<''de> { /* ... */ }
```
- **DeserializeOwned**
- **Eq**
- **Freeze**
- **From**
- ```rust
fn from(t: T) -> T { /* ... */ }
```
Returns the argument unchanged.
- **Hash**
- ```rust
fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H) { /* ... */ }
```
- **Into**
- ```rust
fn into(self: Self) -> U { /* ... */ }
```
Calls `U::from(self)`.
- **PartialEq**
- ```rust
fn eq(self: &Self, other: &AlgorithmParameters) -> bool { /* ... */ }
```
- **RefUnwindSafe**
- **Same**
- **Send**
- **Serialize**
- ```rust
fn serialize<__S>(self: &Self, __serializer: __S) -> _serde::__private228::Result<<__S as >::Ok, <__S as >::Error>
where
__S: _serde::Serializer { /* ... */ }
```
- **StructuralPartialEq**
- **Sync**
- **ToOwned**
- ```rust
fn to_owned(self: &Self) -> T { /* ... */ }
```
- ```rust
fn clone_into(self: &Self, target: &mut T) { /* ... */ }
```
- **TryFrom**
- ```rust
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
```
- **TryInto**
- ```rust
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
```
- **Unpin**
- **UnwindSafe**
- **VZip**
- ```rust
fn vzip(self: Self) -> V { /* ... */ }
```
#### Enum `ThumbprintHash`
The function to use to hash the intermediate thumbprint data.
```rust
pub enum ThumbprintHash {
SHA256,
SHA384,
SHA512,
}
```
##### Variants
###### `SHA256`
###### `SHA384`
###### `SHA512`
##### Implementations
###### Trait Implementations
- **Any**
- ```rust
fn type_id(self: &Self) -> TypeId { /* ... */ }
```
- **Borrow**
- ```rust
fn borrow(self: &Self) -> &T { /* ... */ }
```
- **BorrowMut**
- ```rust
fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
```
- **Clone**
- ```rust
fn clone(self: &Self) -> ThumbprintHash { /* ... */ }
```
- **CloneToUninit**
- ```rust
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8) { /* ... */ }
```
- **Debug**
- ```rust
fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<''_>) -> $crate::fmt::Result { /* ... */ }
```
- **Eq**
- **Freeze**
- **From**
- ```rust
fn from(t: T) -> T { /* ... */ }
```
Returns the argument unchanged.
- **Into**
- ```rust
fn into(self: Self) -> U { /* ... */ }
```
Calls `U::from(self)`.
- **PartialEq**
- ```rust
fn eq(self: &Self, other: &ThumbprintHash) -> bool { /* ... */ }
```
- **RefUnwindSafe**
- **Same**
- **Send**
- **StructuralPartialEq**
- **Sync**
- **ToOwned**
- ```rust
fn to_owned(self: &Self) -> T { /* ... */ }
```
- ```rust
fn clone_into(self: &Self, target: &mut T) { /* ... */ }
```
- **TryFrom**
- ```rust
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
```
- **TryInto**
- ```rust
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
```
- **Unpin**
- **UnwindSafe**
- **VZip**
- ```rust
fn vzip(self: Self) -> V { /* ... */ }
```
#### Struct `Jwk`
```rust
pub struct Jwk {
pub common: CommonParameters,
pub algorithm: AlgorithmParameters,
}
```
##### Fields
| Name | Type | Documentation |
|------|------|---------------|
| `common` | `CommonParameters` | |
| `algorithm` | `AlgorithmParameters` | Key algorithm specific parameters |
##### Implementations
###### Methods
- ```rust
pub fn is_supported(self: &Self) -> bool { /* ... */ }
```
Find whether the Algorithm is implemented and supported
- ```rust
pub fn from_encoding_key(key: &EncodingKey, alg: Algorithm) -> crate::errors::Result<Self> { /* ... */ }
```
- ```rust
pub fn thumbprint(self: &Self, hash_function: ThumbprintHash) -> String { /* ... */ }
```
Compute the thumbprint of the JWK.
###### Trait Implementations
- **Any**
- ```rust
fn type_id(self: &Self) -> TypeId { /* ... */ }
```
- **Borrow**
- ```rust
fn borrow(self: &Self) -> &T { /* ... */ }
```
- **BorrowMut**
- ```rust
fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
```
- **Clone**
- ```rust
fn clone(self: &Self) -> Jwk { /* ... */ }
```
- **CloneToUninit**
- ```rust
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8) { /* ... */ }
```
- **Debug**
- ```rust
fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<''_>) -> $crate::fmt::Result { /* ... */ }
```
- **Deserialize**
- ```rust
fn deserialize<__D>(__deserializer: __D) -> _serde::__private228::Result<Self, <__D as >::Error>
where
__D: _serde::Deserializer<''de> { /* ... */ }
```
- **DeserializeOwned**
- **Eq**
- **Freeze**
- **From**
- ```rust
fn from(t: T) -> T { /* ... */ }
```
Returns the argument unchanged.
- **Hash**
- ```rust
fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H) { /* ... */ }
```
- **Into**
- ```rust
fn into(self: Self) -> U { /* ... */ }
```
Calls `U::from(self)`.
- **PartialEq**
- ```rust
fn eq(self: &Self, other: &Jwk) -> bool { /* ... */ }
```
- **RefUnwindSafe**
- **Same**
- **Send**
- **Serialize**
- ```rust
fn serialize<__S>(self: &Self, __serializer: __S) -> _serde::__private228::Result<<__S as >::Ok, <__S as >::Error>
where
__S: _serde::Serializer { /* ... */ }
```
- **StructuralPartialEq**
- **Sync**
- **ToOwned**
- ```rust
fn to_owned(self: &Self) -> T { /* ... */ }
```
- ```rust
fn clone_into(self: &Self, target: &mut T) { /* ... */ }
```
- **TryFrom**
- ```rust
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
```
- ```rust
fn try_from(jwk: &Jwk) -> Result<Self> { /* ... */ }
```
- **TryInto**
- ```rust
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
```
- **Unpin**
- **UnwindSafe**
- **VZip**
- ```rust
fn vzip(self: Self) -> V { /* ... */ }
```
#### Struct `JwkSet`
A JWK set
```rust
pub struct JwkSet {
pub keys: Vec<Jwk>,
}
```
##### Fields
| Name | Type | Documentation |
|------|------|---------------|
| `keys` | `Vec<Jwk>` | |
##### Implementations
###### Methods
- ```rust
pub fn find(self: &Self, kid: &str) -> Option<&Jwk> { /* ... */ }
```
Find the key in the set that matches the given key id, if any.
###### Trait Implementations
- **Any**
- ```rust
fn type_id(self: &Self) -> TypeId { /* ... */ }
```
- **Borrow**
- ```rust
fn borrow(self: &Self) -> &T { /* ... */ }
```
- **BorrowMut**
- ```rust
fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
```
- **Clone**
- ```rust
fn clone(self: &Self) -> JwkSet { /* ... */ }
```
- **CloneToUninit**
- ```rust
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8) { /* ... */ }
```
- **Debug**
- ```rust
fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<''_>) -> $crate::fmt::Result { /* ... */ }
```
- **Deserialize**
- ```rust
fn deserialize<__D>(__deserializer: __D) -> _serde::__private228::Result<Self, <__D as >::Error>
where
__D: _serde::Deserializer<''de> { /* ... */ }
```
- **DeserializeOwned**
- **Eq**
- **Freeze**
- **From**
- ```rust
fn from(t: T) -> T { /* ... */ }
```
Returns the argument unchanged.
- **Hash**
- ```rust
fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H) { /* ... */ }
```
- **Into**
- ```rust
fn into(self: Self) -> U { /* ... */ }
```
Calls `U::from(self)`.
- **PartialEq**
- ```rust
fn eq(self: &Self, other: &JwkSet) -> bool { /* ... */ }
```
- **RefUnwindSafe**
- **Same**
- **Send**
- **Serialize**
- ```rust
fn serialize<__S>(self: &Self, __serializer: __S) -> _serde::__private228::Result<<__S as >::Ok, <__S as >::Error>
where
__S: _serde::Serializer { /* ... */ }
```
- **StructuralPartialEq**
- **Sync**
- **ToOwned**
- ```rust
fn to_owned(self: &Self) -> T { /* ... */ }
```
- ```rust
fn clone_into(self: &Self, target: &mut T) { /* ... */ }
```
- **TryFrom**
- ```rust
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
```
- **TryInto**
- ```rust
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
```
- **Unpin**
- **UnwindSafe**
- **VZip**
- ```rust
fn vzip(self: Self) -> V { /* ... */ }
```
## Module `jws`
JSON Web Signatures data type.
```rust
pub mod jws { /* ... */ }
```
### Types
#### Struct `Jws`
This is a serde-compatible JSON Web Signature structure.
```rust
pub struct Jws<C> {
pub protected: String,
pub payload: String,
pub signature: String,
pub _pd: std::marker::PhantomData<C>,
}
```
##### Fields
| Name | Type | Documentation |
|------|------|---------------|
| `protected` | `String` | The base64 encoded header data.<br><br>Defined in [RFC7515#3.2](https://tools.ietf.org/html/rfc7515#section-3.2). |
| `payload` | `String` | The base64 encoded claims data.<br><br>Defined in [RFC7515#3.2](https://tools.ietf.org/html/rfc7515#section-3.2). |
| `signature` | `String` | The signature on the other fields.<br><br>Defined in [RFC7515#3.2](https://tools.ietf.org/html/rfc7515#section-3.2). |
| `_pd` | `std::marker::PhantomData<C>` | Unused, for associating type metadata. |
##### Implementations
###### Trait Implementations
- **Any**
- ```rust
fn type_id(self: &Self) -> TypeId { /* ... */ }
```
- **Borrow**
- ```rust
fn borrow(self: &Self) -> &T { /* ... */ }
```
- **BorrowMut**
- ```rust
fn borrow_mut(self: &mut Self) -> &mut T { /* ... */ }
```
- **Clone**
- ```rust
fn clone(self: &Self) -> Jws<C> { /* ... */ }
```
- **CloneToUninit**
- ```rust
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8) { /* ... */ }
```
- **Debug**
- ```rust
fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<''_>) -> $crate::fmt::Result { /* ... */ }
```
- **Deserialize**
- ```rust
fn deserialize<__D>(__deserializer: __D) -> _serde::__private228::Result<Self, <__D as >::Error>
where
__D: _serde::Deserializer<''de> { /* ... */ }
```
- **DeserializeOwned**
- **Freeze**
- **From**
- ```rust
fn from(t: T) -> T { /* ... */ }
```
Returns the argument unchanged.
- **Into**
- ```rust
fn into(self: Self) -> U { /* ... */ }
```
Calls `U::from(self)`.
- **RefUnwindSafe**
- **Same**
- **Send**
- **Serialize**
- ```rust
fn serialize<__S>(self: &Self, __serializer: __S) -> _serde::__private228::Result<<__S as >::Ok, <__S as >::Error>
where
__S: _serde::Serializer { /* ... */ }
```
- **Sync**
- **ToOwned**
- ```rust
fn to_owned(self: &Self) -> T { /* ... */ }
```
- ```rust
fn clone_into(self: &Self, target: &mut T) { /* ... */ }
```
- **TryFrom**
- ```rust
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> { /* ... */ }
```
- **TryInto**
- ```rust
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error> { /* ... */ }
```
- **Unpin**
- **UnwindSafe**
- **VZip**
- ```rust
fn vzip(self: Self) -> V { /* ... */ }
```
### Functions
#### Function `encode`
Encode the header and claims given and sign the payload using the algorithm from the header and the key.
If the algorithm given is RSA or EC, the key needs to be in the PEM format. This produces a JWS instead of
a JWT -- usage is similar to `encode`, see that for more details.
```rust
pub fn encode<T: Serialize>(header: &crate::Header, claims: Option<&T>, key: &crate::EncodingKey) -> crate::errors::Result<Jws<T>> { /* ... */ }
```
#### Function `decode`
Validate a received JWS and decode into the header and claims.
```rust
pub fn decode<T: DeserializeOwned>(jws: &Jws<T>, key: &crate::DecodingKey, validation: &crate::Validation) -> crate::errors::Result<crate::TokenData<T>> { /* ... */ }
```
## Re-exports
### Re-export `Algorithm`
```rust
pub use algorithms::Algorithm;
```
### Re-export `DecodingKey`
```rust
pub use decoding::DecodingKey;
```
### Re-export `TokenData`
```rust
pub use decoding::TokenData;
```
### Re-export `decode`
```rust
pub use decoding::decode;
```
### Re-export `decode_header`
```rust
pub use decoding::decode_header;
```
### Re-export `EncodingKey`
```rust
pub use encoding::EncodingKey;
```
### Re-export `encode`
```rust
pub use encoding::encode;
```
### Re-export `Header`
```rust
pub use header::Header;
```
### Re-export `Validation`
```rust
pub use validation::Validation;
```
### Re-export `get_current_timestamp`
```rust
pub use validation::get_current_timestamp;
```