From dd8907472c3ff9e4754638a8601ae8ff6cd102b4 Mon Sep 17 00:00:00 2001 From: Gus Caplan Date: Tue, 21 Mar 2017 02:17:20 -0500 Subject: [PATCH] nonce has to be a uint64 :< (#1240) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * nonce me daddy * Update RESTMethods.js * Update RESTMethods.js * Update RESTMethods.js * Update RESTMethods.js * Update RESTMethods.js * Update RESTMethods.js * (╯°□°)╯︵ ┻━┻ * Update RESTMethods.js * Update RESTMethods.js --- src/client/rest/RESTMethods.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/client/rest/RESTMethods.js b/src/client/rest/RESTMethods.js index 3e78a8847..69f51e699 100644 --- a/src/client/rest/RESTMethods.js +++ b/src/client/rest/RESTMethods.js @@ -62,6 +62,12 @@ class RESTMethods { return new Promise((resolve, reject) => { // eslint-disable-line complexity if (typeof content !== 'undefined') content = this.client.resolver.resolveString(content); + // The nonce has to be a uint64 :< + if (typeof nonce !== 'undefined') { + nonce = parseInt(nonce); + if (isNaN(nonce) || nonce < 0) throw new RangeError('Message nonce must fit in an unsigned 64-bit integer.'); + } + if (content) { if (split && typeof split !== 'object') split = {};