import type { Result } from '@private.me/shared';
/** Error codes for succession operations. */
export type SuccessionError = 'SIGN_FAILED' | 'VERIFY_FAILED' | 'INVALID_FORMAT' | 'INVALID_TIMESTAMP' | 'SEQUENCE_ROLLBACK' | 'FORK_DETECTED' | 'SUCCESSION_NOT_MONOTONIC';
export interface SuccessionAnnouncement {
    oldDid: string;
    newDid: string;
    rotation_sequence: number;
    effective_at: number;
    expires_at: number;
    grace_period_ms: number;
    timestamp: number;
    oldSignature: Uint8Array;
    newSignature: Uint8Array;
}
/**
 * Create DID succession announcement with dual signatures.
 *
 * Format: did:key:OLD||did:key:NEW||sequence||effective_at||expires_at||grace_period||timestamp||sig_OLD||sig_NEW
 * Both old and new keys must sign to prove possession.
 *
 * @param oldDid - DID being rotated (old key)
 * @param oldPrivateKey - ML-DSA-65 secret key (32-byte seed) for old DID
 * @param newDid - DID replacing old DID
 * @param newPrivateKey - ML-DSA-65 secret key (32-byte seed) for new DID
 * @param rotationSequence - Monotonically increasing sequence number
 * @param gracePeriodMs - Overlap window in milliseconds (default: 7 days)
 * @returns Succession announcement with dual signatures or error
 */
export declare function createSuccession(oldDid: string, oldPrivateKey: Uint8Array, newDid: string, newPrivateKey: Uint8Array, rotationSequence: number, gracePeriodMs?: number): Promise<Result<SuccessionAnnouncement, SuccessionError>>;
/**
 * Verify succession announcement dual signatures.
 *
 * Both old and new keys must have valid signatures.
 * Also checks sequence monotonicity (new sequence must be greater than current).
 *
 * @param announcement - Succession announcement to verify
 * @param oldPublicKey - ML-DSA-65 public key (1952 bytes) for old DID
 * @param newPublicKey - ML-DSA-65 public key (1952 bytes) for new DID
 * @returns true if both signatures valid, false otherwise
 */
export declare function verifySuccession(announcement: SuccessionAnnouncement, oldPublicKey: Uint8Array, newPublicKey: Uint8Array): Promise<Result<boolean, SuccessionError>>;
/**
 * Encode succession announcement to wire format.
 *
 * Format: did:key:OLD||did:key:NEW||sequence||effective_at||expires_at||grace_period||timestamp||sig_OLD||sig_NEW
 *
 * @param announcement - Succession announcement to encode
 * @returns Wire format string (base64-encoded signatures)
 */
export declare function encodeSuccession(announcement: SuccessionAnnouncement): string;
/**
 * Decode succession announcement from wire format.
 *
 * @param encoded - Wire format string
 * @returns Parsed succession announcement or error
 */
export declare function decodeSuccession(encoded: string): Result<SuccessionAnnouncement, SuccessionError>;
/**
 * Verify succession chain has monotonically increasing sequence numbers.
 *
 * Ensures sequence numbers in chain are strictly increasing:
 * - Prevents DID chain manipulation attacks
 * - Detects rollback attempts
 * - Enforces chronological ordering
 *
 * @param chain - Array of succession announcements forming a DID rotation chain
 * @returns Success if chain is monotonically increasing, error otherwise
 *
 * @example
 * ```typescript
 * const chain = [
 *   { ...announcement1, rotation_sequence: 1 },
 *   { ...announcement2, rotation_sequence: 2 },
 *   { ...announcement3, rotation_sequence: 3 }
 * ];
 * const result = verifySuccessionChain(chain);
 * // result.ok === true
 * ```
 *
 * @example
 * ```typescript
 * // Non-monotonic chain (rejected)
 * const badChain = [
 *   { ...announcement1, rotation_sequence: 1 },
 *   { ...announcement2, rotation_sequence: 3 },
 *   { ...announcement3, rotation_sequence: 2 } // Rollback!
 * ];
 * const result = verifySuccessionChain(badChain);
 * // result.ok === false, result.error === 'SUCCESSION_NOT_MONOTONIC'
 * ```
 */
export declare function verifySuccessionChain(chain: SuccessionAnnouncement[]): Result<boolean, SuccessionError>;
