import { peerIdFromPrivateKey } from "@libp2p/peer-id";
import { getV4Crypto } from "@chainsafe/enr";
import { fromHex } from "@lodestar/utils";
export function computeNodeIdFromPrivateKey(privateKey) {
    const peerId = peerIdFromPrivateKey(privateKey);
    return computeNodeId(peerId);
}
export function computeNodeId(peerId) {
    if (peerId.publicKey === undefined) {
        throw Error(`Undefined publicKey peerId=${peerId.toString()}`);
    }
    const nodeIdHex = getV4Crypto().nodeId(peerId.publicKey.raw);
    return fromHex(nodeIdHex);
}
//# sourceMappingURL=interface.js.map