boho 2.0.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "boho",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "Secure Lightweight Encryption & Authentication Library for Node.js, Browsers and Arduino.",
5
5
  "type": "module",
6
6
  "exports": {
package/src/boho.js CHANGED
@@ -135,10 +135,11 @@ export class Boho {
135
135
  const now = Date.now()
136
136
  const secTime = parseInt(now / 1000)
137
137
  const milTime = now % 1000
138
+ if (++this.counter > 65535) this.counter = 0;
138
139
  const salt12 = Buffer.concat([
139
140
  MBP.NB('32L', secTime),
140
141
  MBP.NB('16L', milTime),
141
- MBP.NB('16L', ++this.counter),
142
+ MBP.NB('16L', this.counter),
142
143
  RAND(4) // JS: use crypto.getRandomValues(), Arduino: use micros()
143
144
  ])
144
145
  salt12.copy(this._otpSrc44, 32)
@@ -152,10 +153,11 @@ export class Boho {
152
153
  const now = Date.now()
153
154
  const secTime = parseInt(now / 1000)
154
155
  const milTime = now % 1000
156
+ if (++this.counter > 65535) this.counter = 0;
155
157
  const salt12 = Buffer.concat([
156
158
  MBP.NB('32L', secTime),
157
159
  MBP.NB('16L', milTime),
158
- MBP.NB('16L', ++this.counter),
160
+ MBP.NB('16L', this.counter),
159
161
  nonce
160
162
  ])
161
163
  salt12.copy(this._otpSrc44, 32)