import { ConcordiumGRPCClient } from '../../grpc/index.js'; import { Network } from '../../types.js'; import { BlockHash, TransactionHash } from '../../types/index.js'; import { VerifiablePresentationV1, VerificationRequestV1 } from './index.js'; import { AnchorTransactionMetadata } from './internal.js'; import { VerificationResult } from './proof.js'; /** * A verification audit record that contains the complete verifiable presentation * request and response data. This record maintains the full audit trail of a verification * interaction, including all sensitive data that should be kept private. * * Audit records are used internally by verifiers to maintain complete records * of verification interactions, while only publishing hash-based public records on-chain * to preserve privacy. */ declare class VerificationAuditRecordV1 { readonly request: VerificationRequestV1.Type; readonly presentation: VerifiablePresentationV1.Type; readonly id: string; /** * Creates a new verification audit record. * * @param request - The verifiable presentation request that was made * @param presentation - The verifiable presentation that was provided in response * @param id - Unique identifier for this audit record */ constructor(request: VerificationRequestV1.Type, presentation: VerifiablePresentationV1.Type, id: string); /** * Serializes the audit record to a JSON representation. * * @returns The JSON representation of this audit record */ toJSON(): JSON; } /** * A verification audit record that contains the complete verifiable presentation * request and response data. This record maintains the full audit trail of a verification * interaction, including all sensitive data that should be kept private. * * Audit records are used internally by verifiers to maintain complete records * of verification interactions, while only publishing hash-based public records on-chain * to preserve privacy. */ export type Type = VerificationAuditRecordV1; /** * JSON representation of a verification audit record. * Contains the serialized forms of the request and presentation data. */ export type JSON = Pick & { /** The type identifier for the audit record */ type: 'ConcordiumVerificationAuditRecord'; /** The audit record version */ version: 1; /** The serialized verifiable presentation request */ request: VerificationRequestV1.JSON; /** The serialized verifiable presentation */ presentation: VerifiablePresentationV1.JSON; }; /** * Creates a new verification audit record. * * @param id - Unique identifier for the audit record * @param request - The verifiable presentation request * @param presentation - The corresponding verifiable presentation * * @returns A new verification audit record instance */ export declare function create(id: string, request: VerificationRequestV1.Type, presentation: VerifiablePresentationV1.Type): VerificationAuditRecordV1; /** * Creates a verification audit record after performing comprehensive validation of the presentation against the request. * * @param id - Unique identifier for the audit record * @param request - The verification request containing statements to verify * @param presentation - The verifiable presentation to validate * @param grpc - Concordium gRPC client for on-chain verification * @param network - Network identifier for verification context * @param blockHash - Optional block hash to verify against a specific chain state * * @returns A verification result containing either the audit record on success or an error on failure * * @remarks * This function performs four validation steps: * 1. Compares contexts between request and presentation * 2. Verifies cryptographic integrity of the presentation with public on-chain data * 3. Checks that all credentials are active * 4. Checks that the verification request anchor corresponding to the `request` has been registered on-chain * 4. Validates presentation claims against request statements */ export declare function createChecked(id: string, request: VerificationRequestV1.Type, presentation: VerifiablePresentationV1.Type, grpc: ConcordiumGRPCClient, network: Network, blockHash?: BlockHash.Type): Promise>; /** * Deserializes a verification audit record from its JSON representation. * * @param json - The JSON representation to deserialize * @returns The deserialized verification audit record */ export declare function fromJSON(json: JSON): VerificationAuditRecordV1; /** * Describes the verification audit anchor data registered on chain. */ export type Anchor = { /** Type identifier for _Concordium Verification Audit Anchor_ */ type: 'CCDVAA'; /** Version of the anchor data format */ version: number; /** The SHA-256 hash of the audit record, encoded as a hex string */ hash: Uint8Array; /** Optional public information that can be included in the anchor */ public?: Record; }; /** * Converts a verification audit record to its corresponding anchor representation encoding. * * This function creates a privacy-preserving public record that contains only * a hash of the record data, suitable for publishing on-chain while * maintaining the privacy of the original verification interaction. * * @param record - The audit record to convert * @param info - Optional additional public information to include * * @returns The anchor encoding corresponding to the audit record */ export declare function createAnchor(record: VerificationAuditRecordV1, info?: Record): Uint8Array; /** * Decodes a CBOR-encoded verification audit anchor. * * This function parses and validates a CBOR-encoded anchor that was previously * created with `createAnchor`. It ensures the anchor has the correct format * and contains all required fields. * * @param cbor - The CBOR-encoded anchor data to decode * @returns The decoded anchor data structure * @throws Error if the CBOR data is invalid or doesn't match expected format */ export declare function decodeAnchor(cbor: Uint8Array): Anchor; /** * Computes a hash of the audit record. * * This hash is used to create a tamper-evident anchor that can be stored * on-chain to prove the request was made at a specific time and with * specific parameters. * * @param record - The audit record to compute the hash of * * @returns SHA-256 hash of the serialized audit record */ export declare function computeAnchorHash(record: VerificationAuditRecordV1, info?: Record): Uint8Array; /** * Verifies that an audit record's anchor has been properly registered on-chain. * * This function checks that: * 1. The transaction is finalized * 2. The transaction is a RegisterData transaction * 3. The registered anchor hash matches the computed hash of the audit record * * @param auditRecord - The audit record to verify * @param anchorTransactionRef - The transaction hash of the anchor registration * @param grpc - The gRPC client for blockchain queries * * @returns The transaction outcome if verification succeeds * @throws Error if the transaction is not finalized, has wrong type, or hash mismatch */ export declare function verifyAnchor(auditRecord: VerificationAuditRecordV1, anchorTransactionRef: TransactionHash.Type, grpc: ConcordiumGRPCClient): Promise; type AnchorData = { /** * Transaction metadata for the anchor registration (sender, nonce) */ metadata: AnchorTransactionMetadata; /** * Optional public metadata to include in the anchor */ info?: Record; }; type VerificationData = { /** * The chain network identifier */ network: Network; /** * Optional block hash for querying public info for presentation verification */ blockHash?: BlockHash.Type; }; /** * Creates a verification audit record and anchors it on-chain in a single operation. * * This is a convenience function that: * 1. Creates and validates an audit record using `createChecked` * 2. Registers the audit record anchor on-chain using `registerAnchor` * * @param id - Unique identifier for the audit record * @param request - The verification request being audited * @param presentation - The verifiable presentation being verified * @param grpc - The gRPC client for blockchain queries and transactions * @param anchorData - Transaction metadata for the anchor registration (sender, nonce) + public info * @param verificationData - The network identifier and optional block hash to query information at. * * @returns A verification result containing the audit record and anchor transaction hash */ export declare function createAndAnchor(id: string, request: VerificationRequestV1.Type, presentation: VerifiablePresentationV1.Type, grpc: ConcordiumGRPCClient, { metadata, info }: AnchorData, { network, blockHash }: VerificationData): Promise>; /** * Registers a public verification audit record on the Concordium blockchain. * * This function converts a audit record to a public one and registers * it as transaction data on the blockchain. This provides a verifiable timestamp * and immutable record of the verification event while preserving privacy. * * @param record - The audit record to register publicly * @param grpc - The Concordium GRPC client for blockchain interaction * @param anchorTransactionMetadata - The metadata used for registering the anchor transaction on chain. * @param info - Optional additional public information to include * * @returns Promise resolving to the transaction hash * @throws Error if the transaction fails or network issues occur */ export declare function registerAnchor(record: VerificationAuditRecordV1, grpc: ConcordiumGRPCClient, { sender, sequenceNumber, signer }: AnchorTransactionMetadata, info?: Record): Promise; export {};