@bitgo-beta/sjcl 1.0.2-beta.21 → 1.0.2-beta.2100
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.
- package/CHANGELOG.md +12 -0
- package/index.d.ts +268 -0
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [1.1.0](https://github.com/BitGo/BitGoJS/compare/@bitgo/sjcl@1.0.1...@bitgo/sjcl@1.1.0) (2026-03-27)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* configure learn to skip git operations ([ee3a622](https://github.com/BitGo/BitGoJS/commit/ee3a6220496476aa7f4545b5f4a9a3bf97d9bdb9))
|
|
12
|
+
* define sjcl type definitions ([7d29830](https://github.com/BitGo/BitGoJS/commit/7d298307839be8c7c8ba3c29ae546a24009dce3f))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
6
18
|
## [1.0.1-rc.3](https://github.com/BitGo/BitGoJS/compare/@bitgo/sjcl@1.0.1-rc.2...@bitgo/sjcl@1.0.1-rc.3) (2022-04-19)
|
|
7
19
|
|
|
8
20
|
**Note:** Version bump only for package @bitgo/sjcl
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
export = sjcl;
|
|
2
|
+
export as namespace sjcl;
|
|
3
|
+
|
|
4
|
+
declare namespace sjcl {
|
|
5
|
+
export var bitArray: BitArrayStatic;
|
|
6
|
+
export var codec: SjclCodecs;
|
|
7
|
+
export var hash: SjclHashes;
|
|
8
|
+
export var exception: SjclExceptions;
|
|
9
|
+
export var cipher: SjclCiphers;
|
|
10
|
+
export var mode: SjclModes;
|
|
11
|
+
export var misc: SjclMisc;
|
|
12
|
+
export var random: SjclRandom;
|
|
13
|
+
export var prng: SjclRandomStatic;
|
|
14
|
+
export var keyexchange: Record<string, unknown>;
|
|
15
|
+
export var json: SjclJson;
|
|
16
|
+
export var encrypt: SjclConvenienceEncryptor;
|
|
17
|
+
export var decrypt: SjclConvenienceDecryptor;
|
|
18
|
+
|
|
19
|
+
// ________________________________________________________________________
|
|
20
|
+
|
|
21
|
+
interface BitArray extends Array<number> {}
|
|
22
|
+
|
|
23
|
+
interface BitArrayStatic {
|
|
24
|
+
/** Array slices in units of bits. */
|
|
25
|
+
bitSlice(a: BitArray, bstart: number, bend: number): BitArray;
|
|
26
|
+
|
|
27
|
+
/** Extract a number packed into a bit array. */
|
|
28
|
+
extract(a: BitArray, bstart: number, blength: number): number;
|
|
29
|
+
|
|
30
|
+
/** Concatenate two bit arrays. */
|
|
31
|
+
concat(a1: BitArray, a2: BitArray): BitArray;
|
|
32
|
+
|
|
33
|
+
/** Find the length of an array of bits. */
|
|
34
|
+
bitLength(a: BitArray): number;
|
|
35
|
+
|
|
36
|
+
/** Truncate an array. */
|
|
37
|
+
clamp(a: BitArray, len: number): BitArray;
|
|
38
|
+
|
|
39
|
+
/** Make a partial word for a bit array. */
|
|
40
|
+
partial(len: number, x: number, _end?: number): number;
|
|
41
|
+
|
|
42
|
+
/** Get the number of bits used by a partial word. */
|
|
43
|
+
getPartial(x: number): number;
|
|
44
|
+
|
|
45
|
+
/** Compare two arrays for equality in a predictable amount of time. */
|
|
46
|
+
equal(a: BitArray, b: BitArray): boolean;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// ________________________________________________________________________
|
|
50
|
+
|
|
51
|
+
interface SjclCodec<T> {
|
|
52
|
+
fromBits(bits: BitArray): T;
|
|
53
|
+
toBits(value: T): BitArray;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
interface SjclCodecs {
|
|
57
|
+
utf8String: SjclCodec<string>;
|
|
58
|
+
hex: SjclCodec<string>;
|
|
59
|
+
bytes: SjclCodec<number[]>;
|
|
60
|
+
base64: SjclCodec<string>;
|
|
61
|
+
base64url: SjclCodec<string>;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// ________________________________________________________________________
|
|
65
|
+
|
|
66
|
+
interface SjclHash {
|
|
67
|
+
blockSize: number;
|
|
68
|
+
reset(): SjclHash;
|
|
69
|
+
update(data: BitArray | string): SjclHash;
|
|
70
|
+
finalize(): BitArray;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
interface SjclHashStatic {
|
|
74
|
+
new (hash?: SjclHash): SjclHash;
|
|
75
|
+
hash(data: BitArray | string): BitArray;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
interface SjclHashes {
|
|
79
|
+
sha1: SjclHashStatic;
|
|
80
|
+
sha256: SjclHashStatic;
|
|
81
|
+
sha512: SjclHashStatic;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// ________________________________________________________________________
|
|
85
|
+
|
|
86
|
+
interface SjclExceptions {
|
|
87
|
+
corrupt: SjclExceptionFactory;
|
|
88
|
+
invalid: SjclExceptionFactory;
|
|
89
|
+
bug: SjclExceptionFactory;
|
|
90
|
+
notReady: SjclExceptionFactory;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
interface SjclExceptionFactory {
|
|
94
|
+
new (message: string): Error;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// ________________________________________________________________________
|
|
98
|
+
|
|
99
|
+
interface SjclCiphers {
|
|
100
|
+
aes: SjclCipherStatic;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
interface SjclCipher {
|
|
104
|
+
encrypt(data: number[]): number[];
|
|
105
|
+
decrypt(data: number[]): number[];
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
interface SjclCipherStatic {
|
|
109
|
+
new (key: number[]): SjclCipher;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// ________________________________________________________________________
|
|
113
|
+
|
|
114
|
+
interface SjclModes {
|
|
115
|
+
gcm: SjclGCMMode;
|
|
116
|
+
ccm: SjclCCMMode;
|
|
117
|
+
ocb2: SjclOCB2Mode;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
interface SjclGCMMode {
|
|
121
|
+
encrypt(prf: SjclCipher, plaintext: BitArray, iv: BitArray, adata?: BitArray, tlen?: number): BitArray;
|
|
122
|
+
decrypt(prf: SjclCipher, ciphertext: BitArray, iv: BitArray, adata?: BitArray, tlen?: number): BitArray;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
interface SjclCCMMode {
|
|
126
|
+
encrypt(prf: SjclCipher, plaintext: BitArray, iv: BitArray, adata?: BitArray, tlen?: number): BitArray;
|
|
127
|
+
decrypt(prf: SjclCipher, ciphertext: BitArray, iv: BitArray, adata?: BitArray, tlen?: number): BitArray;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
interface SjclOCB2Mode {
|
|
131
|
+
encrypt(
|
|
132
|
+
prf: SjclCipher,
|
|
133
|
+
plaintext: BitArray,
|
|
134
|
+
iv: BitArray,
|
|
135
|
+
adata?: BitArray,
|
|
136
|
+
tlen?: number,
|
|
137
|
+
premac?: boolean
|
|
138
|
+
): BitArray;
|
|
139
|
+
decrypt(
|
|
140
|
+
prf: SjclCipher,
|
|
141
|
+
ciphertext: BitArray,
|
|
142
|
+
iv: BitArray,
|
|
143
|
+
adata?: BitArray,
|
|
144
|
+
tlen?: number,
|
|
145
|
+
premac?: boolean
|
|
146
|
+
): BitArray;
|
|
147
|
+
pmac(prf: SjclCipher, adata: BitArray): number[];
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// ________________________________________________________________________
|
|
151
|
+
|
|
152
|
+
interface PBKDF2Params {
|
|
153
|
+
iter?: number | undefined;
|
|
154
|
+
salt?: BitArray | undefined;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
interface SjclMisc {
|
|
158
|
+
pbkdf2(
|
|
159
|
+
password: BitArray | string,
|
|
160
|
+
salt: BitArray | string,
|
|
161
|
+
count?: number,
|
|
162
|
+
length?: number,
|
|
163
|
+
Prff?: SjclPRFFamilyStatic
|
|
164
|
+
): BitArray;
|
|
165
|
+
hmac: SjclHMACStatic;
|
|
166
|
+
cachedPbkdf2(
|
|
167
|
+
password: string,
|
|
168
|
+
obj?: PBKDF2Params
|
|
169
|
+
): {
|
|
170
|
+
key: BitArray;
|
|
171
|
+
salt: BitArray;
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
class SjclPRFFamily {
|
|
176
|
+
encrypt(data: BitArray | string): BitArray;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
interface SjclHMAC extends SjclPRFFamily {
|
|
180
|
+
mac(data: BitArray | string): BitArray;
|
|
181
|
+
reset(): void;
|
|
182
|
+
update(data: BitArray | string): void;
|
|
183
|
+
digest(): BitArray;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
interface SjclPRFFamilyStatic {
|
|
187
|
+
new (key: BitArray): SjclPRFFamily;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
interface SjclHMACStatic {
|
|
191
|
+
new (key: BitArray, Hash?: SjclHashStatic): SjclHMAC;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// ________________________________________________________________________
|
|
195
|
+
|
|
196
|
+
interface SjclRandom {
|
|
197
|
+
randomWords(nwords: number, paranoia?: number): BitArray;
|
|
198
|
+
setDefaultParanoia(paranoia: number, allowZeroParanoia: string): void;
|
|
199
|
+
addEntropy(data: number | number[] | string, estimatedEntropy: number, source: string): void;
|
|
200
|
+
isReady(paranoia?: number): number;
|
|
201
|
+
getProgress(paranoia?: number): number;
|
|
202
|
+
startCollectors(): void;
|
|
203
|
+
stopCollectors(): void;
|
|
204
|
+
addEventListener(name: string, cb: () => void): void;
|
|
205
|
+
removeEventListener(name: string, cb: () => void): void;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
interface SjclRandomStatic {
|
|
209
|
+
new (defaultParanoia: number): SjclRandom;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
// ________________________________________________________________________
|
|
213
|
+
|
|
214
|
+
interface SjclCipherParams {
|
|
215
|
+
v?: number | undefined;
|
|
216
|
+
iter?: number | undefined;
|
|
217
|
+
ks?: number | undefined;
|
|
218
|
+
ts?: number | undefined;
|
|
219
|
+
mode?: string | undefined;
|
|
220
|
+
adata?: string | undefined;
|
|
221
|
+
cipher?: string | undefined;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
interface SjclCipherEncryptParams extends SjclCipherParams {
|
|
225
|
+
salt: BitArray;
|
|
226
|
+
iv: BitArray;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
interface SjclCipherDecryptParams extends SjclCipherParams {
|
|
230
|
+
salt?: BitArray | undefined;
|
|
231
|
+
iv?: BitArray | undefined;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
interface SjclCipherEncrypted extends SjclCipherEncryptParams {
|
|
235
|
+
kemtag?: BitArray | undefined;
|
|
236
|
+
ct: BitArray;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
interface SjclCipherDecrypted extends SjclCipherEncrypted {
|
|
240
|
+
key: BitArray;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
interface SjclConvenienceEncryptor {
|
|
244
|
+
(
|
|
245
|
+
password: BitArray | string | undefined,
|
|
246
|
+
plaintext: string | undefined,
|
|
247
|
+
params?: SjclCipherEncryptParams,
|
|
248
|
+
rp?: SjclCipherEncrypted
|
|
249
|
+
): string;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
interface SjclConvenienceDecryptor {
|
|
253
|
+
(
|
|
254
|
+
password: BitArray | string | undefined,
|
|
255
|
+
ciphertext: SjclCipherEncrypted | string | undefined,
|
|
256
|
+
params?: SjclCipherDecryptParams,
|
|
257
|
+
rp?: SjclCipherDecrypted
|
|
258
|
+
): string;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
interface SjclJson {
|
|
262
|
+
defaults: Required<SjclCipherParams>;
|
|
263
|
+
encrypt: SjclConvenienceEncryptor;
|
|
264
|
+
decrypt: SjclConvenienceDecryptor;
|
|
265
|
+
encode(obj: object): string;
|
|
266
|
+
decode(obj: string): object;
|
|
267
|
+
}
|
|
268
|
+
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bitgo-beta/sjcl",
|
|
3
|
-
"version": "1.0.2-beta.
|
|
3
|
+
"version": "1.0.2-beta.2100",
|
|
4
4
|
"description": "fork of Stanford Javascript Crypto Library",
|
|
5
5
|
"main": "sjcl.min.js",
|
|
6
|
+
"types": "index.d.ts",
|
|
6
7
|
"author": "BitGo SDK Team <sdkteam@bitgo.com>",
|
|
7
8
|
"license": "(BSD-2-Clause OR GPL-2.0-only)",
|
|
8
9
|
"repository": {
|
|
@@ -13,5 +14,5 @@
|
|
|
13
14
|
"publishConfig": {
|
|
14
15
|
"access": "public"
|
|
15
16
|
},
|
|
16
|
-
"gitHead": "
|
|
17
|
+
"gitHead": "489b8eef68af040a96e8f14e24a970330a5ada36"
|
|
17
18
|
}
|