@blamejs/core 0.13.42 → 0.13.44

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.
@@ -214,10 +214,11 @@ async function _readCentralDirectory(adapter, eocd) {
214
214
  "multi-disk archives are not supported (diskNumber=" + eocd.diskNumber + ")");
215
215
  }
216
216
  if (eocd.totalEntries === 0xffff || eocd.cdSize === 0xffffffff || eocd.cdOffset === 0xffffffff) {
217
- // ZIP64 sentinel — not supported in v0.12.7. Will land in a
218
- // follow-up patch when an operator surfaces a need.
217
+ // ZIP64 sentinel — unsupported. Archives at >4 GiB / >65535 entries
218
+ // use tar instead (the escape hatch); ZIP64 read support is deferred
219
+ // until an operator surfaces a need.
219
220
  throw new ArchiveReadError("archive-read/zip64-unsupported",
220
- "ZIP64 archives are not supported in v0.12.7 (operators at >4 GiB / >65535 entries should switch to tar — lands v0.12.8)");
221
+ "ZIP64 archives are unsupported (operators at >4 GiB / >65535 entries should switch to tar)");
221
222
  }
222
223
  if (eocd.cdSize === 0 || eocd.totalEntries === 0) {
223
224
  return [];
@@ -256,7 +257,7 @@ async function _readCentralDirectory(adapter, eocd) {
256
257
  }
257
258
  if (compressedSize === 0xffffffff || uncompressedSize === 0xffffffff || lfhOffset === 0xffffffff) {
258
259
  throw new ArchiveReadError("archive-read/zip64-unsupported",
259
- "central directory entry " + n + " carries ZIP64 sentinel sizes (not supported in v0.12.7)");
260
+ "central directory entry " + n + " carries ZIP64 sentinel sizes (unsupported use tar for >4 GiB / >65535 entries)");
260
261
  }
261
262
  // ZIP names are CP437 or UTF-8 (per FLAG_UTF8_NAME bit). Decode
262
263
  // as UTF-8 unconditionally — Codex P2 territory if operators in
@@ -425,7 +426,7 @@ async function _decompressEntry(adapter, entry, dataStart, bombPolicy) {
425
426
  }
426
427
  throw new ArchiveReadError("archive-read/unsupported-method",
427
428
  "entry " + JSON.stringify(entry.name) + " uses method=" + entry.method +
428
- " — only STORE (0) and DEFLATE (8) supported in v0.12.7");
429
+ " — only STORE (0) and DEFLATE (8) are supported");
429
430
  }
430
431
 
431
432
  // ---- Public read.zip factory ---------------------------------------------
@@ -668,8 +669,10 @@ function zip(adapter, opts) {
668
669
  // entry-type policy opts in.
669
670
  if (entry.isEncrypted && !extractOpts.allowEncrypted) {
670
671
  throw new ArchiveReadError("archive-read/encrypted-entry",
671
- "entry " + JSON.stringify(entry.name) + " is encrypted — " +
672
- "v0.12.7 does not decrypt; Flavor 1/2/3 land v0.12.10/v0.12.11");
672
+ "entry " + JSON.stringify(entry.name) + " is encrypted — this " +
673
+ "low-level reader does not decrypt; use b.safeArchive for " +
674
+ "encrypted-archive handling, or pass allowEncrypted to extract " +
675
+ "the raw entry");
673
676
  }
674
677
  var typeRefusal = _enforceEntryTypePolicy(entry, entryTypePolicy);
675
678
  if (typeRefusal) {
package/lib/arg-parser.js CHANGED
@@ -53,17 +53,17 @@ function _isPlainNonEmpty(s) {
53
53
 
54
54
  function _validateFlagName(name) {
55
55
  if (!_isPlainNonEmpty(name)) {
56
- throw new ArgParserError("argParser/flag-name-invalid",
56
+ throw new ArgParserError("arg-parser/flag-name-invalid",
57
57
  "flag name must be a non-empty string");
58
58
  }
59
59
  if (FORBIDDEN_NAMES.indexOf(name) !== -1) {
60
- throw new ArgParserError("argParser/flag-name-forbidden",
60
+ throw new ArgParserError("arg-parser/flag-name-forbidden",
61
61
  "flag name '" + name + "' is reserved");
62
62
  }
63
63
  // ASCII-only kebab-/snake-case identifier. Keeps every flag name safe
64
64
  // to embed in help text and prevents `--foo$bar=baz` style oddities.
65
65
  if (!/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(name)) {
66
- throw new ArgParserError("argParser/flag-name-shape",
66
+ throw new ArgParserError("arg-parser/flag-name-shape",
67
67
  "flag name '" + name + "' must match [a-zA-Z][a-zA-Z0-9_-]*");
68
68
  }
69
69
  }
@@ -71,26 +71,26 @@ function _validateFlagName(name) {
71
71
  function _validateAlias(alias, ownerName) {
72
72
  if (alias === undefined || alias === null) return;
73
73
  if (typeof alias !== "string" || alias.length !== 1 || !/^[a-zA-Z]$/.test(alias)) {
74
- throw new ArgParserError("argParser/alias-shape",
74
+ throw new ArgParserError("arg-parser/alias-shape",
75
75
  "flag '" + ownerName + "' alias must be a single letter [a-zA-Z]");
76
76
  }
77
77
  }
78
78
 
79
79
  function _validateFlagSpec(spec, ownerLabel) {
80
80
  if (!spec || typeof spec !== "object") {
81
- throw new ArgParserError("argParser/flag-spec-invalid",
81
+ throw new ArgParserError("arg-parser/flag-spec-invalid",
82
82
  ownerLabel + ": flag spec must be an object");
83
83
  }
84
84
  _validateFlagName(spec.name);
85
85
  _validateAlias(spec.alias, spec.name);
86
86
  var type = spec.type || "string";
87
87
  if (SUPPORTED_TYPES.indexOf(type) === -1) {
88
- throw new ArgParserError("argParser/flag-type-unsupported",
88
+ throw new ArgParserError("arg-parser/flag-type-unsupported",
89
89
  ownerLabel + ": flag '" + spec.name +
90
90
  "' type '" + type + "' must be one of " + SUPPORTED_TYPES.join(", "));
91
91
  }
92
92
  if (spec.description !== undefined && typeof spec.description !== "string") {
93
- throw new ArgParserError("argParser/flag-description-invalid",
93
+ throw new ArgParserError("arg-parser/flag-description-invalid",
94
94
  ownerLabel + ": flag '" + spec.name + "' description must be a string");
95
95
  }
96
96
  }
@@ -101,7 +101,7 @@ function _coerceValue(spec, raw, label) {
101
101
  if (type === "number") {
102
102
  var n = Number(raw);
103
103
  if (!isFinite(n)) {
104
- throw new ArgParserError("argParser/value-not-number",
104
+ throw new ArgParserError("arg-parser/value-not-number",
105
105
  label + " '" + spec.name + "' expected a number, got " + JSON.stringify(raw));
106
106
  }
107
107
  return n;
@@ -112,7 +112,7 @@ function _coerceValue(spec, raw, label) {
112
112
  var s = String(raw).toLowerCase();
113
113
  if (s === "true" || s === "1" || s === "yes") return true;
114
114
  if (s === "false" || s === "0" || s === "no") return false;
115
- throw new ArgParserError("argParser/value-not-boolean",
115
+ throw new ArgParserError("arg-parser/value-not-boolean",
116
116
  label + " '" + spec.name + "' expected boolean, got " + JSON.stringify(raw));
117
117
  }
118
118
  if (type === "list") {
@@ -121,7 +121,7 @@ function _coerceValue(spec, raw, label) {
121
121
  return s2.indexOf(",") === -1 ? [s2] : s2.split(",");
122
122
  }
123
123
  // Unreachable: validated at create-time.
124
- throw new ArgParserError("argParser/type-unreachable",
124
+ throw new ArgParserError("arg-parser/type-unreachable",
125
125
  "unsupported flag type '" + type + "'");
126
126
  }
127
127
 
@@ -132,13 +132,13 @@ function _buildFlagIndex(flagSpecs, ownerLabel) {
132
132
  var spec = flagSpecs[i];
133
133
  _validateFlagSpec(spec, ownerLabel);
134
134
  if (byName[spec.name]) {
135
- throw new ArgParserError("argParser/flag-duplicate",
135
+ throw new ArgParserError("arg-parser/flag-duplicate",
136
136
  ownerLabel + ": flag '" + spec.name + "' declared twice");
137
137
  }
138
138
  byName[spec.name] = spec;
139
139
  if (spec.alias) {
140
140
  if (byAlias[spec.alias]) {
141
- throw new ArgParserError("argParser/alias-duplicate",
141
+ throw new ArgParserError("arg-parser/alias-duplicate",
142
142
  ownerLabel + ": alias '-" + spec.alias + "' declared twice");
143
143
  }
144
144
  byAlias[spec.alias] = spec;
@@ -232,12 +232,12 @@ function _renderCommandHelp(parser, command) {
232
232
  // command-name (the first non-flag token, when commands are configured).
233
233
  function _splitArgv(parser, argv) {
234
234
  if (!Array.isArray(argv)) {
235
- throw new ArgParserError("argParser/argv-not-array",
235
+ throw new ArgParserError("arg-parser/argv-not-array",
236
236
  "argv must be an array of strings");
237
237
  }
238
238
  for (var n = 0; n < argv.length; n++) {
239
239
  if (typeof argv[n] !== "string") {
240
- throw new ArgParserError("argParser/argv-element-not-string",
240
+ throw new ArgParserError("arg-parser/argv-element-not-string",
241
241
  "argv[" + n + "] must be a string");
242
242
  }
243
243
  }
@@ -256,7 +256,7 @@ function _splitArgv(parser, argv) {
256
256
  if (!parser.commands.byName[name]) {
257
257
  // Surface help / version as built-ins even when no command matches.
258
258
  if (name === "help") return { command: "__help__", pre: argv.slice(0, i), rest: argv.slice(i + 1) };
259
- throw new ArgParserError("argParser/unknown-command",
259
+ throw new ArgParserError("arg-parser/unknown-command",
260
260
  "unknown command '" + name + "'");
261
261
  }
262
262
  return { command: name, pre: argv.slice(0, i), rest: argv.slice(i + 1) };
@@ -299,7 +299,7 @@ function _consumeFlags(index, tokens) {
299
299
  if (tok.indexOf("--") === 0) {
300
300
  var rest = tok.slice(2);
301
301
  if (FORBIDDEN_NAMES.indexOf(rest.split("=")[0]) !== -1) {
302
- throw new ArgParserError("argParser/argv-forbidden-name",
302
+ throw new ArgParserError("arg-parser/argv-forbidden-name",
303
303
  "flag '--" + rest.split("=")[0] + "' is reserved");
304
304
  }
305
305
  var eq = rest.indexOf("=");
@@ -313,7 +313,7 @@ function _consumeFlags(index, tokens) {
313
313
  }
314
314
  spec = index.byName[nm];
315
315
  if (!spec) {
316
- throw new ArgParserError("argParser/unknown-flag",
316
+ throw new ArgParserError("arg-parser/unknown-flag",
317
317
  "unknown flag '--" + nm + "'");
318
318
  }
319
319
  } else if (tok.indexOf("-") === 0 && tok.length >= 2) {
@@ -329,12 +329,12 @@ function _consumeFlags(index, tokens) {
329
329
  ach = alias;
330
330
  }
331
331
  if (ach.length !== 1) {
332
- throw new ArgParserError("argParser/short-flag-shape",
332
+ throw new ArgParserError("arg-parser/short-flag-shape",
333
333
  "short flag '" + tok + "' must be a single letter (use --long-form for multi-char names)");
334
334
  }
335
335
  spec = index.byAlias[ach];
336
336
  if (!spec) {
337
- throw new ArgParserError("argParser/unknown-alias",
337
+ throw new ArgParserError("arg-parser/unknown-alias",
338
338
  "unknown short flag '-" + ach + "'");
339
339
  }
340
340
  } else {
@@ -349,7 +349,7 @@ function _consumeFlags(index, tokens) {
349
349
  } else {
350
350
  if (!hasInlineValue) {
351
351
  if (i + 1 >= tokens.length) {
352
- throw new ArgParserError("argParser/value-missing",
352
+ throw new ArgParserError("arg-parser/value-missing",
353
353
  "flag '--" + spec.name + "' requires a value");
354
354
  }
355
355
  rawValue = tokens[++i];
@@ -377,7 +377,7 @@ function _applyDefaultsAndRequired(specs, flags, ownerLabel) {
377
377
  for (var k = 0; k < specs.length; k++) {
378
378
  var s = specs[k];
379
379
  if (s.required && flags[s.name] === undefined) {
380
- throw new ArgParserError("argParser/missing-required",
380
+ throw new ArgParserError("arg-parser/missing-required",
381
381
  ownerLabel + ": flag '--" + s.name + "' is required");
382
382
  }
383
383
  }
@@ -385,23 +385,23 @@ function _applyDefaultsAndRequired(specs, flags, ownerLabel) {
385
385
 
386
386
  function _validateCommandSpec(cmd) {
387
387
  if (!cmd || typeof cmd !== "object") {
388
- throw new ArgParserError("argParser/command-spec-invalid",
388
+ throw new ArgParserError("arg-parser/command-spec-invalid",
389
389
  "command spec must be an object");
390
390
  }
391
391
  if (!_isPlainNonEmpty(cmd.name)) {
392
- throw new ArgParserError("argParser/command-name-invalid",
392
+ throw new ArgParserError("arg-parser/command-name-invalid",
393
393
  "command name must be a non-empty string");
394
394
  }
395
395
  if (!/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(cmd.name)) {
396
- throw new ArgParserError("argParser/command-name-shape",
396
+ throw new ArgParserError("arg-parser/command-name-shape",
397
397
  "command name '" + cmd.name + "' must match [a-zA-Z][a-zA-Z0-9_-]*");
398
398
  }
399
399
  if (cmd.handler !== undefined && typeof cmd.handler !== "function") {
400
- throw new ArgParserError("argParser/command-handler-not-function",
400
+ throw new ArgParserError("arg-parser/command-handler-not-function",
401
401
  "command '" + cmd.name + "' handler must be a function");
402
402
  }
403
403
  if (cmd.description !== undefined && typeof cmd.description !== "string") {
404
- throw new ArgParserError("argParser/command-description-invalid",
404
+ throw new ArgParserError("arg-parser/command-description-invalid",
405
405
  "command '" + cmd.name + "' description must be a string");
406
406
  }
407
407
  }
@@ -465,29 +465,29 @@ function _validateCommandSpec(cmd) {
465
465
  */
466
466
  function create(opts) {
467
467
  if (!opts || typeof opts !== "object") {
468
- throw new ArgParserError("argParser/opts-required",
468
+ throw new ArgParserError("arg-parser/opts-required",
469
469
  "argParser.create requires an opts object");
470
470
  }
471
471
  var programName = opts.programName;
472
472
  if (programName !== undefined && typeof programName !== "string") {
473
- throw new ArgParserError("argParser/program-name-invalid",
473
+ throw new ArgParserError("arg-parser/program-name-invalid",
474
474
  "programName must be a string");
475
475
  }
476
476
  var description = opts.description;
477
477
  if (description !== undefined && typeof description !== "string") {
478
- throw new ArgParserError("argParser/description-invalid",
478
+ throw new ArgParserError("arg-parser/description-invalid",
479
479
  "description must be a string");
480
480
  }
481
481
  var topFlagsSpec = opts.flags || [];
482
482
  if (!Array.isArray(topFlagsSpec)) {
483
- throw new ArgParserError("argParser/flags-not-array",
483
+ throw new ArgParserError("arg-parser/flags-not-array",
484
484
  "flags must be an array");
485
485
  }
486
486
  var topFlags = _buildFlagIndex(topFlagsSpec, "top-level");
487
487
 
488
488
  var commandsSpec = opts.commands || [];
489
489
  if (!Array.isArray(commandsSpec)) {
490
- throw new ArgParserError("argParser/commands-not-array",
490
+ throw new ArgParserError("arg-parser/commands-not-array",
491
491
  "commands must be an array");
492
492
  }
493
493
  var commandsByName = Object.create(null);
@@ -496,12 +496,12 @@ function create(opts) {
496
496
  var c = commandsSpec[i];
497
497
  _validateCommandSpec(c);
498
498
  if (commandsByName[c.name]) {
499
- throw new ArgParserError("argParser/command-duplicate",
499
+ throw new ArgParserError("arg-parser/command-duplicate",
500
500
  "command '" + c.name + "' declared twice");
501
501
  }
502
502
  var cmdFlagsSpec = c.flags || [];
503
503
  if (!Array.isArray(cmdFlagsSpec)) {
504
- throw new ArgParserError("argParser/command-flags-not-array",
504
+ throw new ArgParserError("arg-parser/command-flags-not-array",
505
505
  "command '" + c.name + "' flags must be an array");
506
506
  }
507
507
  var cmdFlags = _buildFlagIndex(cmdFlagsSpec, "command '" + c.name + "'");
@@ -526,7 +526,7 @@ function create(opts) {
526
526
  if (commandName) {
527
527
  var cmd = commandsByName[commandName];
528
528
  if (!cmd) {
529
- throw new ArgParserError("argParser/help-unknown-command",
529
+ throw new ArgParserError("arg-parser/help-unknown-command",
530
530
  "no command named '" + commandName + "'");
531
531
  }
532
532
  return _renderCommandHelp(parser, cmd);
@@ -645,7 +645,7 @@ function create(opts) {
645
645
  */
646
646
  function parseRaw(argv) {
647
647
  if (!Array.isArray(argv)) {
648
- throw new ArgParserError("argParser/argv-not-array",
648
+ throw new ArgParserError("arg-parser/argv-not-array",
649
649
  "argv must be an array of strings");
650
650
  }
651
651
  var pos = [];
@@ -653,7 +653,7 @@ function parseRaw(argv) {
653
653
  for (var i = 0; i < argv.length; i++) {
654
654
  var tok = argv[i];
655
655
  if (typeof tok !== "string") {
656
- throw new ArgParserError("argParser/argv-element-not-string",
656
+ throw new ArgParserError("arg-parser/argv-element-not-string",
657
657
  "argv[" + i + "] must be a string");
658
658
  }
659
659
  if (tok === "--") {
@@ -673,14 +673,14 @@ function parseRaw(argv) {
673
673
  val = true;
674
674
  }
675
675
  if (FORBIDDEN_NAMES.indexOf(name) !== -1) {
676
- throw new ArgParserError("argParser/argv-forbidden-name",
676
+ throw new ArgParserError("arg-parser/argv-forbidden-name",
677
677
  "flag '--" + name + "' is reserved");
678
678
  }
679
679
  flags[name] = val;
680
680
  } else if (tok.indexOf("-") === 0 && tok.length === 2) {
681
681
  var s = tok.slice(1);
682
682
  if (FORBIDDEN_NAMES.indexOf(s) !== -1) {
683
- throw new ArgParserError("argParser/argv-forbidden-name",
683
+ throw new ArgParserError("arg-parser/argv-forbidden-name",
684
684
  "flag '-" + s + "' is reserved");
685
685
  }
686
686
  flags[s] = true;
package/lib/audit-sign.js CHANGED
@@ -178,13 +178,13 @@ var pendingNewKeyAlg = null;
178
178
  async function init(opts) {
179
179
  if (initialized) return;
180
180
  if (!opts || !opts.dataDir) {
181
- throw new AuditSignError("auditSign/bad-init",
181
+ throw new AuditSignError("audit-sign/bad-init",
182
182
  "auditSign.init({ dataDir }) is required");
183
183
  }
184
184
 
185
185
  var mode = (opts.mode || "wrapped").toLowerCase();
186
186
  if (mode !== "wrapped" && mode !== "plaintext") {
187
- throw new AuditSignError("auditSign/bad-mode",
187
+ throw new AuditSignError("audit-sign/bad-mode",
188
188
  "auditSign.init: mode must be 'wrapped' or 'plaintext'");
189
189
  }
190
190
  // Algorithm-on-generate. Validated against the supported list so
@@ -192,7 +192,7 @@ async function init(opts) {
192
192
  // deeper in nodeCrypto.
193
193
  var alg = (opts.algorithm || DEFAULT_SIGNING_ALG).toLowerCase();
194
194
  if (SUPPORTED_SIGNING_ALGS.indexOf(alg) === -1) {
195
- throw new AuditSignError("auditSign/bad-algorithm",
195
+ throw new AuditSignError("audit-sign/bad-algorithm",
196
196
  "auditSign.init: algorithm must be one of " +
197
197
  SUPPORTED_SIGNING_ALGS.join(", ") + " (got: " + alg + ")");
198
198
  }
@@ -341,7 +341,7 @@ async function _initFirstRunWrapped() {
341
341
 
342
342
  function _requireInit() {
343
343
  if (!initialized) {
344
- throw new AuditSignError("auditSign/not-initialized",
344
+ throw new AuditSignError("audit-sign/not-initialized",
345
345
  "auditSign.init() must be awaited before sign/verify");
346
346
  }
347
347
  }
@@ -144,14 +144,14 @@ function register(opts) {
144
144
  opts = opts || {};
145
145
  validateOpts(opts, ["value", "rank"], "auth.acr.register");
146
146
  validateOpts.requireNonEmptyString(opts.value, "register: value",
147
- AuthError, "auth-stepUp/bad-acr");
147
+ AuthError, "auth-step-up/bad-acr");
148
148
  if (typeof opts.rank !== "number" || !isFinite(opts.rank)) {
149
- throw new AuthError("auth-stepUp/bad-rank",
149
+ throw new AuthError("auth-step-up/bad-rank",
150
150
  "auth.acr.register: rank must be a finite number — got " +
151
151
  JSON.stringify(opts.rank));
152
152
  }
153
153
  if (opts.rank < 0 || opts.rank > 100) {
154
- throw new AuthError("auth-stepUp/bad-rank",
154
+ throw new AuthError("auth-step-up/bad-rank",
155
155
  "auth.acr.register: rank must be in [0, 100] — got " + opts.rank);
156
156
  }
157
157
  _registry[opts.value] = opts.rank;
@@ -192,7 +192,7 @@ function meets(presented, required) {
192
192
  var rp = rankOf(presented);
193
193
  var rr = rankOf(required);
194
194
  if (rr === -1) {
195
- throw new AuthError("auth-stepUp/unknown-acr",
195
+ throw new AuthError("auth-step-up/unknown-acr",
196
196
  "auth.acr.meets: required acr is not registered (call b.auth.acr.register first): " +
197
197
  JSON.stringify(required));
198
198
  }
@@ -58,7 +58,7 @@ function ageSec(claims, now) {
58
58
 
59
59
  function freshEnough(claims, maxAgeSec, now) {
60
60
  if (typeof maxAgeSec !== "number" || !isFinite(maxAgeSec) || maxAgeSec < 0) {
61
- throw new AuthError("auth-stepUp/bad-max-age",
61
+ throw new AuthError("auth-step-up/bad-max-age",
62
62
  "auth.authTime.freshEnough: maxAgeSec must be a finite number >= 0 — got " +
63
63
  JSON.stringify(maxAgeSec));
64
64
  }
@@ -58,7 +58,7 @@ function _ensureSigningKey() {
58
58
 
59
59
  function setSigningKey(keyBuffer) {
60
60
  if (!Buffer.isBuffer(keyBuffer) || keyBuffer.length < MIN_KEY_BYTES) {
61
- throw new AuthError("auth-stepUp/bad-key",
61
+ throw new AuthError("auth-step-up/bad-key",
62
62
  "auth.stepUp.grant.setSigningKey: keyBuffer must be a Buffer of >= " +
63
63
  MIN_KEY_BYTES + " bytes");
64
64
  }
@@ -92,37 +92,37 @@ function create(opts) {
92
92
  "ttlSec", "audience", "now",
93
93
  ], "auth.stepUp.grant.create");
94
94
  validateOpts.requireNonEmptyString(opts.subject,
95
- "grant.create: subject", AuthError, "auth-stepUp/bad-grant");
95
+ "grant.create: subject", AuthError, "auth-step-up/bad-grant");
96
96
  validateOpts.requireNonEmptyString(opts.scope,
97
- "grant.create: scope", AuthError, "auth-stepUp/bad-grant");
97
+ "grant.create: scope", AuthError, "auth-step-up/bad-grant");
98
98
  if (opts.acr != null) {
99
99
  validateOpts.requireNonEmptyString(opts.acr,
100
- "grant.create: acr", AuthError, "auth-stepUp/bad-grant");
100
+ "grant.create: acr", AuthError, "auth-step-up/bad-grant");
101
101
  }
102
102
  if (opts.amr != null) {
103
103
  if (!Array.isArray(opts.amr)) {
104
- throw new AuthError("auth-stepUp/bad-grant",
104
+ throw new AuthError("auth-step-up/bad-grant",
105
105
  "grant.create: amr must be an array — got " + typeof opts.amr);
106
106
  }
107
107
  for (var i = 0; i < opts.amr.length; i += 1) {
108
108
  if (typeof opts.amr[i] !== "string") {
109
- throw new AuthError("auth-stepUp/bad-grant",
109
+ throw new AuthError("auth-step-up/bad-grant",
110
110
  "grant.create: amr[" + i + "] must be a string");
111
111
  }
112
112
  }
113
113
  }
114
114
  if (opts.audience != null) {
115
115
  validateOpts.requireNonEmptyString(opts.audience,
116
- "grant.create: audience", AuthError, "auth-stepUp/bad-grant");
116
+ "grant.create: audience", AuthError, "auth-step-up/bad-grant");
117
117
  }
118
118
  var ttlSec = (typeof opts.ttlSec === "number") ? opts.ttlSec : DEFAULT_TTL_SEC;
119
119
  if (!isFinite(ttlSec) || ttlSec < MIN_TTL_SEC) {
120
- throw new AuthError("auth-stepUp/bad-grant",
120
+ throw new AuthError("auth-step-up/bad-grant",
121
121
  "grant.create: ttlSec must be a finite number >= " +
122
122
  MIN_TTL_SEC + " — got " + JSON.stringify(opts.ttlSec));
123
123
  }
124
124
  if (ttlSec > MAX_TTL_SEC) {
125
- throw new AuthError("auth-stepUp/bad-grant",
125
+ throw new AuthError("auth-step-up/bad-grant",
126
126
  "grant.create: ttlSec must be <= " + MAX_TTL_SEC +
127
127
  " (1h hard ceiling) — got " + ttlSec);
128
128
  }
@@ -247,7 +247,7 @@ function revoke(jti, opts) {
247
247
  opts = opts || {};
248
248
  validateOpts(opts, ["reason"], "auth.stepUp.grant.revoke");
249
249
  if (typeof jti !== "string" || jti.length === 0) {
250
- throw new AuthError("auth-stepUp/bad-jti",
250
+ throw new AuthError("auth-step-up/bad-jti",
251
251
  "grant.revoke: jti must be a non-empty string — got " + JSON.stringify(jti));
252
252
  }
253
253
  _revokedSet[jti] = true;
@@ -59,7 +59,7 @@ function _mkNode(spec) {
59
59
  }
60
60
 
61
61
  function acr(value) {
62
- validateOpts.requireNonEmptyString(value, "policy.acr: value", AuthError, "auth-stepUp/bad-acr");
62
+ validateOpts.requireNonEmptyString(value, "policy.acr: value", AuthError, "auth-step-up/bad-acr");
63
63
  return _mkNode({
64
64
  kind: "acr",
65
65
  value: value,
@@ -76,12 +76,12 @@ function acr(value) {
76
76
 
77
77
  function acrAny(values) {
78
78
  if (!Array.isArray(values) || values.length === 0) {
79
- throw new AuthError("auth-stepUp/bad-policy",
79
+ throw new AuthError("auth-step-up/bad-policy",
80
80
  "policy.acrAny: values must be a non-empty array");
81
81
  }
82
82
  for (var i = 0; i < values.length; i += 1) {
83
83
  validateOpts.requireNonEmptyString(values[i],
84
- "policy.acrAny: values[" + i + "]", AuthError, "auth-stepUp/bad-acr");
84
+ "policy.acrAny: values[" + i + "]", AuthError, "auth-step-up/bad-acr");
85
85
  }
86
86
  var copy = values.slice();
87
87
  return _mkNode({
@@ -100,12 +100,12 @@ function acrAny(values) {
100
100
 
101
101
  function amr(required) {
102
102
  if (!Array.isArray(required) || required.length === 0) {
103
- throw new AuthError("auth-stepUp/bad-policy",
103
+ throw new AuthError("auth-step-up/bad-policy",
104
104
  "policy.amr: required must be a non-empty array");
105
105
  }
106
106
  for (var i = 0; i < required.length; i += 1) {
107
107
  validateOpts.requireNonEmptyString(required[i],
108
- "policy.amr: required[" + i + "]", AuthError, "auth-stepUp/bad-amr");
108
+ "policy.amr: required[" + i + "]", AuthError, "auth-step-up/bad-amr");
109
109
  }
110
110
  var copy = required.slice();
111
111
  return _mkNode({
@@ -138,7 +138,7 @@ function phishingResistant() {
138
138
 
139
139
  function maxAge(seconds) {
140
140
  if (typeof seconds !== "number" || !isFinite(seconds) || seconds < 0) {
141
- throw new AuthError("auth-stepUp/bad-policy",
141
+ throw new AuthError("auth-step-up/bad-policy",
142
142
  "policy.maxAge: seconds must be a finite number >= 0 — got " +
143
143
  JSON.stringify(seconds));
144
144
  }
@@ -157,9 +157,9 @@ function maxAge(seconds) {
157
157
  }
158
158
 
159
159
  function custom(name, fn) {
160
- validateOpts.requireNonEmptyString(name, "policy.custom: name", AuthError, "auth-stepUp/bad-policy");
160
+ validateOpts.requireNonEmptyString(name, "policy.custom: name", AuthError, "auth-step-up/bad-policy");
161
161
  if (typeof fn !== "function") {
162
- throw new AuthError("auth-stepUp/bad-policy",
162
+ throw new AuthError("auth-step-up/bad-policy",
163
163
  "policy.custom: fn must be a function — got " + typeof fn);
164
164
  }
165
165
  return _mkNode({
@@ -171,7 +171,7 @@ function custom(name, fn) {
171
171
  return { ok: ok, atom: "custom:" + name, reason: ok ? null : "custom predicate '" + name + "' returned false" };
172
172
  },
173
173
  _toReq: function () {
174
- throw new AuthError("auth-stepUp/policy-no-challenge",
174
+ throw new AuthError("auth-step-up/policy-no-challenge",
175
175
  "policy.custom: cannot translate to RFC 9470 challenge — wrap in .or() with a translatable atom or use .middleware({ requirement: ... })");
176
176
  },
177
177
  });
@@ -231,7 +231,7 @@ function _not(inner) {
231
231
  return { ok: !i.ok, atom: "not(" + i.atom + ")", reason: i.ok ? "not(" + i.atom + ") matched" : null };
232
232
  },
233
233
  _toReq: function () {
234
- throw new AuthError("auth-stepUp/policy-no-challenge",
234
+ throw new AuthError("auth-step-up/policy-no-challenge",
235
235
  "policy.not: cannot translate to RFC 9470 challenge");
236
236
  },
237
237
  });
@@ -241,7 +241,7 @@ function _mergeAnd(a, b) {
241
241
  var out = {};
242
242
  if (a.acr || b.acr) {
243
243
  if (a.acr && b.acr && a.acr !== b.acr) {
244
- throw new AuthError("auth-stepUp/policy-conflict",
244
+ throw new AuthError("auth-step-up/policy-conflict",
245
245
  "policy.and: conflicting acr requirements " +
246
246
  JSON.stringify(a.acr) + " and " + JSON.stringify(b.acr));
247
247
  }
@@ -311,7 +311,7 @@ var PRESETS = {
311
311
 
312
312
  function preset(name) {
313
313
  if (!Object.prototype.hasOwnProperty.call(PRESETS, name)) {
314
- throw new AuthError("auth-stepUp/bad-preset",
314
+ throw new AuthError("auth-step-up/bad-preset",
315
315
  "policy.preset: unknown preset " + JSON.stringify(name) +
316
316
  " — valid presets: " + Object.keys(PRESETS).join(", "));
317
317
  }