Skip to content

Commit b443822

Browse files
Bump @web5/dids to 0.3.0 (#679)
This PR will: - Bump the `@web5/dids` dependency from 0.2.4 to 0.3.0. - Removed the `@types/dns-packet` dev dependency since it is no longer needed. - Removes `src/did/did.ts` and the associated tests since there are no longer any references to these methods in DWN SDK. Equivalent functionality is available in [`DidUri`](https://github.com/TBD54566975/web5-js/blob/main/packages/dids/src/did-uri.ts) should it ever be needed. - Removes `TestDataGenerator.getKeyId()` since a DID method agnostic method `getSigningMethod()` is now available across all DID method implementations in `@web5/dids`. - Bump release version to `0.2.16` --------- Signed-off-by: Frank Hinek <[email protected]> Co-authored-by: Liran Cohen <[email protected]>
1 parent d5c2e6f commit b443822

26 files changed

+107
-611
lines changed

package-lock.json

Lines changed: 52 additions & 486 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@tbd54566975/dwn-sdk-js",
3-
"version": "0.2.15",
3+
"version": "0.2.16",
44
"description": "A reference implementation of https://identity.foundation/decentralized-web-node/spec/",
55
"repository": {
66
"type": "git",
@@ -65,7 +65,7 @@
6565
"@js-temporal/polyfill": "0.4.4",
6666
"@noble/ed25519": "2.0.0",
6767
"@noble/secp256k1": "2.0.0",
68-
"@web5/dids": "^0.2.4",
68+
"@web5/dids": "0.3.0",
6969
"abstract-level": "1.0.3",
7070
"ajv": "8.12.0",
7171
"blockstore-core": "4.2.0",
@@ -89,7 +89,6 @@
8989
"devDependencies": {
9090
"@types/chai": "4.3.0",
9191
"@types/chai-as-promised": "7.1.5",
92-
"@types/dns-packet": "^5.6.4",
9392
"@types/flat": "^5.0.2",
9493
"@types/karma": "^6.3.3",
9594
"@types/lodash": "4.14.179",
@@ -159,4 +158,4 @@
159158
"license-check": "license-report --only=prod > license-report.json && node ./build/license-check.cjs",
160159
"publish:unstable": "./build/publish-unstable.sh"
161160
}
162-
}
161+
}

src/did/did.ts

Lines changed: 0 additions & 39 deletions
This file was deleted.

src/dwn.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import { RecordsQueryHandler } from './handlers/records-query.js';
3030
import { RecordsReadHandler } from './handlers/records-read.js';
3131
import { RecordsSubscribeHandler } from './handlers/records-subscribe.js';
3232
import { RecordsWriteHandler } from './handlers/records-write.js';
33-
import { DidDhtMethod, DidIonMethod, DidKeyMethod, DidResolver } from '@web5/dids';
33+
import { DidDht, DidIon, DidKey, DidResolver } from '@web5/dids';
3434
import { DwnInterfaceName, DwnMethodName } from './enums/dwn-interface-method.js';
3535

3636
export class Dwn {
@@ -134,7 +134,7 @@ export class Dwn {
134134
* Creates an instance of the DWN.
135135
*/
136136
public static async create(config: DwnConfig): Promise<Dwn> {
137-
config.didResolver ??= new DidResolver({ didResolvers: [DidKeyMethod, DidIonMethod, DidDhtMethod] });
137+
config.didResolver ??= new DidResolver({ didResolvers: [DidKey, DidIon, DidDht] });
138138
config.tenantGate ??= new AllowAllTenantGate();
139139

140140
const dwn = new Dwn(config);

src/jose/jws/general/verifier.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { Cache } from '../../../types/cache.js';
22
import type { GeneralJws } from '../../../types/jws-types.js';
33
import type { PublicJwk } from '../../../types/jose-types.js';
4-
import type { DidResolver, VerificationMethod } from '@web5/dids';
4+
import type { DidResolver, DidVerificationMethod } from '@web5/dids';
55

66
import { Jws } from '../../../utils/jws.js';
77
import { MemoryCache } from '../../../utils/memory-cache.js';
@@ -87,7 +87,7 @@ export class GeneralJwsVerifier {
8787
const { didDocument } = await didResolver.resolve(did);
8888
const { verificationMethod: verificationMethods = [] } = didDocument || {};
8989

90-
let verificationMethod: VerificationMethod | undefined;
90+
let verificationMethod: DidVerificationMethod | undefined;
9191

9292
for (const method of verificationMethods) {
9393
// consider optimizing using a set for O(1) lookups if needed

tests/core/auth.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { authenticate } from '../../src/core/auth.js';
22
import { DwnErrorCode } from '../../src/core/dwn-error.js';
33
import { expect } from 'chai';
4-
import { DidDhtMethod, DidResolver } from '@web5/dids';
4+
import { DidDht, DidResolver } from '@web5/dids';
55

66
describe('Auth', () => {
77
describe('authenticate()', () => {
88
it('should throw if given JWS is `undefined`', async () => {
99
const jws = undefined;
10-
await expect(authenticate(jws, new DidResolver({ didResolvers: [DidDhtMethod] }))).to.be.rejectedWith(DwnErrorCode.AuthenticateJwsMissing);
10+
await expect(authenticate(jws, new DidResolver({ didResolvers: [DidDht] }))).to.be.rejectedWith(DwnErrorCode.AuthenticateJwsMissing);
1111
});
1212
});
1313
});

tests/did/did.spec.ts

Lines changed: 0 additions & 22 deletions
This file was deleted.

tests/handlers/events-get.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { TestDataGenerator } from '../utils/test-data-generator.js';
1414
import { Message } from '../../src/core/message.js';
1515
import { TestEventStream } from '../test-event-stream.js';
1616
import { TestStores } from '../test-stores.js';
17-
import { DidKeyMethod, DidResolver } from '@web5/dids';
17+
import { DidKey, DidResolver } from '@web5/dids';
1818

1919
export function testEventsGetHandler(): void {
2020
describe('EventsGetHandler.handle()', () => {
@@ -28,7 +28,7 @@ export function testEventsGetHandler(): void {
2828
// important to follow the `before` and `after` pattern to initialize and clean the stores in tests
2929
// so that different test suites can reuse the same backend store for testing
3030
before(async () => {
31-
didResolver = new DidResolver({ didResolvers: [DidKeyMethod] });
31+
didResolver = new DidResolver({ didResolvers: [DidKey] });
3232

3333
const stores = TestStores.get();
3434
messageStore = stores.messageStore;

tests/handlers/events-query.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { expect } from 'chai';
1111
import { TestDataGenerator } from '../utils/test-data-generator.js';
1212
import { TestEventStream } from '../test-event-stream.js';
1313
import { TestStores } from '../test-stores.js';
14-
import { DidKeyMethod, DidResolver } from '@web5/dids';
14+
import { DidKey, DidResolver } from '@web5/dids';
1515

1616

1717
export function testEventsQueryHandler(): void {
@@ -26,7 +26,7 @@ export function testEventsQueryHandler(): void {
2626
// important to follow the `before` and `after` pattern to initialize and clean the stores in tests
2727
// so that different test suites can reuse the same backend store for testing
2828
before(async () => {
29-
didResolver = new DidResolver({ didResolvers: [DidKeyMethod] });
29+
didResolver = new DidResolver({ didResolvers: [DidKey] });
3030

3131
const stores = TestStores.get();
3232
messageStore = stores.messageStore;

tests/handlers/events-subscribe.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { Message } from '../../src/core/message.js';
99
import { TestDataGenerator } from '../utils/test-data-generator.js';
1010
import { TestEventStream } from '../test-event-stream.js';
1111
import { TestStores } from '../test-stores.js';
12-
import { DidKeyMethod, DidResolver } from '@web5/dids';
12+
import { DidKey, DidResolver } from '@web5/dids';
1313

1414
import sinon from 'sinon';
1515
import chai, { expect } from 'chai';
@@ -31,7 +31,7 @@ export function testEventsSubscribeHandler(): void {
3131
// important to follow the `before` and `after` pattern to initialize and clean the stores in tests
3232
// so that different test suites can reuse the same backend store for testing
3333
before(async () => {
34-
didResolver = new DidResolver({ didResolvers: [DidKeyMethod] });
34+
didResolver = new DidResolver({ didResolvers: [DidKey] });
3535

3636
const stores = TestStores.get();
3737
messageStore = stores.messageStore;
@@ -85,7 +85,7 @@ export function testEventsSubscribeHandler(): void {
8585
// important to follow the `before` and `after` pattern to initialize and clean the stores in tests
8686
// so that different test suites can reuse the same backend store for testing
8787
before(async () => {
88-
didResolver = new DidResolver({ didResolvers: [DidKeyMethod] });
88+
didResolver = new DidResolver({ didResolvers: [DidKey] });
8989

9090
const stores = TestStores.get();
9191
messageStore = stores.messageStore;

0 commit comments

Comments
 (0)