pub struct AuthToken(/* private fields */);
Expand description
Authorization token used for controlling the destructible memory cell access.
Authorization token is defined together with a destructible memory cell, as a part of the operation output.
When the destructible cell is being accessed by another operation as a part of its input, the
token value is put into the virtual machine register E1
.
Then, it can be used by the codex validating a script alongside the witness value, which is a
part of the operation input data.
§Examples of use
One possible simplified scenario for the use of authorization token is the fact that the token provides a hash of a certain value; and the operation destroying the memory cell provides a preimage of the hash as a part of the input witness; and the validation script checks the preimage against the hash.
More complex scenarios involve single-use seals; the authorization token in this case represents a hash of (a commitment to) a single-use seal definition, and during the memory cell access the operation destroying that cell (“spending operation”) needs to prove that it has properly closed that single-use seal over the commitment to the spending operation. This scenario is implemented in the RGB smart contract system.
Implementations§
Source§impl AuthToken
impl AuthToken
Sourcepub const fn to_fe256(&self) -> fe256
pub const fn to_fe256(&self) -> fe256
Get a representation of a authorization token as a 256-bit field element.
Sourcepub fn from_byte_array(bytes: [u8; 30]) -> AuthToken
pub fn from_byte_array(bytes: [u8; 30]) -> AuthToken
Construct the token out of 30 bytes of raw data.
Sourcepub fn to_byte_array(&self) -> [u8; 30]
pub fn to_byte_array(&self) -> [u8; 30]
Convert the token to 30 bytes of raw data.
Sourcepub fn to_bytes30(&self) -> Array<u8, 30>
pub fn to_bytes30(&self) -> Array<u8, 30>
Convert the token to 30 bytes blob.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for AuthToken
impl<'de> Deserialize<'de> for AuthToken
Source§fn deserialize<D>(
deserializer: D,
) -> Result<AuthToken, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<AuthToken, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Source§impl DisplayBaid64<30> for AuthToken
impl DisplayBaid64<30> for AuthToken
const HRI: &'static str = "at"
const CHUNKING: bool = true
const CHUNK_FIRST: usize = 8usize
const CHUNK_LEN: usize = 8usize
const PREFIX: bool = true
const EMBED_CHECKSUM: bool = true
const MNEMONIC: bool = false
fn to_baid64_payload(&self) -> [u8; 30]
fn to_baid64_string(&self) -> String
fn to_baid64_mnemonic(&self) -> String
fn display_baid64(&self) -> Baid64Display<LEN>
fn fmt_baid64(&self, f: &mut Formatter<'_>) -> Result<(), Error>
Source§impl FromBaid64Str<30> for AuthToken
impl FromBaid64Str<30> for AuthToken
fn from_baid64_str(s: &str) -> Result<Self, Baid64ParseError>
Source§impl Ord for AuthToken
impl Ord for AuthToken
Source§impl PartialOrd for AuthToken
impl PartialOrd for AuthToken
Source§impl Serialize for AuthToken
impl Serialize for AuthToken
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Source§impl StrictDecode for AuthToken
impl StrictDecode for AuthToken
fn strict_decode(reader: &mut impl TypedRead) -> Result<AuthToken, DecodeError>
fn strict_read(reader: impl ReadRaw) -> Result<Self, DecodeError>
Source§impl StrictDumb for AuthToken
impl StrictDumb for AuthToken
fn strict_dumb() -> AuthToken
Source§impl StrictEncode for AuthToken
impl StrictEncode for AuthToken
fn strict_encode<W>(&self, writer: W) -> Result<W, Error>where
W: TypedWrite,
fn strict_write(&self, writer: impl WriteRaw) -> Result<(), Error>
Source§impl StrictTuple for AuthToken
impl StrictTuple for AuthToken
const FIELD_COUNT: u8 = 1u8
fn strict_check_fields()
fn strict_type_info() -> TypeInfo<Self>
Source§impl StrictType for AuthToken
impl StrictType for AuthToken
const STRICT_LIB_NAME: &'static str = LIB_NAME_ULTRASONIC
fn strict_name() -> Option<TypeName>
impl Copy for AuthToken
impl Eq for AuthToken
impl StrictProduct for AuthToken
impl StructuralPartialEq for AuthToken
Auto Trait Implementations§
impl Freeze for AuthToken
impl RefUnwindSafe for AuthToken
impl Send for AuthToken
impl Sync for AuthToken
impl Unpin for AuthToken
impl UnwindSafe for AuthToken
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<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.