Skip to content

Commit

Permalink
Merge pull request #44 from ensdomains/remove-dns-js
Browse files Browse the repository at this point in the history
Remove dns js
  • Loading branch information
Arachnid committed Dec 5, 2018
2 parents fe51114 + fca8f1e commit 439f18a
Show file tree
Hide file tree
Showing 7 changed files with 9,155 additions and 770 deletions.
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

0 comments on commit 439f18a

Please sign in to comment.