UNPKG

1.87 kBPlain TextView Raw
1/* No actual code can go in this file without changing rollup.config.js and .gitignore */
2export type EncodingType = "UTF8" | "UTF16BE" | "UTF16LE";
3export type FormatNoTextType = "HEX" | "B64" | "BYTES" | "ARRAYBUFFER" | "UINT8ARRAY";
4export type FormatType = "TEXT" | FormatNoTextType;
5
6export 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
25export type FixedLengthOptionsNoEncodingType =
26 | {
27 hmacKey?: GenericInputType;
28 }
29 | {
30 numRounds?: number;
31 };
32
33export type FixedLengthOptionsEncodingType =
34 | {
35 hmacKey?: GenericInputType;
36 encoding?: EncodingType;
37 }
38 | {
39 numRounds?: number;
40 encoding?: EncodingType;
41 };
42
43export interface packedValue {
44 value: number[];
45 binLen: number;
46}
47
48export interface SHAKEOptionsNoEncodingType {
49 numRounds?: number;
50}
51
52export interface SHAKEOptionsEncodingType extends SHAKEOptionsNoEncodingType {
53 encoding?: EncodingType;
54}
55
56export interface CSHAKEOptionsNoEncodingType {
57 customization?: GenericInputType;
58 funcName?: GenericInputType;
59}
60
61export interface CSHAKEOptionsEncodingType extends CSHAKEOptionsNoEncodingType {
62 encoding?: EncodingType;
63}
64
65export interface KMACOptionsNoEncodingType {
66 kmacKey: GenericInputType;
67 customization?: GenericInputType;
68}
69
70export interface KMACOptionsEncodingType extends KMACOptionsNoEncodingType {
71 encoding?: EncodingType;
72}
73
74export interface ResolvedCSHAKEOptionsNoEncodingType {
75 funcName: packedValue;
76 customization: packedValue;
77}
78
79export interface ResolvedKMACOptionsNoEncodingType extends ResolvedCSHAKEOptionsNoEncodingType {
80 kmacKey: packedValue;
81}