forked from hyperledger-archives/indy-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.js
45 lines (35 loc) · 1.31 KB
/
template.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*
* Example demonstrating how to do the key rotation on the ledger.
*
* Steward already exists on the ledger and its DID/Verkey are obtained using seed.
* Trust Anchor's DID/Verkey pair is generated and stored into wallet.
* Stewards builds NYM request in order to add Trust Anchor to the ledger.
* Once NYM transaction is done, Trust Anchor wants to change its Verkey.
* First, temporary key is created in the wallet.
* Second, Trust Anchor builds NYM request to replace the Verkey on the ledger.
* Third, when NYM transaction succeeds, Trust Anchor makes new Verkey permanent in wallet
* (it was only temporary before).
*
* To assert the changes, Trust Anchor reads both the Verkey from the wallet and the Verkey from the ledger
* using GET_NYM request, to make sure they are equal to the new Verkey, not the original one
* added by Steward
*/
const indy = require('indy-sdk')
const util = require('./util')
const colors = require('./colors')
const log = console.log
function logValue() {
log(colors.CYAN, ...arguments, colors.NONE)
}
async function run() {
log("Set protocol version 2 to work with Indy Node 1.4")
await indy.setProtocolVersion(2)
// Step 2 code goes here.
// Step 3 code goes here.
// Step 4 code goes here.
}
try {
run()
} catch (e) {
log("ERROR occured : e")
}