Skip to content

@brivora/verify API Reference

async function govern<T>(
fn: () => Promise<T>,
options: {
governance: string | GovernancePack;
audit?: boolean;
verifier?: VerifierIdentity;
chain?: ProofChain;
}
): Promise<GovernResult<T>>

Wrap an AI call with governance evaluation. Executes the 5-stage governance pipeline and returns the original output alongside the governance proof.

ParameterTypeDescription
fn() => Promise<T>The AI call to govern
options.governancestring | GovernancePackPack name or custom pack
options.auditbooleanEnable audit logging (default: false)
options.verifierVerifierIdentityCustom verifier identity
options.chainProofChainAppend to existing proof chain

Returns: GovernResult<T> — contains output, valid, score, report, proof.


async function check(
proof: BrivoraProof,
publicKey?: Uint8Array
): Promise<VerifyResult>

Independently verify a governance proof. Checks Merkle root integrity, signature validity, and timestamp.


function createPack(config: GovernancePackConfig): GovernancePack

Create a custom governance pack from a configuration object.


async function createVerifier(): Promise<VerifierIdentity>

Create a new verifier identity with PQC key pairs for proof signing.


function createChain(verifier: VerifierIdentity): ProofChain

Create a new proof chain. Each subsequent govern() call with this chain appends a proof linked to the previous one.


async function checkChain(
proofs: BrivoraProof[],
publicKey: Uint8Array
): Promise<ChainVerifyResult>

Verify an entire chain of proofs. Checks that each proof’s previous_proof field correctly references the prior proof’s hash, and that all individual proofs are valid.