import type { AgentConfig } from '../../../agent/AgentConfig'; import type { AgentMessage } from '../../../agent/AgentMessage'; import type { Dispatcher } from '../../../agent/Dispatcher'; import type { EventEmitter } from '../../../agent/EventEmitter'; import type { InboundMessageContext } from '../../../agent/models/InboundMessageContext'; import type { Logger } from '../../../logger'; import type { DidCommMessageRepository } from '../../../storage'; import type { ProblemReportMessage } from '../../problem-reports'; import type { CreateProposalOptions, CredentialProtocolMsgReturnType, DeleteCredentialOptions, AcceptProposalOptions, NegotiateProposalOptions, CreateOfferOptions, NegotiateOfferOptions, CreateRequestOptions, AcceptOfferOptions, AcceptRequestOptions, AcceptCredentialOptions, GetFormatDataReturn, CreateProblemReportOptions } from '../CredentialServiceOptions'; import type { CredentialFormat, CredentialFormatService } from '../formats'; import type { CredentialExchangeRecord, CredentialRepository } from './../repository'; import { CredentialState } from '../models/CredentialState'; export declare abstract class CredentialService { protected credentialRepository: CredentialRepository; protected didCommMessageRepository: DidCommMessageRepository; protected eventEmitter: EventEmitter; protected dispatcher: Dispatcher; protected agentConfig: AgentConfig; protected logger: Logger; constructor(credentialRepository: CredentialRepository, didCommMessageRepository: DidCommMessageRepository, eventEmitter: EventEmitter, dispatcher: Dispatcher, agentConfig: AgentConfig); abstract readonly version: string; abstract getFormatServiceForRecordType(credentialRecordType: CFs[number]['credentialRecordType']): CredentialFormatService; abstract createProposal(options: CreateProposalOptions): Promise>; abstract processProposal(messageContext: InboundMessageContext): Promise; abstract acceptProposal(options: AcceptProposalOptions): Promise>; abstract negotiateProposal(options: NegotiateProposalOptions): Promise>; abstract createOffer(options: CreateOfferOptions): Promise>; abstract processOffer(messageContext: InboundMessageContext): Promise; abstract acceptOffer(options: AcceptOfferOptions): Promise>; abstract negotiateOffer(options: NegotiateOfferOptions): Promise>; abstract createRequest(options: CreateRequestOptions): Promise>; abstract processRequest(messageContext: InboundMessageContext): Promise; abstract acceptRequest(options: AcceptRequestOptions): Promise>; abstract processCredential(messageContext: InboundMessageContext): Promise; abstract acceptCredential(options: AcceptCredentialOptions): Promise>; abstract processAck(messageContext: InboundMessageContext): Promise; abstract createProblemReport(options: CreateProblemReportOptions): ProblemReportMessage; abstract findProposalMessage(credentialExchangeId: string): Promise; abstract findOfferMessage(credentialExchangeId: string): Promise; abstract findRequestMessage(credentialExchangeId: string): Promise; abstract findCredentialMessage(credentialExchangeId: string): Promise; abstract getFormatData(credentialExchangeId: string): Promise>; /** * Decline a credential offer * @param credentialRecord The credential to be declined */ declineOffer(credentialRecord: CredentialExchangeRecord): Promise; /** * Process a received credential {@link ProblemReportMessage}. * * @param messageContext The message context containing a credential problem report message * @returns credential record associated with the credential problem report message */ processProblemReport(messageContext: InboundMessageContext): Promise; /** * Update the record to a new state and emit an state changed event. Also updates the record * in storage. * * @param credentialRecord The credential record to update the state for * @param newState The state to update to * */ updateState(credentialRecord: CredentialExchangeRecord, newState: CredentialState): Promise; protected emitStateChangedEvent(credentialRecord: CredentialExchangeRecord, previousState: CredentialState | null): void; /** * Retrieve a credential record by id * * @param credentialRecordId The credential record id * @throws {RecordNotFoundError} If no record is found * @return The credential record * */ getById(credentialRecordId: string): Promise; /** * Retrieve all credential records * * @returns List containing all credential records */ getAll(): Promise; /** * Find a credential record by id * * @param credentialRecordId the credential record id * @returns The credential record or null if not found */ findById(connectionId: string): Promise; delete(credentialRecord: CredentialExchangeRecord, options?: DeleteCredentialOptions): Promise; /** * Retrieve a credential record by connection id and thread id * * @param connectionId The connection id * @param threadId The thread id * @throws {RecordNotFoundError} If no record is found * @throws {RecordDuplicateError} If multiple records are found * @returns The credential record */ getByThreadAndConnectionId(threadId: string, connectionId?: string): Promise; /** * Find a credential record by connection id and thread id, returns null if not found * * @param connectionId The connection id * @param threadId The thread id * @returns The credential record */ findByThreadAndConnectionId(threadId: string, connectionId?: string): Promise; update(credentialRecord: CredentialExchangeRecord): Promise; }