Skip to content

Commit

Permalink
sdk/node: do not use bigint literals and downgrade target to es2015
Browse files Browse the repository at this point in the history
  • Loading branch information
lithdew committed Jun 18, 2020
1 parent 3f7d06e commit 52fec61
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions nodejs/src/monte.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down 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 += 1n;
this.#writeNonce++;

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 += 1n;
this.#readNonce++;

const decipher = crypto.createDecipheriv(
"aes-256-gcm",
Expand Down
2 changes: 1 addition & 1 deletion nodejs/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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'. */
Expand Down

0 comments on commit 52fec61

Please sign in to comment.