pub struct SigninInput(/* private fields */);Expand description
The Sign In input used as parameters when performing
SignInWithSolana (SIWS) requests as defined by the
SIWS standard.
A backup fork can be found at https://github.com/JamiiDao/sign-in-with-solana
Implementations§
Source§impl SigninInput
impl SigninInput
Sourcepub fn set_domain(&mut self, window: &Window) -> WalletResult<&mut Self>
pub fn set_domain(&mut self, window: &Window) -> WalletResult<&mut Self>
An EIP-4361 domain requesting the sign-in. If not provided, the wallet must determine the domain to include in the message. Sets the domain name by fetching the details from window.location().host() .
Sourcepub fn set_custom_domain(&mut self, domain: &str) -> &mut Self
pub fn set_custom_domain(&mut self, domain: &str) -> &mut Self
An EIP-4361 domain requesting the sign-in. If not provided, the wallet must determine the domain to include in the message. Sets a custom domain name instead of fetching from window.location().host()
Sourcepub fn set_address(&mut self, address: &str) -> WalletResult<&mut Self>
pub fn set_address(&mut self, address: &str) -> WalletResult<&mut Self>
The Base58 public key address
NOTE: Some wallets require this field or
an error MessageResponseMismatch which is as
a result of the sent message not corresponding with the signed message
Sourcepub fn set_statement(&mut self, statement: &str) -> &mut Self
pub fn set_statement(&mut self, statement: &str) -> &mut Self
An EIP-4361 Statement which is a human readable string and should not have new-line characters (\n). Sets the message that is shown to the user during Sign In With Solana
Sourcepub fn set_uri(&mut self, window: &Window) -> WalletResult<&mut Self>
pub fn set_uri(&mut self, window: &Window) -> WalletResult<&mut Self>
An EIP-4361 URI is automatically set to the window.location.href
since if it is not the same, the wallet will ignore it and
show the user an error.
This is the URL that is requesting the sign-in.
Sourcepub fn set_version(&mut self, version: &str) -> &mut Self
pub fn set_version(&mut self, version: &str) -> &mut Self
An EIP-4361 version. Sets the version
Sourcepub fn set_chain_id(&mut self, cluster: Cluster) -> &mut Self
pub fn set_chain_id(&mut self, cluster: Cluster) -> &mut Self
An EIP-4361 Chain ID. The chainId can be one of the following: mainnet, testnet, devnet, localnet, solana:mainnet, solana:testnet, solana:devnet.
Sourcepub fn set_nonce(&mut self) -> &mut Self
pub fn set_nonce(&mut self) -> &mut Self
An EIP-4361 Nonce which is an alphanumeric string containing a minimum of 8 characters. This is generated from the Cryptographically Secure Random Number Generator and the bytes converted to hex formatted string.
Sourcepub fn custom_nonce(&mut self, nonce: &str) -> WalletResult<&mut Self>
pub fn custom_nonce(&mut self, nonce: &str) -> WalletResult<&mut Self>
An EIP-4361 Nonce which is an alphanumeric string containing a minimum of 8 characters. This is generated from the Cryptographically Secure Random Number Generator and the bytes converted to hex formatted string.
Sourcepub fn time_now() -> WalletResult<SystemTime>
pub fn time_now() -> WalletResult<SystemTime>
Fetches the time from JavaScript Date Now . This is converted to SystemTime
Sourcepub fn set_issued_at(&mut self) -> WalletResult<&mut Self>
pub fn set_issued_at(&mut self) -> WalletResult<&mut Self>
This represents the time at which the sign-in request was issued to the wallet. Note: For Phantom, issuedAt has a threshold and it should be within +- 10 minutes from the timestamp at which verification is taking place. If not provided, the wallet does not include Issued At in the message. This also follows the ISO 8601 datetime.
Sourcepub fn set_expiration_time_millis(
&mut self,
expiration_time_milliseconds: u64,
) -> WalletResult<&mut Self>
pub fn set_expiration_time_millis( &mut self, expiration_time_milliseconds: u64, ) -> WalletResult<&mut Self>
An ergonomic method for Self::set_expiration_time() where you can add milliseconds and SystemTime is automatically calculated for you
Sourcepub fn set_expiration_time_seconds(
&mut self,
expiration_time_seconds: u64,
) -> WalletResult<&mut Self>
pub fn set_expiration_time_seconds( &mut self, expiration_time_seconds: u64, ) -> WalletResult<&mut Self>
An ergonomic method for Self::set_expiration_time() where you can add seconds and SystemTime is automatically calculated for you
Sourcepub fn set_expiration_time(
&mut self,
expiration_time: SystemTime,
) -> WalletResult<&mut Self>
pub fn set_expiration_time( &mut self, expiration_time: SystemTime, ) -> WalletResult<&mut Self>
An ISO 8601 datetime string. This represents the time at which the sign-in request should expire. If not provided, the wallet does not include Expiration Time in the message. Expiration time should be in future or an error will be thrown even before a request to the wallet is sent
Sourcepub fn set_not_before_time_millis(
&mut self,
expiration_time_milliseconds: u64,
) -> WalletResult<&mut Self>
pub fn set_not_before_time_millis( &mut self, expiration_time_milliseconds: u64, ) -> WalletResult<&mut Self>
An ergonomic method for Self::set_not_before_time() where you can add milliseconds and SystemTime is automatically calculated for you
Sourcepub fn set_not_before_time_seconds(
&mut self,
expiration_time_seconds: u64,
) -> WalletResult<&mut Self>
pub fn set_not_before_time_seconds( &mut self, expiration_time_seconds: u64, ) -> WalletResult<&mut Self>
An ergonomic method for Self::set_not_before_time() where you can add seconds and SystemTime is automatically calculated for you
Sourcepub fn set_not_before_time(
&mut self,
not_before: SystemTime,
) -> WalletResult<&mut Self>
pub fn set_not_before_time( &mut self, not_before: SystemTime, ) -> WalletResult<&mut Self>
An ISO 8601 datetime string.
This represents the time at which the sign-in request becomes valid.
If not provided, the wallet does not include Not Before in the message.
Time must be after IssuedTime
Sourcepub fn get_object(&self) -> WalletResult<JsValue>
pub fn get_object(&self) -> WalletResult<JsValue>
Converts Self to a JsValue to pass to the wallet where it’s internal representation is a js_sys::Object
Sourcepub fn set_request_id(&mut self, id: &str) -> &mut Self
pub fn set_request_id(&mut self, id: &str) -> &mut Self
An EIP-4361 Request ID. In addition to using nonce to avoid replay attacks, dapps can also choose to include a unique signature in the requestId . Once the wallet returns the signed message, dapps can then verify this signature against the state to add an additional, strong layer of security. If not provided, the wallet must not include Request ID in the message.
Sourcepub fn add_resource(&mut self, resource: &str) -> &mut Self
pub fn add_resource(&mut self, resource: &str) -> &mut Self
An EIP-4361 Resources. Usually a list of references in the form of URIs that the dapp wants the user to be aware of. These URIs should be separated by \n-, ie, URIs in new lines starting with the character -. If not provided, the wallet must not include Resources in the message.
Sourcepub fn add_resources(&mut self, resources: &[&str]) -> &mut Self
pub fn add_resources(&mut self, resources: &[&str]) -> &mut Self
Helper for Self::add_resource() when you want to add multiple resources at the same time
Sourcepub fn issued_at(&self) -> Option<&SystemTime>
pub fn issued_at(&self) -> Option<&SystemTime>
Get the issued_at field
Sourcepub fn expiration_time(&self) -> Option<&SystemTime>
pub fn expiration_time(&self) -> Option<&SystemTime>
Get the expiration_time field
Sourcepub fn not_before(&self) -> Option<&SystemTime>
pub fn not_before(&self) -> Option<&SystemTime>
Get the not_before field
Sourcepub fn issued_at_iso8601(&self) -> Option<String>
pub fn issued_at_iso8601(&self) -> Option<String>
Get the issued_at field as ISO8601 date time string
Sourcepub fn expiration_time_iso8601(&self) -> Option<String>
pub fn expiration_time_iso8601(&self) -> Option<String>
Get the expiration_time field as ISO8601 date time string
Sourcepub fn not_before_iso8601(&self) -> Option<String>
pub fn not_before_iso8601(&self) -> Option<String>
Get the not_before field as ISO8601 date time string
Sourcepub fn request_id(&self) -> Option<&String>
pub fn request_id(&self) -> Option<&String>
Get the request_id field
Trait Implementations§
Source§impl Clone for SigninInput
impl Clone for SigninInput
Source§fn clone(&self) -> SigninInput
fn clone(&self) -> SigninInput
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more