@bcts/components 1.0.0-alpha.22 → 1.0.0-alpha.23

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.
@@ -1,9 +1,8 @@
1
- const require_index = require('./index.cjs');
1
+ require("./index.cjs");
2
2
  let _bcts_dcbor = require("@bcts/dcbor");
3
3
  let _bcts_tags = require("@bcts/tags");
4
4
  let _bcts_crypto = require("@bcts/crypto");
5
5
  let _bcts_uniform_resources = require("@bcts/uniform-resources");
6
-
7
6
  //#region src/error.ts
8
7
  /**
9
8
  * Copyright © 2023-2026 Blockchain Commons, LLC
@@ -41,42 +40,42 @@ let _bcts_uniform_resources = require("@bcts/uniform-resources");
41
40
  * This enum allows programmatic checking of error types, matching the
42
41
  * Rust enum variants exactly.
43
42
  */
44
- let ErrorKind = /* @__PURE__ */ function(ErrorKind$1) {
43
+ let ErrorKind = /* @__PURE__ */ function(ErrorKind) {
45
44
  /** Invalid data size for the specified type */
46
- ErrorKind$1["InvalidSize"] = "InvalidSize";
45
+ ErrorKind["InvalidSize"] = "InvalidSize";
47
46
  /** Invalid data format or content */
48
- ErrorKind$1["InvalidData"] = "InvalidData";
47
+ ErrorKind["InvalidData"] = "InvalidData";
49
48
  /** Data too short for the expected type */
50
- ErrorKind$1["DataTooShort"] = "DataTooShort";
49
+ ErrorKind["DataTooShort"] = "DataTooShort";
51
50
  /** Cryptographic operation failed */
52
- ErrorKind$1["Crypto"] = "Crypto";
51
+ ErrorKind["Crypto"] = "Crypto";
53
52
  /** CBOR encoding or decoding error */
54
- ErrorKind$1["Cbor"] = "Cbor";
53
+ ErrorKind["Cbor"] = "Cbor";
55
54
  /** SSKR error */
56
- ErrorKind$1["Sskr"] = "Sskr";
55
+ ErrorKind["Sskr"] = "Sskr";
57
56
  /** SSH key operation failed */
58
- ErrorKind$1["Ssh"] = "Ssh";
57
+ ErrorKind["Ssh"] = "Ssh";
59
58
  /** URI parsing failed */
60
- ErrorKind$1["Uri"] = "Uri";
59
+ ErrorKind["Uri"] = "Uri";
61
60
  /** Data compression/decompression failed */
62
- ErrorKind$1["Compression"] = "Compression";
61
+ ErrorKind["Compression"] = "Compression";
63
62
  /** Post-quantum cryptography library error */
64
- ErrorKind$1["PostQuantum"] = "PostQuantum";
63
+ ErrorKind["PostQuantum"] = "PostQuantum";
65
64
  /** Signature level mismatch */
66
- ErrorKind$1["LevelMismatch"] = "LevelMismatch";
65
+ ErrorKind["LevelMismatch"] = "LevelMismatch";
67
66
  /** SSH agent operation failed */
68
- ErrorKind$1["SshAgent"] = "SshAgent";
67
+ ErrorKind["SshAgent"] = "SshAgent";
69
68
  /** Hex decoding error */
70
- ErrorKind$1["Hex"] = "Hex";
69
+ ErrorKind["Hex"] = "Hex";
71
70
  /** UTF-8 conversion error */
72
- ErrorKind$1["Utf8"] = "Utf8";
71
+ ErrorKind["Utf8"] = "Utf8";
73
72
  /** Environment variable error */
74
- ErrorKind$1["Env"] = "Env";
73
+ ErrorKind["Env"] = "Env";
75
74
  /** SSH agent client error */
76
- ErrorKind$1["SshAgentClient"] = "SshAgentClient";
75
+ ErrorKind["SshAgentClient"] = "SshAgentClient";
77
76
  /** General error with custom message */
78
- ErrorKind$1["General"] = "General";
79
- return ErrorKind$1;
77
+ ErrorKind["General"] = "General";
78
+ return ErrorKind;
80
79
  }({});
81
80
  /**
82
81
  * Error type for cryptographic and component operations.
@@ -122,7 +121,7 @@ var CryptoError = class CryptoError extends Error {
122
121
  */
123
122
  static invalidSizeForType(dataType, expected, actual) {
124
123
  return new CryptoError(`invalid ${dataType} size: expected ${expected}, got ${actual}`, {
125
- kind: ErrorKind.InvalidSize,
124
+ kind: "InvalidSize",
126
125
  dataType,
127
126
  expected,
128
127
  actual
@@ -146,7 +145,7 @@ var CryptoError = class CryptoError extends Error {
146
145
  */
147
146
  static invalidDataForType(dataType, reason) {
148
147
  return new CryptoError(`invalid ${dataType}: ${reason}`, {
149
- kind: ErrorKind.InvalidData,
148
+ kind: "InvalidData",
150
149
  dataType,
151
150
  reason
152
151
  });
@@ -162,7 +161,7 @@ var CryptoError = class CryptoError extends Error {
162
161
  */
163
162
  static dataTooShort(dataType, minimum, actual) {
164
163
  return new CryptoError(`data too short: ${dataType} expected at least ${minimum}, got ${actual}`, {
165
- kind: ErrorKind.DataTooShort,
164
+ kind: "DataTooShort",
166
165
  dataType,
167
166
  minimum,
168
167
  actual
@@ -203,7 +202,7 @@ var CryptoError = class CryptoError extends Error {
203
202
  */
204
203
  static crypto(message) {
205
204
  return new CryptoError(`cryptographic operation failed: ${message}`, {
206
- kind: ErrorKind.Crypto,
205
+ kind: "Crypto",
207
206
  message
208
207
  });
209
208
  }
@@ -216,7 +215,7 @@ var CryptoError = class CryptoError extends Error {
216
215
  */
217
216
  static postQuantum(message) {
218
217
  return new CryptoError(`post-quantum cryptography error: ${message}`, {
219
- kind: ErrorKind.PostQuantum,
218
+ kind: "PostQuantum",
220
219
  message
221
220
  });
222
221
  }
@@ -226,7 +225,7 @@ var CryptoError = class CryptoError extends Error {
226
225
  * Rust equivalent: `Error::LevelMismatch`
227
226
  */
228
227
  static levelMismatch() {
229
- return new CryptoError("signature level does not match key level", { kind: ErrorKind.LevelMismatch });
228
+ return new CryptoError("signature level does not match key level", { kind: "LevelMismatch" });
230
229
  }
231
230
  /**
232
231
  * Create a CBOR error.
@@ -237,7 +236,7 @@ var CryptoError = class CryptoError extends Error {
237
236
  */
238
237
  static cbor(message) {
239
238
  return new CryptoError(`CBOR error: ${message}`, {
240
- kind: ErrorKind.Cbor,
239
+ kind: "Cbor",
241
240
  message
242
241
  });
243
242
  }
@@ -250,7 +249,7 @@ var CryptoError = class CryptoError extends Error {
250
249
  */
251
250
  static hex(message) {
252
251
  return new CryptoError(`hex decoding error: ${message}`, {
253
- kind: ErrorKind.Hex,
252
+ kind: "Hex",
254
253
  message
255
254
  });
256
255
  }
@@ -263,7 +262,7 @@ var CryptoError = class CryptoError extends Error {
263
262
  */
264
263
  static utf8(message) {
265
264
  return new CryptoError(`UTF-8 conversion error: ${message}`, {
266
- kind: ErrorKind.Utf8,
265
+ kind: "Utf8",
267
266
  message
268
267
  });
269
268
  }
@@ -276,7 +275,7 @@ var CryptoError = class CryptoError extends Error {
276
275
  */
277
276
  static compression(message) {
278
277
  return new CryptoError(`compression error: ${message}`, {
279
- kind: ErrorKind.Compression,
278
+ kind: "Compression",
280
279
  message
281
280
  });
282
281
  }
@@ -289,7 +288,7 @@ var CryptoError = class CryptoError extends Error {
289
288
  */
290
289
  static uri(message) {
291
290
  return new CryptoError(`invalid URI: ${message}`, {
292
- kind: ErrorKind.Uri,
291
+ kind: "Uri",
293
292
  message
294
293
  });
295
294
  }
@@ -302,7 +301,7 @@ var CryptoError = class CryptoError extends Error {
302
301
  */
303
302
  static sskr(message) {
304
303
  return new CryptoError(`SSKR error: ${message}`, {
305
- kind: ErrorKind.Sskr,
304
+ kind: "Sskr",
306
305
  message
307
306
  });
308
307
  }
@@ -315,7 +314,7 @@ var CryptoError = class CryptoError extends Error {
315
314
  */
316
315
  static ssh(message) {
317
316
  return new CryptoError(`SSH operation failed: ${message}`, {
318
- kind: ErrorKind.Ssh,
317
+ kind: "Ssh",
319
318
  message
320
319
  });
321
320
  }
@@ -328,7 +327,7 @@ var CryptoError = class CryptoError extends Error {
328
327
  */
329
328
  static sshAgent(message) {
330
329
  return new CryptoError(`SSH agent error: ${message}`, {
331
- kind: ErrorKind.SshAgent,
330
+ kind: "SshAgent",
332
331
  message
333
332
  });
334
333
  }
@@ -341,7 +340,7 @@ var CryptoError = class CryptoError extends Error {
341
340
  */
342
341
  static sshAgentClient(message) {
343
342
  return new CryptoError(`SSH agent client error: ${message}`, {
344
- kind: ErrorKind.SshAgentClient,
343
+ kind: "SshAgentClient",
345
344
  message
346
345
  });
347
346
  }
@@ -354,7 +353,7 @@ var CryptoError = class CryptoError extends Error {
354
353
  */
355
354
  static env(message) {
356
355
  return new CryptoError(`environment variable error: ${message}`, {
357
- kind: ErrorKind.Env,
356
+ kind: "Env",
358
357
  message
359
358
  });
360
359
  }
@@ -367,7 +366,7 @@ var CryptoError = class CryptoError extends Error {
367
366
  */
368
367
  static general(message) {
369
368
  return new CryptoError(message, {
370
- kind: ErrorKind.General,
369
+ kind: "General",
371
370
  message
372
371
  });
373
372
  }
@@ -383,103 +382,103 @@ var CryptoError = class CryptoError extends Error {
383
382
  * Check if this is an InvalidSize error.
384
383
  */
385
384
  isInvalidSize() {
386
- return this.errorKind === ErrorKind.InvalidSize;
385
+ return this.errorKind === "InvalidSize";
387
386
  }
388
387
  /**
389
388
  * Check if this is an InvalidData error.
390
389
  */
391
390
  isInvalidData() {
392
- return this.errorKind === ErrorKind.InvalidData;
391
+ return this.errorKind === "InvalidData";
393
392
  }
394
393
  /**
395
394
  * Check if this is a DataTooShort error.
396
395
  */
397
396
  isDataTooShort() {
398
- return this.errorKind === ErrorKind.DataTooShort;
397
+ return this.errorKind === "DataTooShort";
399
398
  }
400
399
  /**
401
400
  * Check if this is a Crypto error.
402
401
  */
403
402
  isCrypto() {
404
- return this.errorKind === ErrorKind.Crypto;
403
+ return this.errorKind === "Crypto";
405
404
  }
406
405
  /**
407
406
  * Check if this is a Cbor error.
408
407
  */
409
408
  isCbor() {
410
- return this.errorKind === ErrorKind.Cbor;
409
+ return this.errorKind === "Cbor";
411
410
  }
412
411
  /**
413
412
  * Check if this is an Sskr error.
414
413
  */
415
414
  isSskr() {
416
- return this.errorKind === ErrorKind.Sskr;
415
+ return this.errorKind === "Sskr";
417
416
  }
418
417
  /**
419
418
  * Check if this is an Ssh error.
420
419
  */
421
420
  isSsh() {
422
- return this.errorKind === ErrorKind.Ssh;
421
+ return this.errorKind === "Ssh";
423
422
  }
424
423
  /**
425
424
  * Check if this is a Uri error.
426
425
  */
427
426
  isUri() {
428
- return this.errorKind === ErrorKind.Uri;
427
+ return this.errorKind === "Uri";
429
428
  }
430
429
  /**
431
430
  * Check if this is a Compression error.
432
431
  */
433
432
  isCompression() {
434
- return this.errorKind === ErrorKind.Compression;
433
+ return this.errorKind === "Compression";
435
434
  }
436
435
  /**
437
436
  * Check if this is a PostQuantum error.
438
437
  */
439
438
  isPostQuantum() {
440
- return this.errorKind === ErrorKind.PostQuantum;
439
+ return this.errorKind === "PostQuantum";
441
440
  }
442
441
  /**
443
442
  * Check if this is a LevelMismatch error.
444
443
  */
445
444
  isLevelMismatch() {
446
- return this.errorKind === ErrorKind.LevelMismatch;
445
+ return this.errorKind === "LevelMismatch";
447
446
  }
448
447
  /**
449
448
  * Check if this is an SshAgent error.
450
449
  */
451
450
  isSshAgent() {
452
- return this.errorKind === ErrorKind.SshAgent;
451
+ return this.errorKind === "SshAgent";
453
452
  }
454
453
  /**
455
454
  * Check if this is a Hex error.
456
455
  */
457
456
  isHex() {
458
- return this.errorKind === ErrorKind.Hex;
457
+ return this.errorKind === "Hex";
459
458
  }
460
459
  /**
461
460
  * Check if this is a Utf8 error.
462
461
  */
463
462
  isUtf8() {
464
- return this.errorKind === ErrorKind.Utf8;
463
+ return this.errorKind === "Utf8";
465
464
  }
466
465
  /**
467
466
  * Check if this is an Env error.
468
467
  */
469
468
  isEnv() {
470
- return this.errorKind === ErrorKind.Env;
469
+ return this.errorKind === "Env";
471
470
  }
472
471
  /**
473
472
  * Check if this is an SshAgentClient error.
474
473
  */
475
474
  isSshAgentClient() {
476
- return this.errorKind === ErrorKind.SshAgentClient;
475
+ return this.errorKind === "SshAgentClient";
477
476
  }
478
477
  /**
479
478
  * Check if this is a General error.
480
479
  */
481
480
  isGeneral() {
482
- return this.errorKind === ErrorKind.General;
481
+ return this.errorKind === "General";
483
482
  }
484
483
  };
485
484
  /**
@@ -500,7 +499,6 @@ function isCryptoError(result) {
500
499
  function isCryptoErrorKind(result, kind) {
501
500
  return isCryptoError(result) && result.errorKind === kind;
502
501
  }
503
-
504
502
  //#endregion
505
503
  //#region src/utils.ts
506
504
  /**
@@ -624,7 +622,6 @@ function bytesEqual(a, b) {
624
622
  for (let i = 0; i < a.length; i++) result |= a[i] ^ b[i];
625
623
  return result === 0;
626
624
  }
627
-
628
625
  //#endregion
629
626
  //#region src/digest.ts
630
627
  /**
@@ -928,72 +925,72 @@ var Digest = class Digest {
928
925
  return digest.validate(image);
929
926
  }
930
927
  };
931
-
932
928
  //#endregion
933
- Object.defineProperty(exports, 'CryptoError', {
934
- enumerable: true,
935
- get: function () {
936
- return CryptoError;
937
- }
929
+ Object.defineProperty(exports, "CryptoError", {
930
+ enumerable: true,
931
+ get: function() {
932
+ return CryptoError;
933
+ }
938
934
  });
939
- Object.defineProperty(exports, 'Digest', {
940
- enumerable: true,
941
- get: function () {
942
- return Digest;
943
- }
935
+ Object.defineProperty(exports, "Digest", {
936
+ enumerable: true,
937
+ get: function() {
938
+ return Digest;
939
+ }
944
940
  });
945
- Object.defineProperty(exports, 'ErrorKind', {
946
- enumerable: true,
947
- get: function () {
948
- return ErrorKind;
949
- }
941
+ Object.defineProperty(exports, "ErrorKind", {
942
+ enumerable: true,
943
+ get: function() {
944
+ return ErrorKind;
945
+ }
950
946
  });
951
- Object.defineProperty(exports, 'bytesEqual', {
952
- enumerable: true,
953
- get: function () {
954
- return bytesEqual;
955
- }
947
+ Object.defineProperty(exports, "bytesEqual", {
948
+ enumerable: true,
949
+ get: function() {
950
+ return bytesEqual;
951
+ }
956
952
  });
957
- Object.defineProperty(exports, 'bytesToHex', {
958
- enumerable: true,
959
- get: function () {
960
- return bytesToHex;
961
- }
953
+ Object.defineProperty(exports, "bytesToHex", {
954
+ enumerable: true,
955
+ get: function() {
956
+ return bytesToHex;
957
+ }
962
958
  });
963
- Object.defineProperty(exports, 'fromBase64', {
964
- enumerable: true,
965
- get: function () {
966
- return fromBase64;
967
- }
959
+ Object.defineProperty(exports, "fromBase64", {
960
+ enumerable: true,
961
+ get: function() {
962
+ return fromBase64;
963
+ }
968
964
  });
969
- Object.defineProperty(exports, 'hexToBytes', {
970
- enumerable: true,
971
- get: function () {
972
- return hexToBytes;
973
- }
965
+ Object.defineProperty(exports, "hexToBytes", {
966
+ enumerable: true,
967
+ get: function() {
968
+ return hexToBytes;
969
+ }
974
970
  });
975
- Object.defineProperty(exports, 'isCryptoError', {
976
- enumerable: true,
977
- get: function () {
978
- return isCryptoError;
979
- }
971
+ Object.defineProperty(exports, "isCryptoError", {
972
+ enumerable: true,
973
+ get: function() {
974
+ return isCryptoError;
975
+ }
980
976
  });
981
- Object.defineProperty(exports, 'isCryptoErrorKind', {
982
- enumerable: true,
983
- get: function () {
984
- return isCryptoErrorKind;
985
- }
977
+ Object.defineProperty(exports, "isCryptoErrorKind", {
978
+ enumerable: true,
979
+ get: function() {
980
+ return isCryptoErrorKind;
981
+ }
986
982
  });
987
- Object.defineProperty(exports, 'isError', {
988
- enumerable: true,
989
- get: function () {
990
- return isError;
991
- }
983
+ Object.defineProperty(exports, "isError", {
984
+ enumerable: true,
985
+ get: function() {
986
+ return isError;
987
+ }
992
988
  });
993
- Object.defineProperty(exports, 'toBase64', {
994
- enumerable: true,
995
- get: function () {
996
- return toBase64;
997
- }
989
+ Object.defineProperty(exports, "toBase64", {
990
+ enumerable: true,
991
+ get: function() {
992
+ return toBase64;
993
+ }
998
994
  });
999
- //# sourceMappingURL=digest-DWA5qjpo.cjs.map
995
+
996
+ //# sourceMappingURL=digest-DL5sTq8T.cjs.map