createCloak recognizes common wallets on its own. For everything else, it accepts a
@solana/kit signer or a plain object with signMessage and signTransaction. This page covers
those cases and how to sponsor deposit fees.
A key your server holds
signerFromSecretKey turns a 64-byte Solana secret key (the Keypair.secretKey layout) or a 32-byte
seed into a @solana/kit KeyPairSigner. The key is imported as non-extractable.
Keypair is accepted as is. For a server that should not depend on any wallet at all, use
business mode (account: <32-byte key>). See Backend integration.
Privy server wallets
createSolanaKitSigner from @privy-io/node returns a @solana/kit signer that signs messages and
transactions through Privy. Pass it to createCloak as the wallet. The SDK uses its signing methods
and ignores its ability to send, because the SDK submits every transaction itself.
@privy-io/node 0.42.0. The account opens from the server wallet’s signature, so it
is the same account each time that wallet signs.
Any other wallet: the CustomWallet shape
Pass an object with the wallet’s address and byte-level signing functions. This fits KMS and HSM
signers, MPC services, and wallets the SDK does not know.
Leave out
signMessage and the wallet can still shield, but cannot open an account by itself.
signerFromTransactionBytes({ address, signTransaction, signMessage }) builds the equivalent kit
signer for the low-level API.
Checking a wallet before you rely on it
recognizeWallet throws wallet.unrecognized for anything it cannot use.
Sponsored deposits
A shield from Solana is paid by the wallet that funds it. To let a wallet with no SOL shield, the low-leveltransact accepts externalFeePayer: an adapter for a fee-payer service that covers the
network fee and rent and is reimbursed in an SPL token inside the same transaction.
externalFeePayer on the deposit’s TransactOptions. Limits:
- Deposits only. Sends, withdrawals and swaps are already paid for the user.
- Not with a
KeyPairSignerdepositor. The depositor must be a wallet signer (wallet adapter, Wallet Standard, a Privy signer). - Not available through
createCloak. Itsshieldcall takes no fee payer. - Top-up instructions must not include ComputeBudget instructions; the SDK adds its own.