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: &[DidAccount]) -> bool
pub fn is_controlled_by(&self, chain: &[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.Source§fn try_deserialize_unchecked(buf: &mut &[u8]) -> Result<Self>
fn try_deserialize_unchecked(buf: &mut &[u8]) -> Result<Self>
Source§impl AccountSerialize for DidAccount
impl AccountSerialize for DidAccount
Source§impl BorshDeserialize for DidAccount
impl BorshDeserialize for DidAccount
Source§impl BorshSerialize for DidAccount
impl BorshSerialize for DidAccount
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 moreSource§impl Default for DidAccount
impl Default for DidAccount
Source§impl Discriminator for DidAccount
impl Discriminator for DidAccount
const DISCRIMINATOR: [u8; 8]
fn discriminator() -> [u8; 8]
Source§impl Display for DidAccount
impl Display for DidAccount
Auto Trait Implementations§
impl Freeze for DidAccount
impl RefUnwindSafe for DidAccount
impl Send for DidAccount
impl Sync for DidAccount
impl Unpin for DidAccount
impl UnwindSafe for DidAccount
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more