pub struct JsMorpheusOperationBuilder { /* private fields */ }
Expand description
Builder for operations on a given DID. These operations can be later added to a {@link MorpheusOperationSigner} even for different DIDs, so the operations can be signed by a multicipher {@link PrivateKey} that has update rights on these DIDs.
Implementations§
Source§impl JsMorpheusOperationBuilder
impl JsMorpheusOperationBuilder
Sourcepub fn new(
did: &str,
last_tx_id: JsValue,
) -> Result<JsMorpheusOperationBuilder, JsValue>
pub fn new( did: &str, last_tx_id: JsValue, ) -> Result<JsMorpheusOperationBuilder, JsValue>
Create an operation builder acting on a given state of a given DID. The last transaction ID that successfully altered
the DID on-chain can be queried on the blockchain that the SSI transaction will be sent to. If no transactions modified the
implicit DID document yet, this parameter must be null
.
Sourcepub fn add_key(
&self,
authentication: &str,
expires_at_height: JsValue,
) -> Result<JsMorpheusSignableOperation, JsValue>
pub fn add_key( &self, authentication: &str, expires_at_height: JsValue, ) -> Result<JsMorpheusSignableOperation, JsValue>
Create an add key operation. The key can be a {@link KeyId} or a {@link PublicKey} serialized into a string. The expiration can
be left null
, or it can be a block height, when the key is automatically revoked on-chain without a new transaction sent in.
The same key cannot be added when it has not been revoked or before has expired, even if one addition uses an identifier of the key, and the other addition uses the public key. But the key can be re-added after it has expired or been revoked from the DID.
Sourcepub fn revoke_key(
&self,
authentication: &str,
) -> Result<JsMorpheusSignableOperation, JsValue>
pub fn revoke_key( &self, authentication: &str, ) -> Result<JsMorpheusSignableOperation, JsValue>
Create a revoke key operation. A key cannot be revoked if it was not added or has already been revoked or has expired.
Sourcepub fn add_right(
&self,
authentication: &str,
right: &str,
) -> Result<JsMorpheusSignableOperation, JsValue>
pub fn add_right( &self, authentication: &str, right: &str, ) -> Result<JsMorpheusSignableOperation, JsValue>
Add a given right to a key. ‘impersonate’ or ‘update’ are the only choices yet. Cannot add a right to a key that has not yet been added to the DID document. Cannot add a right if it was already granted to the key on this DID.
@see SystemRights
Sourcepub fn revoke_right(
&self,
authentication: &str,
right: &str,
) -> Result<JsMorpheusSignableOperation, JsValue>
pub fn revoke_right( &self, authentication: &str, right: &str, ) -> Result<JsMorpheusSignableOperation, JsValue>
Revoke a given right from a key. ‘impersonate’ or ‘update’ are the only choices yet. Cannot revoke a right to a key that has not yet been added to the DID document. Cannot revoke a right if it was not yet granted to the key on this DID.
@see SystemRights
Sourcepub fn tombstone_did(&self) -> Result<JsMorpheusSignableOperation, JsValue>
pub fn tombstone_did(&self) -> Result<JsMorpheusSignableOperation, JsValue>
Tombstone a DID. All keys and rights are effectively revoked, and the DID cannot be altered any further.
Trait Implementations§
Source§impl From<JsMorpheusOperationBuilder> for JsValue
impl From<JsMorpheusOperationBuilder> for JsValue
Source§fn from(value: JsMorpheusOperationBuilder) -> Self
fn from(value: JsMorpheusOperationBuilder) -> Self
Source§impl RefFromWasmAbi for JsMorpheusOperationBuilder
impl RefFromWasmAbi for JsMorpheusOperationBuilder
Source§type Anchor = RcRef<JsMorpheusOperationBuilder>
type Anchor = RcRef<JsMorpheusOperationBuilder>
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 VectorFromWasmAbi for JsMorpheusOperationBuilder
impl VectorFromWasmAbi for JsMorpheusOperationBuilder
type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi
unsafe fn vector_from_abi(js: Self::Abi) -> Box<[JsMorpheusOperationBuilder]>
Source§impl VectorIntoJsValue for JsMorpheusOperationBuilder
impl VectorIntoJsValue for JsMorpheusOperationBuilder
fn vector_into_jsvalue(vector: Box<[JsMorpheusOperationBuilder]>) -> JsValue
Source§impl VectorIntoWasmAbi for JsMorpheusOperationBuilder
impl VectorIntoWasmAbi for JsMorpheusOperationBuilder
type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi
fn vector_into_abi(vector: Box<[JsMorpheusOperationBuilder]>) -> Self::Abi
Source§impl WasmDescribeVector for JsMorpheusOperationBuilder
impl WasmDescribeVector for JsMorpheusOperationBuilder
impl SupportsConstructor for JsMorpheusOperationBuilder
impl SupportsInstanceProperty for JsMorpheusOperationBuilder
impl SupportsStaticProperty for JsMorpheusOperationBuilder
Auto Trait Implementations§
impl Freeze for JsMorpheusOperationBuilder
impl RefUnwindSafe for JsMorpheusOperationBuilder
impl Send for JsMorpheusOperationBuilder
impl Sync for JsMorpheusOperationBuilder
impl Unpin for JsMorpheusOperationBuilder
impl UnwindSafe for JsMorpheusOperationBuilder
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> 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::Abi
Source§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
.