Skip to main content

Key derivation

import {
  SETUP_MESSAGE,
  deriveKeysFromSignature,
  keysToStealthMetaAddress,
  stealthMetaAddressToHex,
  parseStealthMetaAddress,
  computeStealthAddressAndViewTag,
  recomputeStealthSendFromEphemeralPrivateKey,
  ephemeralPrivateKeyToCompressedPublicKey,
} from "@opaquecash/opaque";
ExportPurpose
SETUP_MESSAGECanonical wallet message for HKDF entropy
deriveKeysFromSignatureViewing + spending keys from signature hex
computeStealthAddressAndViewTagOne-time destination from meta-address
stealthMetaAddressToHexEncode meta-address to 66-byte hex
generateRandomMetaAddressFresh throwaway meta-address (decoy recipients)

Unified signer

import {
  requestSetupSignature,
  selectSigner,
} from "@opaquecash/opaque";

import type {
  UnifiedSigner,
  EvmUnifiedSigner,
  SolanaUnifiedSigner,
} from "@opaquecash/opaque";
One adapter shape over EIP-1193, viem WalletClient, and Solana wallet-adapter. requestSetupSignature(signer) prompts for the SETUP_MESSAGE signature; pass the same shapes to OpaqueClient.fromWallet. See OpaqueClient overview.

Recipient resolution

import {
  parseMetaAddressValue,
  extractMetaAddressFromDidDocument,
  ipfsPathFromInput,
  isOnsNameInput,
  isSnsNameInput,
  resolveIpfsDidMetaAddress,
  resolveEnsMetaAddress,
  resolveSnsMetaAddress,
  OPAQUE_META_RECORD_KEY,      // "com.opaque.meta"
  META_ADDRESS_VALUE_PREFIX,   // "st:opq:"
  DEFAULT_IPFS_GATEWAYS,
} from "@opaquecash/opaque";

import type { ResolvedRecipient, ResolvedRecipientSource } from "@opaquecash/opaque";
Building blocks behind client.resolveRecipient. parseMetaAddressValue validates that both 33-byte halves are real curve points. isOnsNameInput(name, parentName) gates the ONS path (depth-1 subnames of the parent in force). The Solana mirror primitives (fetchOnsMirrorRecord, getOnsMirrorRecordPda, onsNameHash, decodeOnsMirrorRecord, fetchSnsTxtRecord) live in @opaquecash/stealth-chain-solana.

Chain deployments

import {
  getSupportedChainIds,
  getChainDeployment,
  requireChainDeployment,
  NATIVE_TOKEN_ADDRESS,
} from "@opaquecash/opaque";

const ids = getSupportedChainIds();           // [11155111]
const dep = getChainDeployment(11155111);   // registry, announcer, verifier, tokens
These getters read the generated @opaquecash/deployments registry; import that package directly for raw addresses, ABIs, and Solana program ids. See Deployments.

Indexer normalization

import {
  announcementToIndexerRow,
  indexerAnnouncementToScannerRecord,
  indexerAnnouncementsToScannerJson,
} from "@opaquecash/opaque";

PSR codecs (@opaquecash/psr-core)

import {
  parseFieldDefs,
  fieldDefsToString,
  computeSchemaId,
  computeUid,
  encodeAttestationData,
  decodeAttestationData,
  encodeV2AttestationMetadata,
  randomNonce,
  buildActionScope,
  externalNullifierFromScope,
} from "@opaquecash/opaque";

import type { SchemaV2, AttestationV2, FieldDef, ProofData } from "@opaquecash/opaque";

Chain adapters

import {
  EvmAdapter,
  SolanaAdapter,
  getSolanaDeployment,
  WORMHOLE_CHAIN_ETHEREUM,
  WORMHOLE_CHAIN_SOLANA,
} from "@opaquecash/opaque";

import type { ChainAdapter, Announcement, SolanaCluster } from "@opaquecash/opaque";
Use adapters directly only when bypassing OpaqueClient.scan. Most apps should use client.scan.

Solana PSR (namespaced)

Avoids computeSchemaId name clash with psr-core:
import { solanaPsr } from "@opaquecash/opaque";

// solanaPsr.buildRegisterSchemaInstruction, deriveSchemaPda, ...

Prover artifacts

import {
  DEFAULT_REPUTATION_ARTIFACT_PATHS,
  DEFAULT_REPUTATION_ARTIFACTS_ORIGIN,
} from "@opaquecash/opaque";
Default Groth16 wasm/zkey URLs point to opaque.cash /circuits/....

Types reference

TypeDescription
OpaqueClientConfigClient construction
UnifiedSignerOne wallet shape for fromWallet / requestSetupSignature
ResolvedRecipientresolveRecipient result with source tag
DummyAnnouncementDecoy announcement from generateDummyAnnouncements
OpaqueScanChain"ethereum" | "solana"
PsrChainSame as OpaqueScanChain
UnifiedOwnedOutputScan result with chain + source tags
OwnedStealthOutputOwned stealth output from WASM filter
IndexerAnnouncementNormalized indexer row
PrepareStealthSendResultStealth send derivation result
SendStealthPaymentParams / SendStealthPaymentResultHigh-level send
CreateSchemaParams / CreateSchemaResultSchema registration
IssueAttestationParams / IssueAttestationResultAttestation issuance
VerifyReputationArgsProof verification payload
DiscoveredTraitPSR trait from discoverTraitsV2 or legacy discoverTraits
TokenBalanceSummaryAggregated token balance
OutputBalancePer-output native balance