import type { ProofFormat, ProofFormatCredentialForRequestPayload, ProofFormatPayload } from './ProofFormat'; import type { ProofFormatService } from './ProofFormatService'; import type { Attachment } from '../../../decorators/attachment/Attachment'; import type { ProofFormatSpec } from '../models/ProofFormatSpec'; import type { ProofExchangeRecord } from '../repository/ProofExchangeRecord'; /** * Infer the {@link ProofFormat} based on a {@link ProofFormatService}. * * It does this by extracting the `ProofFormat` generic from the `ProofFormatService`. * * @example * ``` * // TheProofFormat is now equal to IndyProofFormat * type TheProofFormat = ExtractProofFormat * ``` * * Because the `IndyProofFormatService` is defined as follows: * ``` * class IndyProofFormatService implements ProofFormatService { * } * ``` */ export type ExtractProofFormat = Type extends ProofFormatService ? ProofFormat : never; /** * Infer an array of {@link ProofFormat} types based on an array of {@link ProofFormatService} types. * * This is based on {@link ExtractProofFormat}, but allows to handle arrays. */ export type ExtractProofFormats = { [PF in keyof PFs]: ExtractProofFormat; }; /** * Base return type for all methods that create an attachment format. * * It requires an attachment and a format to be returned. */ export interface ProofFormatCreateReturn { format: ProofFormatSpec; attachment: Attachment; } /** * Base type for all proof process methods. */ export interface ProofFormatProcessOptions { attachment: Attachment; proofRecord: ProofExchangeRecord; } export interface ProofFormatProcessPresentationOptions extends ProofFormatProcessOptions { requestAttachment: Attachment; } export interface ProofFormatCreateProposalOptions { proofRecord: ProofExchangeRecord; proofFormats: ProofFormatPayload<[PF], 'createProposal'>; attachmentId?: string; } export interface ProofFormatAcceptProposalOptions { proofRecord: ProofExchangeRecord; proofFormats?: ProofFormatPayload<[PF], 'acceptProposal'>; attachmentId?: string; proposalAttachment: Attachment; } export interface FormatCreateRequestOptions { proofRecord: ProofExchangeRecord; proofFormats: ProofFormatPayload<[PF], 'createRequest'>; attachmentId?: string; } export interface ProofFormatAcceptRequestOptions { proofRecord: ProofExchangeRecord; proofFormats?: ProofFormatPayload<[PF], 'acceptRequest'>; attachmentId?: string; requestAttachment: Attachment; proposalAttachment?: Attachment; } export interface ProofFormatGetCredentialsForRequestOptions { proofRecord: ProofExchangeRecord; proofFormats?: ProofFormatCredentialForRequestPayload<[PF], 'getCredentialsForRequest', 'input'>; requestAttachment: Attachment; proposalAttachment?: Attachment; } export type ProofFormatGetCredentialsForRequestReturn = PF['proofFormats']['getCredentialsForRequest']['output']; export interface ProofFormatSelectCredentialsForRequestOptions { proofRecord: ProofExchangeRecord; proofFormats?: ProofFormatCredentialForRequestPayload<[PF], 'selectCredentialsForRequest', 'input'>; requestAttachment: Attachment; proposalAttachment?: Attachment; } export type ProofFormatSelectCredentialsForRequestReturn = PF['proofFormats']['selectCredentialsForRequest']['output']; export interface ProofFormatAutoRespondProposalOptions { proofRecord: ProofExchangeRecord; proposalAttachment: Attachment; requestAttachment: Attachment; } export interface ProofFormatAutoRespondRequestOptions { proofRecord: ProofExchangeRecord; requestAttachment: Attachment; proposalAttachment: Attachment; } export interface ProofFormatAutoRespondPresentationOptions { proofRecord: ProofExchangeRecord; proposalAttachment?: Attachment; requestAttachment: Attachment; presentationAttachment: Attachment; }