From b1a7e2eda44122c1106f4d36c31ffe2658899094 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garci=CC=81a?= Date: Thu, 8 Jun 2023 14:41:48 +0200 Subject: [PATCH] Update schemas --- .../src-ts/bitwarden_client/schemas.ts | 163 ++++++----- languages/csharp/schemas.cs | 163 ++++++----- .../bitwarden_client/schemas.ts | 163 ++++++----- languages/python/BitwardenClient/schemas.py | 269 ++++++++++-------- support/schemas/request/ClientSettings.json | 9 +- support/schemas/request/Command.json | 148 ++++++++++ support/schemas/response/SyncResponse.json | 105 ------- 7 files changed, 559 insertions(+), 461 deletions(-) delete mode 100644 support/schemas/response/SyncResponse.json diff --git a/crates/bitwarden-napi/src-ts/bitwarden_client/schemas.ts b/crates/bitwarden-napi/src-ts/bitwarden_client/schemas.ts index 828eaf54b..d936f1132 100644 --- a/crates/bitwarden-napi/src-ts/bitwarden_client/schemas.ts +++ b/crates/bitwarden-napi/src-ts/bitwarden_client/schemas.ts @@ -1,6 +1,6 @@ // To parse this data: // -// import { Convert, ClientSettings, Command, ResponseForAPIKeyLoginResponse, ResponseForPasswordLoginResponse, ResponseForSecretDeleteResponse, ResponseForSecretIdentifierResponse, ResponseForSecretIdentifiersResponse, ResponseForSecretResponse, ResponseForSecretsDeleteResponse, ResponseForSyncResponse, ResponseForUserAPIKeyResponse } from "./file"; +// import { Convert, ClientSettings, Command, ResponseForAPIKeyLoginResponse, ResponseForPasswordLoginResponse, ResponseForSecretDeleteResponse, ResponseForSecretIdentifierResponse, ResponseForSecretIdentifiersResponse, ResponseForSecretResponse, ResponseForSecretsDeleteResponse, ResponseForUserAPIKeyResponse } from "./file"; // // const clientSettings = Convert.toClientSettings(json); // const command = Convert.toCommand(json); @@ -11,7 +11,6 @@ // const responseForSecretIdentifiersResponse = Convert.toResponseForSecretIdentifiersResponse(json); // const responseForSecretResponse = Convert.toResponseForSecretResponse(json); // const responseForSecretsDeleteResponse = Convert.toResponseForSecretsDeleteResponse(json); -// const responseForSyncResponse = Convert.toResponseForSyncResponse(json); // const responseForUserAPIKeyResponse = Convert.toResponseForUserAPIKeyResponse(json); // // These functions will throw an error if the JSON doesn't @@ -28,8 +27,8 @@ * assert_matches::assert_matches; let settings = ClientSettings { identity_url: * "https://identity.bitwarden.com".to_string(), api_url: * "https://api.bitwarden.com".to_string(), user_agent: "Bitwarden Rust-SDK".to_string(), - * device_type: DeviceType::SDK, }; let default = ClientSettings::default(); - * assert_matches!(settings, default); ``` + * device_type: DeviceType::SDK, state_path: None, }; let default = + * ClientSettings::default(); assert_matches!(settings, default); ``` * * Targets `localhost:8080` for debug builds. */ @@ -47,6 +46,12 @@ export interface ClientSettings { * `https://identity.bitwarden.com` */ identityUrl: string; + /** + * Path to the file that stores the SDK's internal state, when not set the state is kept in + * memory only This option has no effect when compiling for WebAssembly, in that case + * LocalStorage is always used. + */ + statePath?: null | string; /** * The user_agent to sent to Bitwarden. Defaults to `Bitwarden Rust-SDK` */ @@ -104,6 +109,8 @@ export enum DeviceType { * * Returns: [ApiKeyLoginResponse](crate::sdk::auth::response::ApiKeyLoginResponse) * + * Login with a previously saved session + * * > Requires Authentication Get the API key of the currently authenticated user * * Returns: @@ -113,6 +120,10 @@ export enum DeviceType { * * Returns: String * + * > Requires Authentication Get the user's account data associated with this client + * + * Returns: [AccountData](crate::sdk::model::account_data::AccountData) + * * > Requires Authentication Retrieve all user data, ciphers and organizations the user is a * part of * @@ -122,11 +133,14 @@ export interface Command { passwordLogin?: PasswordLoginRequest; apiKeyLogin?: APIKeyLoginRequest; accessTokenLogin?: AccessTokenLoginRequest; + sessionLogin?: SessionLoginRequest; getUserApiKey?: SecretVerificationRequest; fingerprint?: FingerprintRequest; + getAccountState?: { [key: string]: any }; sync?: SyncRequest; secrets?: SecretsCommand; projects?: ProjectsCommand; + folders?: FoldersCommand; } /** @@ -168,6 +182,37 @@ export interface FingerprintRequest { publicKey: string; } +export interface FoldersCommand { + create?: FolderCreateRequest; + update?: FolderUpdateRequest; + delete?: FolderDeleteRequest; +} + +export interface FolderCreateRequest { + /** + * Encrypted folder name + */ + name: string; +} + +export interface FolderDeleteRequest { + /** + * ID of the folder to delete + */ + id: string; +} + +export interface FolderUpdateRequest { + /** + * ID of the folder to update + */ + id: string; + /** + * Encrypted folder name + */ + name: string; +} + export interface SecretVerificationRequest { /** * The user's master password to use for user verification. If supplied, this will be used @@ -308,6 +353,20 @@ export interface SecretPutRequest { value: string; } +/** + * Login to Bitwarden using a saved session + */ +export interface SessionLoginRequest { + /** + * User's master password, used to unlock the vault + */ + password: string; + /** + * User's uuid + */ + userId: string; +} + export interface SyncRequest { /** * Exclude the subdomains from the response, defaults to false @@ -616,51 +675,6 @@ export interface DatumClass { id: string; } -export interface ResponseForSyncResponse { - /** - * The response data. Populated if `success` is true. - */ - data?: SyncResponse | null; - /** - * A message for any error that may occur. Populated if `success` is false. - */ - errorMessage?: null | string; - /** - * Whether or not the SDK request succeeded. - */ - success: boolean; -} - -export interface SyncResponse { - /** - * List of ciphers accesible by the user - */ - ciphers: CipherDetailsResponse[]; - /** - * Data about the user, including their encryption keys and the organizations they are a - * part of - */ - profile: ProfileResponse; -} - -export interface CipherDetailsResponse { -} - -/** - * Data about the user, including their encryption keys and the organizations they are a - * part of - */ -export interface ProfileResponse { - email: string; - id: string; - name: string; - organizations: ProfileOrganizationResponse[]; -} - -export interface ProfileOrganizationResponse { - id: string; -} - export interface ResponseForUserAPIKeyResponse { /** * The response data. Populated if `success` is true. @@ -758,14 +772,6 @@ export class Convert { return JSON.stringify(uncast(value, r("ResponseForSecretsDeleteResponse")), null, 2); } - public static toResponseForSyncResponse(json: string): ResponseForSyncResponse { - return cast(JSON.parse(json), r("ResponseForSyncResponse")); - } - - public static responseForSyncResponseToJson(value: ResponseForSyncResponse): string { - return JSON.stringify(uncast(value, r("ResponseForSyncResponse")), null, 2); - } - public static toResponseForUserAPIKeyResponse(json: string): ResponseForUserAPIKeyResponse { return cast(JSON.parse(json), r("ResponseForUserAPIKeyResponse")); } @@ -932,17 +938,21 @@ const typeMap: any = { { json: "apiUrl", js: "apiUrl", typ: "" }, { json: "deviceType", js: "deviceType", typ: r("DeviceType") }, { json: "identityUrl", js: "identityUrl", typ: "" }, + { json: "statePath", js: "statePath", typ: u(undefined, u(null, "")) }, { json: "userAgent", js: "userAgent", typ: "" }, ], false), "Command": o([ { json: "passwordLogin", js: "passwordLogin", typ: u(undefined, r("PasswordLoginRequest")) }, { json: "apiKeyLogin", js: "apiKeyLogin", typ: u(undefined, r("APIKeyLoginRequest")) }, { json: "accessTokenLogin", js: "accessTokenLogin", typ: u(undefined, r("AccessTokenLoginRequest")) }, + { json: "sessionLogin", js: "sessionLogin", typ: u(undefined, r("SessionLoginRequest")) }, { json: "getUserApiKey", js: "getUserApiKey", typ: u(undefined, r("SecretVerificationRequest")) }, { json: "fingerprint", js: "fingerprint", typ: u(undefined, r("FingerprintRequest")) }, + { json: "getAccountState", js: "getAccountState", typ: u(undefined, m("any")) }, { json: "sync", js: "sync", typ: u(undefined, r("SyncRequest")) }, { json: "secrets", js: "secrets", typ: u(undefined, r("SecretsCommand")) }, { json: "projects", js: "projects", typ: u(undefined, r("ProjectsCommand")) }, + { json: "folders", js: "folders", typ: u(undefined, r("FoldersCommand")) }, ], false), "AccessTokenLoginRequest": o([ { json: "accessToken", js: "accessToken", typ: "" }, @@ -956,6 +966,21 @@ const typeMap: any = { { json: "fingerprintMaterial", js: "fingerprintMaterial", typ: "" }, { json: "publicKey", js: "publicKey", typ: "" }, ], false), + "FoldersCommand": o([ + { json: "create", js: "create", typ: u(undefined, r("FolderCreateRequest")) }, + { json: "update", js: "update", typ: u(undefined, r("FolderUpdateRequest")) }, + { json: "delete", js: "delete", typ: u(undefined, r("FolderDeleteRequest")) }, + ], false), + "FolderCreateRequest": o([ + { json: "name", js: "name", typ: "" }, + ], false), + "FolderDeleteRequest": o([ + { json: "id", js: "id", typ: "" }, + ], false), + "FolderUpdateRequest": o([ + { json: "id", js: "id", typ: "" }, + { json: "name", js: "name", typ: "" }, + ], false), "SecretVerificationRequest": o([ { json: "masterPassword", js: "masterPassword", typ: u(undefined, u(null, "")) }, { json: "otp", js: "otp", typ: u(undefined, u(null, "")) }, @@ -1003,6 +1028,10 @@ const typeMap: any = { { json: "organizationId", js: "organizationId", typ: "" }, { json: "value", js: "value", typ: "" }, ], false), + "SessionLoginRequest": o([ + { json: "password", js: "password", typ: "" }, + { json: "userId", js: "userId", typ: "" }, + ], false), "SyncRequest": o([ { json: "excludeSubdomains", js: "excludeSubdomains", typ: u(undefined, u(true, null)) }, ], false), @@ -1142,26 +1171,6 @@ const typeMap: any = { { json: "error", js: "error", typ: u(undefined, u(null, "")) }, { json: "id", js: "id", typ: "" }, ], false), - "ResponseForSyncResponse": o([ - { json: "data", js: "data", typ: u(undefined, u(r("SyncResponse"), null)) }, - { json: "errorMessage", js: "errorMessage", typ: u(undefined, u(null, "")) }, - { json: "success", js: "success", typ: true }, - ], false), - "SyncResponse": o([ - { json: "ciphers", js: "ciphers", typ: a(r("CipherDetailsResponse")) }, - { json: "profile", js: "profile", typ: r("ProfileResponse") }, - ], false), - "CipherDetailsResponse": o([ - ], false), - "ProfileResponse": o([ - { json: "email", js: "email", typ: "" }, - { json: "id", js: "id", typ: "" }, - { json: "name", js: "name", typ: "" }, - { json: "organizations", js: "organizations", typ: a(r("ProfileOrganizationResponse")) }, - ], false), - "ProfileOrganizationResponse": o([ - { json: "id", js: "id", typ: "" }, - ], false), "ResponseForUserAPIKeyResponse": o([ { json: "data", js: "data", typ: u(undefined, u(r("UserAPIKeyResponse"), null)) }, { json: "errorMessage", js: "errorMessage", typ: u(undefined, u(null, "")) }, diff --git a/languages/csharp/schemas.cs b/languages/csharp/schemas.cs index fdec22410..3e7658749 100644 --- a/languages/csharp/schemas.cs +++ b/languages/csharp/schemas.cs @@ -13,7 +13,6 @@ // var responseForSecretIdentifiersResponse = ResponseForSecretIdentifiersResponse.FromJson(jsonString); // var responseForSecretResponse = ResponseForSecretResponse.FromJson(jsonString); // var responseForSecretsDeleteResponse = ResponseForSecretsDeleteResponse.FromJson(jsonString); -// var responseForSyncResponse = ResponseForSyncResponse.FromJson(jsonString); // var responseForUserApiKeyResponse = ResponseForUserApiKeyResponse.FromJson(jsonString); namespace Bit.Sdk @@ -36,8 +35,8 @@ namespace Bit.Sdk /// assert_matches::assert_matches; let settings = ClientSettings { identity_url: /// "https://identity.bitwarden.com".to_string(), api_url: /// "https://api.bitwarden.com".to_string(), user_agent: "Bitwarden Rust-SDK".to_string(), - /// device_type: DeviceType::SDK, }; let default = ClientSettings::default(); - /// assert_matches!(settings, default); ``` + /// device_type: DeviceType::SDK, state_path: None, }; let default = + /// ClientSettings::default(); assert_matches!(settings, default); ``` /// /// Targets `localhost:8080` for debug builds. /// @@ -62,6 +61,14 @@ public partial class ClientSettings [JsonProperty("identityUrl")] public string IdentityUrl { get; set; } + /// + /// Path to the file that stores the SDK's internal state, when not set the state is kept in + /// memory only This option has no effect when compiling for WebAssembly, in that case + /// LocalStorage is always used. + /// + [JsonProperty("statePath")] + public string StatePath { get; set; } + /// /// The user_agent to sent to Bitwarden. Defaults to `Bitwarden Rust-SDK` /// @@ -92,6 +99,8 @@ public partial class ClientSettings /// /// Returns: [ApiKeyLoginResponse](crate::sdk::auth::response::ApiKeyLoginResponse) /// + /// Login with a previously saved session + /// /// > Requires Authentication Get the API key of the currently authenticated user /// /// Returns: @@ -101,6 +110,10 @@ public partial class ClientSettings /// /// Returns: String /// + /// > Requires Authentication Get the user's account data associated with this client + /// + /// Returns: [AccountData](crate::sdk::model::account_data::AccountData) + /// /// > Requires Authentication Retrieve all user data, ciphers and organizations the user is a /// part of /// @@ -117,12 +130,18 @@ public partial class Command [JsonProperty("accessTokenLogin", NullValueHandling = NullValueHandling.Ignore)] public AccessTokenLoginRequest AccessTokenLogin { get; set; } + [JsonProperty("sessionLogin", NullValueHandling = NullValueHandling.Ignore)] + public SessionLoginRequest SessionLogin { get; set; } + [JsonProperty("getUserApiKey", NullValueHandling = NullValueHandling.Ignore)] public SecretVerificationRequest GetUserApiKey { get; set; } [JsonProperty("fingerprint", NullValueHandling = NullValueHandling.Ignore)] public FingerprintRequest Fingerprint { get; set; } + [JsonProperty("getAccountState", NullValueHandling = NullValueHandling.Ignore)] + public Dictionary GetAccountState { get; set; } + [JsonProperty("sync", NullValueHandling = NullValueHandling.Ignore)] public SyncRequest Sync { get; set; } @@ -131,6 +150,9 @@ public partial class Command [JsonProperty("projects", NullValueHandling = NullValueHandling.Ignore)] public ProjectsCommand Projects { get; set; } + + [JsonProperty("folders", NullValueHandling = NullValueHandling.Ignore)] + public FoldersCommand Folders { get; set; } } /// @@ -184,6 +206,51 @@ public partial class FingerprintRequest public string PublicKey { get; set; } } + public partial class FoldersCommand + { + [JsonProperty("create", NullValueHandling = NullValueHandling.Ignore)] + public FolderCreateRequest Create { get; set; } + + [JsonProperty("update", NullValueHandling = NullValueHandling.Ignore)] + public FolderUpdateRequest Update { get; set; } + + [JsonProperty("delete", NullValueHandling = NullValueHandling.Ignore)] + public FolderDeleteRequest Delete { get; set; } + } + + public partial class FolderCreateRequest + { + /// + /// Encrypted folder name + /// + [JsonProperty("name")] + public string Name { get; set; } + } + + public partial class FolderDeleteRequest + { + /// + /// ID of the folder to delete + /// + [JsonProperty("id")] + public Guid Id { get; set; } + } + + public partial class FolderUpdateRequest + { + /// + /// ID of the folder to update + /// + [JsonProperty("id")] + public Guid Id { get; set; } + + /// + /// Encrypted folder name + /// + [JsonProperty("name")] + public string Name { get; set; } + } + public partial class SecretVerificationRequest { /// @@ -374,6 +441,24 @@ public partial class SecretPutRequest public string Value { get; set; } } + /// + /// Login to Bitwarden using a saved session + /// + public partial class SessionLoginRequest + { + /// + /// User's master password, used to unlock the vault + /// + [JsonProperty("password")] + public string Password { get; set; } + + /// + /// User's uuid + /// + [JsonProperty("userId")] + public Guid UserId { get; set; } + } + public partial class SyncRequest { /// @@ -838,72 +923,6 @@ public partial class DatumClass public Guid Id { get; set; } } - public partial class ResponseForSyncResponse - { - /// - /// The response data. Populated if `success` is true. - /// - [JsonProperty("data")] - public SyncResponse Data { get; set; } - - /// - /// A message for any error that may occur. Populated if `success` is false. - /// - [JsonProperty("errorMessage")] - public string ErrorMessage { get; set; } - - /// - /// Whether or not the SDK request succeeded. - /// - [JsonProperty("success")] - public bool Success { get; set; } - } - - public partial class SyncResponse - { - /// - /// List of ciphers accesible by the user - /// - [JsonProperty("ciphers")] - public CipherDetailsResponse[] Ciphers { get; set; } - - /// - /// Data about the user, including their encryption keys and the organizations they are a - /// part of - /// - [JsonProperty("profile")] - public ProfileResponse Profile { get; set; } - } - - public partial class CipherDetailsResponse - { - } - - /// - /// Data about the user, including their encryption keys and the organizations they are a - /// part of - /// - public partial class ProfileResponse - { - [JsonProperty("email")] - public string Email { get; set; } - - [JsonProperty("id")] - public Guid Id { get; set; } - - [JsonProperty("name")] - public string Name { get; set; } - - [JsonProperty("organizations")] - public ProfileOrganizationResponse[] Organizations { get; set; } - } - - public partial class ProfileOrganizationResponse - { - [JsonProperty("id")] - public Guid Id { get; set; } - } - public partial class ResponseForUserApiKeyResponse { /// @@ -984,11 +1003,6 @@ public partial class ResponseForSecretsDeleteResponse public static ResponseForSecretsDeleteResponse FromJson(string json) => JsonConvert.DeserializeObject(json, Bit.Sdk.Converter.Settings); } - public partial class ResponseForSyncResponse - { - public static ResponseForSyncResponse FromJson(string json) => JsonConvert.DeserializeObject(json, Bit.Sdk.Converter.Settings); - } - public partial class ResponseForUserApiKeyResponse { public static ResponseForUserApiKeyResponse FromJson(string json) => JsonConvert.DeserializeObject(json, Bit.Sdk.Converter.Settings); @@ -1005,7 +1019,6 @@ public static class Serialize public static string ToJson(this ResponseForSecretIdentifiersResponse self) => JsonConvert.SerializeObject(self, Bit.Sdk.Converter.Settings); public static string ToJson(this ResponseForSecretResponse self) => JsonConvert.SerializeObject(self, Bit.Sdk.Converter.Settings); public static string ToJson(this ResponseForSecretsDeleteResponse self) => JsonConvert.SerializeObject(self, Bit.Sdk.Converter.Settings); - public static string ToJson(this ResponseForSyncResponse self) => JsonConvert.SerializeObject(self, Bit.Sdk.Converter.Settings); public static string ToJson(this ResponseForUserApiKeyResponse self) => JsonConvert.SerializeObject(self, Bit.Sdk.Converter.Settings); } diff --git a/languages/js_webassembly/bitwarden_client/schemas.ts b/languages/js_webassembly/bitwarden_client/schemas.ts index 828eaf54b..d936f1132 100644 --- a/languages/js_webassembly/bitwarden_client/schemas.ts +++ b/languages/js_webassembly/bitwarden_client/schemas.ts @@ -1,6 +1,6 @@ // To parse this data: // -// import { Convert, ClientSettings, Command, ResponseForAPIKeyLoginResponse, ResponseForPasswordLoginResponse, ResponseForSecretDeleteResponse, ResponseForSecretIdentifierResponse, ResponseForSecretIdentifiersResponse, ResponseForSecretResponse, ResponseForSecretsDeleteResponse, ResponseForSyncResponse, ResponseForUserAPIKeyResponse } from "./file"; +// import { Convert, ClientSettings, Command, ResponseForAPIKeyLoginResponse, ResponseForPasswordLoginResponse, ResponseForSecretDeleteResponse, ResponseForSecretIdentifierResponse, ResponseForSecretIdentifiersResponse, ResponseForSecretResponse, ResponseForSecretsDeleteResponse, ResponseForUserAPIKeyResponse } from "./file"; // // const clientSettings = Convert.toClientSettings(json); // const command = Convert.toCommand(json); @@ -11,7 +11,6 @@ // const responseForSecretIdentifiersResponse = Convert.toResponseForSecretIdentifiersResponse(json); // const responseForSecretResponse = Convert.toResponseForSecretResponse(json); // const responseForSecretsDeleteResponse = Convert.toResponseForSecretsDeleteResponse(json); -// const responseForSyncResponse = Convert.toResponseForSyncResponse(json); // const responseForUserAPIKeyResponse = Convert.toResponseForUserAPIKeyResponse(json); // // These functions will throw an error if the JSON doesn't @@ -28,8 +27,8 @@ * assert_matches::assert_matches; let settings = ClientSettings { identity_url: * "https://identity.bitwarden.com".to_string(), api_url: * "https://api.bitwarden.com".to_string(), user_agent: "Bitwarden Rust-SDK".to_string(), - * device_type: DeviceType::SDK, }; let default = ClientSettings::default(); - * assert_matches!(settings, default); ``` + * device_type: DeviceType::SDK, state_path: None, }; let default = + * ClientSettings::default(); assert_matches!(settings, default); ``` * * Targets `localhost:8080` for debug builds. */ @@ -47,6 +46,12 @@ export interface ClientSettings { * `https://identity.bitwarden.com` */ identityUrl: string; + /** + * Path to the file that stores the SDK's internal state, when not set the state is kept in + * memory only This option has no effect when compiling for WebAssembly, in that case + * LocalStorage is always used. + */ + statePath?: null | string; /** * The user_agent to sent to Bitwarden. Defaults to `Bitwarden Rust-SDK` */ @@ -104,6 +109,8 @@ export enum DeviceType { * * Returns: [ApiKeyLoginResponse](crate::sdk::auth::response::ApiKeyLoginResponse) * + * Login with a previously saved session + * * > Requires Authentication Get the API key of the currently authenticated user * * Returns: @@ -113,6 +120,10 @@ export enum DeviceType { * * Returns: String * + * > Requires Authentication Get the user's account data associated with this client + * + * Returns: [AccountData](crate::sdk::model::account_data::AccountData) + * * > Requires Authentication Retrieve all user data, ciphers and organizations the user is a * part of * @@ -122,11 +133,14 @@ export interface Command { passwordLogin?: PasswordLoginRequest; apiKeyLogin?: APIKeyLoginRequest; accessTokenLogin?: AccessTokenLoginRequest; + sessionLogin?: SessionLoginRequest; getUserApiKey?: SecretVerificationRequest; fingerprint?: FingerprintRequest; + getAccountState?: { [key: string]: any }; sync?: SyncRequest; secrets?: SecretsCommand; projects?: ProjectsCommand; + folders?: FoldersCommand; } /** @@ -168,6 +182,37 @@ export interface FingerprintRequest { publicKey: string; } +export interface FoldersCommand { + create?: FolderCreateRequest; + update?: FolderUpdateRequest; + delete?: FolderDeleteRequest; +} + +export interface FolderCreateRequest { + /** + * Encrypted folder name + */ + name: string; +} + +export interface FolderDeleteRequest { + /** + * ID of the folder to delete + */ + id: string; +} + +export interface FolderUpdateRequest { + /** + * ID of the folder to update + */ + id: string; + /** + * Encrypted folder name + */ + name: string; +} + export interface SecretVerificationRequest { /** * The user's master password to use for user verification. If supplied, this will be used @@ -308,6 +353,20 @@ export interface SecretPutRequest { value: string; } +/** + * Login to Bitwarden using a saved session + */ +export interface SessionLoginRequest { + /** + * User's master password, used to unlock the vault + */ + password: string; + /** + * User's uuid + */ + userId: string; +} + export interface SyncRequest { /** * Exclude the subdomains from the response, defaults to false @@ -616,51 +675,6 @@ export interface DatumClass { id: string; } -export interface ResponseForSyncResponse { - /** - * The response data. Populated if `success` is true. - */ - data?: SyncResponse | null; - /** - * A message for any error that may occur. Populated if `success` is false. - */ - errorMessage?: null | string; - /** - * Whether or not the SDK request succeeded. - */ - success: boolean; -} - -export interface SyncResponse { - /** - * List of ciphers accesible by the user - */ - ciphers: CipherDetailsResponse[]; - /** - * Data about the user, including their encryption keys and the organizations they are a - * part of - */ - profile: ProfileResponse; -} - -export interface CipherDetailsResponse { -} - -/** - * Data about the user, including their encryption keys and the organizations they are a - * part of - */ -export interface ProfileResponse { - email: string; - id: string; - name: string; - organizations: ProfileOrganizationResponse[]; -} - -export interface ProfileOrganizationResponse { - id: string; -} - export interface ResponseForUserAPIKeyResponse { /** * The response data. Populated if `success` is true. @@ -758,14 +772,6 @@ export class Convert { return JSON.stringify(uncast(value, r("ResponseForSecretsDeleteResponse")), null, 2); } - public static toResponseForSyncResponse(json: string): ResponseForSyncResponse { - return cast(JSON.parse(json), r("ResponseForSyncResponse")); - } - - public static responseForSyncResponseToJson(value: ResponseForSyncResponse): string { - return JSON.stringify(uncast(value, r("ResponseForSyncResponse")), null, 2); - } - public static toResponseForUserAPIKeyResponse(json: string): ResponseForUserAPIKeyResponse { return cast(JSON.parse(json), r("ResponseForUserAPIKeyResponse")); } @@ -932,17 +938,21 @@ const typeMap: any = { { json: "apiUrl", js: "apiUrl", typ: "" }, { json: "deviceType", js: "deviceType", typ: r("DeviceType") }, { json: "identityUrl", js: "identityUrl", typ: "" }, + { json: "statePath", js: "statePath", typ: u(undefined, u(null, "")) }, { json: "userAgent", js: "userAgent", typ: "" }, ], false), "Command": o([ { json: "passwordLogin", js: "passwordLogin", typ: u(undefined, r("PasswordLoginRequest")) }, { json: "apiKeyLogin", js: "apiKeyLogin", typ: u(undefined, r("APIKeyLoginRequest")) }, { json: "accessTokenLogin", js: "accessTokenLogin", typ: u(undefined, r("AccessTokenLoginRequest")) }, + { json: "sessionLogin", js: "sessionLogin", typ: u(undefined, r("SessionLoginRequest")) }, { json: "getUserApiKey", js: "getUserApiKey", typ: u(undefined, r("SecretVerificationRequest")) }, { json: "fingerprint", js: "fingerprint", typ: u(undefined, r("FingerprintRequest")) }, + { json: "getAccountState", js: "getAccountState", typ: u(undefined, m("any")) }, { json: "sync", js: "sync", typ: u(undefined, r("SyncRequest")) }, { json: "secrets", js: "secrets", typ: u(undefined, r("SecretsCommand")) }, { json: "projects", js: "projects", typ: u(undefined, r("ProjectsCommand")) }, + { json: "folders", js: "folders", typ: u(undefined, r("FoldersCommand")) }, ], false), "AccessTokenLoginRequest": o([ { json: "accessToken", js: "accessToken", typ: "" }, @@ -956,6 +966,21 @@ const typeMap: any = { { json: "fingerprintMaterial", js: "fingerprintMaterial", typ: "" }, { json: "publicKey", js: "publicKey", typ: "" }, ], false), + "FoldersCommand": o([ + { json: "create", js: "create", typ: u(undefined, r("FolderCreateRequest")) }, + { json: "update", js: "update", typ: u(undefined, r("FolderUpdateRequest")) }, + { json: "delete", js: "delete", typ: u(undefined, r("FolderDeleteRequest")) }, + ], false), + "FolderCreateRequest": o([ + { json: "name", js: "name", typ: "" }, + ], false), + "FolderDeleteRequest": o([ + { json: "id", js: "id", typ: "" }, + ], false), + "FolderUpdateRequest": o([ + { json: "id", js: "id", typ: "" }, + { json: "name", js: "name", typ: "" }, + ], false), "SecretVerificationRequest": o([ { json: "masterPassword", js: "masterPassword", typ: u(undefined, u(null, "")) }, { json: "otp", js: "otp", typ: u(undefined, u(null, "")) }, @@ -1003,6 +1028,10 @@ const typeMap: any = { { json: "organizationId", js: "organizationId", typ: "" }, { json: "value", js: "value", typ: "" }, ], false), + "SessionLoginRequest": o([ + { json: "password", js: "password", typ: "" }, + { json: "userId", js: "userId", typ: "" }, + ], false), "SyncRequest": o([ { json: "excludeSubdomains", js: "excludeSubdomains", typ: u(undefined, u(true, null)) }, ], false), @@ -1142,26 +1171,6 @@ const typeMap: any = { { json: "error", js: "error", typ: u(undefined, u(null, "")) }, { json: "id", js: "id", typ: "" }, ], false), - "ResponseForSyncResponse": o([ - { json: "data", js: "data", typ: u(undefined, u(r("SyncResponse"), null)) }, - { json: "errorMessage", js: "errorMessage", typ: u(undefined, u(null, "")) }, - { json: "success", js: "success", typ: true }, - ], false), - "SyncResponse": o([ - { json: "ciphers", js: "ciphers", typ: a(r("CipherDetailsResponse")) }, - { json: "profile", js: "profile", typ: r("ProfileResponse") }, - ], false), - "CipherDetailsResponse": o([ - ], false), - "ProfileResponse": o([ - { json: "email", js: "email", typ: "" }, - { json: "id", js: "id", typ: "" }, - { json: "name", js: "name", typ: "" }, - { json: "organizations", js: "organizations", typ: a(r("ProfileOrganizationResponse")) }, - ], false), - "ProfileOrganizationResponse": o([ - { json: "id", js: "id", typ: "" }, - ], false), "ResponseForUserAPIKeyResponse": o([ { json: "data", js: "data", typ: u(undefined, u(r("UserAPIKeyResponse"), null)) }, { json: "errorMessage", js: "errorMessage", typ: u(undefined, u(null, "")) }, diff --git a/languages/python/BitwardenClient/schemas.py b/languages/python/BitwardenClient/schemas.py index da1695855..241b940d7 100644 --- a/languages/python/BitwardenClient/schemas.py +++ b/languages/python/BitwardenClient/schemas.py @@ -1,6 +1,6 @@ from enum import Enum from dataclasses import dataclass -from typing import Any, Optional, List, TypeVar, Type, cast, Callable +from typing import Optional, Any, List, Dict, TypeVar, Type, cast, Callable from uuid import UUID @@ -13,11 +13,6 @@ def from_str(x: Any) -> str: return x -def to_enum(c: Type[EnumT], x: Any) -> EnumT: - assert isinstance(x, c) - return x.value - - def from_none(x: Any) -> Any: assert x is None return x @@ -32,6 +27,11 @@ def from_union(fs, x): assert False +def to_enum(c: Type[EnumT], x: Any) -> EnumT: + assert isinstance(x, c) + return x.value + + def to_class(c: Type[T], x: Any) -> dict: assert isinstance(x, c) return cast(Any, x).to_dict() @@ -47,6 +47,11 @@ def from_bool(x: Any) -> bool: return x +def from_dict(f: Callable[[Any], T], x: Any) -> Dict[str, T]: + assert isinstance(x, dict) + return { k: f(v) for (k, v) in x.items() } + + class DeviceType(Enum): """Device type to send to Bitwarden. Defaults to SDK""" ANDROID = "Android" @@ -85,8 +90,8 @@ class ClientSettings: assert_matches::assert_matches; let settings = ClientSettings { identity_url: "https://identity.bitwarden.com".to_string(), api_url: "https://api.bitwarden.com".to_string(), user_agent: "Bitwarden Rust-SDK".to_string(), - device_type: DeviceType::SDK, }; let default = ClientSettings::default(); - assert_matches!(settings, default); ``` + device_type: DeviceType::SDK, state_path: None, }; let default = + ClientSettings::default(); assert_matches!(settings, default); ``` Targets `localhost:8080` for debug builds. """ @@ -100,6 +105,11 @@ class ClientSettings: identity_url: str """The user_agent to sent to Bitwarden. Defaults to `Bitwarden Rust-SDK`""" user_agent: str + """Path to the file that stores the SDK's internal state, when not set the state is kept in + memory only This option has no effect when compiling for WebAssembly, in that case + LocalStorage is always used. + """ + state_path: Optional[str] = None @staticmethod def from_dict(obj: Any) -> 'ClientSettings': @@ -108,7 +118,8 @@ def from_dict(obj: Any) -> 'ClientSettings': device_type = DeviceType(obj.get("deviceType")) identity_url = from_str(obj.get("identityUrl")) user_agent = from_str(obj.get("userAgent")) - return ClientSettings(api_url, device_type, identity_url, user_agent) + state_path = from_union([from_none, from_str], obj.get("statePath")) + return ClientSettings(api_url, device_type, identity_url, user_agent, state_path) def to_dict(self) -> dict: result: dict = {} @@ -116,6 +127,8 @@ def to_dict(self) -> dict: result["deviceType"] = to_enum(DeviceType, self.device_type) result["identityUrl"] = from_str(self.identity_url) result["userAgent"] = from_str(self.user_agent) + if self.state_path is not None: + result["statePath"] = from_union([from_none, from_str], self.state_path) return result @@ -184,6 +197,86 @@ def to_dict(self) -> dict: return result +@dataclass +class FolderCreateRequest: + """Encrypted folder name""" + name: str + + @staticmethod + def from_dict(obj: Any) -> 'FolderCreateRequest': + assert isinstance(obj, dict) + name = from_str(obj.get("name")) + return FolderCreateRequest(name) + + def to_dict(self) -> dict: + result: dict = {} + result["name"] = from_str(self.name) + return result + + +@dataclass +class FolderDeleteRequest: + """ID of the folder to delete""" + id: UUID + + @staticmethod + def from_dict(obj: Any) -> 'FolderDeleteRequest': + assert isinstance(obj, dict) + id = UUID(obj.get("id")) + return FolderDeleteRequest(id) + + def to_dict(self) -> dict: + result: dict = {} + result["id"] = str(self.id) + return result + + +@dataclass +class FolderUpdateRequest: + """ID of the folder to update""" + id: UUID + """Encrypted folder name""" + name: str + + @staticmethod + def from_dict(obj: Any) -> 'FolderUpdateRequest': + assert isinstance(obj, dict) + id = UUID(obj.get("id")) + name = from_str(obj.get("name")) + return FolderUpdateRequest(id, name) + + def to_dict(self) -> dict: + result: dict = {} + result["id"] = str(self.id) + result["name"] = from_str(self.name) + return result + + +@dataclass +class FoldersCommand: + create: Optional[FolderCreateRequest] = None + update: Optional[FolderUpdateRequest] = None + delete: Optional[FolderDeleteRequest] = None + + @staticmethod + def from_dict(obj: Any) -> 'FoldersCommand': + assert isinstance(obj, dict) + create = from_union([FolderCreateRequest.from_dict, from_none], obj.get("create")) + update = from_union([FolderUpdateRequest.from_dict, from_none], obj.get("update")) + delete = from_union([FolderDeleteRequest.from_dict, from_none], obj.get("delete")) + return FoldersCommand(create, update, delete) + + def to_dict(self) -> dict: + result: dict = {} + if self.create is not None: + result["create"] = from_union([lambda x: to_class(FolderCreateRequest, x), from_none], self.create) + if self.update is not None: + result["update"] = from_union([lambda x: to_class(FolderUpdateRequest, x), from_none], self.update) + if self.delete is not None: + result["delete"] = from_union([lambda x: to_class(FolderDeleteRequest, x), from_none], self.delete) + return result + + @dataclass class SecretVerificationRequest: """The user's master password to use for user verification. If supplied, this will be used @@ -467,6 +560,28 @@ def to_dict(self) -> dict: return result +@dataclass +class SessionLoginRequest: + """Login to Bitwarden using a saved session""" + """User's master password, used to unlock the vault""" + password: str + """User's uuid""" + user_id: UUID + + @staticmethod + def from_dict(obj: Any) -> 'SessionLoginRequest': + assert isinstance(obj, dict) + password = from_str(obj.get("password")) + user_id = UUID(obj.get("userId")) + return SessionLoginRequest(password, user_id) + + def to_dict(self) -> dict: + result: dict = {} + result["password"] = from_str(self.password) + result["userId"] = str(self.user_id) + return result + + @dataclass class SyncRequest: """Exclude the subdomains from the response, defaults to false""" @@ -509,6 +624,8 @@ class Command: Returns: [ApiKeyLoginResponse](crate::sdk::auth::response::ApiKeyLoginResponse) + Login with a previously saved session + > Requires Authentication Get the API key of the currently authenticated user Returns: @@ -518,6 +635,10 @@ class Command: Returns: String + > Requires Authentication Get the user's account data associated with this client + + Returns: [AccountData](crate::sdk::model::account_data::AccountData) + > Requires Authentication Retrieve all user data, ciphers and organizations the user is a part of @@ -526,11 +647,14 @@ class Command: password_login: Optional[PasswordLoginRequest] = None api_key_login: Optional[APIKeyLoginRequest] = None access_token_login: Optional[AccessTokenLoginRequest] = None + session_login: Optional[SessionLoginRequest] = None get_user_api_key: Optional[SecretVerificationRequest] = None fingerprint: Optional[FingerprintRequest] = None + get_account_state: Optional[Dict[str, Any]] = None sync: Optional[SyncRequest] = None secrets: Optional[SecretsCommand] = None projects: Optional[ProjectsCommand] = None + folders: Optional[FoldersCommand] = None @staticmethod def from_dict(obj: Any) -> 'Command': @@ -538,12 +662,15 @@ def from_dict(obj: Any) -> 'Command': password_login = from_union([PasswordLoginRequest.from_dict, from_none], obj.get("passwordLogin")) api_key_login = from_union([APIKeyLoginRequest.from_dict, from_none], obj.get("apiKeyLogin")) access_token_login = from_union([AccessTokenLoginRequest.from_dict, from_none], obj.get("accessTokenLogin")) + session_login = from_union([SessionLoginRequest.from_dict, from_none], obj.get("sessionLogin")) get_user_api_key = from_union([SecretVerificationRequest.from_dict, from_none], obj.get("getUserApiKey")) fingerprint = from_union([FingerprintRequest.from_dict, from_none], obj.get("fingerprint")) + get_account_state = from_union([lambda x: from_dict(lambda x: x, x), from_none], obj.get("getAccountState")) sync = from_union([SyncRequest.from_dict, from_none], obj.get("sync")) secrets = from_union([SecretsCommand.from_dict, from_none], obj.get("secrets")) projects = from_union([ProjectsCommand.from_dict, from_none], obj.get("projects")) - return Command(password_login, api_key_login, access_token_login, get_user_api_key, fingerprint, sync, secrets, projects) + folders = from_union([FoldersCommand.from_dict, from_none], obj.get("folders")) + return Command(password_login, api_key_login, access_token_login, session_login, get_user_api_key, fingerprint, get_account_state, sync, secrets, projects, folders) def to_dict(self) -> dict: result: dict = {} @@ -553,16 +680,22 @@ def to_dict(self) -> dict: result["apiKeyLogin"] = from_union([lambda x: to_class(APIKeyLoginRequest, x), from_none], self.api_key_login) if self.access_token_login is not None: result["accessTokenLogin"] = from_union([lambda x: to_class(AccessTokenLoginRequest, x), from_none], self.access_token_login) + if self.session_login is not None: + result["sessionLogin"] = from_union([lambda x: to_class(SessionLoginRequest, x), from_none], self.session_login) if self.get_user_api_key is not None: result["getUserApiKey"] = from_union([lambda x: to_class(SecretVerificationRequest, x), from_none], self.get_user_api_key) if self.fingerprint is not None: result["fingerprint"] = from_union([lambda x: to_class(FingerprintRequest, x), from_none], self.fingerprint) + if self.get_account_state is not None: + result["getAccountState"] = from_union([lambda x: from_dict(lambda x: x, x), from_none], self.get_account_state) if self.sync is not None: result["sync"] = from_union([lambda x: to_class(SyncRequest, x), from_none], self.sync) if self.secrets is not None: result["secrets"] = from_union([lambda x: to_class(SecretsCommand, x), from_none], self.secrets) if self.projects is not None: result["projects"] = from_union([lambda x: to_class(ProjectsCommand, x), from_none], self.projects) + if self.folders is not None: + result["folders"] = from_union([lambda x: to_class(FoldersCommand, x), from_none], self.folders) return result @@ -1279,114 +1412,6 @@ def to_dict(self) -> dict: return result -@dataclass -class CipherDetailsResponse: - pass - - @staticmethod - def from_dict(obj: Any) -> 'CipherDetailsResponse': - assert isinstance(obj, dict) - return CipherDetailsResponse() - - def to_dict(self) -> dict: - result: dict = {} - return result - - -@dataclass -class ProfileOrganizationResponse: - id: UUID - - @staticmethod - def from_dict(obj: Any) -> 'ProfileOrganizationResponse': - assert isinstance(obj, dict) - id = UUID(obj.get("id")) - return ProfileOrganizationResponse(id) - - def to_dict(self) -> dict: - result: dict = {} - result["id"] = str(self.id) - return result - - -@dataclass -class ProfileResponse: - """Data about the user, including their encryption keys and the organizations they are a - part of - """ - email: str - id: UUID - name: str - organizations: List[ProfileOrganizationResponse] - - @staticmethod - def from_dict(obj: Any) -> 'ProfileResponse': - assert isinstance(obj, dict) - email = from_str(obj.get("email")) - id = UUID(obj.get("id")) - name = from_str(obj.get("name")) - organizations = from_list(ProfileOrganizationResponse.from_dict, obj.get("organizations")) - return ProfileResponse(email, id, name, organizations) - - def to_dict(self) -> dict: - result: dict = {} - result["email"] = from_str(self.email) - result["id"] = str(self.id) - result["name"] = from_str(self.name) - result["organizations"] = from_list(lambda x: to_class(ProfileOrganizationResponse, x), self.organizations) - return result - - -@dataclass -class SyncResponse: - """List of ciphers accesible by the user""" - ciphers: List[CipherDetailsResponse] - """Data about the user, including their encryption keys and the organizations they are a - part of - """ - profile: ProfileResponse - - @staticmethod - def from_dict(obj: Any) -> 'SyncResponse': - assert isinstance(obj, dict) - ciphers = from_list(CipherDetailsResponse.from_dict, obj.get("ciphers")) - profile = ProfileResponse.from_dict(obj.get("profile")) - return SyncResponse(ciphers, profile) - - def to_dict(self) -> dict: - result: dict = {} - result["ciphers"] = from_list(lambda x: to_class(CipherDetailsResponse, x), self.ciphers) - result["profile"] = to_class(ProfileResponse, self.profile) - return result - - -@dataclass -class ResponseForSyncResponse: - """Whether or not the SDK request succeeded.""" - success: bool - """The response data. Populated if `success` is true.""" - data: Optional[SyncResponse] = None - """A message for any error that may occur. Populated if `success` is false.""" - error_message: Optional[str] = None - - @staticmethod - def from_dict(obj: Any) -> 'ResponseForSyncResponse': - assert isinstance(obj, dict) - success = from_bool(obj.get("success")) - data = from_union([SyncResponse.from_dict, from_none], obj.get("data")) - error_message = from_union([from_none, from_str], obj.get("errorMessage")) - return ResponseForSyncResponse(success, data, error_message) - - def to_dict(self) -> dict: - result: dict = {} - result["success"] = from_bool(self.success) - if self.data is not None: - result["data"] = from_union([lambda x: to_class(SyncResponse, x), from_none], self.data) - if self.error_message is not None: - result["errorMessage"] = from_union([from_none, from_str], self.error_message) - return result - - @dataclass class UserAPIKeyResponse: """The user's API key, which represents the client_secret portion of an oauth request.""" @@ -1503,14 +1528,6 @@ def response_for_secrets_delete_response_to_dict(x: ResponseForSecretsDeleteResp return to_class(ResponseForSecretsDeleteResponse, x) -def response_for_sync_response_from_dict(s: Any) -> ResponseForSyncResponse: - return ResponseForSyncResponse.from_dict(s) - - -def response_for_sync_response_to_dict(x: ResponseForSyncResponse) -> Any: - return to_class(ResponseForSyncResponse, x) - - def response_for_user_api_key_response_from_dict(s: Any) -> ResponseForUserAPIKeyResponse: return ResponseForUserAPIKeyResponse.from_dict(s) diff --git a/support/schemas/request/ClientSettings.json b/support/schemas/request/ClientSettings.json index 78d926b5f..80b5bdb85 100644 --- a/support/schemas/request/ClientSettings.json +++ b/support/schemas/request/ClientSettings.json @@ -1,7 +1,7 @@ { "$schema": "http://json-schema.org/draft-07/schema#", "title": "ClientSettings", - "description": "Basic client behavior settings. These settings specify the various targets and behavior of the Bitwarden Client. They are optional and uneditable once the client is initialized.\n\nDefaults to\n\n``` # use bitwarden::sdk::request::client_settings::{ClientSettings, DeviceType}; # use assert_matches::assert_matches; let settings = ClientSettings { identity_url: \"https://identity.bitwarden.com\".to_string(), api_url: \"https://api.bitwarden.com\".to_string(), user_agent: \"Bitwarden Rust-SDK\".to_string(), device_type: DeviceType::SDK, }; let default = ClientSettings::default(); assert_matches!(settings, default); ```\n\nTargets `localhost:8080` for debug builds.", + "description": "Basic client behavior settings. These settings specify the various targets and behavior of the Bitwarden Client. They are optional and uneditable once the client is initialized.\n\nDefaults to\n\n``` # use bitwarden::sdk::request::client_settings::{ClientSettings, DeviceType}; # use assert_matches::assert_matches; let settings = ClientSettings { identity_url: \"https://identity.bitwarden.com\".to_string(), api_url: \"https://api.bitwarden.com\".to_string(), user_agent: \"Bitwarden Rust-SDK\".to_string(), device_type: DeviceType::SDK, state_path: None, }; let default = ClientSettings::default(); assert_matches!(settings, default); ```\n\nTargets `localhost:8080` for debug builds.", "type": "object", "required": [ "apiUrl", @@ -26,6 +26,13 @@ "description": "The identity url of the targeted Bitwarden instance. Defaults to `https://identity.bitwarden.com`", "type": "string" }, + "statePath": { + "description": "Path to the file that stores the SDK's internal state, when not set the state is kept in memory only This option has no effect when compiling for WebAssembly, in that case LocalStorage is always used.", + "type": [ + "string", + "null" + ] + }, "userAgent": { "description": "The user_agent to sent to Bitwarden. Defaults to `Bitwarden Rust-SDK`", "type": "string" diff --git a/support/schemas/request/Command.json b/support/schemas/request/Command.json index 071692175..2a7243806 100644 --- a/support/schemas/request/Command.json +++ b/support/schemas/request/Command.json @@ -41,6 +41,19 @@ }, "additionalProperties": false }, + { + "description": "Login with a previously saved session", + "type": "object", + "required": [ + "sessionLogin" + ], + "properties": { + "sessionLogin": { + "$ref": "#/definitions/SessionLoginRequest" + } + }, + "additionalProperties": false + }, { "description": "> Requires Authentication Get the API key of the currently authenticated user\n\nReturns: [UserApiKeyResponse](crate::sdk::response::user_api_key_response::UserApiKeyResponse)", "type": "object", @@ -67,6 +80,19 @@ }, "additionalProperties": false }, + { + "description": "> Requires Authentication Get the user's account data associated with this client\n\nReturns: [AccountData](crate::sdk::model::account_data::AccountData)", + "type": "object", + "required": [ + "getAccountState" + ], + "properties": { + "getAccountState": { + "$ref": "#/definitions/EmptyRequest" + } + }, + "additionalProperties": false + }, { "description": "> Requires Authentication Retrieve all user data, ciphers and organizations the user is a part of\n\nReturns: [SyncResponse](crate::sdk::response::sync_response::SyncResponse)", "type": "object", @@ -103,6 +129,18 @@ } }, "additionalProperties": false + }, + { + "type": "object", + "required": [ + "folders" + ], + "properties": { + "folders": { + "$ref": "#/definitions/FoldersCommand" + } + }, + "additionalProperties": false } ], "definitions": { @@ -144,6 +182,10 @@ }, "additionalProperties": false }, + "EmptyRequest": { + "description": "An empty request that needs no parameters", + "type": "object" + }, "FingerprintRequest": { "type": "object", "required": [ @@ -162,6 +204,92 @@ }, "additionalProperties": false }, + "FolderCreateRequest": { + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "description": "Encrypted folder name", + "type": "string" + } + }, + "additionalProperties": false + }, + "FolderDeleteRequest": { + "type": "object", + "required": [ + "id" + ], + "properties": { + "id": { + "description": "ID of the folder to delete", + "type": "string", + "format": "uuid" + } + }, + "additionalProperties": false + }, + "FolderUpdateRequest": { + "type": "object", + "required": [ + "id", + "name" + ], + "properties": { + "id": { + "description": "ID of the folder to update", + "type": "string", + "format": "uuid" + }, + "name": { + "description": "Encrypted folder name", + "type": "string" + } + }, + "additionalProperties": false + }, + "FoldersCommand": { + "oneOf": [ + { + "type": "object", + "required": [ + "create" + ], + "properties": { + "create": { + "$ref": "#/definitions/FolderCreateRequest" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "update" + ], + "properties": { + "update": { + "$ref": "#/definitions/FolderUpdateRequest" + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "delete" + ], + "properties": { + "delete": { + "$ref": "#/definitions/FolderDeleteRequest" + } + }, + "additionalProperties": false + } + ] + }, "PasswordLoginRequest": { "description": "Login to Bitwarden with Username and Password", "type": "object", @@ -431,6 +559,26 @@ }, "additionalProperties": false }, + "SessionLoginRequest": { + "description": "Login to Bitwarden using a saved session", + "type": "object", + "required": [ + "password", + "userId" + ], + "properties": { + "password": { + "description": "User's master password, used to unlock the vault", + "type": "string" + }, + "userId": { + "description": "User's uuid", + "type": "string", + "format": "uuid" + } + }, + "additionalProperties": false + }, "SyncRequest": { "type": "object", "properties": { diff --git a/support/schemas/response/SyncResponse.json b/support/schemas/response/SyncResponse.json deleted file mode 100644 index 6c149ab63..000000000 --- a/support/schemas/response/SyncResponse.json +++ /dev/null @@ -1,105 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-07/schema#", - "title": "Response_for_SyncResponse", - "type": "object", - "required": [ - "success" - ], - "properties": { - "data": { - "description": "The response data. Populated if `success` is true.", - "anyOf": [ - { - "$ref": "#/definitions/SyncResponse" - }, - { - "type": "null" - } - ] - }, - "errorMessage": { - "description": "A message for any error that may occur. Populated if `success` is false.", - "type": [ - "string", - "null" - ] - }, - "success": { - "description": "Whether or not the SDK request succeeded.", - "type": "boolean" - } - }, - "additionalProperties": false, - "definitions": { - "CipherDetailsResponse": { - "type": "object", - "additionalProperties": false - }, - "ProfileOrganizationResponse": { - "type": "object", - "required": [ - "id" - ], - "properties": { - "id": { - "type": "string", - "format": "uuid" - } - }, - "additionalProperties": false - }, - "ProfileResponse": { - "type": "object", - "required": [ - "email", - "id", - "name", - "organizations" - ], - "properties": { - "email": { - "type": "string" - }, - "id": { - "type": "string", - "format": "uuid" - }, - "name": { - "type": "string" - }, - "organizations": { - "type": "array", - "items": { - "$ref": "#/definitions/ProfileOrganizationResponse" - } - } - }, - "additionalProperties": false - }, - "SyncResponse": { - "type": "object", - "required": [ - "ciphers", - "profile" - ], - "properties": { - "ciphers": { - "description": "List of ciphers accesible by the user", - "type": "array", - "items": { - "$ref": "#/definitions/CipherDetailsResponse" - } - }, - "profile": { - "description": "Data about the user, including their encryption keys and the organizations they are a part of", - "allOf": [ - { - "$ref": "#/definitions/ProfileResponse" - } - ] - } - }, - "additionalProperties": false - } - } -}