@bakobo/fiki 0.6.0 → 0.7.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bakobo/fiki",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "Sign and verify HTTP requests with a bare Ed25519 key as the identifier. Standard RFC 9421, no KERI dependencies.",
5
5
  "keywords": [
6
6
  "rfc9421",
package/src/index.js CHANGED
@@ -15,7 +15,7 @@ export const VECTORS_FORMAT = 1;
15
15
  // The KERI profile's own conformance contract, vectors/keri/ (`this.i` @8vwrexxc, @9enyfktu). A
16
16
  // separate number from VECTORS_FORMAT, because the two sets answer to different authorities and
17
17
  // move independently.
18
- export const KERI_VECTORS_FORMAT = 2;
18
+ export const KERI_VECTORS_FORMAT = 3;
19
19
 
20
20
  export * as errors from './errors.js';
21
21
  export { FikiError } from './errors.js';
package/src/messages.js CHANGED
@@ -313,7 +313,9 @@ export async function signResponse({
313
313
  * `Content-Length` above zero, any `Transfer-Encoding`, or simply arriving — without a covered
314
314
  * `content-digest` (@7f28p7xk). `null` enforces no minimum, body rule included. `expectedKeyid`
315
315
  * refuses a signature by any other keyid as UnknownKey. `authorities` is the set of `@authority`
316
- * values this verifier serves; a covered `@authority` outside it is a SignatureMismatch.
316
+ * values this verifier serves; a covered `@authority` outside it is a SignatureMismatch, and
317
+ * supplying it makes `@authority` required, so a signature that does not cover it is
318
+ * InsufficientCoverage (@605z9tnw).
317
319
  */
318
320
  export async function verifyRequest({
319
321
  method,
@@ -429,6 +431,9 @@ async function verify(message, headers, body, options) {
429
431
  requestHadBody: request !== null && hasContent(request.body),
430
432
  });
431
433
  }
434
+ // Served authorities bind the signature to a host only if it commits to one, so supplying
435
+ // them makes @authority required (@605z9tnw): coverage, before the key, as section 9 orders.
436
+ if (authorities !== null) checkMinimum(items, ['@authority'], { hasBody: false, requestHadBody: false });
432
437
 
433
438
  const received = inner.params.get('keyid') ?? null;
434
439
  const { raw, aid, keyid } = await resolveKey(expectedAid, received, resolve, expectedKeyid);