UNPKG

880 BTypeScriptView Raw
1// Type definitions for cryptiles 3.1
2// Project: https://github.com/hapijs/cryptiles
3// Definitions by: Alex Wendland <https://github.com/awendland>
4// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
5
6/**
7 * Returns a cryptographically strong pseudo-random data string. Takes a size argument for the length of the string.
8 */
9export function randomString(size: number): string;
10
11/**
12 * Returns a cryptographically strong pseudo-random data string consisting of only numerical digits (0-9).
13 * Takes a size argument for the length of the string.
14 */
15export function randomDigits(size: number): string;
16
17/**
18 * Compare two strings using fixed time algorithm (to prevent time-based analysis of MAC digest match).
19 * Returns true if the strings match, false if they differ.
20 */
21export function fixedTimeComparison(a: string, b: string): boolean;