sm-crypto-v2 1.12.0 → 1.13.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/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [1.13.0](https://github.com/Cubelrti/sm-crypto-v2/compare/v1.12.0...v1.13.0) (2025-07-15)
6
+
7
+
8
+ ### Features
9
+
10
+ * downgrade to es2020 target ([3058285](https://github.com/Cubelrti/sm-crypto-v2/commit/305828570dc15fd686d04f3d85c37b978e8893c8))
11
+
5
12
  ## [1.12.0](https://github.com/Cubelrti/sm-crypto-v2/compare/v1.11.0...v1.12.0) (2025-06-05)
6
13
 
7
14
 
package/dist/index.js CHANGED
@@ -5,6 +5,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
9
  var __export = (target, all) => {
9
10
  for (var name in all)
10
11
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -26,6 +27,10 @@ var __toESM = (mod2, isNodeMode, target) => (target = mod2 != null ? __create(__
26
27
  mod2
27
28
  ));
28
29
  var __toCommonJS = (mod2) => __copyProps(__defProp({}, "__esModule", { value: true }), mod2);
30
+ var __publicField = (obj, key, value) => {
31
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
32
+ return value;
33
+ };
29
34
 
30
35
  // src/index.ts
31
36
  var src_exports = {};
@@ -145,11 +150,11 @@ var DEROctetString = class extends ASN1Object {
145
150
  constructor(s) {
146
151
  super();
147
152
  this.s = s;
153
+ __publicField(this, "hV", "");
148
154
  this.t = "04";
149
155
  if (s)
150
156
  this.v = s.toLowerCase();
151
157
  }
152
- hV = "";
153
158
  getValue() {
154
159
  return this.v;
155
160
  }
@@ -158,8 +163,8 @@ var DERSequence = class extends ASN1Object {
158
163
  constructor(asn1Array) {
159
164
  super();
160
165
  this.asn1Array = asn1Array;
166
+ __publicField(this, "t", "30");
161
167
  }
162
- t = "30";
163
168
  getValue() {
164
169
  this.v = this.asn1Array.map((asn1Object) => asn1Object.getEncodedHex()).join("");
165
170
  return this.v;
@@ -407,16 +412,16 @@ var SHA2 = class extends Hash {
407
412
  this.outputLen = outputLen;
408
413
  this.padOffset = padOffset;
409
414
  this.isLE = isLE2;
415
+ // For partial updates less than block size
416
+ __publicField(this, "buffer");
417
+ __publicField(this, "view");
418
+ __publicField(this, "finished", false);
419
+ __publicField(this, "length", 0);
420
+ __publicField(this, "pos", 0);
421
+ __publicField(this, "destroyed", false);
410
422
  this.buffer = new Uint8Array(blockLen);
411
423
  this.view = createView(this.buffer);
412
424
  }
413
- // For partial updates less than block size
414
- buffer;
415
- view;
416
- finished = false;
417
- length = 0;
418
- pos = 0;
419
- destroyed = false;
420
425
  update(data) {
421
426
  const { view, buffer, blockLen } = this;
422
427
  data = toBytes(data);
@@ -474,7 +479,7 @@ var SHA2 = class extends Hash {
474
479
  return res;
475
480
  }
476
481
  _cloneInto(to) {
477
- to ||= new this.constructor();
482
+ to || (to = new this.constructor());
478
483
  to.set(...this.get());
479
484
  const { blockLen, buffer, length, finished, destroyed, pos } = this;
480
485
  to.length = length;
@@ -492,18 +497,18 @@ var SM3_M = new Uint32Array(64);
492
497
  var T1 = 2043430169;
493
498
  var T2 = 2055708042;
494
499
  var SM3 = class extends SHA2 {
495
- // We cannot use array here since array allows indexing by variable
496
- // which means optimizer/compiler cannot use registers.
497
- A = IV[0] | 0;
498
- B = IV[1] | 0;
499
- C = IV[2] | 0;
500
- D = IV[3] | 0;
501
- E = IV[4] | 0;
502
- F = IV[5] | 0;
503
- G = IV[6] | 0;
504
- H = IV[7] | 0;
505
500
  constructor() {
506
501
  super(64, 32, 8, false);
502
+ // We cannot use array here since array allows indexing by variable
503
+ // which means optimizer/compiler cannot use registers.
504
+ __publicField(this, "A", IV[0] | 0);
505
+ __publicField(this, "B", IV[1] | 0);
506
+ __publicField(this, "C", IV[2] | 0);
507
+ __publicField(this, "D", IV[3] | 0);
508
+ __publicField(this, "E", IV[4] | 0);
509
+ __publicField(this, "F", IV[5] | 0);
510
+ __publicField(this, "G", IV[6] | 0);
511
+ __publicField(this, "H", IV[7] | 0);
507
512
  }
508
513
  get() {
509
514
  const { A, B, C, D, E, F, G, H } = this;
@@ -568,14 +573,14 @@ var sm3 = wrapConstructor(() => new SM3());
568
573
 
569
574
  // src/sm2/hmac.ts
570
575
  var HMAC = class extends Hash {
571
- oHash;
572
- iHash;
573
- blockLen;
574
- outputLen;
575
- finished = false;
576
- destroyed = false;
577
576
  constructor(hash, _key) {
578
577
  super();
578
+ __publicField(this, "oHash");
579
+ __publicField(this, "iHash");
580
+ __publicField(this, "blockLen");
581
+ __publicField(this, "outputLen");
582
+ __publicField(this, "finished", false);
583
+ __publicField(this, "destroyed", false);
579
584
  const key = toBytes(_key);
580
585
  this.iHash = hash.create();
581
586
  if (typeof this.iHash.update !== "function")
@@ -611,7 +616,7 @@ var HMAC = class extends Hash {
611
616
  return out;
612
617
  }
613
618
  _cloneInto(to) {
614
- to ||= Object.create(Object.getPrototypeOf(this), {});
619
+ to || (to = Object.create(Object.getPrototypeOf(this), {}));
615
620
  const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this;
616
621
  to = to;
617
622
  to.finished = finished;
package/dist/index.mjs CHANGED
@@ -1,8 +1,13 @@
1
1
  var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2
3
  var __export = (target, all) => {
3
4
  for (var name in all)
4
5
  __defProp(target, name, { get: all[name], enumerable: true });
5
6
  };
7
+ var __publicField = (obj, key, value) => {
8
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
9
+ return value;
10
+ };
6
11
 
7
12
  // src/sm2/index.ts
8
13
  var sm2_exports = {};
@@ -112,11 +117,11 @@ var DEROctetString = class extends ASN1Object {
112
117
  constructor(s) {
113
118
  super();
114
119
  this.s = s;
120
+ __publicField(this, "hV", "");
115
121
  this.t = "04";
116
122
  if (s)
117
123
  this.v = s.toLowerCase();
118
124
  }
119
- hV = "";
120
125
  getValue() {
121
126
  return this.v;
122
127
  }
@@ -125,8 +130,8 @@ var DERSequence = class extends ASN1Object {
125
130
  constructor(asn1Array) {
126
131
  super();
127
132
  this.asn1Array = asn1Array;
133
+ __publicField(this, "t", "30");
128
134
  }
129
- t = "30";
130
135
  getValue() {
131
136
  this.v = this.asn1Array.map((asn1Object) => asn1Object.getEncodedHex()).join("");
132
137
  return this.v;
@@ -374,16 +379,16 @@ var SHA2 = class extends Hash {
374
379
  this.outputLen = outputLen;
375
380
  this.padOffset = padOffset;
376
381
  this.isLE = isLE2;
382
+ // For partial updates less than block size
383
+ __publicField(this, "buffer");
384
+ __publicField(this, "view");
385
+ __publicField(this, "finished", false);
386
+ __publicField(this, "length", 0);
387
+ __publicField(this, "pos", 0);
388
+ __publicField(this, "destroyed", false);
377
389
  this.buffer = new Uint8Array(blockLen);
378
390
  this.view = createView(this.buffer);
379
391
  }
380
- // For partial updates less than block size
381
- buffer;
382
- view;
383
- finished = false;
384
- length = 0;
385
- pos = 0;
386
- destroyed = false;
387
392
  update(data) {
388
393
  const { view, buffer, blockLen } = this;
389
394
  data = toBytes(data);
@@ -441,7 +446,7 @@ var SHA2 = class extends Hash {
441
446
  return res;
442
447
  }
443
448
  _cloneInto(to) {
444
- to ||= new this.constructor();
449
+ to || (to = new this.constructor());
445
450
  to.set(...this.get());
446
451
  const { blockLen, buffer, length, finished, destroyed, pos } = this;
447
452
  to.length = length;
@@ -459,18 +464,18 @@ var SM3_M = new Uint32Array(64);
459
464
  var T1 = 2043430169;
460
465
  var T2 = 2055708042;
461
466
  var SM3 = class extends SHA2 {
462
- // We cannot use array here since array allows indexing by variable
463
- // which means optimizer/compiler cannot use registers.
464
- A = IV[0] | 0;
465
- B = IV[1] | 0;
466
- C = IV[2] | 0;
467
- D = IV[3] | 0;
468
- E = IV[4] | 0;
469
- F = IV[5] | 0;
470
- G = IV[6] | 0;
471
- H = IV[7] | 0;
472
467
  constructor() {
473
468
  super(64, 32, 8, false);
469
+ // We cannot use array here since array allows indexing by variable
470
+ // which means optimizer/compiler cannot use registers.
471
+ __publicField(this, "A", IV[0] | 0);
472
+ __publicField(this, "B", IV[1] | 0);
473
+ __publicField(this, "C", IV[2] | 0);
474
+ __publicField(this, "D", IV[3] | 0);
475
+ __publicField(this, "E", IV[4] | 0);
476
+ __publicField(this, "F", IV[5] | 0);
477
+ __publicField(this, "G", IV[6] | 0);
478
+ __publicField(this, "H", IV[7] | 0);
474
479
  }
475
480
  get() {
476
481
  const { A, B, C, D, E, F, G, H } = this;
@@ -535,14 +540,14 @@ var sm3 = wrapConstructor(() => new SM3());
535
540
 
536
541
  // src/sm2/hmac.ts
537
542
  var HMAC = class extends Hash {
538
- oHash;
539
- iHash;
540
- blockLen;
541
- outputLen;
542
- finished = false;
543
- destroyed = false;
544
543
  constructor(hash, _key) {
545
544
  super();
545
+ __publicField(this, "oHash");
546
+ __publicField(this, "iHash");
547
+ __publicField(this, "blockLen");
548
+ __publicField(this, "outputLen");
549
+ __publicField(this, "finished", false);
550
+ __publicField(this, "destroyed", false);
546
551
  const key = toBytes(_key);
547
552
  this.iHash = hash.create();
548
553
  if (typeof this.iHash.update !== "function")
@@ -578,7 +583,7 @@ var HMAC = class extends Hash {
578
583
  return out;
579
584
  }
580
585
  _cloneInto(to) {
581
- to ||= Object.create(Object.getPrototypeOf(this), {});
586
+ to || (to = Object.create(Object.getPrototypeOf(this), {}));
582
587
  const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this;
583
588
  to = to;
584
589
  to.finished = finished;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sm-crypto-v2",
3
- "version": "1.12.0",
3
+ "version": "1.13.0",
4
4
  "description": "sm-crypto-v2",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",