NearApi.Wallet.RequestSignin (near_api v0.1.6)
Request Signin struct
Link to this section Summary
Functions
Wallet sign in URL builder
Params are:
contract_id
- address of the wallet where smart contract in deployed
method_names
- list of all smart contract methods we need to give access
success_url
- redirect URL when successful login
failure_url
- redirect URL when failed login
Link to this section Types
Specs
Link to this section Functions
build_url(params, wallet_base_url)
Specs
build_url(params :: map(), net :: atom() | String.t()) :: {url :: String.t(), key_pair :: NearApi.KeyPair.t()}
Wallet sign in URL builder
Params are:
contract_id
- address of the wallet where smart contract in deployed
method_names
- list of all smart contract methods we need to give access
success_url
- redirect URL when successful login
failure_url
- redirect URL when failed login
Function returns a tuple with sign in url and a key pair generated for creating smart contract access, e.g.:
{
"https://wallet.testnet.near.org/login?contract_id=smart_contract_address.testnet&failure_url=https%3A%2F%2Ffailure_url.com&public_key=336ttyrZRPSKSWESkbRx6fBe3DUEP1MMbJHMQ3Es9Cex&success_url=https%3A%2F%2Fsuccess_url.com",
%NearApi.KeyPair{
public_key: %NearApi.PublicKey{
data: <<public key bitstring here>>,
key_type: 0
},
secret_key: "secret key string here, Base58 encoded"
}
}
Function generates a public key we'll use to create access for the smart contract. This puclic key will be returned in the success_url on successful sign in.
When successful sign in the Wallet redirects back to success_url
with additional params:
e.g.:
if success_url
== "https://success_url.com"
then redirect URL will be:
https://success_url.com/?account_id=wallet_account.testnet&public_key=PUBLIC_KEY_32&all_keys=ED25519_ACCESS_KEY