Skip to content

Commit

Permalink
Bump dwn-sdk-js version
Browse files Browse the repository at this point in the history
  • Loading branch information
Diane Huxley committed Nov 13, 2023
1 parent 2421b28 commit 5d2641e
Show file tree
Hide file tree
Showing 13 changed files with 109 additions and 52 deletions.
84 changes: 67 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/agent/.vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
]
}
]
}
}
4 changes: 2 additions & 2 deletions packages/agent/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@web5/agent",
"version": "0.2.3",
"version": "0.2.4",
"type": "module",
"main": "./dist/cjs/index.js",
"module": "./dist/esm/index.js",
Expand Down Expand Up @@ -67,7 +67,7 @@
"node": ">=18.0.0"
},
"dependencies": {
"@tbd54566975/dwn-sdk-js": "0.2.4",
"@tbd54566975/dwn-sdk-js": "0.2.6",
"@web5/common": "0.2.1",
"@web5/crypto": "0.2.2",
"@web5/dids": "0.2.2",
Expand Down
20 changes: 10 additions & 10 deletions packages/agent/src/dwn-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,12 +273,12 @@ export class DwnManager {
}
}

const dwnAuthorizationSigner = await this.constructDwnAuthorizationSigner(request.author);
const dwnsigner = await this.constructDwnsigner(request.author);

const messageCreator = dwnMessageCreators[request.messageType];
const dwnMessage = await messageCreator.create({
...<any>request.messageOptions,
authorizationSigner: dwnAuthorizationSigner
signer: dwnsigner
});

return { message: dwnMessage.toJSON(), dataStream: readableStream };
Expand All @@ -299,7 +299,7 @@ export class DwnManager {
return signingKeyId;
}

private async constructDwnAuthorizationSigner(author: string): Promise<Signer> {
private async constructDwnsigner(author: string): Promise<Signer> {
const signingKeyId = await this.getAuthorSigningKeyId({ did: author });

/**
Expand Down Expand Up @@ -341,11 +341,11 @@ export class DwnManager {
}): Promise<DwnMessage> {
const { author, messageType, messageCid } = options;

const dwnAuthorizationSigner = await this.constructDwnAuthorizationSigner(author);
const dwnsigner = await this.constructDwnsigner(author);

const messagesGet = await MessagesGet.create({
authorizationSigner : dwnAuthorizationSigner,
messageCids : [messageCid]
signer : dwnsigner,
messageCids : [messageCid]
});

const result: MessagesGetReply = await this._dwn.processMessage(author, messagesGet.message);
Expand Down Expand Up @@ -374,8 +374,8 @@ export class DwnManager {
dwnMessage.data = new Blob([dataBytes]);
} else {
const recordsRead = await RecordsRead.create({
authorizationSigner : dwnAuthorizationSigner,
filter : {
signer : dwnsigner,
filter : {
recordId: writeMessage.recordId
}
});
Expand Down Expand Up @@ -409,13 +409,13 @@ export class DwnManager {
}): Promise<EventsGet | MessagesGet | RecordsRead | RecordsQuery | RecordsWrite | RecordsDelete | ProtocolsQuery | ProtocolsConfigure> {
const { author, messageOptions, messageType } = options;

const dwnAuthorizationSigner = await this.constructDwnAuthorizationSigner(author);
const dwnsigner = await this.constructDwnsigner(author);

const messageCreator = dwnMessageCreators[messageType];

const dwnMessage = await messageCreator.create({
...<any>messageOptions,
authorizationSigner: dwnAuthorizationSigner
signer: dwnsigner
});

return dwnMessage;
Expand Down
2 changes: 1 addition & 1 deletion packages/agent/tests/test-config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
declare const __karma__: { config?: { testDwnUrl?: string; } };

const DEFAULT_TEST_DWN_URL = 'https://dwn.tbddev.org/dwn0';
const DEFAULT_TEST_DWN_URL = 'http://localhost:3000';

function getTestDwnUrl(): string {
// Check to see if we're running in a Karma browser test environment.
Expand Down
1 change: 1 addition & 0 deletions packages/api/.vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"webRoot": "${workspaceFolder:web5}"
},
{
"runtimeVersion": "20",
"type": "node",
"request": "launch",
"name": "test:node",
Expand Down
10 changes: 8 additions & 2 deletions packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,17 @@
"node": ">=18.0.0"
},
"dependencies": {
"@tbd54566975/dwn-sdk-js": "0.2.6",
"@web5/agent": "0.2.4",
"@web5/crypto": "0.2.2",
"@tbd54566975/dwn-sdk-js": "0.2.4",
"@web5/agent": "0.2.3",
"@web5/crypto": "0.2.2",
"@web5/crypto": "0.2.1",
"@tbd54566975/dwn-sdk-js": "0.2.6",
"@web5/agent": "0.2.4",
"@web5/crypto": "0.2.1",
"@web5/dids": "0.2.2",
"@web5/user-agent": "0.2.3",
"@web5/user-agent": "0.2.4",
"level": "8.0.0",
"ms": "2.1.3",
"readable-stream": "4.4.2",
Expand Down
14 changes: 7 additions & 7 deletions packages/api/src/dwn-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { dataToBlob } from './utils.js';
* @beta
*/
export type ProtocolsConfigureRequest = {
message: Omit<ProtocolsConfigureOptions, 'authorizationSigner'>;
message: Omit<ProtocolsConfigureOptions, 'signer'>;
}

/**
Expand Down Expand Up @@ -55,7 +55,7 @@ export type ProtocolsQueryReplyEntry = {
*/
export type ProtocolsQueryRequest = {
from?: string;
message: Omit<ProtocolsQueryOptions, 'authorizationSigner'>
message: Omit<ProtocolsQueryOptions, 'signer'>
}

/**
Expand Down Expand Up @@ -90,7 +90,7 @@ export type RecordsCreateResponse = RecordsWriteResponse;
export type RecordsCreateFromRequest = {
author: string;
data: unknown;
message?: Omit<RecordsWriteOptions, 'authorizationSigner'>;
message?: Omit<RecordsWriteOptions, 'signer'>;
record: Record;
}

Expand All @@ -101,7 +101,7 @@ export type RecordsCreateFromRequest = {
*/
export type RecordsDeleteRequest = {
from?: string;
message: Omit<RecordsDeleteOptions, 'authorizationSigner'>;
message: Omit<RecordsDeleteOptions, 'signer'>;
}

/**
Expand All @@ -121,7 +121,7 @@ export type RecordsDeleteResponse = {
export type RecordsQueryRequest = {
/** The from property indicates the DID to query from and return results. */
from?: string;
message: Omit<RecordsQueryOptions, 'authorizationSigner'>;
message: Omit<RecordsQueryOptions, 'signer'>;
}

/**
Expand All @@ -142,7 +142,7 @@ export type RecordsQueryResponse = {
export type RecordsReadRequest = {
/** The from property indicates the DID to read from and return results fro. */
from?: string;
message: Omit<RecordsReadOptions, 'authorizationSigner'>;
message: Omit<RecordsReadOptions, 'signer'>;
}

/**
Expand All @@ -162,7 +162,7 @@ export type RecordsReadResponse = {
*/
export type RecordsWriteRequest = {
data: unknown;
message?: Omit<Partial<RecordsWriteOptions>, 'authorizationSigner'>;
message?: Omit<Partial<RecordsWriteOptions>, 'signer'>;
store?: boolean;
}

Expand Down
10 changes: 5 additions & 5 deletions packages/api/tests/record.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ describe('Record', () => {

// Create a parent record to reference in the RecordsWriteMessage used for validation
const parentRecorsWrite = await RecordsWrite.create({
authorizationSigner : authorization,
signer : authorization,
data : new Uint8Array(await dataBlob.arrayBuffer()),

Check failure on line 150 in packages/api/tests/record.spec.ts

View workflow job for this annotation

GitHub Actions / test-with-node

Extra space after key 'data'
dataFormat,
protocol,
Expand All @@ -157,7 +157,7 @@ describe('Record', () => {
// Create a RecordsWriteMessage
const recordsWrite = await RecordsWrite.create({
attestationSigners : attestation,

Check failure on line 159 in packages/api/tests/record.spec.ts

View workflow job for this annotation

GitHub Actions / test-with-node

Extra space after key 'attestationSigners'
authorizationSigner : authorization,
signer : authorization,

Check failure on line 160 in packages/api/tests/record.spec.ts

View workflow job for this annotation

GitHub Actions / test-with-node

Missing space after key 'signer'
data : new Uint8Array(await dataBlob.arrayBuffer()),

Check failure on line 161 in packages/api/tests/record.spec.ts

View workflow job for this annotation

GitHub Actions / test-with-node

Extra space after key 'data'
dataFormat,
encryptionInput,
Expand Down Expand Up @@ -533,7 +533,7 @@ describe('Record', () => {
});
});

it('writes records to remote DWNs for your own DID', async () => {
it.only('writes records to remote DWNs for your own DID', async () => {

Check warning on line 536 in packages/api/tests/record.spec.ts

View workflow job for this annotation

GitHub Actions / test-with-node

Unexpected exclusive mocha test
const dataString = 'Hello, world!';

// Alice writes a message to her agent connected DWN.
Expand Down Expand Up @@ -908,7 +908,7 @@ describe('Record', () => {

// Create a parent record to reference in the RecordsWriteMessage used for validation
const parentRecorsWrite = await RecordsWrite.create({
authorizationSigner : authorization,
signer : authorization,
data : new Uint8Array(await dataBlob.arrayBuffer()),

Check failure on line 912 in packages/api/tests/record.spec.ts

View workflow job for this annotation

GitHub Actions / test-with-node

Extra space after key 'data'
dataFormat,
protocol,
Expand All @@ -919,7 +919,7 @@ describe('Record', () => {
// Create a RecordsWriteMessage
const recordsWrite = await RecordsWrite.create({
attestationSigners : attestation,

Check failure on line 921 in packages/api/tests/record.spec.ts

View workflow job for this annotation

GitHub Actions / test-with-node

Extra space after key 'attestationSigners'
authorizationSigner : authorization,
signer : authorization,

Check failure on line 922 in packages/api/tests/record.spec.ts

View workflow job for this annotation

GitHub Actions / test-with-node

Missing space after key 'signer'
data : new Uint8Array(await dataBlob.arrayBuffer()),

Check failure on line 923 in packages/api/tests/record.spec.ts

View workflow job for this annotation

GitHub Actions / test-with-node

Extra space after key 'data'
dataFormat,
encryptionInput,
Expand Down
2 changes: 1 addition & 1 deletion packages/dev-env/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ version: "3.98"
services:
dwn-server:
container_name: dwn-server
image: ghcr.io/tbd54566975/dwn-server:dwn-sdk-0.2.4
image: ghcr.io/tbd54566975/dwn-server:dwn-sdk-v0.2.6
ports:
- "3000:3000"
Loading

0 comments on commit 5d2641e

Please sign in to comment.