@lumjs/encode 2.6.0 → 2.6.1

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
@@ -6,8 +6,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
- ## [2.6.0] - 2026-02-24
9
+ ## [2.6.1] - 2026-03-07
10
+ - Thanks to the wonkiness of CJS vs ESM, I've added some stub .ejs files
11
+ for any of the module _sets_. Along with the types added in 2.6.0, this
12
+ is now actually useable in Typescript projects.
10
13
 
14
+ ## [2.6.0] - 2026-02-24
15
+ - Moved to using [@lumjs/build] to build the docs and Typescript type defs.
16
+ - Added some polyfills for a couple Uint8Array methods that aren't supported
17
+ on every runtime yet.
11
18
 
12
19
  ## [2.5.0] - 2026-02-20
13
20
  ### Added
@@ -109,7 +116,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
109
116
  ### Added
110
117
  - Initial release.
111
118
 
112
- [Unreleased]: https://github.com/supernovus/lum.encode.js/compare/v2.6.0...HEAD
119
+ [Unreleased]: https://github.com/supernovus/lum.encode.js/compare/v2.6.1...HEAD
120
+ [2.6.1]: https://github.com/supernovus/lum.encode.js/compare/v2.6.0...v2.6.1
113
121
  [2.6.0]: https://github.com/supernovus/lum.encode.js/compare/v2.5.0...v2.6.0
114
122
  [2.5.0]: https://github.com/supernovus/lum.encode.js/compare/v2.4.1...v2.5.0
115
123
  [2.4.1]: https://github.com/supernovus/lum.encode.js/compare/v2.4.0...v2.4.1
package/TODO.md CHANGED
@@ -1,3 +1,11 @@
1
1
  # TODO
2
2
 
3
3
  - Write tests for HMAC, HOTP, TOTP, etc.
4
+
5
+ ## v3.x
6
+
7
+ - Target `@lumjs/core` 2.x once it is finalised.
8
+ - Rewrite this as ESM with native Typescript typings.
9
+ That will let me drop all the compatibility cruft I've had to add
10
+ just to get this package working for a Typescript project.
11
+
package/lib/hash.js CHANGED
@@ -282,7 +282,7 @@ module.exports = class Hashifier
282
282
  * @param {(string|object|null)} [input]
283
283
  * See [hash()]{@link module:@lumjs/encode/hash#hash} for details.
284
284
  *
285
- * @returns {string}
285
+ * @returns {Promise<string>}
286
286
  */
287
287
  async hex(input)
288
288
  {
@@ -299,7 +299,7 @@ module.exports = class Hashifier
299
299
  *
300
300
  * @param {object} [options] Options to pass to base32.encode().
301
301
  *
302
- * @returns {string}
302
+ * @returns {Promise<string>}
303
303
  */
304
304
  async base32(input, opts=this.defaults.base32)
305
305
  {
@@ -317,7 +317,7 @@ module.exports = class Hashifier
317
317
  *
318
318
  * @param {boolean} [options.url=false] Use URL-safe variant?
319
319
  *
320
- * @returns {string}
320
+ * @returns {Promise<string>}
321
321
  */
322
322
  async base64(input, opts=this.defaults.base64)
323
323
  {
@@ -347,7 +347,7 @@ module.exports = class Hashifier
347
347
  * If this is `false` the `ArrayBffer` will be converted into a `Uint8Array`,
348
348
  * and that will be passed to `base91.encode()`.
349
349
  *
350
- * @returns {string}
350
+ * @returns {Promise<string>}
351
351
  */
352
352
  async base91(input, opts=this.defaults.base91)
353
353
  {
@@ -0,0 +1,2 @@
1
+ export * from './digest.mjs';
2
+ export * from './sign.mjs';
@@ -0,0 +1,7 @@
1
+ import mod from './base.js';
2
+ export const {
3
+ Base32,
4
+ Base64,
5
+ Base91,
6
+ Util,
7
+ } = mod;
@@ -0,0 +1,5 @@
1
+ export * from './base.mjs';
2
+ import mod from './digest.js';
3
+ export const {
4
+ Hash,
5
+ } = mod;
@@ -0,0 +1,6 @@
1
+ export * from './sign.mjs';
2
+ import mod from './digest.js';
3
+ export const {
4
+ HOTP,
5
+ TOTP,
6
+ } = mod;
@@ -0,0 +1,7 @@
1
+ import mod from './sign.js';
2
+ export const {
3
+ HMAC,
4
+ PEM,
5
+ Signature,
6
+ Util,
7
+ } = mod;
package/lum.build.js CHANGED
@@ -14,6 +14,7 @@ module.exports = function(rb)
14
14
  .add('totp')
15
15
  .add('util')
16
16
  .src('./lib/sets')
17
+ .alt('./lib/sets')
17
18
  .types('./types/sets')
18
19
  .add('all')
19
20
  .add('base')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lumjs/encode",
3
- "version": "2.6.0",
3
+ "version": "2.6.1",
4
4
  "main": "lib/index.js",
5
5
  "exports": {
6
6
  ".": "./lib/index.js",
@@ -46,23 +46,28 @@
46
46
  },
47
47
  "./all": {
48
48
  "types": "./types/sets/all.d.ts",
49
- "default": "./lib/sets/all.js"
49
+ "require": "./lib/sets/all.js",
50
+ "import": "./lib/sets/all.mjs"
50
51
  },
51
52
  "./base": {
52
53
  "types": "./types/sets/base.d.ts",
53
- "default": "./lib/sets/base.js"
54
+ "require": "./lib/sets/base.js",
55
+ "import": "./lib/sets/base.mjs"
54
56
  },
55
57
  "./digest": {
56
58
  "types": "./types/sets/digest.d.ts",
57
- "default": "./lib/sets/digest.js"
59
+ "require": "./lib/sets/digest.js",
60
+ "import": "./lib/sets/digest.mjs"
58
61
  },
59
62
  "./otp": {
60
63
  "types": "./types/sets/otp.d.ts",
61
- "default": "./lib/sets/otp.js"
64
+ "require": "./lib/sets/otp.js",
65
+ "import": "./lib/sets/otp.mjs"
62
66
  },
63
67
  "./sign": {
64
68
  "types": "./types/sets/sign.d.ts",
65
- "default": "./lib/sets/sign.js"
69
+ "require": "./lib/sets/sign.js",
70
+ "import": "./lib/sets/sign.mjs"
66
71
  },
67
72
  "./package.json": "./package.json"
68
73
  },
@@ -79,8 +84,9 @@
79
84
  "@lumjs/tests": "^2.0.0"
80
85
  },
81
86
  "scripts": {
82
- "build": "npm run build-types && npm run build-meta && npm run build-docs",
87
+ "build": "npm run build-info && npm run build-docs",
83
88
  "build-docs": "jsdoc -c ./jsdoc.js",
89
+ "build-info": "npm run build-types && npm run build-meta",
84
90
  "build-meta": "lum-build",
85
91
  "build-types": "npx -p typescript tsc",
86
92
  "test": "node ./node_modules/@lumjs/tests/bin/lumtest.js"
@@ -125,9 +125,9 @@ declare class Hashifier {
125
125
  * @param {(string|object|null)} [input]
126
126
  * See [hash()]{@link module:@lumjs/encode/hash#hash} for details.
127
127
  *
128
- * @returns {string}
128
+ * @returns {Promise<string>}
129
129
  */
130
- hex(input?: (string | object | null)): string;
130
+ hex(input?: (string | object | null)): Promise<string>;
131
131
  /**
132
132
  * Get hash as a Base32-encoded string.
133
133
  *
@@ -136,9 +136,9 @@ declare class Hashifier {
136
136
  *
137
137
  * @param {object} [options] Options to pass to base32.encode().
138
138
  *
139
- * @returns {string}
139
+ * @returns {Promise<string>}
140
140
  */
141
- base32(input?: (string | object | null), opts?: any): string;
141
+ base32(input?: (string | object | null), opts?: any): Promise<string>;
142
142
  /**
143
143
  * Get hash as a Base64-encoded string.
144
144
  *
@@ -149,9 +149,9 @@ declare class Hashifier {
149
149
  *
150
150
  * @param {boolean} [options.url=false] Use URL-safe variant?
151
151
  *
152
- * @returns {string}
152
+ * @returns {Promise<string>}
153
153
  */
154
- base64(input?: (string | object | null), opts?: any): string;
154
+ base64(input?: (string | object | null), opts?: any): Promise<string>;
155
155
  /**
156
156
  * Get hash as a Base91-encoded string.
157
157
  *
@@ -173,11 +173,11 @@ declare class Hashifier {
173
173
  * If this is `false` the `ArrayBffer` will be converted into a `Uint8Array`,
174
174
  * and that will be passed to `base91.encode()`.
175
175
  *
176
- * @returns {string}
176
+ * @returns {Promise<string>}
177
177
  */
178
178
  base91(input?: (string | object | null), opts?: {
179
179
  nba?: (boolean | object);
180
- }): string;
180
+ }): Promise<string>;
181
181
  /**
182
182
  * Add input to a progressive hash.
183
183
  *
@@ -1 +1 @@
1
- {"version":3,"file":"hash.d.ts","sourceRoot":"","sources":["../../lib/hash.js"],"names":[],"mappings":";AAyDiB;IA8Xf,0CAGC;IA/XD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAsEG;IACH,sBApEW,CAAC,MAAM,GAAC,MA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