How to use the hsd/lib/covenants/rules.verifyString function in hsd

To help you get started, we’ve selected a few hsd 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 HandshakeAlliance / HNScan / src / handlers / search.js View on Github external
let address;

  try {
    address = new Address(search);
  } catch (e) {
    //Do nothing.
  }

  if (address) {
    if (address.isValid()) {
      let result = { type: "Address", url: `/address/${search}` };
      results.push(result);
    }
  }

  if (rules.verifyString(search)) {
    let result = { type: "Name", url: `/name/${search}` };
    results.push(result);
  }

  if (results.length === 1) {
    //return the url
    return h.redirect(results[0].url);
  }

  return h.view("search.pug", { results });
}