Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: align implicit default ttl with specs (1h→5m) #336

Merged
merged 1 commit into from
Mar 18, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions test/index.spec.ts
Original file line number Diff line number Diff line change
@@ -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 })