const randomBytesAsync = promisify(randomBytes);
const { Address4, Address6 } = require('ip-address');
const dns = require('dns');
-dns.lookupAsync = dns.lookupAsync || promisify(dns.lookup);
const common = require('./common');
const Enum = require('./enum');
const { ValidationError } = require('./errors');
if (!urlObj.hostname.endsWith('.')) {
hostnames.push(urlObj.hostname + '.');
}
- const settledResolutions = await Promise.allSettled(hostnames.map((hostname) => dns.lookupAsync(hostname, {
+ const settledResolutions = await Promise.allSettled(hostnames.map((hostname) => dns.promises.lookup(hostname, {
all: true,
verbatim: true,
})));
Communication._urlValidScheme(profile);
Communication._urlPartsDisallowed(profile, ['hash', 'username', 'password', 'port']);
Communication._urlPathNoDots(url);
- Communication._urlNamedHost(profile, options.allowLoopback, options.resolveHostname);
+ await Communication._urlNamedHost(profile, options.allowLoopback, options.resolveHostname);
} catch (e) {
this.logger.debug(_scope, 'profile url not valid', { url, error: e });
throw new ValidationError(`${errorScope}: ${e.message}`);
let urlMatched = false;
const itemType = item.type || [];
if ((itemType.includes('h-app') || itemType.includes('h-x-app'))
- && (item.properties && item.properties.url)) {
+ && (item?.properties?.url)) {
item.properties.url.forEach((url) => {
try {
const hUrl = new URL(url);
// and populate profile fields with first-encountered card values.
if (mfData && 'items' in mfData) {
const hCards = mfData.items.filter((item) =>
- item.type && item.type.includes('h-card') &&
+ item?.type?.includes('h-card') &&
item.properties && item.properties.url && item.properties.url.includes(urlObj.href));
hCards.forEach((hCard) => {
Object.keys(profile).forEach((key) => {
* @returns {Object}
*/
async redeemProfileCode(urlObj, code, codeVerifier, clientId, redirectURI) {
- return await this.redeemCode(urlObj, code, codeVerifier, clientId, redirectURI);
+ return this.redeemCode(urlObj, code, codeVerifier, clientId, redirectURI);
}