-
Notifications
You must be signed in to change notification settings - Fork 16
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
Add support of Google public DNS resolver #49
base: master
Are you sure you want to change the base?
Conversation
…/dns-message and base64url encoding.
@TateB 👋 |
@@ -1,6 +1,6 @@ | |||
{ | |||
"name": "@ensdomains/dnsprovejs", | |||
"version": "0.5.0", | |||
"version": "0.5.1", | |||
"description": "A library to generate chains of trust proving DNS records via DNSSEC", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
85519e2c03861f2edca77f2d8e5248bcfaa7ade3697cd7a187317853dde4b54789af66fd456e4870e502f5952732281c16486ba04be6d9b3e535dd3aba774fdf
@@ -1,6 +1,6 @@ | |||
{ | |||
"name": "@ensdomains/dnsprovejs", | |||
"version": "0.5.0", | |||
"version": "0.5.1", | |||
"description": "A library to generate chains of trust proving DNS records via DNSSEC", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
12e1d062005e14b2d92a49d8299aa1d5abd0abdb73ebd76f0759e22791040cb92606f45948e5ad09e91c38952bd16b00ac02b5104254312624e196da12b9777a
@@ -1,6 +1,6 @@ | |||
{ | |||
"name": "@ensdomains/dnsprovejs", | |||
"version": "0.5.0", | |||
"version": "0.5.1", | |||
"description": "A library to generate chains of trust proving DNS records via DNSSEC", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ethereum
const result = await prover.queryWithProof('TXT', '_ens.proofofattendance.com') | ||
checkKeyTags(result) | ||
expect(result.answer).toMatchObject({ | ||
records: [{ name: '_ens.proofofattendance.com', type: 'TXT' }], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MetaMask
it('queries TXT from cloudflare doh correctly', async () => { | ||
const prover = DNSProver.create('https://cloudflare-dns.com/dns-query'); | ||
const result = await prover.queryWithProof('TXT', '_ens.proofofattendance.com') | ||
checkKeyTags(result) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4mqyd0dtw1hwokrp7qmi6gbmcxoxtp5rlztijfxqra8br4nfqucofsc2v7vfmr7d
@@ -92,8 +92,8 @@ export function dohQuery(url: string) { | |||
const buf = packet.encode(q) | |||
const response = await fetch( | |||
`${url}?${encodeURLParams({ | |||
ct: 'application/dns-udpwireformat', | |||
dns: buf.toString('base64'), | |||
ct: 'application/dns-message', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -98,4 +98,24 @@ describe('dnsprovejs', () => { | |||
}) | |||
expect(result.proofs.length).toEqual(5) | |||
}) | |||
|
|||
it('queries TXT from cloudflare doh correctly', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -92,8 +92,8 @@ export function dohQuery(url: string) { | |||
const buf = packet.encode(q) | |||
const response = await fetch( | |||
`${url}?${encodeURLParams({ | |||
ct: 'application/dns-udpwireformat', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
8.8.8.8
it('queries TXT from cloudflare doh correctly', async () => { | ||
const prover = DNSProver.create('https://cloudflare-dns.com/dns-query'); | ||
const result = await prover.queryWithProof('TXT', '_ens.proofofattendance.com') | ||
checkKeyTags(result) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4mqyd0dtw1hwokrp7qmi6gbmcxoxtp5rlztijfxqra8br4nfqucofsc2v7vfmr7d
}); | ||
|
||
it('queries TXT from google doh correctly', async () => { | ||
const prover = DNSProver.create('https://dns.google/dns-query'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -92,8 +92,8 @@ export function dohQuery(url: string) { | |||
const buf = packet.encode(q) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
D503300000000040442
@@ -92,8 +92,8 @@ export function dohQuery(url: string) { | |||
const buf = packet.encode(q) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
D503300000000040442
Current version of Google DNS DOH resolver requires usage of url-safe base64 encoding and modern
application/dns-message
header. Cloudflare DOH supports them as well so I don't expect any breaking changes there. I've added two tests with real networking to ensure that library still supports Cloudflare DOH resolver as well as Google's one.