Closed lautom36 closed 11 months ago
I'm seeing the same thing for the Learner Credential Wallet.
Hitting vc.verifyCredential
with the revoked credential @lautom36 attached above returns the following response:
{
"verified": false,
"results": [
{
"proof": {
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://w3id.org/security/suites/ed25519-2020/v1",
"https://w3id.org/dcc/v1",
"https://w3id.org/vc/status-list/2021/v1"
],
"type": "Ed25519Signature2020",
"created": "2022-08-19T06:58:29Z",
"verificationMethod": "did:key:z6MkhVTX9BF3NGYX6cc7jWpbNnR7cAjH8LUffabZP8Qu4ysC#z6MkhVTX9BF3NGYX6cc7jWpbNnR7cAjH8LUffabZP8Qu4ysC",
"proofPurpose": "assertionMethod",
"proofValue": "z33Wy3kvx8UEoPHdQWYHVCXAjW19AZpA88NnikwfJqcH9oNmHyqSkt6wiVS31ewytAX7m2vneVEm8Awo4xzqKHYUp"
},
"verified": false,
"error": {
"name": "Error",
"message": "Invalid signature.",
"stack": "..."
}
}
],
"error": {
"name": "VerificationError",
"errors": [
{
"name": "Error",
"message": "Invalid signature.",
"stack": "..."
}
]
}
}
The response does not contain a log
property. It does return Invalid signature
as the error message, but I imagine we don't want to parse from that for the credential status UI checks, and use the the log mapping instead.
@lautom36
When verifying the attached credential on verifier plus the returned verificationResult does not have a log. revokedCredential.zip
Ok, so, there's a couple things going on here. The first was -- for bizarre reasons, when verification was encountering a TypeError
, it came back like this:
{
"verified": false,
"results": [
// ... results were here
],
"error": {}
}
Notice the empty object for the error
property -- apparently, TypeError
JSON.stringifies to {}
.
This behavior is changed in PR https://github.com/digitalcredentials/vc/pull/8, published as v4.2.0
. Now, when a TypeError is encountered, it just re-throws it instead of adding it to the results log. I believe this is the desired behavior specifically in the case of type errors -- other VC-related errors will go into the error log as usual.
So after PR 8, the actual error surfaced: TypeError: A "checkStatus" function must be given to verify credentials with "credentialStatus".
Ok, so far so good, that's expected.
And when I passed in checkStatus
, as required, the VC from your revokedCredential.zip verified correctly (flagging the revoked status).
To reproduce:
import { checkStatus } from '@digitalcredentials/vc-status-list';
import { Ed25519Signature2020 } from '@digitalcredentials/ed25519-signature-2020';
import { securityLoader } from '@digitalcredentials/security-document-loader';
import vc from '@digitalcredentials/vc';
// From the zipped file
const revokedCredential = {
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://w3id.org/security/suites/ed25519-2020/v1",
"https://w3id.org/dcc/v1",
"https://w3id.org/vc/status-list/2021/v1"
],
"type": [
"VerifiableCredential",
"Assertion"
],
"issuer": {
"id": "did:key:z6MkhVTX9BF3NGYX6cc7jWpbNnR7cAjH8LUffabZP8Qu4ysC",
"name": "Example University",
"url": "https://cs.example.edu",
"image": "https://user-images.githubusercontent.com/947005/133544904-29d6139d-2e7b-4fe2-b6e9-7d1022bb6a45.png"
},
"issuanceDate": "2020-08-16T12:00:00.000+00:00",
"credentialSubject": {
"id": "did:key:z6MkhVTX9BF3NGYX6cc7jWpbNnR7cAjH8LUffabZP8Qu4ysC",
"name": "Kayode Ezike",
"hasCredential": {
"type": [
"EducationalOccupationalCredential"
],
"name": "GT Guide",
"description": "The holder of this credential is qualified to lead new student orientations."
}
},
"expirationDate": "2025-08-16T12:00:00.000+00:00",
"credentialStatus": {
"id": "https://digitalcredentials.github.io/credential-status-playground/JWZM3H8WKU#3",
"type": "StatusList2021Entry",
"statusPurpose": "revocation",
"statusListIndex": 3,
"statusListCredential": "https://digitalcredentials.github.io/credential-status-playground/JWZM3H8WKU"
},
"proof": {
"type": "Ed25519Signature2020",
"created": "2022-08-19T06:58:29Z",
"verificationMethod": "did:key:z6MkhVTX9BF3NGYX6cc7jWpbNnR7cAjH8LUffabZP8Qu4ysC#z6MkhVTX9BF3NGYX6cc7jWpbNnR7cAjH8LUffabZP8Qu4ysC",
"proofPurpose": "assertionMethod",
"proofValue": "z33Wy3kvx8UEoPHdQWYHVCXAjW19AZpA88NnikwfJqcH9oNmHyqSkt6wiVS31ewytAX7m2vneVEm8Awo4xzqKHYUp"
}
}
const documentLoader = securityLoader().build()
const suite = new Ed25519Signature2020();
const result = await vc.verifyCredential({
credential: revokedCredential,
suite,
documentLoader,
checkStatus
});
console.log(JSON.stringify(result, null, 2))
Resulted in:
{
"verified": false,
"results": [
{
"proof": {
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://w3id.org/security/suites/ed25519-2020/v1",
"https://w3id.org/dcc/v1",
"https://w3id.org/vc/status-list/2021/v1"
],
"type": "Ed25519Signature2020",
"created": "2022-08-19T06:58:29Z",
"verificationMethod": "did:key:z6MkhVTX9BF3NGYX6cc7jWpbNnR7cAjH8LUffabZP8Qu4ysC#z6MkhVTX9BF3NGYX6cc7jWpbNnR7cAjH8LUffabZP8Qu4ysC",
"proofPurpose": "assertionMethod",
"proofValue": "z33Wy3kvx8UEoPHdQWYHVCXAjW19AZpA88NnikwfJqcH9oNmHyqSkt6wiVS31ewytAX7m2vneVEm8Awo4xzqKHYUp"
},
"verified": true,
"verificationMethod": {
"@context": "https://w3id.org/security/suites/ed25519-2020/v1",
"id": "did:key:z6MkhVTX9BF3NGYX6cc7jWpbNnR7cAjH8LUffabZP8Qu4ysC#z6MkhVTX9BF3NGYX6cc7jWpbNnR7cAjH8LUffabZP8Qu4ysC",
"type": "Ed25519VerificationKey2020",
"controller": "did:key:z6MkhVTX9BF3NGYX6cc7jWpbNnR7cAjH8LUffabZP8Qu4ysC",
"publicKeyMultibase": "z6MkhVTX9BF3NGYX6cc7jWpbNnR7cAjH8LUffabZP8Qu4ysC"
},
"purposeResult": {
"valid": true
},
"log": [
{
"id": "expiration",
"valid": true
},
{
"id": "valid_signature",
"valid": true
},
{
"id": "issuer_did_resolves",
"valid": true
},
{
"id": "revocation_status",
"valid": false
}
]
}
],
"statusResult": {
"verified": false,
"error": {
"cause": {}
}
},
"log": [
{
"id": "expiration",
"valid": true
},
{
"id": "valid_signature",
"valid": true
},
{
"id": "issuer_did_resolves",
"valid": true
},
{
"id": "revocation_status",
"valid": false
}
]
}
@sethduffin - so, I believe it's now giving the correct/expected behavior (see previous comment). I'm puzzled why you're encountering an Invalid Signature error... Can you paste the exact credential and code to reproduce?
@dmitrizagidulin Thanks for looking into this! With the latest version of the library, I'm no longer seeing the Invalid Signature error for the attached credential above.
However, I found a potentially related issue with the following JFF credential:
If this error is the result of an outdated credential format (or other related attributes), then I am ok closing this issue.
For the time being (and to handle potential future cases), I'm adding logic to LCW to display a generic verification error message instead of the checkmark list, in the event a verify response does not contain a log
value (the response's real error
will be logged to the console).
@lautom36 we'll probably want to add this to WebVerifier+ as well.
Closing.
When verifying the attached credential on verifier plus the returned verificationResult does not have a log. revokedCredential.zip