Skip to content

Commit

Permalink
update web5 packages, fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kirahsapong committed Apr 2, 2024
1 parent 65439c2 commit 33a5040
Show file tree
Hide file tree
Showing 8 changed files with 954 additions and 750 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"license": "Apache-2.0",
"devDependencies": {
"@changesets/changelog-github": "^0.5.0",
"@changesets/cli": "^2.26.2",
"@changesets/cli": "^2.27.1",
"@npmcli/package-json": "5.0.0",
"@types/chai": "4.3.5",
"@types/eslint": "8.44.2",
Expand Down
8 changes: 4 additions & 4 deletions packages/http-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@
},
"dependencies": {
"@tbdex/protocol": "workspace:*",
"@web5/common": "0.2.3",
"@web5/credentials": "0.4.2",
"@web5/crypto": "0.4.0",
"@web5/dids": "0.4.1",
"@web5/common": "0.2.4",
"@web5/credentials": "0.4.5",
"@web5/crypto": "0.4.1",
"@web5/dids": "0.4.3",
"ms": "2.1.3",
"query-string": "8.2.0",
"typeid-js": "0.3.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/http-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"dependencies": {
"@tbdex/http-client": "workspace:*",
"@tbdex/protocol": "workspace:*",
"@web5/dids": "0.4.1",
"@web5/dids": "0.4.3",
"cors": "2.8.5",
"express": "4.19.2"
},
Expand Down
8 changes: 4 additions & 4 deletions packages/protocol/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@
"dependencies": {
"@noble/hashes": "1.3.3",
"@types/node": "^7.0.5",
"@web5/common": "0.2.3",
"@web5/credentials": "0.4.2",
"@web5/crypto": "0.4.0",
"@web5/dids": "0.4.1",
"@web5/common": "0.2.4",
"@web5/credentials": "0.4.5",
"@web5/crypto": "0.4.1",
"@web5/dids": "0.4.3",
"ajv": "8.12.0",
"bignumber.js": "^9.1.2",
"canonicalize": "2.0.0",
Expand Down
17 changes: 10 additions & 7 deletions packages/protocol/src/dev-tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,16 @@ export class DevTools {
input_descriptors : [{
id : 'bbdb9b7c-5754-4f46-b63b-590bada959e0',
constraints : {
fields: [{
path : ['$.type'],
filter : {
type : 'string',
const : 'YoloCredential'
}
}]
fields: [
{
path : ['$.type[*]'],
filter : {
type : 'string',
pattern : '^YoloCredential$'
}
},

]
}
}]
}
Expand Down
4 changes: 2 additions & 2 deletions packages/protocol/src/did-resolver.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import type { DidDocument, DidResource, DidVerificationMethod } from '@web5/dids'

import { DidResolver as Web5DidResolver, DidDht, DidJwk, DidWeb } from '@web5/dids'
import { UniversalResolver, DidDht, DidJwk, DidWeb } from '@web5/dids'

/**
* Can be used to resolve and dereference did:dht, did:jwk, and did:web DIDs
*
* @beta
*/
export const DidResolver = new Web5DidResolver({
export const DidResolver = new UniversalResolver({
didResolvers: [DidDht, DidJwk, DidWeb]
})

Expand Down
13 changes: 9 additions & 4 deletions packages/protocol/tests/rfq.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { VerifiableCredential } from '@web5/credentials'
import { PresentationExchange, VerifiableCredential } from '@web5/credentials'
import { CreateRfqOptions, Offering } from '../src/main.js'

import { Rfq, DevTools } from '../src/main.js'
Expand Down Expand Up @@ -115,7 +115,7 @@ describe('Rfq', () => {
expect(jsonMessage).to.equal(JSON.stringify(parsedMessage))
})

describe('requireAllPrivateData: true', () => {
describe.only('requireAllPrivateData: true', () => {
it('succeeds when all privateData is present', async () => {
const aliceDid = await DidJwk.create()
const rfq = Rfq.create({
Expand Down Expand Up @@ -596,7 +596,12 @@ describe('Rfq', () => {
}
}
})
await rfq.verifyOfferingRequirements(offering)
try {
await rfq.verifyOfferingRequirements(offering)
expect.fail()
} catch(e) {
expect(e.message).to.include('123')
}
})

it('throws an error if payinMethod paymentDetails cannot be validated against the provided offering\'s payinMethod requiredPaymentDetails', async () => {
Expand Down Expand Up @@ -740,7 +745,7 @@ describe('Rfq', () => {
const aliceDid = await DidJwk.create()
const offering = DevTools.createOffering()
const vc = await VerifiableCredential.create({ // this credential fulfills the offering's required claims
type : 'SanctionsCredential',
type : 'YoloCredential',
issuer : aliceDid.uri,
subject : aliceDid.uri,
data : {
Expand Down
Loading

0 comments on commit 33a5040

Please sign in to comment.