@orangecheck/sdk 1.16.0 → 1.16.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/dist/attestation.d.mts +1 -1
- package/dist/attestation.d.ts +1 -1
- package/dist/attestation.js.map +1 -1
- package/dist/attestation.mjs.map +1 -1
- package/dist/canonical.d.mts +1 -1
- package/dist/canonical.d.ts +1 -1
- package/dist/challenge.d.mts +1 -1
- package/dist/challenge.d.ts +1 -1
- package/dist/identity.d.mts +1 -1
- package/dist/identity.d.ts +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +15 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -1
- package/dist/index.mjs.map +1 -1
- package/dist/nostr.d.mts +1 -1
- package/dist/nostr.d.ts +1 -1
- package/dist/nostr.js.map +1 -1
- package/dist/nostr.mjs.map +1 -1
- package/dist/{types-BBRMCgMo.d.mts → types-DsrYs3EB.d.mts} +1 -1
- package/dist/{types-BBRMCgMo.d.ts → types-DsrYs3EB.d.ts} +1 -1
- package/dist/verify.d.mts +1 -1
- package/dist/verify.d.ts +1 -1
- package/dist/verify.js +10 -0
- package/dist/verify.js.map +1 -1
- package/dist/verify.mjs +10 -0
- package/dist/verify.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -213,6 +213,7 @@ function logVerificationError(protocol, identifier, error, context) {
|
|
|
213
213
|
}
|
|
214
214
|
|
|
215
215
|
// src/utils/time.ts
|
|
216
|
+
var ISSUED_AHEAD_MS = 12e4;
|
|
216
217
|
var RFC3339 = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/;
|
|
217
218
|
function rfc3339Ms(value) {
|
|
218
219
|
if (!value || !RFC3339.test(value)) return null;
|
|
@@ -451,6 +452,15 @@ async function verify(input, opts = {}) {
|
|
|
451
452
|
return { ok: false, codes, network, attestation_id };
|
|
452
453
|
}
|
|
453
454
|
}
|
|
455
|
+
const issued = rfc3339Ms(parsed.core.issued_at);
|
|
456
|
+
if (issued === null) {
|
|
457
|
+
codes.push("decode_error");
|
|
458
|
+
return { ok: false, codes, network, attestation_id };
|
|
459
|
+
}
|
|
460
|
+
if (issued > Date.now() + ISSUED_AHEAD_MS) {
|
|
461
|
+
codes.push("not_yet_valid");
|
|
462
|
+
return { ok: false, codes, network, attestation_id };
|
|
463
|
+
}
|
|
454
464
|
if (parsed.expires !== void 0) {
|
|
455
465
|
const exp = rfc3339Ms(parsed.expires);
|
|
456
466
|
if (exp === null || exp < Date.now()) {
|
|
@@ -1179,7 +1189,6 @@ function extractAttestationIdFromUrl(url) {
|
|
|
1179
1189
|
}
|
|
1180
1190
|
|
|
1181
1191
|
// src/check.ts
|
|
1182
|
-
var ISSUED_AHEAD_MS = 12e4;
|
|
1183
1192
|
var MAX_CANDIDATES = 20;
|
|
1184
1193
|
async function check(params) {
|
|
1185
1194
|
const {
|
|
@@ -2359,6 +2368,11 @@ var STATUS_META = {
|
|
|
2359
2368
|
detail: "This signature has passed its expiration date. Generate a new signature with a fresh message.",
|
|
2360
2369
|
severity: "error"
|
|
2361
2370
|
},
|
|
2371
|
+
not_yet_valid: {
|
|
2372
|
+
label: "Not valid yet",
|
|
2373
|
+
detail: "The message is dated ahead of this clock. It counts once that time arrives, or once a clock that is wrong is set right.",
|
|
2374
|
+
severity: "error"
|
|
2375
|
+
},
|
|
2362
2376
|
network_testmode: {
|
|
2363
2377
|
label: "Test network detected",
|
|
2364
2378
|
detail: "This signature uses testnet or signet. Test networks are for development only and cannot be verified in production mode.",
|