import { hexEncode } from "./canonical.js"; import type { AgentIdentity, Constraint, DelegationCert, HumanRoot, HybridPrivateKey, HybridPublicKey, HybridSignature, KeyRotationStatement, ProofBundle, ReceiptPartySignature, RevocationList, RevocationPush, SessionToken, TransactionReceipt, VerifyResult, WitnessEntry } from "./types.js"; /** * hex(SHA-256(ed25519_pub || ml_dsa_65_pub)[:16]) — the canonical Ratify ID * for a HybridPublicKey. 128-bit collision space (2^64 birthday bound). */ export declare function deriveID(pub: HybridPublicKey): string; /** * Generate a fresh hybrid keypair from OS randomness. Two independent * 32-byte seeds; knowledge of one component's secret reveals nothing about * the other's. */ export declare function generateHybridKeypair(): Promise<{ publicKey: HybridPublicKey; privateKey: HybridPrivateKey; }>; /** * Derive a deterministic hybrid keypair from two 32-byte seeds. Used for * test-vector regeneration and any application needing reproducible * keypairs. Production code SHOULD prefer generateHybridKeypair(). */ export declare function hybridKeypairFromSeeds(edSeed: Uint8Array, mlSeed: Uint8Array): Promise<{ publicKey: HybridPublicKey; privateKey: HybridPrivateKey; }>; /** Generate a new HumanRoot identity with a hybrid keypair. */ export declare function generateHumanRoot(): Promise<{ root: HumanRoot; privateKey: HybridPrivateKey; }>; /** Generate a new AgentIdentity keypair. */ export declare function generateAgent(name: string, agentType: string): Promise<{ agent: AgentIdentity; privateKey: HybridPrivateKey; }>; /** * Canonical bytes signed to produce DelegationCert.signature (both algorithm * components sign the same bytes). */ export declare function delegationSignBytes(cert: DelegationCert): Uint8Array; /** * canonicalConstraintDict returns the object shape the canonical JSON * encoder should emit for one Constraint, by kind. Kind-relevant fields * are always included (zero values preserved); irrelevant fields are * omitted entirely. Mirrors Go's Constraint.MarshalJSON. Exported for the * wire codec (wire.ts), which emits the same canonical constraint shape. */ export declare function canonicalConstraintDict(c: Constraint): Record; /** * Canonical bytes signed to produce ProofBundle.challenge_sig. NOT JSON — * raw binary: * * challenge || big-endian uint64(timestamp) * || [optional 32-byte session_context] * || [optional 32-byte stream_id || big-endian int64(stream_seq)] * * Order matters: session_context precedes the stream extension so the signable * bytes remain well-defined across the four allowed length combinations * (40 / 72 / 80 / 112 bytes for a 32-byte challenge). */ export declare function challengeSignBytes(challenge: Uint8Array, ts: number, sessionContext?: Uint8Array, streamID?: Uint8Array, streamSeq?: number): Uint8Array; /** Canonical bytes signed to produce RevocationList.signature. */ export declare function revocationSignBytes(list: RevocationList): Uint8Array; /** Canonical bytes signed by both old and new keys in KeyRotationStatement. */ export declare function keyRotationSignBytes(stmt: KeyRotationStatement): Uint8Array; /** * Produce a hybrid signature over `msg` with both component private keys. * Both components sign identical bytes. ML-DSA-65 uses FIPS 204's canonical * (non-hedged) variant — matches the Go reference's SignTo(randomized=false). */ export declare function signBoth(msg: Uint8Array, priv: HybridPrivateKey): Promise; /** * Verify a hybrid signature. Both component signatures must verify against * their respective public components. Returns null on success; a string * describing which check failed on failure. The string matches the Go * reference's error messages for cross-language fixture compatibility. */ export declare function verifyBoth(msg: Uint8Array, sig: HybridSignature, pub: HybridPublicKey): Promise; /** Sign a DelegationCert; populates cert.signature with a hybrid pair. */ export declare function issueDelegation(cert: DelegationCert, issuerPrivateKey: HybridPrivateKey): Promise; /** * Verify a DelegationCert's hybrid signature. Returns null iff both * components verify; otherwise returns a diagnostic string matching the * Go reference (e.g. "Ed25519 signature invalid"). */ export declare function verifyDelegationSignatureE(cert: DelegationCert): Promise; /** Verify a DelegationCert's hybrid signature. True iff both components verify. */ export declare function verifyDelegationSignature(cert: DelegationCert): Promise; /** Produce a hybrid challenge signature (for ProofBundle.challenge_sig). */ export declare function signChallenge(challenge: Uint8Array, ts: number, agentPrivateKey: HybridPrivateKey, sessionContext?: Uint8Array, streamID?: Uint8Array, streamSeq?: number): Promise; /** * Verify a hybrid challenge signature. Returns null iff both components * verify; otherwise returns a Go-compatible diagnostic string. */ export declare function verifyChallengeSignatureE(challenge: Uint8Array, ts: number, sig: HybridSignature, agentPublicKey: HybridPublicKey, sessionContext?: Uint8Array, streamID?: Uint8Array, streamSeq?: number): Promise; /** Verify a hybrid challenge signature. True iff both components verify. */ export declare function verifyChallengeSignature(challenge: Uint8Array, ts: number, sig: HybridSignature, agentPublicKey: HybridPublicKey, sessionContext?: Uint8Array, streamID?: Uint8Array, streamSeq?: number): Promise; /** Sign a RevocationList with the issuer's hybrid private key. */ export declare function issueRevocationList(list: RevocationList, issuerPrivateKey: HybridPrivateKey): Promise; /** Verify a RevocationList's hybrid signature. True iff both components verify. */ export declare function verifyRevocationList(list: RevocationList, issuerPublicKey: HybridPublicKey): Promise; /** Canonical bytes signed to produce RevocationPush.signature. */ export declare function revocationPushSignBytes(push: RevocationPush): Uint8Array; /** Sign a RevocationPush with the issuer's hybrid private key. */ export declare function issueRevocationPush(push: RevocationPush, issuerPrivateKey: HybridPrivateKey): Promise; /** Verify a RevocationPush's hybrid signature. True iff both components verify. */ export declare function verifyRevocationPush(push: RevocationPush, issuerPublicKey: HybridPublicKey): Promise; /** Canonical bytes signed to produce WitnessEntry.signature. */ export declare function witnessEntrySignBytes(entry: WitnessEntry): Uint8Array; /** Sign a WitnessEntry with the witness operator's hybrid private key. */ export declare function issueWitnessEntry(entry: WitnessEntry, witnessPrivateKey: HybridPrivateKey): Promise; /** Verify a WitnessEntry's hybrid signature. True iff both components verify. */ export declare function verifyWitnessEntry(entry: WitnessEntry, witnessPublicKey: HybridPublicKey): Promise; /** Sign a KeyRotationStatement with both old and new private keys. */ export declare function issueKeyRotationStatement(stmt: KeyRotationStatement, oldPrivateKey: HybridPrivateKey, newPrivateKey: HybridPrivateKey): Promise; /** * Verify key continuity, key possession, and ID/pubkey consistency for a * KeyRotationStatement. Returns null on success, diagnostic string on failure. */ export declare function verifyKeyRotationStatementE(stmt: KeyRotationStatement): Promise; /** Verify a KeyRotationStatement. True iff both signatures and IDs verify. */ export declare function verifyKeyRotationStatement(stmt: KeyRotationStatement): Promise; /** * Canonical bytes that every party in a TransactionReceipt signs. Parties * are sorted by party_id; only identifying fields (not proof_bundle) enter * the signable. Keys in lex order. */ export declare function transactionReceiptSignBytes(receipt: TransactionReceipt): Uint8Array; /** * Produce a party's hybrid signature over the receipt's canonical signable. * Collect the resulting ReceiptPartySignature into receipt.party_signatures * before emitting the receipt. */ export declare function signTransactionReceiptParty(receipt: TransactionReceipt, partyID: string, agentPriv: HybridPrivateKey): Promise; /** * Canonical 32-byte SHA-256 hash of a delegation chain, defined as * SHA-256 of the concatenated delegationSignBytes of each cert in order. * Used as a stable chain identity inside SessionToken — a cert rotation * invalidates every token issued against the old chain. */ export declare function chainHash(chain: DelegationCert[]): Uint8Array; /** * Canonical MAC-input bytes for a SessionToken. The MAC itself is excluded * from the signable (a MAC cannot cover itself). */ export declare function sessionTokenSignBytes(token: SessionToken): Uint8Array; /** * Issue a SessionToken from a previously verified bundle's result. Callers * MUST only invoke this after verifyBundle(bundle, opts) returned valid=true. * sessionSecret MUST be a cryptographically random secret known only to the * verifier. */ export declare function issueSessionToken(bundle: ProofBundle, result: VerifyResult, sessionID: string, issuedAt: number, validUntil: number, sessionSecret: Uint8Array): SessionToken; /** * Check a SessionToken's HMAC against sessionSecret and its validity window * against `now` (unix seconds). Returns null on success; an error string on * failure. */ export declare function verifySessionTokenE(token: SessionToken, sessionSecret: Uint8Array, now: number): string | null; /** Generate 32 cryptographically-random challenge bytes from WebCrypto. */ export declare function generateChallenge(): Uint8Array; export { hexEncode }; //# sourceMappingURL=crypto.d.ts.map