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

Remove dns js #44

Merged
merged 12 commits into from Dec 5, 2018
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
47 changes: 47 additions & 0 deletions lib/anchors.js
@@ -0,0 +1,47 @@
const packet = require('dns-packet');

exports.realEntries = [
{
name: ".",
type: 'DS',
class: 'IN',
ttl: 3600,
data:{
keyTag: 19036,
algorithm: 8,
digestType: 2,
digest: new Buffer("49AAC11D7B6F6446702E54A1607371607A1A41855200FD2CE1CDDE32F24E8FB5", "hex")
}
},
{
name: ".",
type: 'DS',
klass: 'IN',
ttl: 3600,
data:{
keyTag: 20326,
algorithm: 8,
digestType: 2,
digest: new Buffer("E06D44B80B8F1D39A95C0B0D7C65D08458E880409BBC683457104237C7F8EC8D", "hex")
}
},
];

exports.dummyEntry = {
name: ".",
type: 'DS',
class: 'IN',
ttl: 3600,
data:{
keyTag: 5647, // Empty body, flags == 0x0101, algorithm = 253, body = 0x1111
algorithm: 253,
digestType: 253,
digest: new Buffer("", "hex")
}
}

exports.encode = (anchors) =>{
return '0x' + anchors.map((anchor)=>{
return packet.answer.encode(anchor).toString('hex')
}).join('')
}
222 changes: 0 additions & 222 deletions lib/dns.js

This file was deleted.

10 changes: 4 additions & 6 deletions migrations/2_deploy_contracts.js
Expand Up @@ -6,20 +6,18 @@ const SHA1NSEC3Digest = artifacts.require("./nsec3digests/SHA1NSEC3Digest");
const DNSSEC = artifacts.require("./DNSSECImpl");
const DummyAlgorithm = artifacts.require("./algorithms/DummyAlgorithm");
const DummyDigest = artifacts.require("./digests/DummyDigest");

const dns = require("../lib/dns.js");
const dnsAnchors = require("../lib/anchors.js");

module.exports = function(deployer, network) {
return deployer.then(async () => {
let dev = (network == "test" || network == "local");
// From http://data.iana.org/root-anchors/root-anchors.xml
let anchors = dns.anchors;
let anchors = dnsAnchors.realEntries;

if (dev) {
anchors.push(dns.dummyAnchor);
anchors.push(dnsAnchors.dummyEntry);
}

await deployer.deploy(DNSSEC, dns.encodeAnchors(anchors));
await deployer.deploy(DNSSEC, dnsAnchors.encode(anchors));

await deployer.deploy([[RSASHA256Algorithm], [RSASHA1Algorithm], [SHA256Digest], [SHA1Digest], [SHA1NSEC3Digest]]);

Expand Down