/**
 * `@shade/recovery` — social key recovery for Shade (V3.10).
 *
 * Public surface:
 *  - {@link setupRecovery}: distribute Shamir shares to guardians.
 *  - {@link attachGuardian}: wire a guardian-side receiver.
 *  - {@link requestRecovery}: rebuild a lost identity from threshold guardians.
 *  - {@link splitSecret} / {@link combineShares}: low-level Shamir primitives
 *    (exported for advanced callers and test harnesses).
 *  - Errors, store interface, and protocol envelope types.
 */

// Core flows
export { setupRecovery } from './setup.js';
export type {
  SetupRecoveryOptions,
  SetupRecoveryResult,
  GuardianDelivery,
  RecoveryDeliver,
} from './setup.js';

export { attachGuardian } from './guardian.js';
export type {
  AttachGuardianOptions,
  AttachedGuardian,
  GuardianApproveContext,
  GuardianApproveHandler,
} from './guardian.js';

export { requestRecovery } from './request.js';
export type {
  RequestRecoveryOptions,
  RecoveryProgress,
  RecoveryResult,
} from './request.js';

// Storage
export { MemoryRecoveryStore } from './store.js';
export type { GuardianShareEntry, RecoveryStore } from './store.js';

// Errors
export {
  RecoveryError,
  RecoveryDeclinedError,
  RecoveryGuardianRejectedError,
  RecoveryProtocolError,
  RecoveryReconstructionError,
  RecoveryTimeoutError,
} from './errors.js';

// Protocol — exported for apps that need to inspect or relay envelopes.
export {
  encodeRecoveryEnvelope,
  tryParseRecoveryEnvelope,
  RECOVERY_DISCRIMINATOR,
  RECOVERY_PROTOCOL_VERSION,
} from './protocol.js';
export type {
  RecoveryEnvelope,
  RecoveryMessageType,
  RecoveryRequestEnvelope,
  ShareDeclineEnvelope,
  ShareDepositEnvelope,
  ShareGrantEnvelope,
} from './protocol.js';

// Shamir primitives — exported for tests and advanced callers (e.g.
// hardware-token integrations that want to split a different secret).
export { splitSecret, combineShares, encodeShare, decodeShare } from './shamir.js';
export type { ShamirShare } from './shamir.js';

// Encoding helpers — used by widget-layer code and integration tests.
export {
  bytesToBase64Url,
  base64UrlToBytes,
  recoveryKeyToBackupPassphrase,
} from './encoding.js';
