forked from byteball/headless-obyte
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate_attestation.js
35 lines (31 loc) · 919 Bytes
/
create_attestation.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
/*jslint node: true */
"use strict";
var headlessWallet = require('../start.js');
var eventBus = require('ocore/event_bus.js');
function onError(err){
throw Error(err);
}
function createAttestation(){
var composer = require('ocore/composer.js');
var network = require('ocore/network.js');
var callbacks = composer.getSavingCallbacks({
ifNotEnoughFunds: onError,
ifError: onError,
ifOk: function(objJoint){
network.broadcastJoint(objJoint);
}
});
var profile = {
age: 24,
name: "George",
emails: ["[email protected]", "[email protected]"]
};
composer.composeAttestationJoint(
"LS3PUAGJ2CEYBKWPODVV72D3IWWBXNXO", // attestor address
"PYQJWUWRMUUUSUHKNJWFHSR5OADZMUYR", // address of the person being attested (subject)
profile, // attested profile
headlessWallet.signer,
callbacks
);
}
eventBus.on('headless_wallet_ready', createAttestation);