Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle value '$' of input_descriptor's 'path' attribute in presentati… #88

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,19 @@ export class WalletResponseProcessorService {
}

mapVpTokenToAttestations(concludedTransaction: ConcludedTransaction): SharedAttestation[] {
console.log(concludedTransaction);
let presentationSubmission = concludedTransaction.walletResponse.presentation_submission;
let vpToken: string[] = concludedTransaction.walletResponse.vp_token!!;
let arrayAsJson = JSON.parse(JSON.stringify(vpToken))

return presentationSubmission.descriptor_map.map((descriptor) => {
let format = descriptor.format as AttestationFormat;
// locate item in vp_token array
let sharedStr = JSONPath({path: descriptor.path, json: arrayAsJson})[0]
let sharedStr;
if (descriptor.path === "$") {
sharedStr = vpToken[0]
} else {
sharedStr = JSONPath({path: descriptor.path, json: arrayAsJson})[0]
}
// get appropriate decoder
let decoder = this.decoders.decoderOf(format);
// decode to SharedAttestation
Expand Down
Loading