-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
29 lines (25 loc) · 896 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const { KeyDIDMethod } = require("@jpmorganchase/onyx-ssi-sdk");
const VidosResolver = require("./VidosResolver");
async function main() {
const keyDidMethod = new KeyDIDMethod();
console.log("Creating a new DID...");
const did = await keyDidMethod.create();
console.log("Created did: ", did.did);
console.log("Creating a new VidosResolver instance...");
if (!process.env.VIDOS_RESOLVER_URL || !process.env.VIDOS_API_KEY) {
throw new Error(
"Vidos resolver URL and API key must be set in the environment.",
);
}
const resolver = new VidosResolver(
process.env.VIDOS_RESOLVER_URL,
process.env.VIDOS_API_KEY,
);
console.log("Resolving the DID using the VidosResolver instance...");
const resolutionResponse = await resolver.resolve(did.did);
console.log(
"Resolution response: ",
JSON.stringify(resolutionResponse, null, 2),
);
}
main();