boho 1.1.0 → 2.0.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,11 +1,11 @@
1
1
  {
2
2
  "name": "boho",
3
- "version": "1.1.0",
3
+ "version": "2.0.0",
4
4
  "description": "Secure Lightweight Encryption & Authentication Library for Node.js, Browsers and Arduino.",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  "import": "./dist/boho.js",
8
- "require": "./dist/boho.cjs"
8
+ "require": null
9
9
  },
10
10
  "types": "dist/boho.d.ts",
11
11
  "browser": "./dist/boho.min.js",
package/rollup.config.js CHANGED
@@ -25,23 +25,6 @@ export default [
25
25
  commonjs()
26
26
  , terser()
27
27
  ]
28
- },
29
- {
30
- input: './src/index.js',
31
- output: [
32
- {
33
- file: './dist/boho.cjs',
34
- format: 'cjs',
35
- exports: 'default'
36
- }
37
- ],
38
- plugins: [
39
- resolve({
40
- preferBuiltins: true
41
- }),
42
- commonjs()
43
- , terser()
44
- ]
45
28
  }
46
29
 
47
30
  ]
package/src/boho.js CHANGED
@@ -1,14 +1,21 @@
1
+ // Copyright (c) 2024 Taeo Lee (sixgen@gmail.com)
2
+ // MIT License
3
+ //
4
+ // https://github.com/remocons/boho
5
+ //
6
+ //
7
+ //
1
8
  import { sha256 } from './sha256-mbp.js'
2
9
  import MBP from 'meta-buffer-pack'
3
10
  export { MBP }
4
11
  import { BohoMsg, Meta, MetaSize } from './constants.js'
5
12
  export { BohoMsg, Meta, MetaSize, sha256 }
6
13
  import { Buffer } from 'buffer/index.js'
7
- export { Buffer}
14
+ export { Buffer }
8
15
 
9
16
  /**
10
- * 랜덤 바이트 버퍼를 생성합니다.
11
- * @param {number} size - 생성할 바이트 수
17
+ * Generates a random byte buffer.
18
+ * @param {number} size - Number of bytes to generate
12
19
  * @returns {Buffer}
13
20
  */
14
21
  export function RAND(size) {
@@ -16,7 +23,7 @@ export function RAND(size) {
16
23
  }
17
24
 
18
25
  /**
19
- * Boho 보안 프로토콜 클래스
26
+ * Boho security protocol class
20
27
  */
21
28
  export class Boho {
22
29
  /**
@@ -33,13 +40,13 @@ export class Boho {
33
40
  this.localNonce = Buffer.alloc(4)
34
41
  this.remoteNonce = Buffer.alloc(4)
35
42
  this.isAuthorized = false
36
-
43
+ this.counter = 0;
37
44
  }
38
45
 
39
46
  /**
40
- * 인증 상태를 초기화합니다.
47
+ * Initializes authentication state.
41
48
  */
42
- clearAuth(){
49
+ clearAuth() {
43
50
  this._id8.fill(0)
44
51
  this._otpSrc44.fill(0)
45
52
  this._otp36.fill(0)
@@ -48,10 +55,11 @@ export class Boho {
48
55
  this.localNonce.fill(0)
49
56
  this.remoteNonce.fill(0)
50
57
  this.isAuthorized = false
58
+ this.counter = 0;
51
59
  }
52
60
 
53
61
  /**
54
- * 입력 데이터를 해시하여 id8에 설정합니다.
62
+ * Sets id8 by hashing the input data.
55
63
  * @param {any} data
56
64
  */
57
65
  set_hash_id8(data) {
@@ -60,7 +68,7 @@ export class Boho {
60
68
  }
61
69
 
62
70
  /**
63
- * id8 값을 설정합니다.
71
+ * Sets the id8 value.
64
72
  * @param {any} data
65
73
  */
66
74
  set_id8(data) {
@@ -70,7 +78,7 @@ export class Boho {
70
78
  }
71
79
 
72
80
  /**
73
- * 키 값을 해시하여 otpSrc44에 설정합니다.
81
+ * Sets the key value by hashing and storing in otpSrc44.
74
82
  * @param {any} data
75
83
  */
76
84
  set_key(data) {
@@ -79,12 +87,12 @@ export class Boho {
79
87
  }
80
88
 
81
89
  /**
82
- * 'id.key' 문자열을 분리하여 id8과 key를 설정합니다.
90
+ * Splits 'id.key' string and sets id8 and key.
83
91
  * @param {string} id_key
84
92
  */
85
93
  set_id_key(id_key) {
86
94
  let delimiterPosition = id_key.indexOf('.')
87
- if( delimiterPosition == -1 ) return
95
+ if (delimiterPosition == -1) return
88
96
  let id = id_key.substring(0, delimiterPosition)
89
97
  let key = id_key.substring(delimiterPosition + 1)
90
98
  this.set_id8(id)
@@ -92,7 +100,7 @@ export class Boho {
92
100
  }
93
101
 
94
102
  /**
95
- * 외부에서 id8 값을 복사합니다.
103
+ * Copies id8 value from external buffer.
96
104
  * @param {Buffer} data
97
105
  */
98
106
  copy_id8(data) {
@@ -100,7 +108,7 @@ export class Boho {
100
108
  }
101
109
 
102
110
  /**
103
- * 외부에서 key 값을 복사합니다.
111
+ * Copies key value from external buffer.
104
112
  * @param {Buffer} data
105
113
  */
106
114
  copy_key(data) {
@@ -108,7 +116,7 @@ export class Boho {
108
116
  }
109
117
 
110
118
  /**
111
- * sha256 해시를 n번 반복 적용합니다.
119
+ * Applies sha256 hash n times.
112
120
  * @param {any} srcData
113
121
  * @param {number} n
114
122
  * @returns {Uint8Array}
@@ -119,50 +127,54 @@ export class Boho {
119
127
  return hashSum
120
128
  }
121
129
 
130
+
122
131
  /**
123
- * 랜덤 시계값(salt12)을 otpSrc44에 설정합니다.
132
+ * Sets random clock value (salt12) in otpSrc44.
124
133
  */
125
134
  set_clock_rand() {
126
-
127
- let milTime = Date.now()
128
- let secTime = parseInt(milTime / 1000)
129
- milTime = milTime % 0xffffffff
135
+ const now = Date.now()
136
+ const secTime = parseInt(now / 1000)
137
+ const milTime = now % 1000
130
138
  const salt12 = Buffer.concat([
131
- MBP.NB('32L', secTime),
132
- MBP.NB('32L', milTime),
133
- RAND(4)
139
+ MBP.NB('32L', secTime),
140
+ MBP.NB('16L', milTime),
141
+ MBP.NB('16L', ++this.counter),
142
+ RAND(4) // JS: use crypto.getRandomValues(), Arduino: use micros()
134
143
  ])
135
-
136
144
  salt12.copy(this._otpSrc44, 32)
137
145
  }
138
146
 
139
147
  /**
140
- * 주어진 nonce와 시계값을 otpSrc44에 설정합니다.
148
+ * Sets otpSrc44 with given nonce and clock value.
141
149
  * @param {Buffer} nonce
142
150
  */
143
151
  set_clock_nonce(nonce) {
144
- let milTime = Date.now()
145
- let secTime = parseInt(milTime / 1000)
146
- milTime = milTime % 0xffffffff
152
+ const now = Date.now()
153
+ const secTime = parseInt(now / 1000)
154
+ const milTime = now % 1000
147
155
  const salt12 = Buffer.concat([
148
- MBP.NB('32L', secTime),
149
- MBP.NB('32L', milTime),
156
+ MBP.NB('32L', secTime),
157
+ MBP.NB('16L', milTime),
158
+ MBP.NB('16L', ++this.counter),
150
159
  nonce
151
160
  ])
152
-
153
161
  salt12.copy(this._otpSrc44, 32)
154
162
  }
155
163
 
156
164
  /**
157
- * salt12 값을 otpSrc44에 설정합니다.
165
+ * Sets salt12 value in otpSrc44.
158
166
  * @param {Buffer} salt12
159
167
  */
160
- set_salt12(salt12) {
168
+ set_salt12(salt12 , caller) {
169
+ // console.log('boho.set_salt12', salt12 , caller )
170
+ if( salt12.byteLength != 12){
171
+ throw TypeError('set_salt12: Invalid salt12 byteLength.')
172
+ }
161
173
  salt12.copy(this._otpSrc44, 32)
162
174
  }
163
175
 
164
176
  /**
165
- * otp 값을 초기화합니다.
177
+ * Initializes OTP value.
166
178
  */
167
179
  resetOTP() {
168
180
  let otp32 = MBP.B8(sha256.hash(this._otpSrc44))
@@ -170,7 +182,7 @@ export class Boho {
170
182
  }
171
183
 
172
184
  /**
173
- * 인덱스에 해당하는 OTP 값을 반환합니다.
185
+ * Returns OTP value for the given index.
174
186
  * @param {number} otpIndex
175
187
  * @returns {Uint8Array}
176
188
  */
@@ -180,7 +192,7 @@ export class Boho {
180
192
  }
181
193
 
182
194
  /**
183
- * HMAC 값을 생성합니다.
195
+ * Generates HMAC value.
184
196
  * @param {Buffer} data
185
197
  */
186
198
  generateHMAC(data) {
@@ -189,7 +201,7 @@ export class Boho {
189
201
  }
190
202
 
191
203
  /**
192
- * 8바이트 HMAC 값을 반환합니다.
204
+ * Returns 8-byte HMAC value.
193
205
  * @param {Buffer} data
194
206
  * @returns {Buffer}
195
207
  */
@@ -200,7 +212,7 @@ export class Boho {
200
212
  }
201
213
 
202
214
  /**
203
- * OTP 기반 XOR 암호화/복호화
215
+ * OTP-based XOR encryption/decryption
204
216
  * @param {Buffer} data
205
217
  * @param {number} [otpStartIndex=0]
206
218
  * @param {boolean} [shareDataBuffer=false]
@@ -229,64 +241,57 @@ export class Boho {
229
241
  // B. AUTH process
230
242
 
231
243
  /**
232
- * AUTH_REQ 메시지 생성
244
+ * Generates server time and nonce signal
233
245
  * @returns {Buffer}
234
246
  */
235
- auth_req() {
236
- return MBP.pack(
237
- MBP.MB('#type', '8', BohoMsg.AUTH_REQ),
238
- MBP.MB('#reserved', '8', 0)
239
- )
240
- }
247
+ server_time_nonce() {
248
+ const now = Date.now()
249
+ const unixTime = Math.floor(now / 1000)
250
+ const milliseconds = now % 1000;
241
251
 
242
- /**
243
- * AUTH_NONCE 메시지 생성
244
- * @returns {Buffer}
245
- */
246
- auth_nonce() {
247
- let now = Date.now()
248
- let unixTime = Math.floor(now / 1000)
249
- let milTime = now % 1000
250
252
  this.localNonce = RAND(4)
253
+ //keep
251
254
  this.auth_salt12 = Buffer.concat([
252
- MBP.NB('32L', unixTime),
253
- MBP.NB('32L', milTime),
255
+ MBP.NB('32L', unixTime),
256
+ MBP.NB('16L', milliseconds),
257
+ RAND(2), // used for client's counter IV.
254
258
  this.localNonce
255
259
  ])
256
260
 
257
261
  let infoPack = Buffer.concat([
258
- MBP.NB('8', BohoMsg.AUTH_NONCE),
262
+ MBP.NB('8', BohoMsg.SERVER_TIME_NONCE),
259
263
  this.auth_salt12
260
264
  ])
261
265
  return infoPack
262
266
  }
263
267
 
264
268
  /**
265
- * AUTH_HMAC 메시지 생성
266
- * @param {Buffer} buffer
269
+ * Generates AUTH_REQ message
270
+ * @param {Buffer} buffer server's time nonce
267
271
  * @returns {Buffer|boolean}
268
272
  */
269
- auth_hmac(buffer) {
270
- let auth_nonce = MBP.unpack(buffer, Meta.AUTH_NONCE)
271
- if (auth_nonce) {
273
+ auth_req(buffer) {
274
+ let server_time_nonce = MBP.unpack(buffer, Meta.SERVER_TIME_NONCE)
275
+ if (server_time_nonce) {
272
276
  let salt12 = Buffer.concat([
273
- MBP.NB('32L', auth_nonce.unixTime),
274
- MBP.NB('32L', auth_nonce.milTime),
275
- auth_nonce.nonce
277
+ MBP.NB('32L', server_time_nonce.unixTime),
278
+ MBP.NB('16L', server_time_nonce.milTime),
279
+ MBP.NB('16L', server_time_nonce.counter),
280
+ server_time_nonce.nonce
276
281
  ])
277
282
 
278
- this.set_salt12(salt12)
283
+ this.set_salt12(salt12, 'auth_req')
279
284
 
280
285
  this.localNonce = RAND(4)
281
286
  this.generateHMAC(this.localNonce)
282
287
 
283
- this.remoteNonce = auth_nonce.nonce
288
+ this.remoteNonce = server_time_nonce.nonce
284
289
 
285
290
  let auth_hmac_buffer = MBP.pack(
286
- MBP.MB('#header', '8', BohoMsg.AUTH_HMAC),
287
- MBP.MB('#id8', this._id8),
288
- MBP.MB('#nonce', this.localNonce),
289
- MBP.MB('#hmac32', this._hmac ),
291
+ MBP.MB('#header', '8', BohoMsg.AUTH_REQ),
292
+ MBP.MB('#id8', this._id8),
293
+ MBP.MB('#nonce', this.localNonce),
294
+ MBP.MB('#hmac32', this._hmac),
290
295
  )
291
296
 
292
297
  return auth_hmac_buffer
@@ -296,31 +301,26 @@ export class Boho {
296
301
 
297
302
  /*
298
303
  step 4. for server
299
-
300
- step 4-1. check client's auth_hmac
301
- step 4-2. reply result
302
- send AUTH_ACK with another HMAC for client.
303
- or send AUTH_FAIL when fail.
304
304
  */
305
305
 
306
306
  /**
307
- * 클라이언트의 AUTH_HMAC을 검증합니다.
307
+ * Verify client's AUTH_REQ.
308
308
  * @param {Buffer|object} data
309
309
  * @returns {boolean}
310
310
  */
311
- check_auth_hmac(data) {
311
+ verify_auth_req(data) {
312
+
312
313
  let infoPack
313
314
  if (data instanceof Uint8Array) {
314
- infoPack = MBP.unpack(data, Meta.AUTH_HMAC)
315
+ infoPack = MBP.unpack(data, Meta.AUTH_REQ)
315
316
  if (!infoPack) {
316
317
  return
317
318
  }
318
319
  } else {
319
320
  infoPack = data;
320
-
321
321
  }
322
322
 
323
- this.set_salt12(this.auth_salt12)
323
+ this.set_salt12(this.auth_salt12, 'verify_auth_req 1/2')
324
324
 
325
325
  this.generateHMAC(infoPack.nonce)
326
326
  let hmac32 = this._hmac
@@ -333,37 +333,38 @@ export class Boho {
333
333
  this.remoteNonce,
334
334
  this.localNonce
335
335
  ])
336
- this.set_salt12(salt12)
336
+
337
+ this.set_salt12(salt12, 'verify_auth_req 2/2')
337
338
  this.generateHMAC(infoPack.nonce)
338
339
  let replyHMAC = this._hmac
339
340
 
340
- let auth_ack = MBP.rawPack(
341
- MBP.MB('header', '8', BohoMsg.AUTH_ACK),
342
- MBP.MB('hmac32', replyHMAC)
341
+ let auth_res = MBP.rawPack(
342
+ MBP.MB('header', '8', BohoMsg.AUTH_RES),
343
+ MBP.MB('hmac32', replyHMAC)
343
344
  )
344
345
  this.isAuthorized = true
345
- return auth_ack
346
+ return auth_res
346
347
  }
347
348
  return false
348
349
  }
349
350
 
350
351
  /**
351
- * 서버의 AUTH_ACK HMAC을 검증합니다.
352
+ * Verifies server's AUTH_RES HMAC.
352
353
  * @param {Buffer} buffer
353
354
  * @returns {boolean}
354
355
  */
355
- check_auth_ack_hmac(buffer) {
356
- let auth_ack = MBP.unpack(buffer, Meta.AUTH_ACK)
357
- if (auth_ack) {
356
+ verify_auth_res(buffer) {
357
+ let auth_res = MBP.unpack(buffer, Meta.AUTH_RES)
358
+ if (auth_res) {
358
359
  let salt12 = Buffer.concat([
359
360
  this.remoteNonce,
360
361
  this.localNonce,
361
362
  this.remoteNonce,
362
363
  ])
363
- this.set_salt12(salt12)
364
+ this.set_salt12(salt12, 'verify_auth_res')
364
365
  this.generateHMAC(this.localNonce)
365
366
  let hmac32 = this._hmac
366
- if (MBP.equal(hmac32, auth_ack.hmac32)) {
367
+ if (MBP.equal(hmac32, auth_res.hmac32)) {
367
368
  this.isAuthorized = true
368
369
  return true
369
370
  }
@@ -375,7 +376,7 @@ export class Boho {
375
376
 
376
377
  // Must AUTH first.
377
378
  /**
378
- * 인증 후 488 암호화 패킷 생성
379
+ * Generates encrypted 488 packet after authentication
379
380
  * @param {Buffer} data
380
381
  * @returns {Buffer|undefined}
381
382
  */
@@ -401,7 +402,7 @@ export class Boho {
401
402
  }
402
403
 
403
404
  /**
404
- * 인증 후 488 암호화 패킷 복호화
405
+ * Decrypts 488 packet after authentication
405
406
  * @param {Buffer} data
406
407
  * @returns {Buffer|undefined}
407
408
  */
@@ -417,7 +418,7 @@ export class Boho {
417
418
  this.localNonce
418
419
  ])
419
420
 
420
- this.set_salt12(salt12)
421
+ this.set_salt12(salt12 , 'decrypt_488')
421
422
  this.resetOTP()
422
423
 
423
424
  let xdata = pack.$OTHERS.subarray(0, pack.len)
@@ -431,7 +432,7 @@ export class Boho {
431
432
  }
432
433
 
433
434
  /**
434
- * 최대 2^32-1 바이트 데이터 암호화 패킷 생성
435
+ * Generates encrypted packet for up to 2^32-1 bytes
435
436
  * @param {Buffer} data
436
437
  * @returns {Buffer}
437
438
  */
@@ -455,7 +456,7 @@ export class Boho {
455
456
  }
456
457
 
457
458
  /**
458
- * 암호화 패킷 복호화
459
+ * Decrypts encrypted packet
459
460
  * @param {Buffer} data
460
461
  * @returns {Buffer}
461
462
  */
@@ -474,7 +475,7 @@ export class Boho {
474
475
  let pack = MBP.unpack(data, Meta.ENC_PACK)
475
476
  if (!pack) return
476
477
 
477
- this.set_salt12(pack.salt12)
478
+ this.set_salt12(pack.salt12, 'decryptPack')
478
479
  this.resetOTP()
479
480
 
480
481
  let xdata = pack.$OTHERS
@@ -492,7 +493,7 @@ export class Boho {
492
493
  }
493
494
 
494
495
  /**
495
- * E2E 암호화
496
+ * End-to-end encryption
496
497
  * @param {Buffer} data
497
498
  * @param {Buffer} key
498
499
  * @returns {Buffer}
@@ -507,7 +508,7 @@ export class Boho {
507
508
  }
508
509
 
509
510
  /**
510
- * E2E 복호화
511
+ * End-to-end decryption
511
512
  * @param {Buffer} data
512
513
  * @param {Buffer} key
513
514
  * @returns {Buffer}
package/src/constants.js CHANGED
@@ -1,76 +1,75 @@
1
+ // Copyright (c) 2024 Taeo Lee (sixgen@gmail.com)
2
+ // MIT License
3
+ //
4
+ // https://github.com/remocons/boho
5
+ //
6
+ //
7
+ //
1
8
  import MBP from "meta-buffer-pack"
2
9
  import { Buffer } from 'buffer/index.js'
3
10
 
4
11
  /**
5
- * Boho 메시지 타입 상수
12
+ * Boho message type constants
6
13
  * @typedef {Object} BohoMsg
14
+ * @property {number} SERVER_TIME_NONCE
7
15
  * @property {number} AUTH_REQ
8
- * @property {number} AUTH_NONCE
9
- * @property {number} AUTH_HMAC
10
- * @property {number} AUTH_ACK
16
+ * @property {number} AUTH_RES
11
17
  * @property {number} AUTH_FAIL
12
- * @property {number} AUTH_EXT
13
18
  * @property {number} ENC_PACK
14
19
  * @property {number} ENC_E2E
15
20
  * @property {number} ENC_488
16
21
  */
17
22
 
18
- // remocon message pack one byte header.
23
+ // One-byte header for remote control message pack.
19
24
  export let BohoMsg = {
20
- AUTH_REQ : 0xB0,
21
- AUTH_NONCE: 0xB1,
22
- AUTH_HMAC: 0xB2,
23
- AUTH_ACK: 0xB3,
24
- AUTH_FAIL: 0xB4,
25
- AUTH_EXT: 0xB5,
26
- ENC_PACK : 0xB6,
27
- ENC_E2E : 0xB7,
25
+ SERVER_TIME_NONCE : 0xB0,
26
+ AUTH_REQ: 0xB1,
27
+ AUTH_RES: 0xB2,
28
+ AUTH_FAIL: 0xB3,
29
+
30
+ ENC_PACK : 0xB6,
31
+ ENC_E2E : 0xB7,
28
32
  ENC_488 : 0xB8
29
33
  }
30
34
 
31
35
  for (let c in BohoMsg) { BohoMsg[BohoMsg[c]] = c }
32
36
 
33
37
  /**
34
- * Boho 메시지 메타 정보
38
+ * Boho message meta information
35
39
  * @typedef {Object} Meta
40
+ * @property {any} SERVER_TIME_NONCE
36
41
  * @property {any} AUTH_REQ
37
- * @property {any} AUTH_NONCE
38
- * @property {any} AUTH_HMAC
39
- * @property {any} AUTH_ACK
42
+ * @property {any} AUTH_RES
40
43
  * @property {any} ENC_PACK
41
44
  * @property {any} ENC_488
42
45
  */
43
46
 
44
47
  export const Meta = {
45
48
 
46
- AUTH_REQ: MBP.meta( // 2
47
- MBP.MB('header','8', 0),
48
- MBP.MB('reserved','8', 0)
49
- ),
50
-
51
- AUTH_NONCE: MBP.meta( // 13
49
+ SERVER_TIME_NONCE: MBP.meta( // 13
52
50
  MBP.MB('header','8', 0),
53
51
  MBP.MB('unixTime','32L', 0),
54
- MBP.MB('milTime','32L', 0 ),
52
+ MBP.MB('milTime','16L', 0 ),
53
+ MBP.MB('counter','16L', 0 ),
55
54
  MBP.MB('nonce', Buffer.alloc(4))
56
55
  ),
57
56
 
58
- AUTH_HMAC: MBP.meta( // 45
57
+ AUTH_REQ: MBP.meta( // 45
59
58
  MBP.MB('header','8', 0),
60
59
  MBP.MB('id8',Buffer.alloc(8)),
61
60
  MBP.MB('nonce', Buffer.alloc(4)),
62
61
  MBP.MB('hmac32', Buffer.alloc(32))
63
62
  ),
64
-
65
- AUTH_ACK: MBP.meta( // 33
63
+
64
+ AUTH_RES: MBP.meta( // 33
66
65
  MBP.MB('header','8', 0),
67
66
  MBP.MB('hmac32', Buffer.alloc(32))
68
67
  ),
69
-
68
+
70
69
 
71
70
  ENC_PACK: MBP.meta( //25 + payload
72
71
  MBP.MB('type','8',0),
73
- MBP.MB('len','32L',0), // pure xdata size.
72
+ MBP.MB('len','32L',0), // pure xdata size.
74
73
  MBP.MB('salt12', Buffer.alloc(12)), // sec,mil,rand
75
74
  MBP.MB('hmac',8,0)
76
75
  // MBP.MB( 'xdata', encData )
@@ -82,7 +81,7 @@ export const Meta = {
82
81
  MBP.MB('len','32L', 0 ),
83
82
  MBP.MB('otpSrc8', Buffer.alloc(8) ),
84
83
  MBP.MB('hmac8', Buffer.alloc(8) )
85
- // MBP.MB('xdata', encData )
84
+ // MBP.MB('xdata', encData )
86
85
  )
87
86
 
88
87
 
@@ -95,35 +94,32 @@ export const Meta = {
95
94
  }
96
95
 
97
96
  /**
98
- * 각 메타의 바이트 크기 정보
97
+ * Byte size information for each meta
99
98
  * @typedef {Object} MetaSize
100
99
  * @property {number} AUTH_REQ
101
- * @property {number} AUTH_NONCE
102
- * @property {number} AUTH_HMAC
103
- * @property {number} AUTH_ACK
100
+ * @property {number} SERVER_TIME_NONCE
101
+ * @property {number} AUTH_RES
104
102
  * @property {number} ENC_PACK
105
103
  * @property {number} ENC_488
106
104
  */
107
105
 
108
106
  /**
109
- * 각 메타의 바이트 크기 정보
107
+ * Byte size information for each meta
110
108
  * @type {MetaSize}
111
109
  */
112
110
  export const MetaSize = {
111
+ SERVER_TIME_NONCE: getMetaSize( Meta.SERVER_TIME_NONCE ),
113
112
  AUTH_REQ: getMetaSize( Meta.AUTH_REQ ),
114
- AUTH_NONCE: getMetaSize( Meta.AUTH_NONCE ),
115
- AUTH_HMAC: getMetaSize( Meta.AUTH_HMAC ),
116
- AUTH_ACK: getMetaSize( Meta.AUTH_ACK ),
113
+ AUTH_RES: getMetaSize( Meta.AUTH_RES ),
117
114
  ENC_PACK: getMetaSize( Meta.ENC_PACK ),
118
115
  ENC_488: getMetaSize( Meta.ENC_488 )
119
116
  }
120
117
 
121
- // console.log( 'boho MetaSize', MetaSize )
118
+ // console.log( 'boho 2.0.0 MetaSize', MetaSize )
122
119
  // boho MetaSize {
123
- // AUTH_REQ: 2,
124
- // AUTH_NONCE: 13,
125
- // AUTH_HMAC: 45,
126
- // AUTH_ACK: 33,
127
- // ENC_PACK: 25,
128
- // ENC_488: 21
129
- // }
120
+ // SERVER_TIME_NONCE: 13,
121
+ // AUTH_REQ: 45,
122
+ // AUTH_RES: 33,
123
+ // ENC_PACK: 25,
124
+ // ENC_488: 21
125
+ // }