@lighthouse-web3/sdk
Version:
NPM package and CLI tool to interact with lighthouse protocol
36 lines (35 loc) • 1.11 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const lighthouse_config_1 = require("../../lighthouse.config");
exports.default = async (key, apiKey) => {
try {
const url = lighthouse_config_1.lighthouseConfig.lighthouseAPI + `/api/ipns/remove_key?keyName=${key}`;
const response = await fetch(url, {
method: 'DELETE',
headers: {
Authorization: `Bearer ${apiKey}`,
},
});
if (!response.ok) {
throw new Error(`Request failed with status code ${response.status}`);
}
const data = (await response.json());
/*
return:
{
data: {
Keys: [
{
"Name": "3090a315e92c495ea36444f2bbaeefaf",
"Id": "k51qzi5uqu5dm8gfelll8own1epd9osmlig49il5mmphkrcxbnhydkmx101x15"
}
]
}
}
*/
return { data: data };
}
catch (error) {
throw new Error(error.message);
}
};