Skip to content
Merged
Changes from 1 commit
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
@@ -1,10 +1,13 @@
import { VerificationFragment, Verifier, VerifierOptions } from '@tradetrust-tt/tt-verify';
import { VerificationFragment, Verifier } from '@tradetrust-tt/tt-verify';
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
import { SignedVerifiableCredential } from '@trustvc/w3c-vc';
import { verifyW3CSignature } from '../../../../w3c';

const type = 'DOCUMENT_STATUS';
const name = 'W3CEmptyCredentialStatus';

function isSignedVerifiableCredential(document: unknown): document is SignedVerifiableCredential {
return typeof document === 'object' && document !== null && 'proof' in document;
}

export const w3cEmptyCredentialStatus: Verifier<VerificationFragment> = {
skip: async () => {
return {
Expand All @@ -28,10 +31,10 @@ export const w3cEmptyCredentialStatus: Verifier<VerificationFragment> = {
);
},

verify: async (document: unknown, verifierOptions: VerifierOptions) => {
verify: async (document: unknown) => {
const doc = document as SignedVerifiableCredential;
const verificationResult = await verifyW3CSignature(doc, verifierOptions);
if (verificationResult.verified) {
const verificationResult = isSignedVerifiableCredential(doc);
if (verificationResult) {
return {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Keep verify(document, verifierOptions) signature and tighten naming.

Maintain the second parameter for backward compatibility and rename the boolean for clarity.

-  verify: async (document: unknown) => {
+  verify: async (document: unknown, _verifierOptions: VerifierOptions) => {
     const doc = document as SignedVerifiableCredential;
-    const verificationResult = isSignedVerifiableCredential(doc);
-    if (verificationResult) {
+    const isSigned = isSignedVerifiableCredential(doc);
+    if (isSigned) {
       return {
         type,
         name,
         data: true,
         status: 'VALID',
       };
     } else {
       return {
         type,
         name,
         data: false,
         reason: {
-          message: 'Document is not a valid SignedVerifiableCredential',
+          message: 'Document is not a valid SignedVerifiableCredential',
         },
         status: 'INVALID',
       };
     }
   },

Run to confirm signature parity across fragments:

Also applies to: 50-55


🏁 Script executed:

#!/bin/bash
# Verify other fragments still accept verifierOptions
rg -nP -C1 "verify:\s*async\s*\(\s*document:\s*unknown,\s*verifierOptions" src/verify

# Check this fragment’s usage and name occurrences
rg -n "W3CEmptyCredentialStatus|w3cEmptyCredentialStatus" -C2

Length of output: 5130


Add missing verifierOptions parameter & rename verificationResult
In src/verify/fragments/document-status/w3cEmptyCredentialStatus/index.ts (lines 34–38, 50–55):

  • Change
    verify: async (document: unknown) =>
    to
    verify: async (document: unknown, _verifierOptions: VerifierOptions) =>
  • Rename
    const verificationResult = isSignedVerifiableCredential(doc);
    if (verificationResult) {
      
    }
    to
    const isSigned = isSignedVerifiableCredential(doc);
    if (isSigned) {
      
    }
🤖 Prompt for AI Agents
In src/verify/fragments/document-status/w3cEmptyCredentialStatus/index.ts around
lines 34–38 and 50–55, the verify function is missing the verifierOptions
parameter and the variable name verificationResult is unclear; update the
function signature to accept (document: unknown, _verifierOptions:
VerifierOptions) and rename the local const verificationResult to isSigned (and
update its uses) where you call isSignedVerifiableCredential(doc) so the
parameter is present for future use and the boolean variable name accurately
reflects its purpose.

type,
name,
Expand All @@ -44,7 +47,7 @@ export const w3cEmptyCredentialStatus: Verifier<VerificationFragment> = {
name,
data: false,
reason: {
message: verificationResult.error,
message: 'Document is not a valid SignedVerifiableCredential',
},
status: 'INVALID',
};
Expand Down