@hashgraph/hedera-local
Version:
Developer tooling for running Local Hedera Network (Consensus + Mirror Nodes).
25 lines • 862 B
JavaScript
;
// SPDX-License-Identifier: Apache-2.0
Object.defineProperty(exports, "__esModule", { value: true });
exports.KeyType = void 0;
exports.getPrivateKey = getPrivateKey;
const sdk_1 = require("@hashgraph/sdk");
var KeyType;
(function (KeyType) {
KeyType["ED25519"] = "ED25519";
KeyType["ECDSA"] = "ECDSA";
KeyType["DER"] = "DER";
})(KeyType || (exports.KeyType = KeyType = {}));
function getPrivateKey(key) {
switch (key.type) {
case KeyType.ED25519:
return sdk_1.PrivateKey.fromStringED25519(key.value);
case KeyType.ECDSA:
return sdk_1.PrivateKey.fromStringECDSA(key.value);
case KeyType.DER:
return sdk_1.PrivateKey.fromStringDer(key.value);
default:
throw new Error(`Unsupported key type: ${key.type}`);
}
}
//# sourceMappingURL=IPrivateKey.js.map