Skip to content

Commit

Permalink
Updated dependencies for packages dependent by tbDEX packages (#574)
Browse files Browse the repository at this point in the history
  • Loading branch information
thehenrytsai committed May 16, 2024
1 parent 98eeb4c commit 77381f5
Show file tree
Hide file tree
Showing 24 changed files with 331 additions and 82 deletions.
6 changes: 3 additions & 3 deletions packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
},
"dependencies": {
"@isaacs/ttlcache": "1.4.1",
"level": "8.0.0",
"level": "8.0.1",
"multiformats": "11.0.2",
"readable-stream": "4.4.2"
},
Expand All @@ -88,8 +88,8 @@
"@web/test-runner-playwright": "0.11.0",
"abstract-level": "1.0.4",
"c8": "9.1.0",
"chai": "4.3.10",
"chai-as-promised": "7.1.1",
"chai": "5.1.1",
"chai-as-promised": "7.1.2",
"esbuild": "0.19.8",
"eslint": "8.47.0",
"eslint-plugin-mocha": "10.4.3",
Expand Down
4 changes: 2 additions & 2 deletions packages/common/tests/stores.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Level } from 'level';
import chai, { expect } from 'chai';
import { expect, use } from 'chai';
import chaiAsPromised from 'chai-as-promised';

chai.use(chaiAsPromised);
use(chaiAsPromised);

import { LevelStore, MemoryStore } from '../src/stores.js';

Expand Down
2 changes: 1 addition & 1 deletion packages/credentials/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,6 @@
"playwright": "1.44.0",
"rimraf": "5.0.7",
"sinon": "16.1.3",
"typescript": "5.1.6"
"typescript": "5.4.5"
}
}
1 change: 1 addition & 0 deletions packages/credentials/tsconfig.cjs.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
],
"target": "ES5",
"module": "CommonJS",
"moduleResolution": "Node",
"outDir": "dist/cjs",
"declaration": false,
"declarationMap": false,
Expand Down
2 changes: 1 addition & 1 deletion packages/crypto-aws-kms/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"@web5/common": "0.2.4",
"c8": "9.1.0",
"chai": "5.1.1",
"chai-as-promised": "7.1.1",
"chai-as-promised": "7.1.2",
"eslint": "8.47.0",
"eslint-plugin-mocha": "10.4.3",
"mocha": "10.4.0",
Expand Down
6 changes: 3 additions & 3 deletions packages/crypto/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@
"@web/test-runner": "0.18.0",
"@web/test-runner-playwright": "0.11.0",
"c8": "9.1.0",
"chai": "4.3.10",
"chai-as-promised": "7.1.1",
"chai": "5.1.1",
"chai-as-promised": "7.1.2",
"esbuild": "0.19.8",
"eslint": "8.47.0",
"eslint-plugin-mocha": "10.1.0",
Expand All @@ -104,6 +104,6 @@
"rimraf": "5.0.7",
"sinon": "16.1.3",
"source-map-loader": "5.0.0",
"typescript": "5.1.6"
"typescript": "5.4.5"
}
}
4 changes: 2 additions & 2 deletions packages/crypto/tests/jose/jwk.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import chai, { expect } from 'chai';
import { expect, use } from 'chai';
import chaiAsPromised from 'chai-as-promised';

import type { Jwk } from '../../src/jose/jwk.js';
Expand All @@ -15,7 +15,7 @@ import {
} from '../../src/jose/jwk.js';
import { jwkToThumbprintTestVectors } from '../fixtures/test-vectors/jwk.js';

chai.use(chaiAsPromised);
use(chaiAsPromised);

describe('JWK', () => {
describe('computeJwkThumbprint()', () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/crypto/tests/jose/utils.spec.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import chai, { expect } from 'chai';
import { expect, use } from 'chai';
import chaiAsPromised from 'chai-as-promised';

import { canonicalize } from '../../src/jose/utils.js';

chai.use(chaiAsPromised);
use(chaiAsPromised);

describe('JOSE Utils', () => {
describe('canonicalize', () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/crypto/tests/primitives/aes-ctr.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import chai, { expect } from 'chai';
import { expect, use } from 'chai';
import { Convert } from '@web5/common';
import chaiAsPromised from 'chai-as-promised';

Expand All @@ -9,7 +9,7 @@ import { AesCtr } from '../../src/primitives/aes-ctr.js';
import AesCtrDecryptTestVector from '../fixtures/test-vectors/aes-ctr/decrypt.json' assert { type: 'json' };
import AesCtrEncryptTestVector from '../fixtures/test-vectors/aes-ctr/encrypt.json' assert { type: 'json' };

chai.use(chaiAsPromised);
use(chaiAsPromised);

describe('AesCtr', () => {
describe('bytesToPrivateKey()', () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/crypto/tests/primitives/aes-gcm.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import chai, { expect } from 'chai';
import { expect, use } from 'chai';
import { Convert } from '@web5/common';
import chaiAsPromised from 'chai-as-promised';

Expand All @@ -9,7 +9,7 @@ import { AesGcm, AES_GCM_TAG_LENGTHS } from '../../src/primitives/aes-gcm.js';
import AesGcmDecryptTestVector from '../fixtures/test-vectors/aes-gcm/decrypt.json' assert { type: 'json' };
import AesGcmEncryptTestVector from '../fixtures/test-vectors/aes-gcm/encrypt.json' assert { type: 'json' };

chai.use(chaiAsPromised);
use(chaiAsPromised);

describe('AesGcm', () => {
describe('bytesToPrivateKey()', () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/crypto/tests/primitives/concat-kdf.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import chai, { expect } from 'chai';
import { expect, use } from 'chai';
import { Convert } from '@web5/common';
import chaiAsPromised from 'chai-as-promised';

import { ConcatKdf } from '../../src/primitives/concat-kdf.js';

chai.use(chaiAsPromised);
use(chaiAsPromised);

describe('ConcatKdf', () => {
describe('deriveKey()', () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/crypto/tests/primitives/ed25519.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import chai, { expect } from 'chai';
import { expect, use } from 'chai';
import { Convert } from '@web5/common';
import chaiAsPromised from 'chai-as-promised';

Expand All @@ -16,7 +16,7 @@ import ed25519ConvertPrivateKeyToX25519 from '../fixtures/test-vectors/ed25519/c

import { Ed25519 } from '../../src/primitives/ed25519.js';

chai.use(chaiAsPromised);
use(chaiAsPromised);

describe('Ed25519', () => {
let privateKey: Jwk;
Expand Down
4 changes: 2 additions & 2 deletions packages/crypto/tests/primitives/pbkdf2.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import chai, { expect } from 'chai';
import { expect, use } from 'chai';
import { Convert } from '@web5/common';
import chaiAsPromised from 'chai-as-promised';

import { Pbkdf2 } from '../../src/primitives/pbkdf2.js';

chai.use(chaiAsPromised);
use(chaiAsPromised);

describe('Pbkdf2', () => {
const password = Convert.string('password').toUint8Array();
Expand Down
4 changes: 2 additions & 2 deletions packages/crypto/tests/primitives/secp256k1.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import chai, { expect } from 'chai';
import { expect, use } from 'chai';
import { Convert } from '@web5/common';
import chaiAsPromised from 'chai-as-promised';

Expand All @@ -16,7 +16,7 @@ import secp256k1ValidatePrivateKey from '../fixtures/test-vectors/secp256k1/vali

import { Secp256k1 } from '../../src/primitives/secp256k1.js';

chai.use(chaiAsPromised);
use(chaiAsPromised);

describe('Secp256k1', () => {
let privateKey: Jwk;
Expand Down
4 changes: 2 additions & 2 deletions packages/crypto/tests/primitives/secp256r1.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import chai, { expect } from 'chai';
import { expect, use } from 'chai';
import { Convert } from '@web5/common';
import chaiAsPromised from 'chai-as-promised';

Expand All @@ -14,7 +14,7 @@ import secp256r1ValidatePrivateKey from '../fixtures/test-vectors/secp256r1/vali

import { Secp256r1 } from '../../src/primitives/secp256r1.js';

chai.use(chaiAsPromised);
use(chaiAsPromised);

describe('Secp256r1', () => {
let privateKey: Jwk;
Expand Down
4 changes: 2 additions & 2 deletions packages/crypto/tests/primitives/sha256.spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import chai, { expect } from 'chai';
import { expect, use } from 'chai';
import { Convert } from '@web5/common';
import chaiAsPromised from 'chai-as-promised';

import Sha256DigestTestVector from '../fixtures/test-vectors/sha256/digest.json' assert { type: 'json' };

import { Sha256 } from '../../src/primitives/sha256.js';

chai.use(chaiAsPromised);
use(chaiAsPromised);

describe('Sha256', () => {
describe('digest()', () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/crypto/tests/primitives/x25519.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import chai, { expect } from 'chai';
import { expect, use } from 'chai';
import { Convert } from '@web5/common';
import chaiAsPromised from 'chai-as-promised';

Expand All @@ -11,7 +11,7 @@ import x25519PublicKeyToBytes from '../fixtures/test-vectors/x25519/public-key-t

import { X25519 } from '../../src/primitives/x25519.js';

chai.use(chaiAsPromised);
use(chaiAsPromised);

describe('X25519', () => {
let privateKey: Jwk;
Expand Down
4 changes: 2 additions & 2 deletions packages/crypto/tests/primitives/xchacha20-poly1305.spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import chai, { expect } from 'chai';
import { expect, use } from 'chai';
import { Convert } from '@web5/common';
import chaiAsPromised from 'chai-as-promised';

import type { Jwk } from '../../src/jose/jwk.js';

import { POLY1305_TAG_LENGTH, XChaCha20Poly1305 } from '../../src/primitives/xchacha20-poly1305.js';

chai.use(chaiAsPromised);
use(chaiAsPromised);

describe('XChaCha20Poly1305', () => {
describe('bytesToPrivateKey()', () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/crypto/tests/primitives/xchacha20.spec.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import chai, { expect } from 'chai';
import { expect, use } from 'chai';
import { Convert } from '@web5/common';
import chaiAsPromised from 'chai-as-promised';

import type { Jwk } from '../../src/jose/jwk.js';

import { XChaCha20 } from '../../src/primitives/xchacha20.js';

chai.use(chaiAsPromised);
use(chaiAsPromised);

describe('XChaCha20', () => {
describe('bytesToPrivateKey()', () => {
Expand Down
1 change: 1 addition & 0 deletions packages/crypto/tsconfig.cjs.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
],
"target": "ES5",
"module": "CommonJS",
"moduleResolution": "Node",
"outDir": "dist/cjs",
"declaration": false,
"declarationMap": false,
Expand Down
2 changes: 1 addition & 1 deletion packages/dids/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"abstract-level": "1.0.4",
"bencode": "4.0.0",
"buffer": "6.0.3",
"level": "8.0.0",
"level": "8.0.1",
"ms": "2.1.3"
},
"devDependencies": {
Expand Down
14 changes: 7 additions & 7 deletions packages/dids/src/resolver/resolver-cache-level.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export type DidResolverCacheLevelParams = {
* with an associated time-to-live (TTL) value. The TTL is represented in milliseconds and
* determines when the cached entry is considered expired and eligible for removal.
*/
type CacheWrapper = {
type CachedDidResolutionResult = {
/**
* The expiration time of the cache entry in milliseconds since the Unix epoch.
*
Expand Down Expand Up @@ -73,7 +73,7 @@ type CacheWrapper = {
*/
export class DidResolverCacheLevel implements DidResolverCache {
/** The underlying LevelDB store used for caching. */
private cache: AbstractLevel<string | Buffer | Uint8Array, string, string>;
private cache;

/** The time-to-live for cache entries in milliseconds. */
private ttl: number;
Expand All @@ -98,15 +98,15 @@ export class DidResolverCacheLevel implements DidResolverCache {
async get(did: string): Promise<DidResolutionResult | void> {
try {
const str = await this.cache.get(did);
const cacheWrapper: CacheWrapper = JSON.parse(str);
const cachedDidResolutionResult: CachedDidResolutionResult = JSON.parse(str);

if (Date.now() >= cacheWrapper.ttlMillis) {
if (Date.now() >= cachedDidResolutionResult.ttlMillis) {
// defer deletion to be called in the next tick of the js event loop
this.cache.nextTick(() => this.cache.del(did));

return;
} else {
return cacheWrapper.value;
return cachedDidResolutionResult.value;
}

} catch(error: any) {
Expand All @@ -127,8 +127,8 @@ export class DidResolverCacheLevel implements DidResolverCache {
* @returns A promise that resolves when the operation is complete.
*/
set(did: string, value: DidResolutionResult): Promise<void> {
const cacheWrapper: CacheWrapper = { ttlMillis: Date.now() + this.ttl, value };
const str = JSON.stringify(cacheWrapper);
const cachedDidResolutionResult: CachedDidResolutionResult = { ttlMillis: Date.now() + this.ttl, value };
const str = JSON.stringify(cachedDidResolutionResult);

return this.cache.put(did, str);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/dids/tests/resolver/resolver-cache-level.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('DidResolverCacheLevel', () => {
});

it('should initialize with a custom database', async function() {
const db = new Level<string, string>('__TESTDATA__/customLocation');
const db = new Level('__TESTDATA__/customLocation');
const cache = new DidResolverCacheLevel({ db });
expect(cache).to.be.an.instanceof(DidResolverCacheLevel);
await cache.close();
Expand Down

0 comments on commit 77381f5

Please sign in to comment.