Skip to main content
Reference

@blinkk/root-password-protect

Password-protected pages for Root.js sites. This reference is generated from the package's TypeScript types and doc comments.

@blinkk/root-password-protect

import {…} from '@blinkk/root-password-protect';

generateHashfunction

function generateHash(password: string, salt: string): Promise<string>;

hashPasswordfunction

function hashPassword(password: string): Promise<{
    hash: string;
    salt: string;
}>;

verifyPasswordfunction

function verifyPassword(password: string, hash: string, salt: string): Promise<boolean>;

@blinkk/root-password-protect/plugin

import {…} from '@blinkk/root-password-protect/plugin';

PasswordProtectedRouteinterface

interface PasswordProtectedRoute
Members (2)
source: string;

URL glob pattern to match (regex not supported yet).

password: {
    hash: string;
    salt: string;
};

PasswordProtectErrorenum

enum PasswordProtectError {
    UNKNOWN = "UNKNOWN",
    PASSWORD_REQUIRED = "PASSWORD_REQUIRED",
    PASSWORD_INVALID = "PASSWORD_INVALID"
}

passwordProtectPluginfunction

function passwordProtectPlugin(options: PasswordProtectPluginOptions): Plugin;

PasswordProtectPluginOptionsinterface

interface PasswordProtectPluginOptions
Members (1)
protectedRoutes: PasswordProtectedRoute[];

renderPasswordPagefunction

function renderPasswordPage(req: Request, res: Response, options?: {
    error?: PasswordProtectError;
}): Promise<void>;

Renders the login page to a response.

1
2
3
4
5
6
7
8
9
10
11
12
Breakpoint: