Skip to main content
@chipi-stack/core is in development (v0.1.0). APIs may change before stable release.

Overview

SignerAdapter is an interface that abstracts over different key management strategies. Instead of hardwiring passkey logic into transaction flows, you program against the SignerAdapter interface and swap implementations as needed.

The Interface

Implementations

DirectSigner

Signs with a local private key. For development and testing only.
Never use DirectSigner with real private keys in production. It exists for local development and testing.

Constructor

  • privateKey (string): Hex-encoded StarkNet private key (must start with 0x)
  • accountAddress (string, optional): Account address. Defaults to the derived public key.

Throws

  • If privateKey is not a valid hex string starting with 0x

PasskeySigner

Wraps a WebAuthn assertion function that produces Starknet-compatible signatures {r, s} from a challenge. Users authenticate via biometrics (Face ID, fingerprint) and the result is used to sign transactions.

Constructor

  • authenticateFn: A function that takes a challenge hash and returns a Starknet-compatible signature {r, s} via WebAuthn assertion
  • publicKey: The passkey public key obtained during registration
  • accountAddress: The user’s StarkNet account address
Most developers should use the usePasskeyAuth hook from @chipi-stack/chipi-passkey/hooks instead of PasskeySigner directly. PasskeySigner is for advanced use cases where you need low-level control over the signing flow.

ExternalSigner

Generic adapter for any external signing provider. You supply the three interface methods and ExternalSigner wraps them.

Constructor

Use Cases

Backend Automation

Use DirectSigner with a key stored in a vault/HSM for programmatic transaction execution:

Multi-Wallet Support

Support multiple wallet providers without branching transaction code:

Easy Testing

Mock signers for unit tests:

Auth Provider Migration

If you switch from Privy to another provider, only the SignerAdapter implementation changes. All TxBuilder, Erc20, and Amount code stays the same.

Connecting to TxBuilder

createAccount() bridges any SignerAdapter into a starknet.js Account for use with TxBuilder.

Direct (user pays gas)

  • TxBuilder: Uses the Account (which uses the signer) to execute transactions
  • Introduction: Overview of when to use core vs hooks