DecaneDocs
Social sign-inSocial sign-in
Social sign-in

Social sign-in

decane-connect-kit includes built-in non-custodial social wallets backed by Google OAuth and email magic-link. Users get a real on-chain wallet without ever seeing a seed phrase. The private key is split between the user’s device and the decane key server — neither side can reconstruct the key alone.

ConnectMode

The mode config option controls which auth methods are enabled.

ts
type ConnectMode
  = "all"             // all wallet types + social sign-in
  | "social"          // social sign-in only
  | "wallets"         // all wallet types, no social (default)
  | "evm"             // EVM wallets only
  | "solana"          // Solana only
  | "tron"            // Tron only
  | "evm+social"       // EVM wallets + social sign-in
  | "solana+social"    // Solana wallets + social sign-in
  | "tron+social"      // Tron wallets + social sign-in
  | "evm+tron"         // EVM + Tron, no social
  | "evm+tron+social";  // EVM + Tron + social sign-in

SocialConfig

Pass this object as config.social. Required when mode includes social.

ts
interface SocialConfig {
  apiKey: string;                  // your dck_live_… or dck_test_… key
  authMethods?: ("google" | "email")[];  // default: both
  promptPin?: () => Promise<string>;  // called when passkey unavailable
  chains?: string[];                // default: ["eip155:1", "solana:mainnet"]
  rpcUrls?: Record<string, string>;  // override built-in public RPCs
  requireAssertionPerSignature?: boolean;  // default: false — see below
}

Per-signature assertion

By default an unlocked session signs freely until it expires — one unlock, then no further prompts for the session’s lifetime. Setting requireAssertionPerSignature: true instead demands a fresh passkey assertion for every signature, verified inside the TEE against a single-use challenge with a 60-second TTL. The same gate already protects rotateShares and exportPortableBackup.

tsx
social: {
  apiKey: "dck_live_…",
  requireAssertionPerSignature: true,
}
!

This does not shorten the session. The session stays warm for its full duration — deliberately, so there is no re-attestation and no re-authentication per signature. What changes is that a live session alone stops being sufficient authority: each signature is re-proven. If you want a shorter window as well, that’s the separate sessionDurationMinutes knob.

Two practical consequences. Multi-step flows prompt per leg — an ERC-20 approve plus a swap is two prompts, not one. And it needs a passkey: a PIN-only wallet has no authenticator to assert with, so signing fails rather than falling back.

i

Scope, stated plainly: the policy is declared by the client when the session opens. That makes a leaked session handle worthless without the authenticator, but a fully compromised page could open a session without the flag. Making it unbypassable requires the policy to come from the server per user or per project, which is not implemented yet.

Setup example

tsx
<DecaneKit config={{
  mode: "all",
  social: {
    apiKey: "dck_live_…",
    authMethods: ["google", "email"],
    promptPin: () => showPinModal(),
  }, 
}}>
  <App/>
</DecaneKit>
i

The WalletSelector modal automatically shows a Wallet tab and a Sign in tab when mode includes social. No extra components needed.

useSocialAuth()

Sign-in state and the sign-in methods, nothing that signs transactions. Use it in the parts of the app that only need to know who is signed in.

MemberTypeDescription
State
isConnectedbooleanA session exists.
isUnlockedbooleanThe wallet can sign right now.
isNewUserbooleanThis sign-in created the account.
addresses{ evm?, solana?, tron? } | nullKnown before unlock; a restored tab has addresses but no session.
needsReconnectbooleanAddresses are known but there is no live session. Route through sign-in; unlock() or a passkey restores it.
canUsePasskeybooleanThis device can sign the remembered user back in with one passkey prompt. See signing back in.
sessionExpiresAtnumber | nullUnix ms.
profile{ name?, email?, picture? } | nullWhat the provider revealed at sign-in.
providerSubjectstring | nullThe provider's stable id for the user, such as X's numeric id.
phase"creating" | "unlocking" | nullKey generation on first sign-in, or reopening a session.
isCreatingWalletbooleanShorthand for phase === "creating".
errorstring | nullLast failure; clearError() resets it.
Sign in
signInWithGoogle()() => Promise<void>Redirect flow.
signInWithKingsChat()() => Promise<void>Redirect flow.
signInWithX()() => Promise<void>Redirect flow. X releases no email; the handle and id come back on the profile.
sendEmailCode(email)(email) => Promise<{ codeRequired: true }>Then confirmEmailCode(email, code).
confirmEmailCode(email, code)(email, code) => Promise<void>Completes the email sign-in.
sendPhoneCode(phone)(phone) => Promise<{ codeRequired: true }>Then confirmPhoneCode(phone, code). E.164 numbers only.
confirmPhoneCode(phone, code)(phone, code) => Promise<void>Completes the phone sign-in.
signInWithToken(token, opts?)(token, { providerId? }?) => Promise<void>A token from your own provider. See custom auth.
signInWithCustomAuth()(() => Promise<void>) | undefinedOnly when social.customAuth is configured.
signInWithPasskey()() => Promise<void>One prompt, no provider: a server-verified WebAuthn login mints the session.
unlock()() => Promise<void>Reopen a session for a remembered user on this device.
disconnect()() => Promise<void>Sign out. Revokes the JWT; keeps the device share and remembers who left. See signing back in.
Progress
googleLoadingbooleanPer method, while that sign-in is in flight.
kingschatLoadingboolean
xLoadingboolean
emailLoadingboolean
phoneLoadingboolean
tokenLoadingboolean
customLoadingboolean
customAuthLabelstring | undefinedThe button text you configured, e.g. "Continue with Acme".

useSocialWallet()

Everything in useSocialAuth(), plus signing, balances, the device's passkey and password, recovery, and control of the built-in modal.

MemberTypeDescription
Modal
modalOpenboolean
openModal()() => voidOpens SocialWalletModal.
closeModal()() => void
Signing
signMessage(chain, message)(chain, message) => Promise<string>Personal-sign on EVM, raw message on Solana.
sendTransaction(req)(req) => Promise<string>Returns the hash. See sending ERC-20.
signTypedData(req)({ chain, domain, types, message }) => Promise<string>EIP-712.
signAuthorization(req)(req) => Promise<SignedAuthorization>EIP-7702 delegation.
signSolanaTransaction(tx)(tx) => Promise<Uint8Array>See sending on Solana.
signTronTransaction(rawDataHex)(rawDataHex) => Promise<string>
getEthereumProvider(opts?)({ chainId? }?) => Eip1193ProviderFor viem, ethers or wagmi. Stable across renders.
Balances and history
getBalance(chain?)(chain?) => Promise<BalanceResult>Native balance; works while locked.
getBalances()() => Promise<{ chain, balance }[]>Every configured chain; a dead RPC gives null for that chain, not a rejection.
recordTransaction(tx)(tx) => Promise<TransactionRecord>For transactions your app broadcast itself.
getTransactionHistory(limit?)(limit?) => Promise<TransactionRecord[]>Most recent first. Needs a live session.
getAccessToken()() => string | nullThe session JWT, for your own backend.
Passkey and password, this device
hasPasskey()() => Promise<boolean>
addPasskey()() => Promise<void>Needs a live session.
setUnlockPassword(password)(password) => Promise<void>Needs a live session. Throws WeakPasswordError for a password too weak to carry a session.
canUnlockWithPassword()() => Promise<boolean>Signed out: can this device open a session from the password alone?
unlockWithPassword(password)(password) => Promise<void>Signed out: opens one. No provider, no passkey.
removeUnlockPassword()() => Promise<void>Turns the password path off, account-wide.
forgetLastUser()() => void“Use a different account.” Drops the memory of who signed out so they stop being offered; device shares are untouched.
Recovery
rotateShares(opts)({ password, passwordHint? }) => Promise<RecoveryShareFile>Re-issues the share set and returns the recovery file.
exportPortableBackup(opts)({ password, passwordHint? }) => Promise<PortableBackup>
hasRecoveryShare()() => Promise<boolean>
shouldPromptRecovery()() => Promise<boolean>Whether to nudge the user to set recovery up.
dismissRecoveryPrompt()() => Promise<void>
Status
loadingbooleanA signing call is in flight.
errorstring | nullclearError() resets it.

Signing back in after sign-out

disconnect() ends the session, revoking the JWT, but deliberately keeps the device's passkey- or password-wrapped share, so a returning user is one prompt from a session instead of a full sign-in. Since 2.22 it also remembers which account signed out. That is what lets canUsePasskey and canUnlockWithPassword() offer that account's own way back even when several accounts are enrolled on the same browser. The remembered id is a lookup key, not a credential: signInWithPasskey() still needs a server-verified WebAuthn assertion and unlockWithPassword() still needs the password.

Offer the shortcut when canUsePasskey (prefer it) or await canUnlockWithPassword() is true, and show the full method list otherwise. “Use a different account” is forgetLastUser(). Only these explicit entry points consult the memory; connect() and unlock() keep the strict lookup, so an ordinary sign-in never silently re-offers the account the user just left.

SocialWalletModal

Renders automatically inside <DecaneKit> — no placement needed. Open it with useSocialWallet().openModal(). Shows: addresses with copy buttons, locked/unlocked status with session countdown, unlock and sign-out actions.

Send a transaction with a social wallet

tsx
const { sendTransaction } = useSocialWallet();

// SDK auto-fetches nonce + gas from built-in CORS-friendly RPCs
const hash = await sendTransaction({
  chain: "eip155:11155111",   // Sepolia
  to: "0xRecipient",
  value: BigInt("1000000000000000"),  // 0.001 ETH in wei
});

Built-in CORS-enabled RPCs: Ethereum, Polygon, Base, Optimism, Arbitrum, BNB, Sepolia, Base Sepolia. Override any with social.rpcUrls.

Send an ERC-20 token

An ERC-20 transfer is a contract call: to is the token contract, value is zero, and the data field carries the encoded transfer(recipient, amount) call. The SDK broadcasts it the same way and returns a transaction hash.

tsx
import { Interface, parseUnits } from "ethers";

const { sendTransaction } = useSocialWallet();

const iface = new Interface(["function transfer(address to, uint256 amount)"]);
const data = iface.encodeFunctionData("transfer", [
  recipient,
  parseUnits("1.5", 6), // 1.5 USDC (6 decimals — check the token)
]);

const hash = await sendTransaction({
  chain: "eip155:1",
  to: tokenContractAddress, // the ERC-20 contract, not the recipient
  value: 0n,
  data,
});

Send a Solana transaction

sendTransaction is EVM-only. For Solana, build and serialize the transaction yourself, hand it to signSolanaTransaction — which returns the fully signed transaction bytes — then broadcast those to the cluster.

tsx
import {
  Connection, Transaction, SystemProgram, PublicKey, LAMPORTS_PER_SOL,
} from "@solana/web3.js";

const { signSolanaTransaction, addresses } = useSocialWallet();

const conn = new Connection("https://api.devnet.solana.com", "confirmed");
const fromPk = new PublicKey(addresses.solana);
const { blockhash } = await conn.getLatestBlockhash();

const tx = new Transaction({ feePayer: fromPk, recentBlockhash: blockhash }).add(
  SystemProgram.transfer({
    fromPubkey: fromPk,
    toPubkey: new PublicKey(recipient),
    lamports: BigInt(0.01 * LAMPORTS_PER_SOL),
  }),
);

// TEE signs and returns broadcast-ready bytes
const signed = await signSolanaTransaction(
  new Uint8Array(tx.serialize({ requireAllSignatures: false })),
);
const signature = await conn.sendRawTransaction(signed);

The TEE signs on whichever Solana chain is listed in social.chains. The signature is cluster-agnostic, so you can build against and broadcast to either mainnet or devnet.