Skip to main content

HostWithStore

Trait HostWithStore 

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

Generate a fresh random signing key of the declared variant, 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>, variant: EcdsaVariant, 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, the SEC1 private-key body). The encoded curve must match the declared variant’s (error.invalid-key); an embedded public key, when present, is validated against the scalar and never trusted on its own. Returns only the signing key (see the interface doc).

Source

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

Import a signing key as an EC private JWK (kty: "EC", with crv, d, and the mandatory public coordinates x/y, which implementations MAY validate against d and MUST NOT trust). crv and alg are validated as in import-verifying-key-jwk. See mac-key.export-key-jwk for the package-wide JWK contract.

Source

fn unwrap_signing_key_pkcs8( accessor: &Accessor<T, Self>, variant: EcdsaVariant, 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>, variant: EcdsaVariant, 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 EC 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§