@relaycorp/dnssec
Advanced tools
Comparing version 1.11.0 to 1.11.1
@@ -10,3 +10,3 @@ export type { IanaRrTypeName, IanaRrTypeIdOrName } from './lib/utils/dns/ianaRrTypes.js'; | ||
export { RrSet } from './lib/utils/dns/RrSet.js'; | ||
export { DatePeriod } from './lib/DatePeriod.js'; | ||
export { type IDatePeriod } from './lib/dates.js'; | ||
export { DigestType } from './lib/DigestType.js'; | ||
@@ -13,0 +13,0 @@ export { DnssecAlgorithm } from './lib/DnssecAlgorithm.js'; |
@@ -7,4 +7,2 @@ /* eslint-disable import/no-unused-modules */ | ||
export { RrSet } from './lib/utils/dns/RrSet.js'; | ||
// DNSSEC-related | ||
export { DatePeriod } from './lib/DatePeriod.js'; | ||
export { DigestType } from './lib/DigestType.js'; | ||
@@ -11,0 +9,0 @@ export { DnssecAlgorithm } from './lib/DnssecAlgorithm.js'; |
import { UnverifiedChain } from './UnverifiedChain.js'; | ||
import { DatePeriod } from './DatePeriod.js'; | ||
import { DatePeriod } from './dates.js'; | ||
import { DsData } from './records/DsData.js'; | ||
@@ -8,2 +8,7 @@ import { IANA_TRUST_ANCHORS } from './ianaTrustAnchors.js'; | ||
} | ||
function convertDatePeriod(dateOrPeriod) { | ||
return dateOrPeriod instanceof Date | ||
? DatePeriod.init(dateOrPeriod, dateOrPeriod) | ||
: DatePeriod.init(dateOrPeriod.start, dateOrPeriod.end); | ||
} | ||
/** | ||
@@ -14,4 +19,3 @@ * Retrieve RRset for `question` and return it only if DNSSEC validation succeeds. | ||
const unverifiedChain = await UnverifiedChain.retrieve(question, resolver); | ||
const dateOrPeriod = options.dateOrPeriod ?? new Date(); | ||
const datePeriod = dateOrPeriod instanceof DatePeriod ? dateOrPeriod : DatePeriod.init(dateOrPeriod, dateOrPeriod); | ||
const datePeriod = convertDatePeriod(options.dateOrPeriod ?? new Date()); | ||
const dsData = options.trustAnchors | ||
@@ -18,0 +22,0 @@ ? convertTrustAnchors(options.trustAnchors) |
@@ -6,3 +6,3 @@ /// <reference types="node" /> | ||
import type { DnssecAlgorithm } from '../DnssecAlgorithm.js'; | ||
import type { DatePeriod } from '../DatePeriod.js'; | ||
import type { DatePeriod } from '../dates.js'; | ||
import type { DnskeyFlags } from './DnskeyFlags.js'; | ||
@@ -9,0 +9,0 @@ import type { DnssecRecordData } from './DnssecRecordData.js'; |
@@ -5,3 +5,3 @@ import { RrSet } from './utils/dns/RrSet.js'; | ||
import type { Question } from './utils/dns/Question.js'; | ||
import type { DatePeriod } from './DatePeriod.js'; | ||
import type { DatePeriod } from './dates.js'; | ||
/** | ||
@@ -8,0 +8,0 @@ * RRset with one or more corresponding RRSigs. |
import { type RrSet } from '../utils/dns/RrSet.js'; | ||
import { type DatePeriod } from '../DatePeriod.js'; | ||
import { type IDatePeriod } from '../dates.js'; | ||
import { type ZoneResponseSet } from '../dnssecResponses.js'; | ||
@@ -24,3 +24,3 @@ import { Message } from '../utils/dns/Message.js'; | ||
protected generateTrustAnchors(dsData: DsData): readonly TrustAnchor[]; | ||
generateFixture(rrset: RrSet, status: SecurityStatus, signaturePeriod?: DatePeriod): MockChainFixture; | ||
generateFixture(rrset: RrSet, status: SecurityStatus, signaturePeriod?: IDatePeriod): MockChainFixture; | ||
} |
@@ -5,3 +5,3 @@ import { Question } from './utils/dns/Question.js'; | ||
import { Zone } from './Zone.js'; | ||
import type { DatePeriod } from './DatePeriod.js'; | ||
import type { DatePeriod } from './dates.js'; | ||
import { SignedRrSet } from './SignedRrSet.js'; | ||
@@ -8,0 +8,0 @@ import type { Resolver } from './Resolver.js'; |
@@ -1,6 +0,6 @@ | ||
import type { DatePeriod } from './DatePeriod.js'; | ||
import type { IDatePeriod } from './dates.js'; | ||
import type { TrustAnchor } from './TrustAnchor.js'; | ||
export interface VerificationOptions { | ||
readonly dateOrPeriod: Date | DatePeriod; | ||
readonly dateOrPeriod: Date | IDatePeriod; | ||
readonly trustAnchors: readonly TrustAnchor[]; | ||
} |
@@ -6,3 +6,3 @@ import { DsData } from './records/DsData.js'; | ||
import { SignedRrSet } from './SignedRrSet.js'; | ||
import type { DatePeriod } from './DatePeriod.js'; | ||
import type { DatePeriod } from './dates.js'; | ||
/** | ||
@@ -9,0 +9,0 @@ * A secure zone (in DNSSEC terms). |
{ | ||
"name": "@relaycorp/dnssec", | ||
"version": "1.11.0", | ||
"version": "1.11.1", | ||
"author": { | ||
@@ -42,3 +42,3 @@ "email": "no-reply@relaycorp.tech", | ||
"@jest/globals": "^29.4.1", | ||
"@relaycorp/eslint-config": "^1.1.56", | ||
"@relaycorp/eslint-config": "^1.1.61", | ||
"@relaycorp/shared-config": "^1.9.3", | ||
@@ -45,0 +45,0 @@ "@types/jest": "^29.4.0", |
@@ -92,12 +92,12 @@ # `@relaycorp/dnssec` | ||
By default, DNSSEC signatures MUST be valid at the time the `dnssecLookUp()` function is called, but this can be customised by passing a `Date` or `DatePeriod` instance. | ||
By default, DNSSEC signatures MUST be valid at the time the `dnssecLookUp()` function is called, but this can be customised by passing a `Date` or `IDatePeriod` object. | ||
A `DatePeriod` instance is useful when you just want signatures to be valid **at any point** within a given time period. For example, if you want to tolerate [clock drift](https://en.wikipedia.org/wiki/Clock_drift), you could accept signatures valid in the past hour: | ||
An `IDatePeriod` object is useful when you just want signatures to be valid **at any point** within a given time period. For example, if you want to tolerate [clock drift](https://en.wikipedia.org/wiki/Clock_drift), you could accept signatures valid in the past hour: | ||
```js | ||
import { DatePeriod, dnssecLookUp } from '@relaycorp/dnssec'; | ||
import { IDatePeriod, dnssecLookUp } from '@relaycorp/dnssec'; | ||
import { subHours } from 'date-fns'; | ||
const now = new Date(); | ||
const datePeriod = DatePeriod.init(now, subHours(now, 1)); | ||
const datePeriod: IDatePeriod = { start: subHours(now, 1), end: now }; | ||
dnssecLookUp(QUESTION, RESOLVER, { dateOrPeriod: datePeriod }); | ||
@@ -104,0 +104,0 @@ ``` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
166697
2275