hyoo_sync_client 0.0.241 → 0.0.243

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/web.js CHANGED
@@ -400,6 +400,92 @@ var $;
400
400
  ;
401
401
  "use strict";
402
402
  var $;
403
+ (function ($) {
404
+ function $mol_base64_encode(src) {
405
+ throw new Error('Not implemented');
406
+ }
407
+ $.$mol_base64_encode = $mol_base64_encode;
408
+ })($ || ($ = {}));
409
+ //mol/base64/encode/encode.ts
410
+ ;
411
+ "use strict";
412
+ var $;
413
+ (function ($) {
414
+ })($ || ($ = {}));
415
+ //mol/dom/context/context.ts
416
+ ;
417
+ "use strict";
418
+ var $;
419
+ (function ($) {
420
+ $.$mol_dom_context = self;
421
+ })($ || ($ = {}));
422
+ //mol/dom/context/context.web.ts
423
+ ;
424
+ "use strict";
425
+ var $;
426
+ (function ($) {
427
+ function binary_string(bytes) {
428
+ let binary = '';
429
+ if (typeof bytes !== 'string') {
430
+ for (const byte of bytes)
431
+ binary += String.fromCharCode(byte);
432
+ }
433
+ else {
434
+ binary = unescape(encodeURIComponent(bytes));
435
+ }
436
+ return binary;
437
+ }
438
+ function $mol_base64_encode_web(str) {
439
+ return $mol_dom_context.btoa(binary_string(str));
440
+ }
441
+ $.$mol_base64_encode_web = $mol_base64_encode_web;
442
+ $.$mol_base64_encode = $mol_base64_encode_web;
443
+ })($ || ($ = {}));
444
+ //mol/base64/encode/encode.web.ts
445
+ ;
446
+ "use strict";
447
+ var $;
448
+ (function ($) {
449
+ function $mol_base64_encode_safe(buffer) {
450
+ return $mol_base64_encode(buffer).replace(/\+/g, '-').replace(/\//g, '_').replace(/=/, '');
451
+ }
452
+ $.$mol_base64_encode_safe = $mol_base64_encode_safe;
453
+ })($ || ($ = {}));
454
+ //mol/base64/encode/safe/safe.ts
455
+ ;
456
+ "use strict";
457
+ var $;
458
+ (function ($) {
459
+ function $mol_base64_decode(base64) {
460
+ throw new Error('Not implemented');
461
+ }
462
+ $.$mol_base64_decode = $mol_base64_decode;
463
+ })($ || ($ = {}));
464
+ //mol/base64/decode/decode.ts
465
+ ;
466
+ "use strict";
467
+ var $;
468
+ (function ($) {
469
+ function $mol_base64_decode_web(base64Str) {
470
+ return new Uint8Array($mol_dom_context.atob(base64Str).split('').map(c => c.charCodeAt(0)));
471
+ }
472
+ $.$mol_base64_decode_web = $mol_base64_decode_web;
473
+ $.$mol_base64_decode = $mol_base64_decode_web;
474
+ })($ || ($ = {}));
475
+ //mol/base64/decode/decode.web.ts
476
+ ;
477
+ "use strict";
478
+ var $;
479
+ (function ($) {
480
+ function $mol_base64_decode_safe(str) {
481
+ return $mol_base64_decode(str.replace(/-/g, '+').replace(/_/g, '/'));
482
+ }
483
+ $.$mol_base64_decode_safe = $mol_base64_decode_safe;
484
+ })($ || ($ = {}));
485
+ //mol/base64/decode/safe/safe.ts
486
+ ;
487
+ "use strict";
488
+ var $;
403
489
  (function ($) {
404
490
  const algorithm = {
405
491
  name: 'ECDSA',
@@ -416,12 +502,17 @@ var $;
416
502
  $.$mol_crypto_auditor_pair = $mol_crypto_auditor_pair;
417
503
  class $mol_crypto_auditor_public extends Object {
418
504
  native;
419
- static size = 86;
505
+ static size_str = 86;
506
+ static size_bin = 64;
420
507
  constructor(native) {
421
508
  super();
422
509
  this.native = native;
423
510
  }
424
511
  static async from(serial) {
512
+ if (typeof serial !== 'string') {
513
+ serial = $mol_base64_encode_safe(serial.subarray(0, 32))
514
+ + $mol_base64_encode_safe(serial.subarray(32, 64));
515
+ }
425
516
  return new this(await $mol_crypto_native.subtle.importKey('jwk', {
426
517
  crv: "P-256",
427
518
  ext: true,
@@ -435,6 +526,13 @@ var $;
435
526
  const { x, y } = await $mol_crypto_native.subtle.exportKey('jwk', this.native);
436
527
  return x + y;
437
528
  }
529
+ async toArray() {
530
+ const { x, y, d } = await $mol_crypto_native.subtle.exportKey('jwk', this.native);
531
+ return new Uint8Array([
532
+ ...$mol_base64_decode_safe(x),
533
+ ...$mol_base64_decode_safe(y),
534
+ ]);
535
+ }
438
536
  async verify(data, sign) {
439
537
  return await $mol_crypto_native.subtle.verify(algorithm, this.native, sign, data);
440
538
  }
@@ -442,12 +540,18 @@ var $;
442
540
  $.$mol_crypto_auditor_public = $mol_crypto_auditor_public;
443
541
  class $mol_crypto_auditor_private extends Object {
444
542
  native;
445
- static size = 129;
543
+ static size_str = 129;
544
+ static size_bin = 96;
446
545
  constructor(native) {
447
546
  super();
448
547
  this.native = native;
449
548
  }
450
549
  static async from(serial) {
550
+ if (typeof serial !== 'string') {
551
+ serial = $mol_base64_encode_safe(serial.subarray(0, 32))
552
+ + $mol_base64_encode_safe(serial.subarray(32, 64))
553
+ + $mol_base64_encode_safe(serial.subarray(64));
554
+ }
451
555
  return new this(await $mol_crypto_native.subtle.importKey('jwk', {
452
556
  crv: "P-256",
453
557
  ext: true,
@@ -462,6 +566,14 @@ var $;
462
566
  const { x, y, d } = await $mol_crypto_native.subtle.exportKey('jwk', this.native);
463
567
  return x + y + d;
464
568
  }
569
+ async toArray() {
570
+ const { x, y, d } = await $mol_crypto_native.subtle.exportKey('jwk', this.native);
571
+ return new Uint8Array([
572
+ ...$mol_base64_decode_safe(x),
573
+ ...$mol_base64_decode_safe(y),
574
+ ...$mol_base64_decode_safe(d),
575
+ ]);
576
+ }
465
577
  async sign(data) {
466
578
  return await $mol_crypto_native.subtle.sign(algorithm, this.native, data);
467
579
  }
@@ -586,7 +698,6 @@ var $;
586
698
  $.$mol_dev_format_element = $mol_dev_format_element;
587
699
  function $mol_dev_format_span(style, ...content) {
588
700
  return $mol_dev_format_element('span', {
589
- 'vertical-align': '8%',
590
701
  ...style,
591
702
  }, ...content);
592
703
  }
@@ -1526,6 +1637,8 @@ var $;
1526
1637
  return true;
1527
1638
  }
1528
1639
  function compare_buffer(left, right) {
1640
+ if (left instanceof DataView)
1641
+ return compare_buffer(new Uint8Array(left.buffer, left.byteOffset, left.byteLength), new Uint8Array(right.buffer, left.byteOffset, left.byteLength));
1529
1642
  const len = left.byteLength;
1530
1643
  if (len !== right.byteLength)
1531
1644
  return false;
@@ -1941,19 +2054,6 @@ var $;
1941
2054
  ;
1942
2055
  "use strict";
1943
2056
  var $;
1944
- (function ($) {
1945
- })($ || ($ = {}));
1946
- //mol/dom/context/context.ts
1947
- ;
1948
- "use strict";
1949
- var $;
1950
- (function ($) {
1951
- $.$mol_dom_context = self;
1952
- })($ || ($ = {}));
1953
- //mol/dom/context/context.web.ts
1954
- ;
1955
- "use strict";
1956
- var $;
1957
2057
  (function ($) {
1958
2058
  function $mol_dom_render_children(el, childNodes) {
1959
2059
  const node_set = new Set(childNodes);