Struct sol_did::state::DidAccount
source · pub struct DidAccount {
pub version: u8,
pub bump: u8,
pub nonce: u64,
pub initial_verification_method: VerificationMethod,
pub verification_methods: Vec<VerificationMethod>,
pub services: Vec<Service>,
pub native_controllers: Vec<Pubkey>,
pub other_controllers: Vec<String>,
}Fields§
§version: u8Version identifier
bump: u8Bump
nonce: u64Nonce, for protecting against replay attacks around secp256k1 signatures.
initial_verification_method: VerificationMethodThe initial authority key, automatically being added to the array of all Verification Methods.
verification_methods: Vec<VerificationMethod>All verification methods
services: Vec<Service>Services
native_controllers: Vec<Pubkey>Controller (native) - did:sol:
other_controllers: Vec<String>Controller (others) - all others
Implementations§
source§impl DidAccount
impl DidAccount
pub fn new(bump: u8, authority_key: &Pubkey) -> Self
pub fn init(
&mut self,
bump: u8,
authority_key: &Pubkey,
flags: VerificationMethodFlags
)
sourcepub fn verification_methods(
&self,
filter_types: Option<&[VerificationMethodType]>,
filter_flags: Option<VerificationMethodFlags>,
filter_key: Option<&[u8]>,
filter_fragment: Option<&String>
) -> Vec<&VerificationMethod> ⓘ
pub fn verification_methods(
&self,
filter_types: Option<&[VerificationMethodType]>,
filter_flags: Option<VerificationMethodFlags>,
filter_key: Option<&[u8]>,
filter_fragment: Option<&String>
) -> Vec<&VerificationMethod> ⓘ
Accessor for all verification methods (including the initial one) Enables to pass several filters that are ANDed together.
sourcepub fn verification_methods_mut(
&mut self,
filter_types: Option<&[VerificationMethodType]>,
filter_flags: Option<VerificationMethodFlags>,
filter_key: Option<&[u8]>,
filter_fragment: Option<&String>
) -> Vec<&mut VerificationMethod> ⓘ
pub fn verification_methods_mut(
&mut self,
filter_types: Option<&[VerificationMethodType]>,
filter_flags: Option<VerificationMethodFlags>,
filter_key: Option<&[u8]>,
filter_fragment: Option<&String>
) -> Vec<&mut VerificationMethod> ⓘ
Accessor for all verification methods (including the initial one) Enables to pass several filters that are ANDed together. Mutable Version
pub fn remove_verification_method(&mut self, fragment: &String) -> Result<()>
pub fn find_verification_method(
&mut self,
fragment: &String
) -> Option<&mut VerificationMethod>
sourcepub fn is_directly_controlled_by(&self, other: &DidAccount) -> bool
pub fn is_directly_controlled_by(&self, other: &DidAccount) -> bool
Returns true if other is a valid controller of this DID
sourcepub fn is_controlled_by(&self, chain: &[Account<'_, DidAccount>]) -> bool
pub fn is_controlled_by(&self, chain: &[Account<'_, DidAccount>]) -> bool
returns true if the controller chain is valid.
The chain must be provided in the following order:
this -> chain[0] -> … -> chain[n]
where ‘->’ represents the relationship “is controlled by”.
NOTE: an empty chain returns true.
pub fn set_services(
&mut self,
services: Vec<Service>,
allow_duplicates: bool
) -> Result<()>
pub fn set_verification_methods(
&mut self,
existing: Vec<VerificationMethod>,
incoming: Vec<VerificationMethod>
) -> Result<()>
pub fn set_native_controllers(
&mut self,
native_controllers: Vec<Pubkey>
) -> Result<()>
pub fn set_other_controllers(
&mut self,
other_controllers: Vec<String>
) -> Result<()>
pub fn try_from(
did_account: &AccountInfo<'_>,
initial_authority: &Pubkey,
did_account_seed_bump: Option<u8>
) -> Result<DidAccount>
pub fn size(&self) -> usize
pub fn initial_size() -> usize
Trait Implementations§
source§impl AccountDeserialize for DidAccount
impl AccountDeserialize for DidAccount
source§fn try_deserialize(buf: &mut &[u8]) -> Result<Self>
fn try_deserialize(buf: &mut &[u8]) -> Result<Self>
Mint account into a token
Account. Read moresource§impl AccountSerialize for DidAccount
impl AccountSerialize for DidAccount
source§impl BorshDeserialize for DidAccountwhere
u8: BorshDeserialize,
u8: BorshDeserialize,
u64: BorshDeserialize,
VerificationMethod: BorshDeserialize,
Vec<VerificationMethod>: BorshDeserialize,
Vec<Service>: BorshDeserialize,
Vec<Pubkey>: BorshDeserialize,
Vec<String>: BorshDeserialize,
impl BorshDeserialize for DidAccountwhere
u8: BorshDeserialize,
u8: BorshDeserialize,
u64: BorshDeserialize,
VerificationMethod: BorshDeserialize,
Vec<VerificationMethod>: BorshDeserialize,
Vec<Service>: BorshDeserialize,
Vec<Pubkey>: BorshDeserialize,
Vec<String>: BorshDeserialize,
source§impl BorshSerialize for DidAccountwhere
u8: BorshSerialize,
u8: BorshSerialize,
u64: BorshSerialize,
VerificationMethod: BorshSerialize,
Vec<VerificationMethod>: BorshSerialize,
Vec<Service>: BorshSerialize,
Vec<Pubkey>: BorshSerialize,
Vec<String>: BorshSerialize,
impl BorshSerialize for DidAccountwhere
u8: BorshSerialize,
u8: BorshSerialize,
u64: BorshSerialize,
VerificationMethod: BorshSerialize,
Vec<VerificationMethod>: BorshSerialize,
Vec<Service>: BorshSerialize,
Vec<Pubkey>: BorshSerialize,
Vec<String>: BorshSerialize,
source§impl Clone for DidAccount
impl Clone for DidAccount
source§fn clone(&self) -> DidAccount
fn clone(&self) -> DidAccount
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more