Skip to main content

HostWithStore

Trait HostWithStore 

Source
pub trait HostWithStore<T>: HasData + Send {
    // Required methods
    fn import_verifying_key_raw(
        accessor: &Accessor<T, Self>,
        variant: EcdsaVariant,
        raw: Vec<u8>,
    ) -> impl Future<Output = Result<Result<Resource<VerifyingKey>, Error>>> + Send;
    fn import_verifying_key_spki(
        accessor: &Accessor<T, Self>,
        variant: EcdsaVariant,
        spki: Vec<u8>,
    ) -> impl Future<Output = Result<Result<Resource<VerifyingKey>, Error>>> + Send;
    fn import_verifying_key_jwk(
        accessor: &Accessor<T, Self>,
        variant: EcdsaVariant,
        jwk: String,
    ) -> impl Future<Output = Result<Result<Resource<VerifyingKey>, Error>>> + Send;
}

Required Methods§

Source

fn import_verifying_key_raw( accessor: &Accessor<T, Self>, variant: EcdsaVariant, raw: Vec<u8>, ) -> impl Future<Output = Result<Result<Resource<VerifyingKey>, Error>>> + Send

Import a public key as an uncompressed SEC1 point (04 ‖ x ‖ y; 65 bytes for P-256, 97 bytes for P-384 — WebCrypto’s raw format). Anything else — including compressed points and points not on the curve — fails with error.invalid-key. verifying-key.export-key-raw returns this same form.

Source

fn import_verifying_key_spki( accessor: &Accessor<T, Self>, variant: EcdsaVariant, spki: Vec<u8>, ) -> impl Future<Output = Result<Result<Resource<VerifyingKey>, Error>>> + Send

Import a public key as an X.509 SubjectPublicKeyInfo (DER). The curve must be named by OID and must match the declared variant’s, or the import fails with error.invalid-key: an encoding that carries explicit ECParameters instead of the named-curve OID is rejected even when the parameters describe the variant’s curve. A point not on the curve is always rejected. An uncompressed point is always accepted; whether a compressed encoding is accepted is implementation-defined, as it is across WebCrypto engines — do not rely on either behavior.

Source

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

Import a public key as an EC JWK (kty: "EC", with crv, x, and y). jwk is the JWK as JSON text; see mac-key.export-key-jwk for the package-wide JWK contract. The JWK’s crv must match the declared variant’s curve (error.invalid-key otherwise), and an alg member, when present, must be the curve’s JOSE signature alg ("ES256" for P-256, "ES384" for P-384) — curve-determined, so it does not vary with the variant’s mint-bound hash.

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§