pub struct JsSignedBytes { /* private fields */ }
Expand description
Binary data signed by a multicipher key.
Implementations§
Source§impl JsSignedBytes
impl JsSignedBytes
Sourcepub fn new(
public_key: &JsMPublicKey,
content: &[u8],
signature: &JsMSignature,
) -> Result<JsSignedBytes, JsValue>
pub fn new( public_key: &JsMPublicKey, content: &[u8], signature: &JsMSignature, ) -> Result<JsSignedBytes, JsValue>
Create {@link SignedBytes} from its parts.
Sourcepub fn public_key(&self) -> JsMPublicKey
pub fn public_key(&self) -> JsMPublicKey
Accessor of the {@link PublicKey} that signed the binary data.
Sourcepub fn signature(&self) -> JsMSignature
pub fn signature(&self) -> JsMSignature
Accessor of the {@link Signature}.
Sourcepub fn validate(&self) -> bool
pub fn validate(&self) -> bool
Verify if {@link signature} was made by the private key that belongs to {@link publicKey} on the {@link content}.
Sourcepub fn validate_with_keyid(&self, signer_id: &JsMKeyId) -> bool
pub fn validate_with_keyid(&self, signer_id: &JsMKeyId) -> bool
Not only validate the signature, but also check if the provided {@link KeyId} was made from {@link publicKey}.
@see validate
Sourcepub fn validate_with_did_doc(
&self,
did_doc_str: &str,
from_height_inc: Option<u32>,
until_height_exc: Option<u32>,
) -> Result<JsValue, JsValue>
pub fn validate_with_did_doc( &self, did_doc_str: &str, from_height_inc: Option<u32>, until_height_exc: Option<u32>, ) -> Result<JsValue, JsValue>
Not only validate the signature, but also check the signing key had impersonation right the whole time period specified by the optional upper and lower block height boundaries. The DID document serialized as a string provides the whole history of key rights, so depending on the use-case there are three possible outcomes:
- The signing key had impersonation right the whole time and the signature is valid (green)
- Cannot prove if the signing key had impersonation right the whole time, but no other issues found (yellow)
- The signature is invalid or we can prove the signing key did not have impersonation right at any point in the given time interval (red)
The return value is a {@link ValidationResult}
Trait Implementations§
Source§impl From<JsSignedBytes> for JsValue
impl From<JsSignedBytes> for JsValue
Source§fn from(value: JsSignedBytes) -> JsValue
fn from(value: JsSignedBytes) -> JsValue
Source§impl FromWasmAbi for JsSignedBytes
impl FromWasmAbi for JsSignedBytes
Source§impl IntoWasmAbi for JsSignedBytes
impl IntoWasmAbi for JsSignedBytes
Source§impl LongRefFromWasmAbi for JsSignedBytes
impl LongRefFromWasmAbi for JsSignedBytes
Source§type Anchor = RcRef<JsSignedBytes>
type Anchor = RcRef<JsSignedBytes>
RefFromWasmAbi::Anchor
Source§unsafe fn long_ref_from_abi(
js: <JsSignedBytes as LongRefFromWasmAbi>::Abi,
) -> <JsSignedBytes as LongRefFromWasmAbi>::Anchor
unsafe fn long_ref_from_abi( js: <JsSignedBytes as LongRefFromWasmAbi>::Abi, ) -> <JsSignedBytes as LongRefFromWasmAbi>::Anchor
RefFromWasmAbi::ref_from_abi
Source§impl OptionFromWasmAbi for JsSignedBytes
impl OptionFromWasmAbi for JsSignedBytes
Source§fn is_none(abi: &<JsSignedBytes as FromWasmAbi>::Abi) -> bool
fn is_none(abi: &<JsSignedBytes as FromWasmAbi>::Abi) -> bool
None
, and otherwise it will be passed to
FromWasmAbi
.Source§impl OptionIntoWasmAbi for JsSignedBytes
impl OptionIntoWasmAbi for JsSignedBytes
Source§fn none() -> <JsSignedBytes as IntoWasmAbi>::Abi
fn none() -> <JsSignedBytes as IntoWasmAbi>::Abi
None
branch of this option. Read moreSource§impl RefFromWasmAbi for JsSignedBytes
impl RefFromWasmAbi for JsSignedBytes
Source§type Anchor = RcRef<JsSignedBytes>
type Anchor = RcRef<JsSignedBytes>
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§unsafe fn ref_from_abi(
js: <JsSignedBytes as RefFromWasmAbi>::Abi,
) -> <JsSignedBytes as RefFromWasmAbi>::Anchor
unsafe fn ref_from_abi( js: <JsSignedBytes as RefFromWasmAbi>::Abi, ) -> <JsSignedBytes as RefFromWasmAbi>::Anchor
Source§impl RefMutFromWasmAbi for JsSignedBytes
impl RefMutFromWasmAbi for JsSignedBytes
Source§type Anchor = RcRefMut<JsSignedBytes>
type Anchor = RcRefMut<JsSignedBytes>
RefFromWasmAbi::Anchor
Source§unsafe fn ref_mut_from_abi(
js: <JsSignedBytes as RefMutFromWasmAbi>::Abi,
) -> <JsSignedBytes as RefMutFromWasmAbi>::Anchor
unsafe fn ref_mut_from_abi( js: <JsSignedBytes as RefMutFromWasmAbi>::Abi, ) -> <JsSignedBytes as RefMutFromWasmAbi>::Anchor
RefFromWasmAbi::ref_from_abi
Source§impl TryFromJsValue for JsSignedBytes
impl TryFromJsValue for JsSignedBytes
Source§fn try_from_js_value(
value: JsValue,
) -> Result<JsSignedBytes, <JsSignedBytes as TryFromJsValue>::Error>
fn try_from_js_value( value: JsValue, ) -> Result<JsSignedBytes, <JsSignedBytes as TryFromJsValue>::Error>
Source§impl VectorFromWasmAbi for JsSignedBytes
impl VectorFromWasmAbi for JsSignedBytes
type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi
unsafe fn vector_from_abi( js: <JsSignedBytes as VectorFromWasmAbi>::Abi, ) -> Box<[JsSignedBytes]>
Source§impl VectorIntoWasmAbi for JsSignedBytes
impl VectorIntoWasmAbi for JsSignedBytes
type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi
fn vector_into_abi( vector: Box<[JsSignedBytes]>, ) -> <JsSignedBytes as VectorIntoWasmAbi>::Abi
Auto Trait Implementations§
impl Freeze for JsSignedBytes
impl RefUnwindSafe for JsSignedBytes
impl Send for JsSignedBytes
impl Sync for JsSignedBytes
impl Unpin for JsSignedBytes
impl UnwindSafe for JsSignedBytes
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
.