bufferbase 2.0.0 → 3.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.
Files changed (115) hide show
  1. package/README.md +151 -63
  2. package/dist/cjs/bases.d.ts +152 -45
  3. package/dist/cjs/bases.d.ts.map +1 -1
  4. package/dist/cjs/bases.js +90 -77
  5. package/dist/cjs/bases.js.map +1 -1
  6. package/dist/cjs/bufferbase.d.ts +21 -27
  7. package/dist/cjs/bufferbase.d.ts.map +1 -1
  8. package/dist/cjs/bufferbase.js +21 -31
  9. package/dist/cjs/bufferbase.js.map +1 -1
  10. package/dist/cjs/codec-base.d.ts +56 -0
  11. package/dist/cjs/codec-base.d.ts.map +1 -0
  12. package/dist/cjs/codec-base.js +132 -0
  13. package/dist/cjs/codec-base.js.map +1 -0
  14. package/dist/cjs/codec-block.d.ts +47 -0
  15. package/dist/cjs/codec-block.d.ts.map +1 -0
  16. package/dist/cjs/codec-block.js +213 -0
  17. package/dist/cjs/codec-block.js.map +1 -0
  18. package/dist/cjs/codec-block85.d.ts +56 -0
  19. package/dist/cjs/codec-block85.d.ts.map +1 -0
  20. package/dist/cjs/codec-block85.js +271 -0
  21. package/dist/cjs/codec-block85.js.map +1 -0
  22. package/dist/cjs/codec-radix.d.ts +46 -0
  23. package/dist/cjs/codec-radix.d.ts.map +1 -0
  24. package/dist/cjs/codec-radix.js +181 -0
  25. package/dist/cjs/codec-radix.js.map +1 -0
  26. package/dist/cjs/codec.d.ts +25 -111
  27. package/dist/cjs/codec.d.ts.map +1 -1
  28. package/dist/cjs/codec.js +50 -228
  29. package/dist/cjs/codec.js.map +1 -1
  30. package/dist/cjs/codecs.d.ts +8 -59
  31. package/dist/cjs/codecs.d.ts.map +1 -1
  32. package/dist/cjs/codecs.js +6 -79
  33. package/dist/cjs/codecs.js.map +1 -1
  34. package/dist/cjs/errors.d.ts +65 -48
  35. package/dist/cjs/errors.d.ts.map +1 -1
  36. package/dist/cjs/errors.js +89 -51
  37. package/dist/cjs/errors.js.map +1 -1
  38. package/dist/cjs/example.js +44 -21
  39. package/dist/cjs/example.js.map +1 -1
  40. package/dist/cjs/functions.d.ts +27 -31
  41. package/dist/cjs/functions.d.ts.map +1 -1
  42. package/dist/cjs/functions.js +25 -47
  43. package/dist/cjs/functions.js.map +1 -1
  44. package/dist/cjs/index.d.ts +7 -5
  45. package/dist/cjs/index.d.ts.map +1 -1
  46. package/dist/cjs/index.js +17 -7
  47. package/dist/cjs/index.js.map +1 -1
  48. package/dist/cjs/package.json +13 -7
  49. package/dist/cjs/types.d.ts +108 -71
  50. package/dist/cjs/types.d.ts.map +1 -1
  51. package/dist/esm/bases.d.ts +152 -45
  52. package/dist/esm/bases.d.ts.map +1 -1
  53. package/dist/esm/bases.js +88 -75
  54. package/dist/esm/bases.js.map +1 -1
  55. package/dist/esm/bufferbase.d.ts +21 -27
  56. package/dist/esm/bufferbase.d.ts.map +1 -1
  57. package/dist/esm/bufferbase.js +18 -30
  58. package/dist/esm/bufferbase.js.map +1 -1
  59. package/dist/esm/codec-base.d.ts +56 -0
  60. package/dist/esm/codec-base.d.ts.map +1 -0
  61. package/dist/esm/codec-base.js +127 -0
  62. package/dist/esm/codec-base.js.map +1 -0
  63. package/dist/esm/codec-block.d.ts +47 -0
  64. package/dist/esm/codec-block.d.ts.map +1 -0
  65. package/dist/esm/codec-block.js +209 -0
  66. package/dist/esm/codec-block.js.map +1 -0
  67. package/dist/esm/codec-block85.d.ts +56 -0
  68. package/dist/esm/codec-block85.d.ts.map +1 -0
  69. package/dist/esm/codec-block85.js +267 -0
  70. package/dist/esm/codec-block85.js.map +1 -0
  71. package/dist/esm/codec-radix.d.ts +46 -0
  72. package/dist/esm/codec-radix.d.ts.map +1 -0
  73. package/dist/esm/codec-radix.js +177 -0
  74. package/dist/esm/codec-radix.js.map +1 -0
  75. package/dist/esm/codec.d.ts +25 -111
  76. package/dist/esm/codec.d.ts.map +1 -1
  77. package/dist/esm/codec.js +44 -226
  78. package/dist/esm/codec.js.map +1 -1
  79. package/dist/esm/codecs.d.ts +8 -59
  80. package/dist/esm/codecs.d.ts.map +1 -1
  81. package/dist/esm/codecs.js +7 -80
  82. package/dist/esm/codecs.js.map +1 -1
  83. package/dist/esm/errors.d.ts +65 -48
  84. package/dist/esm/errors.d.ts.map +1 -1
  85. package/dist/esm/errors.js +83 -50
  86. package/dist/esm/errors.js.map +1 -1
  87. package/dist/esm/example.js +45 -22
  88. package/dist/esm/example.js.map +1 -1
  89. package/dist/esm/functions.d.ts +27 -31
  90. package/dist/esm/functions.d.ts.map +1 -1
  91. package/dist/esm/functions.js +26 -48
  92. package/dist/esm/functions.js.map +1 -1
  93. package/dist/esm/index.d.ts +7 -5
  94. package/dist/esm/index.d.ts.map +1 -1
  95. package/dist/esm/index.js +6 -6
  96. package/dist/esm/index.js.map +1 -1
  97. package/dist/esm/package.json +13 -7
  98. package/dist/esm/types.d.ts +108 -71
  99. package/dist/esm/types.d.ts.map +1 -1
  100. package/package.json +13 -7
  101. package/src/algorithms.test.ts +442 -0
  102. package/src/bases.ts +98 -76
  103. package/src/bufferbase.ts +26 -36
  104. package/src/codec-base.ts +181 -0
  105. package/src/codec-block.ts +258 -0
  106. package/src/codec-block85.ts +315 -0
  107. package/src/codec-radix.ts +206 -0
  108. package/src/codec.test.ts +17 -9
  109. package/src/codec.ts +48 -247
  110. package/src/codecs.ts +11 -105
  111. package/src/errors.ts +90 -50
  112. package/src/example.ts +47 -22
  113. package/src/functions.ts +34 -54
  114. package/src/index.ts +27 -7
  115. package/src/types.ts +113 -86
@@ -1,71 +1,20 @@
1
- import { Codec } from './codec.js';
1
+ import type { ICodec } from './types.js';
2
+ import { type BaseName } from './bases.js';
2
3
  /**
3
- * Pre-defined codec instances for common base encodings.
4
- *
5
- * Use these for encoding/decoding without creating codec instances manually.
6
- * Each codec provides `encode()`, `decode()`, `validate()`, and `convertTo()` methods.
4
+ * A ready-made codec for every name in `Bases`.
7
5
  *
8
6
  * @example
9
7
  * ```typescript
10
8
  * import { Codecs } from 'bufferbase';
11
9
  *
12
- * // Encode to Base58
13
- * const encoded = Codecs.base58.encode(Buffer.from('Hello'));
14
- *
15
- * // Decode from Base58
16
- * const decoded = Codecs.base58.decode(encoded);
17
- *
18
- * // Convert between bases
19
- * const base64 = Codecs.base58.convertTo(Codecs.base64url, encoded);
20
- *
21
- * // Validate
22
- * Codecs.base58.validate(encoded); // true
10
+ * Codecs.base58.encode(Buffer.from('Hello')); // '9Ajdvzr'
11
+ * Codecs.base64.encode(Buffer.from('fo')); // 'Zm8='
12
+ * Codecs.base58.convertTo(Codecs.base64url, '9Ajdvzr');
23
13
  * ```
24
- *
25
- * Available codecs:
26
- * - `decimal` - Base 10 (0-9)
27
- * - `base16` / `hex` - Hexadecimal (0-9A-F)
28
- * - `base32` - RFC 4648 Base32 (A-Z2-7)
29
- * - `base32crockford` - Crockford's Base32
30
- * - `base36` - Alphanumeric (0-9A-Z)
31
- * - `base52` - Letters only (A-Za-z)
32
- * - `base58` - Bitcoin alphabet
33
- * - `base64` - Standard Base64
34
- * - `base64url` - URL-safe Base64
35
- * - `base64xml` - XML token Base64
36
- * - `base64xmlname` - XML name Base64
37
- * - `ascii85` - ASCII85 encoding
38
- * - `base85` - Base85 encoding
39
- * - `z85` - ZeroMQ Z85 encoding
40
14
  */
41
- export declare const Codecs: {
42
- readonly decimal: Codec;
43
- readonly base16: Codec;
44
- readonly hex: Codec;
45
- readonly base32: Codec;
46
- readonly base32crockford: Codec;
47
- readonly base36: Codec;
48
- readonly base52: Codec;
49
- readonly base58: Codec;
50
- readonly base64: Codec;
51
- readonly base64url: Codec;
52
- readonly base64xml: Codec;
53
- readonly base64xmlname: Codec;
54
- readonly ascii85: Codec;
55
- readonly base85: Codec;
56
- readonly z85: Codec;
57
- };
15
+ export declare const Codecs: Record<BaseName, ICodec>;
58
16
  /**
59
17
  * Type representing valid codec names in the `Codecs` object.
60
- *
61
- * @example
62
- * ```typescript
63
- * import { Codecs, CodecName } from 'bufferbase';
64
- *
65
- * function getCodec(name: CodecName) {
66
- * return Codecs[name];
67
- * }
68
- * ```
69
18
  */
70
- export type CodecName = keyof typeof Codecs;
19
+ export type CodecName = BaseName;
71
20
  //# sourceMappingURL=codecs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"codecs.d.ts","sourceRoot":"","sources":["../../src/codecs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAgDnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;CAgBT,CAAC;AAEX;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,OAAO,MAAM,CAAC"}
1
+ {"version":3,"file":"codecs.d.ts","sourceRoot":"","sources":["../../src/codecs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAS,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGlD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,MAAM,EAEd,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;AAE9B;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,QAAQ,CAAC"}
@@ -1,89 +1,16 @@
1
- import { Codec } from './codec.js';
2
- import { Chars } from './bases.js';
3
- /** Decimal (base 10) codec: 0-9 */
4
- const decimal = new Codec(Chars.Decimal);
5
- /** Hexadecimal (base 16) codec: 0-9A-F */
6
- const base16 = new Codec(Chars.Base16);
7
- /** Alias for base16 */
8
- const hex = base16;
9
- /** RFC 4648 Base32 codec: A-Z2-7 */
10
- const base32 = new Codec(Chars.Base32);
11
- /** Crockford's Base32 codec: 0-9A-HJKMNP-TV-Z (no I, L, O, U) */
12
- const base32crockford = new Codec(Chars.Base32Crockford);
13
- /** Base36 codec: 0-9A-Z */
14
- const base36 = new Codec(Chars.Base36);
15
- /** Base52 codec: A-Za-z (letters only) */
16
- const base52 = new Codec(Chars.Base52);
17
- /** Bitcoin Base58 codec: 1-9A-HJ-NP-Za-km-z (no 0, O, I, l) */
18
- const base58 = new Codec(Chars.Base58);
19
- /** Standard Base64 codec: A-Za-z0-9+/ */
20
- const base64 = new Codec(Chars.Base64);
21
- /** URL-safe Base64 codec: A-Za-z0-9-_ */
22
- const base64url = new Codec(Chars.Base64Url);
23
- /** XML token Base64 codec: A-Za-z0-9._ */
24
- const base64xml = new Codec(Chars.Base64Xml);
25
- /** XML name Base64 codec: A-Za-z0-9_: */
26
- const base64xmlname = new Codec(Chars.Base64XmlName);
27
- /** ASCII85 codec */
28
- const ascii85 = new Codec(Chars.Ascii85);
29
- /** Base85 codec */
30
- const base85 = new Codec(Chars.Base85);
31
- /** ZeroMQ Z85 codec */
32
- const z85 = new Codec(Chars.Z85);
1
+ import { Bases } from './bases.js';
2
+ import { getCodec } from './codec.js';
33
3
  /**
34
- * Pre-defined codec instances for common base encodings.
35
- *
36
- * Use these for encoding/decoding without creating codec instances manually.
37
- * Each codec provides `encode()`, `decode()`, `validate()`, and `convertTo()` methods.
4
+ * A ready-made codec for every name in `Bases`.
38
5
  *
39
6
  * @example
40
7
  * ```typescript
41
8
  * import { Codecs } from 'bufferbase';
42
9
  *
43
- * // Encode to Base58
44
- * const encoded = Codecs.base58.encode(Buffer.from('Hello'));
45
- *
46
- * // Decode from Base58
47
- * const decoded = Codecs.base58.decode(encoded);
48
- *
49
- * // Convert between bases
50
- * const base64 = Codecs.base58.convertTo(Codecs.base64url, encoded);
51
- *
52
- * // Validate
53
- * Codecs.base58.validate(encoded); // true
10
+ * Codecs.base58.encode(Buffer.from('Hello')); // '9Ajdvzr'
11
+ * Codecs.base64.encode(Buffer.from('fo')); // 'Zm8='
12
+ * Codecs.base58.convertTo(Codecs.base64url, '9Ajdvzr');
54
13
  * ```
55
- *
56
- * Available codecs:
57
- * - `decimal` - Base 10 (0-9)
58
- * - `base16` / `hex` - Hexadecimal (0-9A-F)
59
- * - `base32` - RFC 4648 Base32 (A-Z2-7)
60
- * - `base32crockford` - Crockford's Base32
61
- * - `base36` - Alphanumeric (0-9A-Z)
62
- * - `base52` - Letters only (A-Za-z)
63
- * - `base58` - Bitcoin alphabet
64
- * - `base64` - Standard Base64
65
- * - `base64url` - URL-safe Base64
66
- * - `base64xml` - XML token Base64
67
- * - `base64xmlname` - XML name Base64
68
- * - `ascii85` - ASCII85 encoding
69
- * - `base85` - Base85 encoding
70
- * - `z85` - ZeroMQ Z85 encoding
71
14
  */
72
- export const Codecs = {
73
- decimal,
74
- base16,
75
- hex,
76
- base32,
77
- base32crockford,
78
- base36,
79
- base52,
80
- base58,
81
- base64,
82
- base64url,
83
- base64xml,
84
- base64xmlname,
85
- ascii85,
86
- base85,
87
- z85,
88
- };
15
+ export const Codecs = Object.fromEntries(Object.entries(Bases).map(([name, spec]) => [name, getCodec(spec)]));
89
16
  //# sourceMappingURL=codecs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"codecs.js","sourceRoot":"","sources":["../../src/codecs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,mCAAmC;AACnC,MAAM,OAAO,GAAG,IAAI,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AAEzC,0CAA0C;AAC1C,MAAM,MAAM,GAAG,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAEvC,uBAAuB;AACvB,MAAM,GAAG,GAAG,MAAM,CAAC;AAEnB,oCAAoC;AACpC,MAAM,MAAM,GAAG,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAEvC,iEAAiE;AACjE,MAAM,eAAe,GAAG,IAAI,KAAK,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;AAEzD,2BAA2B;AAC3B,MAAM,MAAM,GAAG,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,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC,WAAW,CACtC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CACxC,CAAC"}
@@ -1,18 +1,5 @@
1
1
  /**
2
2
  * Error thrown when an invalid character is encountered during decoding.
3
- *
4
- * @example
5
- * ```typescript
6
- * import { decode, InvalidCharacterError } from 'bufferbase';
7
- *
8
- * try {
9
- * decode('invalid!', 'base58');
10
- * } catch (e) {
11
- * if (e instanceof InvalidCharacterError) {
12
- * console.log(e.message); // "Invalid character found: '!'"
13
- * }
14
- * }
15
- * ```
16
3
  */
17
4
  export declare class InvalidCharacterError extends Error {
18
5
  /**
@@ -21,24 +8,8 @@ export declare class InvalidCharacterError extends Error {
21
8
  constructor(char?: string);
22
9
  }
23
10
  /**
24
- * Error thrown when decoded buffer size exceeds the specified size.
25
- *
26
- * This error is thrown when using the `size` option in decode operations
27
- * and the decoded data is larger than the specified size.
28
- *
29
- * @example
30
- * ```typescript
31
- * import { decode, BufferSizeError } from 'bufferbase';
32
- *
33
- * try {
34
- * // Trying to decode into a buffer too small
35
- * decode('72k1xXWG59fYdzSNoA', 'base58', { size: 2 });
36
- * } catch (e) {
37
- * if (e instanceof BufferSizeError) {
38
- * console.log(e.message); // "Buffer size 13 exceeds specified size 2"
39
- * }
40
- * }
41
- * ```
11
+ * Error thrown when the decoded buffer does not have the size requested
12
+ * through `DecodeOptions.size`.
42
13
  */
43
14
  export declare class BufferSizeError extends Error {
44
15
  /**
@@ -49,23 +20,6 @@ export declare class BufferSizeError extends Error {
49
20
  }
50
21
  /**
51
22
  * Error thrown when an unknown base name is provided.
52
- *
53
- * This error is thrown when using the function API with an invalid base name
54
- * that is neither a known encoding name nor a valid custom character set
55
- * (character sets must be longer than 15 characters).
56
- *
57
- * @example
58
- * ```typescript
59
- * import { encode, UnknownBaseError } from 'bufferbase';
60
- *
61
- * try {
62
- * encode(Buffer.from('test'), 'invalidbase');
63
- * } catch (e) {
64
- * if (e instanceof UnknownBaseError) {
65
- * console.log(e.message); // "Unknown base encoding: 'invalidbase'"
66
- * }
67
- * }
68
- * ```
69
23
  */
70
24
  export declare class UnknownBaseError extends Error {
71
25
  /**
@@ -73,4 +27,67 @@ export declare class UnknownBaseError extends Error {
73
27
  */
74
28
  constructor(name: string);
75
29
  }
30
+ /**
31
+ * Error thrown when a string cannot be the encoding of any byte sequence
32
+ * because of its length.
33
+ *
34
+ * A Base64 string of 5 characters, for example, describes 30 bits: too many
35
+ * for 3 bytes and too few for 4.
36
+ */
37
+ export declare class InvalidLengthError extends Error {
38
+ /**
39
+ * @param length - The length that cannot occur
40
+ * @param detail - What the length should have been
41
+ */
42
+ constructor(length: number, detail: string);
43
+ }
44
+ /**
45
+ * Error thrown when input is well-formed but is not the canonical encoding of
46
+ * the bytes it decodes to (RFC 4648 §3.5).
47
+ *
48
+ * Accepting such input makes decoding non-injective: `'Zm8='` and `'Zm9='`
49
+ * would both decode to `'fo'`. Pass `strict: false` in the codec spec to allow
50
+ * it.
51
+ */
52
+ export declare class NonCanonicalError extends Error {
53
+ /**
54
+ * @param detail - What made the input non-canonical
55
+ */
56
+ constructor(detail: string);
57
+ }
58
+ /**
59
+ * Error thrown when a codec spec cannot be realised, such as a `'block'`
60
+ * algorithm with an alphabet whose length is not a power of two.
61
+ */
62
+ export declare class InvalidCodecError extends Error {
63
+ /**
64
+ * @param detail - Why the spec is unusable
65
+ */
66
+ constructor(detail: string);
67
+ }
68
+ /**
69
+ * Error thrown when a group of characters denotes a number too large for the
70
+ * bytes it is supposed to encode.
71
+ *
72
+ * In an Ascii85 group, five characters must denote a value below 2^32; `'s8W-!'`
73
+ * does not, so it encodes nothing. Unlike `NonCanonicalError` this is never
74
+ * allowed, because there is no byte sequence to decode to.
75
+ */
76
+ export declare class ValueRangeError extends Error {
77
+ /**
78
+ * @param group - The group of characters that is out of range
79
+ */
80
+ constructor(group: string);
81
+ }
82
+ /**
83
+ * Error thrown when a trailing check symbol does not match the value it
84
+ * follows, which means the string was mistyped or corrupted.
85
+ */
86
+ export declare class CheckSymbolError extends Error {
87
+ /**
88
+ * @param found - The check symbol present in the input
89
+ * @param expected - The check symbol the value calls for
90
+ */
91
+ constructor(found: string, expected: string);
92
+ }
76
93
  //# sourceMappingURL=errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C;;OAEG;gBACS,IAAI,CAAC,EAAE,MAAM;CAK1B;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,eAAgB,SAAQ,KAAK;IACxC;;;OAGG;gBACS,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;CAI7C;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,gBAAiB,SAAQ,KAAK;IACzC;;OAEG;gBACS,IAAI,EAAE,MAAM;CAIzB"}
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C;;OAEG;gBACS,IAAI,CAAC,EAAE,MAAM;CAK1B;AAED;;;GAGG;AACH,qBAAa,eAAgB,SAAQ,KAAK;IACxC;;;OAGG;gBACS,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;CAI7C;AAED;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,KAAK;IACzC;;OAEG;gBACS,IAAI,EAAE,MAAM;CAOzB;AAED;;;;;;GAMG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C;;;OAGG;gBACS,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAI3C;AAED;;;;;;;GAOG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;IAC1C;;OAEG;gBACS,MAAM,EAAE,MAAM;CAI3B;AAED;;;GAGG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;IAC1C;;OAEG;gBACS,MAAM,EAAE,MAAM;CAI3B;AAED;;;;;;;GAOG;AACH,qBAAa,eAAgB,SAAQ,KAAK;IACxC;;OAEG;gBACS,KAAK,EAAE,MAAM;CAI1B;AAED;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,KAAK;IACzC;;;OAGG;gBACS,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;CAI5C"}
@@ -1,18 +1,5 @@
1
1
  /**
2
2
  * Error thrown when an invalid character is encountered during decoding.
3
- *
4
- * @example
5
- * ```typescript
6
- * import { decode, InvalidCharacterError } from 'bufferbase';
7
- *
8
- * try {
9
- * decode('invalid!', 'base58');
10
- * } catch (e) {
11
- * if (e instanceof InvalidCharacterError) {
12
- * console.log(e.message); // "Invalid character found: '!'"
13
- * }
14
- * }
15
- * ```
16
3
  */
17
4
  export class InvalidCharacterError extends Error {
18
5
  /**
@@ -25,24 +12,8 @@ export class InvalidCharacterError extends Error {
25
12
  }
26
13
  }
27
14
  /**
28
- * Error thrown when decoded buffer size exceeds the specified size.
29
- *
30
- * This error is thrown when using the `size` option in decode operations
31
- * and the decoded data is larger than the specified size.
32
- *
33
- * @example
34
- * ```typescript
35
- * import { decode, BufferSizeError } from 'bufferbase';
36
- *
37
- * try {
38
- * // Trying to decode into a buffer too small
39
- * decode('72k1xXWG59fYdzSNoA', 'base58', { size: 2 });
40
- * } catch (e) {
41
- * if (e instanceof BufferSizeError) {
42
- * console.log(e.message); // "Buffer size 13 exceeds specified size 2"
43
- * }
44
- * }
45
- * ```
15
+ * Error thrown when the decoded buffer does not have the size requested
16
+ * through `DecodeOptions.size`.
46
17
  */
47
18
  export class BufferSizeError extends Error {
48
19
  /**
@@ -50,37 +21,99 @@ export class BufferSizeError extends Error {
50
21
  * @param expected - The expected (specified) buffer size
51
22
  */
52
23
  constructor(actual, expected) {
53
- super(`Buffer size ${actual} exceeds specified size ${expected}`);
24
+ super(`Buffer size ${actual} does not match specified size ${expected}`);
54
25
  this.name = 'BufferSizeError';
55
26
  }
56
27
  }
57
28
  /**
58
29
  * Error thrown when an unknown base name is provided.
59
- *
60
- * This error is thrown when using the function API with an invalid base name
61
- * that is neither a known encoding name nor a valid custom character set
62
- * (character sets must be longer than 15 characters).
63
- *
64
- * @example
65
- * ```typescript
66
- * import { encode, UnknownBaseError } from 'bufferbase';
67
- *
68
- * try {
69
- * encode(Buffer.from('test'), 'invalidbase');
70
- * } catch (e) {
71
- * if (e instanceof UnknownBaseError) {
72
- * console.log(e.message); // "Unknown base encoding: 'invalidbase'"
73
- * }
74
- * }
75
- * ```
76
30
  */
77
31
  export class UnknownBaseError extends Error {
78
32
  /**
79
33
  * @param name - The unknown base name that was provided
80
34
  */
81
35
  constructor(name) {
82
- super(`Unknown base encoding: '${name}'`);
36
+ super(`Unknown base encoding: '${name}'. ` +
37
+ 'Pass a CodecSpec such as { alphabet, algorithm: \'radix\' } to use a custom alphabet.');
83
38
  this.name = 'UnknownBaseError';
84
39
  }
85
40
  }
41
+ /**
42
+ * Error thrown when a string cannot be the encoding of any byte sequence
43
+ * because of its length.
44
+ *
45
+ * A Base64 string of 5 characters, for example, describes 30 bits: too many
46
+ * for 3 bytes and too few for 4.
47
+ */
48
+ export class InvalidLengthError extends Error {
49
+ /**
50
+ * @param length - The length that cannot occur
51
+ * @param detail - What the length should have been
52
+ */
53
+ constructor(length, detail) {
54
+ super(`Invalid encoded length ${length}: ${detail}`);
55
+ this.name = 'InvalidLengthError';
56
+ }
57
+ }
58
+ /**
59
+ * Error thrown when input is well-formed but is not the canonical encoding of
60
+ * the bytes it decodes to (RFC 4648 §3.5).
61
+ *
62
+ * Accepting such input makes decoding non-injective: `'Zm8='` and `'Zm9='`
63
+ * would both decode to `'fo'`. Pass `strict: false` in the codec spec to allow
64
+ * it.
65
+ */
66
+ export class NonCanonicalError extends Error {
67
+ /**
68
+ * @param detail - What made the input non-canonical
69
+ */
70
+ constructor(detail) {
71
+ super(`Non-canonical encoding: ${detail}`);
72
+ this.name = 'NonCanonicalError';
73
+ }
74
+ }
75
+ /**
76
+ * Error thrown when a codec spec cannot be realised, such as a `'block'`
77
+ * algorithm with an alphabet whose length is not a power of two.
78
+ */
79
+ export class InvalidCodecError extends Error {
80
+ /**
81
+ * @param detail - Why the spec is unusable
82
+ */
83
+ constructor(detail) {
84
+ super(`Invalid codec: ${detail}`);
85
+ this.name = 'InvalidCodecError';
86
+ }
87
+ }
88
+ /**
89
+ * Error thrown when a group of characters denotes a number too large for the
90
+ * bytes it is supposed to encode.
91
+ *
92
+ * In an Ascii85 group, five characters must denote a value below 2^32; `'s8W-!'`
93
+ * does not, so it encodes nothing. Unlike `NonCanonicalError` this is never
94
+ * allowed, because there is no byte sequence to decode to.
95
+ */
96
+ export class ValueRangeError extends Error {
97
+ /**
98
+ * @param group - The group of characters that is out of range
99
+ */
100
+ constructor(group) {
101
+ super(`Encoded group '${group}' exceeds the maximum value for its block`);
102
+ this.name = 'ValueRangeError';
103
+ }
104
+ }
105
+ /**
106
+ * Error thrown when a trailing check symbol does not match the value it
107
+ * follows, which means the string was mistyped or corrupted.
108
+ */
109
+ export class CheckSymbolError extends Error {
110
+ /**
111
+ * @param found - The check symbol present in the input
112
+ * @param expected - The check symbol the value calls for
113
+ */
114
+ constructor(found, expected) {
115
+ super(`Check symbol '${found}' does not match the expected '${expected}'`);
116
+ this.name = 'CheckSymbolError';
117
+ }
118
+ }
86
119
  //# sourceMappingURL=errors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,MA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AAC,CAAC;QAC3E,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;IACjC,CAAC;CACF"}
@@ -1,30 +1,53 @@
1
1
  import { Buffer } from 'node:buffer';
2
- import { encode, decode, convert, validate, Codecs } from './index.js';
3
- // Example buffer
2
+ import { encode, decode, convert, validate, createCodec, Chars, Codecs } from './index.js';
4
3
  const bytes = Buffer.from('Hello, World!', 'utf8');
5
- // Using simple function API
6
- const base32encoded = encode(bytes, 'base32crockford');
7
- const base58encoded = convert(base32encoded, 'base32crockford', 'base58');
8
- const base64encoded = convert(base58encoded, 'base58', 'base64url');
9
- const isValidAsBase64 = validate(base64encoded, 'base64url');
10
- const decoded = decode(base64encoded, 'base64url');
11
- console.log('=== Function API ===');
4
+ // The same bytes under each algorithm.
5
+ console.log('=== Algorithms ===');
6
+ console.table({
7
+ 'block base64': encode(bytes, 'base64'),
8
+ 'block base32': encode(bytes, 'base32'),
9
+ 'block85 ascii85': encode(bytes, 'ascii85'),
10
+ 'radix base58': encode(bytes, 'base58'),
11
+ 'radix base32crockford': encode(bytes, 'base32crockford'),
12
+ });
13
+ // Converting goes through the bytes, so any pair works.
14
+ console.log('\n=== Function API ===');
15
+ const base58 = encode(bytes, 'base58');
16
+ const base64url = convert(base58, 'base58', 'base64url');
12
17
  console.table({
13
18
  bytes: bytes.toString('utf8'),
14
- base32encoded,
15
- base58encoded,
16
- base64encoded,
17
- isValidAsBase64,
18
- decoded: decoded.toString('utf8'),
19
+ base58,
20
+ base64url,
21
+ valid: validate(base64url, 'base64url'),
22
+ decoded: decode(base64url, 'base64url').toString('utf8'),
23
+ });
24
+ // validate() agrees with decode(): it checks length, padding and canonicality.
25
+ console.log('\n=== Rejected input ===');
26
+ console.table({
27
+ "'Zm8=' (canonical)": validate('Zm8=', 'base64'),
28
+ "'Zm9=' (spare bits set)": validate('Zm9=', 'base64'),
29
+ "'Zm9vd' (5 characters)": validate('Zm9vd', 'base64'),
30
+ });
31
+ // Crockford's Base32 reads what a person is likely to have written down.
32
+ console.log('\n=== Crockford ===');
33
+ const crockford = encode(bytes, 'base32crockfordcheck');
34
+ console.table({
35
+ encoded: crockford,
36
+ 'as typed': decode(`${crockford.slice(0, 4)}-${crockford.slice(4)}`.toLowerCase(), 'base32crockfordcheck').toString('utf8'),
37
+ 'one character changed': validate(`${crockford.slice(0, -2)}Z${crockford.slice(-1)}`, 'base32crockfordcheck'),
38
+ });
39
+ // Codecs, and a custom alphabet.
40
+ console.log('\n=== Codecs and custom alphabets ===');
41
+ const binary = createCodec('01');
42
+ const adobe = createCodec({
43
+ alphabet: Chars.Ascii85,
44
+ algorithm: 'block85',
45
+ zeroShortcut: true,
46
+ delimiters: true,
19
47
  });
20
- // Using Codecs object
21
- console.log('\n=== Codecs API ===');
22
- const encoded = Codecs.base58.encode(bytes);
23
- const converted = Codecs.base58.convertTo(Codecs.base64url, encoded);
24
48
  console.table({
25
- original: bytes.toString('utf8'),
26
- base58: encoded,
27
- base64url: converted,
28
- valid: Codecs.base64url.validate(converted),
49
+ 'Codecs.base58': Codecs.base58.encode(bytes),
50
+ 'binary of [5]': binary.encode(Uint8Array.of(5)),
51
+ 'adobe ascii85': adobe.encode(bytes),
29
52
  });
30
53
  //# sourceMappingURL=example.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"example.js","sourceRoot":"","sources":["../../src/example.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEvE,iBAAiB;AACjB,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;AAEnD,4BAA4B;AAC5B,MAAM,aAAa,GAAG,MAAM,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC;AACvD,MAAM,aAAa,GAAG,OAAO,CAAC,aAAa,EAAE,iBAAiB,EAAE,Q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