@bitwarden/sdk-internal 0.2.0-main.7 → 0.2.0-main.70
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 -36
- package/bitwarden_wasm_internal_bg.js +676 -403
- package/bitwarden_wasm_internal_bg.wasm +0 -0
- package/bitwarden_wasm_internal_bg.wasm.d.ts +35 -25
- package/bitwarden_wasm_internal_bg.wasm.js +1 -1
- package/node/bitwarden_wasm_internal.d.ts +155 -36
- package/node/bitwarden_wasm_internal.js +677 -404
- package/node/bitwarden_wasm_internal_bg.wasm +0 -0
- package/node/bitwarden_wasm_internal_bg.wasm.d.ts +35 -25
- package/package.json +5 -4
package/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
566b3a86d2a7b5d0fd0e9b0f98fb291be2301d5a
|
@@ -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): SshKey;
|
3
30
|
export enum LogLevel {
|
4
31
|
Trace = 0,
|
5
32
|
Debug = 1,
|
@@ -51,6 +78,75 @@ 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
|
+
|
118
|
+
export interface CoreError extends Error {
|
119
|
+
name: "CoreError";
|
120
|
+
variant:
|
121
|
+
| "MissingFieldError"
|
122
|
+
| "VaultLocked"
|
123
|
+
| "NotAuthenticated"
|
124
|
+
| "AccessTokenInvalid"
|
125
|
+
| "InvalidResponse"
|
126
|
+
| "Crypto"
|
127
|
+
| "IdentityFail"
|
128
|
+
| "Reqwest"
|
129
|
+
| "Serde"
|
130
|
+
| "Io"
|
131
|
+
| "InvalidBase64"
|
132
|
+
| "Chrono"
|
133
|
+
| "ResponseContent"
|
134
|
+
| "ValidationError"
|
135
|
+
| "InvalidStateFileVersion"
|
136
|
+
| "InvalidStateFile"
|
137
|
+
| "Internal"
|
138
|
+
| "EncryptionSettings";
|
139
|
+
}
|
140
|
+
|
141
|
+
export function isCoreError(error: any): error is CoreError;
|
142
|
+
|
143
|
+
export interface EncryptionSettingsError extends Error {
|
144
|
+
name: "EncryptionSettingsError";
|
145
|
+
variant: "Crypto" | "InvalidBase64" | "VaultLocked" | "InvalidPrivateKey" | "MissingPrivateKey";
|
146
|
+
}
|
147
|
+
|
148
|
+
export function isEncryptionSettingsError(error: any): error is EncryptionSettingsError;
|
149
|
+
|
54
150
|
export type DeviceType =
|
55
151
|
| "Android"
|
56
152
|
| "iOS"
|
@@ -129,6 +225,38 @@ export type Kdf =
|
|
129
225
|
| { pBKDF2: { iterations: NonZeroU32 } }
|
130
226
|
| { argon2id: { iterations: NonZeroU32; memory: NonZeroU32; parallelism: NonZeroU32 } };
|
131
227
|
|
228
|
+
export interface SshKey {
|
229
|
+
/**
|
230
|
+
* The private key in OpenSSH format
|
231
|
+
*/
|
232
|
+
private_key: string;
|
233
|
+
public_key: string;
|
234
|
+
key_fingerprint: string;
|
235
|
+
}
|
236
|
+
|
237
|
+
export type KeyAlgorithm = "Ed25519" | "Rsa3072" | "Rsa4096";
|
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
|
+
|
253
|
+
export interface KeyGenerationError extends Error {
|
254
|
+
name: "KeyGenerationError";
|
255
|
+
variant: "KeyGenerationError" | "KeyConversionError";
|
256
|
+
}
|
257
|
+
|
258
|
+
export function isKeyGenerationError(error: any): error is KeyGenerationError;
|
259
|
+
|
132
260
|
export interface Folder {
|
133
261
|
id: Uuid | undefined;
|
134
262
|
name: EncString;
|
@@ -141,6 +269,12 @@ export interface FolderView {
|
|
141
269
|
revisionDate: DateTime<Utc>;
|
142
270
|
}
|
143
271
|
|
272
|
+
export interface TestError extends Error {
|
273
|
+
name: "TestError";
|
274
|
+
}
|
275
|
+
|
276
|
+
export function isTestError(error: any): error is TestError;
|
277
|
+
|
144
278
|
export type Uuid = string;
|
145
279
|
|
146
280
|
/**
|
@@ -161,70 +295,55 @@ export type NonZeroU32 = number;
|
|
161
295
|
|
162
296
|
export class BitwardenClient {
|
163
297
|
free(): void;
|
164
|
-
/**
|
165
|
-
* @param {ClientSettings | undefined} [settings]
|
166
|
-
* @param {LogLevel | undefined} [log_level]
|
167
|
-
*/
|
168
298
|
constructor(settings?: ClientSettings, log_level?: LogLevel);
|
169
299
|
/**
|
170
300
|
* Test method, echoes back the input
|
171
|
-
* @param {string} msg
|
172
|
-
* @returns {string}
|
173
301
|
*/
|
174
302
|
echo(msg: string): string;
|
175
|
-
/**
|
176
|
-
* @returns {string}
|
177
|
-
*/
|
178
303
|
version(): string;
|
179
|
-
/**
|
180
|
-
* @param {string} msg
|
181
|
-
*/
|
182
304
|
throw(msg: string): void;
|
183
305
|
/**
|
184
306
|
* Test method, calls http endpoint
|
185
|
-
* @param {string} url
|
186
|
-
* @returns {Promise<string>}
|
187
307
|
*/
|
188
308
|
http_get(url: string): Promise<string>;
|
309
|
+
crypto(): CryptoClient;
|
310
|
+
vault(): VaultClient;
|
311
|
+
}
|
312
|
+
export class ClientFolders {
|
313
|
+
private constructor();
|
314
|
+
free(): void;
|
189
315
|
/**
|
190
|
-
*
|
191
|
-
*/
|
192
|
-
crypto(): ClientCrypto;
|
193
|
-
/**
|
194
|
-
* @returns {ClientVault}
|
316
|
+
* Decrypt folder
|
195
317
|
*/
|
196
|
-
|
318
|
+
decrypt(folder: Folder): FolderView;
|
197
319
|
}
|
198
|
-
export class
|
320
|
+
export class CryptoClient {
|
321
|
+
private constructor();
|
199
322
|
free(): void;
|
200
323
|
/**
|
201
324
|
* Initialization method for the user crypto. Needs to be called before any other crypto
|
202
325
|
* operations.
|
203
|
-
* @param {InitUserCryptoRequest} req
|
204
|
-
* @returns {Promise<void>}
|
205
326
|
*/
|
206
327
|
initialize_user_crypto(req: InitUserCryptoRequest): Promise<void>;
|
207
328
|
/**
|
208
329
|
* Initialization method for the organization crypto. Needs to be called after
|
209
330
|
* `initialize_user_crypto` but before any other crypto operations.
|
210
|
-
* @param {InitOrgCryptoRequest} req
|
211
|
-
* @returns {Promise<void>}
|
212
331
|
*/
|
213
332
|
initialize_org_crypto(req: InitOrgCryptoRequest): Promise<void>;
|
214
|
-
}
|
215
|
-
export class ClientFolders {
|
216
|
-
free(): void;
|
217
333
|
/**
|
218
|
-
*
|
219
|
-
*
|
220
|
-
* @returns {FolderView}
|
334
|
+
* Generates a new key pair and encrypts the private key with the provided user key.
|
335
|
+
* Crypto initialization not required.
|
221
336
|
*/
|
222
|
-
|
223
|
-
}
|
224
|
-
export class ClientVault {
|
225
|
-
free(): void;
|
337
|
+
make_key_pair(user_key: string): MakeKeyPairResponse;
|
226
338
|
/**
|
227
|
-
*
|
339
|
+
* Verifies a user's asymmetric keys by decrypting the private key with the provided user
|
340
|
+
* key. Returns if the private key is decryptable and if it is a valid matching key.
|
341
|
+
* Crypto initialization not required.
|
228
342
|
*/
|
343
|
+
verify_asymmetric_keys(request: VerifyAsymmetricKeysRequest): VerifyAsymmetricKeysResponse;
|
344
|
+
}
|
345
|
+
export class VaultClient {
|
346
|
+
private constructor();
|
347
|
+
free(): void;
|
229
348
|
folders(): ClientFolders;
|
230
349
|
}
|