anon-identity
Version:
Decentralized identity framework with DIDs, Verifiable Credentials, and privacy-preserving selective disclosure
86 lines • 2.93 kB
TypeScript
import { Proof, ProofPurpose } from '../types/vc2';
/**
* Manages multiple proofs on credentials and presentations
*/
export declare class ProofManager {
/**
* Add a proof to a document (credential or presentation)
* @param document The document to add proof to
* @param newProof The proof to add
* @returns The document with the new proof added
*/
static addProof<T extends {
proof?: Proof | Proof[];
}>(document: T, newProof: Proof): T;
/**
* Get all proofs from a document
* @param document The document to get proofs from
* @returns Array of proofs (empty if none)
*/
static getProofs(document: {
proof?: Proof | Proof[];
}): Proof[];
/**
* Find proofs by purpose
* @param document The document to search
* @param purpose The proof purpose to find
* @returns Array of matching proofs
*/
static findProofsByPurpose(document: {
proof?: Proof | Proof[];
}, purpose: ProofPurpose | string): Proof[];
/**
* Find proofs by type
* @param document The document to search
* @param type The proof type to find
* @returns Array of matching proofs
*/
static findProofsByType(document: {
proof?: Proof | Proof[];
}, type: string): Proof[];
/**
* Find proofs by verification method
* @param document The document to search
* @param verificationMethod The verification method to find
* @returns Array of matching proofs
*/
static findProofsByVerificationMethod(document: {
proof?: Proof | Proof[];
}, verificationMethod: string): Proof[];
/**
* Validate proof chain (each proof must be created before the next)
* @param proofs Array of proofs to validate
* @returns Validation result
*/
static validateProofChain(proofs: Proof[]): {
valid: boolean;
errors?: string[];
};
/**
* Remove expired proofs
* @param document The document to clean
* @returns The document with expired proofs removed
*/
static removeExpiredProofs<T extends {
proof?: Proof | Proof[];
}>(document: T, now?: Date): T;
/**
* Merge proofs from multiple documents
* @param documents Array of documents with proofs
* @returns Array of all unique proofs
*/
static mergeProofs(...documents: Array<{
proof?: Proof | Proof[];
}>): Proof[];
/**
* Check if a document has a valid proof for a given purpose
* @param document The document to check
* @param purpose The proof purpose required
* @param verifierDIDs Optional list of acceptable verifier DIDs
* @returns Whether a valid proof exists
*/
static hasValidProofForPurpose(document: {
proof?: Proof | Proof[];
}, purpose: ProofPurpose | string, verifierDIDs?: string[]): boolean;
}
//# sourceMappingURL=proof-manager.d.ts.map