cobinhood-rx
Version:
CobinhoodRx is a rxjs node wrapper for the CobinhoodRx Api.
23 lines • 727 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
class NonceManager {
constructor() {
this.nonceHistory = [];
}
getNonce() {
let nonce = this.generateNonce();
while (nonce === this.nonceHistory[this.nonceHistory.length - 1]) {
nonce = this.generateNonce();
}
this.nonceHistory = this.nonceHistory.slice(-50);
this.nonceHistory.push(nonce);
return nonce;
}
generateNonce() {
return Math.floor(new Date().getTime() / 1000);
}
}
exports.NonceManager = NonceManager;
const nonceManager = new NonceManager();
exports.default = nonceManager;
//# sourceMappingURL=NounceManager.js.map