nzcp-js icon indicating copy to clipboard operation
nzcp-js copied to clipboard

If trusted issuer is supplied, offline function should load up the corresponding did document

Open noway opened this issue 3 years ago • 2 comments
trafficstars

This will more closely resemble online version

verifyPassOffline(validExamplePass, { trustedIssuer: TRUSTED_ISSUERS.MOH_EXAMPLE }) // <-- this fails now

currently if you want to specify TRUSTED_ISSUERS.MOH_EXAMPLE trustedIssuer, you ALSO need to define didDocument

noway avatar Dec 04 '21 10:12 noway

I second this :)

I thought the function was already doing that, but it turns out DID_DOCUMENTS.MOH_LIVE is the fallback when didDocument isn't provided in the options param.

In case somebody else come across the same issue, this code should suffice:

const trustedIssuer = TRUSTED_ISSUERS.MOH_EXAMPLE;
const didDocument = Object.values(DID_DOCUMENTS).find(document => document.id === trustedIssuer);

verifyPassURIOffline(validExamplePass, { trustedIssuer, didDocument });

fappaz avatar Jul 23 '22 09:07 fappaz

Thanks for providing a workaround!

noway avatar Jul 24 '22 22:07 noway