@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.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as VerifyOptions, I as IdentityBinding, N as Network, c as NostrEvent, d as StatusCode } from './types-
|
|
2
|
-
export { A as AttestationEnvelope, e as IdentityProtocol, M as Metrics, S as Scheme, V as VerifyInput, b as VerifyOutcome } from './types-
|
|
1
|
+
import { a as VerifyOptions, I as IdentityBinding, N as Network, c as NostrEvent, d as StatusCode } from './types-DsrYs3EB.js';
|
|
2
|
+
export { A as AttestationEnvelope, e as IdentityProtocol, M as Metrics, S as Scheme, V as VerifyInput, b as VerifyOutcome } from './types-DsrYs3EB.js';
|
|
3
3
|
export { signatureIsValid, verify } from './verify.js';
|
|
4
4
|
export { createAttestation, discoverAttestations, extractAttestationIdFromUrl, formatIdentitiesForDisplay, getAttestationsForAddress, getAttestationsForIdentity, getVerificationUrl, publishAttestation, verifyAttestationById } from './attestation.js';
|
|
5
5
|
export { Challenge, IssueChallengeOptions, VerifyChallengeOptions, VerifyChallengeReason, VerifyChallengeResult, issueChallenge, verifyChallenge } from './challenge.js';
|
package/dist/index.js
CHANGED
|
@@ -215,6 +215,7 @@ function logVerificationError(protocol, identifier, error, context) {
|
|
|
215
215
|
}
|
|
216
216
|
|
|
217
217
|
// src/utils/time.ts
|
|
218
|
+
var ISSUED_AHEAD_MS = 12e4;
|
|
218
219
|
var RFC3339 = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/;
|
|
219
220
|
function rfc3339Ms(value) {
|
|
220
221
|
if (!value || !RFC3339.test(value)) return null;
|
|
@@ -453,6 +454,15 @@ async function verify(input, opts = {}) {
|
|
|
453
454
|
return { ok: false, codes, network, attestation_id };
|
|
454
455
|
}
|
|
455
456
|
}
|
|
457
|
+
const issued = rfc3339Ms(parsed.core.issued_at);
|
|
458
|
+
if (issued === null) {
|
|
459
|
+
codes.push("decode_error");
|
|
460
|
+
return { ok: false, codes, network, attestation_id };
|
|
461
|
+
}
|
|
462
|
+
if (issued > Date.now() + ISSUED_AHEAD_MS) {
|
|
463
|
+
codes.push("not_yet_valid");
|
|
464
|
+
return { ok: false, codes, network, attestation_id };
|
|
465
|
+
}
|
|
456
466
|
if (parsed.expires !== void 0) {
|
|
457
467
|
const exp = rfc3339Ms(parsed.expires);
|
|
458
468
|
if (exp === null || exp < Date.now()) {
|
|
@@ -1181,7 +1191,6 @@ function extractAttestationIdFromUrl(url) {
|
|
|
1181
1191
|
}
|
|
1182
1192
|
|
|
1183
1193
|
// src/check.ts
|
|
1184
|
-
var ISSUED_AHEAD_MS = 12e4;
|
|
1185
1194
|
var MAX_CANDIDATES = 20;
|
|
1186
1195
|
async function check(params) {
|
|
1187
1196
|
const {
|
|
@@ -2361,6 +2370,11 @@ var STATUS_META = {
|
|
|
2361
2370
|
detail: "This signature has passed its expiration date. Generate a new signature with a fresh message.",
|
|
2362
2371
|
severity: "error"
|
|
2363
2372
|
},
|
|
2373
|
+
not_yet_valid: {
|
|
2374
|
+
label: "Not valid yet",
|
|
2375
|
+
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.",
|
|
2376
|
+
severity: "error"
|
|
2377
|
+
},
|
|
2364
2378
|
network_testmode: {
|
|
2365
2379
|
label: "Test network detected",
|
|
2366
2380
|
detail: "This signature uses testnet or signet. Test networks are for development only and cannot be verified in production mode.",
|