Skip to content

Commit

Permalink
Merge 500ad2d into d06ff06
Browse files Browse the repository at this point in the history
  • Loading branch information
tynes committed Aug 7, 2020
2 parents d06ff06 + 500ad2d commit 0f38612
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/dns/server.js
Expand Up @@ -276,6 +276,10 @@ class RootServer extends DNSServer {
res.answer.push(key.ds.deepClone());
key.signZSK(res.answer, types.DS);
break;
case types.KEY:
res.answer.push(this.toKEY());
key.signZSK(res.answer, types.KEY);
break;
default:
// Empty Proof:
res.authority.push(this.toNSEC());
Expand Down Expand Up @@ -489,6 +493,10 @@ class RootServer extends DNSServer {
rd.typeBitmap = TYPE_MAP;
return rr;
}

toKEY() {
return hsig.makeKey(this.key);
}
}

/**
Expand Down
9 changes: 9 additions & 0 deletions test/ns-test.js
Expand Up @@ -107,4 +107,13 @@ describe('RootServer', function() {
// Nothing was added to the cache
assert.strictEqual(cache.size, 1);
});

it('should resolve KEY rr', async () => {
const req = {question: [{name: '.', type: wire.types.KEY}]};
const res = await ns.resolve(req);
const got = res.answer.find(rr => rr.type === wire.types.KEY);

assert(got);
assert.equal(got.name, '.');
});
});

0 comments on commit 0f38612

Please sign in to comment.