-
Notifications
You must be signed in to change notification settings - Fork 10
/
base32.d.ts
51 lines (37 loc) · 1.13 KB
/
base32.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
export declare type ByteArray = ArrayLike<number>;
export declare function encode(buf: ByteArray, options: EncoderOptions): string;
export declare interface EncoderOptions {
type?: string;
alphabet?: string;
lc?: boolean;
}
export declare class Encoder {
constructor(options?: EncoderOptions);
private buf: string;
private shift: number;
private carry: number;
write(buf: ByteArray): this;
finalize(buf: ByteArray): string;
}
export declare interface DecoderOptions {
type?: string;
charmap?: CharacterMap;
}
export declare class Decoder {
constructor(options?: DecoderOptions);
private buf: ByteArray;
private shift: number;
private carry: number;
}
export declare function charmap(alphabet: string, mappings: CharacterMap): CharacterMap;
export declare interface CharacterMap {
[charToReplace: string]: number;
[charToReplace: number]: number;
}
export declare interface Base32Variant {
alphabet: string;
charmap: CharacterMap;
}
export declare const crockford: Base32Variant;
export declare const rfc4648: Base32Variant;
export declare const base32hex: Base32Variant;