@bitwarden/sdk-internal 0.2.0-main.46 → 0.2.0-main.49
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/bitwarden_wasm_internal.d.ts +45 -2
- package/bitwarden_wasm_internal_bg.js +81 -7
- package/bitwarden_wasm_internal_bg.wasm +0 -0
- package/bitwarden_wasm_internal_bg.wasm.d.ts +5 -2
- package/bitwarden_wasm_internal_bg.wasm.js +1 -1
- package/node/bitwarden_wasm_internal.d.ts +45 -2
- package/node/bitwarden_wasm_internal.js +81 -7
- package/node/bitwarden_wasm_internal_bg.wasm +0 -0
- package/node/bitwarden_wasm_internal_bg.wasm.d.ts +5 -2
- package/package.json +1 -1
@@ -1,6 +1,32 @@
|
|
1
1
|
/* tslint:disable */
|
2
2
|
/* eslint-disable */
|
3
|
-
|
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): SshKey;
|
4
30
|
export enum LogLevel {
|
5
31
|
Trace = 0,
|
6
32
|
Debug = 1,
|
@@ -199,7 +225,10 @@ export type Kdf =
|
|
199
225
|
| { pBKDF2: { iterations: NonZeroU32 } }
|
200
226
|
| { argon2id: { iterations: NonZeroU32; memory: NonZeroU32; parallelism: NonZeroU32 } };
|
201
227
|
|
202
|
-
export interface
|
228
|
+
export interface SshKey {
|
229
|
+
/**
|
230
|
+
* The private key in OpenSSH format
|
231
|
+
*/
|
203
232
|
private_key: string;
|
204
233
|
public_key: string;
|
205
234
|
key_fingerprint: string;
|
@@ -207,6 +236,20 @@ export interface GenerateSshKeyResult {
|
|
207
236
|
|
208
237
|
export type KeyAlgorithm = "Ed25519" | "Rsa3072" | "Rsa4096";
|
209
238
|
|
239
|
+
export interface SshKeyExportError extends Error {
|
240
|
+
name: "SshKeyExportError";
|
241
|
+
variant: "KeyConversionError";
|
242
|
+
}
|
243
|
+
|
244
|
+
export function isSshKeyExportError(error: any): error is SshKeyExportError;
|
245
|
+
|
246
|
+
export interface SshKeyImportError extends Error {
|
247
|
+
name: "SshKeyImportError";
|
248
|
+
variant: "ParsingError" | "PasswordRequired" | "WrongPassword" | "UnsupportedKeyType";
|
249
|
+
}
|
250
|
+
|
251
|
+
export function isSshKeyImportError(error: any): error is SshKeyImportError;
|
252
|
+
|
210
253
|
export interface KeyGenerationError extends Error {
|
211
254
|
name: "KeyGenerationError";
|
212
255
|
variant: "KeyGenerationError" | "KeyConversionError";
|
@@ -266,6 +266,32 @@ module.exports.isEncryptionSettingsError = function (error) {
|
|
266
266
|
}
|
267
267
|
};
|
268
268
|
|
269
|
+
/**
|
270
|
+
* @param {any} error
|
271
|
+
* @returns {boolean}
|
272
|
+
*/
|
273
|
+
module.exports.isSshKeyExportError = function (error) {
|
274
|
+
try {
|
275
|
+
const ret = wasm.isSshKeyExportError(addBorrowedObject(error));
|
276
|
+
return ret !== 0;
|
277
|
+
} finally {
|
278
|
+
heap[stack_pointer++] = undefined;
|
279
|
+
}
|
280
|
+
};
|
281
|
+
|
282
|
+
/**
|
283
|
+
* @param {any} error
|
284
|
+
* @returns {boolean}
|
285
|
+
*/
|
286
|
+
module.exports.isSshKeyImportError = function (error) {
|
287
|
+
try {
|
288
|
+
const ret = wasm.isSshKeyImportError(addBorrowedObject(error));
|
289
|
+
return ret !== 0;
|
290
|
+
} finally {
|
291
|
+
heap[stack_pointer++] = undefined;
|
292
|
+
}
|
293
|
+
};
|
294
|
+
|
269
295
|
/**
|
270
296
|
* @param {any} error
|
271
297
|
* @returns {boolean}
|
@@ -293,8 +319,16 @@ module.exports.isTestError = function (error) {
|
|
293
319
|
};
|
294
320
|
|
295
321
|
/**
|
322
|
+
* Generate a new SSH key pair
|
323
|
+
*
|
324
|
+
* # Arguments
|
325
|
+
* - `key_algorithm` - The algorithm to use for the key pair
|
326
|
+
*
|
327
|
+
* # Returns
|
328
|
+
* - `Ok(SshKey)` if the key was successfully generated
|
329
|
+
* - `Err(KeyGenerationError)` if the key could not be generated
|
296
330
|
* @param {KeyAlgorithm} key_algorithm
|
297
|
-
* @returns {
|
331
|
+
* @returns {SshKey}
|
298
332
|
*/
|
299
333
|
module.exports.generate_ssh_key = function (key_algorithm) {
|
300
334
|
try {
|
@@ -312,16 +346,56 @@ module.exports.generate_ssh_key = function (key_algorithm) {
|
|
312
346
|
}
|
313
347
|
};
|
314
348
|
|
349
|
+
/**
|
350
|
+
* Convert a PCKS8 or OpenSSH encrypted or unencrypted private key
|
351
|
+
* to an OpenSSH private key with public key and fingerprint
|
352
|
+
*
|
353
|
+
* # Arguments
|
354
|
+
* - `imported_key` - The private key to convert
|
355
|
+
* - `password` - The password to use for decrypting the key
|
356
|
+
*
|
357
|
+
* # Returns
|
358
|
+
* - `Ok(SshKey)` if the key was successfully coneverted
|
359
|
+
* - `Err(PasswordRequired)` if the key is encrypted and no password was provided
|
360
|
+
* - `Err(WrongPassword)` if the password provided is incorrect
|
361
|
+
* - `Err(ParsingError)` if the key could not be parsed
|
362
|
+
* - `Err(UnsupportedKeyType)` if the key type is not supported
|
363
|
+
* @param {string} imported_key
|
364
|
+
* @param {string | undefined} [password]
|
365
|
+
* @returns {SshKey}
|
366
|
+
*/
|
367
|
+
module.exports.import_ssh_key = function (imported_key, password) {
|
368
|
+
try {
|
369
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
370
|
+
const ptr0 = passStringToWasm0(imported_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
371
|
+
const len0 = WASM_VECTOR_LEN;
|
372
|
+
var ptr1 = isLikeNone(password)
|
373
|
+
? 0
|
374
|
+
: passStringToWasm0(password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
375
|
+
var len1 = WASM_VECTOR_LEN;
|
376
|
+
wasm.import_ssh_key(retptr, ptr0, len0, ptr1, len1);
|
377
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
378
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
379
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
380
|
+
if (r2) {
|
381
|
+
throw takeObject(r1);
|
382
|
+
}
|
383
|
+
return takeObject(r0);
|
384
|
+
} finally {
|
385
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
386
|
+
}
|
387
|
+
};
|
388
|
+
|
315
389
|
function __wbg_adapter_38(arg0, arg1, arg2) {
|
316
|
-
wasm.
|
390
|
+
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hc12b2748bafd9ecb(
|
317
391
|
arg0,
|
318
392
|
arg1,
|
319
393
|
addHeapObject(arg2),
|
320
394
|
);
|
321
395
|
}
|
322
396
|
|
323
|
-
function
|
324
|
-
wasm.
|
397
|
+
function __wbg_adapter_130(arg0, arg1, arg2, arg3) {
|
398
|
+
wasm.wasm_bindgen__convert__closures__invoke2_mut__h423fb4c5cede6659(
|
325
399
|
arg0,
|
326
400
|
arg1,
|
327
401
|
addHeapObject(arg2),
|
@@ -874,7 +948,7 @@ module.exports.__wbg_new_3d446df9155128ef = function (arg0, arg1) {
|
|
874
948
|
const a = state0.a;
|
875
949
|
state0.a = 0;
|
876
950
|
try {
|
877
|
-
return
|
951
|
+
return __wbg_adapter_130(a, state0.b, arg0, arg1);
|
878
952
|
} finally {
|
879
953
|
state0.a = a;
|
880
954
|
}
|
@@ -1179,8 +1253,8 @@ module.exports.__wbindgen_cb_drop = function (arg0) {
|
|
1179
1253
|
return ret;
|
1180
1254
|
};
|
1181
1255
|
|
1182
|
-
module.exports.
|
1183
|
-
const ret = makeMutClosure(arg0, arg1,
|
1256
|
+
module.exports.__wbindgen_closure_wrapper2041 = function (arg0, arg1, arg2) {
|
1257
|
+
const ret = makeMutClosure(arg0, arg1, 546, __wbg_adapter_38);
|
1184
1258
|
return addHeapObject(ret);
|
1185
1259
|
};
|
1186
1260
|
|
Binary file
|
@@ -3,6 +3,8 @@
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
4
4
|
export const isCoreError: (a: number) => number;
|
5
5
|
export const isEncryptionSettingsError: (a: number) => number;
|
6
|
+
export const isSshKeyExportError: (a: number) => number;
|
7
|
+
export const isSshKeyImportError: (a: number) => number;
|
6
8
|
export const isKeyGenerationError: (a: number) => number;
|
7
9
|
export const __wbg_bitwardenclient_free: (a: number, b: number) => void;
|
8
10
|
export const bitwardenclient_new: (a: number, b: number) => number;
|
@@ -17,6 +19,7 @@ export const cryptoclient_initialize_org_crypto: (a: number, b: number) => numbe
|
|
17
19
|
export const cryptoclient_make_key_pair: (a: number, b: number, c: number, d: number) => void;
|
18
20
|
export const cryptoclient_verify_asymmetric_keys: (a: number, b: number, c: number) => void;
|
19
21
|
export const generate_ssh_key: (a: number, b: number) => void;
|
22
|
+
export const import_ssh_key: (a: number, b: number, c: number, d: number, e: number) => void;
|
20
23
|
export const clientfolders_decrypt: (a: number, b: number, c: number) => void;
|
21
24
|
export const __wbg_cryptoclient_free: (a: number, b: number) => void;
|
22
25
|
export const __wbg_clientfolders_free: (a: number, b: number) => void;
|
@@ -29,12 +32,12 @@ export const __wbindgen_exn_store: (a: number) => void;
|
|
29
32
|
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
30
33
|
export const __wbindgen_export_4: WebAssembly.Table;
|
31
34
|
export const __wbindgen_add_to_stack_pointer: (a: number) => number;
|
32
|
-
export const
|
35
|
+
export const _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hc12b2748bafd9ecb: (
|
33
36
|
a: number,
|
34
37
|
b: number,
|
35
38
|
c: number,
|
36
39
|
) => void;
|
37
|
-
export const
|
40
|
+
export const wasm_bindgen__convert__closures__invoke2_mut__h423fb4c5cede6659: (
|
38
41
|
a: number,
|
39
42
|
b: number,
|
40
43
|
c: number,
|