From 52fec6161f82003eff4fc9f0bbc9a2595b356a19 Mon Sep 17 00:00:00 2001 From: Kenta Iwasaki Date: Fri, 19 Jun 2020 02:17:46 +0900 Subject: [PATCH] sdk/node: do not use bigint literals and downgrade target to es2015 --- nodejs/src/monte.ts | 8 ++++---- nodejs/tsconfig.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/nodejs/src/monte.ts b/nodejs/src/monte.ts index d1ea578..2bb30b1 100644 --- a/nodejs/src/monte.ts +++ b/nodejs/src/monte.ts @@ -27,8 +27,8 @@ export class MonteSocket extends Duplex { #pending: EventEmitter = new EventEmitter(); #counter: number = 0; - #readNonce: bigint = 0n; - #writeNonce: bigint = 0n; + #readNonce: bigint = BigInt(0); + #writeNonce: bigint = BigInt(0); #sock: net.Socket; #secret: Uint8Array; @@ -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 += 1n; + this.#writeNonce++; const cipher = crypto.createCipheriv("aes-256-gcm", this.#secret, nonce, { authTagLength: 16, @@ -138,7 +138,7 @@ export class MonteSocket extends Duplex { const nonce = Buffer.alloc(12); nonce.writeBigUInt64BE(this.#readNonce); - this.#readNonce += 1n; + this.#readNonce++; const decipher = crypto.createDecipheriv( "aes-256-gcm", diff --git a/nodejs/tsconfig.json b/nodejs/tsconfig.json index 290c877..55fa89d 100644 --- a/nodejs/tsconfig.json +++ b/nodejs/tsconfig.json @@ -5,7 +5,7 @@ /* Basic Options */ // "incremental": true, /* Enable incremental compilation */ - "target": "es2020", + "target": "es2015", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */ "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */