-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
30 lines (26 loc) · 1.1 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
interface ObscureIdOptions {
key?: string;
charset?: string;
defaultIdLength?: number;
prefixLength?: number;
randomFunction?: () => Promise<number>;
}
function obscureId(id: number, length?: number, random?: number[] | (() => Promise<number>)): Promise<string>;
function obscureId(id: string): Promise<number>;
namespace obscureId {
export function configure(options: ObscureIdOptions): void;
export function resetConfiguration(): void;
export function maxId(length?: number): number;
export class ObscuredIdGenerator {
constructor(options?: ObscureIdOptions);
configure(options: ObscureIdOptions): this;
resetConfiguration(): this;
maxId(length?: number): number;
obscureId(id: number, length?: number, random?: number[] | (() => Promise<number>)): Promise<string>;
generate(id: number, length?: number, random?: number[] | (() => Promise<number>)): Promise<string>;
encode(id: number, length?: number, random?: number[] | (() => Promise<number>)): Promise<string>;
obscureId(id: string): Promise<number>;
decode(id: string): Promise<number>;
}
}
export = obscureId;