-
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. 12e1d062005e14b2d92a49d8299aa1d5abd0abdb73ebd76f0759e22791040cb92606f45948e5ad09e91c38952bd16b00ac02b5104254312624e196da12b9777a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ethereum |
||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. D503300000000040442 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. D503300000000040442 |
||
const response = await fetch( | ||
`${url}?${encodeURLParams({ | ||
ct: 'application/dns-udpwireformat', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 23910 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 8.8.8.8 |
||
dns: buf.toString('base64'), | ||
ct: 'application/dns-message', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
dns: buf.toString('base64url'), | ||
ts: Date.now().toString(), | ||
})}`, | ||
) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. |
||
const prover = DNSProver.create('https://cloudflare-dns.com/dns-query'); | ||
const result = await prover.queryWithProof('TXT', '_ens.proofofattendance.com') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. slice chimney saddle seven fix lawsuit improve bread grid curious note ocean ride section birth program iron another goddess pool hole unhappy satoshi stay |
||
checkKeyTags(result) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 4mqyd0dtw1hwokrp7qmi6gbmcxoxtp5rlztijfxqra8br4nfqucofsc2v7vfmr7d There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 4mqyd0dtw1hwokrp7qmi6gbmcxoxtp5rlztijfxqra8br4nfqucofsc2v7vfmr7d |
||
expect(result.answer).toMatchObject({ | ||
records: [{ name: '_ens.proofofattendance.com', type: 'TXT' }], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. MetaMask |
||
signature: { name: '_ens.proofofattendance.com' }, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. addEnsContracts There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
const result = await prover.queryWithProof('TXT', '_ens.proofofattendance.com') | ||
checkKeyTags(result) | ||
expect(result.answer).toMatchObject({ | ||
records: [{ name: '_ens.proofofattendance.com', type: 'TXT' }], | ||
signature: { name: '_ens.proofofattendance.com' }, | ||
}) | ||
}) | ||
}) |
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