From 6d63a0ba443e120f9ffcc0be5020601dbea4f67f Mon Sep 17 00:00:00 2001 From: Frank Hinek Date: Fri, 21 Apr 2023 06:11:27 -0400 Subject: [PATCH] Update simple-agent example to define location for EventLog Signed-off-by: Frank Hinek --- examples/simple-agent/.gitignore | 1 + examples/simple-agent/src/utils.js | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/examples/simple-agent/.gitignore b/examples/simple-agent/.gitignore index cf58023e7..9cda4e2f9 100644 --- a/examples/simple-agent/.gitignore +++ b/examples/simple-agent/.gitignore @@ -1,3 +1,4 @@ DATASTORE-* +EVENTLOG-* INDEX-* MESSAGESTORE-* \ No newline at end of file diff --git a/examples/simple-agent/src/utils.js b/examples/simple-agent/src/utils.js index 0c20d6871..d2782cfc5 100644 --- a/examples/simple-agent/src/utils.js +++ b/examples/simple-agent/src/utils.js @@ -1,5 +1,5 @@ import getRawBody from 'raw-body'; -import { DataStoreLevel, Dwn, MessageStoreLevel } from '@tbd54566975/dwn-sdk-js'; +import { DataStoreLevel, Dwn, EventLogLevel, MessageStoreLevel } from '@tbd54566975/dwn-sdk-js'; import { Web5 } from '@tbd54566975/web5'; import fs from 'node:fs'; import mkdirp from 'mkdirp'; @@ -9,12 +9,13 @@ import { createRequire } from 'node:module'; // in the same directory. If you don't do this, you will get LevelDB lock errors. const port = await getPort(process.argv); const dataStore = new DataStoreLevel({ blockstoreLocation: `DATASTORE-${port}` }); +const eventLog = new EventLogLevel({ location: `EVENTLOG-${port}` }); const messageStore = new MessageStoreLevel({ blockstoreLocation : `MESSAGESTORE-${port}`, indexLocation : `INDEX-${port}`, }); -const dwnNode = await Dwn.create({ messageStore, dataStore }); +const dwnNode = await Dwn.create({ dataStore, eventLog, messageStore }); export const web5 = new Web5({ dwn: { node: dwnNode }}); @@ -57,7 +58,7 @@ export async function loadConfig() { web5.did.manager.set(didState.id, { connected: true, endpoint: 'app://dwn', - keys: didState.keys['#dwn'].keyPair, + keys: { ['#dwn']: { keyPair: didState.keys[0].keyPair} }, }); }