DOCS / SDK & API REFERENCE
Request, verify, and deliver.
Use hosted signers to derive keys, authorize exact requests and retrieve verifiable signatures.
Hosted API v2
Base URL: https://pairkey.com/api/v2. POST JSON with X-PairKey-Client: 1. The header is request hygiene, not signing authority. Use HTTPS outside loopback. Never send a wallet private key to the API.
| Endpoint | Purpose |
|---|---|
| GET /config | Deployment, signer identities, identity sources, program policy scopes, per-chain transaction capabilities, and optional typed_data_signing and evm_chain_selection flags. |
| POST /namespaces | {identity, namespace_id}: public metadata and two attestations; no registration transaction. |
| POST /keys | {registration, chain, path}: derived public key and suite certificate. |
| POST /approvals | {signing_request, identity}: exact message or typed transaction, current rules, payload, and authorization bytes. |
| POST /jobs | {signing_request, approval: {request, proof}}: privately authenticate at both signers and submit. |
| GET /jobs/:id | Read working, complete or failed/uncertain status. |
| POST /jobs/:id/recover | Read existing public results; cannot start another signing attempt. |
| POST /verify | Fresh message-signature verification. |
| POST /rpc | Bounded devnet RPC for explicit wallet transactions and chain reads. |
signing_request always contains {key: {registration, chain, path}, request_id} and exactly one useful payload: nonempty message, or a typed transaction with an empty message. Transaction variants are {solana:{message}}, {evm_legacy:{transfer}}, {near:{transaction}}, and {sui:{transaction}}. The SDK includes client support for {evm_typed_data:{typed_data}} and {bitcoin_psbt:{spend}}; these require a compatible service deployment. The Sui value is BCS TransactionData. Byte arrays use JSON integer arrays. Use the SDK instead of hand-encoding these canonical envelopes.
Browser and Rust SDKs
@pairkey/sdk exposes PairKeyClient for all four authority sources and @pairkey/sdk/program exposes ProgramClient. Install it with npm install @pairkey/sdk. Released PairKeyClient methods include connect, key, signMessage, signTransaction, signAndSend, recover, and recoverAndSend. ProgramClient also provides example-controller policy management. Standard account, passkey and OIDC/OAuth rule edits require a custom integration with the repository's lower-level PairKey implementation; that class is not a public package export. signTypedData for EIP-712 is included in SDK 0.2.1 but requires a service deployment that advertises typed_data_signing.evm. See Signing schemes for the exact message format on each destination and the separate typed-data path.
import * as web3 from '@solana/web3.js';
import {PairKeyClient} from '@pairkey/sdk';
const pairkey = new PairKeyClient({web3, storage: localStorage});
await pairkey.connect({
source: 'account', // or program, passkey, oidc
namespace: 'org/acme/treasury',
// plus the source-specific wallet, program, identity, credential, or token callback
});
await pairkey.key({chain, path: [0]});
const signed = await pairkey.signTransaction({chain, path: [0], transaction});The client recomputes canonical request bytes, checks namespace attestations and applicable wallet or ephemeral proofs, and validates policy/commit instruction bundles. The Rust hosted verifier checks the chain signature, key context, approval, and both worker receipts. Browser Ed25519 verification and a service /verify call do not replace that independent verification.
Exact approval and versions
The approval binds identity, namespace registration digest, request ID, destination/path, payload hash and length, policy revision/digest, issued time and expiry. The wallet signs a domain-separated ASCII digest message. Default validity is five minutes. Never sign bytes returned by a server without checking them against the original intended request.
The HTTP API is v2; the approval structure has its own version 1, and multisuite protocol envelopes have version 2. These are separate version fields. Existing v1 routes and legacy derivation encodings remain compatible.
Bound passkey and OIDC/OAuth identities
A binding includes the identity digest, namespace digest, ephemeral Ed25519 public key, and a validity interval of at most ten minutes. The high-level client creates it before preparing each request. The ephemeral key signs that exact approval and is never used as the derived destination key.
await pairkey.connect({source:'passkey', identity, credentialId, namespace});
await pairkey.signTransaction({chain:'solana', transaction});
await pairkey.connect({source:'oidc', identity, namespace,
getIdToken: ({nonce}) => obtainIdToken({nonce})});
await pairkey.signTransaction({chain:'near', transaction: nearBytes});Passkey identity includes the credential’s compressed P-256 public key, RP ID and origin. Each signer checks origin, RP ID, presence, verification and binding challenge. OIDC/OAuth identity includes issuer, audience and subject; each signer verifies the configured token, identity/time claims, and nonce using operator-pinned issuer configuration. Assertions, ID tokens, and ephemeral private keys are excluded from public recovery records.
Policy and program endpoints
| POST endpoint | Purpose |
|---|---|
| /policies | Read standard namespace rules. |
| /policies/prepare | Prepare the exact next rules revision for an identity. |
| /policies/instructions | Construct unsigned identity-authorized native verification and gateway instructions. |
| /programs/example | Resolve example program/owner/mode and optional namespace_scope into a source and policy address. |
| /programs/example/policy/read | Read the shared or namespace-scoped application policy. |
| /programs/example/policy | Construct an explicit owner-signed application policy edit. |
| /programs/example/commit | Construct the exact onchain approval instruction. |
A namespace-scoped policy uses ["pairkey-policy", owner, namespace_digest]; omitting the scope selects the compatible shared account. Policy endpoints construct instructions and wallets explicitly send them.
Recovery without another signature
The SDK saves the public prepared request, key, deployment, and deterministic job ID before authentication and submission. recover(jobId) retrieves only that original signing attempt and never asks for another wallet signature, passkey assertion, ID token, program commit, or threshold signing round.
For signAndSend, the SDK also stores the exact signed destination transaction before contacting the RPC. An RPC timeout becomes status: "unknown". recoverAndSend(jobId) can recover and rebroadcast those identical bytes. A threshold result, RPC acceptance, and destination finality remain separate states.
Interpret errors at the right stage
Before submission, malformed bytes, expired authentication or changed rules stop the request. After submission begins, a lost response or failure can leave an uncertain outcome. Hosted errors include an error string; job failures also carry uncertainty. Do not label an HTTP failure as a refusal by both signers.
Rate limits return HTTP 429. Respect backoff and retain the exact request/job ID. The service does not automatically create another signing attempt. Policy revision conflicts require reading current rules and deliberately preparing a new edit.
Durability and limits
Hosted jobs retain public request metadata, proof commitments and completed results, with at most 1,024 retained hosted jobs and no automatic eviction. Raw messages are limited to 256 UTF-8 bytes; the API has bounded body sizes, a shared 120-call/minute limit and a signing/enrollment gate. Save verified transcripts in your application. Public metadata is not confidential storage.
Worker and coordinator request claims survive ordinary restarts. File locking and atomic snapshots do not establish distributed rollback protection. Never reset roots, journals or incident latches to retry an uncertain job.
Internal coordinator and legacy APIs
Internal worker routes are not public hosted APIs. The coordinator’s off-chain path privately distributes authentication, reserves durable request claims and recovers only original receipts. The hosted service adds its own durable public job journal.
The older /api/v1 hosted API keeps registration and exact COMMIT behavior for compatible clients. Registered-policy and native-transfer sessions use separate types. Do not send a legacy session as a v2 identity proof.
Legacy lower-level integration
The self-hosted multi-suite API retains /multi/keys, /jobs with a signing envelope, job polling/events/cancellation and /multi/sign. Its older retention and explicit-attempt semantics differ from v2 durable approval claims. fresh_attempt is not a recovery API for v2. See repository docs/program-jobs-and-lifecycle.md and program_jobs.rs for this compatibility path.