Skip to content

Commit

Permalink
fix: proof configurable on proofRecord (#397)
Browse files Browse the repository at this point in the history
  • Loading branch information
berendsliedrecht authored Jul 20, 2021
1 parent 69684bc commit 8e83c03
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/core/src/modules/proofs/ProofsModule.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { AutoAcceptProof } from './ProofAutoAcceptType'
import type { PresentationPreview } from './messages'
import type { RequestedCredentials, RetrievedCredentials } from './models'
import type { ProofRecord } from './repository/ProofRecord'
Expand Down Expand Up @@ -60,6 +61,7 @@ export class ProofsModule {
presentationProposal: PresentationPreview,
config?: {
comment?: string
autoAcceptProof?: AutoAcceptProof
}
): Promise<ProofRecord> {
const connection = await this.connectionService.getById(connectionId)
Expand Down Expand Up @@ -131,6 +133,7 @@ export class ProofsModule {
proofRequestOptions: Partial<Pick<ProofRequest, 'name' | 'nonce' | 'requestedAttributes' | 'requestedPredicates'>>,
config?: {
comment?: string
autoAcceptProof?: AutoAcceptProof
}
): Promise<ProofRecord> {
const connection = await this.connectionService.getById(connectionId)
Expand Down
5 changes: 5 additions & 0 deletions packages/core/src/modules/proofs/services/ProofService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { AgentMessage } from '../../../agent/AgentMessage'
import type { InboundMessageContext } from '../../../agent/models/InboundMessageContext'
import type { Logger } from '../../../logger'
import type { ConnectionRecord } from '../../connections'
import type { AutoAcceptProof } from '../ProofAutoAcceptType'
import type { ProofStateChangedEvent } from '../ProofEvents'
import type { PresentationPreview, PresentationPreviewAttribute } from '../messages'
import type { CredDef, IndyProof, Schema } from 'indy-sdk'
Expand Down Expand Up @@ -97,6 +98,7 @@ export class ProofService {
presentationProposal: PresentationPreview,
config?: {
comment?: string
autoAcceptProof?: AutoAcceptProof
}
): Promise<ProofProtocolMsgReturnType<ProposePresentationMessage>> {
// Assert
Expand All @@ -114,6 +116,7 @@ export class ProofService {
threadId: proposalMessage.threadId,
state: ProofState.ProposalSent,
proposalMessage,
autoAcceptProof: config?.autoAcceptProof,
})
await this.proofRepository.save(proofRecord)
this.eventEmitter.emit<ProofStateChangedEvent>({
Expand Down Expand Up @@ -273,6 +276,7 @@ export class ProofService {
proofRequest: ProofRequest,
config?: {
comment?: string
autoAcceptProof?: AutoAcceptProof
}
): Promise<ProofProtocolMsgReturnType<RequestPresentationMessage>> {
// Assert
Expand All @@ -297,6 +301,7 @@ export class ProofService {
threadId: requestPresentationMessage.threadId,
requestMessage: requestPresentationMessage,
state: ProofState.RequestSent,
autoAcceptProof: config?.autoAcceptProof,
})

await this.proofRepository.save(proofRecord)
Expand Down

0 comments on commit 8e83c03

Please sign in to comment.