@sebastianp265/safe-server-side-storage-client
Version:
Library for Confidential Server-Side Message Storage Using the Labyrinth Protocol
13 lines (12 loc) • 694 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateEpochDeviceMac = generateEpochDeviceMac;
const key_derivation_1 = require("../crypto/key-derivation");
const utils_1 = require("../crypto/utils");
const message_authentication_1 = require("../crypto/message-authentication");
function generateEpochDeviceMac(epoch, deviceKeyPub) {
const epochDeviceMacKey = (0, key_derivation_1.kdfOneKey)(epoch.rootKey, null,
// TODO: why in protocol there is base64 encoding?
(0, utils_1.asciiStringToBytes)(`epoch_devices_${epoch.sequenceId}`));
return (0, message_authentication_1.mac)(epochDeviceMacKey, deviceKeyPub.getX25519PublicKeyBytes());
}