Skip to content

Commit

Permalink
sdk/node/monte: do not downcast bigint to number via post-increment op
Browse files Browse the repository at this point in the history
  • Loading branch information
lithdew committed Jun 18, 2020
1 parent 52fec61 commit feec97f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions nodejs/src/monte.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export class MonteSocket extends Duplex {
public encrypt(buf: Buffer): Buffer {
const nonce = Buffer.alloc(12);
nonce.writeBigUInt64BE(this.#writeNonce);
this.#writeNonce++;
this.#writeNonce = this.#writeNonce + BigInt(1);

const cipher = crypto.createCipheriv("aes-256-gcm", this.#secret, nonce, {
authTagLength: 16,
Expand All @@ -138,7 +138,7 @@ export class MonteSocket extends Duplex {

const nonce = Buffer.alloc(12);
nonce.writeBigUInt64BE(this.#readNonce);
this.#readNonce++;
this.#readNonce = this.#readNonce + BigInt(1);

const decipher = crypto.createDecipheriv(
"aes-256-gcm",
Expand Down

0 comments on commit feec97f

Please sign in to comment.