Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
protected async getSignedRaw() {
const receiverKey = this.receiverKey.serialize();
const senderKey = this.senderKey.serialize();
const message = await this.message.exportProto();
const data = utils.combine(receiverKey, senderKey, message);
return data;
}
/**
* N = ceil(L/HashLen)
* T = T(1) | T(2) | T(3) | ... | T(N)
* OKM = first L octets of T
*
* where:
* T(0) = empty string (zero length)
* T(1) = HMAC-Hash(PRK, T(0) | info | 0x01)
* T(2) = HMAC-Hash(PRK, T(1) | info | 0x02)
* T(3) = HMAC-Hash(PRK, T(2) | info | 0x03)
*/
const PRK = await this.importHMAC(PRKBytes);
const T: ArrayBuffer[] = [new ArrayBuffer(0)];
for (let i = 0; i < keysCount; i++) {
T[i + 1] = await this.sign(PRK, combine(T[i], info, new Uint8Array([i + 1]).buffer as ArrayBuffer));
}
return T.slice(1);
}