Function Signature
DynamicEvmWalletClient, DynamicSvmWalletClient, DynamicBtcWalletClient, DynamicTonWalletClient).
Description
Authenticates the client with a Dynamic user JWT obtained outside the SDK — for example, by an agent that completed a Dynamic sign-in (email OTP or SIWE) on behalf of a user via createAuthClient. All wallet operations then run as that user. Unlike authenticateApiToken, no token exchange happens: the JWT is installed directly as the bearer token for all subsequent API calls. This method only validates the token’s structure (a compact JWS with three non-empty dot-separated segments); the server validates the token on every request. WhengetSessionSignature is provided, the client attaches a signed-session proof to key-share backup and recovery calls (backUpToDynamic: true create, backup, recovery, and sign-with-auto-recovery flows). The SDK passes messages to the callback and uses the signatures it returns — the session private key never enters the SDK. Without a signer, those calls fail with a 400 from the keyshares relay for agent JWT sessions.
Parameters
Required Parameters
jwt(string) - A Dynamic user JWT. Header-based (not cookie-based) JWTs are required for agent flows. To use signed sessions, the JWT must have been minted with the session public key bound in (passsessionPublicKeyat sign-in).
Optional Parameters
options.getSessionSignature((message: string) => Promise<string>) - Signer callback for signed sessions. Must return the signature as lowercase hex — the raw 64-byte ECDSA P-256r‖s, as produced by signSessionMessage. Other encodings, notably base64 (which can contain/), corrupt the/-delimited signed-session composite sent to the keyshares relay.
Returns
Promise<void>- Resolves once the token is installed. The signer, when provided, is kept for the life of the session and preserved across refreshAuthToken calls. A laterauthenticateApiTokencall clears it.
Example
Error Handling
Related Functions
refreshAuthToken()- Refresh the installed JWTcreateAuthClient()- Obtain a user JWT headlesslygenerateSessionKeyPair()- Generate a session key pairsignSessionMessage()- ImplementgetSessionSignaturefor a stored JWK