@bitwarden/sdk-internal 0.2.0-main.231 → 0.2.0-main.233

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 CHANGED
@@ -1 +1 @@
1
- 812865fe73b742f82360060430cb1003a9e0e3e5
1
+ f1fc29b660d4669b7618fbd70d42d217e22619d3
@@ -1,20 +1,5 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- /**
4
- * Registers a DiscoverHandler so that the client can respond to DiscoverRequests.
5
- */
6
- export function ipcRegisterDiscoverHandler(
7
- ipc_client: IpcClient,
8
- response: DiscoverResponse,
9
- ): Promise<void>;
10
- /**
11
- * Sends a DiscoverRequest to the specified destination and returns the response.
12
- */
13
- export function ipcRequestDiscover(
14
- ipc_client: IpcClient,
15
- destination: Endpoint,
16
- abort_signal?: AbortSignal | null,
17
- ): Promise<DiscoverResponse>;
18
3
  export function set_log_level(level: LogLevel): void;
19
4
  export function init_sdk(log_level?: LogLevel | null): void;
20
5
  /**
@@ -44,6 +29,21 @@ export function generate_ssh_key(key_algorithm: KeyAlgorithm): SshKeyView;
44
29
  * - `Err(UnsupportedKeyType)` if the key type is not supported
45
30
  */
46
31
  export function import_ssh_key(imported_key: string, password?: string | null): SshKeyView;
32
+ /**
33
+ * Registers a DiscoverHandler so that the client can respond to DiscoverRequests.
34
+ */
35
+ export function ipcRegisterDiscoverHandler(
36
+ ipc_client: IpcClient,
37
+ response: DiscoverResponse,
38
+ ): Promise<void>;
39
+ /**
40
+ * Sends a DiscoverRequest to the specified destination and returns the response.
41
+ */
42
+ export function ipcRequestDiscover(
43
+ ipc_client: IpcClient,
44
+ destination: Endpoint,
45
+ abort_signal?: AbortSignal | null,
46
+ ): Promise<DiscoverResponse>;
47
47
  export enum CardLinkedIdType {
48
48
  CardholderName = 300,
49
49
  ExpMonth = 301,
@@ -112,6 +112,52 @@ export enum UriMatchType {
112
112
  RegularExpression = 4,
113
113
  Never = 5,
114
114
  }
115
+
116
+ import { Tagged } from "type-fest";
117
+
118
+ /**
119
+ * A string that **MUST** be a valid UUID.
120
+ *
121
+ * Never create or cast to this type directly, use the `uuid<T>()` function instead.
122
+ */
123
+ // TODO: Uncomment this when the `uuid` crate is used.
124
+ // export type Uuid = unknown;
125
+
126
+ export type Uuid = string;
127
+
128
+ /**
129
+ * RFC3339 compliant date-time string.
130
+ * @typeParam T - Not used in JavaScript.
131
+ */
132
+ export type DateTime<T = unknown> = string;
133
+
134
+ /**
135
+ * UTC date-time string. Not used in JavaScript.
136
+ */
137
+ export type Utc = unknown;
138
+
139
+ /**
140
+ * An integer that is known not to equal zero.
141
+ */
142
+ export type NonZeroU32 = number;
143
+
144
+ export interface Repository<T> {
145
+ get(id: string): Promise<T | null>;
146
+ list(): Promise<T[]>;
147
+ set(id: string, value: T): Promise<void>;
148
+ remove(id: string): Promise<void>;
149
+ }
150
+
151
+ export interface TokenProvider {
152
+ get_access_token(): Promise<string | undefined>;
153
+ }
154
+
155
+ export interface TestError extends Error {
156
+ name: "TestError";
157
+ }
158
+
159
+ export function isTestError(error: any): error is TestError;
160
+
115
161
  /**
116
162
  * State used for initializing the user cryptographic state.
117
163
  */
@@ -998,6 +1044,16 @@ export interface SecureNoteView {
998
1044
  type: SecureNoteType;
999
1045
  }
1000
1046
 
1047
+ /**
1048
+ * Request to add or edit a folder.
1049
+ */
1050
+ export interface FolderAddEditRequest {
1051
+ /**
1052
+ * The new name of the folder.
1053
+ */
1054
+ name: string;
1055
+ }
1056
+
1001
1057
  export interface Folder {
1002
1058
  id: Uuid | undefined;
1003
1059
  name: EncString;
@@ -1052,6 +1108,34 @@ export interface PasswordHistory {
1052
1108
  lastUsedDate: DateTime<Utc>;
1053
1109
  }
1054
1110
 
1111
+ export interface GetFolderError extends Error {
1112
+ name: "GetFolderError";
1113
+ variant: "ItemNotFound" | "Crypto" | "RepositoryError";
1114
+ }
1115
+
1116
+ export function isGetFolderError(error: any): error is GetFolderError;
1117
+
1118
+ export interface EditFolderError extends Error {
1119
+ name: "EditFolderError";
1120
+ variant:
1121
+ | "ItemNotFound"
1122
+ | "Crypto"
1123
+ | "Api"
1124
+ | "VaultParse"
1125
+ | "MissingField"
1126
+ | "RepositoryError"
1127
+ | "Uuid";
1128
+ }
1129
+
1130
+ export function isEditFolderError(error: any): error is EditFolderError;
1131
+
1132
+ export interface CreateFolderError extends Error {
1133
+ name: "CreateFolderError";
1134
+ variant: "Crypto" | "Api" | "VaultParse" | "MissingField" | "RepositoryError";
1135
+ }
1136
+
1137
+ export function isCreateFolderError(error: any): error is CreateFolderError;
1138
+
1055
1139
  export interface Collection {
1056
1140
  id: Uuid | undefined;
1057
1141
  organizationId: Uuid;
@@ -1232,51 +1316,6 @@ export interface Attachment {
1232
1316
  key: EncString | undefined;
1233
1317
  }
1234
1318
 
1235
- import { Tagged } from "type-fest";
1236
-
1237
- /**
1238
- * A string that **MUST** be a valid UUID.
1239
- *
1240
- * Never create or cast to this type directly, use the `uuid<T>()` function instead.
1241
- */
1242
- // TODO: Uncomment this when the `uuid` crate is used.
1243
- // export type Uuid = unknown;
1244
-
1245
- export type Uuid = string;
1246
-
1247
- /**
1248
- * RFC3339 compliant date-time string.
1249
- * @typeParam T - Not used in JavaScript.
1250
- */
1251
- export type DateTime<T = unknown> = string;
1252
-
1253
- /**
1254
- * UTC date-time string. Not used in JavaScript.
1255
- */
1256
- export type Utc = unknown;
1257
-
1258
- /**
1259
- * An integer that is known not to equal zero.
1260
- */
1261
- export type NonZeroU32 = number;
1262
-
1263
- export interface Repository<T> {
1264
- get(id: string): Promise<T | null>;
1265
- list(): Promise<T[]>;
1266
- set(id: string, value: T): Promise<void>;
1267
- remove(id: string): Promise<void>;
1268
- }
1269
-
1270
- export interface TokenProvider {
1271
- get_access_token(): Promise<string | undefined>;
1272
- }
1273
-
1274
- export interface TestError extends Error {
1275
- name: "TestError";
1276
- }
1277
-
1278
- export function isTestError(error: any): error is TestError;
1279
-
1280
1319
  export class AttachmentsClient {
1281
1320
  private constructor();
1282
1321
  free(): void;
@@ -1401,12 +1440,40 @@ export class ExporterClient {
1401
1440
  */
1402
1441
  import_cxf(payload: string): Cipher[];
1403
1442
  }
1443
+ /**
1444
+ * Wrapper for folder specific functionality.
1445
+ */
1404
1446
  export class FoldersClient {
1405
1447
  private constructor();
1406
1448
  free(): void;
1449
+ /**
1450
+ * Encrypt a [FolderView] to a [Folder].
1451
+ */
1407
1452
  encrypt(folder_view: FolderView): Folder;
1453
+ /**
1454
+ * Encrypt a [Folder] to [FolderView].
1455
+ */
1408
1456
  decrypt(folder: Folder): FolderView;
1457
+ /**
1458
+ * Decrypt a list of [Folder]s to a list of [FolderView]s.
1459
+ */
1409
1460
  decrypt_list(folders: Folder[]): FolderView[];
1461
+ /**
1462
+ * Get all folders from state and decrypt them to a list of [FolderView].
1463
+ */
1464
+ list(): Promise<FolderView[]>;
1465
+ /**
1466
+ * Get a specific [Folder] by its ID from state and decrypt it to a [FolderView].
1467
+ */
1468
+ get(folder_id: string): Promise<FolderView>;
1469
+ /**
1470
+ * Create a new [Folder] and save it to the server.
1471
+ */
1472
+ create(request: FolderAddEditRequest): Promise<FolderView>;
1473
+ /**
1474
+ * Edit the [Folder] and save it to the server.
1475
+ */
1476
+ edit(folder_id: string, request: FolderAddEditRequest): Promise<FolderView>;
1410
1477
  }
1411
1478
  export class GeneratorClient {
1412
1479
  private constructor();
@@ -1652,6 +1719,7 @@ export class StateClient {
1652
1719
  private constructor();
1653
1720
  free(): void;
1654
1721
  register_cipher_repository(store: Repository<Cipher>): void;
1722
+ register_folder_repository(store: Repository<Folder>): void;
1655
1723
  }
1656
1724
  export class TotpClient {
1657
1725
  private constructor();