@synqauth/solana
Sign in to Synq with a Solana wallet, on the Wallet Standard.
@synqauth/solana
canSignIn
Function. Whether wallet is a Solana wallet that can sign someone in.
function canSignIn(wallet: Wallet): booleanencodeSiws
Function. synq_siws for what a wallet signed: base64url JSON of the address, signature and nonce.
function encodeSiws(signed: SignedRequest): stringgetSolanaWallets
Function. The wallets the browser has now that can sign someone in.
function getSolanaWallets(): readonly Wallet[]requestSignIn
Function. The issuer's request for this page: POST <issuer>/siws/nonce with the
app's client_id, from a page on one of the app's redirect origins. Only a
brand's own app gets one.
function requestSignIn(options: { issuer: string | URL; clientId: string; fetch?: { (input: URL | RequestInfo, init?: RequestInit | undefined): Promise<Response>; (input: string | URL | Request, init?: RequestInit | undefined): Promise<Response>; } | undefined; }): Promise<SignInRequest>SignedRequest
Interface. What a wallet signed for a request: its address and the signature, in standard base64.
interface SignedRequest {
address: string;
signature: string;
nonce: string;
}signInMessage
Function. The text a wallet signs for request and address, line for line as the
Wallet Standard's solana:signIn writes it, and as the issuer checks it.
function signInMessage(request: SignInRequest, address: string): stringSignInRequest
Interface. What the issuer asks a wallet to sign: everything but the address.
interface SignInRequest {
domain: string;
uri: string;
statement: string;
version: string;
chainId: string;
nonce: string;
issuedAt: string;
expirationTime: string;
}signInWithWallet
Function. The same, navigating the browser there.
function signInWithWallet(client: SynqClient, options: WalletSignInOptions): Promise<void>signWithWallet
Function. Has wallet sign request: with solana:signIn when it has it (the
wallet shows a sign-in and checks the domain against the page), else by
connecting and signing the same message with solana:signMessage.
A person who declines is the error wallet_rejected.
function signWithWallet(wallet: Wallet, request: SignInRequest, account?: WalletAccount | undefined): Promise<SignedRequest>SolanaWallet
Type. A wallet that can sign someone in: it connects, and signs a sign-in message one way or the other.
type SolanaWallet = Wallet;Wallet
Interface. Interface of a Wallet, also referred to as a Standard Wallet.
A Standard Wallet implements and adheres to the Wallet Standard.
interface Wallet {
readonly version: WalletVersion;
readonly name: string;
readonly icon: WalletIcon;
readonly chains: IdentifierArray;
readonly features: IdentifierRecord<unknown>;
readonly accounts: readonly WalletAccount[];
}WalletAccount
Interface. Interface of a WalletAccount, also referred to as an Account.
An account is a read-only data object that is provided from the Wallet to the app, authorizing the app to use it.
The app can use an account to display and query information from a chain.
The app can also act using an account by passing it to {@link Wallet.featuresfeatures} of the Wallet.
Wallets may use or extend {@link "@wallet-standard/wallet".ReadonlyWalletAccount} which implements this interface.
interface WalletAccount {
readonly address: string;
readonly publicKey: ReadonlyUint8Array;
readonly chains: IdentifierArray;
readonly features: IdentifierArray;
readonly label?: string;
readonly icon?: WalletIcon;
}WalletSignInOptions
Interface. What walletSignInUrl takes besides the client.
interface WalletSignInOptions extends Omit<AuthorizationUrlOptions, 'pushed' | 'prompt' | 'method'> {
issuer: string | URL;
clientId: string;
wallet: Wallet;
account?: WalletAccount;
fetch?: typeof fetch;
}walletSignInUrl
Function. The whole headless sign-in, up to the URL to send the browser to: the
issuer's request, the wallet's signature, and the pushed authorization
request carrying it. The browser goes there, and comes straight back to
the app's redirect URI with a code for client.handleCallback.
function walletSignInUrl(client: SynqClient, options: WalletSignInOptions): Promise<URL>watchSolanaWallets
Function. Finds the browser's wallets, now and as they arrive: the listener hears the wallets that can sign in, each time the list changes. Answers a function that stops listening.
function watchSolanaWallets(listener: Listener): () => void@synqauth/solana/react
useSolanaWallets
Function. The wallets the browser has that can sign someone in, kept current as
wallets load (or add solana:signIn later). Empty on the server.
function useSolanaWallets(): readonly Wallet[]See every package.