Skip to content

Commit 6c36281

Browse files
committed
chore(ipns): align implicit default ttl with specs
lowering TTL to 5m due to ipfs/specs#492 lifetime is validity of signature, and that should be fine up to 48h, to match DHT expiration window
1 parent 45ca6bc commit 6c36281

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

packages/ipns/src/index.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -284,10 +284,10 @@ const log = logger('helia:ipns')
284284
const MINUTE = 60 * 1000
285285
const HOUR = 60 * MINUTE
286286

287-
const DEFAULT_LIFETIME_MS = 24 * HOUR
287+
const DEFAULT_LIFETIME_MS = 48 * HOUR
288288
const DEFAULT_REPUBLISH_INTERVAL_MS = 23 * HOUR
289289

290-
const DEFAULT_TTL_NS = BigInt(HOUR) * 1_000_000n
290+
const DEFAULT_TTL_NS = BigInt(MINUTE) * 5 * 1_000_000n
291291

292292
export type PublishProgressEvents =
293293
ProgressEvent<'ipns:publish:start'> |
@@ -311,7 +311,7 @@ export type ResolveDNSLinkProgressEvents =
311311

312312
export interface PublishOptions extends AbortOptions, ProgressOptions<PublishProgressEvents | IPNSRoutingEvents> {
313313
/**
314-
* Time duration of the record in ms (default: 24hrs)
314+
* Time duration of the signature validity in ms (default: 48hrs)
315315
*/
316316
lifetime?: number
317317

@@ -327,7 +327,7 @@ export interface PublishOptions extends AbortOptions, ProgressOptions<PublishPro
327327
v1Compatible?: boolean
328328

329329
/**
330-
* The TTL of the record in ms (default: 1 hour)
330+
* The TTL of the record in ms (default: 5 minutes)
331331
*/
332332
ttl?: number
333333
}

packages/ipns/test/publish.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ describe('publish', () => {
4545
const ipnsEntry = await name.publish(key, cid)
4646

4747
expect(ipnsEntry).to.have.property('sequence', 1n)
48-
expect(ipnsEntry).to.have.property('ttl', 3_600_000_000_000n) // 1 hour
48+
expect(ipnsEntry).to.have.property('ttl', 300_000_000_000n) // 5 minutes
4949
})
5050

5151
it('should publish an IPNS record with a custom lifetime params', async function () {

0 commit comments

Comments
 (0)