@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";
|
@@ -272,6 +272,32 @@ export function isEncryptionSettingsError(error) {
|
|
272
272
|
}
|
273
273
|
}
|
274
274
|
|
275
|
+
/**
|
276
|
+
* @param {any} error
|
277
|
+
* @returns {boolean}
|
278
|
+
*/
|
279
|
+
export function isSshKeyExportError(error) {
|
280
|
+
try {
|
281
|
+
const ret = wasm.isSshKeyExportError(addBorrowedObject(error));
|
282
|
+
return ret !== 0;
|
283
|
+
} finally {
|
284
|
+
heap[stack_pointer++] = undefined;
|
285
|
+
}
|
286
|
+
}
|
287
|
+
|
288
|
+
/**
|
289
|
+
* @param {any} error
|
290
|
+
* @returns {boolean}
|
291
|
+
*/
|
292
|
+
export function isSshKeyImportError(error) {
|
293
|
+
try {
|
294
|
+
const ret = wasm.isSshKeyImportError(addBorrowedObject(error));
|
295
|
+
return ret !== 0;
|
296
|
+
} finally {
|
297
|
+
heap[stack_pointer++] = undefined;
|
298
|
+
}
|
299
|
+
}
|
300
|
+
|
275
301
|
/**
|
276
302
|
* @param {any} error
|
277
303
|
* @returns {boolean}
|
@@ -299,8 +325,16 @@ export function isTestError(error) {
|
|
299
325
|
}
|
300
326
|
|
301
327
|
/**
|
328
|
+
* Generate a new SSH key pair
|
329
|
+
*
|
330
|
+
* # Arguments
|
331
|
+
* - `key_algorithm` - The algorithm to use for the key pair
|
332
|
+
*
|
333
|
+
* # Returns
|
334
|
+
* - `Ok(SshKey)` if the key was successfully generated
|
335
|
+
* - `Err(KeyGenerationError)` if the key could not be generated
|
302
336
|
* @param {KeyAlgorithm} key_algorithm
|
303
|
-
* @returns {
|
337
|
+
* @returns {SshKey}
|
304
338
|
*/
|
305
339
|
export function generate_ssh_key(key_algorithm) {
|
306
340
|
try {
|
@@ -318,16 +352,56 @@ export function generate_ssh_key(key_algorithm) {
|
|
318
352
|
}
|
319
353
|
}
|
320
354
|
|
355
|
+
/**
|
356
|
+
* Convert a PCKS8 or OpenSSH encrypted or unencrypted private key
|
357
|
+
* to an OpenSSH private key with public key and fingerprint
|
358
|
+
*
|
359
|
+
* # Arguments
|
360
|
+
* - `imported_key` - The private key to convert
|
361
|
+
* - `password` - The password to use for decrypting the key
|
362
|
+
*
|
363
|
+
* # Returns
|
364
|
+
* - `Ok(SshKey)` if the key was successfully coneverted
|
365
|
+
* - `Err(PasswordRequired)` if the key is encrypted and no password was provided
|
366
|
+
* - `Err(WrongPassword)` if the password provided is incorrect
|
367
|
+
* - `Err(ParsingError)` if the key could not be parsed
|
368
|
+
* - `Err(UnsupportedKeyType)` if the key type is not supported
|
369
|
+
* @param {string} imported_key
|
370
|
+
* @param {string | undefined} [password]
|
371
|
+
* @returns {SshKey}
|
372
|
+
*/
|
373
|
+
export function import_ssh_key(imported_key, password) {
|
374
|
+
try {
|
375
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
376
|
+
const ptr0 = passStringToWasm0(imported_key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
377
|
+
const len0 = WASM_VECTOR_LEN;
|
378
|
+
var ptr1 = isLikeNone(password)
|
379
|
+
? 0
|
380
|
+
: passStringToWasm0(password, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
381
|
+
var len1 = WASM_VECTOR_LEN;
|
382
|
+
wasm.import_ssh_key(retptr, ptr0, len0, ptr1, len1);
|
383
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
384
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
385
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
386
|
+
if (r2) {
|
387
|
+
throw takeObject(r1);
|
388
|
+
}
|
389
|
+
return takeObject(r0);
|
390
|
+
} finally {
|
391
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
392
|
+
}
|
393
|
+
}
|
394
|
+
|
321
395
|
function __wbg_adapter_38(arg0, arg1, arg2) {
|
322
|
-
wasm.
|
396
|
+
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hc12b2748bafd9ecb(
|
323
397
|
arg0,
|
324
398
|
arg1,
|
325
399
|
addHeapObject(arg2),
|
326
400
|
);
|
327
401
|
}
|
328
402
|
|
329
|
-
function
|
330
|
-
wasm.
|
403
|
+
function __wbg_adapter_130(arg0, arg1, arg2, arg3) {
|
404
|
+
wasm.wasm_bindgen__convert__closures__invoke2_mut__h423fb4c5cede6659(
|
331
405
|
arg0,
|
332
406
|
arg1,
|
333
407
|
addHeapObject(arg2),
|
@@ -876,7 +950,7 @@ export function __wbg_new_3d446df9155128ef(arg0, arg1) {
|
|
876
950
|
const a = state0.a;
|
877
951
|
state0.a = 0;
|
878
952
|
try {
|
879
|
-
return
|
953
|
+
return __wbg_adapter_130(a, state0.b, arg0, arg1);
|
880
954
|
} finally {
|
881
955
|
state0.a = a;
|
882
956
|
}
|
@@ -1181,8 +1255,8 @@ export function __wbindgen_cb_drop(arg0) {
|
|
1181
1255
|
return ret;
|
1182
1256
|
}
|
1183
1257
|
|
1184
|
-
export function
|
1185
|
-
const ret = makeMutClosure(arg0, arg1,
|
1258
|
+
export function __wbindgen_closure_wrapper2041(arg0, arg1, arg2) {
|
1259
|
+
const ret = makeMutClosure(arg0, arg1, 546, __wbg_adapter_38);
|
1186
1260
|
return addHeapObject(ret);
|
1187
1261
|
}
|
1188
1262
|
|
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,
|