For AI agents: a documentation index is available at /llms.txt. A markdown version of this page is available at the same URL with .md appended (or via Accept: text/markdown).
Skip to main content

Ed25519 Private Key

The getEd25519PrivateKey method returns the user's Ed25519 private key. Use this key to sign transactions on Solana, Near, Algorand, and other chains that use the Ed25519 curve.

This method throws:

  • Web3AuthError.noUserFound if no user session exists.
  • Web3AuthError.ed25519KeyNotFound if the session has no Ed25519 key. This always happens for users who signed in with an idToken (single-factor authentication), because SFA sign-in doesn't return an Ed25519 key.
  • Web3AuthError.ed25519CustomAuthError if useSFAKey is true and the dashboard marks the user's auth connection as not default (isDefault is false).

When you set useSFAKey to true in Web3AuthOptions, this method returns the single-factor authentication (SFA) Ed25519 key.

Usage​

let ed25519PrivateKey = try web3Auth.getEd25519PrivateKey()
On this page