pub enum WrappedAccountCryptographicState {
V1 {
private_key: EncString,
},
V2 {
private_key: EncString,
signed_public_key: Option<SignedPublicKey>,
signing_key: EncString,
security_state: SignedSecurityState,
},
}Expand description
Any keys / cryptographic protection “downstream” from the account symmetric key (user key). Private keys are protected by the user key.
Variants§
V1
A V1 user has only a private key.
V2
A V2 user has a private key, a signing key, a signed public key and a signed security state. The SignedPublicKey ensures that others can verify the public key is claimed by an identity they want to share data to. The signed security state protects against cryptographic downgrades.
Fields
signed_public_key: Option<SignedPublicKey>The user’s public-key for the private key, signed by the user’s signing key. Note: This is optional for backwards compatibility. After a few releases, this will be made non-optional once all clients store the response on sync.
security_state: SignedSecurityStateThe user’s signed security state.
Implementations§
Source§impl WrappedAccountCryptographicState
impl WrappedAccountCryptographicState
Sourcepub fn to_request_model(
&self,
store: &KeyStore<KeyIds>,
) -> Result<AccountKeysRequestModel, AccountCryptographyInitializationError>
pub fn to_request_model( &self, store: &KeyStore<KeyIds>, ) -> Result<AccountKeysRequestModel, AccountCryptographyInitializationError>
Converts to a AccountKeysRequestModel in order to make API requests. Since the WrappedAccountCryptographicState is encrypted, the key store needs to contain the user key required to unlock this state.
Sourcepub fn make(
ctx: &mut KeyStoreContext<'_, KeyIds>,
user_id: UserId,
) -> Result<(SymmetricKeyId, Self), AccountCryptographyInitializationError>
pub fn make( ctx: &mut KeyStoreContext<'_, KeyIds>, user_id: UserId, ) -> Result<(SymmetricKeyId, Self), AccountCryptographyInitializationError>
Creates a new V2 account cryptographic state with fresh keys. This does not change the user state, but does set some keys to the local context.
Sourcepub(crate) fn set_to_context(
&self,
security_state_rwlock: &RwLock<Option<SecurityState>>,
user_key: SymmetricKeyId,
store: &KeyStore<KeyIds>,
ctx: KeyStoreContext<'_, KeyIds>,
) -> Result<(), AccountCryptographyInitializationError>
pub(crate) fn set_to_context( &self, security_state_rwlock: &RwLock<Option<SecurityState>>, user_key: SymmetricKeyId, store: &KeyStore<KeyIds>, ctx: KeyStoreContext<'_, KeyIds>, ) -> Result<(), AccountCryptographyInitializationError>
Set the decrypted account cryptographic state to the context’s non-local storage.
This needs a mutable context passed in that already has a user_key set to a local key slot,
for which the id is passed in as user_key. Note, that this function drops the context
and clears the existing local state, after persisting it.
Sourcefn verifying_key(
&self,
store: &KeyStore<KeyIds>,
) -> Result<Option<VerifyingKey>, AccountCryptographyInitializationError>
fn verifying_key( &self, store: &KeyStore<KeyIds>, ) -> Result<Option<VerifyingKey>, AccountCryptographyInitializationError>
Retrieve the verifying key from the wrapped state, if present. This requires the user key to be present in the store.
Sourcefn public_key(
&self,
store: &KeyStore<KeyIds>,
) -> Result<Option<AsymmetricPublicCryptoKey>, AccountCryptographyInitializationError>
fn public_key( &self, store: &KeyStore<KeyIds>, ) -> Result<Option<AsymmetricPublicCryptoKey>, AccountCryptographyInitializationError>
Retrieve the public key from the wrapped state, if present. This requires the user key to be present in the store.
Sourcefn signed_public_key(
&self,
) -> Result<Option<&SignedPublicKey>, AccountCryptographyInitializationError>
fn signed_public_key( &self, ) -> Result<Option<&SignedPublicKey>, AccountCryptographyInitializationError>
Retrieve the signed public key from the wrapped state, if present.
Trait Implementations§
Source§impl Clone for WrappedAccountCryptographicState
impl Clone for WrappedAccountCryptographicState
Source§fn clone(&self) -> WrappedAccountCryptographicState
fn clone(&self) -> WrappedAccountCryptographicState
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<UT> ConvertError<UT> for WrappedAccountCryptographicState
impl<UT> ConvertError<UT> for WrappedAccountCryptographicState
fn try_convert_unexpected_callback_error( e: UnexpectedUniFFICallbackError, ) -> Result<Self>
Source§impl<'de> Deserialize<'de> for WrappedAccountCryptographicState
impl<'de> Deserialize<'de> for WrappedAccountCryptographicState
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<UT> FfiConverter<UT> for WrappedAccountCryptographicState
impl<UT> FfiConverter<UT> for WrappedAccountCryptographicState
Source§const TYPE_ID_META: MetadataBuffer
const TYPE_ID_META: MetadataBuffer
Source§type FfiType = RustBuffer
type FfiType = RustBuffer
Source§fn lower(v: Self) -> RustBuffer
fn lower(v: Self) -> RustBuffer
Source§fn try_lift(buf: RustBuffer) -> Result<Self>
fn try_lift(buf: RustBuffer) -> Result<Self>
Source§impl From<WrappedAccountCryptographicState> for JsValue
impl From<WrappedAccountCryptographicState> for JsValue
Source§fn from(value: WrappedAccountCryptographicState) -> Self
fn from(value: WrappedAccountCryptographicState) -> Self
Source§impl FromWasmAbi for WrappedAccountCryptographicStatewhere
Self: DeserializeOwned,
impl FromWasmAbi for WrappedAccountCryptographicStatewhere
Self: DeserializeOwned,
Source§impl<UT> Lift<UT> for WrappedAccountCryptographicState
impl<UT> Lift<UT> for WrappedAccountCryptographicState
Source§impl<UT> LiftRef<UT> for WrappedAccountCryptographicState
impl<UT> LiftRef<UT> for WrappedAccountCryptographicState
Source§impl<UT> LiftReturn<UT> for WrappedAccountCryptographicState
impl<UT> LiftReturn<UT> for WrappedAccountCryptographicState
Source§type ReturnType = <WrappedAccountCryptographicState as Lift<UT>>::FfiType
type ReturnType = <WrappedAccountCryptographicState as Lift<UT>>::FfiType
Source§fn try_lift_successful_return(v: Self::ReturnType) -> Result<Self>
fn try_lift_successful_return(v: Self::ReturnType) -> Result<Self>
§fn lift_foreign_return(
ffi_return: Self::ReturnType,
call_status: RustCallStatus,
) -> Self
fn lift_foreign_return( ffi_return: Self::ReturnType, call_status: RustCallStatus, ) -> Self
§fn lift_error(_buf: RustBuffer) -> Self
fn lift_error(_buf: RustBuffer) -> Self
§fn handle_callback_unexpected_error(e: UnexpectedUniFFICallbackError) -> Self
fn handle_callback_unexpected_error(e: UnexpectedUniFFICallbackError) -> Self
Source§impl<UT> Lower<UT> for WrappedAccountCryptographicState
impl<UT> Lower<UT> for WrappedAccountCryptographicState
Source§impl<UT> LowerError<UT> for WrappedAccountCryptographicState
impl<UT> LowerError<UT> for WrappedAccountCryptographicState
Source§fn lower_error(obj: Self) -> RustBuffer
fn lower_error(obj: Self) -> RustBuffer
Source§impl<UT> LowerReturn<UT> for WrappedAccountCryptographicState
impl<UT> LowerReturn<UT> for WrappedAccountCryptographicState
Source§type ReturnType = <WrappedAccountCryptographicState as Lower<UT>>::FfiType
type ReturnType = <WrappedAccountCryptographicState as Lower<UT>>::FfiType
Source§fn lower_return(v: Self) -> Result<Self::ReturnType, RustCallError>
fn lower_return(v: Self) -> Result<Self::ReturnType, RustCallError>
§fn handle_failed_lift(
error: LiftArgsError,
) -> Result<Self::ReturnType, RustCallError>
fn handle_failed_lift( error: LiftArgsError, ) -> Result<Self::ReturnType, RustCallError>
Source§impl OptionFromWasmAbi for WrappedAccountCryptographicStatewhere
Self: DeserializeOwned,
impl OptionFromWasmAbi for WrappedAccountCryptographicStatewhere
Self: DeserializeOwned,
Source§impl RefFromWasmAbi for WrappedAccountCryptographicStatewhere
Self: DeserializeOwned,
impl RefFromWasmAbi for WrappedAccountCryptographicStatewhere
Self: DeserializeOwned,
Source§type Abi = <JsType as RefFromWasmAbi>::Abi
type Abi = <JsType as RefFromWasmAbi>::Abi
Self are recovered from.Source§type Anchor = SelfOwner<WrappedAccountCryptographicState>
type Anchor = SelfOwner<WrappedAccountCryptographicState>
Self for the duration of the
invocation of the function that has an &Self parameter. This is
required to ensure that the lifetimes don’t persist beyond one function
call, and so that they remain anonymous.Source§impl Tsify for WrappedAccountCryptographicState
impl Tsify for WrappedAccountCryptographicState
const DECL: &'static str = "/**\n * Any keys / cryptographic protection \\\"downstream\\\" from the account symmetric key (user key).\n * Private keys are protected by the user key.\n */\nexport type WrappedAccountCryptographicState = { V1: { private_key: EncString } } | { V2: { private_key: EncString; signed_public_key: SignedPublicKey | undefined; signing_key: EncString; security_state: SignedSecurityState } };"
const SERIALIZATION_CONFIG: SerializationConfig
type JsType = JsType
fn into_js(&self) -> Result<Self::JsType, Error>where
Self: Serialize,
fn from_js<T>(js: T) -> Result<Self, Error>
Source§impl<UT> TypeId<UT> for WrappedAccountCryptographicState
impl<UT> TypeId<UT> for WrappedAccountCryptographicState
const TYPE_ID_META: MetadataBuffer
Source§impl VectorFromWasmAbi for WrappedAccountCryptographicStatewhere
Self: DeserializeOwned,
impl VectorFromWasmAbi for WrappedAccountCryptographicStatewhere
Self: DeserializeOwned,
type Abi = <JsType as VectorFromWasmAbi>::Abi
unsafe fn vector_from_abi(js: Self::Abi) -> Box<[Self]>
Source§impl VectorIntoWasmAbi for WrappedAccountCryptographicState
impl VectorIntoWasmAbi for WrappedAccountCryptographicState
type Abi = <JsType as VectorIntoWasmAbi>::Abi
fn vector_into_abi(vector: Box<[Self]>) -> Self::Abi
Auto Trait Implementations§
impl Freeze for WrappedAccountCryptographicState
impl RefUnwindSafe for WrappedAccountCryptographicState
impl Send for WrappedAccountCryptographicState
impl Sync for WrappedAccountCryptographicState
impl Unpin for WrappedAccountCryptographicState
impl UnwindSafe for WrappedAccountCryptographicState
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
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,
§impl<T> CompatExt for T
impl<T> CompatExt for T
§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
§unsafe fn consume_handle(handle: Handle) -> Arc<T>
unsafe fn consume_handle(handle: Handle) -> Arc<T>
Arc<> Read more§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
IntoWasmAbi::AbiSource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.