How to use the pvtsutils.combine function in pvtsutils

To help you get started, we’ve selected a few pvtsutils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github PeculiarVentures / 2key-ratchet / src / protocol / message_signed.ts View on Github external
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;
    }
github PeculiarVentures / 2key-ratchet / src / crypto / secret.ts View on Github external
/**
         * 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);
    }