Skip to content

Commit

Permalink
fix: Create identities from required issuers to resolve gql queries
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Healy committed Apr 23, 2020
1 parent 657f5de commit b93d7ad
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion packages/daf-selective-disclosure/src/helper.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Claim, Presentation } from 'daf-core'
import { Claim, Presentation, Identity } from 'daf-core'
import { SelectiveDisclosureRequest } from './action-handler'
import { In, Like, Connection } from 'typeorm'

Expand Down Expand Up @@ -35,8 +35,20 @@ export const findCredentialsForSdr = async (
}

const claims = await (await dbConnection).getRepository(Claim).find({ where, relations: ['credential'] })
const issuers =
credentialRequest.issuers &&
credentialRequest.issuers.map(iss => {
const issuer = new Identity()
issuer.did = iss.did
return {
url: iss.url,
did: issuer,
}
})

result.push({
...credentialRequest,
issuers,
credentials: claims.map(c => c.credential),
})
}
Expand Down

0 comments on commit b93d7ad

Please sign in to comment.