Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Daniel Norman <[email protected]>
  • Loading branch information
jtsmedley and 2color authored Apr 1, 2024
1 parent ffafe6d commit 0f3837f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import type { CID } from 'multiformats/cid'

const log = logger('ipns')
const ID_MULTIHASH_CODE = identity.code
const DEFAULT_TTL_NS = BigInt(3.6e+12) // 1 Hour or 3600 Seconds
const DEFAULT_TTL_NS = 60 * 60 * 1e+9 // 1 Hour or 3600 Seconds

export const namespace = '/ipns/'
export const namespaceLength = namespace.length
Expand Down Expand Up @@ -129,7 +129,7 @@ export interface IDKeys {
}

export interface CreateOptions {
ttlNs?: bigint
ttlNs?: number | bigint
v1Compatible?: boolean
}

Expand Down
8 changes: 4 additions & 4 deletions test/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('ipns', function () {

it('should create an ipns record (V1+V2) correctly', async () => {
const sequence = 0
const ttl = BigInt(3.6e+12)
const ttl = 3.6e+12
const validity = 1000000

const record = await ipns.create(peerId, contentPath, sequence, validity)
Expand Down Expand Up @@ -68,7 +68,7 @@ describe('ipns', function () {

it('should create an ipns record (V2) correctly', async () => {
const sequence = 0
const ttl = BigInt(3.6e+12)
const ttl = 3.6e+12
const validity = 1000000

const record = await ipns.create(peerId, contentPath, sequence, validity, { v1Compatible: false })
Expand Down Expand Up @@ -134,7 +134,7 @@ describe('ipns', function () {

it('should be able to create a record (V1+V2) with a fixed ttl', async () => {
const sequence = 0
const ttl = BigInt(0.6e+12)
const ttl = 0.6e+12
const validity = 1000000

const record = await ipns.create(peerId, contentPath, sequence, validity, {
Expand Down Expand Up @@ -162,7 +162,7 @@ describe('ipns', function () {

await ipnsValidator(peerIdToRoutingKey(peerId), marshalledRecord)

const pb = IpnsEntry.decode(ipns.marshal(record))
const pb = IpnsEntry.decode(marshalledRecord)
expect(pb).to.not.have.property('ttl')

const data = parseCborData(pb.data ?? new Uint8Array(0))
Expand Down

0 comments on commit 0f3837f

Please sign in to comment.