Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/simplewebauthn/packages/browser/src/helpers/isValidDomain.ts>isValidDomain

WebAuthn, Simplified. A collection of TypeScript-first libraries for simpler WebAuthn integration. Supports modern browsers, Node, Deno, and more.
Latest
function isValidDomain
import { isValidDomain } from "https://deno.land/x/simplewebauthn@v11.0.0/packages/browser/src/helpers/isValidDomain.ts";

A simple test to determine if a hostname is a properly-formatted domain name

A "valid domain" is defined here: https://url.spec.whatwg.org/#valid-domain

Regex sourced from here: https://www.oreilly.com/library/view/regular-expressions-cookbook/9781449327453/ch08s15.html

Parameters

hostname: string

Returns

boolean