@bitwarden/sdk-internal 0.2.0-main.8 → 0.2.0-main.81
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/VERSION +1 -0
- package/bitwarden_wasm_internal.d.ts +155 -38
- package/bitwarden_wasm_internal_bg.js +783 -469
- package/bitwarden_wasm_internal_bg.wasm +0 -0
- package/bitwarden_wasm_internal_bg.wasm.d.ts +46 -28
- package/bitwarden_wasm_internal_bg.wasm.js +1 -1
- package/node/bitwarden_wasm_internal.d.ts +155 -38
- package/node/bitwarden_wasm_internal.js +787 -472
- package/node/bitwarden_wasm_internal_bg.wasm +0 -0
- package/node/bitwarden_wasm_internal_bg.wasm.d.ts +46 -28
- package/package.json +5 -4
package/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3d5952a599216e3e3678486d4f9f849523c207d8
|
@@ -1,5 +1,32 @@
|
|
1
1
|
/* tslint:disable */
|
2
2
|
/* eslint-disable */
|
3
|
+
/**
|
4
|
+
* Generate a new SSH key pair
|
5
|
+
*
|
6
|
+
* # Arguments
|
7
|
+
* - `key_algorithm` - The algorithm to use for the key pair
|
8
|
+
*
|
9
|
+
* # Returns
|
10
|
+
* - `Ok(SshKey)` if the key was successfully generated
|
11
|
+
* - `Err(KeyGenerationError)` if the key could not be generated
|
12
|
+
*/
|
13
|
+
export function generate_ssh_key(key_algorithm: KeyAlgorithm): SshKey;
|
14
|
+
/**
|
15
|
+
* Convert a PCKS8 or OpenSSH encrypted or unencrypted private key
|
16
|
+
* to an OpenSSH private key with public key and fingerprint
|
17
|
+
*
|
18
|
+
* # Arguments
|
19
|
+
* - `imported_key` - The private key to convert
|
20
|
+
* - `password` - The password to use for decrypting the key
|
21
|
+
*
|
22
|
+
* # Returns
|
23
|
+
* - `Ok(SshKey)` if the key was successfully coneverted
|
24
|
+
* - `Err(PasswordRequired)` if the key is encrypted and no password was provided
|
25
|
+
* - `Err(WrongPassword)` if the password provided is incorrect
|
26
|
+
* - `Err(ParsingError)` if the key could not be parsed
|
27
|
+
* - `Err(UnsupportedKeyType)` if the key type is not supported
|
28
|
+
*/
|
29
|
+
export function import_ssh_key(imported_key: string, password?: string | null): SshKey;
|
3
30
|
export enum LogLevel {
|
4
31
|
Trace = 0,
|
5
32
|
Debug = 1,
|
@@ -51,6 +78,43 @@ export interface InitOrgCryptoRequest {
|
|
51
78
|
organizationKeys: Map<Uuid, AsymmetricEncString>;
|
52
79
|
}
|
53
80
|
|
81
|
+
export interface MakeKeyPairResponse {
|
82
|
+
/**
|
83
|
+
* The user\'s public key
|
84
|
+
*/
|
85
|
+
userPublicKey: string;
|
86
|
+
/**
|
87
|
+
* User\'s private key, encrypted with the user key
|
88
|
+
*/
|
89
|
+
userKeyEncryptedPrivateKey: EncString;
|
90
|
+
}
|
91
|
+
|
92
|
+
export interface VerifyAsymmetricKeysRequest {
|
93
|
+
/**
|
94
|
+
* The user\'s user key
|
95
|
+
*/
|
96
|
+
userKey: string;
|
97
|
+
/**
|
98
|
+
* The user\'s public key
|
99
|
+
*/
|
100
|
+
userPublicKey: string;
|
101
|
+
/**
|
102
|
+
* User\'s private key, encrypted with the user key
|
103
|
+
*/
|
104
|
+
userKeyEncryptedPrivateKey: EncString;
|
105
|
+
}
|
106
|
+
|
107
|
+
export interface VerifyAsymmetricKeysResponse {
|
108
|
+
/**
|
109
|
+
* Whether the user\'s private key was decryptable by the user key.
|
110
|
+
*/
|
111
|
+
privateKeyDecryptable: boolean;
|
112
|
+
/**
|
113
|
+
* Whether the user\'s private key was a valid RSA key and matched the public key provided.
|
114
|
+
*/
|
115
|
+
validPrivateKey: boolean;
|
116
|
+
}
|
117
|
+
|
54
118
|
export interface CoreError extends Error {
|
55
119
|
name: "CoreError";
|
56
120
|
variant:
|
@@ -67,7 +131,6 @@ export interface CoreError extends Error {
|
|
67
131
|
| "InvalidBase64"
|
68
132
|
| "Chrono"
|
69
133
|
| "ResponseContent"
|
70
|
-
| "ValidationError"
|
71
134
|
| "InvalidStateFileVersion"
|
72
135
|
| "InvalidStateFile"
|
73
136
|
| "Internal"
|
@@ -161,6 +224,38 @@ export type Kdf =
|
|
161
224
|
| { pBKDF2: { iterations: NonZeroU32 } }
|
162
225
|
| { argon2id: { iterations: NonZeroU32; memory: NonZeroU32; parallelism: NonZeroU32 } };
|
163
226
|
|
227
|
+
export interface SshKey {
|
228
|
+
/**
|
229
|
+
* The private key in OpenSSH format
|
230
|
+
*/
|
231
|
+
private_key: string;
|
232
|
+
public_key: string;
|
233
|
+
key_fingerprint: string;
|
234
|
+
}
|
235
|
+
|
236
|
+
export type KeyAlgorithm = "Ed25519" | "Rsa3072" | "Rsa4096";
|
237
|
+
|
238
|
+
export interface SshKeyExportError extends Error {
|
239
|
+
name: "SshKeyExportError";
|
240
|
+
variant: "KeyConversionError";
|
241
|
+
}
|
242
|
+
|
243
|
+
export function isSshKeyExportError(error: any): error is SshKeyExportError;
|
244
|
+
|
245
|
+
export interface SshKeyImportError extends Error {
|
246
|
+
name: "SshKeyImportError";
|
247
|
+
variant: "ParsingError" | "PasswordRequired" | "WrongPassword" | "UnsupportedKeyType";
|
248
|
+
}
|
249
|
+
|
250
|
+
export function isSshKeyImportError(error: any): error is SshKeyImportError;
|
251
|
+
|
252
|
+
export interface KeyGenerationError extends Error {
|
253
|
+
name: "KeyGenerationError";
|
254
|
+
variant: "KeyGenerationError" | "KeyConversionError";
|
255
|
+
}
|
256
|
+
|
257
|
+
export function isKeyGenerationError(error: any): error is KeyGenerationError;
|
258
|
+
|
164
259
|
export interface Folder {
|
165
260
|
id: Uuid | undefined;
|
166
261
|
name: EncString;
|
@@ -173,6 +268,24 @@ export interface FolderView {
|
|
173
268
|
revisionDate: DateTime<Utc>;
|
174
269
|
}
|
175
270
|
|
271
|
+
export interface TotpResponse {
|
272
|
+
/**
|
273
|
+
* Generated TOTP code
|
274
|
+
*/
|
275
|
+
code: string;
|
276
|
+
/**
|
277
|
+
* Time period
|
278
|
+
*/
|
279
|
+
period: number;
|
280
|
+
}
|
281
|
+
|
282
|
+
export interface TotpError extends Error {
|
283
|
+
name: "TotpError";
|
284
|
+
variant: "InvalidOtpauth" | "MissingSecret" | "CryptoError" | "VaultLocked";
|
285
|
+
}
|
286
|
+
|
287
|
+
export function isTotpError(error: any): error is TotpError;
|
288
|
+
|
176
289
|
export interface TestError extends Error {
|
177
290
|
name: "TestError";
|
178
291
|
}
|
@@ -199,71 +312,75 @@ export type NonZeroU32 = number;
|
|
199
312
|
|
200
313
|
export class BitwardenClient {
|
201
314
|
free(): void;
|
202
|
-
|
203
|
-
* @param {ClientSettings | undefined} [settings]
|
204
|
-
* @param {LogLevel | undefined} [log_level]
|
205
|
-
*/
|
206
|
-
constructor(settings?: ClientSettings, log_level?: LogLevel);
|
315
|
+
constructor(settings?: ClientSettings | null, log_level?: LogLevel | null);
|
207
316
|
/**
|
208
317
|
* Test method, echoes back the input
|
209
|
-
* @param {string} msg
|
210
|
-
* @returns {string}
|
211
318
|
*/
|
212
319
|
echo(msg: string): string;
|
213
|
-
/**
|
214
|
-
* @returns {string}
|
215
|
-
*/
|
216
320
|
version(): string;
|
217
|
-
|
218
|
-
* @param {string} msg
|
219
|
-
* @returns {Promise<void>}
|
220
|
-
*/
|
221
|
-
throw(msg: string): Promise<void>;
|
321
|
+
throw(msg: string): void;
|
222
322
|
/**
|
223
323
|
* Test method, calls http endpoint
|
224
|
-
* @param {string} url
|
225
|
-
* @returns {Promise<string>}
|
226
324
|
*/
|
227
325
|
http_get(url: string): Promise<string>;
|
326
|
+
crypto(): CryptoClient;
|
327
|
+
vault(): VaultClient;
|
328
|
+
}
|
329
|
+
export class ClientFolders {
|
330
|
+
private constructor();
|
331
|
+
free(): void;
|
228
332
|
/**
|
229
|
-
*
|
333
|
+
* Decrypt folder
|
230
334
|
*/
|
231
|
-
|
335
|
+
decrypt(folder: Folder): FolderView;
|
336
|
+
}
|
337
|
+
export class ClientTotp {
|
338
|
+
private constructor();
|
339
|
+
free(): void;
|
232
340
|
/**
|
233
|
-
*
|
341
|
+
* Generates a TOTP code from a provided key
|
342
|
+
*
|
343
|
+
* # Arguments
|
344
|
+
* - `key` - Can be:
|
345
|
+
* - A base32 encoded string
|
346
|
+
* - OTP Auth URI
|
347
|
+
* - Steam URI
|
348
|
+
* - `time_ms` - Optional timestamp in milliseconds
|
349
|
+
*
|
350
|
+
* # Returns
|
351
|
+
* - `Ok(TotpResponse)` containing the generated code and period
|
352
|
+
* - `Err(TotpError)` if code generation fails
|
234
353
|
*/
|
235
|
-
|
354
|
+
generate_totp(key: string, time_ms?: number | null): TotpResponse;
|
236
355
|
}
|
237
|
-
export class
|
356
|
+
export class CryptoClient {
|
357
|
+
private constructor();
|
238
358
|
free(): void;
|
239
359
|
/**
|
240
360
|
* Initialization method for the user crypto. Needs to be called before any other crypto
|
241
361
|
* operations.
|
242
|
-
* @param {InitUserCryptoRequest} req
|
243
|
-
* @returns {Promise<void>}
|
244
362
|
*/
|
245
363
|
initialize_user_crypto(req: InitUserCryptoRequest): Promise<void>;
|
246
364
|
/**
|
247
365
|
* Initialization method for the organization crypto. Needs to be called after
|
248
366
|
* `initialize_user_crypto` but before any other crypto operations.
|
249
|
-
* @param {InitOrgCryptoRequest} req
|
250
|
-
* @returns {Promise<void>}
|
251
367
|
*/
|
252
368
|
initialize_org_crypto(req: InitOrgCryptoRequest): Promise<void>;
|
253
|
-
}
|
254
|
-
export class ClientFolders {
|
255
|
-
free(): void;
|
256
369
|
/**
|
257
|
-
*
|
258
|
-
*
|
259
|
-
* @returns {FolderView}
|
370
|
+
* Generates a new key pair and encrypts the private key with the provided user key.
|
371
|
+
* Crypto initialization not required.
|
260
372
|
*/
|
261
|
-
|
262
|
-
}
|
263
|
-
export class ClientVault {
|
264
|
-
free(): void;
|
373
|
+
make_key_pair(user_key: string): MakeKeyPairResponse;
|
265
374
|
/**
|
266
|
-
*
|
375
|
+
* Verifies a user's asymmetric keys by decrypting the private key with the provided user
|
376
|
+
* key. Returns if the private key is decryptable and if it is a valid matching key.
|
377
|
+
* Crypto initialization not required.
|
267
378
|
*/
|
379
|
+
verify_asymmetric_keys(request: VerifyAsymmetricKeysRequest): VerifyAsymmetricKeysResponse;
|
380
|
+
}
|
381
|
+
export class VaultClient {
|
382
|
+
private constructor();
|
383
|
+
free(): void;
|
268
384
|
folders(): ClientFolders;
|
385
|
+
totp(): ClientTotp;
|
269
386
|
}
|