From 3c5d8aef67b61194af890996b6af55744ec063d3 Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Tue, 18 Mar 2025 14:34:16 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20align=20implicit=20default=20ttl=20with?= =?UTF-8?q?=20specs=20(1h=E2=86=925m)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Same rationale as https://github.com/ipfs/helia/pull/749 --- src/index.ts | 2 +- test/index.spec.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/index.ts b/src/index.ts index da8b321..43b8be0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -11,7 +11,7 @@ import type { CID } from 'multiformats/cid' import type { MultihashDigest } from 'multiformats/hashes/interface' const log = logger('ipns') -const DEFAULT_TTL_NS = 60 * 60 * 1e+9 // 1 Hour or 3600 Seconds +const DEFAULT_TTL_NS = 5 * 60 * 1e+9 // 5 Minutes or 300 Seconds, as suggested by https://specs.ipfs.tech/ipns/ipns-record/#ttl-uint64 export const namespace = '/ipns/' export const namespaceLength = namespace.length diff --git a/test/index.spec.ts b/test/index.spec.ts index 6b9497c..9f3a89e 100644 --- a/test/index.spec.ts +++ b/test/index.spec.ts @@ -31,7 +31,7 @@ describe('ipns', function () { it('should create an ipns record (V1+V2) correctly', async () => { const sequence = 0 - const ttl = BigInt(60 * 60 * 1e+9) + const ttl = BigInt(5 * 60 * 1e+9) const validity = 1000000 const record = await createIPNSRecord(privateKey, contentPath, sequence, validity) @@ -67,7 +67,7 @@ describe('ipns', function () { it('should create an ipns record (V2) correctly', async () => { const sequence = 0 - const ttl = BigInt(60 * 60 * 1e+9) + const ttl = BigInt(5 * 60 * 1e+9) const validity = 1000000 const record = await createIPNSRecord(privateKey, contentPath, sequence, validity, { v1Compatible: false })