@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
|
-
|
|
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
package/dist/key-proof/index.js
CHANGED