edc-health-care_web3
v1.0.2
Published
## Install
Downloads
1
Readme
EDC Health Care_Web3
Install
yarn add <package-local-path>
Usage
Connection
import { Connection } from "edc-health-care_web3";
const connection = new Connection("http://localhost:8545");
DID
import { Authenticator, Connection, DID } from "edc-health-care_web3";
import { AuthType } from "edc-health-care_web3/types/did";
const connection = new Connection(
"http://localhost:8545",
"ws://localhost:8546"
);
const did = new DID(connection);
const { address, privateKey } = did.generateDID();
console.log(address, privateKey);
const authenticator = new Authenticator(
connection,
[],
"0x0000000000000000000000000000000000000000"
);
did.setAuthDID(privateKey, address, AuthType.IV, authenticator);
LockData Quesiton
import { Connection, DID } from "edc-health-care_web3";
import { Question } from "edc-health-care_web3/lock-data";
import { hashFuntion } from "edc-health-care_web3/utils/helper";
const connection = new Connection("http://localhost:8545");
const did = new DID(connection);
const { address, privateKey } = did.generateDID();
const question = new Question(
connection,
[],
"0x0000000000000000000000000000000000000000"
);
const hashValue = hashFuntion(connection, "data-hash");
question.lockData(privateKey, hashValue, "uri-to-data", "data-for-hash");