Skip to content

Commit

Permalink
fix: Allow empty issuers in sdr credential request
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Healy committed Oct 1, 2020
1 parent 3414781 commit 453a51c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions __tests__/shared/handleSdrMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,21 @@ export default (testContext: {
expect(verifiableCredential.proof.jwt).toBeDefined()
})

it('should accept empty issuers array', async () => {
const credentials = await agent.getVerifiableCredentialsForSdr({
sdr: {
claims: [
{
claimType: 'name',
issuers: [],
},
],
},
})

expect(credentials[0].credentials[0]).toHaveProperty('proof.jwt')
})

it('should create verifiable presentation', async () => {
const credentials = await agent.getVerifiableCredentialsForSdr({
sdr: {
Expand Down
2 changes: 1 addition & 1 deletion packages/daf-selective-disclosure/src/action-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export class SelectiveDisclosure implements IAgentPlugin {
findArgs.where?.push({ column: 'value', value: [credentialRequest.claimValue] })
}

if (credentialRequest.issuers) {
if (credentialRequest.issuers && credentialRequest.issuers.length > 0) {
findArgs.where?.push({ column: 'issuer', value: credentialRequest.issuers.map((i) => i.did) })
}

Expand Down

0 comments on commit 453a51c

Please sign in to comment.