import type { TagsBase, RecordTags } from '@credo-ts/core'; import { BaseRecord } from '@credo-ts/core'; export type ThresholdSessionStatus = 'pending' | 'complete' | 'expired' | 'failed'; export interface CollectedShare { /** Share index (1-based) */ identifier: number; /** Base64url-encoded share data */ data: string; /** DID of the participant who provided this share */ providedBy: string; /** When the share was provided */ providedAt: Date; } export type CustomThresholdSessionTags = TagsBase; export type DefaultThresholdSessionTags = { sessionId: string; vaultId: string; docId: string; status: ThresholdSessionStatus; initiatedBy: string; }; export type ThresholdSessionTags = RecordTags; export interface ThresholdSessionRecordProps { id?: string; createdAt?: Date; updatedAt?: Date; tags?: CustomThresholdSessionTags; sessionId: string; vaultId: string; docId: string; threshold: number; totalShares: number; status: ThresholdSessionStatus; shares: CollectedShare[]; reconstructedCek?: string; initiatedBy: string; expiresAt?: Date; purpose?: string; } /** * Database record for a threshold share collection session * * Used to track the collection of Shamir secret shares * for threshold (t-of-n) vault decryption */ export declare class ThresholdSessionRecord extends BaseRecord { /** Unique session identifier */ sessionId: string; /** Associated vault ID */ vaultId: string; /** Associated document ID */ docId: string; /** Minimum shares required (t) */ threshold: number; /** Total shares (n) */ totalShares: number; /** Current session status */ status: ThresholdSessionStatus; /** Collected shares so far */ shares: CollectedShare[]; /** Reconstructed CEK (only set when threshold met) */ reconstructedCek?: string; /** DID of the session initiator */ initiatedBy: string; /** When the session expires */ expiresAt?: Date; /** Purpose of this reconstruction session */ purpose?: string; static readonly type = "ThresholdSessionRecord"; readonly type = "ThresholdSessionRecord"; constructor(props: ThresholdSessionRecordProps); getTags(): DefaultThresholdSessionTags & CustomThresholdSessionTags; /** * Check if threshold has been met */ get isThresholdMet(): boolean; /** * Check if session has expired */ get isExpired(): boolean; /** * Get number of shares still needed */ get sharesNeeded(): number; /** * Check if a participant has already provided a share */ hasShareFrom(participantDid: string): boolean; /** * Add a share to the collection */ addShare(share: CollectedShare): void; }