Skip to main content

HostWithStore

Trait HostWithStore 

Source
pub trait HostWithStore<T>: HasData + Send {
    // Required methods
    fn generate_key(
        accessor: &Accessor<T, Self>,
        options: Resource<SigningKeyOptions>,
    ) -> impl Future<Output = Result<Result<(Resource<SigningKey>, Resource<VerifyingKey>), Error>>> + Send;
    fn import_signing_key_pkcs8(
        accessor: &Accessor<T, Self>,
        pkcs8: Vec<u8>,
        options: Resource<SigningKeyOptions>,
    ) -> impl Future<Output = Result<Result<Resource<SigningKey>, Error>>> + Send;
    fn import_signing_key_jwk(
        accessor: &Accessor<T, Self>,
        jwk: String,
        options: Resource<SigningKeyOptions>,
    ) -> impl Future<Output = Result<Result<Resource<SigningKey>, Error>>> + Send;
    fn unwrap_signing_key_pkcs8(
        accessor: &Accessor<T, Self>,
        input: Resource<UnwrapInput>,
        options: Resource<SigningKeyOptions>,
    ) -> impl Future<Output = Result<Result<Resource<SigningKey>, Error>>> + Send;
    fn unwrap_signing_key_jwk(
        accessor: &Accessor<T, Self>,
        input: Resource<UnwrapInput>,
        options: Resource<SigningKeyOptions>,
    ) -> impl Future<Output = Result<Result<Resource<SigningKey>, Error>>> + Send;
}

Required Methods§

Source

fn generate_key( accessor: &Accessor<T, Self>, options: Resource<SigningKeyOptions>, ) -> impl Future<Output = Result<Result<(Resource<SigningKey>, Resource<VerifyingKey>), Error>>> + Send

Generate a fresh random signing key, returning both halves — the only point at which every provider is guaranteed to have the public key on hand.

Source

fn import_signing_key_pkcs8( accessor: &Accessor<T, Self>, pkcs8: Vec<u8>, options: Resource<SigningKeyOptions>, ) -> impl Future<Output = Result<Result<Resource<SigningKey>, Error>>> + Send

Import a signing key as a PKCS#8 PrivateKeyInfo (DER, RFC 8410: the 32-byte seed in a CurvePrivateKey). Wrong OIDs and malformed DER fail with error.invalid-key.

Source

fn import_signing_key_jwk( accessor: &Accessor<T, Self>, jwk: String, options: Resource<SigningKeyOptions>, ) -> impl Future<Output = Result<Result<Resource<SigningKey>, Error>>> + Send

Import a signing key as an RFC 8037 OKP private JWK (kty: "OKP", crv: "Ed25519", with x and d both required; an alg member, when present, must be "Ed25519" or "EdDSA"). Implementations MAY reject a JWK whose x is not the public key of d, and MUST NOT trust x for any operation. See mac-key.export-key-jwk for the package-wide JWK contract.

Source

fn unwrap_signing_key_pkcs8( accessor: &Accessor<T, Self>, input: Resource<UnwrapInput>, options: Resource<SigningKeyOptions>, ) -> impl Future<Output = Result<Result<Resource<SigningKey>, Error>>> + Send

Mint a signing key from unwrapped key material (see the wrapping interface): input’s bytes are read as a PKCS#8 PrivateKeyInfo, subject to import-signing-key-pkcs8’s contract. input is consumed.

The minted key’s usages and extractability come from options alone (the W3C Web Cryptography API’s unwrapKey model).

Source

fn unwrap_signing_key_jwk( accessor: &Accessor<T, Self>, input: Resource<UnwrapInput>, options: Resource<SigningKeyOptions>, ) -> impl Future<Output = Result<Result<Resource<SigningKey>, Error>>> + Send

Mint a signing key from unwrapped key material read as an OKP private JWK, subject to import-signing-key-jwk’s contract plus the unwrap-path use/key_ops checks (see README.md, “JWK contract”). input is consumed; see unwrap-signing-key-pkcs8 for the options model.

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.

Implementors§