UNPKG

@nictool/dns-resource-record

Version:
47 lines (37 loc) 933 B
import RR from '../rr.js' export default class OPENPGPKEY extends RR { constructor(opts) { super(opts) } /****** Resource record specific setters *******/ setPublicKey(val) { this.set('public key', val) } getDescription() { return 'OpenPGP Public Key' } getRdataFields() { return ['public key'] } getRFCs() { return [4880, 7929] } getTypeId() { return 61 } /****** IMPORTERS *******/ fromBind(obj) { // test.example.com 3600 IN OPENPGPKEY <base64 public key> const regex = /^([\S]+)\s+(\d{1,10})\s+(IN)\s+(OPENPGPKEY)\s+([\W\w]*)$/ // eslint-disable-next-line no-unused-vars const [ignore, owner, ttl, c, type, publickey] = obj.bindline.trim().match(regex) return new OPENPGPKEY({ owner, ttl: parseInt(ttl, 10), class: c, type: type, 'public key': publickey.trim(), }) } /****** EXPORTERS *******/ }