import type { AgentContext } from '../../../../agent'; import type { AgentMessage } from '../../../../agent/AgentMessage'; import type { FeatureRegistry } from '../../../../agent/FeatureRegistry'; import type { InboundMessageContext } from '../../../../agent/models/InboundMessageContext'; import type { DependencyManager } from '../../../../plugins'; import type { ProblemReportMessage } from '../../../problem-reports'; import type { ProofFormatService } from '../../formats/ProofFormatService'; import type { ProofProtocol } from '../ProofProtocol'; import type { AcceptPresentationOptions, AcceptProofProposalOptions, AcceptProofRequestOptions, CreateProofProblemReportOptions, CreateProofProposalOptions, CreateProofRequestOptions, GetCredentialsForRequestOptions, GetCredentialsForRequestReturn, GetProofFormatDataReturn, NegotiateProofProposalOptions, NegotiateProofRequestOptions, ProofProtocolMsgReturnType, SelectCredentialsForRequestOptions, SelectCredentialsForRequestReturn } from '../ProofProtocolOptions'; import { V2ProposeCredentialMessage } from '../../../credentials'; import { ProofExchangeRecord } from '../../repository'; import { BaseProofProtocol } from '../BaseProofProtocol'; import { V2PresentationAckMessage, V2RequestPresentationMessage } from './messages'; import { V2PresentationMessage } from './messages/V2PresentationMessage'; import { V2ProposePresentationMessage } from './messages/V2ProposePresentationMessage'; export interface V2ProofProtocolConfig { proofFormats: ProofFormatServices; } export declare class V2ProofProtocol extends BaseProofProtocol implements ProofProtocol { private proofFormatCoordinator; private proofFormats; constructor({ proofFormats }: V2ProofProtocolConfig); /** * The version of the present proof protocol this service supports */ readonly version: "v2"; register(dependencyManager: DependencyManager, featureRegistry: FeatureRegistry): void; createProposal(agentContext: AgentContext, { connectionRecord, proofFormats, comment, autoAcceptProof, goalCode, parentThreadId, }: CreateProofProposalOptions): Promise<{ proofRecord: ProofExchangeRecord; message: AgentMessage; }>; /** * Method called by {@link V2ProposeCredentialHandler} on reception of a propose presentation message * We do the necessary processing here to accept the proposal and do the state change, emit event etc. * @param messageContext the inbound propose presentation message * @returns proof record appropriate for this incoming message (once accepted) */ processProposal(messageContext: InboundMessageContext): Promise; acceptProposal(agentContext: AgentContext, { proofRecord, proofFormats, autoAcceptProof, comment, goalCode, willConfirm }: AcceptProofProposalOptions): Promise>; /** * Negotiate a proof proposal as verifier (by sending a proof request message) to the connection * associated with the proof record. * * @param options configuration for the request see {@link NegotiateProofProposalOptions} * @returns Proof exchange record associated with the proof request * */ negotiateProposal(agentContext: AgentContext, { proofRecord, proofFormats, autoAcceptProof, comment, goalCode, willConfirm }: NegotiateProofProposalOptions): Promise>; /** * Create a {@link V2RequestPresentationMessage} as beginning of protocol process. * @returns Object containing request message and associated credential record * */ createRequest(agentContext: AgentContext, { proofFormats, autoAcceptProof, comment, connectionRecord, parentThreadId, goalCode, willConfirm, }: CreateProofRequestOptions): Promise>; /** * Process a received {@link V2RequestPresentationMessage}. This will not accept the proof request * or send a proof. It will only update the existing proof record with * the information from the proof request message. Use {@link createCredential} * after calling this method to create a proof. *z * @param messageContext The message context containing a v2 proof request message * @returns proof record associated with the proof request message * */ processRequest(messageContext: InboundMessageContext): Promise; acceptRequest(agentContext: AgentContext, { proofRecord, autoAcceptProof, comment, proofFormats, goalCode }: AcceptProofRequestOptions): Promise<{ proofRecord: ProofExchangeRecord; message: V2PresentationMessage; }>; /** * Create a {@link V2ProposePresentationMessage} as response to a received credential request. * To create a proposal not bound to an existing proof exchange, use {@link createProposal}. * * @param options configuration to use for the proposal * @returns Object containing proposal message and associated proof record * */ negotiateRequest(agentContext: AgentContext, { proofRecord, proofFormats, autoAcceptProof, comment, goalCode }: NegotiateProofRequestOptions): Promise>; getCredentialsForRequest(agentContext: AgentContext, { proofRecord, proofFormats }: GetCredentialsForRequestOptions): Promise>; selectCredentialsForRequest(agentContext: AgentContext, { proofRecord, proofFormats }: SelectCredentialsForRequestOptions): Promise>; processPresentation(messageContext: InboundMessageContext): Promise; acceptPresentation(agentContext: AgentContext, { proofRecord }: AcceptPresentationOptions): Promise>; processAck(messageContext: InboundMessageContext): Promise; createProblemReport(agentContext: AgentContext, { description, proofRecord }: CreateProofProblemReportOptions): Promise>; shouldAutoRespondToProposal(agentContext: AgentContext, options: { proofRecord: ProofExchangeRecord; proposalMessage: V2ProposePresentationMessage; }): Promise; shouldAutoRespondToRequest(agentContext: AgentContext, options: { proofRecord: ProofExchangeRecord; requestMessage: V2RequestPresentationMessage; }): Promise; shouldAutoRespondToPresentation(agentContext: AgentContext, options: { proofRecord: ProofExchangeRecord; presentationMessage: V2PresentationMessage; }): Promise; findRequestMessage(agentContext: AgentContext, proofRecordId: string): Promise; findPresentationMessage(agentContext: AgentContext, proofRecordId: string): Promise; findProposalMessage(agentContext: AgentContext, proofRecordId: string): Promise; getFormatData(agentContext: AgentContext, proofRecordId: string): Promise; /** * Get all the format service objects for a given proof format from an incoming message * @param messageFormats the format objects containing the format name (eg indy) * @return the proof format service objects in an array - derived from format object keys */ private getFormatServicesFromMessage; /** * Get all the format service objects for a given proof format * @param proofFormats the format object containing various optional parameters * @return the proof format service objects in an array - derived from format object keys */ private getFormatServices; private getFormatServiceForFormatKey; private getFormatServiceForFormat; }