UNPKG

lighthouse-package-fork

Version:

NPM package and CLI tool to interact with lighthouse protocol

15 lines (14 loc) 669 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const lighthouse_encryption_sdk_browser_1 = require("lighthouse-encryption-sdk-browser"); exports.default = async (cid, publicKey, signedMessage, dynamicData = {}, shardCount = 3) => { const { error, shards } = await (0, lighthouse_encryption_sdk_browser_1.recoverShards)(publicKey, cid, signedMessage, shardCount, dynamicData); if (error) { throw error; } const { masterKey: key, error: recoverError } = await (0, lighthouse_encryption_sdk_browser_1.recoverKey)(shards); if (recoverError) { throw recoverError; } return { data: { key: key } }; };