ts-mls
Version:
[](https://github.com/LukaJCB/ts-mls/actions/workflows/ci.yml) [](https://badge.fury.io/js/ts-mls) [ {
const secret = await deriveSecret(exporterSecret, label, cs.kdf);
const hash = await cs.hash.digest(context);
return expandWithLabel(secret, "exported", hash, length, cs.kdf);
}
export async function deriveKeySchedule(joinerSecret, pskSecret, groupContext, kdf) {
const epochSecret = await extractEpochSecret(groupContext, joinerSecret, kdf, pskSecret);
return await initializeKeySchedule(epochSecret, kdf);
}
export async function initializeKeySchedule(epochSecret, kdf) {
const newInitSecret = await deriveSecret(epochSecret, "init", kdf);
const senderDataSecret = await deriveSecret(epochSecret, "sender data", kdf);
const encryptionSecret = await deriveSecret(epochSecret, "encryption", kdf);
const exporterSecret = await deriveSecret(epochSecret, "exporter", kdf);
const externalSecret = await deriveSecret(epochSecret, "external", kdf);
const confirmationKey = await deriveSecret(epochSecret, "confirm", kdf);
const membershipKey = await deriveSecret(epochSecret, "membership", kdf);
const resumptionPsk = await deriveSecret(epochSecret, "resumption", kdf);
const epochAuthenticator = await deriveSecret(epochSecret, "authentication", kdf);
const newKeySchedule = {
epochSecret: epochSecret,
initSecret: newInitSecret,
senderDataSecret,
encryptionSecret,
exporterSecret,
externalSecret,
confirmationKey,
membershipKey,
resumptionPsk,
epochAuthenticator,
};
return newKeySchedule;
}
export async function initializeEpoch(initSecret, commitSecret, groupContext, pskSecret, kdf) {
const joinerSecret = await extractJoinerSecret(groupContext, initSecret, commitSecret, kdf);
const welcomeSecret = await extractWelcomeSecret(joinerSecret, pskSecret, kdf);
const newKeySchedule = await deriveKeySchedule(joinerSecret, pskSecret, groupContext, kdf);
return { welcomeSecret, joinerSecret, keySchedule: newKeySchedule };
}
//# sourceMappingURL=keySchedule.js.map