@bcts/components 1.0.0-alpha.21 → 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.
- package/dist/{digest-DFW8lGqJ.mjs → digest-B1bpgcdz.mjs} +78 -68
- package/dist/digest-B1bpgcdz.mjs.map +1 -0
- package/dist/{digest-DWA5qjpo.cjs → digest-DL5sTq8T.cjs} +111 -114
- package/dist/{digest-DWA5qjpo.cjs.map → digest-DL5sTq8T.cjs.map} +1 -1
- package/dist/digest-DRakTOWS.cjs +2 -0
- package/dist/index.cjs +547 -648
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -14
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +10 -14
- package/dist/index.d.mts.map +1 -1
- package/dist/index.iife.js +947 -1038
- package/dist/index.iife.js.map +1 -1
- package/dist/index.mjs +513 -610
- package/dist/index.mjs.map +1 -1
- package/package.json +16 -16
- package/dist/digest-BJkzk4LG.mjs +0 -3
- package/dist/digest-BzlBpAL2.cjs +0 -3
- package/dist/digest-DFW8lGqJ.mjs.map +0 -1
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
|
|
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
|
|
43
|
+
let ErrorKind = /* @__PURE__ */ function(ErrorKind) {
|
|
45
44
|
/** Invalid data size for the specified type */
|
|
46
|
-
ErrorKind
|
|
45
|
+
ErrorKind["InvalidSize"] = "InvalidSize";
|
|
47
46
|
/** Invalid data format or content */
|
|
48
|
-
ErrorKind
|
|
47
|
+
ErrorKind["InvalidData"] = "InvalidData";
|
|
49
48
|
/** Data too short for the expected type */
|
|
50
|
-
ErrorKind
|
|
49
|
+
ErrorKind["DataTooShort"] = "DataTooShort";
|
|
51
50
|
/** Cryptographic operation failed */
|
|
52
|
-
ErrorKind
|
|
51
|
+
ErrorKind["Crypto"] = "Crypto";
|
|
53
52
|
/** CBOR encoding or decoding error */
|
|
54
|
-
ErrorKind
|
|
53
|
+
ErrorKind["Cbor"] = "Cbor";
|
|
55
54
|
/** SSKR error */
|
|
56
|
-
ErrorKind
|
|
55
|
+
ErrorKind["Sskr"] = "Sskr";
|
|
57
56
|
/** SSH key operation failed */
|
|
58
|
-
ErrorKind
|
|
57
|
+
ErrorKind["Ssh"] = "Ssh";
|
|
59
58
|
/** URI parsing failed */
|
|
60
|
-
ErrorKind
|
|
59
|
+
ErrorKind["Uri"] = "Uri";
|
|
61
60
|
/** Data compression/decompression failed */
|
|
62
|
-
ErrorKind
|
|
61
|
+
ErrorKind["Compression"] = "Compression";
|
|
63
62
|
/** Post-quantum cryptography library error */
|
|
64
|
-
ErrorKind
|
|
63
|
+
ErrorKind["PostQuantum"] = "PostQuantum";
|
|
65
64
|
/** Signature level mismatch */
|
|
66
|
-
ErrorKind
|
|
65
|
+
ErrorKind["LevelMismatch"] = "LevelMismatch";
|
|
67
66
|
/** SSH agent operation failed */
|
|
68
|
-
ErrorKind
|
|
67
|
+
ErrorKind["SshAgent"] = "SshAgent";
|
|
69
68
|
/** Hex decoding error */
|
|
70
|
-
ErrorKind
|
|
69
|
+
ErrorKind["Hex"] = "Hex";
|
|
71
70
|
/** UTF-8 conversion error */
|
|
72
|
-
ErrorKind
|
|
71
|
+
ErrorKind["Utf8"] = "Utf8";
|
|
73
72
|
/** Environment variable error */
|
|
74
|
-
ErrorKind
|
|
73
|
+
ErrorKind["Env"] = "Env";
|
|
75
74
|
/** SSH agent client error */
|
|
76
|
-
ErrorKind
|
|
75
|
+
ErrorKind["SshAgentClient"] = "SshAgentClient";
|
|
77
76
|
/** General error with custom message */
|
|
78
|
-
ErrorKind
|
|
79
|
-
return ErrorKind
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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 ===
|
|
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 ===
|
|
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 ===
|
|
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 ===
|
|
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 ===
|
|
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 ===
|
|
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 ===
|
|
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 ===
|
|
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 ===
|
|
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 ===
|
|
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 ===
|
|
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 ===
|
|
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 ===
|
|
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 ===
|
|
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 ===
|
|
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 ===
|
|
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 ===
|
|
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,
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
929
|
+
Object.defineProperty(exports, "CryptoError", {
|
|
930
|
+
enumerable: true,
|
|
931
|
+
get: function() {
|
|
932
|
+
return CryptoError;
|
|
933
|
+
}
|
|
938
934
|
});
|
|
939
|
-
Object.defineProperty(exports,
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
935
|
+
Object.defineProperty(exports, "Digest", {
|
|
936
|
+
enumerable: true,
|
|
937
|
+
get: function() {
|
|
938
|
+
return Digest;
|
|
939
|
+
}
|
|
944
940
|
});
|
|
945
|
-
Object.defineProperty(exports,
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
941
|
+
Object.defineProperty(exports, "ErrorKind", {
|
|
942
|
+
enumerable: true,
|
|
943
|
+
get: function() {
|
|
944
|
+
return ErrorKind;
|
|
945
|
+
}
|
|
950
946
|
});
|
|
951
|
-
Object.defineProperty(exports,
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
947
|
+
Object.defineProperty(exports, "bytesEqual", {
|
|
948
|
+
enumerable: true,
|
|
949
|
+
get: function() {
|
|
950
|
+
return bytesEqual;
|
|
951
|
+
}
|
|
956
952
|
});
|
|
957
|
-
Object.defineProperty(exports,
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
953
|
+
Object.defineProperty(exports, "bytesToHex", {
|
|
954
|
+
enumerable: true,
|
|
955
|
+
get: function() {
|
|
956
|
+
return bytesToHex;
|
|
957
|
+
}
|
|
962
958
|
});
|
|
963
|
-
Object.defineProperty(exports,
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
959
|
+
Object.defineProperty(exports, "fromBase64", {
|
|
960
|
+
enumerable: true,
|
|
961
|
+
get: function() {
|
|
962
|
+
return fromBase64;
|
|
963
|
+
}
|
|
968
964
|
});
|
|
969
|
-
Object.defineProperty(exports,
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
965
|
+
Object.defineProperty(exports, "hexToBytes", {
|
|
966
|
+
enumerable: true,
|
|
967
|
+
get: function() {
|
|
968
|
+
return hexToBytes;
|
|
969
|
+
}
|
|
974
970
|
});
|
|
975
|
-
Object.defineProperty(exports,
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
971
|
+
Object.defineProperty(exports, "isCryptoError", {
|
|
972
|
+
enumerable: true,
|
|
973
|
+
get: function() {
|
|
974
|
+
return isCryptoError;
|
|
975
|
+
}
|
|
980
976
|
});
|
|
981
|
-
Object.defineProperty(exports,
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
977
|
+
Object.defineProperty(exports, "isCryptoErrorKind", {
|
|
978
|
+
enumerable: true,
|
|
979
|
+
get: function() {
|
|
980
|
+
return isCryptoErrorKind;
|
|
981
|
+
}
|
|
986
982
|
});
|
|
987
|
-
Object.defineProperty(exports,
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
983
|
+
Object.defineProperty(exports, "isError", {
|
|
984
|
+
enumerable: true,
|
|
985
|
+
get: function() {
|
|
986
|
+
return isError;
|
|
987
|
+
}
|
|
992
988
|
});
|
|
993
|
-
Object.defineProperty(exports,
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
989
|
+
Object.defineProperty(exports, "toBase64", {
|
|
990
|
+
enumerable: true,
|
|
991
|
+
get: function() {
|
|
992
|
+
return toBase64;
|
|
993
|
+
}
|
|
998
994
|
});
|
|
999
|
-
|
|
995
|
+
|
|
996
|
+
//# sourceMappingURL=digest-DL5sTq8T.cjs.map
|