How to use the bns.util.parseHex function in bns

To help you get started, we’ve selected a few bns examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github handshake-org / hsd / lib / dns / records.js View on Github external
fromJSON(json) {
    assert(typeof json === 'object');
    assert(typeof json.hash === 'string');
    assert((json.hash.length >>> 1) === 28);
    this.hash = util.parseHex(json.hash);
    this.publicKey = util.parseHex(json.publicKey);
    return this;
  }
}
github handshake-org / hsd / lib / dns / records.js View on Github external
fromJSON(json) {
    assert(json && typeof json === 'object');
    assert(typeof json.hash === 'string');
    assert(json.hash.length === 56);
    assert((json.usage & 0xff) === json.usage);
    assert((json.selector & 0xff) === json.selector);
    assert((json.matchingType & 0xff) === json.matchingType);
    assert(typeof json.certificate === 'string');
    assert((json.certificate.length >>> 1) <= 255);
    this.hash = util.parseHex(json.hash);
    this.port = json.port;
    this.usage = json.usage;
    this.selector = json.selector;
    this.matchingType = json.matchingType;
    this.certificate = util.parseHex(json.certificate);
    return this;
  }
}
github handshake-org / hsd / lib / dns / records.js View on Github external
assert(json && typeof json === 'object');
    assert(typeof json.protocol === 'string');
    assert(json.protocol.length <= 255);
    assert((json.port & 0xffff) === json.port);
    assert((json.usage & 0xff) === json.usage);
    assert((json.selector & 0xff) === json.selector);
    assert((json.matchingType & 0xff) === json.matchingType);
    assert(typeof json.certificate === 'string');
    assert((json.certificate.length >>> 1) <= 255);
    assert(isSingle(json.protocol));
    this.protocol = util.fqdn(json.protocol);
    this.port = json.port;
    this.usage = json.usage;
    this.selector = json.selector;
    this.matchingType = json.matchingType;
    this.certificate = util.parseHex(json.certificate);
    return this;
  }
}
github handshake-org / hsd / lib / dns / records.js View on Github external
fromJSON(json) {
    assert(json && typeof json === 'object');
    assert((json.type & 0xff) === json.type);
    assert(typeof json.data === 'string');
    assert((json.data >>> 1) <= 255);
    this.type = json.type;
    this.data = util.parseHex(json.data);
    return this;
  }
}
github handshake-org / hsd / lib / dns / records.js View on Github external
fromJSON(json) {
    assert(json && typeof json === 'object');
    assert((json.keyTag & 0xffff) === json.keyTag);
    assert((json.algorithm & 0xff) === json.algorithm);
    assert((json.digestType & 0xff) === json.digestType);
    assert(typeof json.digest === 'string');
    assert((json.digest.length >>> 1) <= 255);
    this.keyTag = json.keyTag;
    this.algorithm = json.algorithm;
    this.digestType = json.digestType;
    this.digest = util.parseHex(json.digest);
    return this;
  }
}
github handshake-org / hsd / lib / dns / records.js View on Github external
fromJSON(json) {
    assert(json && typeof json === 'object');
    assert((json.algorithm & 0xff) === json.algorithm);
    assert((json.digestType & 0xff) === json.digestType);
    assert(typeof json.fingerprint === 'string');
    assert((json.fingerprint >>> 1) <= 255);
    this.algorithm = json.algorithm;
    this.digestType = json.digestType;
    this.fingerprint = util.parseHex(json.fingerprint);
    return this;
  }
}