@volter/tabnode 0.5.49 → 0.5.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,203 @@
1
+ import { GHASH } from '@noble/ciphers/_polyval.js';
2
+ type Mode = 'gcm' | 'cbc' | 'ctr' | 'ecb';
3
+ type Bytes = Uint8Array;
4
+ export interface CipherDeps {
5
+ /** The guest's Buffer.from over bytes. */
6
+ toBuffer(bytes: Bytes): Uint8Array;
7
+ /** Bytes of a string (in its encoding) or a view, as the rest of crypto reads them. */
8
+ bytesOf(value: unknown, encoding?: string): Bytes;
9
+ /** A secret KeyObject's bytes, or undefined when the value is not a KeyObject. */
10
+ secretKeyBytes(value: unknown): Bytes | undefined;
11
+ /** Bytes in an output encoding, as `digest` answers them. */
12
+ encode(bytes: Bytes, encoding?: string): unknown;
13
+ error(code: string, message: string): Error;
14
+ }
15
+ /** The ciphers `createCipheriv` accepts, as `getCiphers` lists them. */
16
+ export declare function cipherNames(): string[];
17
+ export declare function createCipherClasses(deps: CipherDeps): {
18
+ Cipheriv: {
19
+ new (algorithm: unknown, key: unknown, iv: unknown, options?: {
20
+ authTagLength?: number;
21
+ }): {
22
+ getAuthTag(): Uint8Array;
23
+ readonly "__#private@#decrypt": boolean;
24
+ readonly "__#private@#mode": Mode;
25
+ readonly "__#private@#xk": Uint32Array;
26
+ readonly "__#private@#xkDec": Uint32Array | undefined;
27
+ "__#private@#padding": boolean;
28
+ "__#private@#finished": boolean;
29
+ "__#private@#started": boolean;
30
+ /** CBC/ECB: bytes not yet a whole block (and, decrypting with padding, the last whole block). */
31
+ "__#private@#pending": Bytes;
32
+ /** CBC's chaining block. */
33
+ "__#private@#chain": Bytes | undefined;
34
+ /** CTR/GCM: the next counter block and what is left of the current keystream block. */
35
+ "__#private@#counter": Bytes | undefined;
36
+ "__#private@#keystream": Bytes;
37
+ /** GCM. */
38
+ "__#private@#ghash": GHASH | undefined;
39
+ "__#private@#tagMask": Bytes | undefined;
40
+ "__#private@#ghashPending": Bytes;
41
+ "__#private@#aadLength": number;
42
+ "__#private@#dataLength": number;
43
+ "__#private@#authTagLength": number | undefined;
44
+ "__#private@#authTag": Bytes | undefined;
45
+ setAutoPadding(autoPadding?: boolean): /*elided*/ any;
46
+ setAAD(buffer: unknown, _options?: {
47
+ plaintextLength?: number;
48
+ }): /*elided*/ any;
49
+ "__#private@#getTag"(): Bytes;
50
+ "__#private@#setTag"(tag: unknown, encoding?: string): void;
51
+ update(data: unknown, inputEncoding?: string, outputEncoding?: string): unknown;
52
+ final(outputEncoding?: string): unknown;
53
+ "__#private@#process"(input: Bytes): Bytes;
54
+ /** XOR with the counter's keystream, carrying a partial block across calls. */
55
+ "__#private@#stream"(input: Bytes): Bytes;
56
+ /** GHASH over the ciphertext, in whole blocks: GHASH pads each update, so a partial block waits for the next. */
57
+ "__#private@#absorb"(ciphertext: Bytes): void;
58
+ /** CBC and ECB: every whole block now; decrypting with padding, the last whole block waits for `final`. */
59
+ "__#private@#blocks"(input: Bytes): Bytes;
60
+ "__#private@#block"(block: Bytes): Bytes;
61
+ "__#private@#finish"(): Bytes;
62
+ "__#private@#finishGcm"(): Bytes;
63
+ };
64
+ };
65
+ Decipheriv: {
66
+ new (algorithm: unknown, key: unknown, iv: unknown, options?: {
67
+ authTagLength?: number;
68
+ }): {
69
+ setAuthTag(tag: unknown, encoding?: string): /*elided*/ any;
70
+ readonly "__#private@#decrypt": boolean;
71
+ readonly "__#private@#mode": Mode;
72
+ readonly "__#private@#xk": Uint32Array;
73
+ readonly "__#private@#xkDec": Uint32Array | undefined;
74
+ "__#private@#padding": boolean;
75
+ "__#private@#finished": boolean;
76
+ "__#private@#started": boolean;
77
+ /** CBC/ECB: bytes not yet a whole block (and, decrypting with padding, the last whole block). */
78
+ "__#private@#pending": Bytes;
79
+ /** CBC's chaining block. */
80
+ "__#private@#chain": Bytes | undefined;
81
+ /** CTR/GCM: the next counter block and what is left of the current keystream block. */
82
+ "__#private@#counter": Bytes | undefined;
83
+ "__#private@#keystream": Bytes;
84
+ /** GCM. */
85
+ "__#private@#ghash": GHASH | undefined;
86
+ "__#private@#tagMask": Bytes | undefined;
87
+ "__#private@#ghashPending": Bytes;
88
+ "__#private@#aadLength": number;
89
+ "__#private@#dataLength": number;
90
+ "__#private@#authTagLength": number | undefined;
91
+ "__#private@#authTag": Bytes | undefined;
92
+ setAutoPadding(autoPadding?: boolean): /*elided*/ any;
93
+ setAAD(buffer: unknown, _options?: {
94
+ plaintextLength?: number;
95
+ }): /*elided*/ any;
96
+ "__#private@#getTag"(): Bytes;
97
+ "__#private@#setTag"(tag: unknown, encoding?: string): void;
98
+ update(data: unknown, inputEncoding?: string, outputEncoding?: string): unknown;
99
+ final(outputEncoding?: string): unknown;
100
+ "__#private@#process"(input: Bytes): Bytes;
101
+ /** XOR with the counter's keystream, carrying a partial block across calls. */
102
+ "__#private@#stream"(input: Bytes): Bytes;
103
+ /** GHASH over the ciphertext, in whole blocks: GHASH pads each update, so a partial block waits for the next. */
104
+ "__#private@#absorb"(ciphertext: Bytes): void;
105
+ /** CBC and ECB: every whole block now; decrypting with padding, the last whole block waits for `final`. */
106
+ "__#private@#blocks"(input: Bytes): Bytes;
107
+ "__#private@#block"(block: Bytes): Bytes;
108
+ "__#private@#finish"(): Bytes;
109
+ "__#private@#finishGcm"(): Bytes;
110
+ };
111
+ };
112
+ createCipheriv: (algorithm: unknown, key: unknown, iv: unknown, options?: {
113
+ authTagLength?: number;
114
+ }) => {
115
+ getAuthTag(): Uint8Array;
116
+ readonly "__#private@#decrypt": boolean;
117
+ readonly "__#private@#mode": Mode;
118
+ readonly "__#private@#xk": Uint32Array;
119
+ readonly "__#private@#xkDec": Uint32Array | undefined;
120
+ "__#private@#padding": boolean;
121
+ "__#private@#finished": boolean;
122
+ "__#private@#started": boolean;
123
+ /** CBC/ECB: bytes not yet a whole block (and, decrypting with padding, the last whole block). */
124
+ "__#private@#pending": Bytes;
125
+ /** CBC's chaining block. */
126
+ "__#private@#chain": Bytes | undefined;
127
+ /** CTR/GCM: the next counter block and what is left of the current keystream block. */
128
+ "__#private@#counter": Bytes | undefined;
129
+ "__#private@#keystream": Bytes;
130
+ /** GCM. */
131
+ "__#private@#ghash": GHASH | undefined;
132
+ "__#private@#tagMask": Bytes | undefined;
133
+ "__#private@#ghashPending": Bytes;
134
+ "__#private@#aadLength": number;
135
+ "__#private@#dataLength": number;
136
+ "__#private@#authTagLength": number | undefined;
137
+ "__#private@#authTag": Bytes | undefined;
138
+ setAutoPadding(autoPadding?: boolean): /*elided*/ any;
139
+ setAAD(buffer: unknown, _options?: {
140
+ plaintextLength?: number;
141
+ }): /*elided*/ any;
142
+ "__#private@#getTag"(): Bytes;
143
+ "__#private@#setTag"(tag: unknown, encoding?: string): void;
144
+ update(data: unknown, inputEncoding?: string, outputEncoding?: string): unknown;
145
+ final(outputEncoding?: string): unknown;
146
+ "__#private@#process"(input: Bytes): Bytes;
147
+ /** XOR with the counter's keystream, carrying a partial block across calls. */
148
+ "__#private@#stream"(input: Bytes): Bytes;
149
+ /** GHASH over the ciphertext, in whole blocks: GHASH pads each update, so a partial block waits for the next. */
150
+ "__#private@#absorb"(ciphertext: Bytes): void;
151
+ /** CBC and ECB: every whole block now; decrypting with padding, the last whole block waits for `final`. */
152
+ "__#private@#blocks"(input: Bytes): Bytes;
153
+ "__#private@#block"(block: Bytes): Bytes;
154
+ "__#private@#finish"(): Bytes;
155
+ "__#private@#finishGcm"(): Bytes;
156
+ };
157
+ createDecipheriv: (algorithm: unknown, key: unknown, iv: unknown, options?: {
158
+ authTagLength?: number;
159
+ }) => {
160
+ setAuthTag(tag: unknown, encoding?: string): /*elided*/ any;
161
+ readonly "__#private@#decrypt": boolean;
162
+ readonly "__#private@#mode": Mode;
163
+ readonly "__#private@#xk": Uint32Array;
164
+ readonly "__#private@#xkDec": Uint32Array | undefined;
165
+ "__#private@#padding": boolean;
166
+ "__#private@#finished": boolean;
167
+ "__#private@#started": boolean;
168
+ /** CBC/ECB: bytes not yet a whole block (and, decrypting with padding, the last whole block). */
169
+ "__#private@#pending": Bytes;
170
+ /** CBC's chaining block. */
171
+ "__#private@#chain": Bytes | undefined;
172
+ /** CTR/GCM: the next counter block and what is left of the current keystream block. */
173
+ "__#private@#counter": Bytes | undefined;
174
+ "__#private@#keystream": Bytes;
175
+ /** GCM. */
176
+ "__#private@#ghash": GHASH | undefined;
177
+ "__#private@#tagMask": Bytes | undefined;
178
+ "__#private@#ghashPending": Bytes;
179
+ "__#private@#aadLength": number;
180
+ "__#private@#dataLength": number;
181
+ "__#private@#authTagLength": number | undefined;
182
+ "__#private@#authTag": Bytes | undefined;
183
+ setAutoPadding(autoPadding?: boolean): /*elided*/ any;
184
+ setAAD(buffer: unknown, _options?: {
185
+ plaintextLength?: number;
186
+ }): /*elided*/ any;
187
+ "__#private@#getTag"(): Bytes;
188
+ "__#private@#setTag"(tag: unknown, encoding?: string): void;
189
+ update(data: unknown, inputEncoding?: string, outputEncoding?: string): unknown;
190
+ final(outputEncoding?: string): unknown;
191
+ "__#private@#process"(input: Bytes): Bytes;
192
+ /** XOR with the counter's keystream, carrying a partial block across calls. */
193
+ "__#private@#stream"(input: Bytes): Bytes;
194
+ /** GHASH over the ciphertext, in whole blocks: GHASH pads each update, so a partial block waits for the next. */
195
+ "__#private@#absorb"(ciphertext: Bytes): void;
196
+ /** CBC and ECB: every whole block now; decrypting with padding, the last whole block waits for `final`. */
197
+ "__#private@#blocks"(input: Bytes): Bytes;
198
+ "__#private@#block"(block: Bytes): Bytes;
199
+ "__#private@#finish"(): Bytes;
200
+ "__#private@#finishGcm"(): Bytes;
201
+ };
202
+ };
203
+ export {};