Skip to content

Commit

Permalink
Handle value '$' of input_descriptor's 'path' attribute in presentati…
Browse files Browse the repository at this point in the history
…on_submission json
  • Loading branch information
vafeini committed Sep 30, 2024
1 parent 59d21cd commit a246c88
Showing 1 changed file with 6 additions and 2 deletions.
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

0 comments on commit a246c88

Please sign in to comment.