import type { AgentMessage } from '../../../../agent/AgentMessage'; import type { HandlerInboundMessage } from '../../../../agent/Handler'; import type { InboundMessageContext } from '../../../../agent/models/InboundMessageContext'; import type { ProblemReportMessage } from '../../../problem-reports'; import type { AcceptCredentialOptions, AcceptOfferOptions, AcceptProposalOptions, AcceptRequestOptions, CreateOfferOptions, CreateProblemReportOptions, CreateProposalOptions, CredentialProtocolMsgReturnType, NegotiateOfferOptions, NegotiateProposalOptions } from '../../CredentialServiceOptions'; import type { GetFormatDataReturn } from '../../CredentialsModuleOptions'; import type { CredentialFormat } from '../../formats'; import type { IndyCredentialFormat } from '../../formats/indy/IndyCredentialFormat'; import { AgentConfig } from '../../../../agent/AgentConfig'; import { Dispatcher } from '../../../../agent/Dispatcher'; import { EventEmitter } from '../../../../agent/EventEmitter'; import { DidCommMessageRepository } from '../../../../storage'; import { ConnectionService } from '../../../connections/services'; import { RoutingService } from '../../../routing/services/RoutingService'; import { IndyCredentialFormatService } from '../../formats/indy/IndyCredentialFormatService'; import { CredentialRepository, CredentialExchangeRecord } from '../../repository'; import { CredentialService } from '../../services'; import { V1OfferCredentialHandler } from './handlers'; import { V1CredentialAckMessage, V1IssueCredentialMessage, V1OfferCredentialMessage, V1ProposeCredentialMessage, V1RequestCredentialMessage } from './messages'; export declare class V1CredentialService extends CredentialService<[IndyCredentialFormat]> { private connectionService; private formatService; private routingService; constructor(connectionService: ConnectionService, didCommMessageRepository: DidCommMessageRepository, agentConfig: AgentConfig, routingService: RoutingService, dispatcher: Dispatcher, eventEmitter: EventEmitter, credentialRepository: CredentialRepository, formatService: IndyCredentialFormatService); /** * The version of the issue credential protocol this service supports */ readonly version = "v1"; getFormatServiceForRecordType(credentialRecordType: string): IndyCredentialFormatService; /** * Create a {@link ProposeCredentialMessage} not bound to an existing credential exchange. * To create a proposal as response to an existing credential exchange, use {@link createProposalAsResponse}. * * @param options The object containing config options * @returns Object containing proposal message and associated credential record * */ createProposal({ connection, credentialFormats, comment, autoAcceptCredential, }: CreateProposalOptions<[IndyCredentialFormat]>): Promise>; /** * Process a received {@link ProposeCredentialMessage}. This will not accept the credential proposal * or send a credential offer. It will only create a new, or update the existing credential record with * the information from the credential proposal message. Use {@link createOfferAsResponse} * after calling this method to create a credential offer. * * @param messageContext The message context containing a credential proposal message * @returns credential record associated with the credential proposal message * */ processProposal(messageContext: InboundMessageContext): Promise; /** * Processing an incoming credential message and create a credential offer as a response * @param options The object containing config options * @returns Object containing proposal message and associated credential record */ acceptProposal({ credentialRecord, credentialFormats, comment, autoAcceptCredential, }: AcceptProposalOptions<[IndyCredentialFormat]>): Promise>; /** * Negotiate a credential proposal as issuer (by sending a credential offer message) to the connection * associated with the credential record. * * @param options configuration for the offer see {@link NegotiateProposalOptions} * @returns Credential record associated with the credential offer and the corresponding new offer message * */ negotiateProposal({ credentialFormats, credentialRecord, comment, autoAcceptCredential, }: NegotiateProposalOptions<[IndyCredentialFormat]>): Promise>; /** * Create a {@link OfferCredentialMessage} not bound to an existing credential exchange. * To create an offer as response to an existing credential exchange, use {@link V1CredentialService#createOfferAsResponse}. * * @param options The options containing config params for creating the credential offer * @returns Object containing offer message and associated credential record * */ createOffer({ credentialFormats, autoAcceptCredential, comment, connection, }: CreateOfferOptions<[IndyCredentialFormat]>): Promise>; /** * Process a received {@link OfferCredentialMessage}. This will not accept the credential offer * or send a credential request. It will only create a new credential record with * the information from the credential offer message. Use {@link createRequest} * after calling this method to create a credential request. * * @param messageContext The message context containing a credential request message * @returns credential record associated with the credential offer message * */ processOffer(messageContext: HandlerInboundMessage): Promise; /** * Create a {@link RequestCredentialMessage} as response to a received credential offer. * * @param options configuration to use for the credential request * @returns Object containing request message and associated credential record * */ acceptOffer({ credentialRecord, credentialFormats, comment, autoAcceptCredential, }: AcceptOfferOptions<[IndyCredentialFormat]>): Promise>; /** * Process a received {@link RequestCredentialMessage}. This will not accept the credential request * or send a credential. It will only update the existing credential record with * the information from the credential request message. Use {@link createCredential} * after calling this method to create a credential. * * @param messageContext The message context containing a credential request message * @returns credential record associated with the credential request message * */ negotiateOffer({ credentialFormats, credentialRecord, autoAcceptCredential, comment, }: NegotiateOfferOptions<[IndyCredentialFormat]>): Promise>; /** * Starting from a request is not supported in v1 of the issue credential protocol * because indy doesn't allow to start from a request */ createRequest(): Promise>; /** * Process a received {@link IssueCredentialMessage}. This will not accept the credential * or send a credential acknowledgement. It will only update the existing credential record with * the information from the issue credential message. Use {@link createAck} * after calling this method to create a credential acknowledgement. * * @param messageContext The message context containing an issue credential message * * @returns credential record associated with the issue credential message * */ processRequest(messageContext: InboundMessageContext): Promise; /** * Create a {@link IssueCredentialMessage} as response to a received credential request. * * @returns Object containing issue credential message and associated credential record * */ acceptRequest({ credentialRecord, credentialFormats, comment, autoAcceptCredential, }: AcceptRequestOptions<[IndyCredentialFormat]>): Promise>; /** * Process an incoming {@link IssueCredentialMessage} * * @param messageContext The message context containing a credential acknowledgement message * @returns credential record associated with the credential acknowledgement message * */ processCredential(messageContext: InboundMessageContext): Promise; /** * Create a {@link CredentialAckMessage} as response to a received credential. * * @param credentialRecord The credential record for which to create the credential acknowledgement * @returns Object containing credential acknowledgement message and associated credential record * */ acceptCredential({ credentialRecord, }: AcceptCredentialOptions): Promise>; /** * Process a received {@link CredentialAckMessage}. * * @param messageContext The message context containing a credential acknowledgement message * @returns credential record associated with the credential acknowledgement message * */ processAck(messageContext: InboundMessageContext): Promise; /** * Create a {@link V1CredentialProblemReportMessage} to be sent. * * @param message message to send * @returns a {@link V1CredentialProblemReportMessage} * */ createProblemReport(options: CreateProblemReportOptions): ProblemReportMessage; shouldAutoRespondToProposal(options: { credentialRecord: CredentialExchangeRecord; proposalMessage: V1ProposeCredentialMessage; }): Promise; shouldAutoRespondToOffer(options: { credentialRecord: CredentialExchangeRecord; offerMessage: V1OfferCredentialMessage; }): Promise; shouldAutoRespondToRequest(options: { credentialRecord: CredentialExchangeRecord; requestMessage: V1RequestCredentialMessage; }): Promise; shouldAutoRespondToCredential(options: { credentialRecord: CredentialExchangeRecord; credentialMessage: V1IssueCredentialMessage; }): Promise; findProposalMessage(credentialExchangeId: string): Promise; findOfferMessage(credentialExchangeId: string): Promise; findRequestMessage(credentialExchangeId: string): Promise; findCredentialMessage(credentialExchangeId: string): Promise; getFormatData(credentialExchangeId: string): Promise>; protected registerHandlers(): void; private rfc0592ProposalFromV1ProposeMessage; private assertOnlyIndyFormat; }