referrerpolicy=no-referrer-when-downgrade
polkadot_sdk_frame::traits

Trait OpaqueKeys

pub trait OpaqueKeys: Clone {
    type KeyTypeIdProviders;

    // Required methods
    fn key_ids() -> &'static [KeyTypeId];
    fn get_raw(&self, i: KeyTypeId) -> &[u8] ;

    // Provided methods
    fn get<T>(&self, i: KeyTypeId) -> Option<T>
       where T: Decode { ... }
    fn ownership_proof_is_valid(&self, _proof: &[u8]) -> bool { ... }
}
Expand description

Opaque data type that may be destructured into a series of raw byte slices (which represent individual keys).

Required Associated Types§

type KeyTypeIdProviders

Types bound to this opaque keys that provide the key type ids returned.

Required Methods§

fn key_ids() -> &'static [KeyTypeId]

Return the key-type IDs supported by this set.

fn get_raw(&self, i: KeyTypeId) -> &[u8]

Get the raw bytes of key with key-type ID i.

Provided Methods§

fn get<T>(&self, i: KeyTypeId) -> Option<T>
where T: Decode,

Get the decoded key with key-type ID i.

fn ownership_proof_is_valid(&self, _proof: &[u8]) -> bool

Verify a proof of ownership for the keys.

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§