macro_rules! key_ids {
( $(
#[$meta_type:tt]
$vis:vis enum $name:ident {
$(
$( #[$variant_tag:tt] )?
$variant:ident $( ( $inner:ty ) )?
),*
$(,)?
}
)+
$ids_vis:vis $ids_name:ident => $symm_name:ident, $asymm_name:ident;
) => { ... };
( @key_type symmetric ) => { ... };
( @key_type asymmetric ) => { ... };
( @variant_match $variant:ident ( $inner:ty ) ) => { ... };
( @variant_match $variant:ident ) => { ... };
( @variant_value local ) => { ... };
( @variant_value ) => { ... };
}
Expand description
Just a small derive_like macro that can be used to generate the key identifier enums. Example usage:
use bitwarden_crypto::key_ids;
key_ids! {
#[symmetric]
pub enum SymmKeyId {
User,
Org(uuid::Uuid),
#[local]
Local(&'static str),
}
#[asymmetric]
pub enum AsymmKeyId {
PrivateKey,
}
pub Ids => SymmKeyId, AsymmKeyId;
}