Skip to content

Commit

Permalink
using fs to writeFile to overwrite the test vectors
Browse files Browse the repository at this point in the history
  • Loading branch information
jiyoontbd committed Jan 23, 2024
1 parent 1dac659 commit d7d7f95
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/protocol/src/message-kinds/rfq.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,14 @@ export class Rfq extends Message<'rfq'> {
return
}

const credentials = PresentationExchange.selectCredentials(this.claims, offering.data.requiredClaims)
const credentials = PresentationExchange.selectCredentials({ vcJwts: this.claims, presentationDefinition: offering.data.requiredClaims })

if (!credentials.length) {
throw new Error(`claims do not fulfill the offering's requirements`)
}

for (let credential of credentials) {
await VerifiableCredential.verify(credential)
await VerifiableCredential.verify({ vcJwt: credential })
}
}

Expand Down
6 changes: 5 additions & 1 deletion packages/protocol/tests/generate-test-vectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,11 @@ const overWriteTestVectors = async () => {
for (const { filename, vector } of vectorFilePair) {
const fileLocation = `../../tbdex/hosted/test-vectors/protocol/vectors/${filename}`
console.log(`Overwriting ${fileLocation} with new test vector.`)
fs.writeFile(fileLocation, JSON.stringify(vector, null, 2))
try {
fs.writeFileSync(fileLocation, JSON.stringify(vector, null, 2))
} catch (err) {
console.error(`Error writing file ${fileLocation}:`, err)
}
}
}

Expand Down

0 comments on commit d7d7f95

Please sign in to comment.