"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateKeyPair = generateKeyPair;
exports.digestSHA256 = digestSHA256;
exports.signSHA256 = signSHA256;
const crypto_1 = __importDefault(require("crypto"));
// Returns an ECDSA key pair
function generateKeyPair() {
    return crypto_1.default.generateKeyPairSync('ec', { namedCurve: 'P-256' });
}
// Returns a hex-encoded SHA256 digest
function digestSHA256(data) {
    return crypto_1.default.createHash('sha256').update(data).digest('hex');
}
// Returns a hex-encoded SHA256 signature
function signSHA256(key, data) {
    return crypto_1.default.createSign('sha256').update(data).sign(key).toString('hex');
}
