Enum dcl_crypto::chain::AuthLink
source · pub enum AuthLink {
Signer {
payload: Address,
signature: String,
},
EcdsaPersonalEphemeral {
payload: EphemeralPayload,
signature: PersonalSignature,
},
EcdsaPersonalSignedEntity {
payload: String,
signature: PersonalSignature,
},
EcdsaEip1654Ephemeral {
payload: EphemeralPayload,
signature: EIP1271Signature,
},
EcdsaEip1654SignedEntity {
payload: String,
signature: EIP1271Signature,
},
}
Expand description
Representation of each link on an auth chain
use dcl_crypto::account::Address;
use dcl_crypto::chain::AuthLink;
let signer = AuthLink::parse(r#"{"type": "SIGNER","payload": "0x3f17f1962b36e491b30a40b2405849e597ba5fb5","signature": ""}"#).unwrap();
let expected = AuthLink::signer(Address::try_from("0x3f17f1962b36e491b30a40b2405849e597ba5fb5").unwrap());
assert_eq!(signer, expected);
use dcl_crypto::account::{Address, PersonalSignature, EphemeralPayload};
use dcl_crypto::chain::AuthLink;
let personal_ephemeral = AuthLink::parse(r#"{"type":"ECDSA_EPHEMERAL","payload":"Decentraland Login\nEphemeral address: 0x612f2657CE738799056051aB09926cE806CcDa0E\nExpiration: 2023-05-02T23:06:21.135Z","signature":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c5"}"#).unwrap();
let expected = AuthLink::EcdsaPersonalEphemeral{
payload: EphemeralPayload::try_from("Decentraland Login\nEphemeral address: 0x612f2657CE738799056051aB09926cE806CcDa0E\nExpiration: 2023-05-02T23:06:21.135Z").unwrap(),
signature: PersonalSignature::try_from("0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c5").unwrap(),
};
assert_eq!(personal_ephemeral, expected);
Variants§
Signer
EcdsaPersonalEphemeral
EcdsaPersonalSignedEntity
EcdsaEip1654Ephemeral
EcdsaEip1654SignedEntity
Implementations§
Trait Implementations§
source§impl<'de> Deserialize<'de> for AuthLink
impl<'de> Deserialize<'de> for AuthLink
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>,
Deserialize this value from the given Serde deserializer. Read more
source§impl PartialEq for AuthLink
impl PartialEq for AuthLink
impl StructuralPartialEq for AuthLink
Auto Trait Implementations§
impl RefUnwindSafe for AuthLink
impl Send for AuthLink
impl Sync for AuthLink
impl Unpin for AuthLink
impl UnwindSafe for AuthLink
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
Mutably borrows from an owned value. Read more