did-provider-quick
Version:
Veramo plugin that can enable creation and control of did:quick identifiers.
31 lines • 1.06 kB
JavaScript
import { WitnessClient } from "@witnessco/client";
export const API_KEY = process.env.WITNESS_API_KEY;
export const createWitnessHash = (content) => {
const witness = new WitnessClient(API_KEY);
return witness.hash(content);
};
export const getTimestamp = async (leafHash) => {
const witness = new WitnessClient(API_KEY);
try {
const timestamp = await witness.getTimestampForLeafHash(leafHash);
// console.log("timestamp: ", timestamp)
return timestamp;
}
catch (ex) {
console.log("no timestamp found");
await postLeaf(leafHash);
return undefined;
}
};
export const postLeaf = async (leafHash) => {
const witness = new WitnessClient(API_KEY);
const result = await witness.postLeaf(leafHash);
// console.log("result: ", result)
return result;
};
export const getProof = async (leafHash) => {
const witness = new WitnessClient(API_KEY);
const result = await witness.getProofForLeafHash(leafHash);
return result;
};
//# sourceMappingURL=witnessApi.js.map