@betacodd/lighthouse-package
Version:
NPM package and CLI tool to interact with lighthouse protocol
23 lines (22 loc) • 681 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const kavach_1 = require("@lighthouse-web3/kavach");
exports.default = async (cid, publicKey, signedMessage) => {
const { error, shards } = await (0, kavach_1.recoverShards)(publicKey, cid, signedMessage);
if (error) {
throw error;
}
const { masterKey: key, error: recoverError } = await (0, kavach_1.recoverKey)(shards);
if (recoverError) {
throw recoverError;
}
/*
return:
{
data: {
key: '519862401c52447c87eb4d41ea5e99f4c6b82a5914cf4086a61f25ef3128122d'
}
}
*/
return { data: { key: key } };
};