@bitwarden/sdk-internal 0.2.0-main.4 → 0.2.0-main.40
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 +106 -30
- package/bitwarden_wasm_internal_bg.js +561 -370
- package/bitwarden_wasm_internal_bg.wasm +0 -0
- package/bitwarden_wasm_internal_bg.wasm.d.ts +32 -25
- package/bitwarden_wasm_internal_bg.wasm.js +1 -1
- package/node/bitwarden_wasm_internal.d.ts +106 -30
- package/node/bitwarden_wasm_internal.js +560 -369
- package/node/bitwarden_wasm_internal_bg.wasm +0 -0
- package/node/bitwarden_wasm_internal_bg.wasm.d.ts +32 -25
- package/package.json +1 -1
@@ -1,5 +1,6 @@
|
|
1
1
|
/* tslint:disable */
|
2
2
|
/* eslint-disable */
|
3
|
+
export function generate_ssh_key(key_algorithm: KeyAlgorithm): GenerateSshKeyResult;
|
3
4
|
export enum LogLevel {
|
4
5
|
Trace = 0,
|
5
6
|
Debug = 1,
|
@@ -51,6 +52,75 @@ export interface InitOrgCryptoRequest {
|
|
51
52
|
organizationKeys: Map<Uuid, AsymmetricEncString>;
|
52
53
|
}
|
53
54
|
|
55
|
+
export interface MakeKeyPairResponse {
|
56
|
+
/**
|
57
|
+
* The user\'s public key
|
58
|
+
*/
|
59
|
+
userPublicKey: string;
|
60
|
+
/**
|
61
|
+
* User\'s private key, encrypted with the user key
|
62
|
+
*/
|
63
|
+
userKeyEncryptedPrivateKey: EncString;
|
64
|
+
}
|
65
|
+
|
66
|
+
export interface VerifyAsymmetricKeysRequest {
|
67
|
+
/**
|
68
|
+
* The user\'s user key
|
69
|
+
*/
|
70
|
+
userKey: string;
|
71
|
+
/**
|
72
|
+
* The user\'s public key
|
73
|
+
*/
|
74
|
+
userPublicKey: string;
|
75
|
+
/**
|
76
|
+
* User\'s private key, encrypted with the user key
|
77
|
+
*/
|
78
|
+
userKeyEncryptedPrivateKey: EncString;
|
79
|
+
}
|
80
|
+
|
81
|
+
export interface VerifyAsymmetricKeysResponse {
|
82
|
+
/**
|
83
|
+
* Whether the user\'s private key was decryptable by the user key.
|
84
|
+
*/
|
85
|
+
privateKeyDecryptable: boolean;
|
86
|
+
/**
|
87
|
+
* Whether the user\'s private key was a valid RSA key and matched the public key provided.
|
88
|
+
*/
|
89
|
+
validPrivateKey: boolean;
|
90
|
+
}
|
91
|
+
|
92
|
+
export interface CoreError extends Error {
|
93
|
+
name: "CoreError";
|
94
|
+
variant:
|
95
|
+
| "MissingFieldError"
|
96
|
+
| "VaultLocked"
|
97
|
+
| "NotAuthenticated"
|
98
|
+
| "AccessTokenInvalid"
|
99
|
+
| "InvalidResponse"
|
100
|
+
| "Crypto"
|
101
|
+
| "IdentityFail"
|
102
|
+
| "Reqwest"
|
103
|
+
| "Serde"
|
104
|
+
| "Io"
|
105
|
+
| "InvalidBase64"
|
106
|
+
| "Chrono"
|
107
|
+
| "ResponseContent"
|
108
|
+
| "ValidationError"
|
109
|
+
| "InvalidStateFileVersion"
|
110
|
+
| "InvalidStateFile"
|
111
|
+
| "Internal"
|
112
|
+
| "EncryptionSettings";
|
113
|
+
}
|
114
|
+
|
115
|
+
export function isCoreError(error: any): error is CoreError;
|
116
|
+
|
117
|
+
export interface EncryptionSettingsError extends Error {
|
118
|
+
name: "EncryptionSettingsError";
|
119
|
+
variant: "Crypto" | "InvalidBase64" | "VaultLocked" | "InvalidPrivateKey" | "MissingPrivateKey";
|
120
|
+
}
|
121
|
+
|
122
|
+
export function isEncryptionSettingsError(error: any): error is EncryptionSettingsError;
|
123
|
+
|
54
124
|
export type DeviceType =
|
55
125
|
| "Android"
|
56
126
|
| "iOS"
|
@@ -129,6 +199,21 @@ export type Kdf =
|
|
129
199
|
| { pBKDF2: { iterations: NonZeroU32 } }
|
130
200
|
| { argon2id: { iterations: NonZeroU32; memory: NonZeroU32; parallelism: NonZeroU32 } };
|
131
201
|
|
202
|
+
export interface GenerateSshKeyResult {
|
203
|
+
private_key: string;
|
204
|
+
public_key: string;
|
205
|
+
key_fingerprint: string;
|
206
|
+
}
|
207
|
+
|
208
|
+
export type KeyAlgorithm = "Ed25519" | "Rsa3072" | "Rsa4096";
|
209
|
+
|
210
|
+
export interface KeyGenerationError extends Error {
|
211
|
+
name: "KeyGenerationError";
|
212
|
+
variant: "KeyGenerationError" | "KeyConversionError";
|
213
|
+
}
|
214
|
+
|
215
|
+
export function isKeyGenerationError(error: any): error is KeyGenerationError;
|
216
|
+
|
132
217
|
export interface Folder {
|
133
218
|
id: Uuid | undefined;
|
134
219
|
name: EncString;
|
@@ -141,6 +226,12 @@ export interface FolderView {
|
|
141
226
|
revisionDate: DateTime<Utc>;
|
142
227
|
}
|
143
228
|
|
229
|
+
export interface TestError extends Error {
|
230
|
+
name: "TestError";
|
231
|
+
}
|
232
|
+
|
233
|
+
export function isTestError(error: any): error is TestError;
|
234
|
+
|
144
235
|
export type Uuid = string;
|
145
236
|
|
146
237
|
/**
|
@@ -161,70 +252,55 @@ export type NonZeroU32 = number;
|
|
161
252
|
|
162
253
|
export class BitwardenClient {
|
163
254
|
free(): void;
|
164
|
-
/**
|
165
|
-
* @param {ClientSettings | undefined} [settings]
|
166
|
-
* @param {LogLevel | undefined} [log_level]
|
167
|
-
*/
|
168
255
|
constructor(settings?: ClientSettings, log_level?: LogLevel);
|
169
256
|
/**
|
170
257
|
* Test method, echoes back the input
|
171
|
-
* @param {string} msg
|
172
|
-
* @returns {string}
|
173
258
|
*/
|
174
259
|
echo(msg: string): string;
|
175
|
-
/**
|
176
|
-
* @returns {string}
|
177
|
-
*/
|
178
260
|
version(): string;
|
179
|
-
|
180
|
-
* @param {string} msg
|
181
|
-
*/
|
182
|
-
throw(msg: string): void;
|
261
|
+
throw(msg: string): Promise<void>;
|
183
262
|
/**
|
184
263
|
* Test method, calls http endpoint
|
185
|
-
* @param {string} url
|
186
|
-
* @returns {Promise<string>}
|
187
264
|
*/
|
188
265
|
http_get(url: string): Promise<string>;
|
189
|
-
/**
|
190
|
-
* @returns {ClientCrypto}
|
191
|
-
*/
|
192
266
|
crypto(): ClientCrypto;
|
193
|
-
/**
|
194
|
-
* @returns {ClientVault}
|
195
|
-
*/
|
196
267
|
vault(): ClientVault;
|
197
268
|
}
|
198
269
|
export class ClientCrypto {
|
270
|
+
private constructor();
|
199
271
|
free(): void;
|
200
272
|
/**
|
201
273
|
* Initialization method for the user crypto. Needs to be called before any other crypto
|
202
274
|
* operations.
|
203
|
-
* @param {InitUserCryptoRequest} req
|
204
|
-
* @returns {Promise<void>}
|
205
275
|
*/
|
206
276
|
initialize_user_crypto(req: InitUserCryptoRequest): Promise<void>;
|
207
277
|
/**
|
208
278
|
* Initialization method for the organization crypto. Needs to be called after
|
209
279
|
* `initialize_user_crypto` but before any other crypto operations.
|
210
|
-
* @param {InitOrgCryptoRequest} req
|
211
|
-
* @returns {Promise<void>}
|
212
280
|
*/
|
213
281
|
initialize_org_crypto(req: InitOrgCryptoRequest): Promise<void>;
|
282
|
+
/**
|
283
|
+
* Generates a new key pair and encrypts the private key with the provided user key.
|
284
|
+
* Crypto initialization not required.
|
285
|
+
*/
|
286
|
+
make_key_pair(user_key: string): MakeKeyPairResponse;
|
287
|
+
/**
|
288
|
+
* Verifies a user's asymmetric keys by decrypting the private key with the provided user
|
289
|
+
* key. Returns if the private key is decryptable and if it is a valid matching key.
|
290
|
+
* Crypto initialization not required.
|
291
|
+
*/
|
292
|
+
verify_asymmetric_keys(request: VerifyAsymmetricKeysRequest): VerifyAsymmetricKeysResponse;
|
214
293
|
}
|
215
294
|
export class ClientFolders {
|
295
|
+
private constructor();
|
216
296
|
free(): void;
|
217
297
|
/**
|
218
298
|
* Decrypt folder
|
219
|
-
* @param {Folder} folder
|
220
|
-
* @returns {FolderView}
|
221
299
|
*/
|
222
300
|
decrypt(folder: Folder): FolderView;
|
223
301
|
}
|
224
302
|
export class ClientVault {
|
303
|
+
private constructor();
|
225
304
|
free(): void;
|
226
|
-
/**
|
227
|
-
* @returns {ClientFolders}
|
228
|
-
*/
|
229
305
|
folders(): ClientFolders;
|
230
306
|
}
|