1 |
|
2 | export type EncodingType = "UTF8" | "UTF16BE" | "UTF16LE";
|
3 | export type FormatNoTextType = "HEX" | "B64" | "BYTES" | "ARRAYBUFFER" | "UINT8ARRAY";
|
4 | export type FormatType = "TEXT" | FormatNoTextType;
|
5 |
|
6 | export type GenericInputType =
|
7 | | {
|
8 | value: string;
|
9 | format: "TEXT";
|
10 | encoding?: EncodingType;
|
11 | }
|
12 | | {
|
13 | value: string;
|
14 | format: "B64" | "HEX" | "BYTES";
|
15 | }
|
16 | | {
|
17 | value: ArrayBuffer;
|
18 | format: "ARRAYBUFFER";
|
19 | }
|
20 | | {
|
21 | value: Uint8Array;
|
22 | format: "UINT8ARRAY";
|
23 | };
|
24 |
|
25 | export type FixedLengthOptionsNoEncodingType =
|
26 | | {
|
27 | hmacKey?: GenericInputType;
|
28 | }
|
29 | | {
|
30 | numRounds?: number;
|
31 | };
|
32 |
|
33 | export type FixedLengthOptionsEncodingType =
|
34 | | {
|
35 | hmacKey?: GenericInputType;
|
36 | encoding?: EncodingType;
|
37 | }
|
38 | | {
|
39 | numRounds?: number;
|
40 | encoding?: EncodingType;
|
41 | };
|
42 |
|
43 | export interface packedValue {
|
44 | value: number[];
|
45 | binLen: number;
|
46 | }
|
47 |
|
48 | export interface SHAKEOptionsNoEncodingType {
|
49 | numRounds?: number;
|
50 | }
|
51 |
|
52 | export interface SHAKEOptionsEncodingType extends SHAKEOptionsNoEncodingType {
|
53 | encoding?: EncodingType;
|
54 | }
|
55 |
|
56 | export interface CSHAKEOptionsNoEncodingType {
|
57 | customization?: GenericInputType;
|
58 | funcName?: GenericInputType;
|
59 | }
|
60 |
|
61 | export interface CSHAKEOptionsEncodingType extends CSHAKEOptionsNoEncodingType {
|
62 | encoding?: EncodingType;
|
63 | }
|
64 |
|
65 | export interface KMACOptionsNoEncodingType {
|
66 | kmacKey: GenericInputType;
|
67 | customization?: GenericInputType;
|
68 | }
|
69 |
|
70 | export interface KMACOptionsEncodingType extends KMACOptionsNoEncodingType {
|
71 | encoding?: EncodingType;
|
72 | }
|
73 |
|
74 | export interface ResolvedCSHAKEOptionsNoEncodingType {
|
75 | funcName: packedValue;
|
76 | customization: packedValue;
|
77 | }
|
78 |
|
79 | export interface ResolvedKMACOptionsNoEncodingType extends ResolvedCSHAKEOptionsNoEncodingType {
|
80 | kmacKey: packedValue;
|
81 | }
|