From 58e348e4db9efe0fad5bc7ee555ebe492a775539 Mon Sep 17 00:00:00 2001 From: Diane Huxley Date: Tue, 26 Sep 2023 12:46:27 -0700 Subject: [PATCH 1/2] Bump dwn-sdk-js to v0.2.3 --- package-lock.json | 253 +++++++---------------------------------- package.json | 4 +- src/http-api.ts | 4 +- src/storage.ts | 10 +- tests/http-api.spec.ts | 8 +- tests/test-dwn.ts | 4 +- tests/utils.ts | 22 ++-- 7 files changed, 68 insertions(+), 237 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7dfe5c2..2ca35c7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,8 +8,8 @@ "name": "@web5/dwn-server", "version": "0.1.2", "dependencies": { - "@tbd54566975/dwn-sdk-js": "0.2.1", - "@tbd54566975/dwn-sql-store": "^0.1.0", + "@tbd54566975/dwn-sdk-js": "0.2.3", + "@tbd54566975/dwn-sql-store": "0.2.0", "better-sqlite3": "^8.5.0", "bytes": "3.1.2", "cors": "2.8.5", @@ -754,9 +754,9 @@ "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==" }, "node_modules/@tbd54566975/dwn-sdk-js": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/@tbd54566975/dwn-sdk-js/-/dwn-sdk-js-0.2.1.tgz", - "integrity": "sha512-7rFi0zvpt0F/6E2Pow5+iCnf35YGIUneI9U4J43A8NfP0Gh5S2eJkApvhrPOyt50Xq2MerFR9F5E3BE2E0jJRQ==", + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@tbd54566975/dwn-sdk-js/-/dwn-sdk-js-0.2.3.tgz", + "integrity": "sha512-T3Yy6kY6zftdVgsX2C0D2bIAmWQQVCFrLB95+BN/zoAAA29LogOr807Kx15QHrKmILWidVfYt/ZwsPHl4k5bDQ==", "dependencies": { "@ipld/dag-cbor": "9.0.3", "@js-temporal/polyfill": "0.4.4", @@ -779,7 +779,7 @@ "multiformats": "11.0.2", "randombytes": "2.1.0", "readable-stream": "4.4.0", - "ulid": "2.3.0", + "ulidx": "2.1.0", "uuid": "8.3.2", "varint": "6.0.0" }, @@ -837,116 +837,36 @@ } }, "node_modules/@tbd54566975/dwn-sql-store": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/@tbd54566975/dwn-sql-store/-/dwn-sql-store-0.1.0.tgz", - "integrity": "sha512-HPgQxbHRh9OVx5ipb7aYZGeaHix8m90CTNhBiNcLs3SzCvT8Gt7HVJnKDo2bsJElN3k6teoZbfue49o8GiY8xw==", + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@tbd54566975/dwn-sql-store/-/dwn-sql-store-0.2.0.tgz", + "integrity": "sha512-MiH+8rt+2PbnS5GOljAC++Ylv4za+t0Nn0vuQIVSjjeJgQ3XYYiH5lpF0L8aQh+aAPKRQW4kErXAHQC7crUPiQ==", "dependencies": { - "@tbd54566975/dwn-sdk-js": "0.1.0", - "kysely": "0.25.0", + "@ipld/dag-cbor": "^9.0.5", + "@tbd54566975/dwn-sdk-js": "0.2.3", + "kysely": "0.26.3", "multiformats": "12.0.1", "readable-stream": "4.4.2" } }, - "node_modules/@tbd54566975/dwn-sql-store/node_modules/@tbd54566975/dwn-sdk-js": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/@tbd54566975/dwn-sdk-js/-/dwn-sdk-js-0.1.0.tgz", - "integrity": "sha512-oH5s2P5855mIkPkbHeYuRWNgyQKU7nO6ccmtKYr0qMeYgIYUjBNpvIkgqllfx7ObsfLPU7myFYmlxqHAiFZGRA==", - "dependencies": { - "@ipld/dag-cbor": "9.0.3", - "@js-temporal/polyfill": "0.4.4", - "@noble/ed25519": "2.0.0", - "@noble/secp256k1": "2.0.0", - "abstract-level": "1.0.3", - "ajv": "8.12.0", - "blockstore-core": "4.2.0", - "cross-fetch": "3.1.6", - "eciesjs": "0.4.0", - "flat": "5.0.2", - "interface-blockstore": "5.2.3", - "interface-store": "5.1.2", - "ipfs-unixfs-exporter": "13.1.5", - "ipfs-unixfs-importer": "15.1.5", - "level": "8.0.0", - "lodash": "4.17.21", - "lru-cache": "9.1.2", - "ms": "2.1.3", - "multiformats": "11.0.2", - "randombytes": "2.1.0", - "readable-stream": "4.4.0", - "secp256k1": "5.0.0", - "ulid": "2.3.0", - "uuid": "8.3.2", - "varint": "6.0.0" - }, - "engines": { - "node": ">= 18" - } - }, - "node_modules/@tbd54566975/dwn-sql-store/node_modules/@tbd54566975/dwn-sdk-js/node_modules/multiformats": { - "version": "11.0.2", - "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-11.0.2.tgz", - "integrity": "sha512-b5mYMkOkARIuVZCpvijFj9a6m5wMVLC7cf/jIPd5D/ARDOfLC5+IFkbgDXQgcU2goIsTD/O9NY4DI/Mt4OGvlg==", - "engines": { - "node": ">=16.0.0", - "npm": ">=7.0.0" - } - }, - "node_modules/@tbd54566975/dwn-sql-store/node_modules/@tbd54566975/dwn-sdk-js/node_modules/readable-stream": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.4.0.tgz", - "integrity": "sha512-kDMOq0qLtxV9f/SQv522h8cxZBqNZXuXNyjyezmfAAuribMyVXziljpQ/uQhfE1XLg2/TLTW2DsnoE4VAi/krg==", + "node_modules/@tbd54566975/dwn-sql-store/node_modules/@ipld/dag-cbor": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/@ipld/dag-cbor/-/dag-cbor-9.0.5.tgz", + "integrity": "sha512-TyqgtxEojc98rvxg4NGM+73JzQeM4+tK2VQes/in2mdyhO+1wbGuBijh1tvi9BErQ/dEblxs9v4vEQSX8mFCIw==", "dependencies": { - "abort-controller": "^3.0.0", - "buffer": "^6.0.3", - "events": "^3.3.0", - "process": "^0.11.10" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - } - }, - "node_modules/@tbd54566975/dwn-sql-store/node_modules/cross-fetch": { - "version": "3.1.6", - "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.6.tgz", - "integrity": "sha512-riRvo06crlE8HiqOwIpQhxwdOk4fOeR7FVM/wXoxchFEqMNUjvbs3bfo4OTgMEMHzppd4DxFBDbyySj8Cv781g==", - "dependencies": { - "node-fetch": "^2.6.11" - } - }, - "node_modules/@tbd54566975/dwn-sql-store/node_modules/ipfs-unixfs-importer": { - "version": "15.1.5", - "resolved": "https://registry.npmjs.org/ipfs-unixfs-importer/-/ipfs-unixfs-importer-15.1.5.tgz", - "integrity": "sha512-TXaOI0M5KNpq2+qLw8AIYd0Lnc0gWTKCBqUd9eErBUwaP3Fna4qauF+JX9Rj2UrwaOvG/1xbF8Vm+92eOcKWMA==", - "dependencies": { - "@ipld/dag-pb": "^4.0.0", - "@multiformats/murmur3": "^2.0.0", - "err-code": "^3.0.1", - "hamt-sharding": "^3.0.0", - "interface-blockstore": "^5.0.0", - "interface-store": "^5.0.1", - "ipfs-unixfs": "^11.0.0", - "it-all": "^3.0.2", - "it-batch": "^3.0.2", - "it-first": "^3.0.2", - "it-parallel-batch": "^3.0.1", - "multiformats": "^11.0.0", - "progress-events": "^1.0.0", - "rabin-wasm": "^0.1.4", - "uint8arraylist": "^2.4.3", - "uint8arrays": "^4.0.2" + "cborg": "^4.0.0", + "multiformats": "^12.0.1" }, "engines": { "node": ">=16.0.0", "npm": ">=7.0.0" } }, - "node_modules/@tbd54566975/dwn-sql-store/node_modules/ipfs-unixfs-importer/node_modules/multiformats": { - "version": "11.0.2", - "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-11.0.2.tgz", - "integrity": "sha512-b5mYMkOkARIuVZCpvijFj9a6m5wMVLC7cf/jIPd5D/ARDOfLC5+IFkbgDXQgcU2goIsTD/O9NY4DI/Mt4OGvlg==", - "engines": { - "node": ">=16.0.0", - "npm": ">=7.0.0" + "node_modules/@tbd54566975/dwn-sql-store/node_modules/cborg": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/cborg/-/cborg-4.0.3.tgz", + "integrity": "sha512-poLvpK30KT5KI8gzDx3J/IuVCbsLqMT2fEbOrOuX0H7Hyj8yg5LezeWhRh9aLa5Z6MfPC5sriW3HVJF328M8LQ==", + "bin": { + "cborg": "lib/bin.js" } }, "node_modules/@tbd54566975/dwn-sql-store/node_modules/multiformats": { @@ -958,25 +878,6 @@ "npm": ">=7.0.0" } }, - "node_modules/@tbd54566975/dwn-sql-store/node_modules/node-fetch": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", - "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", - "dependencies": { - "whatwg-url": "^5.0.0" - }, - "engines": { - "node": "4.x || >=6.0.0" - }, - "peerDependencies": { - "encoding": "^0.1.0" - }, - "peerDependenciesMeta": { - "encoding": { - "optional": true - } - } - }, "node_modules/@tbd54566975/dwn-sql-store/node_modules/readable-stream": { "version": "4.4.2", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.4.2.tgz", @@ -992,14 +893,6 @@ "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, - "node_modules/@tbd54566975/dwn-sql-store/node_modules/uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", - "bin": { - "uuid": "dist/bin/uuid" - } - }, "node_modules/@types/body-parser": { "version": "1.19.3", "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.3.tgz", @@ -1738,11 +1631,6 @@ "npm": ">=7.0.0" } }, - "node_modules/bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" - }, "node_modules/body-parser": { "version": "1.20.1", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz", @@ -1813,11 +1701,6 @@ "node": ">=8" } }, - "node_modules/brorand": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", - "integrity": "sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==" - }, "node_modules/browser-level": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/browser-level/-/browser-level-1.0.1.tgz", @@ -2570,20 +2453,6 @@ "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" }, - "node_modules/elliptic": { - "version": "6.5.4", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", - "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", - "dependencies": { - "bn.js": "^4.11.9", - "brorand": "^1.1.0", - "hash.js": "^1.0.0", - "hmac-drbg": "^1.0.1", - "inherits": "^2.0.4", - "minimalistic-assert": "^1.0.1", - "minimalistic-crypto-utils": "^1.0.1" - } - }, "node_modules/emoji-regex": { "version": "9.2.2", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", @@ -3878,15 +3747,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/hash.js": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", - "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", - "dependencies": { - "inherits": "^2.0.3", - "minimalistic-assert": "^1.0.1" - } - }, "node_modules/he": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", @@ -3905,16 +3765,6 @@ "node": ">=8" } }, - "node_modules/hmac-drbg": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", - "integrity": "sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg==", - "dependencies": { - "hash.js": "^1.0.3", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.1" - } - }, "node_modules/http-errors": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", @@ -4678,13 +4528,18 @@ } }, "node_modules/kysely": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/kysely/-/kysely-0.25.0.tgz", - "integrity": "sha512-srn0efIMu5IoEBk0tBmtGnoUss4uwvxtbFQWG/U2MosfqIace1l43IFP1PmEpHRDp+Z79xIcKEqmHH3dAvQdQA==", + "version": "0.26.3", + "resolved": "https://registry.npmjs.org/kysely/-/kysely-0.26.3.tgz", + "integrity": "sha512-yWSgGi9bY13b/W06DD2OCDDHQmq1kwTGYlQ4wpZkMOJqMGCstVCFIvxCCVG4KfY1/3G0MhDAcZsip/Lw8/vJWw==", "engines": { "node": ">=14.0.0" } }, + "node_modules/layerr": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/layerr/-/layerr-2.0.1.tgz", + "integrity": "sha512-z0730CwG/JO24evdORnyDkwG1Q7b7mF2Tp1qRQ0YvrMMARbt1DFG694SOv439Gm7hYKolyZyaB49YIrYIfZBdg==" + }, "node_modules/level": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/level/-/level-8.0.0.tgz", @@ -5036,16 +4891,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/minimalistic-assert": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", - "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" - }, - "node_modules/minimalistic-crypto-utils": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", - "integrity": "sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==" - }, "node_modules/minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", @@ -5286,11 +5131,6 @@ "node": ">=10" } }, - "node_modules/node-addon-api": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-5.1.0.tgz", - "integrity": "sha512-eh0GgfEkpnoWDq+VY8OyvYhFEzBk6jIYbRKdIlyTiAXIVJ8PyBaKb0rp7oDtoddbdoHWhq8wwr+XZ81F1rpNdA==" - }, "node_modules/node-domexception": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", @@ -6485,20 +6325,6 @@ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, - "node_modules/secp256k1": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-5.0.0.tgz", - "integrity": "sha512-TKWX8xvoGHrxVdqbYeZM9w+izTF4b9z3NhSaDkdn81btvuh+ivbIMGT/zQvDtTFWhRlThpoz6LEYTr7n8A5GcA==", - "hasInstallScript": true, - "dependencies": { - "elliptic": "^6.5.4", - "node-addon-api": "^5.0.0", - "node-gyp-build": "^4.2.0" - }, - "engines": { - "node": ">=14.0.0" - } - }, "node_modules/semver": { "version": "7.5.4", "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", @@ -7336,12 +7162,15 @@ "npm": ">=7.0.0" } }, - "node_modules/ulid": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/ulid/-/ulid-2.3.0.tgz", - "integrity": "sha512-keqHubrlpvT6G2wH0OEfSW4mquYRcbe/J8NMmveoQOjUqmo+hXtO+ORCpWhdbZ7k72UtY61BL7haGxW6enBnjw==", - "bin": { - "ulid": "bin/cli.js" + "node_modules/ulidx": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/ulidx/-/ulidx-2.1.0.tgz", + "integrity": "sha512-DlMi97oP9HASI3kLCjBlOhAG1SoisUrEqC2PJ7itiFbq9q5Zo0JejupXeu2Gke99W62epNzA4MFNToNiq8A5LA==", + "dependencies": { + "layerr": "^2.0.1" + }, + "engines": { + "node": ">=16" } }, "node_modules/unbox-primitive": { diff --git a/package.json b/package.json index d8a93c9..cc983c6 100644 --- a/package.json +++ b/package.json @@ -23,8 +23,8 @@ "url": "https://github.com/TBD54566975/dwn-server/issues" }, "dependencies": { - "@tbd54566975/dwn-sdk-js": "0.2.1", - "@tbd54566975/dwn-sql-store": "^0.1.0", + "@tbd54566975/dwn-sdk-js": "0.2.3", + "@tbd54566975/dwn-sql-store": "0.2.0", "better-sqlite3": "^8.5.0", "bytes": "3.1.2", "cors": "2.8.5", diff --git a/src/http-api.ts b/src/http-api.ts index 6de4a5e..4754207 100644 --- a/src/http-api.ts +++ b/src/http-api.ts @@ -79,7 +79,9 @@ export class HttpApi { }); this.#api.get('/:did/records/:id', async (req, res) => { - const record = await RecordsRead.create({ recordId: req.params.id }); + const record = await RecordsRead.create({ + filter: { recordId: req.params.id }, + }); const reply = (await this.dwn.processMessage( req.params.did, record.toJSON(), diff --git a/src/storage.ts b/src/storage.ts index 00e44cf..33c7da2 100644 --- a/src/storage.ts +++ b/src/storage.ts @@ -1,5 +1,10 @@ import type { Config } from './config.js'; import type { Dialect } from '@tbd54566975/dwn-sql-store'; +import { + DataStoreLevel, + EventLogLevel, + MessageStoreLevel, +} from '@tbd54566975/dwn-sdk-js'; import type { DataStore, DwnConfig, @@ -12,11 +17,6 @@ import Database from 'better-sqlite3'; import pg from 'pg'; import { createPool as MySQLCreatePool } from 'mysql2'; -import { - DataStoreLevel, - EventLogLevel, - MessageStoreLevel, -} from '@tbd54566975/dwn-sdk-js/stores'; import { DataStoreSql, EventLogSql, diff --git a/tests/http-api.spec.ts b/tests/http-api.spec.ts index 519c381..d0d59ca 100644 --- a/tests/http-api.spec.ts +++ b/tests/http-api.spec.ts @@ -141,7 +141,7 @@ describe('http api', function () { filter: { schema: 'woosa', }, - authorizationSignatureInput: alice.signatureInput, + authorizationSigner: alice.signer, }); const requestId = uuidv4(); @@ -337,8 +337,10 @@ describe('http api', function () { expect(reply.status.code).to.equal(202); const recordsRead = await RecordsRead.create({ - authorizationSignatureInput: alice.signatureInput, - recordId: recordsWrite.message.recordId, + authorizationSigner: alice.signer, + filter: { + recordId: recordsWrite.message.recordId, + }, }); requestId = uuidv4(); diff --git a/tests/test-dwn.ts b/tests/test-dwn.ts index 7652644..515ece5 100644 --- a/tests/test-dwn.ts +++ b/tests/test-dwn.ts @@ -1,9 +1,9 @@ -import { Dwn } from '@tbd54566975/dwn-sdk-js'; import { + Dwn, DataStoreLevel, EventLogLevel, MessageStoreLevel, -} from '@tbd54566975/dwn-sdk-js/stores'; +} from '@tbd54566975/dwn-sdk-js'; const dataStore = new DataStoreLevel({ blockstoreLocation: 'data/DATASTORE' }); const eventLog = new EventLogLevel({ location: 'data/EVENTLOG' }); diff --git a/tests/utils.ts b/tests/utils.ts index 7fc0f1a..f6750e4 100644 --- a/tests/utils.ts +++ b/tests/utils.ts @@ -1,10 +1,6 @@ import type { Readable } from 'readable-stream'; import type { ReadStream } from 'node:fs'; -import type { - PrivateJwk, - PublicJwk, - SignatureInput, -} from '@tbd54566975/dwn-sdk-js'; +import type { PrivateJwk, PublicJwk, Signer } from '@tbd54566975/dwn-sdk-js'; import fs from 'node:fs'; import http from 'node:http'; @@ -16,6 +12,7 @@ import { Cid, DataStream, DidKeyResolver, + PrivateKeySigner, RecordsWrite, } from '@tbd54566975/dwn-sdk-js'; @@ -29,22 +26,23 @@ export type Profile = { publicJwk: PublicJwk; privateJwk: PrivateJwk; }; - signatureInput: SignatureInput; + signer: Signer; }; export async function createProfile(): Promise { const { did, keyPair, keyId } = await DidKeyResolver.generate(); - // signatureInput is required by all dwn message classes. it's used to sign messages - const signatureInput = { + // signer is required by all dwn message classes. it's used to sign messages + const signer = new PrivateKeySigner({ privateJwk: keyPair.privateJwk, - protectedHeader: { alg: keyPair.privateJwk.alg, kid: `${did}#${keyId}` }, - }; + algorithm: keyPair.privateJwk.alg, + keyId: `${did}#${keyId}`, + }); return { did, keyPair, - signatureInput, + signer, }; } @@ -80,7 +78,7 @@ export async function createRecordsWriteMessage( const recordsWrite = await RecordsWrite.create({ ...overrides, dataFormat: 'application/json', - authorizationSignatureInput: signer.signatureInput, + authorizationSigner: signer.signer, }); let dataStream: Readable | undefined; From 497bfa699647158bcbab0e35f6d091def0e171d1 Mon Sep 17 00:00:00 2001 From: Diane Huxley Date: Tue, 26 Sep 2023 13:28:28 -0700 Subject: [PATCH 2/2] Increment version --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2ca35c7..4fa7720 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@web5/dwn-server", - "version": "0.1.2", + "version": "0.1.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@web5/dwn-server", - "version": "0.1.2", + "version": "0.1.3", "dependencies": { "@tbd54566975/dwn-sdk-js": "0.2.3", "@tbd54566975/dwn-sql-store": "0.2.0", diff --git a/package.json b/package.json index cc983c6..c4b166c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@web5/dwn-server", "type": "module", - "version": "0.1.2", + "version": "0.1.3", "files": [ "dist", "src"