@metalabel/dfos-protocol 0.41.0 → 0.43.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.
@@ -54,7 +54,8 @@ var validateKeyProofPayload = (value) => {
54
54
  if (audience !== audience.toLowerCase() || /[\s/\\?#]/.test(audience)) {
55
55
  throw invalid("schema", "audience must be a lowercase authority, without a scheme or path");
56
56
  }
57
- if (!WHOLE_SECOND_TIMESTAMP.test(timestamp) || !Number.isFinite(Date.parse(timestamp))) {
57
+ const parsedMs = WHOLE_SECOND_TIMESTAMP.test(timestamp) ? Date.parse(timestamp) : Number.NaN;
58
+ if (!Number.isFinite(parsedMs) || new Date(parsedMs).toISOString() !== timestamp) {
58
59
  throw invalid("schema", "timestamp must be ISO-8601 UTC whole-second .000Z");
59
60
  }
60
61
  return { nonce, audience, publicKeyMultibase, timestamp };
@@ -99,6 +100,9 @@ var signKeyProof = async (input) => {
99
100
  return { proof, payload };
100
101
  };
101
102
  var verifyKeyProof = (jws, options) => {
103
+ if (options.expectedTyp === "") {
104
+ throw new Error("invalid key proof verifier: expectedTyp must be a registered purpose value");
105
+ }
102
106
  const maxSkew = options.maxSkewSeconds ?? DEFAULT_KEY_PROOF_SKEW_SECONDS;
103
107
  if (!Number.isSafeInteger(maxSkew) || maxSkew < 0) {
104
108
  throw new Error("invalid key proof verifier: maxSkewSeconds must be a non-negative integer");
package/dist/index.js CHANGED
@@ -95,7 +95,7 @@ import {
95
95
  keyProofSigningInput,
96
96
  signKeyProof,
97
97
  verifyKeyProof
98
- } from "./chunk-73YLK7GK.js";
98
+ } from "./chunk-WCYN7BV7.js";
99
99
  import {
100
100
  ED25519_PRIV_MULTICODEC,
101
101
  ED25519_PUB_MULTICODEC,
@@ -6,7 +6,7 @@ import {
6
6
  keyProofSigningInput,
7
7
  signKeyProof,
8
8
  verifyKeyProof
9
- } from "../chunk-73YLK7GK.js";
9
+ } from "../chunk-WCYN7BV7.js";
10
10
  import "../chunk-IDVYITX7.js";
11
11
  import "../chunk-4LG2GEB2.js";
12
12
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metalabel/dfos-protocol",
3
- "version": "0.41.0",
3
+ "version": "0.43.0",
4
4
  "type": "module",
5
5
  "description": "DFOS Protocol — Ed25519 signed chain primitives, services, credentials, and verification",
6
6
  "license": "MIT",