From a76013c44829874ab0f8e20ba733693c3d9256ca Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 9 Oct 2024 10:46:50 -0400 Subject: [PATCH 01/39] [deps]: Update System.Text.Json to 8.0.5 [SECURITY] (#1121) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [System.Text.Json](https://dot.net/) ([source](https://redirect.github.com/dotnet/runtime)) | `8.0.4` -> `8.0.5` | [![age](https://developer.mend.io/api/mc/badges/age/nuget/System.Text.Json/8.0.5?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/nuget/System.Text.Json/8.0.5?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/nuget/System.Text.Json/8.0.4/8.0.5?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/nuget/System.Text.Json/8.0.4/8.0.5?slim=true)](https://docs.renovatebot.com/merge-confidence/) | ### GitHub Vulnerability Alerts #### [CVE-2024-43485](https://redirect.github.com/dotnet/runtime/security/advisories/GHSA-8g4q-xg66-9fp4) # Microsoft Security Advisory CVE-2024-43485 | .NET Denial of Service Vulnerability ## Executive summary Microsoft is releasing this security advisory to provide information about a vulnerability in System.Text.Json 6.0.x and 8.0.x. This advisory also provides guidance on what developers can do to update their applications to remove this vulnerability. In System.Text.Json 6.0.x and 8.0.x, applications which deserialize input to a model with an `[ExtensionData]` property can be vulnerable to an algorithmic complexity attack resulting in Denial of Service. ## Announcement Announcement for this issue can be found at [https://github.com/dotnet/announcements/issues/329](https://redirect.github.com/dotnet/announcements/issues/329) ## Mitigation factors JSON models which do not utilize the `[ExtensionData]` feature are not impacted by this vulnerability. ## Affected software * Any .NET 8.0 application running on .NET 8.0.8 or earlier. * Any .NET 6.0 aplication running on .NET 6.0.33 or earlier. * Any application consuming one of the [vulnerable packages](affected-packages). ## Affected Packages The vulnerability affects any Microsoft .NET Core project if it uses any of affected packages versions listed below ### .NET 8 Package name | Affected version | Patched version ------------ | ---------------- | ------------------------- [System.Text.Json](https://www.nuget.org/packages/System.Text.Json) | >= 8.0.0, <= 8.0.4 | 8.0.5 ### .NET 6 Package name | Affected version | Patched version ------------ | ---------------- | ------------------------- [System.Text.Json](https://www.nuget.org/packages/System.Text.Json) | >= 6.0.0, <= 6.0.9 | 6.0.10 ## Advisory FAQ ### How do I know if I am affected? If you have a runtime or SDK with a version listed, or an affected package listed in [affected software](#affected-packages) or [affected packages](#affected-software), you're exposed to the vulnerability. ### How do I fix the issue? * To fix the issue please install the latest version of .NET 8.0 or .NET 6.0. If you have installed one or more .NET SDKs through Visual Studio, Visual Studio will prompt you to update Visual Studio, which will also update your .NET SDKs. * .NET Framework-based applications and other application types need to perform a package update. * If you have .NET 6.0 or greater installed, you can list the versions you have installed by running the `dotnet --info` command. You will see output like the following; ``` .NET Core SDK (reflecting any global.json): Version: 8.0.200 Commit: 8473146e7d Runtime Environment: OS Name: Windows OS Version: 10.0.18363 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\6.0.300\ Host (useful for support): Version: 8.0.3 Commit: 8473146e7d .NET Core SDKs installed: 8.0.200 [C:\Program Files\dotnet\sdk] .NET Core runtimes installed: Microsoft.AspAspNetCore.App 8.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspAspNetCore.App] Microsoft.AspNetCore.App 8.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.WindowsDesktop.App 8.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] To install additional .NET Core runtimes or SDKs: https://aka.ms/dotnet-download ``` * If you're using .NET 6.0, you should download and install .NET 6.0.35 Runtime or .NET 6.0.135 SDK (for Visual Studio 2022 v17.6) from https://dotnet.microsoft.com/download/dotnet-core/6.0. * If you're using .NET 8.0, you should download and install .NET 8.0.10 Runtime or .NET 8.0.110 SDK (for Visual Studio 2022 v17.8) from https://dotnet.microsoft.com/download/dotnet-core/8.0. .NET 8.0 and .NET 6.0 updates are also available from Microsoft Update. To access this either type "Check for updates" in your Windows search, or open Settings, choose Update & Security and then click Check for Updates. Once you have installed the updated runtime or SDK, restart your apps for the update to take effect. Additionally, if you've deployed [self-contained applications](https://docs.microsoft.com/dotnet/core/deploying/#self-contained-deployments-scd) targeting any of the impacted versions, these applications are also vulnerable and must be recompiled and redeployed. ## Other Information ### Reporting Security Issues If you have found a potential security issue in .NET 8.0 or .NET 6.0, please email details to secure@microsoft.com. Reports may qualify for the Microsoft .NET Core & .NET 5 Bounty. Details of the Microsoft .NET Bounty Program including terms and conditions are at . ### Support You can ask questions about this issue on GitHub in the .NET GitHub organization. The main repos are located at https://github.com/dotnet/runtime and https://github.com/dotnet/aspnet/. The Announcements repo (https://github.com/dotnet/Announcements) will contain this bulletin as an issue and will include a link to a discussion issue. You can ask questions in the linked discussion issue. ### Disclaimer The information provided in this advisory is provided "as is" without warranty of any kind. Microsoft disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. In no event shall Microsoft Corporation or its suppliers be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages, even if Microsoft Corporation or its suppliers have been advised of the possibility of such damages. Some states do not allow the exclusion or limitation of liability for consequential or incidental damages so the foregoing limitation may not apply. ### External Links [CVE-2024-43485]( https://www.cve.org/CVERecord?id=CVE-2024-43485) ### Revisions V1.0 (October 08, 2024): Advisory published. _Version 1.0_ _Last Updated 2024-10-08_ --- ### Release Notes dotnet/runtime (System.Text.Json) ### [`v8.0.5`](https://redirect.github.com/dotnet/runtime/releases/tag/v8.0.5): .NET 8.0.5 [Release](https://redirect.github.com/dotnet/core/releases/tag/v8.0.5) #### What's Changed - \[release/8.0-staging] Fix AsyncVoidMethodBuilder race condition around SynchronizationContext by [@github-actions](https://redirect.github.com/github-actions) in [https://github.com/dotnet/runtime/pull/99640](https://redirect.github.com/dotnet/runtime/pull/99640) - \[release/8.0-staging] Always keep global symbols on ApplePlatforms by [@github-actions](https://redirect.github.com/github-actions) in [https://github.com/dotnet/runtime/pull/99650](https://redirect.github.com/dotnet/runtime/pull/99650) - \[release/8.0-staging] Delete Decrypt_Pkcs1\_ErrorsForInvalidPadding by [@github-actions](https://redirect.github.com/github-actions) in [https://github.com/dotnet/runtime/pull/99653](https://redirect.github.com/dotnet/runtime/pull/99653) - \[8.0] Rename MSBuild property MicrosoftNativeQuicMsQuicVersion -> MicrosoftNativeQuicMsQuicSchannelVersion by [@carlossanlop](https://redirect.github.com/carlossanlop) in [https://github.com/dotnet/runtime/pull/99714](https://redirect.github.com/dotnet/runtime/pull/99714) - \[release/8.0] Fixing SignedXml.CheckSignature for enveloped signature with `#xpointer(/)` Reference by [@bartonjs](https://redirect.github.com/bartonjs) in [https://github.com/dotnet/runtime/pull/99651](https://redirect.github.com/dotnet/runtime/pull/99651) - \[release/8.0-staging] disable optimizations for PopCount by [@github-actions](https://redirect.github.com/github-actions) in [https://github.com/dotnet/runtime/pull/99832](https://redirect.github.com/dotnet/runtime/pull/99832) - \[release/8.0-staging] Handle NativeOverlapped\* coming from both the Windows or Portable thread pool in NativeRuntimeEventSource by [@github-actions](https://redirect.github.com/github-actions) in [https://github.com/dotnet/runtime/pull/99656](https://redirect.github.com/dotnet/runtime/pull/99656) - \[release/8.0-staging] Fix exporting certificate keys on macOS 14.4. by [@github-actions](https://redirect.github.com/github-actions) in [https://github.com/dotnet/runtime/pull/99776](https://redirect.github.com/dotnet/runtime/pull/99776) - \[release/8.0] Upgrade zlib to 1.3.1 by [@carlossanlop](https://redirect.github.com/carlossanlop) in [https://github.com/dotnet/runtime/pull/99473](https://redirect.github.com/dotnet/runtime/pull/99473) - \[release/8.0] Fix failing CertificateValidationRemoteServer.ConnectWithRevocation_WithCallback test ([#99915](https://redirect.github.com/dotnet/runtime/issues/99915)) by [@rzikm](https://redirect.github.com/rzikm) in [https://github.com/dotnet/runtime/pull/99950](https://redirect.github.com/dotnet/runtime/pull/99950) - \[mono] Stop exporting ICU symbols from Mono by [@matouskozak](https://redirect.github.com/matouskozak) in [https://github.com/dotnet/runtime/pull/99449](https://redirect.github.com/dotnet/runtime/pull/99449) - \[release/8.0-staging] Fix AV in HttpTelemetry.WriteEvent by [@github-actions](https://redirect.github.com/github-actions) in [https://github.com/dotnet/runtime/pull/99607](https://redirect.github.com/dotnet/runtime/pull/99607) - \[release/8.0-staging] \[HTTP/2] Fix handling of effectively empty DATA frame ([#99502](https://redirect.github.com/dotnet/runtime/issues/99502)) by [@ManickaP](https://redirect.github.com/ManickaP) in [https://github.com/dotnet/runtime/pull/99677](https://redirect.github.com/dotnet/runtime/pull/99677) - \[release/8.0-staging] \[HttpStress] \[SslStress] Workaround image bug in 1es-windows-2022-open by [@github-actions](https://redirect.github.com/github-actions) in [https://github.com/dotnet/runtime/pull/100303](https://redirect.github.com/dotnet/runtime/pull/100303) - \[release/8.0-staging] Support building against clang 18 by [@omajid](https://redirect.github.com/omajid) in [https://github.com/dotnet/runtime/pull/100258](https://redirect.github.com/dotnet/runtime/pull/100258) - \[release/8.0]\[browser] WebSocket works differently depending on if we look up its state or not by [@ilonatommy](https://redirect.github.com/ilonatommy) in [https://github.com/dotnet/runtime/pull/99673](https://redirect.github.com/dotnet/runtime/pull/99673) - \[release/8.0-staging] Call the Copy Constructor for stack arguments in C++/CLI on x86 by [@AaronRobinsonMSFT](https://redirect.github.com/AaronRobinsonMSFT) in [https://github.com/dotnet/runtime/pull/100221](https://redirect.github.com/dotnet/runtime/pull/100221) - \[release/8.0] Don't unset ALPN list pointer during ALPN selection callback. by [@github-actions](https://redirect.github.com/github-actions) in [https://github.com/dotnet/runtime/pull/99670](https://redirect.github.com/dotnet/runtime/pull/99670) - \[release/8.0-staging]\[mono]\[debugger] Fix inspect Span by [@thaystg](https://redirect.github.com/thaystg) in [https://github.com/dotnet/runtime/pull/99844](https://redirect.github.com/dotnet/runtime/pull/99844) - Update branding to 8.0.5 by [@vseanreesermsft](https://redirect.github.com/vseanreesermsft) in [https://github.com/dotnet/runtime/pull/100547](https://redirect.github.com/dotnet/runtime/pull/100547) - \[release/8.0-staging] Ensure that Sse3.MoveAndDuplicate correctly tracks supporting SIMD scalar loads by [@tannergooding](https://redirect.github.com/tannergooding) in [https://github.com/dotnet/runtime/pull/100417](https://redirect.github.com/dotnet/runtime/pull/100417) - \[release/8.0] Avoid allocating collectible instances in the frozen heap ([#100444](https://redirect.github.com/dotnet/runtime/issues/100444)) by [@jkotas](https://redirect.github.com/jkotas) in [https://github.com/dotnet/runtime/pull/100509](https://redirect.github.com/dotnet/runtime/pull/100509) - \[release/8.0-staging] Use clang --version to get Apple toolset version by [@github-actions](https://redirect.github.com/github-actions) in [https://github.com/dotnet/runtime/pull/100199](https://redirect.github.com/dotnet/runtime/pull/100199) - \[release/8.0-staging] Azure Linux 3.0 deps package by [@github-actions](https://redirect.github.com/github-actions) in [https://github.com/dotnet/runtime/pull/100684](https://redirect.github.com/dotnet/runtime/pull/100684) - \[release/8.0-staging] Fix Http2 deadlock by [@github-actions](https://redirect.github.com/github-actions) in [https://github.com/dotnet/runtime/pull/100086](https://redirect.github.com/dotnet/runtime/pull/100086) - Merging internal commits for release/8.0 by [@vseanreesermsft](https://redirect.github.com/vseanreesermsft) in [https://github.com/dotnet/runtime/pull/100835](https://redirect.github.com/dotnet/runtime/pull/100835) - \[release/8.0-staging] Update CI builds to not use VS Previews by [@github-actions](https://redirect.github.com/github-actions) in [https://github.com/dotnet/runtime/pull/100622](https://redirect.github.com/dotnet/runtime/pull/100622) - \[release/8.0-staging] Update dependencies from dotnet/hotreload-utils by [@dotnet-maestro](https://redirect.github.com/dotnet-maestro) in [https://github.com/dotnet/runtime/pull/100892](https://redirect.github.com/dotnet/runtime/pull/100892) - \[release/8.0-staging] Update dependencies from dotnet/runtime-assets by [@dotnet-maestro](https://redirect.github.com/dotnet-maestro) in [https://github.com/dotnet/runtime/pull/100073](https://redirect.github.com/dotnet/runtime/pull/100073) - \[automated] Merge branch 'release/8.0' => 'release/8.0-staging' by [@dotnet-maestro-bot](https://redirect.github.com/dotnet-maestro-bot) in [https://github.com/dotnet/runtime/pull/99585](https://redirect.github.com/dotnet/runtime/pull/99585) - \[release/8.0-staging] Update dependencies from dotnet/source-build-externals by [@dotnet-maestro](https://redirect.github.com/dotnet-maestro) in [https://github.com/dotnet/runtime/pull/99601](https://redirect.github.com/dotnet/runtime/pull/99601) - \[release/8.0-staging] Update dependencies from dotnet/xharness by [@dotnet-maestro](https://redirect.github.com/dotnet-maestro) in [https://github.com/dotnet/runtime/pull/100883](https://redirect.github.com/dotnet/runtime/pull/100883) - \[release/8.0-staging] Update dependencies from dotnet/source-build-reference-packages by [@dotnet-maestro](https://redirect.github.com/dotnet-maestro) in [https://github.com/dotnet/runtime/pull/99902](https://redirect.github.com/dotnet/runtime/pull/99902) - \[release/8.0-staging] Update dependencies from dotnet/source-build-externals by [@dotnet-maestro](https://redirect.github.com/dotnet-maestro) in [https://github.com/dotnet/runtime/pull/100015](https://redirect.github.com/dotnet/runtime/pull/100015) - \[release/8.0-staging] Update dependencies from dotnet/runtime-assets by [@dotnet-maestro](https://redirect.github.com/dotnet-maestro) in [https://github.com/dotnet/runtime/pull/100958](https://redirect.github.com/dotnet/runtime/pull/100958) - \[release/8.0-staging] Update dependencies from dotnet/arcade by [@dotnet-maestro](https://redirect.github.com/dotnet-maestro) in [https://github.com/dotnet/runtime/pull/100885](https://redirect.github.com/dotnet/runtime/pull/100885) - \[release/8.0-staging] Fix native leak in CryptoNative_GetX509nameInfo by [@github-actions](https://redirect.github.com/github-actions) in [https://github.com/dotnet/runtime/pull/100793](https://redirect.github.com/dotnet/runtime/pull/100793) - \[release/8.0-staging] Update dependencies from dotnet/emsdk by [@dotnet-maestro](https://redirect.github.com/dotnet-maestro) in [https://github.com/dotnet/runtime/pull/99696](https://redirect.github.com/dotnet/runtime/pull/99696) - \[release/8.0-staging] \[mono]\[debugger] Search for seqpoints directly from jitinfo if it's not find on get_default_jit_mm by [@github-actions](https://redirect.github.com/github-actions) in [https://github.com/dotnet/runtime/pull/100978](https://redirect.github.com/dotnet/runtime/pull/100978) - \[release/8.0]\[browser] fix emscripten out/err overrides by [@pavelsavara](https://redirect.github.com/pavelsavara) in [https://github.com/dotnet/runtime/pull/100818](https://redirect.github.com/dotnet/runtime/pull/100818) - \[release/8.0-staging] \[mono]\[eventpipe] Fix firing dynamic method wrappers crash by [@github-actions](https://redirect.github.com/github-actions) in [https://github.com/dotnet/runtime/pull/99712](https://redirect.github.com/dotnet/runtime/pull/99712) - Update Alpine versions for `release/8.0-staging` by [@richlander](https://redirect.github.com/richlander) in [https://github.com/dotnet/runtime/pull/99849](https://redirect.github.com/dotnet/runtime/pull/99849) - \[release/8.0-staging] Guard against -1 Returned from sysconf for the Cache Sizes Causing Large Gen0 Sizes and Budgets for Certain Linux Distributions. by [@github-actions](https://redirect.github.com/github-actions) in [https://github.com/dotnet/runtime/pull/100575](https://redirect.github.com/dotnet/runtime/pull/100575) - \[Release/8.0] Remove preventing EH at shutdown by [@janvorli](https://redirect.github.com/janvorli) in [https://github.com/dotnet/runtime/pull/100836](https://redirect.github.com/dotnet/runtime/pull/100836) - \[release/8.8] Add metadata for workload automation by [@joeloff](https://redirect.github.com/joeloff) in [https://github.com/dotnet/runtime/pull/100649](https://redirect.github.com/dotnet/runtime/pull/100649) - \[8.0] Reset OOB packages enabled in the April release by [@carlossanlop](https://redirect.github.com/carlossanlop) in [https://github.com/dotnet/runtime/pull/99583](https://redirect.github.com/dotnet/runtime/pull/99583) - \[release/8.0-staging] Always zero-init if object contains pointers by [@VSadov](https://redirect.github.com/VSadov) in [https://github.com/dotnet/runtime/pull/100426](https://redirect.github.com/dotnet/runtime/pull/100426) - \[release/8.0-staging] JIT: Fixed incorrect reversed condition for GT by [@github-actions](https://redirect.github.com/github-actions) in [https://github.com/dotnet/runtime/pull/100372](https://redirect.github.com/dotnet/runtime/pull/100372) - \[manual] Merge release/8.0-staging into release/8.0 by [@directhex](https://redirect.github.com/directhex) in [https://github.com/dotnet/runtime/pull/101091](https://redirect.github.com/dotnet/runtime/pull/101091) - \[release/8.0] \[release/8.0] Update MicrosoftBuildVersion to latest by [@github-actions](https://redirect.github.com/github-actions) in [https://github.com/dotnet/runtime/pull/101145](https://redirect.github.com/dotnet/runtime/pull/101145) **Full Changelog**: https://github.com/dotnet/runtime/compare/v8.0.4...v8.0.5 --- ### Configuration đ **Schedule**: Branch creation - "" (UTC), Automerge - At any time (no schedule defined). đĻ **Automerge**: Disabled by config. Please merge this manually once you are satisfied. âģ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. đ **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/bitwarden/sdk). Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- languages/csharp/Bitwarden.Sdk/Bitwarden.Sdk.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/languages/csharp/Bitwarden.Sdk/Bitwarden.Sdk.csproj b/languages/csharp/Bitwarden.Sdk/Bitwarden.Sdk.csproj index d2363f4a..a7c82e4b 100644 --- a/languages/csharp/Bitwarden.Sdk/Bitwarden.Sdk.csproj +++ b/languages/csharp/Bitwarden.Sdk/Bitwarden.Sdk.csproj @@ -25,7 +25,7 @@ - + From 89b23bd85ea09f3af43a41e216cfd7fe9917b188 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 10 Oct 2024 11:02:59 +0200 Subject: [PATCH 02/39] [deps]: Lock file maintenance (#1125) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Update | Change | |---|---| | lockFileMaintenance | All locks refreshed | đ§ This Pull Request updates lock files to use the latest dependency versions. --- ### Configuration đ **Schedule**: Branch creation - "every 2nd week starting on the 2 week of the year before 4am on Monday" (UTC), Automerge - At any time (no schedule defined). đĻ **Automerge**: Disabled by config. Please merge this manually once you are satisfied. âģ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. đģ **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://redirect.github.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/bitwarden/sdk). Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- Cargo.lock | 190 +++++++++++----------- languages/js/sdk-client/package-lock.json | 12 +- package-lock.json | 18 +- 3 files changed, 111 insertions(+), 109 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4e0d1411..5397271c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -861,9 +861,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.22" +version = "1.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9540e661f81799159abee814118cc139a2004b3a3aa3ea37724a1b66530b90e0" +checksum = "2e80e3b6a3ab07840e1cae9b0666a63970dc28e8ed5ffbcdacbfc760c281bfc1" dependencies = [ "shlex", ] @@ -935,9 +935,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.18" +version = "4.5.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0956a43b323ac1afaffc053ed5c4b7c1f1800bacd1683c353aabbb752515dd3" +checksum = "b97f376d85a664d5837dbae44bf546e6477a679ff6610010f17276f686d867e8" dependencies = [ "clap_builder", "clap_derive", @@ -945,9 +945,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.18" +version = "4.5.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d72166dd41634086d5803a47eb71ae740e61d84709c36f3c34110173db3961b" +checksum = "19bc80abd44e4bed93ca373a0704ccbd1b710dc5749406201bb018272808dc54" dependencies = [ "anstream", "anstyle", @@ -957,9 +957,9 @@ dependencies = [ [[package]] name = "clap_complete" -version = "4.5.29" +version = "4.5.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8937760c3f4c60871870b8c3ee5f9b30771f792a7045c48bcbba999d7d6b3b8e" +checksum = "9646e2e245bf62f45d39a0f3f36f1171ad1ea0d6967fd114bca72cb02a8fcdfb" dependencies = [ "clap", ] @@ -984,9 +984,9 @@ checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" [[package]] name = "clap_mangen" -version = "0.2.23" +version = "0.2.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f17415fd4dfbea46e3274fcd8d368284519b358654772afb700dc2e8d2b24eeb" +checksum = "fbae9cbfdc5d4fa8711c09bd7b83f644cb48281ac35bf97af3e47b0675864bdf" dependencies = [ "clap", "roff", @@ -1414,18 +1414,18 @@ dependencies = [ [[package]] name = "derive_builder" -version = "0.20.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd33f37ee6a119146a1781d3356a7c26028f83d779b2e04ecd45fdc75c76877b" +checksum = "507dfb09ea8b7fa618fcf76e953f4f5e192547945816d5358edffe39f6f94947" dependencies = [ "derive_builder_macro", ] [[package]] name = "derive_builder_core" -version = "0.20.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7431fa049613920234f22c47fdc33e6cf3ee83067091ea4277a3f8c4587aae38" +checksum = "2d5bcf7b024d6835cfb3d473887cd966994907effbe9227e8c8219824d06c4e8" dependencies = [ "darling", "proc-macro2", @@ -1435,9 +1435,9 @@ dependencies = [ [[package]] name = "derive_builder_macro" -version = "0.20.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4abae7035bf79b9877b779505d8cf3749285b80c43941eda66604841889451dc" +checksum = "ab63b0e2bf4d5928aff72e83a7dace85d7bba5fe12dcc3c5a572d78caffd3f3c" dependencies = [ "derive_builder_core", "syn 2.0.79", @@ -1652,9 +1652,9 @@ dependencies = [ [[package]] name = "futures" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" dependencies = [ "futures-channel", "futures-core", @@ -1667,9 +1667,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" dependencies = [ "futures-core", "futures-sink", @@ -1677,15 +1677,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" [[package]] name = "futures-executor" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" dependencies = [ "futures-core", "futures-task", @@ -1694,15 +1694,15 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" [[package]] name = "futures-macro" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", @@ -1711,21 +1711,21 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" [[package]] name = "futures-task" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" [[package]] name = "futures-util" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ "futures-channel", "futures-core", @@ -1840,7 +1840,7 @@ dependencies = [ "futures-core", "futures-sink", "http", - "indexmap 2.5.0", + "indexmap 2.6.0", "slab", "tokio", "tokio-util", @@ -1869,6 +1869,12 @@ version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +[[package]] +name = "hashbrown" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" + [[package]] name = "heck" version = "0.4.1" @@ -1962,9 +1968,9 @@ dependencies = [ [[package]] name = "httparse" -version = "1.9.4" +version = "1.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" +checksum = "7d71d3574edd2771538b901e6549113b4006ece66150fb69c0fb6d9a2adae946" [[package]] name = "httpdate" @@ -2093,12 +2099,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5" +checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" dependencies = [ "equivalent", - "hashbrown 0.14.5", + "hashbrown 0.15.0", "serde", ] @@ -2137,9 +2143,9 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.10.0" +version = "2.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "187674a687eed5fe42285b40c6291f9a01517d415fad1c3cbc6a9f778af7fcd4" +checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708" [[package]] name = "is-terminal" @@ -2210,9 +2216,9 @@ checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" [[package]] name = "js-sys" -version = "0.3.70" +version = "0.3.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a" +checksum = "0cb94a0ffd3f3ee755c20f7d8752f45cac88605a4dcf808abcff72873296ec7b" dependencies = [ "wasm-bindgen", ] @@ -2551,12 +2557,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.20.1" +version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82881c4be219ab5faaf2ad5e5e5ecdff8c66bd7402ca3160975c93b24961afd1" -dependencies = [ - "portable-atomic", -] +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" [[package]] name = "onig" @@ -2706,7 +2709,7 @@ dependencies = [ "coset", "data-encoding", "getrandom", - "indexmap 2.5.0", + "indexmap 2.6.0", "rand", "serde", "serde_json", @@ -2816,7 +2819,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42cf17e9a1800f5f396bc67d193dc9411b59012a5876445ef450d449881e1016" dependencies = [ "base64", - "indexmap 2.5.0", + "indexmap 2.6.0", "quick-xml", "serde", "time", @@ -2906,9 +2909,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.86" +version = "1.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +checksum = "b3e4daa0dcf6feba26f985457cdf104d4b4256fc5a09547140f3631bb076b19a" dependencies = [ "unicode-ident", ] @@ -3110,9 +3113,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.6" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "355ae415ccd3a04315d3f8246e86d67689ea74d88d915576e1589a351062a13b" +checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f" dependencies = [ "bitflags 2.6.0", ] @@ -3159,9 +3162,9 @@ checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "reqwest" -version = "0.12.7" +version = "0.12.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8f4955649ef5c38cc7f9e8aa41761d48fb9677197daea9984dc54f56aad5e63" +checksum = "f713147fbe92361e52392c73b8c9e48c04c6625bce969ef54dc901e58e042a7b" dependencies = [ "base64", "bytes", @@ -3287,9 +3290,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.13" +version = "0.23.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2dabaac7466917e566adb06783a81ca48944c6898a1b08b9374106dd671f4c8" +checksum = "415d9944693cb90382053259f89fbb077ea730ad7273047ec63b19bc9b160ba8" dependencies = [ "once_cell", "ring", @@ -3314,11 +3317,10 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "2.1.3" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "196fe16b00e106300d3e45ecfcb764fa292a535d7326a29a5875c579c7417425" +checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" dependencies = [ - "base64", "rustls-pki-types", ] @@ -3389,9 +3391,9 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.24" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9aaafd5a2b6e3d657ff009d82fbd630b6bd54dd4eb06f21693925cdf80f9b8b" +checksum = "01227be5826fa0690321a2ba6c5cd57a19cf3f6a09e76973b58e61de6ab9d1c1" dependencies = [ "windows-sys 0.59.0", ] @@ -3564,7 +3566,7 @@ version = "1.0.128" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" dependencies = [ - "indexmap 2.5.0", + "indexmap 2.6.0", "itoa", "memchr", "ryu", @@ -3616,15 +3618,15 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.9.0" +version = "3.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69cecfa94848272156ea67b2b1a53f20fc7bc638c4a46d2f8abde08f05f4b857" +checksum = "8e28bdad6db2b8340e449f7108f020b3b092e8583a9e3fb82713e1d4e71fe817" dependencies = [ "base64", "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.5.0", + "indexmap 2.6.0", "serde", "serde_derive", "serde_json", @@ -3634,9 +3636,9 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.9.0" +version = "3.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8fee4991ef4f274617a51ad4af30519438dacb2f56ac773b08a1922ff743350" +checksum = "9d846214a9854ef724f3da161b426242d8de7c1fc7de2f89bb1efcb154dca79d" dependencies = [ "darling", "proc-macro2", @@ -3650,7 +3652,7 @@ version = "0.9.34+deprecated" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" dependencies = [ - "indexmap 2.5.0", + "indexmap 2.6.0", "itoa", "ryu", "serde", @@ -4122,7 +4124,7 @@ version = "0.22.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" dependencies = [ - "indexmap 2.5.0", + "indexmap 2.6.0", "serde", "serde_spanned", "toml_datetime", @@ -4223,9 +4225,9 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.15" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" +checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893" [[package]] name = "unicode-ident" @@ -4313,9 +4315,9 @@ dependencies = [ [[package]] name = "uniffi_checksum_derive" -version = "0.28.1" +version = "0.28.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a22dbe67c1c957ac6e7611bdf605a6218aa86b0eebeb8be58b70ae85ad7d73dc" +checksum = "d2c801f0f05b06df456a2da4c41b9c2c4fdccc6b9916643c6c67275c4c9e4d07" dependencies = [ "quote", "syn 2.0.79", @@ -4507,9 +4509,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.93" +version = "0.2.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" +checksum = "ef073ced962d62984fb38a36e5fdc1a2b23c9e0e1fa0689bb97afa4202ef6887" dependencies = [ "cfg-if", "once_cell", @@ -4520,9 +4522,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.93" +version = "0.2.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" +checksum = "c4bfab14ef75323f4eb75fa52ee0a3fb59611977fd3240da19b2cf36ff85030e" dependencies = [ "bumpalo", "log", @@ -4535,9 +4537,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.43" +version = "0.4.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61e9300f63a621e96ed275155c108eb6f843b6a26d053f122ab69724559dc8ed" +checksum = "65471f79c1022ffa5291d33520cbbb53b7687b01c2f8e83b57d102eed7ed479d" dependencies = [ "cfg-if", "js-sys", @@ -4547,9 +4549,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.93" +version = "0.2.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" +checksum = "a7bec9830f60924d9ceb3ef99d55c155be8afa76954edffbb5936ff4509474e7" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4557,9 +4559,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.93" +version = "0.2.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" +checksum = "4c74f6e152a76a2ad448e223b0fc0b6b5747649c3d769cc6bf45737bf97d0ed6" dependencies = [ "proc-macro2", "quote", @@ -4570,15 +4572,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.93" +version = "0.2.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" +checksum = "a42f6c679374623f295a8623adfe63d9284091245c3504bde47c17a3ce2777d9" [[package]] name = "wasm-bindgen-test" -version = "0.3.43" +version = "0.3.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68497a05fb21143a08a7d24fc81763384a3072ee43c44e86aad1744d6adef9d9" +checksum = "a93d2a9ae98f1af8953f6415397299d808cce0a24f6d7c613d27bd83edf98da8" dependencies = [ "console_error_panic_hook", "js-sys", @@ -4591,9 +4593,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-test-macro" -version = "0.3.43" +version = "0.3.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b8220be1fa9e4c889b30fd207d4906657e7e90b12e0e6b0c8b8d8709f5de021" +checksum = "fb8b294691f640bad8f2bb35a11bb28272701b1d687bd5fd661a27684e894d4d" dependencies = [ "proc-macro2", "quote", @@ -4602,9 +4604,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.70" +version = "0.3.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26fdeaafd9bd129f65e7c031593c24d62186301e0c72c8978fa1678be7d532c0" +checksum = "44188d185b5bdcae1052d08bcbcf9091a5524038d4572cc4f4f2bb9d5554ddd9" dependencies = [ "js-sys", "wasm-bindgen", diff --git a/languages/js/sdk-client/package-lock.json b/languages/js/sdk-client/package-lock.json index f5b6f590..5911a333 100644 --- a/languages/js/sdk-client/package-lock.json +++ b/languages/js/sdk-client/package-lock.json @@ -30,9 +30,9 @@ } }, "node_modules/@types/node": { - "version": "20.16.10", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.16.10.tgz", - "integrity": "sha512-vQUKgWTjEIRFCvK6CyriPH3MZYiYlNy0fKiEYHWbcoWLEgs4opurGGKlebrTLqdSMIbXImH6XExNiIyNUv3WpA==", + "version": "20.16.11", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.16.11.tgz", + "integrity": "sha512-y+cTCACu92FyA5fgQSAI8A1H429g7aSK2HsO7K4XYUWc4dY5IUz55JSDIYT6/VsOLfGy8vmvQYC2hfb0iF16Uw==", "dev": true, "license": "MIT", "dependencies": { @@ -436,9 +436,9 @@ } }, "node_modules/typescript": { - "version": "5.6.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.2.tgz", - "integrity": "sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw==", + "version": "5.6.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.3.tgz", + "integrity": "sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==", "dev": true, "license": "Apache-2.0", "bin": { diff --git a/package-lock.json b/package-lock.json index 9ceb5ffe..3d3e1669 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,9 +19,9 @@ } }, "node_modules/@babel/runtime": { - "version": "7.25.6", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.25.6.tgz", - "integrity": "sha512-VBj9MYyDb9tuLq7yzqjgzt6Q+IBQLrGZfdjOekyEirZPHxXWoTSGUTMrpsfi58Up73d13NfYLv8HT9vmznjzhQ==", + "version": "7.25.7", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.25.7.tgz", + "integrity": "sha512-FjoyLe754PMiYsFaN5C94ttGiOmBNYTf6pLr4xXHAT5uctHb092PBszndLDR5XA/jghQvn4n7JMHl7dmTgbm9w==", "dev": true, "license": "MIT", "dependencies": { @@ -359,9 +359,9 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "22.7.4", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.7.4.tgz", - "integrity": "sha512-y+NPi1rFzDs1NdQHHToqeiX2TIS79SWEAw9GYhkkx8bD0ChpfqC+n2j5OXOCpzfojBEBt6DnEnnG9MY0zk1XLg==", + "version": "22.7.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.7.5.tgz", + "integrity": "sha512-jML7s2NAzMWc//QSJ1a3prpk78cOPchGvXJsC3C6R6PSMoooztvRVQEz89gmBTBY1SPMaqo5teB4uNHPdetShQ==", "dev": true, "license": "MIT", "peer": true, @@ -1069,9 +1069,9 @@ } }, "node_modules/form-data": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", - "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.1.tgz", + "integrity": "sha512-tzN8e4TX8+kkxGPK8D5u0FNmjPUjw3lwC9lSLxxoB/+GtsJG91CO8bSWy73APlgAZzZbXEYZJuxjkHH2w+Ezhw==", "dev": true, "license": "MIT", "dependencies": { From 4e341e55541f9c9f70c765c4a2d9ac8e98d3a750 Mon Sep 17 00:00:00 2001 From: Vince Grassia <593223+vgrassia@users.noreply.github.com> Date: Thu, 10 Oct 2024 05:46:39 -0400 Subject: [PATCH 03/39] BRE-359 - Update Build C++ workflow (#1123) --- .github/workflows/build-cpp.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/build-cpp.yml b/.github/workflows/build-cpp.yml index 01222aac..68636936 100644 --- a/.github/workflows/build-cpp.yml +++ b/.github/workflows/build-cpp.yml @@ -95,7 +95,6 @@ jobs: working-directory: languages/cpp shell: bash run: | - mv include/release/* include/ if [[ '${{ runner.os }}' == 'macOS' || '${{ runner.os }}' == 'Linux' ]]; then ls include/libbitwarden_c.* || { echo "Missing libbitwarden_c.*"; exit 1; } fi @@ -103,7 +102,6 @@ jobs: ls include/bitwarden_c.dll || { echo "Missing bitwarden_c.dll"; exit 1; } ls include/bitwarden_c.dll.lib || { echo "Missing bitwarden_c.dll.lib"; exit 1; } fi - rmdir include/release - name: Build unix working-directory: languages/cpp From 7e663e9cfa88782ccb45376690c5dca41c0b1711 Mon Sep 17 00:00:00 2001 From: Oscar Hinton Date: Thu, 10 Oct 2024 13:36:42 +0200 Subject: [PATCH 04/39] Remove the old doc script (#1126) --- crates/bitwarden-uniffi/README.md | 12 --- crates/bitwarden-uniffi/src/docs.rs | 49 ---------- crates/bitwarden-uniffi/src/lib.rs | 3 - crates/sdk-schemas/Cargo.toml | 6 +- crates/sdk-schemas/src/main.rs | 3 - package-lock.json | 64 ------------- package.json | 1 - support/docs/docs.ts | 139 ---------------------------- support/docs/rustdoc.ts | 12 --- support/docs/template.hbs | 91 ------------------ 10 files changed, 1 insertion(+), 379 deletions(-) delete mode 100644 crates/bitwarden-uniffi/src/docs.rs delete mode 100644 support/docs/docs.ts delete mode 100644 support/docs/rustdoc.ts delete mode 100644 support/docs/template.hbs diff --git a/crates/bitwarden-uniffi/README.md b/crates/bitwarden-uniffi/README.md index 4b2e6171..c2e4d6c4 100644 --- a/crates/bitwarden-uniffi/README.md +++ b/crates/bitwarden-uniffi/README.md @@ -1,13 +1 @@ # Bitwarden-uniffi - -## Generating documentation - -If desired we have some scripts that generates markdown documentation from the rustdoc output. - -```bash -cargo +nightly rustdoc -p bitwarden -- -Zunstable-options --output-format json -cargo +nightly rustdoc -p bitwarden-uniffi -- -Zunstable-options --output-format json -npm run schemas - -npx ts-node ./support/docs/docs.ts > doc.md -``` diff --git a/crates/bitwarden-uniffi/src/docs.rs b/crates/bitwarden-uniffi/src/docs.rs deleted file mode 100644 index 5edbc714..00000000 --- a/crates/bitwarden-uniffi/src/docs.rs +++ /dev/null @@ -1,49 +0,0 @@ -use bitwarden::{ - auth::password::MasterPasswordPolicyOptions, - exporters::ExportFormat, - generators::{PassphraseGeneratorRequest, PasswordGeneratorRequest}, - mobile::crypto::{InitOrgCryptoRequest, InitUserCryptoRequest}, - platform::FingerprintRequest, - send::{Send, SendListView, SendView}, - vault::{Cipher, CipherView, Collection, Folder, FolderView, TotpResponse}, -}; -use bitwarden_crypto::{HashPurpose, Kdf}; -use schemars::JsonSchema; - -#[derive(JsonSchema)] -#[allow(clippy::large_enum_variant)] -pub enum DocRef { - // Vault - Cipher(Cipher), - CipherView(CipherView), - Collection(Collection), - Folder(Folder), - FolderView(FolderView), - Send(Send), - SendView(SendView), - SendListView(SendListView), - - // Crypto - InitUserCryptoRequest(InitUserCryptoRequest), - InitOrgCryptoRequest(InitOrgCryptoRequest), - HashPurpose(HashPurpose), - - // Generators - PasswordGeneratorRequest(PasswordGeneratorRequest), - PassphraseGeneratorRequest(PassphraseGeneratorRequest), - - // Exporters - ExportFormat(ExportFormat), - - // Platform - FingerprintRequest(FingerprintRequest), - - // Auth - MasterPasswordPolicyOptions(MasterPasswordPolicyOptions), - - // Kdf - Kdf(Kdf), - - /// TOTP - TotpResponse(TotpResponse), -} diff --git a/crates/bitwarden-uniffi/src/lib.rs b/crates/bitwarden-uniffi/src/lib.rs index 0d89ffdb..a9eb6a3e 100644 --- a/crates/bitwarden-uniffi/src/lib.rs +++ b/crates/bitwarden-uniffi/src/lib.rs @@ -13,9 +13,6 @@ pub mod tool; mod uniffi_support; pub mod vault; -#[cfg(feature = "docs")] -pub mod docs; - #[cfg(target_os = "android")] mod android_support; diff --git a/crates/sdk-schemas/Cargo.toml b/crates/sdk-schemas/Cargo.toml index 8d48cd69..b4dd496a 100644 --- a/crates/sdk-schemas/Cargo.toml +++ b/crates/sdk-schemas/Cargo.toml @@ -12,11 +12,7 @@ license-file.workspace = true keywords.workspace = true [features] -internal = [ - "bitwarden/internal", - "bitwarden-json/internal", - "bitwarden-uniffi/docs", -] +internal = ["bitwarden/internal", "bitwarden-json/internal"] [dependencies] anyhow = "1.0.82" diff --git a/crates/sdk-schemas/src/main.rs b/crates/sdk-schemas/src/main.rs index 94959fa6..66683256 100644 --- a/crates/sdk-schemas/src/main.rs +++ b/crates/sdk-schemas/src/main.rs @@ -121,8 +121,5 @@ struct SchemaTypes { fn main() -> Result<()> { write_schema_for!("schema_types", SchemaTypes); - #[cfg(feature = "internal")] - write_schema_for!(bitwarden_uniffi::docs::DocRef); - Ok(()) } diff --git a/package-lock.json b/package-lock.json index 3d3e1669..894ec74e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,6 @@ "license": "SEE LICENSE IN LICENSE", "devDependencies": { "@openapitools/openapi-generator-cli": "2.13.4", - "handlebars": "^4.7.8", "prettier": "3.3.3", "quicktype-core": "23.0.170", "rimraf": "6.0.1", @@ -1144,28 +1143,6 @@ "dev": true, "license": "ISC" }, - "node_modules/handlebars": { - "version": "4.7.8", - "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.8.tgz", - "integrity": "sha512-vafaFqs8MZkRrSX7sFVUdo3ap/eNiLnb4IakshzvP56X5Nr1iGKAIqdX6tMlm6HcNRIkr6AxO5jFEoJzzpT8aQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "minimist": "^1.2.5", - "neo-async": "^2.6.2", - "source-map": "^0.6.1", - "wordwrap": "^1.0.0" - }, - "bin": { - "handlebars": "bin/handlebars" - }, - "engines": { - "node": ">=0.4.7" - }, - "optionalDependencies": { - "uglify-js": "^3.1.4" - } - }, "node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -1450,16 +1427,6 @@ "node": "*" } }, - "node_modules/minimist": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", - "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", - "dev": true, - "license": "MIT", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/minipass": { "version": "7.1.2", "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", @@ -1484,13 +1451,6 @@ "dev": true, "license": "ISC" }, - "node_modules/neo-async": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", - "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", - "dev": true, - "license": "MIT" - }, "node_modules/node-fetch": { "version": "2.7.0", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", @@ -1939,16 +1899,6 @@ "dev": true, "license": "ISC" }, - "node_modules/source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/spawn-command": { "version": "0.0.2", "resolved": "https://registry.npmjs.org/spawn-command/-/spawn-command-0.0.2.tgz", @@ -2158,20 +2108,6 @@ "node": ">=14.17" } }, - "node_modules/uglify-js": { - "version": "3.19.3", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.19.3.tgz", - "integrity": "sha512-v3Xu+yuwBXisp6QYTcH4UbH+xYJXqnq2m/LtQVWKWzYc1iehYnLixoQDN9FH6/j9/oybfd6W9Ghwkl8+UMKTKQ==", - "dev": true, - "license": "BSD-2-Clause", - "optional": true, - "bin": { - "uglifyjs": "bin/uglifyjs" - }, - "engines": { - "node": ">=0.8.0" - } - }, "node_modules/uid": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/uid/-/uid-2.0.2.tgz", diff --git a/package.json b/package.json index 8f40e36a..e7e41946 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,6 @@ }, "devDependencies": { "@openapitools/openapi-generator-cli": "2.13.4", - "handlebars": "^4.7.8", "prettier": "3.3.3", "quicktype-core": "23.0.170", "rimraf": "6.0.1", diff --git a/support/docs/docs.ts b/support/docs/docs.ts deleted file mode 100644 index 067ff082..00000000 --- a/support/docs/docs.ts +++ /dev/null @@ -1,139 +0,0 @@ -// Quick script that parses the rustdoc json output and generates a basic markdown documentation. -// -// Do note that this script follows no best practices and will not handle anything many edge cases. - -import fs from "fs"; -import path from "path"; -import Handlebars from "handlebars"; - -import { Input, InputType } from "./rustdoc"; - -const doc = JSON.parse(fs.readFileSync("./target/doc/bitwarden_uniffi.json", "utf8")); -const command = JSON.parse( - fs.readFileSync("./support/schemas/bitwarden_uniffi/DocRef.json", "utf8"), -); - -const template = Handlebars.compile( - fs.readFileSync(path.resolve(__dirname, "template.hbs"), "utf8"), -); - -// Modify this to include more root elements -const rootElements = [ - "Client", - "ClientAuth", - "ClientAttachments", - "ClientCiphers", - "ClientCollections", - "ClientCrypto", - "ClientExporters", - "ClientFolders", - "ClientGenerators", - "ClientPasswordHistory", - "ClientPlatform", - "ClientSends", - "ClientVault", -]; - -const localIndexArray = Object.values(doc.index).filter((entry: any) => entry.crate_id == 0); -const localIndex = localIndexArray.reduce((map: any, obj: any) => { - map[obj.id] = obj; - return map; -}, {}) as Record; - -let usedDefinitions: any[] = []; - -const out = rootElements.map((rootElement) => { - const root: any = localIndexArray.find((entry: any) => entry.name == rootElement); - const impls = root.inner.struct.impls; - - const elements = impls - .flatMap((e: any) => localIndex[e]) - .flatMap((e: any) => e.inner.impl.items) - .map((e: any) => localIndex[e]) - .filter((e: any) => e?.docs != null); - - return { - name: rootElement, - elements: elements.map((e: any) => { - return { - name: e.name, - docs: e.docs, - args: e.inner.function.decl.inputs.map((e: any) => map_input(e)), - output: map_type(e.inner.function.decl.output), - }; - }), - }; -}); - -function stripDef(str: string) { - return str.replace(/#\/definitions\//g, ""); -} - -Handlebars.registerHelper("stripDef", (str: string) => { - return stripDef(str); -}); - -// Add references -for (let i = 0; i < usedDefinitions.length; i++) { - const key = usedDefinitions[i]; - const cmd = command.definitions[key]; - if (cmd == null) { - continue; - } - - Object.entries(cmd.properties ?? {}).forEach((prop: any) => { - prop[1].allOf?.forEach((e: any) => { - usedDefinitions.push(stripDef(e["$ref"] as string)); - }); - }); -} - -const filteredDefinitions = [...new Set(usedDefinitions)] - .sort() - .map((key) => [key, command.definitions[key]]) - .filter((e) => e[1] != null) - .reduce((obj, cur) => ({ ...obj, [cur[0]]: cur[1] }), {}); - -console.log(template({ sections: out, commands: filteredDefinitions })); - -/// -/// Implementation details below. -/// - -// Format -function map_input(input: Input) { - return { - name: input[0], - type: map_type(input[1]), - }; -} - -function map_type(t: InputType) { - const args = t.resolved_path?.args; - const name = t.resolved_path?.name; - - let out = ""; - - if (name) { - usedDefinitions.push(name); - - if (command.definitions[name] != null) { - out += `[${name}](#${name.toLowerCase()})`; - } else { - out += name; - } - } - - if (args != null && args.angle_bracketed.args.length > 0) { - out += "<"; - out += args.angle_bracketed.args.map((t: any) => { - if (t.type.generic) { - return t.type.generic; - } else if (t.type.resolved_path) { - return t.type.resolved_path.name; - } - }); - out += ">"; - } - return out; -} diff --git a/support/docs/rustdoc.ts b/support/docs/rustdoc.ts deleted file mode 100644 index 2622b711..00000000 --- a/support/docs/rustdoc.ts +++ /dev/null @@ -1,12 +0,0 @@ -export type Input = [string, InputType]; - -export type InputType = { - resolved_path?: { - name: string; - args: { - angle_bracketed: { - args: any[]; - }; - }; - }; -}; diff --git a/support/docs/template.hbs b/support/docs/template.hbs deleted file mode 100644 index bd78d138..00000000 --- a/support/docs/template.hbs +++ /dev/null @@ -1,91 +0,0 @@ -# Bitwarden Mobile SDK - -Auto generated documentation for the Bitwarden Mobile SDK. For more information please refer to -the rust crates `bitwarden` and `bitwarden-uniffi`. For code samples check the -`languages/kotlin/app` and `languages/swift/app` directories. - -{{#each sections}} - -## {{name}} - -{{#each elements}} -### `{{name}}` -{{docs}} - -**Arguments**: -{{#each args}} -- {{name}}: {{{type}}} -{{/each}} - -**Output**: {{{output}}} - -{{/each}} -{{/each}} - -# References - -References are generated from the JSON schemas and should mostly match the kotlin and swift -implementations. - -{{#each commands}} - -## `{{@key}}` - -{{#if oneOf}} - - - Key - Type - Description - -{{#each oneOf}} -{{#each properties}} - - {{@key}} - {{type}} - - -{{#if properties}} - - - - - Key - Type - Description - - {{#each properties}} - - {{@key}} - {{type}} - {{{description}}} - - {{/each}} - - - -{{/if}} -{{/each}} -{{/each}} - - -{{/if}} - -{{#unless oneOf}} - - - Key - Type - Description - -{{#each properties}} - - {{@key}} - {{type}} - {{description}} - -{{/each}} - -{{/unless}} - -{{/each}} From 0ae6d73e6b066bac69dd3769e643137a2bec119c Mon Sep 17 00:00:00 2001 From: Andreas Coroiu Date: Thu, 10 Oct 2024 17:00:06 +0200 Subject: [PATCH 05/39] fix: .editorconfig not being applied properly (#1127) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## đī¸ Tracking ## đ Objective `[*.{ts}]` -> `[*.ts]` ## â° Reminders before review - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable - Protected functional changes with optionality (feature flags) - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team ## đĻŽ Reviewer guidelines - đ (`:+1:`) or similar for great changes - đ (`:memo:`) or âšī¸ (`:information_source:`) for notes or general info - â (`:question:`) for questions - đ¤ (`:thinking:`) or đ (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion - đ¨ (`:art:`) for suggestions / improvements - â (`:x:`) or â ī¸ (`:warning:`) for more significant problems or concerns needing attention - đą (`:seedling:`) or âģī¸ (`:recycle:`) for future improvements or indications of technical debt - â (`:pick:`) for minor or nitpick changes --- .editorconfig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.editorconfig b/.editorconfig index 28ef180e..33fa272b 100644 --- a/.editorconfig +++ b/.editorconfig @@ -12,10 +12,10 @@ insert_final_newline = true indent_style = space indent_size = 2 -[*.{ts}] -quote_type = single +[*.ts] +quote_type = double -[*.{rs}] +[*.rs] indent_style = space indent_size = 4 @@ -23,6 +23,6 @@ indent_size = 4 indent_style = space indent_size = 4 -[*.{xml}] +[*.xml] # VS Code XML extension removes the final newline insert_final_newline = false From 7e90f52cfd9fe3741816962cb3555cac40627ad4 Mon Sep 17 00:00:00 2001 From: Oscar Hinton Date: Fri, 11 Oct 2024 13:09:52 +0200 Subject: [PATCH 06/39] [PM-13371] Repository split - Avoid depdending on Bitwarden (#1124) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## đī¸ Tracking Epic: https://bitwarden.atlassian.net/browse/PM-13370 Phase: https://bitwarden.atlassian.net/browse/PM-13371 ## đ Objective Decouples our internal crates from depending on the public `bitwarden` crate. `uniffi`, `wasm-internal` and `bw` now depends directly on feature crates. --- .github/workflows/build-rust-crates.yml | 6 -- Cargo.lock | 12 +--- crates/bitwarden-json/Cargo.toml | 3 +- crates/bitwarden-json/src/client.rs | 14 ---- crates/bitwarden-json/src/command.rs | 46 ------------- crates/bitwarden-uniffi/Cargo.toml | 4 +- crates/bitwarden-uniffi/src/auth/mod.rs | 2 +- crates/bitwarden-uniffi/src/crypto.rs | 2 +- crates/bitwarden-uniffi/src/error.rs | 52 +++++++++++++-- crates/bitwarden-uniffi/src/lib.rs | 10 +-- crates/bitwarden-uniffi/src/platform/fido2.rs | 41 ++++++------ crates/bitwarden-uniffi/src/platform/mod.rs | 2 +- crates/bitwarden-uniffi/src/tool/mod.rs | 18 ++--- crates/bitwarden-uniffi/src/tool/sends.rs | 2 +- crates/bitwarden-uniffi/src/uniffi_support.rs | 8 ++- .../bitwarden-uniffi/src/vault/attachments.rs | 2 +- crates/bitwarden-uniffi/src/vault/ciphers.rs | 8 +-- .../bitwarden-uniffi/src/vault/collections.rs | 2 +- crates/bitwarden-uniffi/src/vault/folders.rs | 2 +- crates/bitwarden-uniffi/src/vault/mod.rs | 11 ++-- .../src/vault/password_history.rs | 2 +- crates/bitwarden-wasm-internal/Cargo.toml | 2 +- crates/bitwarden-wasm/Cargo.toml | 5 +- crates/bitwarden/Cargo.toml | 23 ------- crates/bitwarden/src/error.rs | 66 +------------------ crates/bitwarden/src/lib.rs | 29 +------- crates/bw/Cargo.toml | 4 +- crates/bw/src/auth/login.rs | 6 +- crates/bw/src/main.rs | 15 ++--- crates/sdk-schemas/Cargo.toml | 1 - crates/sdk-schemas/src/main.rs | 7 -- support/scripts/schemas.ts | 12 ---- 32 files changed, 124 insertions(+), 295 deletions(-) diff --git a/.github/workflows/build-rust-crates.yml b/.github/workflows/build-rust-crates.yml index d4116bcf..8400fcbf 100644 --- a/.github/workflows/build-rust-crates.yml +++ b/.github/workflows/build-rust-crates.yml @@ -49,12 +49,6 @@ jobs: env: RUSTFLAGS: "-D warnings" - - name: Build Internal - if: ${{ matrix.package == 'bitwarden' }} - run: cargo build -p ${{ matrix.package }} --features internal --release - env: - RUSTFLAGS: "-D warnings" - release-dry-run: name: Release dry-run runs-on: ubuntu-latest diff --git a/Cargo.lock b/Cargo.lock index 5397271c..024abbe0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -362,16 +362,9 @@ checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" name = "bitwarden" version = "1.0.0" dependencies = [ - "bitwarden-api-api", - "bitwarden-api-identity", "bitwarden-core", - "bitwarden-crypto", - "bitwarden-exporters", - "bitwarden-fido", "bitwarden-generators", - "bitwarden-send", "bitwarden-sm", - "bitwarden-vault", "thiserror", "uuid", ] @@ -623,7 +616,6 @@ version = "0.1.0" dependencies = [ "android_logger", "async-trait", - "bitwarden", "bitwarden-core", "bitwarden-crypto", "bitwarden-exporters", @@ -746,9 +738,11 @@ checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" name = "bw" version = "0.0.2" dependencies = [ - "bitwarden", "bitwarden-cli", + "bitwarden-core", "bitwarden-crypto", + "bitwarden-generators", + "bitwarden-vault", "clap", "color-eyre", "env_logger", diff --git a/crates/bitwarden-json/Cargo.toml b/crates/bitwarden-json/Cargo.toml index ed1b3958..b5b8052b 100644 --- a/crates/bitwarden-json/Cargo.toml +++ b/crates/bitwarden-json/Cargo.toml @@ -16,8 +16,7 @@ repository.workspace = true license-file.workspace = true [features] -internal = ["bitwarden/internal"] # Internal testing methods -secrets = ["bitwarden/secrets"] # Secrets manager API +secrets = ["bitwarden/secrets"] # Secrets manager API [dependencies] bitwarden = { workspace = true } diff --git a/crates/bitwarden-json/src/client.rs b/crates/bitwarden-json/src/client.rs index dc84c559..8da635a2 100644 --- a/crates/bitwarden-json/src/client.rs +++ b/crates/bitwarden-json/src/client.rs @@ -1,5 +1,3 @@ -#[cfg(feature = "internal")] -use bitwarden::vault::ClientVaultExt; use bitwarden::ClientSettings; #[cfg(feature = "secrets")] use bitwarden::{ @@ -54,22 +52,10 @@ impl Client { let client = &self.0; match cmd { - #[cfg(feature = "internal")] - Command::PasswordLogin(req) => client.auth().login_password(&req).await.into_string(), #[cfg(feature = "secrets")] Command::LoginAccessToken(req) => { client.auth().login_access_token(&req).await.into_string() } - #[cfg(feature = "internal")] - Command::GetUserApiKey(req) => { - client.platform().get_user_api_key(req).await.into_string() - } - #[cfg(feature = "internal")] - Command::ApiKeyLogin(req) => client.auth().login_api_key(&req).await.into_string(), - #[cfg(feature = "internal")] - Command::Sync(req) => client.vault().sync(&req).await.into_string(), - #[cfg(feature = "internal")] - Command::Fingerprint(req) => client.platform().fingerprint(&req).into_string(), #[cfg(feature = "secrets")] Command::Secrets(cmd) => match cmd { diff --git a/crates/bitwarden-json/src/command.rs b/crates/bitwarden-json/src/command.rs index 7483b90c..faaa8177 100644 --- a/crates/bitwarden-json/src/command.rs +++ b/crates/bitwarden-json/src/command.rs @@ -13,38 +13,12 @@ use bitwarden::{ }, }, }; -#[cfg(feature = "internal")] -use bitwarden::{ - auth::login::{ApiKeyLoginRequest, PasswordLoginRequest}, - platform::{FingerprintRequest, SecretVerificationRequest}, - vault::SyncRequest, -}; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, JsonSchema, Debug)] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub enum Command { - #[cfg(feature = "internal")] - /// Login with username and password - /// - /// This command is for initiating an authentication handshake with Bitwarden. - /// Authorization may fail due to requiring 2fa or captcha challenge completion - /// despite accurate credentials. - /// - /// This command is not capable of handling authentication requiring 2fa or captcha. - /// - /// Returns: [PasswordLoginResponse](bitwarden::auth::login::PasswordLoginResponse) - PasswordLogin(PasswordLoginRequest), - - #[cfg(feature = "internal")] - /// Login with API Key - /// - /// This command is for initiating an authentication handshake with Bitwarden. - /// - /// Returns: [ApiKeyLoginResponse](bitwarden::auth::login::ApiKeyLoginResponse) - ApiKeyLogin(ApiKeyLoginRequest), - #[cfg(feature = "secrets")] /// Login with Secrets Manager Access Token /// @@ -53,26 +27,6 @@ pub enum Command { /// Returns: [ApiKeyLoginResponse](bitwarden::auth::login::ApiKeyLoginResponse) LoginAccessToken(AccessTokenLoginRequest), - #[cfg(feature = "internal")] - /// > Requires Authentication - /// Get the API key of the currently authenticated user - /// - /// Returns: [UserApiKeyResponse](bitwarden::platform::UserApiKeyResponse) - GetUserApiKey(SecretVerificationRequest), - - #[cfg(feature = "internal")] - /// Get the user's passphrase - /// - /// Returns: String - Fingerprint(FingerprintRequest), - - #[cfg(feature = "internal")] - /// > Requires Authentication - /// Retrieve all user data, ciphers and organizations the user is a part of - /// - /// Returns: [SyncResponse](bitwarden::vault::SyncResponse) - Sync(SyncRequest), - #[cfg(feature = "secrets")] Secrets(SecretsCommand), #[cfg(feature = "secrets")] diff --git a/crates/bitwarden-uniffi/Cargo.toml b/crates/bitwarden-uniffi/Cargo.toml index 822ed0d3..2e57e23b 100644 --- a/crates/bitwarden-uniffi/Cargo.toml +++ b/crates/bitwarden-uniffi/Cargo.toml @@ -11,7 +11,6 @@ repository.workspace = true license-file.workspace = true [features] -docs = ["dep:schemars"] # Docs [lib] crate-type = ["lib", "staticlib", "cdylib"] @@ -19,7 +18,6 @@ bench = false [dependencies] async-trait = "0.1.80" -bitwarden = { workspace = true, features = ["internal", "uniffi"] } bitwarden-core = { workspace = true, features = ["uniffi"] } bitwarden-crypto = { workspace = true, features = ["uniffi"] } bitwarden-exporters = { workspace = true, features = ["uniffi"] } @@ -28,8 +26,8 @@ bitwarden-generators = { workspace = true, features = ["uniffi"] } bitwarden-send = { workspace = true, features = ["uniffi"] } bitwarden-vault = { workspace = true, features = ["uniffi"] } chrono = { workspace = true, features = ["std"] } -log = { workspace = true } env_logger = "0.11.1" +log = { workspace = true } schemars = { workspace = true, optional = true } thiserror = { workspace = true } uniffi = { workspace = true } diff --git a/crates/bitwarden-uniffi/src/auth/mod.rs b/crates/bitwarden-uniffi/src/auth/mod.rs index d036991e..43496080 100644 --- a/crates/bitwarden-uniffi/src/auth/mod.rs +++ b/crates/bitwarden-uniffi/src/auth/mod.rs @@ -1,6 +1,6 @@ use std::sync::Arc; -use bitwarden::{ +use bitwarden_core::{ auth::{ password::MasterPasswordPolicyOptions, AuthRequestResponse, KeyConnectorResponse, RegisterKeyResponse, RegisterTdeKeyResponse, diff --git a/crates/bitwarden-uniffi/src/crypto.rs b/crates/bitwarden-uniffi/src/crypto.rs index 608698fc..6404d62f 100644 --- a/crates/bitwarden-uniffi/src/crypto.rs +++ b/crates/bitwarden-uniffi/src/crypto.rs @@ -1,6 +1,6 @@ use std::sync::Arc; -use bitwarden::{ +use bitwarden_core::{ mobile::crypto::{ DeriveKeyConnectorRequest, DerivePinKeyResponse, InitOrgCryptoRequest, InitUserCryptoRequest, UpdatePasswordResponse, diff --git a/crates/bitwarden-uniffi/src/error.rs b/crates/bitwarden-uniffi/src/error.rs index 5a1dfe43..889e3c7f 100644 --- a/crates/bitwarden-uniffi/src/error.rs +++ b/crates/bitwarden-uniffi/src/error.rs @@ -1,21 +1,24 @@ use std::fmt::{Display, Formatter}; +use bitwarden_exporters::ExportError; +use bitwarden_generators::{PassphraseError, PasswordError, UsernameError}; + // Name is converted from *Error to *Exception, so we can't just name the enum Error because // Exception already exists #[derive(uniffi::Error, Debug)] #[uniffi(flat_error)] pub enum BitwardenError { - E(bitwarden::error::Error), + E(Error), } -impl From for BitwardenError { - fn from(e: bitwarden::Error) -> Self { +impl From for BitwardenError { + fn from(e: bitwarden_core::Error) -> Self { Self::E(e.into()) } } -impl From for BitwardenError { - fn from(e: bitwarden::error::Error) -> Self { +impl From for BitwardenError { + fn from(e: Error) -> Self { Self::E(e) } } @@ -37,3 +40,42 @@ impl std::error::Error for BitwardenError { } pub type Result = std::result::Result; + +#[derive(thiserror::Error, Debug)] +pub enum Error { + #[error(transparent)] + Core(#[from] bitwarden_core::Error), + + // Generators + #[error(transparent)] + UsernameError(#[from] UsernameError), + #[error(transparent)] + PassphraseError(#[from] PassphraseError), + #[error(transparent)] + PasswordError(#[from] PasswordError), + + // Vault + #[error(transparent)] + Cipher(#[from] bitwarden_vault::CipherError), + #[error(transparent)] + Totp(#[from] bitwarden_vault::TotpError), + + #[error(transparent)] + ExportError(#[from] ExportError), + + // Fido + #[error(transparent)] + MakeCredential(#[from] bitwarden_fido::MakeCredentialError), + #[error(transparent)] + GetAssertion(#[from] bitwarden_fido::GetAssertionError), + #[error(transparent)] + SilentlyDiscoverCredentials(#[from] bitwarden_fido::SilentlyDiscoverCredentialsError), + #[error(transparent)] + CredentialsForAutofillError(#[from] bitwarden_fido::CredentialsForAutofillError), + #[error(transparent)] + DecryptFido2AutofillCredentialsError( + #[from] bitwarden_fido::DecryptFido2AutofillCredentialsError, + ), + #[error(transparent)] + Fido2Client(#[from] bitwarden_fido::Fido2ClientError), +} diff --git a/crates/bitwarden-uniffi/src/lib.rs b/crates/bitwarden-uniffi/src/lib.rs index a9eb6a3e..aae35c37 100644 --- a/crates/bitwarden-uniffi/src/lib.rs +++ b/crates/bitwarden-uniffi/src/lib.rs @@ -3,7 +3,7 @@ uniffi::setup_scaffolding!(); use std::sync::Arc; use auth::ClientAuth; -use bitwarden::ClientSettings; +use bitwarden_core::ClientSettings; pub mod auth; pub mod crypto; @@ -23,7 +23,7 @@ use tool::{ClientExporters, ClientGenerators, ClientSends}; use vault::ClientVault; #[derive(uniffi::Object)] -pub struct Client(bitwarden::Client); +pub struct Client(bitwarden_core::Client); #[uniffi::export(async_runtime = "tokio")] impl Client { @@ -35,7 +35,7 @@ impl Client { #[cfg(target_os = "android")] android_support::init(); - Arc::new(Self(bitwarden::Client::new(settings))) + Arc::new(Self(bitwarden_core::Client::new(settings))) } /// Crypto operations @@ -84,9 +84,9 @@ impl Client { .get(&url) .send() .await - .map_err(bitwarden::Error::Reqwest)?; + .map_err(bitwarden_core::Error::Reqwest)?; - Ok(res.text().await.map_err(bitwarden::Error::Reqwest)?) + Ok(res.text().await.map_err(bitwarden_core::Error::Reqwest)?) } } diff --git a/crates/bitwarden-uniffi/src/platform/fido2.rs b/crates/bitwarden-uniffi/src/platform/fido2.rs index f483ff34..99c99864 100644 --- a/crates/bitwarden-uniffi/src/platform/fido2.rs +++ b/crates/bitwarden-uniffi/src/platform/fido2.rs @@ -1,19 +1,18 @@ use std::sync::Arc; -use bitwarden::{ - error::Error, - fido::{ - CheckUserOptions, ClientData, ClientFido2Ext, Fido2CallbackError as BitFido2CallbackError, - GetAssertionRequest, GetAssertionResult, MakeCredentialRequest, MakeCredentialResult, - PublicKeyCredentialAuthenticatorAssertionResponse, - PublicKeyCredentialAuthenticatorAttestationResponse, PublicKeyCredentialRpEntity, - PublicKeyCredentialUserEntity, - }, - vault::{Cipher, CipherView, Fido2CredentialNewView}, +use bitwarden_fido::{ + CheckUserOptions, ClientData, ClientFido2Ext, Fido2CallbackError as BitFido2CallbackError, + Fido2CredentialAutofillView, GetAssertionRequest, GetAssertionResult, MakeCredentialRequest, + MakeCredentialResult, Origin, PublicKeyCredentialAuthenticatorAssertionResponse, + PublicKeyCredentialAuthenticatorAttestationResponse, PublicKeyCredentialRpEntity, + PublicKeyCredentialUserEntity, }; -use bitwarden_fido::{Fido2CredentialAutofillView, Origin}; +use bitwarden_vault::{Cipher, CipherView, Fido2CredentialNewView}; -use crate::{error::Result, Client}; +use crate::{ + error::{Error, Result}, + Client, +}; #[derive(uniffi::Object)] pub struct ClientFido2(pub(crate) Arc); @@ -180,7 +179,7 @@ pub struct CheckUserResult { user_verified: bool, } -impl From for bitwarden::fido::CheckUserResult { +impl From for bitwarden_fido::CheckUserResult { fn from(val: CheckUserResult) -> Self { Self { user_present: val.user_present, @@ -268,7 +267,7 @@ pub trait Fido2CredentialStore: Send + Sync { struct UniffiTraitBridge(T); #[async_trait::async_trait] -impl bitwarden::fido::Fido2CredentialStore for UniffiTraitBridge<&dyn Fido2CredentialStore> { +impl bitwarden_fido::Fido2CredentialStore for UniffiTraitBridge<&dyn Fido2CredentialStore> { async fn find_credentials( &self, ids: Option>>, @@ -306,9 +305,9 @@ pub enum UIHint { RequestExistingCredential(CipherView), } -impl From> for UIHint { - fn from(hint: bitwarden::fido::UIHint<'_, CipherView>) -> Self { - use bitwarden::fido::UIHint as BWUIHint; +impl From> for UIHint { + fn from(hint: bitwarden_fido::UIHint<'_, CipherView>) -> Self { + use bitwarden_fido::UIHint as BWUIHint; match hint { BWUIHint::InformExcludedCredentialFound(cipher) => { UIHint::InformExcludedCredentialFound(cipher.clone()) @@ -333,12 +332,12 @@ impl From> for UIHint { } #[async_trait::async_trait] -impl bitwarden::fido::Fido2UserInterface for UniffiTraitBridge<&dyn Fido2UserInterface> { +impl bitwarden_fido::Fido2UserInterface for UniffiTraitBridge<&dyn Fido2UserInterface> { async fn check_user<'a>( &self, options: CheckUserOptions, - hint: bitwarden::fido::UIHint<'a, CipherView>, - ) -> Result { + hint: bitwarden_fido::UIHint<'a, CipherView>, + ) -> Result { self.0 .check_user(options.clone(), hint.into()) .await @@ -359,7 +358,7 @@ impl bitwarden::fido::Fido2UserInterface for UniffiTraitBridge<&dyn Fido2UserInt &self, options: CheckUserOptions, new_credential: Fido2CredentialNewView, - ) -> Result<(CipherView, bitwarden::fido::CheckUserResult), BitFido2CallbackError> { + ) -> Result<(CipherView, bitwarden_fido::CheckUserResult), BitFido2CallbackError> { self.0 .check_user_and_pick_credential_for_creation(options, new_credential) .await diff --git a/crates/bitwarden-uniffi/src/platform/mod.rs b/crates/bitwarden-uniffi/src/platform/mod.rs index 63ff6e18..b5d94415 100644 --- a/crates/bitwarden-uniffi/src/platform/mod.rs +++ b/crates/bitwarden-uniffi/src/platform/mod.rs @@ -1,6 +1,6 @@ use std::sync::Arc; -use bitwarden::platform::FingerprintRequest; +use bitwarden_core::platform::FingerprintRequest; use crate::{error::Result, Client}; diff --git a/crates/bitwarden-uniffi/src/tool/mod.rs b/crates/bitwarden-uniffi/src/tool/mod.rs index 1fd439a4..49888421 100644 --- a/crates/bitwarden-uniffi/src/tool/mod.rs +++ b/crates/bitwarden-uniffi/src/tool/mod.rs @@ -1,16 +1,16 @@ use std::sync::Arc; -use bitwarden::{ - error::Error, - exporters::{ClientExportersExt, ExportFormat}, - generators::{ - ClientGeneratorExt, PassphraseGeneratorRequest, PasswordGeneratorRequest, - UsernameGeneratorRequest, - }, - vault::{Cipher, Collection, Folder}, +use bitwarden_exporters::{ClientExportersExt, ExportFormat}; +use bitwarden_generators::{ + ClientGeneratorExt, PassphraseGeneratorRequest, PasswordGeneratorRequest, + UsernameGeneratorRequest, }; +use bitwarden_vault::{Cipher, Collection, Folder}; -use crate::{error::Result, Client}; +use crate::{ + error::{Error, Result}, + Client, +}; mod sends; pub use sends::ClientSends; diff --git a/crates/bitwarden-uniffi/src/tool/sends.rs b/crates/bitwarden-uniffi/src/tool/sends.rs index 1d5a056a..18732f57 100644 --- a/crates/bitwarden-uniffi/src/tool/sends.rs +++ b/crates/bitwarden-uniffi/src/tool/sends.rs @@ -1,6 +1,6 @@ use std::{path::Path, sync::Arc}; -use bitwarden::send::{ClientSendsExt, Send, SendListView, SendView}; +use bitwarden_send::{ClientSendsExt, Send, SendListView, SendView}; use crate::{Client, Result}; diff --git a/crates/bitwarden-uniffi/src/uniffi_support.rs b/crates/bitwarden-uniffi/src/uniffi_support.rs index 74f48486..282b0346 100644 --- a/crates/bitwarden-uniffi/src/uniffi_support.rs +++ b/crates/bitwarden-uniffi/src/uniffi_support.rs @@ -4,6 +4,10 @@ use uuid::Uuid; // Forward the type definitions to the main bitwarden crate type DateTime = chrono::DateTime; uniffi::ffi_converter_forward!(DateTime, bitwarden_core::UniFfiTag, crate::UniFfiTag); -uniffi::ffi_converter_forward!(EncString, bitwarden::UniFfiTag, crate::UniFfiTag); -uniffi::ffi_converter_forward!(AsymmetricEncString, bitwarden::UniFfiTag, crate::UniFfiTag); +uniffi::ffi_converter_forward!(EncString, bitwarden_core::UniFfiTag, crate::UniFfiTag); +uniffi::ffi_converter_forward!( + AsymmetricEncString, + bitwarden_core::UniFfiTag, + crate::UniFfiTag +); uniffi::ffi_converter_forward!(Uuid, bitwarden_core::UniFfiTag, crate::UniFfiTag); diff --git a/crates/bitwarden-uniffi/src/vault/attachments.rs b/crates/bitwarden-uniffi/src/vault/attachments.rs index e8bddd12..cb2a011a 100644 --- a/crates/bitwarden-uniffi/src/vault/attachments.rs +++ b/crates/bitwarden-uniffi/src/vault/attachments.rs @@ -1,6 +1,6 @@ use std::{path::Path, sync::Arc}; -use bitwarden::vault::{ +use bitwarden_vault::{ Attachment, AttachmentEncryptResult, AttachmentView, Cipher, ClientVaultExt, }; diff --git a/crates/bitwarden-uniffi/src/vault/ciphers.rs b/crates/bitwarden-uniffi/src/vault/ciphers.rs index 1195cf81..64751b37 100644 --- a/crates/bitwarden-uniffi/src/vault/ciphers.rs +++ b/crates/bitwarden-uniffi/src/vault/ciphers.rs @@ -1,13 +1,9 @@ use std::sync::Arc; -use bitwarden::{ - error::Error, - vault::{Cipher, CipherListView, CipherView, ClientVaultExt}, -}; -use bitwarden_vault::Fido2CredentialView; +use bitwarden_vault::{Cipher, CipherListView, CipherView, ClientVaultExt, Fido2CredentialView}; use uuid::Uuid; -use crate::{Client, Result}; +use crate::{error::Error, Client, Result}; #[derive(uniffi::Object)] pub struct ClientCiphers(pub Arc); diff --git a/crates/bitwarden-uniffi/src/vault/collections.rs b/crates/bitwarden-uniffi/src/vault/collections.rs index 84d928e6..250588e8 100644 --- a/crates/bitwarden-uniffi/src/vault/collections.rs +++ b/crates/bitwarden-uniffi/src/vault/collections.rs @@ -1,6 +1,6 @@ use std::sync::Arc; -use bitwarden::vault::{ClientVaultExt, Collection, CollectionView}; +use bitwarden_vault::{ClientVaultExt, Collection, CollectionView}; use crate::{Client, Result}; diff --git a/crates/bitwarden-uniffi/src/vault/folders.rs b/crates/bitwarden-uniffi/src/vault/folders.rs index 2efeb1f1..758d0917 100644 --- a/crates/bitwarden-uniffi/src/vault/folders.rs +++ b/crates/bitwarden-uniffi/src/vault/folders.rs @@ -1,6 +1,6 @@ use std::sync::Arc; -use bitwarden::vault::{ClientVaultExt, Folder, FolderView}; +use bitwarden_vault::{ClientVaultExt, Folder, FolderView}; use crate::{Client, Result}; diff --git a/crates/bitwarden-uniffi/src/vault/mod.rs b/crates/bitwarden-uniffi/src/vault/mod.rs index 4cf84086..cec625e3 100644 --- a/crates/bitwarden-uniffi/src/vault/mod.rs +++ b/crates/bitwarden-uniffi/src/vault/mod.rs @@ -1,13 +1,12 @@ use std::sync::Arc; -use bitwarden::{ - error::Error, - vault::{ClientVaultExt, TotpResponse}, -}; -use bitwarden_vault::CipherListView; +use bitwarden_vault::{CipherListView, ClientVaultExt, TotpResponse}; use chrono::{DateTime, Utc}; -use crate::{error::Result, Client}; +use crate::{ + error::{Error, Result}, + Client, +}; pub mod attachments; pub mod ciphers; diff --git a/crates/bitwarden-uniffi/src/vault/password_history.rs b/crates/bitwarden-uniffi/src/vault/password_history.rs index 3fa0fd3b..330e9121 100644 --- a/crates/bitwarden-uniffi/src/vault/password_history.rs +++ b/crates/bitwarden-uniffi/src/vault/password_history.rs @@ -1,6 +1,6 @@ use std::sync::Arc; -use bitwarden::vault::{ClientVaultExt, PasswordHistory, PasswordHistoryView}; +use bitwarden_vault::{ClientVaultExt, PasswordHistory, PasswordHistoryView}; use crate::{Client, Result}; diff --git a/crates/bitwarden-wasm-internal/Cargo.toml b/crates/bitwarden-wasm-internal/Cargo.toml index df69015c..4f68c08d 100644 --- a/crates/bitwarden-wasm-internal/Cargo.toml +++ b/crates/bitwarden-wasm-internal/Cargo.toml @@ -15,7 +15,7 @@ keywords.workspace = true crate-type = ["cdylib"] [dependencies] -bitwarden = { workspace = true, features = ["internal", "wasm"] } +bitwarden = { workspace = true, features = ["wasm"] } console_error_panic_hook = "0.1.7" console_log = { version = "1.0.0", features = ["color"] } js-sys = "0.3.68" diff --git a/crates/bitwarden-wasm/Cargo.toml b/crates/bitwarden-wasm/Cargo.toml index c4be614d..fd3c278f 100644 --- a/crates/bitwarden-wasm/Cargo.toml +++ b/crates/bitwarden-wasm/Cargo.toml @@ -19,10 +19,7 @@ argon2 = { version = ">=0.5.0, <0.6", features = [ "alloc", "zeroize", ], default-features = false } -bitwarden-json = { path = "../bitwarden-json", features = [ - "secrets", - "internal", -] } +bitwarden-json = { path = "../bitwarden-json", features = ["secrets"] } console_error_panic_hook = "0.1.7" console_log = { version = "1.0.0", features = ["color"] } js-sys = "0.3.68" diff --git a/crates/bitwarden/Cargo.toml b/crates/bitwarden/Cargo.toml index 1d09377c..3626f9d1 100644 --- a/crates/bitwarden/Cargo.toml +++ b/crates/bitwarden/Cargo.toml @@ -16,25 +16,9 @@ license-file.workspace = true [features] default = ["secrets"] -internal = [ - "bitwarden-core/internal", - "dep:bitwarden-exporters", - "dep:bitwarden-generators", - "dep:bitwarden-send", - "dep:bitwarden-vault", -] # Internal testing methods no-memory-hardening = [ "bitwarden-core/no-memory-hardening", ] # Disable memory hardening features -uniffi = [ - "bitwarden-core/uniffi", - "bitwarden-crypto/uniffi", - "bitwarden-exporters/uniffi", - "bitwarden-fido/uniffi", - "bitwarden-generators/uniffi", - "bitwarden-send/uniffi", - "bitwarden-vault/uniffi", -] # Uniffi bindings secrets = [ "bitwarden-core/secrets", "dep:bitwarden-sm", @@ -43,16 +27,9 @@ secrets = [ wasm = ["bitwarden-core/wasm"] # WASM support [dependencies] -bitwarden-api-api = { workspace = true } -bitwarden-api-identity = { workspace = true } bitwarden-core = { workspace = true } -bitwarden-crypto = { workspace = true } -bitwarden-exporters = { workspace = true, optional = true } -bitwarden-fido = { workspace = true, optional = true } bitwarden-generators = { workspace = true, optional = true } -bitwarden-send = { workspace = true, optional = true } bitwarden-sm = { workspace = true, optional = true } -bitwarden-vault = { workspace = true, optional = true } thiserror = { workspace = true } [dev-dependencies] diff --git a/crates/bitwarden/src/error.rs b/crates/bitwarden/src/error.rs index 06ef0964..163ccc20 100644 --- a/crates/bitwarden/src/error.rs +++ b/crates/bitwarden/src/error.rs @@ -1,77 +1,13 @@ //! Errors that can occur when using this SDK -use std::{borrow::Cow, fmt::Debug}; +use std::fmt::Debug; -#[cfg(feature = "internal")] -use bitwarden_exporters::ExportError; -#[cfg(feature = "internal")] -use bitwarden_generators::{PassphraseError, PasswordError, UsernameError}; use thiserror::Error; #[derive(Debug, Error)] pub enum Error { #[error(transparent)] Core(#[from] bitwarden_core::Error), - - // Generators - #[cfg(feature = "internal")] - #[error(transparent)] - UsernameError(#[from] UsernameError), - #[cfg(feature = "internal")] - #[error(transparent)] - PassphraseError(#[from] PassphraseError), - #[cfg(feature = "internal")] - #[error(transparent)] - PasswordError(#[from] PasswordError), - - // Vault - #[cfg(feature = "internal")] - #[error(transparent)] - Cipher(#[from] bitwarden_vault::CipherError), - #[cfg(feature = "internal")] - #[error(transparent)] - Totp(#[from] bitwarden_vault::TotpError), - - #[cfg(feature = "internal")] - #[error(transparent)] - ExportError(#[from] ExportError), - - // Fido - #[cfg(all(feature = "uniffi", feature = "internal"))] - #[error(transparent)] - MakeCredential(#[from] bitwarden_fido::MakeCredentialError), - #[cfg(all(feature = "uniffi", feature = "internal"))] - #[error(transparent)] - GetAssertion(#[from] bitwarden_fido::GetAssertionError), - #[cfg(all(feature = "uniffi", feature = "internal"))] - #[error(transparent)] - SilentlyDiscoverCredentials(#[from] bitwarden_fido::SilentlyDiscoverCredentialsError), - #[cfg(all(feature = "uniffi", feature = "internal"))] - #[error(transparent)] - CredentialsForAutofillError(#[from] bitwarden_fido::CredentialsForAutofillError), - #[cfg(all(feature = "uniffi", feature = "internal"))] - #[error(transparent)] - DecryptFido2AutofillCredentialsError( - #[from] bitwarden_fido::DecryptFido2AutofillCredentialsError, - ), - #[cfg(all(feature = "uniffi", feature = "internal"))] - #[error(transparent)] - Fido2Client(#[from] bitwarden_fido::Fido2ClientError), - - #[error("Internal error: {0}")] - Internal(Cow<'static, str>), -} - -impl From for Error { - fn from(s: String) -> Self { - Self::Internal(s.into()) - } -} - -impl From<&'static str> for Error { - fn from(s: &'static str) -> Self { - Self::Internal(s.into()) - } } // Ensure that the error messages implement Send and Sync diff --git a/crates/bitwarden/src/lib.rs b/crates/bitwarden/src/lib.rs index c87693ce..77a063f5 100644 --- a/crates/bitwarden/src/lib.rs +++ b/crates/bitwarden/src/lib.rs @@ -61,34 +61,7 @@ mod readme {} pub use bitwarden_core::*; pub mod error; -#[cfg(feature = "internal")] -pub mod internal { - pub mod generators { - pub use bitwarden_generators::*; - } - - pub mod exporters { - pub use bitwarden_exporters::*; - } - - pub mod send { - pub use bitwarden_send::*; - } - - pub mod vault { - pub use bitwarden_vault::*; - } - - #[cfg(feature = "uniffi")] - pub mod fido { - pub use bitwarden_fido::*; - } -} -#[cfg(feature = "internal")] -pub use internal::*; - -// Re-export generators used for secrets-manager, internal flag already exports all generators -#[cfg(all(feature = "secrets", not(feature = "internal")))] +#[cfg(feature = "secrets")] pub mod generators { pub use bitwarden_generators::{ClientGeneratorExt, PasswordError, PasswordGeneratorRequest}; } diff --git a/crates/bw/Cargo.toml b/crates/bw/Cargo.toml index cb8e02ba..a2ba807c 100644 --- a/crates/bw/Cargo.toml +++ b/crates/bw/Cargo.toml @@ -14,9 +14,11 @@ repository.workspace = true license-file.workspace = true [dependencies] -bitwarden = { workspace = true, features = ["internal"] } bitwarden-cli = { workspace = true } +bitwarden-core = { workspace = true } bitwarden-crypto = { workspace = true } +bitwarden-generators = { workspace = true } +bitwarden-vault = { workspace = true } clap = { version = "4.5.4", features = ["derive", "env"] } color-eyre = "0.6.3" env_logger = "0.11.1" diff --git a/crates/bw/src/auth/login.rs b/crates/bw/src/auth/login.rs index 51fe64a3..131d39f0 100644 --- a/crates/bw/src/auth/login.rs +++ b/crates/bw/src/auth/login.rs @@ -1,12 +1,12 @@ -use bitwarden::{ +use bitwarden_cli::text_prompt_when_none; +use bitwarden_core::{ auth::login::{ ApiKeyLoginRequest, PasswordLoginRequest, TwoFactorEmailRequest, TwoFactorProvider, TwoFactorRequest, }, - vault::{ClientVaultExt, SyncRequest}, Client, }; -use bitwarden_cli::text_prompt_when_none; +use bitwarden_vault::{ClientVaultExt, SyncRequest}; use color_eyre::eyre::{bail, Result}; use inquire::{Password, Text}; use log::{debug, error, info}; diff --git a/crates/bw/src/main.rs b/crates/bw/src/main.rs index a9a7eeea..06d5d0bd 100644 --- a/crates/bw/src/main.rs +++ b/crates/bw/src/main.rs @@ -1,9 +1,8 @@ -use bitwarden::{ - auth::RegisterRequest, - generators::{ClientGeneratorExt, PassphraseGeneratorRequest, PasswordGeneratorRequest}, - ClientSettings, -}; use bitwarden_cli::{install_color_eyre, text_prompt_when_none, Color}; +use bitwarden_core::{auth::RegisterRequest, ClientSettings}; +use bitwarden_generators::{ + ClientGeneratorExt, PassphraseGeneratorRequest, PasswordGeneratorRequest, +}; use clap::{command, Args, CommandFactory, Parser, Subcommand}; use color_eyre::eyre::Result; use inquire::Password; @@ -157,7 +156,7 @@ async fn process_commands() -> Result<()> { identity_url: format!("{}/identity", server), ..Default::default() }); - let client = bitwarden::Client::new(settings); + let client = bitwarden_core::Client::new(settings); match args.command { // FIXME: Rust CLI will not support password login! @@ -188,7 +187,7 @@ async fn process_commands() -> Result<()> { identity_url: format!("{}/identity", server), ..Default::default() }); - let client = bitwarden::Client::new(settings); + let client = bitwarden_core::Client::new(settings); let email = text_prompt_when_none("Email", email)?; let password = Password::new("Password").prompt()?; @@ -207,7 +206,7 @@ async fn process_commands() -> Result<()> { } // Not login, assuming we have a config - let client = bitwarden::Client::new(None); + let client = bitwarden_core::Client::new(None); // And finally we process all the commands which require authentication match command { diff --git a/crates/sdk-schemas/Cargo.toml b/crates/sdk-schemas/Cargo.toml index b4dd496a..13a66487 100644 --- a/crates/sdk-schemas/Cargo.toml +++ b/crates/sdk-schemas/Cargo.toml @@ -12,7 +12,6 @@ license-file.workspace = true keywords.workspace = true [features] -internal = ["bitwarden/internal", "bitwarden-json/internal"] [dependencies] anyhow = "1.0.82" diff --git a/crates/sdk-schemas/src/main.rs b/crates/sdk-schemas/src/main.rs index 66683256..2db3ce5f 100644 --- a/crates/sdk-schemas/src/main.rs +++ b/crates/sdk-schemas/src/main.rs @@ -109,13 +109,6 @@ struct SchemaTypes { projects: Response, projects_delete: Response, password: Response, - - #[cfg(feature = "internal")] - fingerprint: Response, - #[cfg(feature = "internal")] - sync: Response, - #[cfg(feature = "internal")] - user_api_key: Response, } fn main() -> Result<()> { diff --git a/support/scripts/schemas.ts b/support/scripts/schemas.ts index 3eaad190..873a9de7 100644 --- a/support/scripts/schemas.ts +++ b/support/scripts/schemas.ts @@ -7,18 +7,6 @@ import { } from "quicktype-core"; import fs from "fs"; -import path from "path"; - -async function* walk(dir: string): AsyncIterable { - for await (const d of await fs.promises.opendir(dir)) { - const entry = path.join(dir, d.name); - if (d.isDirectory()) { - yield* walk(entry); - } else if (d.isFile()) { - yield entry; - } - } -} async function main() { const schemaInput = new JSONSchemaInput(new FetchingJSONSchemaStore()); From 97116b1151a8942f640a264fa1c1c4a37512a482 Mon Sep 17 00:00:00 2001 From: Oscar Hinton Date: Fri, 11 Oct 2024 14:28:28 +0200 Subject: [PATCH 07/39] Pin WASM bindgen (#1129) Every time wasm-bindgen is updated we run into conflicts with the wasm-bindgen-cli version. Pin it to avoid this problem in the future. --- .github/workflows/build-wasm-internal.yml | 2 +- .github/workflows/build-wasm.yml | 2 +- Cargo.lock | 20 ++++++++++---------- crates/bitwarden-wasm-internal/Cargo.toml | 3 ++- crates/bitwarden-wasm/Cargo.toml | 3 ++- 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build-wasm-internal.yml b/.github/workflows/build-wasm-internal.yml index 99fe06c4..0be6b29c 100644 --- a/.github/workflows/build-wasm-internal.yml +++ b/.github/workflows/build-wasm-internal.yml @@ -46,7 +46,7 @@ jobs: key: wasm-cargo-cache - name: Install wasm-bindgen-cli - run: cargo install wasm-bindgen-cli + run: cargo install wasm-bindgen-cli --version 0.2.95 - name: Build run: ./build.sh -r diff --git a/.github/workflows/build-wasm.yml b/.github/workflows/build-wasm.yml index 35c0ca6b..117bbf2c 100644 --- a/.github/workflows/build-wasm.yml +++ b/.github/workflows/build-wasm.yml @@ -46,7 +46,7 @@ jobs: key: wasm-cargo-cache - name: Install wasm-bindgen-cli - run: cargo install wasm-bindgen-cli + run: cargo install wasm-bindgen-cli --version 0.2.95 - name: Build run: ./build.sh -r diff --git a/Cargo.lock b/Cargo.lock index 024abbe0..e6ca566f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4503,9 +4503,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.94" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef073ced962d62984fb38a36e5fdc1a2b23c9e0e1fa0689bb97afa4202ef6887" +checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" dependencies = [ "cfg-if", "once_cell", @@ -4516,9 +4516,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.94" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4bfab14ef75323f4eb75fa52ee0a3fb59611977fd3240da19b2cf36ff85030e" +checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" dependencies = [ "bumpalo", "log", @@ -4543,9 +4543,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.94" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7bec9830f60924d9ceb3ef99d55c155be8afa76954edffbb5936ff4509474e7" +checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4553,9 +4553,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.94" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c74f6e152a76a2ad448e223b0fc0b6b5747649c3d769cc6bf45737bf97d0ed6" +checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" dependencies = [ "proc-macro2", "quote", @@ -4566,9 +4566,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.94" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a42f6c679374623f295a8623adfe63d9284091245c3504bde47c17a3ce2777d9" +checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" [[package]] name = "wasm-bindgen-test" diff --git a/crates/bitwarden-wasm-internal/Cargo.toml b/crates/bitwarden-wasm-internal/Cargo.toml index 4f68c08d..b18e412c 100644 --- a/crates/bitwarden-wasm-internal/Cargo.toml +++ b/crates/bitwarden-wasm-internal/Cargo.toml @@ -21,7 +21,8 @@ console_log = { version = "1.0.0", features = ["color"] } js-sys = "0.3.68" log = "0.4.20" serde_json = ">=1.0.96, <2.0" -wasm-bindgen = { version = "0.2.91", features = ["serde-serialize"] } +# When upgrading wasm-bindgen, make sure to update the version in the workflows! +wasm-bindgen = { version = "=0.2.95", features = ["serde-serialize"] } wasm-bindgen-futures = "0.4.41" [lints] diff --git a/crates/bitwarden-wasm/Cargo.toml b/crates/bitwarden-wasm/Cargo.toml index fd3c278f..b57a0192 100644 --- a/crates/bitwarden-wasm/Cargo.toml +++ b/crates/bitwarden-wasm/Cargo.toml @@ -25,7 +25,8 @@ console_log = { version = "1.0.0", features = ["color"] } js-sys = "0.3.68" log = "0.4.20" serde = { version = "1.0.196", features = ["derive"] } -wasm-bindgen = { version = "0.2.91", features = ["serde-serialize"] } +# When upgrading wasm-bindgen, make sure to update the version in the workflows! +wasm-bindgen = { version = "=0.2.95", features = ["serde-serialize"] } wasm-bindgen-futures = "0.4.41" [dev-dependencies] From c75f247f36551eae86a4df1c302542bff2b12dbe Mon Sep 17 00:00:00 2001 From: Hinton Date: Fri, 11 Oct 2024 14:38:09 +0200 Subject: [PATCH 08/39] Remove secrets manager language bindings and clients --- .github/CODEOWNERS | 6 - .github/ISSUE_TEMPLATE/cli.yml | 90 -- .github/ISSUE_TEMPLATE/config.yml | 14 - .github/ISSUE_TEMPLATE/sdk.yml | 78 -- .github/workflows/build-cli-docker.yml | 143 --- .github/workflows/build-cli.yml | 467 -------- .github/workflows/build-cpp.yml | 159 --- .github/workflows/build-dotnet.yml | 99 -- .github/workflows/build-go.yaml | 49 - .github/workflows/build-java.yml | 88 -- .github/workflows/build-napi.yml | 91 -- .github/workflows/build-python-wheels.yml | 122 -- .github/workflows/build-ruby.yml | 95 -- .../workflows/build-rust-cross-platform.yml | 95 -- .github/workflows/build-wasm.yml | 76 -- .github/workflows/publish-bws.yml | 215 ---- .github/workflows/publish-dotnet.yml | 113 -- .github/workflows/publish-java.yml | 128 -- .github/workflows/publish-napi.yml | 155 --- .github/workflows/publish-php.yml | 270 ----- .github/workflows/publish-python.yml | 132 --- .github/workflows/publish-ruby.yml | 126 -- .github/workflows/publish-wasm.yml | 138 --- .github/workflows/release-bws.yml | 77 -- .github/workflows/release-cpp.yml | 167 --- .github/workflows/release-dotnet.yml | 75 -- .github/workflows/release-go.yml | 283 ----- .github/workflows/release-java.yml | 61 - .github/workflows/release-napi.yml | 96 -- .github/workflows/release-python.yml | 80 -- .github/workflows/release-wasm.yml | 78 -- .github/workflows/rust-test.yml | 2 +- .github/workflows/version-bump.yml | 71 -- .gitignore | 21 - .prettierignore | 2 - .vscode/launch.json | 22 - .vscode/tasks.json | 62 - CHANGELOG.md | 6 - Cargo.lock | 784 +------------ README.md | 31 +- crates/bitwarden-c/Cargo.toml | 25 - crates/bitwarden-c/src/c.rs | 58 - crates/bitwarden-c/src/lib.rs | 9 - crates/bitwarden-c/src/macros/ffi.rs | 16 - crates/bitwarden-c/src/macros/mod.rs | 1 - crates/bitwarden-json/Cargo.toml | 29 - crates/bitwarden-json/src/client.rs | 102 -- crates/bitwarden-json/src/command.rs | 144 --- crates/bitwarden-json/src/lib.rs | 3 - crates/bitwarden-json/src/response.rs | 64 - crates/bitwarden-napi/.npmignore | 13 - crates/bitwarden-napi/Cargo.toml | 33 - crates/bitwarden-napi/README.md | 32 - crates/bitwarden-napi/binding.d.ts | 16 - crates/bitwarden-napi/binding.js | 290 ----- crates/bitwarden-napi/build.rs | 5 - .../bitwarden-napi/npm/darwin-arm64/LICENSE | 295 ----- .../bitwarden-napi/npm/darwin-arm64/README.md | 3 - .../npm/darwin-arm64/package.json | 31 - crates/bitwarden-napi/npm/darwin-x64/LICENSE | 295 ----- .../bitwarden-napi/npm/darwin-x64/README.md | 3 - .../npm/darwin-x64/package.json | 31 - .../bitwarden-napi/npm/linux-x64-gnu/LICENSE | 295 ----- .../npm/linux-x64-gnu/README.md | 3 - .../npm/linux-x64-gnu/package.json | 30 - .../bitwarden-napi/npm/win32-x64-msvc/LICENSE | 295 ----- .../npm/win32-x64-msvc/README.md | 3 - .../npm/win32-x64-msvc/package.json | 31 - crates/bitwarden-napi/package-lock.json | 51 - crates/bitwarden-napi/package.json | 50 - .../src-ts/bitwarden_client/index.ts | 245 ---- crates/bitwarden-napi/src-ts/index.ts | 3 - crates/bitwarden-napi/src/client.rs | 44 - crates/bitwarden-napi/src/lib.rs | 2 - crates/bitwarden-napi/tsconfig.json | 13 - crates/bitwarden-py/Cargo.toml | 30 - crates/bitwarden-py/MANIFEST.in | 2 - crates/bitwarden-py/build.rs | 3 - crates/bitwarden-py/pyproject.toml | 2 - crates/bitwarden-py/src/client.rs | 28 - crates/bitwarden-py/src/lib.rs | 5 - crates/bitwarden-py/src/python_module.rs | 9 - crates/bitwarden-wasm-internal/Cargo.toml | 2 +- crates/bitwarden-wasm-internal/src/client.rs | 2 +- crates/bitwarden-wasm/Cargo.toml | 43 - crates/bitwarden-wasm/README.md | 23 - crates/bitwarden-wasm/build.sh | 23 - crates/bitwarden-wasm/src/client.rs | 80 -- crates/bitwarden-wasm/src/lib.rs | 1 - crates/bitwarden/CHANGELOG.md | 83 -- crates/bitwarden/Cargo.toml | 39 - crates/bitwarden/README.md | 58 - crates/bitwarden/src/error.rs | 24 - crates/bitwarden/src/lib.rs | 72 -- crates/bws/CHANGELOG.md | 78 -- crates/bws/Cargo.toml | 60 - crates/bws/Dockerfile | 57 - crates/bws/Dockerfile.dockerignore | 4 - crates/bws/README.md | 94 -- crates/bws/build.rs | 14 - crates/bws/entitlements.plist | 8 - crates/bws/scripts/install.ps1 | 108 -- crates/bws/scripts/install.sh | 180 --- crates/bws/src/cli.rs | 169 --- crates/bws/src/command/mod.rs | 67 -- crates/bws/src/command/project.rs | 141 --- crates/bws/src/command/run.rs | 149 --- crates/bws/src/command/secret.rs | 221 ---- crates/bws/src/config.rs | 217 ---- crates/bws/src/main.rs | 195 ---- crates/bws/src/render.rs | 154 --- crates/bws/src/state.rs | 32 - crates/bws/src/util.rs | 93 -- crates/sdk-schemas/Cargo.toml | 23 - crates/sdk-schemas/src/main.rs | 118 -- languages/cpp/CMakeBuild.md | 61 - languages/cpp/CMakeLists.txt | 37 - languages/cpp/README.md | 112 -- languages/cpp/examples/ExampleUse.md | 108 -- languages/cpp/examples/Wrapper.cpp | 131 --- languages/cpp/include/BitwardenClient.h | 38 - languages/cpp/include/BitwardenLibrary.h | 27 - languages/cpp/include/BitwardenSettings.h | 19 - languages/cpp/include/CommandRunner.h | 45 - languages/cpp/include/Projects.h | 19 - languages/cpp/include/Secrets.h | 24 - languages/cpp/src/BitwardenClient.cpp | 160 --- languages/cpp/src/BitwardenLibrary.cpp | 107 -- languages/cpp/src/CommandRunner.cpp | 49 - languages/cpp/src/Projects.cpp | 132 --- languages/cpp/src/Secrets.cpp | 230 ---- languages/cpp/vcpkg.json | 11 - languages/csharp/.editorconfig | 125 -- .../Bitwarden.Sdk.Samples.csproj | 14 - .../csharp/Bitwarden.Sdk.Samples/Program.cs | 73 -- languages/csharp/Bitwarden.Sdk/AuthClient.cs | 21 - .../csharp/Bitwarden.Sdk/Bitwarden.Sdk.csproj | 77 -- .../Bitwarden.Sdk/BitwardenAuthException.cs | 13 - .../csharp/Bitwarden.Sdk/BitwardenClient.cs | 31 - .../Bitwarden.Sdk/BitwardenException.cs | 13 - .../csharp/Bitwarden.Sdk/BitwardenLibrary.cs | 21 - .../Bitwarden.Sdk/BitwardenSafeHandle.cs | 17 - .../csharp/Bitwarden.Sdk/BitwardenSettings.cs | 14 - .../csharp/Bitwarden.Sdk/CommandRunner.cs | 20 - .../csharp/Bitwarden.Sdk/ProjectsClient.cs | 94 -- .../csharp/Bitwarden.Sdk/SecretsClient.cs | 145 --- languages/csharp/Bitwarden.Sdk/bitwarden.png | Bin 790 -> 0 bytes languages/csharp/Bitwarden.sln | 22 - languages/csharp/LICENSE.txt | 295 ----- languages/csharp/README.md | 89 -- languages/csharp/global.json | 6 - languages/go/.version | 1 - languages/go/INSTRUCTIONS.md | 150 --- languages/go/README.md | 143 --- languages/go/bitwarden_client.go | 85 -- languages/go/command_runner.go | 37 - languages/go/example/example.go | 137 --- languages/go/example/go.mod | 10 - languages/go/example/go.sum | 2 - languages/go/generators.go | 35 - languages/go/go.mod | 3 - languages/go/go.sum | 0 .../internal/cinterface/bitwarden_library.go | 58 - languages/go/project.go | 107 -- languages/go/secrets.go | 151 --- languages/go/util.go | 33 - languages/java/.gitignore | 3 - languages/java/INSTALL.md | 52 - languages/java/README.md | 108 -- languages/java/build.gradle | 106 -- languages/java/example/Example.java | 73 -- languages/java/example/build.gradle | 23 - .../java/gradle/wrapper/gradle-wrapper.jar | Bin 63721 -> 0 bytes .../gradle/wrapper/gradle-wrapper.properties | 7 - languages/java/gradlew | 249 ---- languages/java/gradlew.bat | 92 -- languages/java/settings.gradle | 7 - .../java/com/bitwarden/sdk/AuthClient.java | 32 - .../com/bitwarden/sdk/BitwardenClient.java | 77 -- .../sdk/BitwardenClientException.java | 12 - .../com/bitwarden/sdk/BitwardenLibrary.java | 13 - .../com/bitwarden/sdk/BitwardenSettings.java | 32 - .../java/com/bitwarden/sdk/CommandRunner.java | 45 - .../com/bitwarden/sdk/ProjectsClient.java | 109 -- .../java/com/bitwarden/sdk/SecretsClient.java | 152 --- .../com/bitwarden/sdk/ThrowingFunction.java | 7 - languages/js/example/index.js | 32 - languages/js/example/package-lock.json | 34 - languages/js/example/package.json | 11 - languages/js/sdk-client/.gitignore | 2 - languages/js/sdk-client/package-lock.json | 574 --------- languages/js/sdk-client/package.json | 20 - languages/js/sdk-client/src/client.ts | 197 ---- languages/js/sdk-client/src/lib.ts | 2 - languages/js/sdk-client/tsconfig.json | 12 - languages/js/wasm/.gitignore | 6 - languages/js/wasm/index.js | 25 - languages/js/wasm/package.json | 25 - languages/php/.gitignore | 4 - languages/php/INSTALL.md | 56 - languages/php/README.md | 121 -- languages/php/composer.json | 23 - languages/php/composer.lock | 21 - languages/php/example.php | 103 -- languages/php/src/AuthClient.php | 35 - languages/php/src/BitwardenClient.php | 45 - languages/php/src/BitwardenLib.php | 112 -- languages/php/src/BitwardenSettings.php | 26 - languages/php/src/CommandRunner.php | 33 - languages/php/src/ProjectsClient.php | 94 -- languages/php/src/SecretsClient.php | 125 -- languages/python/.gitignore | 4 - languages/python/README.md | 59 - languages/python/bitwarden_sdk/__init__.py | 13 - .../python/bitwarden_sdk/bitwarden_client.py | 170 --- languages/python/example.py | 83 -- languages/python/openapitools.json | 7 - languages/python/pyproject.toml | 29 - languages/ruby/.gitignore | 4 - languages/ruby/CHANGELOG.md | 6 - languages/ruby/README.md | 140 --- languages/ruby/bitwarden_sdk_secrets/Gemfile | 10 - languages/ruby/bitwarden_sdk_secrets/Rakefile | 11 - .../bitwarden-sdk-secrets.gemspec | 47 - .../ruby/bitwarden_sdk_secrets/lib/auth.rb | 16 - .../lib/bitwarden-sdk-secrets.rb | 52 - .../lib/bitwarden_error.rb | 9 - .../lib/bitwarden_lib.rb | 35 - .../lib/command_runner.rb | 15 - .../lib/extended_schemas/schemas.rb | 78 -- .../bitwarden_sdk_secrets/lib/projects.rb | 116 -- .../ruby/bitwarden_sdk_secrets/lib/secrets.rb | 140 --- .../ruby/bitwarden_sdk_secrets/lib/version.rb | 5 - .../ruby/bitwarden_sdk_secrets/sig/auth.rbs | 9 - .../sig/bitwarden-sdk-secrets.rbs | 39 - .../sig/bitwarden_error.rbs | 5 - .../sig/bitwarden_lib.rbs | 7 - .../sig/command_runner.rbs | 12 - .../bitwarden_sdk_secrets/sig/projects.rbs | 25 - .../bitwarden_sdk_secrets/sig/secrets.rbs | 29 - .../bitwarden_sdk_secrets/sig/version.rbs | 3 - .../spec/settings_spec.rb | 15 - languages/ruby/examples/example.rb | 77 -- languages/ruby/gen_ruby_typedefs.sh | 26 - package-lock.json | 1031 +---------------- package.json | 15 +- sig/bitwarden_sdk/bitwarden_client.rbs | 5 - support/scripts/schemas.ts | 138 --- 248 files changed, 49 insertions(+), 18866 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/cli.yml delete mode 100644 .github/ISSUE_TEMPLATE/config.yml delete mode 100644 .github/ISSUE_TEMPLATE/sdk.yml delete mode 100644 .github/workflows/build-cli-docker.yml delete mode 100644 .github/workflows/build-cli.yml delete mode 100644 .github/workflows/build-cpp.yml delete mode 100644 .github/workflows/build-dotnet.yml delete mode 100644 .github/workflows/build-go.yaml delete mode 100644 .github/workflows/build-java.yml delete mode 100644 .github/workflows/build-napi.yml delete mode 100644 .github/workflows/build-python-wheels.yml delete mode 100644 .github/workflows/build-ruby.yml delete mode 100644 .github/workflows/build-rust-cross-platform.yml delete mode 100644 .github/workflows/build-wasm.yml delete mode 100644 .github/workflows/publish-bws.yml delete mode 100644 .github/workflows/publish-dotnet.yml delete mode 100644 .github/workflows/publish-java.yml delete mode 100644 .github/workflows/publish-napi.yml delete mode 100644 .github/workflows/publish-php.yml delete mode 100644 .github/workflows/publish-python.yml delete mode 100644 .github/workflows/publish-ruby.yml delete mode 100644 .github/workflows/publish-wasm.yml delete mode 100644 .github/workflows/release-bws.yml delete mode 100644 .github/workflows/release-cpp.yml delete mode 100644 .github/workflows/release-dotnet.yml delete mode 100644 .github/workflows/release-go.yml delete mode 100644 .github/workflows/release-java.yml delete mode 100644 .github/workflows/release-napi.yml delete mode 100644 .github/workflows/release-python.yml delete mode 100644 .github/workflows/release-wasm.yml delete mode 100644 .vscode/tasks.json delete mode 100644 CHANGELOG.md delete mode 100644 crates/bitwarden-c/Cargo.toml delete mode 100644 crates/bitwarden-c/src/c.rs delete mode 100644 crates/bitwarden-c/src/lib.rs delete mode 100644 crates/bitwarden-c/src/macros/ffi.rs delete mode 100644 crates/bitwarden-c/src/macros/mod.rs delete mode 100644 crates/bitwarden-json/Cargo.toml delete mode 100644 crates/bitwarden-json/src/client.rs delete mode 100644 crates/bitwarden-json/src/command.rs delete mode 100644 crates/bitwarden-json/src/lib.rs delete mode 100644 crates/bitwarden-json/src/response.rs delete mode 100644 crates/bitwarden-napi/.npmignore delete mode 100644 crates/bitwarden-napi/Cargo.toml delete mode 100644 crates/bitwarden-napi/README.md delete mode 100644 crates/bitwarden-napi/binding.d.ts delete mode 100644 crates/bitwarden-napi/binding.js delete mode 100644 crates/bitwarden-napi/build.rs delete mode 100644 crates/bitwarden-napi/npm/darwin-arm64/LICENSE delete mode 100644 crates/bitwarden-napi/npm/darwin-arm64/README.md delete mode 100644 crates/bitwarden-napi/npm/darwin-arm64/package.json delete mode 100644 crates/bitwarden-napi/npm/darwin-x64/LICENSE delete mode 100644 crates/bitwarden-napi/npm/darwin-x64/README.md delete mode 100644 crates/bitwarden-napi/npm/darwin-x64/package.json delete mode 100644 crates/bitwarden-napi/npm/linux-x64-gnu/LICENSE delete mode 100644 crates/bitwarden-napi/npm/linux-x64-gnu/README.md delete mode 100644 crates/bitwarden-napi/npm/linux-x64-gnu/package.json delete mode 100644 crates/bitwarden-napi/npm/win32-x64-msvc/LICENSE delete mode 100644 crates/bitwarden-napi/npm/win32-x64-msvc/README.md delete mode 100644 crates/bitwarden-napi/npm/win32-x64-msvc/package.json delete mode 100644 crates/bitwarden-napi/package-lock.json delete mode 100644 crates/bitwarden-napi/package.json delete mode 100644 crates/bitwarden-napi/src-ts/bitwarden_client/index.ts delete mode 100644 crates/bitwarden-napi/src-ts/index.ts delete mode 100644 crates/bitwarden-napi/src/client.rs delete mode 100644 crates/bitwarden-napi/src/lib.rs delete mode 100644 crates/bitwarden-napi/tsconfig.json delete mode 100644 crates/bitwarden-py/Cargo.toml delete mode 100644 crates/bitwarden-py/MANIFEST.in delete mode 100644 crates/bitwarden-py/build.rs delete mode 100644 crates/bitwarden-py/pyproject.toml delete mode 100644 crates/bitwarden-py/src/client.rs delete mode 100644 crates/bitwarden-py/src/lib.rs delete mode 100644 crates/bitwarden-py/src/python_module.rs delete mode 100644 crates/bitwarden-wasm/Cargo.toml delete mode 100644 crates/bitwarden-wasm/README.md delete mode 100755 crates/bitwarden-wasm/build.sh delete mode 100644 crates/bitwarden-wasm/src/client.rs delete mode 100644 crates/bitwarden-wasm/src/lib.rs delete mode 100644 crates/bitwarden/CHANGELOG.md delete mode 100644 crates/bitwarden/Cargo.toml delete mode 100644 crates/bitwarden/README.md delete mode 100644 crates/bitwarden/src/error.rs delete mode 100644 crates/bitwarden/src/lib.rs delete mode 100644 crates/bws/CHANGELOG.md delete mode 100644 crates/bws/Cargo.toml delete mode 100644 crates/bws/Dockerfile delete mode 100644 crates/bws/Dockerfile.dockerignore delete mode 100644 crates/bws/README.md delete mode 100644 crates/bws/build.rs delete mode 100644 crates/bws/entitlements.plist delete mode 100755 crates/bws/scripts/install.ps1 delete mode 100755 crates/bws/scripts/install.sh delete mode 100644 crates/bws/src/cli.rs delete mode 100644 crates/bws/src/command/mod.rs delete mode 100644 crates/bws/src/command/project.rs delete mode 100644 crates/bws/src/command/run.rs delete mode 100644 crates/bws/src/command/secret.rs delete mode 100644 crates/bws/src/config.rs delete mode 100644 crates/bws/src/main.rs delete mode 100644 crates/bws/src/render.rs delete mode 100644 crates/bws/src/state.rs delete mode 100644 crates/bws/src/util.rs delete mode 100644 crates/sdk-schemas/Cargo.toml delete mode 100644 crates/sdk-schemas/src/main.rs delete mode 100644 languages/cpp/CMakeBuild.md delete mode 100644 languages/cpp/CMakeLists.txt delete mode 100644 languages/cpp/README.md delete mode 100644 languages/cpp/examples/ExampleUse.md delete mode 100644 languages/cpp/examples/Wrapper.cpp delete mode 100644 languages/cpp/include/BitwardenClient.h delete mode 100644 languages/cpp/include/BitwardenLibrary.h delete mode 100644 languages/cpp/include/BitwardenSettings.h delete mode 100644 languages/cpp/include/CommandRunner.h delete mode 100644 languages/cpp/include/Projects.h delete mode 100644 languages/cpp/include/Secrets.h delete mode 100644 languages/cpp/src/BitwardenClient.cpp delete mode 100644 languages/cpp/src/BitwardenLibrary.cpp delete mode 100644 languages/cpp/src/CommandRunner.cpp delete mode 100644 languages/cpp/src/Projects.cpp delete mode 100644 languages/cpp/src/Secrets.cpp delete mode 100644 languages/cpp/vcpkg.json delete mode 100644 languages/csharp/.editorconfig delete mode 100644 languages/csharp/Bitwarden.Sdk.Samples/Bitwarden.Sdk.Samples.csproj delete mode 100644 languages/csharp/Bitwarden.Sdk.Samples/Program.cs delete mode 100644 languages/csharp/Bitwarden.Sdk/AuthClient.cs delete mode 100644 languages/csharp/Bitwarden.Sdk/Bitwarden.Sdk.csproj delete mode 100644 languages/csharp/Bitwarden.Sdk/BitwardenAuthException.cs delete mode 100644 languages/csharp/Bitwarden.Sdk/BitwardenClient.cs delete mode 100644 languages/csharp/Bitwarden.Sdk/BitwardenException.cs delete mode 100644 languages/csharp/Bitwarden.Sdk/BitwardenLibrary.cs delete mode 100644 languages/csharp/Bitwarden.Sdk/BitwardenSafeHandle.cs delete mode 100644 languages/csharp/Bitwarden.Sdk/BitwardenSettings.cs delete mode 100644 languages/csharp/Bitwarden.Sdk/CommandRunner.cs delete mode 100644 languages/csharp/Bitwarden.Sdk/ProjectsClient.cs delete mode 100644 languages/csharp/Bitwarden.Sdk/SecretsClient.cs delete mode 100644 languages/csharp/Bitwarden.Sdk/bitwarden.png delete mode 100644 languages/csharp/Bitwarden.sln delete mode 100644 languages/csharp/LICENSE.txt delete mode 100644 languages/csharp/README.md delete mode 100644 languages/csharp/global.json delete mode 100644 languages/go/.version delete mode 100644 languages/go/INSTRUCTIONS.md delete mode 100644 languages/go/README.md delete mode 100644 languages/go/bitwarden_client.go delete mode 100644 languages/go/command_runner.go delete mode 100644 languages/go/example/example.go delete mode 100644 languages/go/example/go.mod delete mode 100644 languages/go/example/go.sum delete mode 100644 languages/go/generators.go delete mode 100644 languages/go/go.mod delete mode 100644 languages/go/go.sum delete mode 100644 languages/go/internal/cinterface/bitwarden_library.go delete mode 100644 languages/go/project.go delete mode 100644 languages/go/secrets.go delete mode 100644 languages/go/util.go delete mode 100644 languages/java/.gitignore delete mode 100644 languages/java/INSTALL.md delete mode 100644 languages/java/README.md delete mode 100644 languages/java/build.gradle delete mode 100644 languages/java/example/Example.java delete mode 100644 languages/java/example/build.gradle delete mode 100644 languages/java/gradle/wrapper/gradle-wrapper.jar delete mode 100644 languages/java/gradle/wrapper/gradle-wrapper.properties delete mode 100755 languages/java/gradlew delete mode 100644 languages/java/gradlew.bat delete mode 100644 languages/java/settings.gradle delete mode 100644 languages/java/src/main/java/com/bitwarden/sdk/AuthClient.java delete mode 100644 languages/java/src/main/java/com/bitwarden/sdk/BitwardenClient.java delete mode 100644 languages/java/src/main/java/com/bitwarden/sdk/BitwardenClientException.java delete mode 100644 languages/java/src/main/java/com/bitwarden/sdk/BitwardenLibrary.java delete mode 100644 languages/java/src/main/java/com/bitwarden/sdk/BitwardenSettings.java delete mode 100644 languages/java/src/main/java/com/bitwarden/sdk/CommandRunner.java delete mode 100644 languages/java/src/main/java/com/bitwarden/sdk/ProjectsClient.java delete mode 100644 languages/java/src/main/java/com/bitwarden/sdk/SecretsClient.java delete mode 100644 languages/java/src/main/java/com/bitwarden/sdk/ThrowingFunction.java delete mode 100644 languages/js/example/index.js delete mode 100644 languages/js/example/package-lock.json delete mode 100644 languages/js/example/package.json delete mode 100644 languages/js/sdk-client/.gitignore delete mode 100644 languages/js/sdk-client/package-lock.json delete mode 100644 languages/js/sdk-client/package.json delete mode 100644 languages/js/sdk-client/src/client.ts delete mode 100644 languages/js/sdk-client/src/lib.ts delete mode 100644 languages/js/sdk-client/tsconfig.json delete mode 100644 languages/js/wasm/.gitignore delete mode 100644 languages/js/wasm/index.js delete mode 100644 languages/js/wasm/package.json delete mode 100644 languages/php/.gitignore delete mode 100644 languages/php/INSTALL.md delete mode 100644 languages/php/README.md delete mode 100644 languages/php/composer.json delete mode 100644 languages/php/composer.lock delete mode 100644 languages/php/example.php delete mode 100644 languages/php/src/AuthClient.php delete mode 100644 languages/php/src/BitwardenClient.php delete mode 100644 languages/php/src/BitwardenLib.php delete mode 100644 languages/php/src/BitwardenSettings.php delete mode 100644 languages/php/src/CommandRunner.php delete mode 100644 languages/php/src/ProjectsClient.php delete mode 100644 languages/php/src/SecretsClient.php delete mode 100644 languages/python/.gitignore delete mode 100644 languages/python/README.md delete mode 100644 languages/python/bitwarden_sdk/__init__.py delete mode 100644 languages/python/bitwarden_sdk/bitwarden_client.py delete mode 100755 languages/python/example.py delete mode 100644 languages/python/openapitools.json delete mode 100644 languages/python/pyproject.toml delete mode 100644 languages/ruby/.gitignore delete mode 100644 languages/ruby/CHANGELOG.md delete mode 100644 languages/ruby/README.md delete mode 100644 languages/ruby/bitwarden_sdk_secrets/Gemfile delete mode 100644 languages/ruby/bitwarden_sdk_secrets/Rakefile delete mode 100644 languages/ruby/bitwarden_sdk_secrets/bitwarden-sdk-secrets.gemspec delete mode 100644 languages/ruby/bitwarden_sdk_secrets/lib/auth.rb delete mode 100644 languages/ruby/bitwarden_sdk_secrets/lib/bitwarden-sdk-secrets.rb delete mode 100644 languages/ruby/bitwarden_sdk_secrets/lib/bitwarden_error.rb delete mode 100644 languages/ruby/bitwarden_sdk_secrets/lib/bitwarden_lib.rb delete mode 100644 languages/ruby/bitwarden_sdk_secrets/lib/command_runner.rb delete mode 100644 languages/ruby/bitwarden_sdk_secrets/lib/extended_schemas/schemas.rb delete mode 100644 languages/ruby/bitwarden_sdk_secrets/lib/projects.rb delete mode 100644 languages/ruby/bitwarden_sdk_secrets/lib/secrets.rb delete mode 100644 languages/ruby/bitwarden_sdk_secrets/lib/version.rb delete mode 100644 languages/ruby/bitwarden_sdk_secrets/sig/auth.rbs delete mode 100644 languages/ruby/bitwarden_sdk_secrets/sig/bitwarden-sdk-secrets.rbs delete mode 100644 languages/ruby/bitwarden_sdk_secrets/sig/bitwarden_error.rbs delete mode 100644 languages/ruby/bitwarden_sdk_secrets/sig/bitwarden_lib.rbs delete mode 100644 languages/ruby/bitwarden_sdk_secrets/sig/command_runner.rbs delete mode 100644 languages/ruby/bitwarden_sdk_secrets/sig/projects.rbs delete mode 100644 languages/ruby/bitwarden_sdk_secrets/sig/secrets.rbs delete mode 100644 languages/ruby/bitwarden_sdk_secrets/sig/version.rbs delete mode 100644 languages/ruby/bitwarden_sdk_secrets/spec/settings_spec.rb delete mode 100644 languages/ruby/examples/example.rb delete mode 100755 languages/ruby/gen_ruby_typedefs.sh delete mode 100644 sig/bitwarden_sdk/bitwarden_client.rbs delete mode 100644 support/scripts/schemas.ts diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index e4fbb97b..b10ec1b4 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -10,9 +10,3 @@ # Secrets Manager team crates/bitwarden-sm @bitwarden/team-secrets-manager-dev -crates/bws @bitwarden/team-secrets-manager-dev - -# BRE Automations -crates/bws/Cargo.toml -crates/bws/scripts/install.ps1 -crates/bws/scripts/install.sh diff --git a/.github/ISSUE_TEMPLATE/cli.yml b/.github/ISSUE_TEMPLATE/cli.yml deleted file mode 100644 index b747873b..00000000 --- a/.github/ISSUE_TEMPLATE/cli.yml +++ /dev/null @@ -1,90 +0,0 @@ -name: Secrets Manager CLI Bug Report -description: File a bug report for issues encountered using the Bitwarden Secrets Manager CLI (bws) -labels: [bug, bws] -body: - - type: markdown - attributes: - value: | - Thanks for taking the time to fill out this bug report! - - Please do not submit feature requests. The [Community Forums](https://community.bitwarden.com) has a section for submitting, voting for, and discussing product feature requests. - - type: textarea - id: reproduce - attributes: - label: Steps To Reproduce - description: How can we reproduce the behavior. - value: | - 1. Go to '...' - 2. Click on '....' - 3. Scroll down to '....' - 4. Click on '...' - validations: - required: true - - type: textarea - id: expected - attributes: - label: Expected Result - description: A clear and concise description of what you expected to happen. - validations: - required: true - - type: textarea - id: actual - attributes: - label: Actual Result - description: A clear and concise description of what is happening. - validations: - required: true - - type: textarea - id: screenshots - attributes: - label: Screenshots or Videos - description: If applicable, add screenshots and/or a short video to help explain your problem. - - type: textarea - id: additional-context - attributes: - label: Additional Context - description: Add any other context about the problem here. - - type: dropdown - id: os - attributes: - label: Operating System - description: What operating system are you seeing the problem on? - multiple: true - options: - - Windows - - macOS - - Linux - validations: - required: true - - type: input - id: os-version - attributes: - label: Operating System Version - description: What version of the operating system(s) are you seeing the problem on? - - type: dropdown - id: shell - attributes: - label: Shell - description: What shell(s) are you seeing the problem on? - multiple: true - options: - - Bash - - Zsh - - PowerShell - validations: - required: true - - type: input - id: version - attributes: - label: Build Version - description: What version of our software are you running? (run `bws --version`) - validations: - required: true - - type: checkboxes - id: issue-tracking-info - attributes: - label: Issue Tracking Info - description: | - Issue tracking information - options: - - label: I understand that work is tracked outside of Github. A PR will be linked to this issue should one be opened to address it, but Bitwarden doesn't use fields like "assigned", "milestone", or "project" to track progress. diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml deleted file mode 100644 index 61d7e2b9..00000000 --- a/.github/ISSUE_TEMPLATE/config.yml +++ /dev/null @@ -1,14 +0,0 @@ -blank_issues_enabled: false -contact_links: - - name: Feature Requests - url: https://community.bitwarden.com/c/feature-requests/ - about: Request new features using the Community Forums. Please search existing feature requests before making a new one. - - name: Bitwarden Community Forums - url: https://community.bitwarden.com - about: Please visit the community forums for general community discussion, support and the development roadmap. - - name: Customer Support - url: https://bitwarden.com/contact/ - about: Please contact our customer support for account issues and general customer support. - - name: Security Issues - url: https://hackerone.com/bitwarden - about: We use HackerOne to manage security disclosures. diff --git a/.github/ISSUE_TEMPLATE/sdk.yml b/.github/ISSUE_TEMPLATE/sdk.yml deleted file mode 100644 index c5bb87a6..00000000 --- a/.github/ISSUE_TEMPLATE/sdk.yml +++ /dev/null @@ -1,78 +0,0 @@ -name: SDK Bug Report -description: File a bug report for issues encountered using the Bitwarden SDK -labels: [bug, sdk] -body: - - type: markdown - attributes: - value: | - Thanks for taking the time to fill out this bug report! - - Please do not submit feature requests. The [Community Forums](https://community.bitwarden.com) has a section for submitting, voting for, and discussing product feature requests. - - type: textarea - id: reproduce - attributes: - label: Steps To Reproduce - description: How can we reproduce the behavior. - value: | - 1. Go to '...' - 2. Click on '....' - 3. Scroll down to '....' - 4. Click on '...' - validations: - required: true - - type: textarea - id: expected - attributes: - label: Expected Result - description: A clear and concise description of what you expected to happen. - validations: - required: true - - type: textarea - id: actual - attributes: - label: Actual Result - description: A clear and concise description of what is happening. - validations: - required: true - - type: textarea - id: screenshots - attributes: - label: Screenshots or Videos - description: If applicable, add screenshots and/or a short video to help explain your problem. - - type: textarea - id: additional-context - attributes: - label: Additional Context - description: Add any other context about the problem here. - - type: dropdown - id: os - attributes: - label: Operating System - description: What operating system are you seeing the problem on? - multiple: true - options: - - Windows - - macOS - - Linux - validations: - required: true - - type: input - id: os-version - attributes: - label: Operating System Version - description: What version of the operating system(s) are you seeing the problem on? - - type: input - id: version - attributes: - label: Build Version - description: What version of the SDK are you running? - validations: - required: true - - type: checkboxes - id: issue-tracking-info - attributes: - label: Issue Tracking Info - description: | - Issue tracking information - options: - - label: I understand that work is tracked outside of Github. A PR will be linked to this issue should one be opened to address it, but Bitwarden doesn't use fields like "assigned", "milestone", or "project" to track progress. diff --git a/.github/workflows/build-cli-docker.yml b/.github/workflows/build-cli-docker.yml deleted file mode 100644 index 83daabf2..00000000 --- a/.github/workflows/build-cli-docker.yml +++ /dev/null @@ -1,143 +0,0 @@ ---- -name: Build bws Docker image - -on: - push: - branches: - - "main" - workflow_dispatch: - pull_request: - -env: - _AZ_REGISTRY: bitwardenprod.azurecr.io - -jobs: - build-docker: - name: Build Docker image - runs-on: ubuntu-22.04 - steps: - - name: Checkout Repository - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - - - name: Check Branch to Publish - id: publish-branch-check - run: | - if [[ "$GITHUB_REF" == "refs/heads/main" ]]; then - echo "is_publish_branch=true" >> $GITHUB_ENV - else - echo "is_publish_branch=false" >> $GITHUB_ENV - fi - - ########## Set up Docker ########## - - name: Set up QEMU emulators - uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1 - - ########## Login to Docker registries ########## - - name: Login to Azure - Prod Subscription - uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0 - with: - creds: ${{ secrets.AZURE_PROD_KV_CREDENTIALS }} - - - name: Login to Azure ACR - run: az acr login -n ${_AZ_REGISTRY%.azurecr.io} - - - name: Login to Azure - CI Subscription - uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0 - with: - creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }} - - - name: Retrieve github PAT secrets - id: retrieve-secret-pat - uses: bitwarden/gh-actions/get-keyvault-secrets@main - with: - keyvault: "bitwarden-ci" - secrets: "github-pat-bitwarden-devops-bot-repo-scope" - - - name: Setup Docker Trust - if: ${{ env.is_publish_branch == 'true' }} - uses: bitwarden/gh-actions/setup-docker-trust@main - with: - azure-creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }} - azure-keyvault-name: "bitwarden-ci" - - ########## Generate image tag and build Docker image ########## - - name: Generate Docker image tag - id: tag - run: | - REF=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}} - IMAGE_TAG=$(echo "${REF}" | sed "s#/#-#g") # slash safe branch name - if [[ "${IMAGE_TAG}" == "main" ]]; then - IMAGE_TAG=dev - fi - - echo "image_tag=${IMAGE_TAG}" >> $GITHUB_OUTPUT - - - name: Generate tag list - id: tag-list - env: - IMAGE_TAG: ${{ steps.tag.outputs.image_tag }} - run: | - if [[ "${IMAGE_TAG}" == "dev" ]]; then - echo "tags=$_AZ_REGISTRY/bws:${IMAGE_TAG},bitwarden/bws:${IMAGE_TAG}" >> $GITHUB_OUTPUT - else - echo "tags=$_AZ_REGISTRY/bws:${IMAGE_TAG}" >> $GITHUB_OUTPUT - fi - - - name: Build and push Docker image - uses: docker/build-push-action@32945a339266b759abcbdc89316275140b0fc960 # v6.8.0 - with: - context: . - file: crates/bws/Dockerfile - platforms: | - linux/amd64, - linux/arm64/v8 - push: true - tags: ${{ steps.tag-list.outputs.tags }} - secrets: | - "GH_PAT=${{ steps.retrieve-secret-pat.outputs.github-pat-bitwarden-devops-bot-repo-scope }}" - - - name: Log out of Docker and disable Docker Notary - if: ${{ env.is_publish_branch == 'true' }} - run: | - docker logout - echo "DOCKER_CONTENT_TRUST=0" >> $GITHUB_ENV - - check-failures: - name: Check for failures - if: always() - runs-on: ubuntu-22.04 - needs: build-docker - steps: - - name: Check if any job failed - if: github.ref == 'refs/heads/main' - env: - BUILD_DOCKER_STATUS: ${{ needs.build-docker.result }} - run: | - if [ "$BUILD_DOCKER_STATUS" = "failure" ]; then - exit 1 - fi - - - name: Login to Azure - CI subscription - uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0 - if: failure() - with: - creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }} - - - name: Retrieve secrets - id: retrieve-secrets - uses: bitwarden/gh-actions/get-keyvault-secrets@main - if: failure() - with: - keyvault: "bitwarden-ci" - secrets: "devops-alerts-slack-webhook-url" - - - name: Notify Slack on failure - uses: act10ns/slack@44541246747a30eb3102d87f7a4cc5471b0ffb7d # v2.1.0 - if: failure() - env: - SLACK_WEBHOOK_URL: ${{ steps.retrieve-secrets.outputs.devops-alerts-slack-webhook-url }} - with: - status: ${{ job.status }} diff --git a/.github/workflows/build-cli.yml b/.github/workflows/build-cli.yml deleted file mode 100644 index 9ffb3bde..00000000 --- a/.github/workflows/build-cli.yml +++ /dev/null @@ -1,467 +0,0 @@ ---- -name: Build CLI - -on: - pull_request: - push: - branches: - - "main" - workflow_dispatch: - -defaults: - run: - shell: bash - -jobs: - setup: - name: Setup - runs-on: ubuntu-22.04 - outputs: - package_version: ${{ steps.retrieve-version.outputs.package_version }} - sign: ${{ steps.sign.outputs.sign }} - steps: - - name: Checkout repo - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - - - name: Get Package Version - id: retrieve-version - run: | - VERSION=$(grep -o '^version = ".*"' crates/bws/Cargo.toml | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+") - echo "package_version=$VERSION" >> $GITHUB_OUTPUT - - - name: Sign if repo is owned by Bitwarden - id: sign - env: - REPO_OWNER: ${{ github.repository_owner }} - run: | - if [[ $REPO_OWNER == bitwarden ]]; then - echo "sign=true" >> $GITHUB_OUTPUT - fi - echo "sign=false" >> $GITHUB_OUTPUT - - build-windows: - name: Building CLI for - ${{ matrix.settings.os }} - ${{ matrix.settings.target }} - runs-on: ${{ matrix.settings.os || 'ubuntu-latest' }} - needs: setup - env: - _PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }} - strategy: - fail-fast: false - matrix: - settings: - - os: windows-2022 - target: x86_64-pc-windows-msvc - - - os: windows-2022 - target: aarch64-pc-windows-msvc - steps: - - name: Checkout repo - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - - - name: Install rust - uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # stable - with: - toolchain: stable - targets: ${{ matrix.settings.target }} - - - name: Cache cargo registry - uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3 - with: - key: ${{ matrix.settings.target }}-cargo-${{ matrix.settings.os }} - - - name: Build - env: - TARGET: ${{ matrix.settings.target }} - run: cargo build -p bws --release --target=${{ matrix.settings.target }} - - - name: Login to Azure - if: ${{ needs.setup.outputs.sign == 'true' }} - uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0 - with: - creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }} - - - name: Retrieve secrets - if: ${{ needs.setup.outputs.sign == 'true' }} - id: retrieve-secrets-windows - uses: bitwarden/gh-actions/get-keyvault-secrets@main - with: - keyvault: "bitwarden-ci" - secrets: "code-signing-vault-url, - code-signing-client-id, - code-signing-tenant-id, - code-signing-client-secret, - code-signing-cert-name" - - - name: Install AST - if: ${{ needs.setup.outputs.sign == 'true' }} - run: dotnet tool install --global AzureSignTool --version 4.0.1 - - - name: Sign windows binary - if: ${{ needs.setup.outputs.sign == 'true' }} - env: - SIGNING_VAULT_URL: ${{ steps.retrieve-secrets-windows.outputs.code-signing-vault-url }} - SIGNING_CLIENT_ID: ${{ steps.retrieve-secrets-windows.outputs.code-signing-client-id }} - SIGNING_TENANT_ID: ${{ steps.retrieve-secrets-windows.outputs.code-signing-tenant-id }} - SIGNING_CLIENT_SECRET: ${{ steps.retrieve-secrets-windows.outputs.code-signing-client-secret }} - SIGNING_CERT_NAME: ${{ steps.retrieve-secrets-windows.outputs.code-signing-cert-name }} - run: | - azuresigntool sign -v \ - -kvu $SIGNING_VAULT_URL \ - -kvi $SIGNING_CLIENT_ID \ - -kvt $SIGNING_TENANT_ID \ - -kvs $SIGNING_CLIENT_SECRET \ - -kvc $SIGNING_CERT_NAME \ - -fd sha256 \ - -du https://bitwarden.com \ - -tr http://timestamp.digicert.com \ - ./target/${{ matrix.settings.target }}/release/bws.exe - - - name: Zip - shell: cmd - run: 7z a ./bws-${{ matrix.settings.target }}-%_PACKAGE_VERSION%.zip ./target/${{ matrix.settings.target }}/release/bws.exe - - - name: Upload artifact - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 - with: - name: bws-${{ matrix.settings.target }}-${{ env._PACKAGE_VERSION }}.zip - path: ./bws-${{ matrix.settings.target }}-${{ env._PACKAGE_VERSION }}.zip - if-no-files-found: error - - build-macos: - name: Building CLI for - ${{ matrix.settings.os }} - ${{ matrix.settings.target }} - runs-on: ${{ matrix.settings.os || 'ubuntu-latest' }} - needs: setup - env: - _PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }} - strategy: - fail-fast: false - matrix: - settings: - - os: macos-13 - target: x86_64-apple-darwin - - - os: macos-13 - target: aarch64-apple-darwin - - steps: - - name: Checkout repo - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - - - name: Install rust - uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # stable - with: - toolchain: stable - targets: ${{ matrix.settings.target }} - - - name: Cache cargo registry - uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3 - with: - key: ${{ matrix.settings.target }}-cargo-${{ matrix.settings.os }} - - - name: Build - env: - TARGET: ${{ matrix.settings.target }} - run: cargo build -p bws --release --target=${{ matrix.settings.target }} - - - name: Login to Azure - uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0 - with: - creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }} - - - name: Retrieve secrets macos - id: retrieve-secrets-macos - uses: bitwarden/gh-actions/get-keyvault-secrets@main - with: - keyvault: "bitwarden-ci" - secrets: "macos-bws-notarization-apple-id, - macos-bws-notarization-team-id, - macos-bws-notarization-password, - macos-bws-certificate-name, - macos-bws-installer-certificate-name" - - - name: Decrypt secrets - env: - DECRYPT_FILE_PASSWORD: ${{ secrets.DECRYPT_FILE_PASSWORD }} - run: | - mkdir -p $HOME/secrets - - gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPT_FILE_PASSWORD" \ - --output "$HOME/secrets/devid-app-cert.p12" \ - "$GITHUB_WORKSPACE/.github/secrets/devid-app-cert.p12.gpg" - - - name: Set up keychain - env: - KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} - DEVID_CERT_PASSWORD: ${{ secrets.DEVID_CERT_PASSWORD }} - run: | - security create-keychain -p $KEYCHAIN_PASSWORD build.keychain - security default-keychain -s build.keychain - security unlock-keychain -p $KEYCHAIN_PASSWORD build.keychain - security set-keychain-settings -lut 1200 build.keychain - - ls $HOME/secrets - - security import "$HOME/secrets/devid-app-cert.p12" -k build.keychain -P $DEVID_CERT_PASSWORD \ - -T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/productbuild - - security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $KEYCHAIN_PASSWORD build.keychain - - - name: Sign macos - env: - MACOS_CERTIFICATE_NAME: ${{ steps.retrieve-secrets-macos.outputs.macos-bws-certificate-name }} - run: codesign --sign "$MACOS_CERTIFICATE_NAME" --verbose=3 --force --options=runtime --timestamp ./target/${{ matrix.settings.target }}/release/bws - - - name: Notarize app macos - env: - MACOS_NOTARIZATION_APPLE_ID: ${{ steps.retrieve-secrets-macos.outputs.macos-bws-notarization-apple-id }} - MACOS_NOTARIZATION_TEAM_ID: ${{ steps.retrieve-secrets-macos.outputs.macos-bws-notarization-team-id }} - MACOS_NOTARIZATION_PWD: ${{ steps.retrieve-secrets-macos.outputs.macos-bws-notarization-password }} - MACOS_CERTIFICATE_NAME: ${{ steps.retrieve-secrets-macos.outputs.macos-bws-certificate-name }} - run: | - echo "Create keychain profile" - xcrun notarytool store-credentials "notarytool-profile" --apple-id "$MACOS_NOTARIZATION_APPLE_ID" --team-id "$MACOS_NOTARIZATION_TEAM_ID" --password "$MACOS_NOTARIZATION_PWD" - - echo "Creating notarization archive" - zip -j ./bws-${{ matrix.settings.target }}-${{ env._PACKAGE_VERSION }}.zip ./target/${{ matrix.settings.target }}/release/bws - - codesign --sign "$MACOS_CERTIFICATE_NAME" --verbose=3 --force --options=runtime --timestamp ./bws-${{ matrix.settings.target }}-${{ env._PACKAGE_VERSION }}.zip - - echo "Notarize app" - xcrun notarytool submit ./bws-${{ matrix.settings.target }}-${{ env._PACKAGE_VERSION }}.zip --keychain-profile "notarytool-profile" --wait - - - name: Upload artifact - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 - with: - name: bws-${{ matrix.settings.target }}-${{ env._PACKAGE_VERSION }}.zip - path: ./bws-${{ matrix.settings.target }}-${{ env._PACKAGE_VERSION }}.zip - if-no-files-found: error - - build-linux: - name: Building CLI for - ${{ matrix.settings.os }} - ${{ matrix.settings.target }} - runs-on: ${{ matrix.settings.os || 'ubuntu-latest' }} - needs: setup - env: - _PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }} - strategy: - fail-fast: false - matrix: - settings: - - os: ubuntu-20.04 - target: x86_64-unknown-linux-musl - - - os: ubuntu-20.04 - target: aarch64-unknown-linux-musl - - - os: ubuntu-20.04 - target: x86_64-unknown-linux-gnu - - - os: ubuntu-20.04 - target: aarch64-unknown-linux-gnu - steps: - - name: Checkout repo - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - - - name: Install rust - uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # stable - with: - toolchain: stable - targets: ${{ matrix.settings.target }} - - - name: Set up Zig - uses: goto-bus-stop/setup-zig@abea47f85e598557f500fa1fd2ab7464fcb39406 # v2.2.1 - with: - version: 0.12.0 - - - name: Cache cargo registry - uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3 - with: - key: ${{ matrix.settings.target }}-cargo-${{ matrix.settings.os }} - - - name: Install Zigbuild - run: cargo install cargo-zigbuild --locked --git https://github.com/rust-cross/cargo-zigbuild --rev 6f7e1336c9cd13cf1b3704f93c40fcf84caaed6b # 0.18.4 - - - name: Build - env: - TARGET: ${{ matrix.settings.target }} - run: cargo zigbuild -p bws --release --target=${{ matrix.settings.target }} - - - name: Zip linux - run: zip -j ./bws-${{ matrix.settings.target }}-${{ env._PACKAGE_VERSION }}.zip ./target/${{ matrix.settings.target }}/release/bws - - - name: Upload artifact - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 - with: - name: bws-${{ matrix.settings.target }}-${{ env._PACKAGE_VERSION }}.zip - path: ./bws-${{ matrix.settings.target }}-${{ env._PACKAGE_VERSION }}.zip - if-no-files-found: error - - macos-universal-binary: - name: Generate universal macOS binary - runs-on: macos-13 - needs: - - setup - - build-macos - env: - _PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }} - steps: - - name: Checkout repo - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - - - name: Download x86_64-apple-darwin artifact - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 - with: - name: bws-x86_64-apple-darwin-${{ env._PACKAGE_VERSION }}.zip - - - name: Download aarch64-apple-darwin artifact - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 - with: - name: bws-aarch64-apple-darwin-${{ env._PACKAGE_VERSION }}.zip - - - name: Unzip artifacts - run: | - unzip bws-x86_64-apple-darwin-${{ env._PACKAGE_VERSION }}.zip -d ./bws-x86_64-apple-darwin - unzip bws-aarch64-apple-darwin-${{ env._PACKAGE_VERSION }}.zip -d ./bws-aarch64-apple-darwin - - - name: Create universal package with lipo - run: | - mkdir ./bws-macos-universal - - lipo -create -output ./bws-macos-universal/bws ./bws-x86_64-apple-darwin/bws ./bws-aarch64-apple-darwin/bws - - - name: Login to Azure - uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0 - with: - creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }} - - - name: Retrieve secrets - id: retrieve-secrets-macos - uses: bitwarden/gh-actions/get-keyvault-secrets@main - with: - keyvault: "bitwarden-ci" - secrets: "macos-bws-notarization-apple-id, - macos-bws-notarization-team-id, - macos-bws-notarization-password, - macos-bws-certificate-name, - macos-bws-installer-certificate-name" - - - name: Decrypt secrets - env: - DECRYPT_FILE_PASSWORD: ${{ secrets.DECRYPT_FILE_PASSWORD }} - run: | - mkdir -p $HOME/secrets - - gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPT_FILE_PASSWORD" \ - --output "$HOME/secrets/devid-app-cert.p12" \ - "$GITHUB_WORKSPACE/.github/secrets/devid-app-cert.p12.gpg" - - - name: Set up keychain - env: - KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} - DEVID_CERT_PASSWORD: ${{ secrets.DEVID_CERT_PASSWORD }} - run: | - security create-keychain -p $KEYCHAIN_PASSWORD build.keychain - security default-keychain -s build.keychain - security unlock-keychain -p $KEYCHAIN_PASSWORD build.keychain - security set-keychain-settings -lut 1200 build.keychain - - security import "$HOME/secrets/devid-app-cert.p12" -k build.keychain -P $DEVID_CERT_PASSWORD \ - -T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/productbuild - - security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $KEYCHAIN_PASSWORD build.keychain - - - name: Sign binary - env: - MACOS_CERTIFICATE_NAME: ${{ steps.retrieve-secrets-macos.outputs.macos-bws-certificate-name }} - run: codesign --sign "$MACOS_CERTIFICATE_NAME" --verbose=3 --force --options=runtime --timestamp ./bws-macos-universal/bws - - - name: Notarize app - env: - MACOS_NOTARIZATION_APPLE_ID: ${{ steps.retrieve-secrets-macos.outputs.macos-bws-notarization-apple-id }} - MACOS_NOTARIZATION_TEAM_ID: ${{ steps.retrieve-secrets-macos.outputs.macos-bws-notarization-team-id }} - MACOS_NOTARIZATION_PWD: ${{ steps.retrieve-secrets-macos.outputs.macos-bws-notarization-password }} - MACOS_CERTIFICATE_NAME: ${{ steps.retrieve-secrets-macos.outputs.macos-bws-certificate-name }} - run: | - - echo "Create keychain profile" - xcrun notarytool store-credentials "notarytool-profile" --apple-id "$MACOS_NOTARIZATION_APPLE_ID" --team-id "$MACOS_NOTARIZATION_TEAM_ID" --password "$MACOS_NOTARIZATION_PWD" - - echo "Creating notarization archive" - zip -j ./bws-macos-universal-${{ env._PACKAGE_VERSION }}.zip ./bws-macos-universal/bws - - codesign --sign "$MACOS_CERTIFICATE_NAME" --verbose=3 --force --options=runtime --timestamp ./bws-macos-universal-${{ env._PACKAGE_VERSION }}.zip - - echo "Notarize app" - xcrun notarytool submit ./bws-macos-universal-${{ env._PACKAGE_VERSION }}.zip --keychain-profile "notarytool-profile" --wait - - - name: Upload artifact - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 - with: - name: bws-macos-universal-${{ env._PACKAGE_VERSION }}.zip - path: ./bws-macos-universal-${{ env._PACKAGE_VERSION }}.zip - if-no-files-found: error - - third_party: - name: Generate THIRDPARTY.html - runs-on: ubuntu-22.04 - needs: - - setup - steps: - - name: Checkout repo - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - - - name: Install rust - uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # stable - with: - toolchain: stable - - - name: Cache cargo registry - uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3 - with: - key: cargo-cli-about - - - name: Install cargo-about - run: cargo install cargo-about - - - name: Generate THIRDPARTY.html - working-directory: ./crates/bws - run: | - cargo about generate ../../about.hbs > THIRDPARTY.html - sed -i.bak 's/\$NAME\$/Bitwarden Secrets Manager CLI/g' THIRDPARTY.html - - - name: Upload artifact - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 - with: - name: THIRDPARTY.html - path: ./crates/bws/THIRDPARTY.html - if-no-files-found: error - - manpages: - name: Generate manpages - runs-on: ubuntu-22.04 - needs: setup - steps: - - name: Checkout repo - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - - - name: Install rust - uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # stable - with: - toolchain: stable - - - name: Cache cargo registry - uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3 - with: - key: cargo-cli-manpage - - - name: Generate manpages - run: | - cargo check -p bws --message-format json > build.json - OUT_DIR=$(jq -r --slurp '.[] | select (.reason == "build-script-executed") | select(.package_id|contains("crates/bws")) .out_dir' build.json) - mv $OUT_DIR/manpages . - - - name: Upload artifact - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 - with: - name: manpages - path: ./manpages/* - if-no-files-found: error diff --git a/.github/workflows/build-cpp.yml b/.github/workflows/build-cpp.yml deleted file mode 100644 index 68636936..00000000 --- a/.github/workflows/build-cpp.yml +++ /dev/null @@ -1,159 +0,0 @@ -name: Build C++ SDK - -on: - push: - branches: - - main - - rc - - hotfix-rc - - pull_request: - workflow_dispatch: - -jobs: - generate-schemas: - uses: ./.github/workflows/generate_schemas.yml - - build_rust: - uses: ./.github/workflows/build-rust-cross-platform.yml - - build: - name: Build for ${{ matrix.settings.os }} ${{ matrix.settings.target }} - needs: - - generate-schemas - - build_rust - runs-on: ${{ matrix.settings.os }} - strategy: - fail-fast: false - matrix: - settings: - - os: macos-13 - target: x86_64-apple-darwin - - - os: macos-13 - target: aarch64-apple-darwin - - - os: windows-2022 - target: x86_64-pc-windows-msvc - - - os: ubuntu-22.04 - target: x86_64-unknown-linux-gnu - - steps: - - name: Checkout Repository - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - - - name: install dependencies linux - if: runner.os == 'Linux' - run: | - sudo apt-get install -y nlohmann-json3-dev - sudo apt-get install -y libboost-all-dev - - - name: install dependencies macos - if: runner.os == 'macOS' - run: | - brew install nlohmann-json - brew install boost - - - name: Export GitHub Actions cache environment variables - if: runner.os == 'Windows' - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 - with: - script: | - core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); - core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); - - - name: Download schemas - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 - with: - name: sdk-schemas-cpp - path: languages/cpp/include - - - name: Download ${{ matrix.settings.target }} files - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 - with: - name: libbitwarden_c_files-${{ matrix.settings.target }} - path: languages/cpp/include - - - name: Set permissions to include folder - if: runner.os == 'Windows' - shell: pwsh - run: | - Get-Acl languages/cpp/include/* | Format-List - - $path = "./languages/cpp/include" - $name = [System.Security.Principal.WindowsIdentity]::GetCurrent().Name - $acl = Get-Acl languages/cpp/include - $accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule($name,"FullControl","Allow") - $acl.SetAccessRule($accessRule) - $acl | Set-Acl languages/cpp/include - Get-ChildItem -Path "$path" -Recurse -Force | Set-Acl -aclObject $acl -Verbose - - Get-Acl languages/cpp/include/* | Format-List - - - name: Ensure bitwarden-c is in include folder - working-directory: languages/cpp - shell: bash - run: | - if [[ '${{ runner.os }}' == 'macOS' || '${{ runner.os }}' == 'Linux' ]]; then - ls include/libbitwarden_c.* || { echo "Missing libbitwarden_c.*"; exit 1; } - fi - if [[ '${{ runner.os }}' == 'Windows' ]]; then - ls include/bitwarden_c.dll || { echo "Missing bitwarden_c.dll"; exit 1; } - ls include/bitwarden_c.dll.lib || { echo "Missing bitwarden_c.dll.lib"; exit 1; } - fi - - - name: Build unix - working-directory: languages/cpp - if: runner.os == 'macOS' || runner.os == 'Linux' - run: | - if [[ '${{ runner.os }}' == 'macOS' ]]; then - export DNLOHMANN_PATH=/usr/local/opt/nlohmann-json - export DBOOST_PATH=/usr/local/opt/boost - export DTARGET=include/libbitwarden_c.dylib - fi - - if [[ '${{ runner.os }}' == 'Linux' ]]; then - export DNLOHMANN_PATH=/usr/share/doc/nlohmann-json3-dev - export DBOOST_PATH=/usr/share/doc/libboost-all-dev - export DTARGET=include/libbitwarden_c.so - fi - - mkdir build - cd build - cmake .. -DNLOHMANN=$DNLOHMANN_PATH -DBOOST=$DBOOST_PATH -DTARGET=$DTARGET - cmake --build . - - - name: Build windows - if: runner.os == 'Windows' - working-directory: languages/cpp - env: - VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" - run: | - mkdir build - cd build - $env:DTARGET="include\bitwarden_c.dll.lib" - cmake .. -DTARGET="$env:DTARGET" -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALLATION_ROOT\scripts\buildsystems\vcpkg.cmake" - cmake --build . --config Release - shell: pwsh - - - name: Copy artifacts - working-directory: languages/cpp/build - shell: bash - run: | - mkdir artifacts - if [[ '${{ runner.os }}' == 'macOS' || '${{ runner.os }}' == 'Linux' ]]; then - cp libbitwarden_c.* artifacts - cp libBitwardenClient.* artifacts - fi - if [[ '${{ runner.os }}' == 'Windows' ]]; then - cp */BitwardenClient.* artifacts - cp ../include/bitwarden_c.{lib,dll.lib,dll} artifacts - fi - - - name: Upload C++ package for ${{ matrix.settings.target }} - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 - with: - name: libbitwarden_cpp-${{ matrix.settings.target }} - path: languages/cpp/build/artifacts - if-no-files-found: error diff --git a/.github/workflows/build-dotnet.yml b/.github/workflows/build-dotnet.yml deleted file mode 100644 index bb5d56b6..00000000 --- a/.github/workflows/build-dotnet.yml +++ /dev/null @@ -1,99 +0,0 @@ -name: Build .NET SDK - -on: - push: - branches: - - main - - rc - - hotfix-rc - pull_request: - workflow_dispatch: - -jobs: - generate_schemas: - uses: ./.github/workflows/generate_schemas.yml - - build_rust: - uses: ./.github/workflows/build-rust-cross-platform.yml - - version: - name: Get version - runs-on: ubuntu-22.04 - outputs: - version: ${{ steps.version.outputs.version }} - steps: - - name: Checkout repo - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - - - name: Install xmllint - run: sudo apt-get install -y libxml2-utils - - - name: Get version - id: version - run: | - VERSION=$(xmllint --xpath 'string(/Project/PropertyGroup/Version)' languages/csharp/Bitwarden.Sdk/Bitwarden.Sdk.csproj) - echo "version=$VERSION" >> $GITHUB_OUTPUT - - build_dotnet: - name: Build .NET - runs-on: ubuntu-22.04 - needs: - - generate_schemas - - build_rust - - version - - steps: - - name: Checkout Repository - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - - - name: Download C# schemas artifact - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 - with: - name: schemas.cs - path: languages/csharp/Bitwarden.Sdk - - - name: Set up .NET Core - uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4.0.1 - with: - global-json-file: languages/csharp/global.json - - - name: Download x86_64-apple-darwin files - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 - with: - name: libbitwarden_c_files-x86_64-apple-darwin - path: languages/csharp/Bitwarden.Sdk/macos-x64 - - - name: Download aarch64-apple-darwin files - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 - with: - name: libbitwarden_c_files-aarch64-apple-darwin - path: languages/csharp/Bitwarden.Sdk/macos-arm64 - - - name: Download x86_64-unknown-linux-gnu files - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 - with: - name: libbitwarden_c_files-x86_64-unknown-linux-gnu - path: languages/csharp/Bitwarden.Sdk/linux-x64 - - - name: Download x86_64-pc-windows-msvc files - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 - with: - name: libbitwarden_c_files-x86_64-pc-windows-msvc - path: languages/csharp/Bitwarden.Sdk/windows-x64 - - - name: Build .NET Project - working-directory: languages/csharp/Bitwarden.Sdk - run: | - dotnet restore - dotnet build --configuration Release - - - name: Pack NuGet Package - run: dotnet pack --configuration Release --output ./nuget-output /nologo /v:n - working-directory: languages/csharp/Bitwarden.Sdk - - - name: Upload NuGet package - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 - with: - name: Bitwarden.Sdk.${{ needs.version.outputs.version }}.nupkg - path: | - ./languages/csharp/Bitwarden.Sdk/nuget-output/*.nupkg diff --git a/.github/workflows/build-go.yaml b/.github/workflows/build-go.yaml deleted file mode 100644 index ffb4d669..00000000 --- a/.github/workflows/build-go.yaml +++ /dev/null @@ -1,49 +0,0 @@ -name: Build Go SDK - -on: - push: - branches: - - main - - rc - - hotfix-rc - - pull_request: - -env: - GO111MODULE: on - GO_VERSION: "^1.21" - -jobs: - build: - name: Build - runs-on: ubuntu-22.04 - steps: - - name: Checkout Repository - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - - - name: Setup Go environment - uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 - with: - go-version: ${{ env.GO_VERSION }} - - - name: Cache dependencies - uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 - with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} - restore-keys: | - ${{ runner.os }}-go- - - - name: npm ci - run: npm ci - - - name: Generate schemas - run: npm run schemas - - - name: Build - working-directory: languages/go - run: go build -v ./... - - - name: Test - working-directory: languages/go - run: go test -v ./... diff --git a/.github/workflows/build-java.yml b/.github/workflows/build-java.yml deleted file mode 100644 index 6994a5a6..00000000 --- a/.github/workflows/build-java.yml +++ /dev/null @@ -1,88 +0,0 @@ ---- -name: Build Java SDK - -on: - push: - branches: - - main - pull_request: - workflow_dispatch: - -jobs: - generate_schemas: - uses: ./.github/workflows/generate_schemas.yml - - build_rust: - uses: ./.github/workflows/build-rust-cross-platform.yml - - build_java: - name: Build Java - runs-on: ubuntu-22.04 - needs: - - generate_schemas - - build_rust - - steps: - - name: Checkout Repository - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - - - name: Download Java schemas artifact - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 - with: - name: sdk-schemas-java - path: languages/java/src/main/java/bit/sdk/schema/ - - - name: Setup Java - uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4.4.0 - with: - distribution: temurin - java-version: 17 - - - name: Download x86_64-apple-darwin files - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 - with: - name: libbitwarden_c_files-x86_64-apple-darwin - path: languages/java/src/main/resources/darwin-x86-64 - - - name: Download aarch64-apple-darwin files - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 - with: - name: libbitwarden_c_files-aarch64-apple-darwin - path: languages/java/src/main/resources/darwin-aarch64 - - - name: Download x86_64-unknown-linux-gnu files - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 - with: - name: libbitwarden_c_files-x86_64-unknown-linux-gnu - path: languages/java/src/main/resources/linux-x86-64 - - - name: Download x86_64-pc-windows-msvc files - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 - with: - name: libbitwarden_c_files-x86_64-pc-windows-msvc - path: languages/java/src/main/resources/win32-x86-64 - - - name: Build Maven - run: ./gradlew build - working-directory: languages/java - - - name: Upload Java SDK Build - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 - with: - name: build - path: ${{ github.workspace }}/languages/java/build - if-no-files-found: error - - - name: Upload Java SDK Build - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 - with: - name: resources - path: ${{ github.workspace }}/languages/java/src/main/resources - if-no-files-found: error - - - name: Upload Java SDK Build - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 - with: - name: schemas - path: languages/java/src/main/java/bit/sdk/schema - if-no-files-found: error diff --git a/.github/workflows/build-napi.yml b/.github/workflows/build-napi.yml deleted file mode 100644 index 41ed1d17..00000000 --- a/.github/workflows/build-napi.yml +++ /dev/null @@ -1,91 +0,0 @@ ---- -name: Build @bitwarden/sdk-napi - -on: - pull_request: - push: - branches: - - "main" - - "rc" - - "hotfix-rc" - workflow_dispatch: - -defaults: - run: - shell: bash - working-directory: crates/bitwarden-napi - -jobs: - generate_schemas: - uses: ./.github/workflows/generate_schemas.yml - - build: - name: Building @bitwarden/sdk-napi for - ${{ matrix.settings.os }} - runs-on: ${{ matrix.settings.os || 'ubuntu-latest' }} - needs: generate_schemas - strategy: - fail-fast: false - matrix: - settings: - - os: macos-13 - target: x86_64-apple-darwin - build: | - npm run build - strip -x *.node - - - os: macos-13 - target: aarch64-apple-darwin - build: | - npm run build-arm64 - strip -x *.node - - - os: windows-2022 - target: x86_64-pc-windows-msvc - build: npm run build - - - os: ubuntu-22.04 - target: x86_64-unknown-linux-gnu - build: | - set -e && - npm run build && - strip *.node - steps: - - name: Checkout repo - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - - - name: Setup Node - uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4 - with: - node-version: 18 - cache: "npm" - cache-dependency-path: crates/bitwarden-napi/package-lock.json - - - name: Install rust - uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # stable - with: - toolchain: stable - targets: ${{ matrix.settings.target }} - - - name: Cache cargo registry - uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3 - with: - key: ${{ matrix.settings.target }}-cargo-${{ matrix.settings.os }} - - - name: Retrieve schemas - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 - with: - name: schemas.ts - path: ${{ github.workspace }}/crates/bitwarden-napi/src-ts/bitwarden_client/ - - - name: Install dependencies - run: npm ci - - - name: Build - run: ${{ matrix.settings.build }} - - - name: Upload artifact - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 - with: - name: sdk-bitwarden-napi-${{ matrix.settings.target }} - path: ${{ github.workspace }}/crates/bitwarden-napi/sdk-napi.*.node - if-no-files-found: error diff --git a/.github/workflows/build-python-wheels.yml b/.github/workflows/build-python-wheels.yml deleted file mode 100644 index b3919567..00000000 --- a/.github/workflows/build-python-wheels.yml +++ /dev/null @@ -1,122 +0,0 @@ ---- -name: Build Python Wheels - -on: - pull_request: - push: - branches: - - "main" - - "rc" - - "hotfix-rc" - workflow_dispatch: - -defaults: - run: - shell: bash - working-directory: languages/python - -jobs: - generate_schemas: - uses: ./.github/workflows/generate_schemas.yml - - setup: - name: Setup - runs-on: ubuntu-22.04 - outputs: - package_version: ${{ steps.retrieve-version.outputs.package_version }} - steps: - - name: Checkout repo - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - - - name: Get Package Version - id: retrieve-version - run: | - VERSION="$(grep -o '^version = ".*"' ../../crates/bitwarden-py/Cargo.toml | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+")" - echo "package_version=$VERSION" >> $GITHUB_OUTPUT - - build: - name: Building Python wheel for - ${{ matrix.settings.os }} - ${{ matrix.settings.target }} - runs-on: ${{ matrix.settings.os || 'ubuntu-latest' }} - needs: - - generate_schemas - - setup - env: - _PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }} - strategy: - fail-fast: false - matrix: - settings: - - os: macos-13 - target: x86_64-apple-darwin - - - os: macos-13 - target: aarch64-apple-darwin - - - os: windows-2022 - target: x86_64-pc-windows-msvc - - - os: ubuntu-22.04 - target: x86_64-unknown-linux-gnu - - - os: ubuntu-22.04 - target: aarch64-unknown-linux-gnu - - steps: - - name: Checkout repo - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - - - name: Setup Node - uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4 - with: - node-version: 18 - - - name: Install rust - uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # stable - with: - toolchain: stable - targets: ${{ matrix.settings.target }} - - - name: Cache cargo registry - uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3 - with: - key: ${{ matrix.settings.target }}-cargo-${{ matrix.settings.os }} - - - name: Retrieve schemas - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 - with: - name: schemas.py - path: ${{ github.workspace }}/languages/python/bitwarden_sdk - - - name: Build wheels - if: ${{ matrix.settings.target != 'x86_64-unknown-linux-gnu' }} - uses: PyO3/maturin-action@2c5c1560848aaa364c3545136054932db5fa27b7 # v1.44.0 - with: - target: ${{ matrix.settings.target }} - args: --release --find-interpreter --sdist - sccache: "true" - manylinux: "2_28" # https://github.com/pola-rs/polars/pull/12211 - working-directory: ${{ github.workspace }}/languages/python - - - name: Build wheels (Linux - x86_64) - if: ${{ matrix.settings.target == 'x86_64-unknown-linux-gnu' }} - uses: PyO3/maturin-action@2c5c1560848aaa364c3545136054932db5fa27b7 # v1.44.0 - with: - target: ${{ matrix.settings.target }} - args: --release --find-interpreter --sdist - container: quay.io/pypa/manylinux_2_28_x86_64:2023-11-20-745eb52 - sccache: "true" - manylinux: "2_28" # https://github.com/pola-rs/polars/pull/12211 - working-directory: ${{ github.workspace }}/languages/python - - - name: Upload wheels - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 - with: - name: bitwarden_sdk-${{ env._PACKAGE_VERSION }}-${{ matrix.settings.target }} - path: ${{ github.workspace }}/target/wheels/bitwarden_sdk*.whl - - - name: Upload sdists - if: ${{ matrix.settings.target == 'x86_64-unknown-linux-gnu' }} # we only need one sdist - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 - with: - name: bitwarden_sdk-${{ env._PACKAGE_VERSION }}-sdist - path: ${{ github.workspace }}/target/wheels/bitwarden_sdk-*.tar.gz diff --git a/.github/workflows/build-ruby.yml b/.github/workflows/build-ruby.yml deleted file mode 100644 index 5a3f1a01..00000000 --- a/.github/workflows/build-ruby.yml +++ /dev/null @@ -1,95 +0,0 @@ ---- -name: Build Ruby - -on: - pull_request: - push: - branches: - - "main" - workflow_dispatch: - -jobs: - build: - name: Build Ruby - runs-on: ubuntu-22.04 - steps: - - name: Checkout Repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - - name: Set up Ruby - uses: ruby/setup-ruby@52753b7da854d5c07df37391a986c76ab4615999 # v1.191.0 - with: - ruby-version: 3.2 - - - name: Download artifacts - uses: bitwarden/gh-actions/download-artifacts@main - with: - workflow: generate_schemas.yml - path: languages/ruby/bitwarden_sdk_secrets/lib - workflow_conclusion: success - branch: ${{ github.ref_name }} - artifacts: schemas.rb - - - name: Download x86_64-apple-darwin artifact - uses: bitwarden/gh-actions/download-artifacts@main - with: - workflow: build-rust-cross-platform.yml - path: temp/macos-x64 - workflow_conclusion: success - branch: ${{ github.ref_name }} - artifacts: libbitwarden_c_files-x86_64-apple-darwin - - - name: Download aarch64-apple-darwin artifact - uses: bitwarden/gh-actions/download-artifacts@main - with: - workflow: build-rust-cross-platform.yml - workflow_conclusion: success - branch: ${{ github.ref_name }} - artifacts: libbitwarden_c_files-aarch64-apple-darwin - path: temp/macos-arm64 - - - name: Download x86_64-unknown-linux-gnu artifact - uses: bitwarden/gh-actions/download-artifacts@main - with: - workflow: build-rust-cross-platform.yml - workflow_conclusion: success - branch: ${{ github.ref_name }} - artifacts: libbitwarden_c_files-x86_64-unknown-linux-gnu - path: temp/linux-x64 - - - name: Download x86_64-pc-windows-msvc artifact - uses: bitwarden/gh-actions/download-artifacts@main - with: - workflow: build-rust-cross-platform.yml - workflow_conclusion: success - branch: ${{ github.ref_name }} - artifacts: libbitwarden_c_files-x86_64-pc-windows-msvc - path: temp/windows-x64 - - - name: Copy lib files - run: | - mkdir -p languages/ruby/bitwarden_sdk_secrets/lib/macos-arm64 - mkdir -p languages/ruby/bitwarden_sdk_secrets/lib/linux-x64 - mkdir -p languages/ruby/bitwarden_sdk_secrets/lib/macos-x64 - mkdir -p languages/ruby/bitwarden_sdk_secrets/lib/windows-x64 - - platforms=("macos-arm64" "linux-x64" "macos-x64" "windows-x64") - files=("libbitwarden_c.dylib" "libbitwarden_c.so" "libbitwarden_c.dylib" "bitwarden_c.dll") - - for ((i=0; i<${#platforms[@]}; i++)); do - cp "temp/${platforms[$i]}/${files[$i]}" "languages/ruby/bitwarden_sdk_secrets/lib/${platforms[$i]}/${files[$i]}" - done - - - name: bundle install - run: bundle install - working-directory: languages/ruby/bitwarden_sdk_secrets - - - name: Build gem - run: gem build bitwarden-sdk-secrets.gemspec - working-directory: languages/ruby/bitwarden_sdk_secrets - - - name: Upload artifact - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 - with: - path: bitwarden-sdk-secrets-*.gem - name: bitwarden-sdk-secrets diff --git a/.github/workflows/build-rust-cross-platform.yml b/.github/workflows/build-rust-cross-platform.yml deleted file mode 100644 index 1748661b..00000000 --- a/.github/workflows/build-rust-cross-platform.yml +++ /dev/null @@ -1,95 +0,0 @@ -name: Build Rust Cross Platform - -on: - workflow_call: - workflow_dispatch: - push: - branches: - - main - - rc - - hotfix-rc - pull_request: - -jobs: - build_rust: - name: Build for ${{ matrix.settings.os }} ${{ matrix.settings.target }} - runs-on: ${{ matrix.settings.os }} - strategy: - fail-fast: false - matrix: - settings: - - os: macos-13 - target: x86_64-apple-darwin - - os: macos-13 - target: aarch64-apple-darwin - - os: windows-2022 - target: x86_64-pc-windows-msvc - - os: windows-2022 - target: x86_64-pc-windows-gnu - # caution: updating the linux runner OS version for GNU - # targets will likely break libbitwarden_c for older OS versions. - # prefer using oldest supported runner for for these targets - - os: ubuntu-22.04 - target: x86_64-unknown-linux-gnu - - os: ubuntu-22.04 - target: x86_64-unknown-linux-musl - - os: ubuntu-22.04 - target: aarch64-unknown-linux-musl - - steps: - - name: Checkout - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - - - name: Install rust - uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # stable - with: - toolchain: stable - - - name: Cache cargo registry - uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3 - - - uses: goto-bus-stop/setup-zig@abea47f85e598557f500fa1fd2ab7464fcb39406 # v2.2.1 - if: ${{ contains(matrix.settings.target, 'musl') }} - with: - version: 0.12.0 - - - name: Install Zigbuild - if: ${{ contains(matrix.settings.target, 'musl') }} - run: cargo install cargo-zigbuild --locked --git https://github.com/rust-cross/cargo-zigbuild --rev 6f7e1336c9cd13cf1b3704f93c40fcf84caaed6b # 0.18.4 - - - name: Add build architecture - run: rustup target add ${{ matrix.settings.target }} - - # Build Rust for musl - - name: Build Rust for - ${{ matrix.settings.target }} - if: ${{ contains(matrix.settings.target, 'musl') }} - env: - RUSTFLAGS: "-D warnings" - run: cargo zigbuild -p bitwarden-c --target ${{ matrix.settings.target }} --release - - # Build Rust for windows-gnu - - name: Build Rust for - ${{ matrix.settings.target }} - if: ${{ matrix.settings.target == 'x86_64-pc-windows-gnu' }} - env: - RUSTFLAGS: "-D warnings" - run: cargo build -p bitwarden-c --target ${{ matrix.settings.target }} --profile=release-windows - - # Build Rust for !musl && !windows-gnu - - name: Build Rust for - ${{ matrix.settings.target }} - if: ${{ !contains(matrix.settings.target, 'musl') && matrix.settings.target != 'x86_64-pc-windows-gnu' }} - env: - RUSTFLAGS: "-D warnings" - MACOSX_DEPLOYMENT_TARGET: "10.14" # allows using new macos runner versions while still supporting older systems - run: cargo build -p bitwarden-c --target ${{ matrix.settings.target }} --release - - - name: Upload Artifact - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 - with: - name: libbitwarden_c_files-${{ matrix.settings.target }} - path: target/${{ matrix.settings.target }}/release/*bitwarden_c* - - - name: Upload Artifact - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 - with: - name: libbitwarden_c_files-${{ matrix.settings.target }} - path: target/${{ matrix.settings.target }}/release-windows/*bitwarden_c* diff --git a/.github/workflows/build-wasm.yml b/.github/workflows/build-wasm.yml deleted file mode 100644 index 35c0ca6b..00000000 --- a/.github/workflows/build-wasm.yml +++ /dev/null @@ -1,76 +0,0 @@ ---- -name: Build @bitwarden/sdk-wasm - -on: - pull_request: - push: - branches: - - "main" - - "rc" - - "hotfix-rc" - workflow_dispatch: - -defaults: - run: - shell: bash - working-directory: crates/bitwarden-wasm - -jobs: - build: - name: Building @bitwarden/sdk-wasm - runs-on: ubuntu-22.04 - - steps: - - name: Checkout repo - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - - - name: Setup Node - uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4 - with: - node-version: 18 - registry-url: "https://npm.pkg.github.com" - cache: "npm" - - - name: Install dependencies - run: npm i -g binaryen - - - name: Install rust - uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # stable - with: - toolchain: stable - targets: wasm32-unknown-unknown - - - name: Cache cargo registry - uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3 - with: - key: wasm-cargo-cache - - - name: Install wasm-bindgen-cli - run: cargo install wasm-bindgen-cli - - - name: Build - run: ./build.sh -r - - - name: Upload artifact - uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 - with: - name: sdk-bitwarden-wasm - path: ${{ github.workspace }}/languages/js/wasm/* - if-no-files-found: error - - - name: Set version - if: ${{ github.ref == 'refs/heads/main' }} - # Fetches current version from registry and uses prerelease to bump it - run: | - npm version --no-git-tag-version $(npm view @bitwarden/sdk-wasm@latest version) - npm version --no-git-tag-version prerelease - env: - NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - working-directory: languages/js/wasm - - - name: Publish NPM - if: ${{ github.ref == 'refs/heads/main' }} - run: npm publish --access public - env: - NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - working-directory: languages/js/wasm diff --git a/.github/workflows/publish-bws.yml b/.github/workflows/publish-bws.yml deleted file mode 100644 index dc939a5d..00000000 --- a/.github/workflows/publish-bws.yml +++ /dev/null @@ -1,215 +0,0 @@ ---- -name: Publish bws CLI -run-name: Publish bws CLI ${{ inputs.release_type }} - -on: - workflow_dispatch: - inputs: - release_type: - description: "Release Options" - required: true - default: "Release" - type: choice - options: - - Release - - Dry Run - version: - description: "Version to publish (default: latest bws cli release)" - required: true - type: string - default: latest - -env: - _AZ_REGISTRY: bitwardenprod.azurecr.io - -jobs: - setup: - name: Setup - runs-on: ubuntu-22.04 - outputs: - release-version: ${{ steps.version-output.outputs.version }} - release-tag: ${{ steps.version-output.outputs.tag_name }} - deployment-id: ${{ steps.deployment.outputs.deployment_id }} - steps: - - name: Checkout repo - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - - - name: Branch check - if: ${{ inputs.release_type != 'Dry Run' }} - run: | - if [[ "$GITHUB_REF" != "refs/heads/main" ]]; then - echo "===================================" - echo "[!] Can only release from the 'main' branch" - echo "===================================" - exit 1 - fi - - - name: Version output - id: version-output - run: | - if [[ "${{ inputs.version }}" == "latest" || "${{ inputs.version }}" == "" ]]; then - TAG_NAME=$(curl "https://api.github.com/repos/bitwarden/sdk/releases" | jq -c '.[] | select(.tag_name | contains("bws")) | .tag_name' | head -1) - VERSION=$(echo $TAG_NAME | grep -ohE '20[0-9]{2}\.([1-9]|1[0-2])\.[0-9]+') - echo "Latest Released Version: $VERSION" - echo "version=$VERSION" >> $GITHUB_OUTPUT - - echo "Latest Released Tag name: $TAG_NAME" - echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT - else - echo "Release Version: ${{ inputs.version }}" - echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT - fi - - - name: Create GitHub deployment - if: ${{ inputs.release_type != 'Dry Run' }} - uses: chrnorm/deployment-action@55729fcebec3d284f60f5bcabbd8376437d696b1 # v2.0.7 - id: deployment - with: - token: "${{ secrets.GITHUB_TOKEN }}" - initial-status: "in_progress" - environment: "bws CLI - Production" - description: "Deployment ${{ steps.version-output.outputs.version }} from branch ${{ github.ref_name }}" - task: release - - publish: - name: Publish bws to crates.io - runs-on: ubuntu-22.04 - needs: setup - env: - _VERSION: ${{ needs.setup.outputs.release-version }} - _TAG_NAME: ${{ needs.setup.outputs.release-tag }} - steps: - - name: Checkout - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - - - name: Login to Azure - uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0 - with: - creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }} - ref: ${{ env._TAG_NAME }} - - - name: Retrieve secrets - id: retrieve-secrets - uses: bitwarden/gh-actions/get-keyvault-secrets@main - with: - keyvault: "bitwarden-ci" - secrets: "cratesio-api-token" - - - name: Install rust - uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # stable - with: - toolchain: stable - - - name: Cache cargo registry - uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3 - - - name: Install cargo-release - run: cargo install cargo-release - - - name: Cargo release - if: ${{ inputs.release_type != 'Dry Run' }} - env: - PUBLISH_GRACE_SLEEP: 10 - CARGO_REGISTRY_TOKEN: ${{ steps.retrieve-secrets.outputs.cratesio-api-token }} - run: cargo-release release publish -p bws --execute --no-confirm - - publish-docker: - name: Publish docker versioned and latest image - runs-on: ubuntu-22.04 - needs: setup - steps: - - name: Checkout - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - with: - ref: ${{ env._TAG_NAME }} - - - name: Generate tag list - id: tag-list - env: - VERSION: ${{ needs.setup.outputs.release-version }} - DRY_RUN: ${{ inputs.release_type == 'Dry Run' }} - run: | - if [[ "${DRY_RUN}" == "true" ]]; then - REF=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}} - IMAGE_TAG=$(echo "${REF}" | sed "s#/#-#g") # slash safe branch name - echo "tags=$_AZ_REGISTRY/bws:${IMAGE_TAG},bitwarden/bws:${IMAGE_TAG}" >> $GITHUB_OUTPUT - else - echo "tags=$_AZ_REGISTRY/bws:${VERSION},bitwarden/bws:${VERSION},$_AZ_REGISTRY/bws:latest,bitwarden/bws:latest" >> $GITHUB_OUTPUT - fi - - ########## Set up Docker ########## - - name: Set up QEMU emulators - uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1 - - ########## Login to Docker registries ########## - - name: Login to Azure - Prod Subscription - uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0 - with: - creds: ${{ secrets.AZURE_PROD_KV_CREDENTIALS }} - - - name: Login to Azure ACR - run: az acr login -n ${_AZ_REGISTRY%.azurecr.io} - - - name: Login to Azure - CI Subscription - uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0 - with: - creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }} - - - name: Retrieve github PAT secrets - id: retrieve-secret-pat - uses: bitwarden/gh-actions/get-keyvault-secrets@main - with: - keyvault: "bitwarden-ci" - secrets: "github-pat-bitwarden-devops-bot-repo-scope" - - - name: Setup Docker Trust - uses: bitwarden/gh-actions/setup-docker-trust@main - with: - azure-creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }} - azure-keyvault-name: "bitwarden-ci" - - - name: Build and push Docker image - uses: docker/build-push-action@32945a339266b759abcbdc89316275140b0fc960 # v6.8.0 - with: - context: . - file: crates/bws/Dockerfile - platforms: | - linux/amd64, - linux/arm64/v8 - push: ${{ inputs.release_type != 'Dry Run' }} - tags: ${{ steps.tag-list.outputs.tags }} - secrets: | - "GH_PAT=${{ steps.retrieve-secret-pat.outputs.github-pat-bitwarden-devops-bot-repo-scope }}" - - - name: Log out of Docker and disable Docker Notary - if: ${{ inputs.release_type != 'Dry Run' }} - run: | - docker logout - echo "DOCKER_CONTENT_TRUST=0" >> $GITHUB_ENV - - update_release_status: - name: Update GitHub deployment status - runs-on: ubuntu-22.04 - needs: setup - if: ${{ inputs.release_type != 'Dry Run' }} - env: - _DEPLOYMENT_ID: ${{ needs.setup.outputs.deployment-id }} - steps: - - name: Update deployment status to Success - if: ${{ inputs.release_type != 'Dry Run' && success() }} - uses: chrnorm/deployment-status@9a72af4586197112e0491ea843682b5dc280d806 # v2.0.3 - with: - token: "${{ secrets.GITHUB_TOKEN }}" - state: "success" - deployment-id: ${{ env._DEPLOYMENT_ID }} - - - name: Update deployment status to Failure - if: ${{ inputs.release_type != 'Dry Run' && failure() }} - uses: chrnorm/deployment-status@9a72af4586197112e0491ea843682b5dc280d806 # v2.0.3 - with: - token: "${{ secrets.GITHUB_TOKEN }}" - state: "failure" - deployment-id: ${{ env._DEPLOYMENT_ID }} diff --git a/.github/workflows/publish-dotnet.yml b/.github/workflows/publish-dotnet.yml deleted file mode 100644 index 1e2fc06f..00000000 --- a/.github/workflows/publish-dotnet.yml +++ /dev/null @@ -1,113 +0,0 @@ -name: Publish .NET NuGet -run-name: Publish .NET NuGet Package ${{ inputs.release_type }} - -on: - workflow_dispatch: - inputs: - release_type: - description: "Release Options" - required: true - default: "Release" - type: choice - options: - - Release - - Dry Run - version: - description: "Release Version" - required: false - default: "latest" - -env: - _KEY_VAULT: "bitwarden-ci" - -jobs: - validate: - name: Setup - runs-on: ubuntu-22.04 - outputs: - version: ${{ steps.version-output.outputs.version }} - steps: - - name: Checkout repo - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - - - name: Branch check - if: ${{ inputs.release_type != 'Dry Run' }} - run: | - if [[ "$GITHUB_REF" != "refs/heads/main" ]]; then - echo "===================================" - echo "[!] Can only release from the 'main' branch" - echo "===================================" - exit 1 - fi - - - name: Version output - id: version-output - run: | - if [[ "${{ inputs.version }}" == "latest" || "${{ inputs.version }}" == "" ]]; then - TAG_NAME=$(curl "https://api.github.com/repos/bitwarden/sdk/releases" | jq -c '.[] | select(.tag_name | contains("dotnet")) | .tag_name' | head -1) - VERSION=$(echo $TAG_NAME | grep -ohE '20[0-9]{2}\.([1-9]|1[0-2])\.[0-9]+') - echo "Latest Released Version: $VERSION" - echo "version=$VERSION" >> $GITHUB_OUTPUT - - echo "Latest Released Tag name: $TAG_NAME" - echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT - else - echo "Release Version: ${{ inputs.version }}" - echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT - fi - - deploy: - name: Deploy - runs-on: ubuntu-22.04 - needs: validate - steps: - - name: Create GitHub deployment - if: ${{ inputs.release_type != 'Dry Run' }} - uses: chrnorm/deployment-action@55729fcebec3d284f60f5bcabbd8376437d696b1 # v2.0.7 - id: deployment - with: - token: "${{ secrets.GITHUB_TOKEN }}" - initial-status: "in_progress" - environment: "dotnet - Production" - description: "Deployment ${{ needs.validate.outputs.version }} from branch ${{ github.ref_name }}" - task: release - - - name: Download artifact - run: | - mkdir -p nuget-output - cd nuget-output - wget https://github.com/bitwarden/sdk/releases/download/dotnet-v${{ needs.validate.outputs.version }}/Bitwarden.Sdk.${{ needs.validate.outputs.version }}.nupkg - - - name: Login to Azure - Prod Subscription - uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0 - with: - creds: ${{ secrets.AZURE_CI_SERVICE_PRINCIPAL }} - - - name: Retrieve secrets - id: retrieve-secrets - uses: bitwarden/gh-actions/get-keyvault-secrets@main - with: - keyvault: ${{ env._KEY_VAULT }} - secrets: "nuget-api-key" - - - name: Publish NuGet Package - if: ${{ inputs.release_type != 'Dry Run' }} - env: - NUGET_API_KEY: ${{ steps.retrieve-secrets.outputs.nuget-api-key }} - run: dotnet nuget push ./nuget-output/*.nupkg -k ${{ env.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json - - - name: Update deployment status to Success - if: ${{ inputs.release_type != 'Dry Run' && success() }} - uses: chrnorm/deployment-status@9a72af4586197112e0491ea843682b5dc280d806 # v2.0.3 - with: - token: "${{ secrets.GITHUB_TOKEN }}" - state: "success" - deployment-id: ${{ steps.deployment.outputs.deployment_id }} - - - name: Update deployment status to Failure - if: ${{ inputs.release_type != 'Dry Run' && failure() }} - uses: chrnorm/deployment-status@9a72af4586197112e0491ea843682b5dc280d806 # v2.0.3 - with: - token: "${{ secrets.GITHUB_TOKEN }}" - state: "failure" - deployment-id: ${{ steps.deployment.outputs.deployment_id }} diff --git a/.github/workflows/publish-java.yml b/.github/workflows/publish-java.yml deleted file mode 100644 index 002a61ee..00000000 --- a/.github/workflows/publish-java.yml +++ /dev/null @@ -1,128 +0,0 @@ ---- -name: Publish Java SDK -run-name: Publish Java SDK ${{ inputs.release_type }} - -on: - workflow_dispatch: - inputs: - release_type: - description: "Release Options" - required: true - default: "Release" - type: choice - options: - - Release - - Dry Run - version: - description: "Release Version" - required: false - default: "latest" - -defaults: - run: - shell: bash - working-directory: languages/java - -env: - _KEY_VAULT: "bitwarden-ci" - -jobs: - validate: - name: Setup - runs-on: ubuntu-22.04 - outputs: - version: ${{ steps.version-output.outputs.version }} - tag_name: ${{ steps.version-output.outputs.tag_name }} - steps: - - name: Checkout repo - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - - - name: Branch check - if: ${{ inputs.release_type != 'Dry Run' }} - run: | - if [[ "$GITHUB_REF" != "refs/heads/main" ]]; then - echo "===================================" - echo "[!] Can only release from the 'main' branch" - echo "===================================" - exit 1 - fi - - - name: Version output - id: version-output - run: | - if [[ "${{ inputs.version }}" == "latest" || "${{ inputs.version }}" == "" ]]; then - TAG_NAME=$(curl "https://api.github.com/repos/bitwarden/sdk/releases" | jq -c '.[] | select(.tag_name | contains("java")) | .tag_name' | head -1) - VERSION=$(echo $TAG_NAME | grep -ohE '20[0-9]{2}\.([1-9]|1[0-2])\.[0-9]+') - echo "Latest Released Version: $VERSION" - echo "version=$VERSION" >> $GITHUB_OUTPUT - - echo "Latest Released Tag name: $TAG_NAME" - echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT - else - echo "Release Version: ${{ inputs.version }}" - echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT - fi - - publish: - name: Publish - runs-on: ubuntu-22.04 - needs: validate - steps: - - name: Checkout Repository - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - with: - ref: ${{ needs.validate.outputs.tag_name }} - - - name: Azure login - uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0 - with: - creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }} - - - name: Retrieve secrets - id: retrieve-secrets - uses: bitwarden/gh-actions/get-keyvault-secrets@main - with: - keyvault: ${{ env._KEY_VAULT }} - secrets: "maven-sonartype-ssrh-username, - maven-sonartype-ossrh-password" - - - name: Setup java - uses: actions/setup-java@b36c23c0d998641eff861008f374ee103c25ac73 # v4.4.0 - with: - distribution: temurin - java-version: 17 - - - name: Setup Gradle - uses: gradle/actions/setup-gradle@d156388eb19639ec20ade50009f3d199ce1e2808 # v4.1.0 - - - name: Download Java SDK Build - uses: bitwarden/gh-actions/download-artifacts@main - with: - workflow: build-java.yml - workflow_conclusion: success - artifacts: build - path: languages/java/build - - - name: Download Java Resources - uses: bitwarden/gh-actions/download-artifacts@main - with: - workflow: build-java.yml - workflow_conclusion: success - artifacts: resources - path: languages/java/src/main/resources - - - name: Download Java Resources - uses: bitwarden/gh-actions/download-artifacts@main - with: - workflow: build-java.yml - workflow_conclusion: success - artifacts: schemas - path: languages/java/src/main/java/bit/sdk/schema - - - name: Publish package to GitHub Packages - if: ${{ inputs.release_type != 'Dry Run' }} - run: ./gradlew publish - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - MAVEN_USERNAME: ${{ steps.retrieve-secrets.outputs.maven-sonartype-ssrh-username }} - MAVEN_PASSWORD: ${{ steps.retrieve-secrets.outputs.maven-sonartype-ossrh-password }} diff --git a/.github/workflows/publish-napi.yml b/.github/workflows/publish-napi.yml deleted file mode 100644 index 6a284d4a..00000000 --- a/.github/workflows/publish-napi.yml +++ /dev/null @@ -1,155 +0,0 @@ ---- -name: Publish @bitwarden/sdk-napi -run-name: Publish @bitwarden/sdk-napi ${{ inputs.release_type }} - -on: - workflow_dispatch: - inputs: - release_type: - description: "Release Options" - required: true - default: "Release" - type: choice - options: - - Release - - Dry Run - version: - description: "Release Version" - required: false - default: "latest" - -defaults: - run: - working-directory: crates/bitwarden-napi - -jobs: - setup: - name: Setup - runs-on: ubuntu-22.04 - outputs: - release-version: ${{ steps.version-output.outputs.version }} - tag-name: ${{ steps.version-output.outputs.tag_name }} - steps: - - name: Checkout repo - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - - name: Branch check - if: ${{ inputs.release_type != 'Dry Run' }} - run: | - if [[ "$GITHUB_REF" != "refs/heads/main" ]]; then - echo "===================================" - echo "[!] Can only release from the 'main' branch" - echo "===================================" - exit 1 - fi - - - name: Version output - id: version-output - run: | - if [[ "${{ inputs.version }}" == "latest" || "${{ inputs.version }}" == "" ]]; then - TAG_NAME=$(curl "https://api.github.com/repos/bitwarden/sdk/releases" | jq -c '.[] | select(.tag_name | contains("napi")) | .tag_name' | head -1) - VERSION=$(echo $TAG_NAME | grep -ohE '20[0-9]{2}\.([1-9]|1[0-2])\.[0-9]+') - echo "Latest Released Version: $VERSION" - echo "version=$VERSION" >> $GITHUB_OUTPUT - - echo "Latest Released Tag name: $TAG_NAME" - echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT - else - echo "Release Version: ${{ inputs.version }}" - echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT - fi - - npm: - name: Publish NPM - runs-on: ubuntu-22.04 - needs: setup - env: - _PKG_VERSION: ${{ needs.setup.outputs.release-version }} - _TAG_NAME: ${{ needs.setup.outputs.tag-name }} - steps: - - name: Checkout repo - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - with: - ref: ${{ env._TAG_NAME }} - - - name: Create GitHub deployment - if: ${{ inputs.release_type != 'Dry Run' }} - uses: chrnorm/deployment-action@55729fcebec3d284f60f5bcabbd8376437d696b1 # v2.0.7 - id: deployment - with: - token: "${{ secrets.GITHUB_TOKEN }}" - initial-status: "in_progress" - environment: "Bitwarden SDK NAPI - Production" - description: "Deployment ${{ env._PKG_VERSION }} from branch ${{ github.ref_name }}" - task: release - - - name: Setup Node - uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 - with: - node-version: 18 - cache: "npm" - cache-dependency-path: crates/bitwarden-napi/package-lock.json - - - name: Download schemas.ts artifact - run: | - wget https://github.com/bitwarden/sdk/releases/download/napi-v${{ env._PKG_VERSION }}/schemas.ts - mv schemas.ts ${{ github.workspace }}/crates/bitwarden-napi/src-ts/bitwarden_client/schemas.ts - - - name: Install dependencies - run: npm ci - - - name: Run tsc - run: npm run tsc - - - name: Login to Azure - uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0 - with: - creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }} - - - name: Retrieve secrets - id: retrieve-secrets - uses: bitwarden/gh-actions/get-keyvault-secrets@main - with: - keyvault: "bitwarden-ci" - secrets: "npm-api-key" - - - name: Download sdk-napi artifacts - run: | - wget https://github.com/bitwarden/sdk/releases/download/napi-v${{ env._PKG_VERSION }}/sdk-napi.darwin-arm64.node - wget https://github.com/bitwarden/sdk/releases/download/napi-v${{ env._PKG_VERSION }}/sdk-napi.darwin-x64.node - wget https://github.com/bitwarden/sdk/releases/download/napi-v${{ env._PKG_VERSION }}/sdk-napi.win32-x64-msvc.node - wget https://github.com/bitwarden/sdk/releases/download/napi-v${{ env._PKG_VERSION }}/sdk-napi.linux-x64-gnu.node - mv sdk-napi.*.node ${{ github.workspace }}/crates/bitwarden-napi/artifacts - - - name: Move artifacts - run: npm run artifacts - - - name: Setup NPM - run: | - echo 'registry="https://registry.npmjs.org/"' > ./.npmrc - echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ./.npmrc - - echo 'registry="https://registry.npmjs.org/"' > ~/.npmrc - echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc - env: - NPM_TOKEN: ${{ steps.retrieve-secrets.outputs.npm-api-key }} - - - name: Publish NPM - if: ${{ inputs.release_type != 'Dry Run' }} - run: npm publish --access public --registry=https://registry.npmjs.org/ --userconfig=./.npmrc - - - name: Update deployment status to Success - if: ${{ inputs.release_type != 'Dry Run' && success() }} - uses: chrnorm/deployment-status@9a72af4586197112e0491ea843682b5dc280d806 # v2.0.3 - with: - token: "${{ secrets.GITHUB_TOKEN }}" - state: "success" - deployment-id: ${{ steps.deployment.outputs.deployment_id }} - - - name: Update deployment status to Failure - if: ${{ inputs.release_type != 'Dry Run' && failure() }} - uses: chrnorm/deployment-status@9a72af4586197112e0491ea843682b5dc280d806 # v2.0.3 - with: - token: "${{ secrets.GITHUB_TOKEN }}" - state: "failure" - deployment-id: ${{ steps.deployment.outputs.deployment_id }} diff --git a/.github/workflows/publish-php.yml b/.github/workflows/publish-php.yml deleted file mode 100644 index 986923ab..00000000 --- a/.github/workflows/publish-php.yml +++ /dev/null @@ -1,270 +0,0 @@ ---- -name: Publish PHP SDK -run-name: Publish PHP SDK ${{ inputs.release_type }} - -on: - workflow_dispatch: - inputs: - release_type: - description: "Release Options" - required: true - default: "Release" - type: choice - options: - - Release - - Dry Run - -env: - _KEY_VAULT: "bitwarden-ci" - -jobs: - validate: - name: Setup - runs-on: ubuntu-22.04 - outputs: - version: ${{ steps.version.outputs.version }} - steps: - - name: Checkout repo - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - - - name: Branch check - if: ${{ inputs.release_type != 'Dry Run' }} - run: | - if [[ "$GITHUB_REF" != "refs/heads/main" ]]; then - echo "===================================" - echo "[!] Can only release from the 'main' branch" - echo "===================================" - exit 1 - fi - - - name: Get version - id: version - run: | - VERSION=$(cat languages/php/composer.json | grep -Eo '"version": "[0-9]+\.[0-9]+\.[0-9]+"' | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+') - echo "version=$VERSION" >> $GITHUB_OUTPUT - - setup-php: - name: Setup PHP - runs-on: ubuntu-22.04 - steps: - - name: Checkout Repository - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - - - name: Setup PHP with PECL extension - uses: shivammathur/setup-php@c541c155eee45413f5b09a52248675b1a2575231 # 2.31.1 - with: - php-version: "8.0" - tools: composer - extensions: ext-ffi - - - name: Composer check - run: | - composer update - composer install - composer validate - working-directory: languages/php/ - - repo-sync: - name: Push changed files to SDK PHP repo - runs-on: ubuntu-22.04 - needs: - - validate - - setup-php - env: - _BOT_EMAIL: 106330231+bitwarden-devops-bot@users.noreply.github.com - _BOT_NAME: bitwarden-devops-bot - _PKG_VERSION: ${{ needs.validate.outputs.version }} - steps: - - name: Checkout SDK repo - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - with: - path: sdk - - - name: Login to Azure - Prod Subscription - uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0 - with: - creds: ${{ secrets.AZURE_CI_SERVICE_PRINCIPAL }} - - - name: Retrieve secrets - id: retrieve-secrets - uses: bitwarden/gh-actions/get-keyvault-secrets@main - with: - keyvault: ${{ env._KEY_VAULT }} - secrets: "github-pat-bitwarden-devops-bot-repo-scope" - - - name: Checkout SDK-PHP repo - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - with: - repository: bitwarden/sm-sdk-php - path: sm-sdk-php - ref: main - token: ${{ steps.retrieve-secrets.outputs.github-pat-bitwarden-devops-bot-repo-scope }} - - - name: Setup Git - working-directory: sm-sdk-php - run: | - git config --local user.email "${{ env._BOT_EMAIL }}" - git config --local user.name "${{ env._BOT_NAME }}" - - - name: Update files - run: | - # Copy files to local sm-sdk-php repo path - cp --verbose -rf sdk/languages/php/. sm-sdk-php - - - name: Replace repo name - working-directory: sm-sdk-php - run: | - find . -name '*' -exec \ - sed -i -e 's/github.com\/bitwarden\/sdk\/languages\/php/github.com\/bitwarden\/sm-sdk-php/g' {} \; - - find . -name '*' -exec \ - sed -i -e 's/github.com\/bitwarden\/sdk/github.com\/bitwarden\/sm-sdk-php/g' {} \; - - - name: Push changes - working-directory: sm-sdk-php - run: | - git add . - git commit -m "Update PHP SDK to ${{ github.sha }}" - - if [[ "${{ inputs.release_type }}" == "Dry Run" ]]; then - echo "===================================" - echo "[!] Dry Run - Skipping push" - echo "===================================" - git ls-files -m - exit 0 - else - git push origin main - fi - - - name: Create release tag on PHP SDK repo - if: ${{ inputs.release_type != 'Dry Run' }} - working-directory: sm-sdk-php - run: | - # Check if tag exists, set output then exit 0 if true. - if git log v${{ env._PKG_VERSION }} >/dev/null 2>&1; then - echo "===================================" - echo "[!] Tag v${{ env._PKG_VERSION }} already exists" - echo "===================================" - exit 1 - fi - - git tag v${{ env._PKG_VERSION }} - git push origin v${{ env._PKG_VERSION }} - - github-release: - name: GitHub Release - runs-on: ubuntu-22.04 - needs: - - setup-php - - repo-sync - - validate - env: - _PKG_VERSION: ${{ needs.validate.outputs.version }} - steps: - - name: Login to Azure - Prod Subscription - uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0 - with: - creds: ${{ secrets.AZURE_CI_SERVICE_PRINCIPAL }} - - - name: Retrieve secrets - id: retrieve-secrets - uses: bitwarden/gh-actions/get-keyvault-secrets@main - with: - keyvault: ${{ env._KEY_VAULT }} - secrets: "github-pat-bitwarden-devops-bot-repo-scope" - - - name: Download x86_64-apple-darwin artifact - uses: bitwarden/gh-actions/download-artifacts@main - with: - workflow: build-rust-cross-platform.yml - workflow_conclusion: success - branch: main - artifacts: libbitwarden_c_files-x86_64-apple-darwin - skip_unpack: true - - - name: Download aarch64-apple-darwin artifact - uses: bitwarden/gh-actions/download-artifacts@main - with: - workflow: build-rust-cross-platform.yml - workflow_conclusion: success - branch: main - artifacts: libbitwarden_c_files-aarch64-apple-darwin - skip_unpack: true - - - name: Download x86_64-unknown-linux-gnu artifact - uses: bitwarden/gh-actions/download-artifacts@main - with: - workflow: build-rust-cross-platform.yml - workflow_conclusion: success - branch: main - artifacts: libbitwarden_c_files-x86_64-unknown-linux-gnu - skip_unpack: true - - - name: Download x86_64-pc-windows-msvc artifact - uses: bitwarden/gh-actions/download-artifacts@main - with: - workflow: build-rust-cross-platform.yml - workflow_conclusion: success - branch: main - artifacts: libbitwarden_c_files-x86_64-pc-windows-msvc - skip_unpack: true - - - name: Rename build artifacts - run: | - mv libbitwarden_c_files-x86_64-apple-darwin.zip libbitwarden_c_files-x86_64-apple-darwin-$_PKG_VERSION.zip - mv libbitwarden_c_files-aarch64-apple-darwin.zip libbitwarden_c_files-aarch64-apple-darwin-$_PKG_VERSION.zip - mv libbitwarden_c_files-x86_64-unknown-linux-gnu.zip libbitwarden_c_files-x86_64-unknown-linux-gnu-$_PKG_VERSION.zip - mv libbitwarden_c_files-x86_64-pc-windows-msvc.zip libbitwarden_c_files-x86_64-pc-windows-msvc-$_PKG_VERSION.zip - - - name: Create release - if: ${{ inputs.release_type != 'Dry Run' }} - uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0 - with: - tag: v${{ env._PKG_VERSION }} - name: v${{ env._PKG_VERSION }} - body: "" - token: ${{ steps.retrieve-secrets.outputs.github-pat-bitwarden-devops-bot-repo-scope }} - draft: true - repo: sm-sdk-php - owner: bitwarden - artifacts: "libbitwarden_c_files-x86_64-apple-darwin-${{ env._PKG_VERSION }}.zip, - libbitwarden_c_files-aarch64-apple-darwin-${{ env._PKG_VERSION }}.zip, - libbitwarden_c_files-x86_64-unknown-linux-gnu-${{ env._PKG_VERSION }}.zip, - libbitwarden_c_files-x86_64-pc-windows-msvc-${{ env._PKG_VERSION }}.zip" - - packagist-publish: - name: Publish to Packagist - runs-on: ubuntu-22.04 - needs: - - validate - - setup-php - - repo-sync - - github-release - steps: - - name: Login to Azure - Prod Subscription - uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0 - with: - creds: ${{ secrets.AZURE_CI_SERVICE_PRINCIPAL }} - - - name: Retrieve secrets - id: retrieve-secrets - uses: bitwarden/gh-actions/get-keyvault-secrets@main - with: - keyvault: ${{ env._KEY_VAULT }} - secrets: "github-pat-bitwarden-devops-bot-repo-scope, - packagist-key" - - - name: Checkout SDK-PHP repo - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - with: - repository: bitwarden/sm-sdk-php - path: sm-sdk-php - ref: main - token: ${{ steps.retrieve-secrets.outputs.github-pat-bitwarden-devops-bot-repo-scope }} - - - name: Publish version - if: ${{ inputs.release_type != 'Dry Run' }} - env: - PACKAGIST_KEY: ${{ steps.retrieve-secrets.outputs.packagist-key }} - run: curl -XPOST -H'content-type:application/json' 'https://packagist.org/api/update-package?username=bitwarden&apiToken=${{ env.PACKAGIST_KEY }}' -d'{"repository":{"url":"https://packagist.org/packages/bitwarden/sdk-secrets"}}' - working-directory: sm-sdk-php diff --git a/.github/workflows/publish-python.yml b/.github/workflows/publish-python.yml deleted file mode 100644 index 7e339509..00000000 --- a/.github/workflows/publish-python.yml +++ /dev/null @@ -1,132 +0,0 @@ ---- -name: Publish Python SDK -run-name: Publish Python SDK ${{ inputs.release_type }} - -on: - workflow_dispatch: - inputs: - release_type: - description: "Release Options" - required: true - default: "Release" - type: choice - options: - - Release - - Dry Run - version: - description: "Release Version" - required: false - default: "latest" - -defaults: - run: - shell: bash - -jobs: - setup: - name: Setup - runs-on: ubuntu-22.04 - outputs: - version: ${{ steps.version-output.outputs.version }} - tag_name: ${{ steps.version-output.outputs.tag_name }} - steps: - - name: Checkout repo - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - - - name: Branch check - if: ${{ inputs.release_type != 'Dry Run' }} - run: | - if [[ "$GITHUB_REF" != "refs/heads/main" ]]; then - echo "===================================" - echo "[!] Can only release from the 'main' branch" - echo "===================================" - exit 1 - fi - - - name: Version output - id: version-output - run: | - if [[ "${{ inputs.version }}" == "latest" || "${{ inputs.version }}" == "" ]]; then - TAG_NAME=$(curl "https://api.github.com/repos/bitwarden/sdk/releases" | jq -c '.[] | select(.tag_name | contains("python")) | .tag_name' | head -1) - VERSION=$(echo $TAG_NAME | grep -ohE '20[0-9]{2}\.([1-9]|1[0-2])\.[0-9]+') - echo "Latest Released Version: $VERSION" - echo "version=$VERSION" >> $GITHUB_OUTPUT - - echo "Latest Released Tag name: $TAG_NAME" - echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT - else - echo "Release Version: ${{ inputs.version }}" - echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT - fi - - publish: - name: Publish - runs-on: ubuntu-22.04 - needs: setup - steps: - - name: Checkout repo - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - with: - ref: ${{ needs.setup.outputs.tag_name }} - - - name: Install Python - uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 - with: - python-version: "3.9" - - - name: Install twine - run: pip install twine - - - name: Get release assets - working-directory: ${{ github.workspace }}/target/wheels/dist - run: | - ARTIFACT_URLS=$(curl -sSL https://api.github.com/repos/bitwarden/sdk/releases/tags/${{ needs.setup.outputs.tag_name }} | jq -r '.assets[].browser_download_url') - for url in $ARTIFACT_URLS; do - wget $url - done - - - name: Unpack release assets - working-directory: ${{ github.workspace }}/target/wheels/dist - run: | - for file in *.zip; do - unzip $file - done - - - name: Move files - working-directory: ${{ github.workspace }}/target/wheels/dist - run: | - find . -maxdepth 2 -type f -print0 | xargs -0 mv -t . - rm -rf */ - - - name: Login to Azure - uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0 - with: - creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }} - - - name: Retrieve pypi api token - id: retrieve-secret - uses: bitwarden/gh-actions/get-keyvault-secrets@main - with: - keyvault: "bitwarden-ci" - secrets: "pypi-api-token, - pypi-test-api-token" - - - name: Check - working-directory: ${{ github.workspace }}/target/wheels - run: twine check dist/* - - - name: Publish - if: ${{ inputs.release_type != 'Dry Run' }} - working-directory: ${{ github.workspace }}/target/wheels - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ steps.retrieve-secret.outputs.pypi-api-token }} - run: twine upload --repository pypi dist/* - - - name: Dry Run - Publish - if: ${{ inputs.release_type == 'Dry Run' }} - working-directory: ${{ github.workspace }}/target/wheels - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ steps.retrieve-secret.outputs.pypi-test-api-token }} - run: twine upload --repository testpypi dist/* diff --git a/.github/workflows/publish-ruby.yml b/.github/workflows/publish-ruby.yml deleted file mode 100644 index 875def06..00000000 --- a/.github/workflows/publish-ruby.yml +++ /dev/null @@ -1,126 +0,0 @@ -name: Publish Ruby SDK -run-name: Publish Ruby SDK ${{ inputs.release_type }} - -on: - workflow_dispatch: - inputs: - release_type: - description: "Release Options" - required: true - default: "Release" - type: choice - options: - - Release - - Dry Run - version: - description: "Release Version" - required: false - default: "latest" - -permissions: - contents: read - id-token: write - -jobs: - setup: - name: Setup - runs-on: ubuntu-22.04 - outputs: - release-version: ${{ steps.version-output.outputs.version }} - tag-name: ${{ steps.version-output.outputs.tag_name }} - steps: - - name: Checkout Repository - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - - - name: Branch check - if: ${{ inputs.release_type != 'Dry Run' }} - run: | - if [[ "$GITHUB_REF" != "refs/heads/main" ]]; then - echo "===================================" - echo "[!] Can only release from the 'main' branch" - echo "===================================" - exit 1 - fi - - - name: Version output - id: version-output - run: | - if [[ "${{ inputs.version }}" == "latest" || "${{ inputs.version }}" == "" ]]; then - TAG_NAME=$(curl "https://api.github.com/repos/bitwarden/sdk/releases" | jq -c '.[] | select(.tag_name | contains("ruby")) | .tag_name' | head -1) - VERSION=$(echo $TAG_NAME | grep -ohE '20[0-9]{2}\.([1-9]|1[0-2])\.[0-9]+') - echo "Latest Released Version: $VERSION" - echo "version=$VERSION" >> $GITHUB_OUTPUT - - echo "Latest Released Tag name: $TAG_NAME" - echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT - else - echo "Release Version: ${{ inputs.version }}" - echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT - fi - - publish: - name: Publish - runs-on: ubuntu-22.04 - needs: setup - env: - _VERSION: ${{ needs.setup.outputs.release-version }} - _TAG_NAME: ${{ needs.setup.outputs.tag-name }} - steps: - - name: Checkout Repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - with: - ref: ${{ env._TAG_NAME }} - - - name: Create GitHub deployment - if: ${{ inputs.release_type != 'Dry Run' }} - uses: chrnorm/deployment-action@55729fcebec3d284f60f5bcabbd8376437d696b1 # v2.0.7 - id: deployment - with: - token: "${{ secrets.GITHUB_TOKEN }}" - initial-status: "in_progress" - environment: "Bitwarden Ruby SDK - Production" - description: "Deployment ${{ env._VERSION }} from branch ${{ github.ref_name }}" - task: release - - - name: Login to Azure - uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0 - with: - creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }} - - - name: Retrieve secrets - id: retrieve-secrets - uses: bitwarden/gh-actions/get-keyvault-secrets@main - with: - keyvault: "bitwarden-ci" - secrets: "rubygem-api-key" - - - name: Download ruby artifact - run: wget https://github.com/bitwarden/sdk/releases/download/ruby-v${{ env._VERSION }}/bitwarden-sdk-secrets-${{ env._VERSION }}.gem - - - name: Push gem to Rubygems - if: ${{ inputs.release_type != 'Dry Run' }} - run: | - mkdir -p $HOME/.gem - touch $HOME/.gem/credentials - chmod 0600 $HOME/.gem/credentials - printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials - gem push *.gem - env: - GEM_HOST_API_KEY: ${{ steps.retrieve-secrets.outputs.rubygem-api-key }} - working-directory: languages/ruby/bitwarden_sdk_secrets - - - name: Update deployment status to Success - if: ${{ inputs.release_type != 'Dry Run' && success() }} - uses: chrnorm/deployment-status@9a72af4586197112e0491ea843682b5dc280d806 # v2.0.3 - with: - token: "${{ secrets.GITHUB_TOKEN }}" - state: "success" - deployment-id: ${{ steps.deployment.outputs.deployment_id }} - - - name: Update deployment status to Failure - if: ${{ inputs.release_type != 'Dry Run' && failure() }} - uses: chrnorm/deployment-status@9a72af4586197112e0491ea843682b5dc280d806 # v2.0.3 - with: - token: "${{ secrets.GITHUB_TOKEN }}" - state: "failure" - deployment-id: ${{ steps.deployment.outputs.deployment_id }} diff --git a/.github/workflows/publish-wasm.yml b/.github/workflows/publish-wasm.yml deleted file mode 100644 index 95a86a0c..00000000 --- a/.github/workflows/publish-wasm.yml +++ /dev/null @@ -1,138 +0,0 @@ ---- -name: Publish @bitwarden/sdk-wasm -run-name: Publish @bitwarden/sdk-wasm ${{ inputs.release_type }} - -on: - workflow_dispatch: - inputs: - release_type: - description: "Release Options" - required: true - default: "Release" - type: choice - options: - - Release - - Dry Run - version: - description: "Release Version" - required: false - default: "latest" - -defaults: - run: - working-directory: languages/js/wasm - -jobs: - setup: - name: Setup - runs-on: ubuntu-22.04 - outputs: - release-version: ${{ steps.version-output.outputs.version }} - tag_name: ${{ steps.version-output.outputs.tag_name }} - steps: - - name: Checkout repo - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - - name: Branch check - if: ${{ inputs.release_type != 'Dry Run' }} - run: | - if [[ "$GITHUB_REF" != "refs/heads/main" ]]; then - echo "===================================" - echo "[!] Can only release from the 'main' branch" - echo "===================================" - exit 1 - fi - - - name: Version output - id: version-output - run: | - if [[ "${{ inputs.version }}" == "latest" || "${{ inputs.version }}" == "" ]]; then - TAG_NAME=$(curl "https://api.github.com/repos/bitwarden/sdk/releases" | jq -c '.[] | select(.tag_name | contains("napi")) | .tag_name' | head -1) - VERSION=$(echo $TAG_NAME | grep -ohE '20[0-9]{2}\.([1-9]|1[0-2])\.[0-9]+') - echo "Latest Released Version: $VERSION" - echo "version=$VERSION" >> $GITHUB_OUTPUT - - echo "Latest Released Tag name: $TAG_NAME" - echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT - else - echo "Release Version: ${{ inputs.version }}" - echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT - fi - - npm: - name: Publish NPM - runs-on: ubuntu-22.04 - needs: setup - env: - _VERSION: ${{ needs.setup.outputs.release-version }} - steps: - - name: Checkout repo - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - with: - ref: ${{ needs.setup.outputs.tag_name }} - - - name: Setup Node - uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3 - with: - node-version: 18 - cache: "npm" - - - name: Login to Azure - uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0 - with: - creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }} - - - name: Retrieve secrets - id: retrieve-secrets - uses: bitwarden/gh-actions/get-keyvault-secrets@main - with: - keyvault: "bitwarden-ci" - secrets: "npm-api-key" - - - name: Download artifact - run: | - cd ${{ github.workspace }}/languages/js/wasm - wget https://github.com/bitwarden/sdk/releases/download/wasm-v${{ env._VERSION }}/sdk-bitwarden-wasm.zip - unzip sdk-bitwarden-wasm.zip - rm sdk-bitwarden-wasm.zip - - - name: Create GitHub deployment - if: ${{ inputs.release_type != 'Dry Run' }} - uses: chrnorm/deployment-action@55729fcebec3d284f60f5bcabbd8376437d696b1 # v2.0.7 - id: deployment - with: - token: "${{ secrets.GITHUB_TOKEN }}" - initial-status: "in_progress" - environment: "Bitwarden SDK WASM - Production" - description: "Deployment ${{ env._VERSION }} from branch ${{ github.ref_name }}" - task: release - - - name: Setup NPM - run: | - echo 'registry="https://registry.npmjs.org/"' > ./.npmrc - echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ./.npmrc - - echo 'registry="https://registry.npmjs.org/"' > ~/.npmrc - echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc - env: - NPM_TOKEN: ${{ steps.retrieve-secrets.outputs.npm-api-key }} - - - name: Publish NPM - if: ${{ inputs.release_type != 'Dry Run' }} - run: npm publish --access public --registry=https://registry.npmjs.org/ --userconfig=./.npmrc - - - name: Update deployment status to Success - if: ${{ inputs.release_type != 'Dry Run' && success() }} - uses: chrnorm/deployment-status@9a72af4586197112e0491ea843682b5dc280d806 # v2.0.3 - with: - token: "${{ secrets.GITHUB_TOKEN }}" - state: "success" - deployment-id: ${{ steps.deployment.outputs.deployment_id }} - - - name: Update deployment status to Failure - if: ${{ inputs.release_type != 'Dry Run' && failure() }} - uses: chrnorm/deployment-status@9a72af4586197112e0491ea843682b5dc280d806 # v2.0.3 - with: - token: "${{ secrets.GITHUB_TOKEN }}" - state: "failure" - deployment-id: ${{ steps.deployment.outputs.deployment_id }} diff --git a/.github/workflows/release-bws.yml b/.github/workflows/release-bws.yml deleted file mode 100644 index 92a8544b..00000000 --- a/.github/workflows/release-bws.yml +++ /dev/null @@ -1,77 +0,0 @@ ---- -name: Release bws CLI -run-name: Release bws CLI ${{ inputs.release_type }} - -on: - workflow_dispatch: - inputs: - release_type: - description: "Release Options" - required: true - default: "Release" - type: choice - options: - - Release - - Dry Run - -jobs: - setup: - name: Setup - runs-on: ubuntu-22.04 - outputs: - release-version: ${{ steps.version.outputs.version }} - steps: - - name: Checkout repo - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - - name: Branch check - if: ${{ inputs.release_type != 'Dry Run' }} - run: | - if [[ "$GITHUB_REF" != "refs/heads/main" ]]; then - echo "===================================" - echo "[!] Can only release from the 'main' branch" - echo "===================================" - exit 1 - fi - - - name: Check Release Version - id: version - run: | - VERSION=$(grep -o '^version = ".*"' crates/bws/Cargo.toml | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+") - echo "version=$VERSION" >> $GITHUB_OUTPUT - - - name: Download all Release artifacts - uses: bitwarden/gh-actions/download-artifacts@main - with: - workflow: build-cli.yml - path: packages - workflow_conclusion: success - branch: ${{ github.ref_name }} - - - name: Get checksum files - uses: bitwarden/gh-actions/get-checksum@main - with: - packages_dir: "packages" - file_path: "packages/bws-sha256-checksums-${{ steps.version.outputs.version }}.txt" - - - name: Create release - if: ${{ inputs.release_type != 'Dry Run' }} - uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0 - env: - PKG_VERSION: ${{ steps.version.outputs.version }} - with: - artifacts: "packages/bws-x86_64-apple-darwin-${{ env.PKG_VERSION }}.zip, - packages/bws-aarch64-apple-darwin-${{ env.PKG_VERSION }}.zip, - packages/bws-macos-universal-${{ env.PKG_VERSION }}.zip, - packages/bws-x86_64-pc-windows-msvc-${{ env.PKG_VERSION }}.zip, - packages/bws-aarch64-pc-windows-msvc-${{ env.PKG_VERSION }}.zip, - packages/bws-x86_64-unknown-linux-gnu-${{ env.PKG_VERSION }}.zip, - packages/bws-aarch64-unknown-linux-gnu-${{ env.PKG_VERSION }}.zip, - packages/THIRDPARTY.html, - packages/bws-sha256-checksums-${{ env.PKG_VERSION }}.txt" - commit: ${{ github.sha }} - tag: bws-v${{ env.PKG_VERSION }} - name: bws CLI v${{ env.PKG_VERSION }} - body: "" - token: ${{ secrets.GITHUB_TOKEN }} - draft: true diff --git a/.github/workflows/release-cpp.yml b/.github/workflows/release-cpp.yml deleted file mode 100644 index 47199a99..00000000 --- a/.github/workflows/release-cpp.yml +++ /dev/null @@ -1,167 +0,0 @@ -name: Release C++ SDK -run-name: Release C++ SDK ${{ inputs.release_type }} - -on: - workflow_dispatch: - inputs: - release_type: - description: "Release Options" - required: true - default: "Release" - type: choice - options: - - Release - - Dry Run - -env: - _KEY_VAULT: "bitwarden-ci" - -jobs: - validate: - name: Setup - runs-on: ubuntu-22.04 - outputs: - version: ${{ steps.version.outputs.version }} - steps: - - name: Checkout repo - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - - - name: Branch check - if: ${{ inputs.release_type != 'Dry Run' }} - run: | - if [[ "$GITHUB_REF" != "refs/heads/main" ]] ; then - echo "===================================" - echo "[!] Can only release from the 'main' branches" - echo "===================================" - exit 1 - fi - - - name: Get version - id: version - run: | - VERSION=$(cat languages/cpp/vcpkg.json | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+") - echo "version=$VERSION" >> $GITHUB_OUTPUT - - github-release: - name: GitHub Release - runs-on: ubuntu-22.04 - needs: validate - env: - _PKG_VERSION: ${{ needs.validate.outputs.version }} - steps: - - name: Login to Azure - Prod Subscription - uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0 - with: - creds: ${{ secrets.AZURE_CI_SERVICE_PRINCIPAL }} - - - name: Retrieve secrets - id: retrieve-secrets - uses: bitwarden/gh-actions/get-keyvault-secrets@main - with: - keyvault: ${{ env._KEY_VAULT }} - secrets: "github-pat-bitwarden-devops-bot-repo-scope" - - - name: Download x86_64-apple-darwin C artifact - uses: bitwarden/gh-actions/download-artifacts@main - with: - workflow: build-rust-cross-platform.yml - workflow_conclusion: success - branch: ${{ inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} - artifacts: libbitwarden_c_files-x86_64-apple-darwin - skip_unpack: true - - - name: Download aarch64-apple-darwin C artifact - uses: bitwarden/gh-actions/download-artifacts@main - with: - workflow: build-rust-cross-platform.yml - workflow_conclusion: success - branch: ${{ inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} - artifacts: libbitwarden_c_files-aarch64-apple-darwin - skip_unpack: true - - - name: Download x86_64-unknown-linux-gnu C artifact - uses: bitwarden/gh-actions/download-artifacts@main - with: - workflow: build-rust-cross-platform.yml - workflow_conclusion: success - branch: ${{ inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} - artifacts: libbitwarden_c_files-x86_64-unknown-linux-gnu - skip_unpack: true - - - name: Download x86_64-pc-windows-msvc C artifact - uses: bitwarden/gh-actions/download-artifacts@main - with: - workflow: build-rust-cross-platform.yml - workflow_conclusion: success - branch: ${{ inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} - artifacts: libbitwarden_c_files-x86_64-pc-windows-msvc - skip_unpack: true - - - name: Rename C build artifacts - run: | - artifacts=("x86_64-apple-darwin" "aarch64-apple-darwin" "x86_64-unknown-linux-gnu" "x86_64-pc-windows-msvc") # aarch64-unknown-linux-gnu) - for value in "${artifacts[@]}" - do - unzip libbitwarden_c_files-$value.zip -d libbitwarden_c_files-$value - cd libbitwarden_c_files-$value - zip -Rj ../libbitwarden_c_files-$value-$_PKG_VERSION.zip 'libbitwarden_c.*' - cd .. - done - - - name: Download schemas - uses: bitwarden/gh-actions/download-artifacts@main - with: - name: sdk-schemas-cpp - workflow: generate_schemas.yml - workflow_conclusion: success - branch: ${{ inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} - artifacts: sdk-schemas-cpp - skip_unpack: true - - - name: Rename schemas artifacts - run: mv sdk-schemas-cpp.zip sdk-schemas-cpp-$_PKG_VERSION.zip - - - name: Download x86_64-apple-darwin C++ artifact - uses: bitwarden/gh-actions/download-artifacts@main - with: - workflow: build-cpp.yml - workflow_conclusion: success - branch: ${{ inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} - artifacts: libbitwarden_cpp-x86_64-apple-darwin - skip_unpack: true - - - name: Download x86_64-unknown-linux-gnu C++ artifact - uses: bitwarden/gh-actions/download-artifacts@main - with: - workflow: build-cpp.yml - workflow_conclusion: success - branch: ${{ inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} - artifacts: libbitwarden_cpp-x86_64-unknown-linux-gnu - skip_unpack: true - - - name: Rename C++ build artifacts - run: | - artifacts=("x86_64-apple-darwin" "x86_64-unknown-linux-gnu") # "x86_64-pc-windows-msvc" "aarch64-apple-darwin" "aarch64-unknown-linux-gnu") - for value in "${artifacts[@]}" - do - mv libbitwarden_cpp-$value.zip libbitwarden_cpp_files-$value-$_PKG_VERSION.zip - done - - - name: Create release - if: ${{ inputs.release_type != 'Dry Run' }} - uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0 - with: - tag: cpp-sdk-v${{ env._PKG_VERSION }} - name: "C++ SDK v${{ env._PKG_VERSION }}" - body: "" - token: ${{ steps.retrieve-secrets.outputs.github-pat-bitwarden-devops-bot-repo-scope }} - draft: true - repo: sdk - owner: bitwarden - artifacts: "libbitwarden_c_files-x86_64-apple-darwin-${{ env._PKG_VERSION }}.zip, - libbitwarden_c_files-aarch64-apple-darwin-${{ env._PKG_VERSION }}.zip, - libbitwarden_c_files-x86_64-unknown-linux-gnu-${{ env._PKG_VERSION }}.zip, - libbitwarden_c_files-x86_64-pc-windows-msvc-${{ env._PKG_VERSION }}.zip, - libbitwarden_cpp_files-x86_64-unknown-linux-gnu-${{ env._PKG_VERSION }}.zip, - libbitwarden_cpp_files-x86_64-apple-darwin-${{ env._PKG_VERSION }}.zip, - sdk-schemas-cpp-${{ env._PKG_VERSION }}.zip" diff --git a/.github/workflows/release-dotnet.yml b/.github/workflows/release-dotnet.yml deleted file mode 100644 index dc853927..00000000 --- a/.github/workflows/release-dotnet.yml +++ /dev/null @@ -1,75 +0,0 @@ -name: Release .NET NuGet -run-name: Release .NET NuGet Package ${{ inputs.release_type }} - -on: - workflow_dispatch: - inputs: - release_type: - description: "Release Options" - required: true - default: "Release" - type: choice - options: - - Release - - Dry Run - -jobs: - setup: - name: Setup - runs-on: ubuntu-22.04 - outputs: - version: ${{ steps.version.outputs.version }} - steps: - - name: Checkout repo - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - - name: Branch check - if: ${{ inputs.release_type != 'Dry Run' }} - run: | - if [[ "$GITHUB_REF" != "refs/heads/main" ]]; then - echo "===================================" - echo "[!] Can only release from the 'main' branch" - echo "===================================" - exit 1 - fi - - - name: Install xmllint - run: sudo apt-get install -y libxml2-utils - - - name: Get version - id: version - run: | - VERSION=$(xmllint --xpath 'string(/Project/PropertyGroup/Version)' languages/csharp/Bitwarden.Sdk/Bitwarden.Sdk.csproj) - echo "version=$VERSION" >> $GITHUB_OUTPUT - - release: - name: Create GitHub release - runs-on: ubuntu-22.04 - needs: setup - steps: - - name: Checkout Repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - - name: Download NuGet package - uses: bitwarden/gh-actions/download-artifacts@main - with: - workflow: build-dotnet.yml - workflow_conclusion: success - branch: main - artifacts: Bitwarden.Sdk.${{ needs.setup.outputs.version }}.nupkg - path: ./nuget-output - - - name: Create release - if: ${{ inputs.release_type != 'Dry Run' }} - uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0 - env: - PKG_VERSION: ${{ needs.setup.outputs.version }} - with: - commit: ${{ github.sha }} - tag: dotnet-v${{ env.PKG_VERSION }} - name: .NET NuGet v${{ env.PKG_VERSION }} - body: "" - token: ${{ secrets.GITHUB_TOKEN }} - draft: true - artifacts: | - ./nuget-output/Bitwarden.Sdk.${{ needs.setup.outputs.version }}.nupkg diff --git a/.github/workflows/release-go.yml b/.github/workflows/release-go.yml deleted file mode 100644 index f88e52af..00000000 --- a/.github/workflows/release-go.yml +++ /dev/null @@ -1,283 +0,0 @@ -name: Release Go SDK -run-name: Release Go SDK ${{ inputs.release_type }} - -on: - workflow_dispatch: - inputs: - release_type: - description: "Release Options" - required: true - default: "Release" - type: choice - options: - - Release - - Dry Run - -env: - GO111MODULE: on - GO_VERSION: "^1.21" - _KEY_VAULT: "bitwarden-ci" - -jobs: - validate: - name: Setup - runs-on: ubuntu-22.04 - outputs: - version: ${{ steps.version.outputs.version }} - steps: - - name: Checkout repo - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - - - name: Branch check - if: ${{ inputs.release_type != 'Dry Run' }} - run: | - if [[ "$GITHUB_REF" != "refs/heads/rc" ]] && [[ "$GITHUB_REF" != "refs/heads/hotfix-rc" ]]; then - echo "===================================" - echo "[!] Can only release from the 'rc' or 'hotfix-rc' branches" - echo "===================================" - exit 1 - fi - - - name: Get version - id: version - run: | - VERSION=$(cat languages/go/.version | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+") - echo "version=$VERSION" >> $GITHUB_OUTPUT - - repo-sync: - name: Push changed files to SDK Go repo - runs-on: ubuntu-22.04 - needs: validate - env: - _BOT_EMAIL: 106330231+bitwarden-devops-bot@users.noreply.github.com - _BOT_NAME: bitwarden-devops-bot - _PKG_VERSION: ${{ needs.validate.outputs.version }} - - steps: - - name: Checkout SDK repo - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - with: - path: sdk - - - name: Login to Azure - Prod Subscription - uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0 - with: - creds: ${{ secrets.AZURE_CI_SERVICE_PRINCIPAL }} - - - name: Retrieve secrets - id: retrieve-secrets - uses: bitwarden/gh-actions/get-keyvault-secrets@main - with: - keyvault: ${{ env._KEY_VAULT }} - secrets: "github-pat-bitwarden-devops-bot-repo-scope" - - - name: Checkout SDK-Go repo - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - with: - repository: bitwarden/sdk-go - path: sdk-go - ref: main - token: ${{ steps.retrieve-secrets.outputs.github-pat-bitwarden-devops-bot-repo-scope }} - - - name: Setup Git - working-directory: sdk-go - run: | - git config --local user.email "${{ env._BOT_EMAIL }}" - git config --local user.name "${{ env._BOT_NAME }}" - - - name: Download x86_64-apple-darwin artifact - uses: bitwarden/gh-actions/download-artifacts@main - with: - workflow: build-rust-cross-platform.yml - workflow_conclusion: success - branch: ${{ inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} - artifacts: libbitwarden_c_files-x86_64-apple-darwin - skip_unpack: true - - - name: Download aarch64-apple-darwin artifact - uses: bitwarden/gh-actions/download-artifacts@main - with: - workflow: build-rust-cross-platform.yml - workflow_conclusion: success - branch: ${{ inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} - artifacts: libbitwarden_c_files-aarch64-apple-darwin - skip_unpack: true - - - name: Download x86_64-unknown-linux-musl artifact - uses: bitwarden/gh-actions/download-artifacts@main - with: - workflow: build-rust-cross-platform.yml - workflow_conclusion: success - branch: ${{ inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} - artifacts: libbitwarden_c_files-x86_64-unknown-linux-musl - skip_unpack: true - - - name: Download aarch64-unknown-linux-musl artifact - uses: bitwarden/gh-actions/download-artifacts@main - with: - workflow: build-rust-cross-platform.yml - workflow_conclusion: success - branch: ${{ inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} - artifacts: libbitwarden_c_files-aarch64-unknown-linux-musl - skip_unpack: true - - - name: Download x86_64-pc-windows-gnu artifact - uses: bitwarden/gh-actions/download-artifacts@main - with: - workflow: build-rust-cross-platform.yml - workflow_conclusion: success - branch: ${{ inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} - artifacts: libbitwarden_c_files-x86_64-pc-windows-gnu - skip_unpack: true - - - name: Update files - run: | - # Copy files to local sdk-go repo path - cp --verbose -rf sdk/languages/go/. sdk-go - # Remove the old cinterface lib files - rm -rf sdk-go/internal/cinterface/lib/* - mkdir -p sdk-go/internal/cinterface/lib/{darwin-{x64,arm64},linux-{x64,arm64},windows-x64} - - - name: Extract static libs to their respective directories - run: | - unzip 'libbitwarden_c_files-x86_64-apple-darwin.zip' '*.a' -d sdk-go/internal/cinterface/lib/darwin-x64 - unzip 'libbitwarden_c_files-aarch64-apple-darwin.zip' '*.a' -d sdk-go/internal/cinterface/lib/darwin-arm64 - unzip 'libbitwarden_c_files-x86_64-unknown-linux-musl.zip' '*.a' -d sdk-go/internal/cinterface/lib/linux-x64 - unzip 'libbitwarden_c_files-aarch64-unknown-linux-musl.zip' '*.a' -d sdk-go/internal/cinterface/lib/linux-arm64 - unzip 'libbitwarden_c_files-x86_64-pc-windows-gnu.zip' '*.a' -d sdk-go/internal/cinterface/lib/windows-x64 - - - name: Download artifacts - uses: bitwarden/gh-actions/download-artifacts@main - with: - workflow: generate_schemas.yml - path: sdk-go - workflow_conclusion: success - branch: ${{ inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} - artifacts: schemas.go - - - name: Push changes - working-directory: sdk-go - run: | - git add . - git commit -m "Update Go SDK to ${{ github.sha }}" - - if [[ "${{ inputs.release_type }}" == "Dry Run" ]]; then - echo "===================================" - echo "[!] Dry Run - Skipping push" - echo "===================================" - git ls-files -m - exit 0 - else - git push origin main - fi - - - name: Create release tag on SDK Go repo - if: ${{ inputs.release_type != 'Dry Run' }} - working-directory: sdk-go - run: | - # Check if tag exists, set output then exit 0 if true. - if git log v${{ env._PKG_VERSION }} >/dev/null 2>&1; then - echo "===================================" - echo "[!] Tag v${{ env._PKG_VERSION }} already exists" - echo "===================================" - exit 1 - fi - - git tag v${{ env._PKG_VERSION }} - git push origin v${{ env._PKG_VERSION }} - - github-release: - name: GitHub Release - runs-on: ubuntu-22.04 - needs: - - repo-sync - - validate - env: - _PKG_VERSION: ${{ needs.validate.outputs.version }} - steps: - - name: Login to Azure - Prod Subscription - uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0 - with: - creds: ${{ secrets.AZURE_CI_SERVICE_PRINCIPAL }} - - - name: Retrieve secrets - id: retrieve-secrets - uses: bitwarden/gh-actions/get-keyvault-secrets@main - with: - keyvault: ${{ env._KEY_VAULT }} - secrets: "github-pat-bitwarden-devops-bot-repo-scope" - - - name: Download x86_64-apple-darwin artifact - uses: bitwarden/gh-actions/download-artifacts@main - with: - workflow: build-rust-cross-platform.yml - workflow_conclusion: success - branch: ${{ inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} - artifacts: libbitwarden_c_files-x86_64-apple-darwin - skip_unpack: true - - - name: Download aarch64-apple-darwin artifact - uses: bitwarden/gh-actions/download-artifacts@main - with: - workflow: build-rust-cross-platform.yml - workflow_conclusion: success - branch: ${{ inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} - artifacts: libbitwarden_c_files-aarch64-apple-darwin - skip_unpack: true - - - name: Download x86_64-unknown-linux-musl artifact - uses: bitwarden/gh-actions/download-artifacts@main - with: - workflow: build-rust-cross-platform.yml - workflow_conclusion: success - branch: ${{ inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} - artifacts: libbitwarden_c_files-x86_64-unknown-linux-musl - skip_unpack: true - - - name: Download aarch64-unknown-linux-musl artifact - uses: bitwarden/gh-actions/download-artifacts@main - with: - workflow: build-rust-cross-platform.yml - workflow_conclusion: success - branch: ${{ inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} - artifacts: libbitwarden_c_files-aarch64-unknown-linux-musl - skip_unpack: true - - - name: Download x86_64-pc-windows-gnu artifact - uses: bitwarden/gh-actions/download-artifacts@main - with: - workflow: build-rust-cross-platform.yml - workflow_conclusion: success - branch: ${{ inputs.release_type == 'Dry Run' && 'main' || github.ref_name }} - artifacts: libbitwarden_c_files-x86_64-pc-windows-gnu - skip_unpack: true - - - name: Rename build artifacts - run: | - artifacts=("x86_64-apple-darwin" "aarch64-apple-darwin" "x86_64-unknown-linux-musl" "aarch64-unknown-linux-musl" "x86_64-pc-windows-gnu") - for value in "${artifacts[@]}" - do - unzip libbitwarden_c_files-$value.zip -d libbitwarden_c_files-$value - cd libbitwarden_c_files-$value - zip -Rj ../libbitwarden_c_files-$value-$_PKG_VERSION.zip 'libbitwarden_c.*' - cd .. - done - - ls ./libbitwarden_c_files-x86_64-apple-darwin-$_PKG_VERSION.zip -lRa - - - name: Create release - if: ${{ inputs.release_type != 'Dry Run' }} - uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0 - with: - tag: v${{ env._PKG_VERSION }} - name: v${{ env._PKG_VERSION }} - body: "" - token: ${{ steps.retrieve-secrets.outputs.github-pat-bitwarden-devops-bot-repo-scope }} - draft: true - repo: sdk-go - owner: bitwarden - artifacts: "libbitwarden_c_files-x86_64-apple-darwin-${{ env._PKG_VERSION }}.zip, - libbitwarden_c_files-aarch64-apple-darwin-${{ env._PKG_VERSION }}.zip, - libbitwarden_c_files-x86_64-unknown-linux-musl-${{ env._PKG_VERSION }}.zip, - libbitwarden_c_files-aarch64-unknown-linux-musl-${{ env._PKG_VERSION }}.zip, - libbitwarden_c_files-x86_64-pc-windows-gnu-${{ env._PKG_VERSION }}.zip" diff --git a/.github/workflows/release-java.yml b/.github/workflows/release-java.yml deleted file mode 100644 index 6898932d..00000000 --- a/.github/workflows/release-java.yml +++ /dev/null @@ -1,61 +0,0 @@ -name: Release Java SDK -run-name: Release Java SDK ${{ inputs.release_type }} - -on: - workflow_dispatch: - inputs: - release_type: - description: "Release Options" - required: true - default: "Release" - type: choice - options: - - Release - - Dry Run - -jobs: - setup: - name: Setup - runs-on: ubuntu-22.04 - outputs: - version: ${{ steps.version.outputs.version }} - steps: - - name: Checkout repo - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - - name: Branch check - if: ${{ inputs.release_type != 'Dry Run' }} - run: | - if [[ "$GITHUB_REF" != "refs/heads/main" ]]; then - echo "===================================" - echo "[!] Can only release from the 'main' branch" - echo "===================================" - exit 1 - fi - - - name: Get version - id: version - run: | - VERSION=$(cat languages/java/build.gradle | grep -Eo 'version = "[0-9]+\.[0-9]+\.[0-9]+"' | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+') - echo "version=$VERSION" >> $GITHUB_OUTPUT - - release: - name: Release - runs-on: ubuntu-22.04 - needs: setup - steps: - - name: Checkout Repository - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - - name: Create release - if: ${{ inputs.release_type != 'Dry Run' }} - uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0 - env: - PKG_VERSION: ${{ needs.setup.outputs.version }} - with: - commit: ${{ github.sha }} - tag: java-v${{ env.PKG_VERSION }} - name: Java SDK v${{ env.PKG_VERSION }} - body: "" - token: ${{ secrets.GITHUB_TOKEN }} - draft: true diff --git a/.github/workflows/release-napi.yml b/.github/workflows/release-napi.yml deleted file mode 100644 index 761515c7..00000000 --- a/.github/workflows/release-napi.yml +++ /dev/null @@ -1,96 +0,0 @@ ---- -name: Release @bitwarden/sdk-napi -run-name: Release @bitwarden/sdk-napi ${{ inputs.release_type }} - -on: - workflow_dispatch: - inputs: - release_type: - description: "Release Options" - required: true - default: "Initial Release" - type: choice - options: - - Initial Release - - Redeploy - - Dry Run - -defaults: - run: - shell: bash - working-directory: crates/bitwarden-napi - -jobs: - setup: - name: Setup - runs-on: ubuntu-22.04 - outputs: - version: ${{ steps.version.outputs.version }} - steps: - - name: Checkout repo - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - - - name: Branch check - if: ${{ inputs.release_type != 'Dry Run' }} - run: | - if [[ "$GITHUB_REF" != "refs/heads/main" ]]; then - echo "===================================" - echo "[!] Can only release from the 'main' branch" - echo "===================================" - exit 1 - fi - - - name: Check Release Version - id: version - uses: bitwarden/gh-actions/release-version-check@main - with: - release-type: ${{ inputs.release_type }} - project-type: ts - file: crates/bitwarden-napi/package.json - monorepo: false - - release: - name: Create GitHub release - runs-on: ubuntu-22.04 - needs: setup - steps: - - name: Checkout Repository - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - - - name: Download artifacts - uses: dawidd6/action-download-artifact@bf251b5aa9c2f7eeb574a96ee720e24f801b7c11 # v6 - with: - workflow: build-napi.yml - workflow_conclusion: success - branch: main - name: sdk-bitwarden-napi-(.*)|schemas.ts - name_is_regexp: true - path: dist - - - name: Move artifact files to single directory - run: | - ls -alhR - shopt -s globstar - mv **/*.node . - mv schemas.ts/ schemas/ - mv schemas/schemas.ts . - working-directory: dist - - - name: Create release - if: ${{ inputs.release_type != 'Dry Run' }} - uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0 - env: - _VERSION: ${{ needs.setup.outputs.version }} - with: - commit: ${{ github.sha }} - tag: napi-v${{ env._VERSION }} - name: napi v${{ env._VERSION }} - body: "" - token: ${{ secrets.GITHUB_TOKEN }} - draft: true - artifacts: | - dist/sdk-napi.darwin-arm64.node - dist/sdk-napi.darwin-x64.node - dist/sdk-napi.win32-x64-msvc.node - dist/sdk-napi.linux-x64-gnu.node - dist/schemas.ts diff --git a/.github/workflows/release-python.yml b/.github/workflows/release-python.yml deleted file mode 100644 index 5be1a12f..00000000 --- a/.github/workflows/release-python.yml +++ /dev/null @@ -1,80 +0,0 @@ ---- -name: Release Python SDK -run-name: Release Python SDK ${{ inputs.release_type }} - -on: - workflow_dispatch: - inputs: - release_type: - description: "Release Options" - required: true - default: "Release" - type: choice - options: - - Release - - Dry Run - -jobs: - setup: - name: Setup - runs-on: ubuntu-22.04 - outputs: - version: ${{ steps.version.outputs.version }} - steps: - - name: Checkout repo - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - - name: Branch check - if: ${{ inputs.release_type != 'Dry Run' }} - run: | - if [[ "$GITHUB_REF" != "refs/heads/main" ]]; then - echo "===================================" - echo "[!] Can only release from the 'main' branch" - echo "===================================" - exit 1 - fi - - - name: Get version - id: version - run: | - VERSION=$(cat languages/python/pyproject.toml | grep -Eo 'version = "[0-9]+\.[0-9]+\.[0-9]+"' | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+') - echo "version=$VERSION" >> $GITHUB_OUTPUT - - release: - name: Release - runs-on: ubuntu-22.04 - needs: setup - steps: - - name: Checkout repo - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - - name: Download artifacts - uses: dawidd6/action-download-artifact@bf251b5aa9c2f7eeb574a96ee720e24f801b7c11 # v6 - with: - workflow: build-python-wheels.yml - path: ${{ github.workspace }}/target/wheels/dist - workflow_conclusion: success - branch: main - name: bitwarden_sdk(.*) - name_is_regexp: true - - - name: Move all whl files to single directory - run: | - shopt -s globstar - mv **/*.whl . - working-directory: ${{ github.workspace }}/target/wheels/dist - - - name: Create GitHub release - if: ${{ inputs.release_type != 'Dry Run' }} - uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0 - env: - PKG_VERSION: ${{ needs.setup.outputs.version }} - with: - commit: ${{ github.sha }} - tag: python-v${{ env.PKG_VERSION }} - name: Python v${{ env.PKG_VERSION }} - body: "" - token: ${{ secrets.GITHUB_TOKEN }} - draft: true - artifacts: | - ${{ github.workspace }}/target/wheels/dist/bitwarden_sdk-*.whl diff --git a/.github/workflows/release-wasm.yml b/.github/workflows/release-wasm.yml deleted file mode 100644 index 97b2c34d..00000000 --- a/.github/workflows/release-wasm.yml +++ /dev/null @@ -1,78 +0,0 @@ ---- -name: Release @bitwarden/sdk-wasm -run-name: Release @bitwarden/sdk-wasm ${{ inputs.release_type }} - -on: - workflow_dispatch: - inputs: - release_type: - description: "Release Options" - required: true - default: "Release" - type: choice - options: - - Release - - Dry Run - -defaults: - run: - working-directory: languages/js/wasm - -jobs: - setup: - name: Setup - runs-on: ubuntu-22.04 - outputs: - release-version: ${{ steps.version.outputs.version }} - steps: - - name: Checkout repo - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - - - name: Branch check - if: ${{ inputs.release_type != 'Dry Run' }} - run: | - if [[ "$GITHUB_REF" != "refs/heads/main" ]]; then - echo "===================================" - echo "[!] Can only release from the 'main' branch" - echo "===================================" - exit 1 - fi - - - name: Check Release Version - id: version - uses: bitwarden/gh-actions/release-version-check@main - with: - release-type: ${{ inputs.release_type }} - project-type: ts - file: languages/js/wasm/package.json - monorepo: false - - release: - name: Release - runs-on: ubuntu-22.04 - needs: setup - steps: - - name: Checkout repo - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 - - - name: Download artifacts - uses: dawidd6/action-download-artifact@bf251b5aa9c2f7eeb574a96ee720e24f801b7c11 # v6 - with: - workflow: build-wasm.yml - skip_unpack: true - workflow_conclusion: success - branch: main - - - name: Create GitHub release - if: ${{ inputs.release_type != 'Dry Run' }} - uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0 - env: - PKG_VERSION: ${{ needs.setup.outputs.release-version }} - with: - commit: ${{ github.sha }} - tag: wasm-v${{ env.PKG_VERSION }} - name: WASM v${{ env.PKG_VERSION }} - body: "" - token: ${{ secrets.GITHUB_TOKEN }} - draft: true - artifacts: sdk-bitwarden-wasm.zip diff --git a/.github/workflows/rust-test.yml b/.github/workflows/rust-test.yml index 5e7703e8..2ddb853c 100644 --- a/.github/workflows/rust-test.yml +++ b/.github/workflows/rust-test.yml @@ -46,7 +46,7 @@ jobs: - name: Test # Termporarily exclude NAPI due to a test error on windows - run: cargo test --workspace --exclude bitwarden-napi --all-features + run: cargo test --workspace --all-features coverage: name: Coverage diff --git a/.github/workflows/version-bump.yml b/.github/workflows/version-bump.yml index 7053181e..960febd4 100644 --- a/.github/workflows/version-bump.yml +++ b/.github/workflows/version-bump.yml @@ -11,15 +11,6 @@ on: type: choice options: - bitwarden - - bws - - napi - - python-sdk - - ruby-sdk - - go-sdk - - dotnet-sdk - - php-sdk - - java-sdk - - cpp-sdk version_number: description: "New version (example: '2024.1.0')" required: true @@ -90,73 +81,11 @@ jobs: # VERSION BUMP SECTION # ######################## - ### napi - - name: Bump @bitwarden/sdk-napi Version - if: ${{ inputs.project == 'napi' }} - working-directory: "crates/bitwarden-napi" - run: | - npm ci - npm version ${{ inputs.version_number }} - - - name: Bump napi crate Version - if: ${{ inputs.project == 'napi' }} - run: cargo set-version -p bitwarden-napi ${{ inputs.version_number }} - ### bitwarden - name: Bump bitwarden crate Version if: ${{ inputs.project == 'bitwarden' }} run: cargo set-version -p bitwarden ${{ inputs.version_number }} - ### bws - - name: Bump bws Version - if: ${{ inputs.project == 'bws' }} - run: | - cargo set-version -p bws ${{ inputs.version_number }} - # bump the version in install.sh - sed -i 's/DEFAULT_BWS_VERSION="[0-9]\+\.[0-9]\+\.[0-9]\+"/DEFAULT_BWS_VERSION="${{ inputs.version_number }}"/' ./crates/bws/scripts/install.sh - # bump the version in install.ps1 - sed -i 's/\$defaultBwsVersion = "[0-9]\+\.[0-9]\+\.[0-9]\+"/\$defaultBwsVersion = "${{ inputs.version_number }}"/' ./crates/bws/scripts/install.ps1 - - ### python - - name: Bump python-sdk Version - if: ${{ inputs.project == 'python-sdk' }} - run: | - sed -i 's/version = "[0-9]\.[0-9]\.[0-9]"/version = "${{ inputs.version_number }}"/' ./languages/python/pyproject.toml - sed -i 's/__version__ = "[0-9]\.[0-9]\.[0-9]"/__version__ = "${{ inputs.version_number }}"/' ./languages/python/bitwarden_sdk/__init__.py - - ### ruby sdk - - name: Bump ruby-sdk Version - if: ${{ inputs.project == 'ruby-sdk' }} - run: sed -i "s/VERSION = '[0-9]\.[0-9]\.[0-9]'/VERSION = '${{ inputs.version_number }}'/" ./languages/ruby/bitwarden_sdk_secrets/lib/version.rb - - ### go sdk - - name: Bump go-sdk Version - if: ${{ inputs.project == 'go-sdk' }} - run: sed -i 's/[0-9]\.[0-9]\.[0-9]/${{ inputs.version_number }}/' ./languages/go/.version - - ### dotnet sdk - - name: Bump dotnet-sdk Version - if: ${{ inputs.project == 'dotnet-sdk' }} - run: sed -i 's/[0-9]\.[0-9]\.[0-9]<\/Version>/${{ inputs.version_number }}<\/Version>/' languages/csharp/Bitwarden.Sdk/Bitwarden.Sdk.csproj - - ### php sdk - - name: Bump php-sdk Version - if: ${{ inputs.project == 'php-sdk' }} - run: | - sed -i 's/"version": "[0-9]\.[0-9]\.[0-9]"/"version": "${{ inputs.version_number }}"/' ./languages/php/composer.json - - ### java sdk - - name: Bump java-sdk Version - if: ${{ inputs.project == 'java-sdk' }} - run: | - sed -i 's/version = "[0-9]\.[0-9]\.[0-9]"/version = "${{ inputs.version_number }}"/' ./languages/java/build.gradle - - ### cpp sdk - - name: Bump C++ SDK Version - if: ${{ inputs.project == 'cpp-sdk' }} - run: | - sed -i 's/"version": "[0-9]\.[0-9]\.[0-9]"/"version": "${{ inputs.version_number }}"/' ./languages/cpp/vcpkg.json - ############################ # VERSION BUMP SECTION END # ############################ diff --git a/.gitignore b/.gitignore index 4a1d79fc..cea87ccb 100644 --- a/.gitignore +++ b/.gitignore @@ -32,34 +32,13 @@ xcuserdata/ #/target node_modules/ -clients/python/env/ # Third party license THIRDPARTY.html -# Node.js addon binary file, for the current running operating system. -crates/bitwarden-napi/sdk-napi.*.node - -# Complied TypeScript client -crates/bitwarden-napi/dist -languages/js/sdk-client/dist/ - # Uniffi languages/swift/BitwardenFFI.xcframework languages/swift/tmp languages/swift/.build languages/swift/.swiftpm languages/kotlin/sdk/src/main/java/com/bitwarden/**/*.kt - -# Schemas -crates/bitwarden-napi/src-ts/bitwarden_client/schemas.ts -languages/cpp/include/schemas.hpp -languages/csharp/Bitwarden.Sdk/schemas.cs -languages/go/schema.go -languages/java/src/main/java/com/bitwarden/sdk/schema -languages/js/sdk-client/src/schemas.ts -languages/python/bitwarden_sdk/schemas.py -support/schemas - -# Cmake build files -languages/cpp/cmake-build-debug diff --git a/.prettierignore b/.prettierignore index 16243942..13f89e9c 100644 --- a/.prettierignore +++ b/.prettierignore @@ -5,9 +5,7 @@ languages/js/* !languages/js/sdk-internal languages/js/sdk-internal/bitwarden_wasm_internal_bg.wasm.js schemas -/crates/bitwarden-napi/src-ts/bitwarden_client/schemas.ts about.hbs -support/docs/template.hbs # Test fixtures crates/bitwarden-exporters/resources/* diff --git a/.vscode/launch.json b/.vscode/launch.json index 7da474a2..3bbf9af5 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -4,28 +4,6 @@ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ - { - "name": ".NET Core Launch (console)", - "type": "coreclr", - "request": "launch", - "preLaunchTask": "buildCsharp", - "program": "${workspaceFolder}/languages/csharp/Bitwarden.Sdk/bin/Debug/net6.0/BitwardenSdk.dll", - "args": [], - "env": { - "RUST_LOG": "debug" - }, - "cwd": "${workspaceFolder}", - "stopAtEntry": false, - "console": "internalConsole" - }, - { - "name": "Python: Current File", - "type": "python", - "request": "launch", - "program": "${file}", - "console": "integratedTerminal", - "preLaunchTask": "build python" - }, { "type": "lldb", "request": "launch", diff --git a/.vscode/tasks.json b/.vscode/tasks.json deleted file mode 100644 index 71400c06..00000000 --- a/.vscode/tasks.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "version": "2.0.0", - "tasks": [ - { - "type": "cargo", - "command": "build", - "problemMatcher": ["$rustc"], - "options": { - "cwd": "${workspaceFolder}/crates/bitwarden-c/" - }, - "group": { - "kind": "build", - "isDefault": true - }, - "label": "rust: bitwarden-c build" - }, - { - "type": "cargo", - "command": "build", - "args": ["--release"], - "options": { - "cwd": "${workspaceFolder}/crates/bitwarden-c/" - }, - "problemMatcher": ["$rustc"], - "label": "rust: bitwarden-c release build" - }, - { - "label": "buildCsharp", - "command": "dotnet", - "type": "process", - "args": [ - "build", - "${workspaceFolder}/languages/csharp/Bitwarden.Sdk/Bitwarden.Sdk.csproj", - "/property:GenerateFullPaths=true", - "/consoleloggerparameters:NoSummary" - ], - "problemMatcher": "$msCompile", - "dependsOrder": "sequence", - "dependsOn": ["rust: bitwarden-c build"] - }, - { - "label": "build python", - "command": "python3", - "type": "shell", - "args": ["setup.py", "develop"], - "options": { - "cwd": "${workspaceFolder}/languages/python" - } - }, - { - "label": "buildJava", - "type": "shell", - "command": "gradle", - "args": ["build"], - "dependsOrder": "sequence", - "dependsOn": ["rust: bitwarden-c build"], - "options": { - "cwd": "${workspaceFolder}/languages/java" - } - } - ] -} diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 10edbfba..00000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,6 +0,0 @@ -# Changelog - -The changelog for the crates are located in the individual crates. - -- [`bitwarden`](./crates/bitwarden/CHANGELOG.md) -- [`bws`](./crates/bws/CHANGELOG.md) diff --git a/Cargo.lock b/Cargo.lock index 024abbe0..a73f7c68 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -17,12 +17,6 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" -[[package]] -name = "adler2" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" - [[package]] name = "aes" version = "0.8.4" @@ -82,15 +76,6 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" -[[package]] -name = "ansi_colours" -version = "1.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14eec43e0298190790f41679fe69ef7a829d2a2ddd78c8c00339e84710e435fe" -dependencies = [ - "rgb", -] - [[package]] name = "anstream" version = "0.6.15" @@ -146,12 +131,6 @@ version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6" -[[package]] -name = "arc-swap" -version = "1.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69f7f8c3906b62b754cd5326047894316021dcfe5a194c8ea52bdd94934a3457" - [[package]] name = "argon2" version = "0.5.3" @@ -262,7 +241,7 @@ dependencies = [ "cc", "cfg-if", "libc", - "miniz_oxide 0.7.4", + "miniz_oxide", "object", "rustc-demangle", ] @@ -294,34 +273,6 @@ dependencies = [ "serde", ] -[[package]] -name = "bat" -version = "0.24.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dcc9e5637c2330d8eb7b920f2aa5d9e184446c258466f825ea1412c7614cc86" -dependencies = [ - "ansi_colours", - "bincode", - "bytesize", - "clircle", - "console", - "content_inspector", - "encoding_rs", - "flate2", - "globset", - "home", - "nu-ansi-term", - "once_cell", - "path_abs", - "plist", - "semver", - "serde", - "serde_yaml", - "syntect", - "thiserror", - "unicode-width", -] - [[package]] name = "bincode" version = "1.3.3" @@ -358,17 +309,6 @@ version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" -[[package]] -name = "bitwarden" -version = "1.0.0" -dependencies = [ - "bitwarden-core", - "bitwarden-generators", - "bitwarden-sm", - "thiserror", - "uuid", -] - [[package]] name = "bitwarden-api-api" version = "1.0.0" @@ -395,15 +335,6 @@ dependencies = [ "uuid", ] -[[package]] -name = "bitwarden-c" -version = "0.1.0" -dependencies = [ - "bitwarden-json", - "env_logger", - "tokio", -] - [[package]] name = "bitwarden-cli" version = "1.0.0" @@ -541,40 +472,6 @@ dependencies = [ "wiremock", ] -[[package]] -name = "bitwarden-json" -version = "0.3.0" -dependencies = [ - "bitwarden", - "log", - "schemars", - "serde", - "serde_json", -] - -[[package]] -name = "bitwarden-napi" -version = "1.0.0" -dependencies = [ - "bitwarden-json", - "env_logger", - "log", - "napi", - "napi-build", - "napi-derive", -] - -[[package]] -name = "bitwarden-py" -version = "0.1.0" -dependencies = [ - "bitwarden-json", - "pyo3", - "pyo3-build-config", - "pyo3-log", - "tokio", -] - [[package]] name = "bitwarden-send" version = "1.0.0" @@ -660,28 +557,11 @@ dependencies = [ "uuid", ] -[[package]] -name = "bitwarden-wasm" -version = "0.1.0" -dependencies = [ - "argon2", - "bitwarden-json", - "chrono", - "console_error_panic_hook", - "console_log", - "js-sys", - "log", - "serde", - "wasm-bindgen", - "wasm-bindgen-futures", - "wasm-bindgen-test", -] - [[package]] name = "bitwarden-wasm-internal" version = "0.1.0" dependencies = [ - "bitwarden", + "bitwarden-core", "console_error_panic_hook", "console_log", "js-sys", @@ -718,16 +598,6 @@ dependencies = [ "generic-array", ] -[[package]] -name = "bstr" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40723b8fb387abc38f4f4a37c09073622e41dd12327033091ef8950659e6dc0c" -dependencies = [ - "memchr", - "serde", -] - [[package]] name = "bumpalo" version = "3.16.0" @@ -752,42 +622,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "bws" -version = "1.0.0" -dependencies = [ - "bat", - "bitwarden", - "bitwarden-cli", - "chrono", - "clap", - "clap_complete", - "clap_mangen", - "color-eyre", - "comfy-table", - "directories", - "env_logger", - "itertools 0.13.0", - "log", - "regex", - "serde", - "serde_json", - "serde_yaml", - "supports-color", - "tempfile", - "thiserror", - "tokio", - "toml 0.8.19", - "uuid", - "which", -] - -[[package]] -name = "bytemuck" -version = "1.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94bbb0ad554ad961ddc5da507a12a29b14e4ae5bda06b19f575a3e6079d2e2ae" - [[package]] name = "byteorder" version = "1.5.0" @@ -800,12 +634,6 @@ version = "1.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3" -[[package]] -name = "bytesize" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e368af43e418a04d52505cf3dbc23dda4e3407ae2fa99fd0e4f308ce546acc" - [[package]] name = "camino" version = "1.1.9" @@ -949,15 +777,6 @@ dependencies = [ "strsim", ] -[[package]] -name = "clap_complete" -version = "4.5.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9646e2e245bf62f45d39a0f3f36f1171ad1ea0d6967fd114bca72cb02a8fcdfb" -dependencies = [ - "clap", -] - [[package]] name = "clap_derive" version = "4.5.18" @@ -976,28 +795,6 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" -[[package]] -name = "clap_mangen" -version = "0.2.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbae9cbfdc5d4fa8711c09bd7b83f644cb48281ac35bf97af3e47b0675864bdf" -dependencies = [ - "clap", - "roff", -] - -[[package]] -name = "clircle" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8e87cbed5354f17bd8ca8821a097fb62599787fe8f611743fad7ee156a0a600" -dependencies = [ - "cfg-if", - "libc", - "serde", - "winapi", -] - [[package]] name = "color-eyre" version = "0.6.3" @@ -1053,19 +850,6 @@ dependencies = [ "unicode-width", ] -[[package]] -name = "console" -version = "0.15.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e1f83fc076bd6dd27517eacdf25fef6c4dfe5f1d7448bafaaf3a26f13b5e4eb" -dependencies = [ - "encode_unicode", - "lazy_static", - "libc", - "unicode-width", - "windows-sys 0.52.0", -] - [[package]] name = "console_error_panic_hook" version = "0.1.7" @@ -1093,24 +877,6 @@ version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" -[[package]] -name = "content_inspector" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7bda66e858c683005a53a9a60c69a4aca7eeaa45d124526e389f7aec8e62f38" -dependencies = [ - "memchr", -] - -[[package]] -name = "convert_case" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca" -dependencies = [ - "unicode-segmentation", -] - [[package]] name = "core-foundation" version = "0.9.4" @@ -1146,15 +912,6 @@ dependencies = [ "libc", ] -[[package]] -name = "crc32fast" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" -dependencies = [ - "cfg-if", -] - [[package]] name = "criterion" version = "0.5.1" @@ -1303,16 +1060,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "ctor" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edb49164822f3ee45b17acd4a208cfc1251410cf0cad9a833234c9890774dd9f" -dependencies = [ - "quote", - "syn 2.0.79", -] - [[package]] name = "darling" version = "0.20.10" @@ -1449,27 +1196,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "directories" -version = "5.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a49173b84e034382284f27f1af4dcbbd231ffa358c0fe316541a7337f376a35" -dependencies = [ - "dirs-sys", -] - -[[package]] -name = "dirs-sys" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" -dependencies = [ - "libc", - "option-ext", - "redox_users", - "windows-sys 0.48.0", -] - [[package]] name = "dyn-clone" version = "1.0.17" @@ -1519,21 +1245,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "encode_unicode" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" - -[[package]] -name = "encoding_rs" -version = "0.8.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" -dependencies = [ - "cfg-if", -] - [[package]] name = "env_filter" version = "0.1.2" @@ -1610,16 +1321,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "flate2" -version = "1.0.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1b589b4dc103969ad3cf85c950899926ec64300a1a46d76c03a6072957036f0" -dependencies = [ - "crc32fast", - "miniz_oxide 0.8.0", -] - [[package]] name = "fnv" version = "1.0.7" @@ -1787,19 +1488,6 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" -[[package]] -name = "globset" -version = "0.4.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15f1ce686646e7f1e19bf7d5533fe443a45dbfb990e00629110797578b42fb19" -dependencies = [ - "aho-corasick", - "bstr", - "log", - "regex-automata", - "regex-syntax", -] - [[package]] name = "goblin" version = "0.8.2" @@ -1917,15 +1605,6 @@ dependencies = [ "digest", ] -[[package]] -name = "home" -version = "0.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" -dependencies = [ - "windows-sys 0.52.0", -] - [[package]] name = "http" version = "1.1.0" @@ -2102,12 +1781,6 @@ dependencies = [ "serde", ] -[[package]] -name = "indoc" -version = "2.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5" - [[package]] name = "inout" version = "0.1.3" @@ -2248,16 +1921,6 @@ version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" -[[package]] -name = "libredox" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" -dependencies = [ - "bitflags 2.6.0", - "libc", -] - [[package]] name = "linux-raw-sys" version = "0.4.14" @@ -2286,15 +1949,6 @@ version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" -[[package]] -name = "memoffset" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" -dependencies = [ - "autocfg", -] - [[package]] name = "memory-testing" version = "0.1.0" @@ -2323,16 +1977,6 @@ dependencies = [ "unicase", ] -[[package]] -name = "minicov" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c71e683cd655513b99affab7d317deb690528255a0d5f717f1024093c12b169" -dependencies = [ - "cc", - "walkdir", -] - [[package]] name = "minimal-lexical" version = "0.2.1" @@ -2348,15 +1992,6 @@ dependencies = [ "adler", ] -[[package]] -name = "miniz_oxide" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" -dependencies = [ - "adler2", -] - [[package]] name = "mio" version = "0.8.11" @@ -2381,64 +2016,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "napi" -version = "2.16.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53575dfa17f208dd1ce3a2da2da4659aae393b256a472f2738a8586a6c4107fd" -dependencies = [ - "bitflags 2.6.0", - "ctor", - "napi-derive", - "napi-sys", - "once_cell", - "tokio", -] - -[[package]] -name = "napi-build" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1c0f5d67ee408a4685b61f5ab7e58605c8ae3f2b4189f0127d804ff13d5560a" - -[[package]] -name = "napi-derive" -version = "2.16.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17435f7a00bfdab20b0c27d9c56f58f6499e418252253081bfff448099da31d1" -dependencies = [ - "cfg-if", - "convert_case", - "napi-derive-backend", - "proc-macro2", - "quote", - "syn 2.0.79", -] - -[[package]] -name = "napi-derive-backend" -version = "1.0.74" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "967c485e00f0bf3b1bdbe510a38a4606919cf1d34d9a37ad41f25a81aa077abe" -dependencies = [ - "convert_case", - "once_cell", - "proc-macro2", - "quote", - "regex", - "semver", - "syn 2.0.79", -] - -[[package]] -name = "napi-sys" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "427802e8ec3a734331fec1035594a210ce1ff4dc5bc1950530920ab717964ea3" -dependencies = [ - "libloading", -] - [[package]] name = "newline-converter" version = "0.3.0" @@ -2458,15 +2035,6 @@ dependencies = [ "minimal-lexical", ] -[[package]] -name = "nu-ansi-term" -version = "0.49.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c073d3c1930d0751774acf49e66653acecb416c3a54c6ec095a9b11caddb5a68" -dependencies = [ - "windows-sys 0.48.0", -] - [[package]] name = "num-bigint" version = "0.4.6" @@ -2555,28 +2123,6 @@ version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" -[[package]] -name = "onig" -version = "6.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c4b31c8722ad9171c6d77d3557db078cab2bd50afcc9d09c8b315c59df8ca4f" -dependencies = [ - "bitflags 1.3.2", - "libc", - "once_cell", - "onig_sys", -] - -[[package]] -name = "onig_sys" -version = "69.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b829e3d7e9cc74c7e315ee8edb185bf4190da5acde74afd7fc59c35b1f086e7" -dependencies = [ - "cc", - "pkg-config", -] - [[package]] name = "oorandom" version = "11.1.4" @@ -2589,12 +2135,6 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" -[[package]] -name = "option-ext" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" - [[package]] name = "oslog" version = "0.2.0" @@ -2728,15 +2268,6 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" -[[package]] -name = "path_abs" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05ef02f6342ac01d8a93b65f96db53fe68a92a15f41144f97fb00a9e669633c3" -dependencies = [ - "std_prelude", -] - [[package]] name = "pbkdf2" version = "0.12.2" @@ -2794,31 +2325,12 @@ dependencies = [ "spki", ] -[[package]] -name = "pkg-config" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" - [[package]] name = "plain" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" -[[package]] -name = "plist" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42cf17e9a1800f5f396bc67d193dc9411b59012a5876445ef450d449881e1016" -dependencies = [ - "base64", - "indexmap 2.6.0", - "quick-xml", - "serde", - "time", -] - [[package]] name = "plotters" version = "0.3.7" @@ -2847,12 +2359,6 @@ dependencies = [ "plotters-backend", ] -[[package]] -name = "portable-atomic" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc9c68a3f6da06753e9335d63e27f6b9754dd1920d941135b7ea8224f141adb2" - [[package]] name = "powerfmt" version = "0.2.0" @@ -2915,89 +2421,6 @@ name = "public-suffix" version = "0.1.1" source = "git+https://github.com/bitwarden/passkey-rs?rev=ff757604cd7b4e8f321ed1616fef7e40e21ac5df#ff757604cd7b4e8f321ed1616fef7e40e21ac5df" -[[package]] -name = "pyo3" -version = "0.22.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15ee168e30649f7f234c3d49ef5a7a6cbf5134289bc46c29ff3155fa3221c225" -dependencies = [ - "cfg-if", - "indoc", - "libc", - "memoffset", - "once_cell", - "portable-atomic", - "pyo3-build-config", - "pyo3-ffi", - "pyo3-macros", - "unindent", -] - -[[package]] -name = "pyo3-build-config" -version = "0.22.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e61cef80755fe9e46bb8a0b8f20752ca7676dcc07a5277d8b7768c6172e529b3" -dependencies = [ - "once_cell", - "target-lexicon", -] - -[[package]] -name = "pyo3-ffi" -version = "0.22.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67ce096073ec5405f5ee2b8b31f03a68e02aa10d5d4f565eca04acc41931fa1c" -dependencies = [ - "libc", - "pyo3-build-config", -] - -[[package]] -name = "pyo3-log" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ac84e6eec1159bc2a575c9ae6723baa6ee9d45873e9bebad1e3ad7e8d28a443" -dependencies = [ - "arc-swap", - "log", - "pyo3", -] - -[[package]] -name = "pyo3-macros" -version = "0.22.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2440c6d12bc8f3ae39f1e775266fa5122fd0c8891ce7520fa6048e683ad3de28" -dependencies = [ - "proc-macro2", - "pyo3-macros-backend", - "quote", - "syn 2.0.79", -] - -[[package]] -name = "pyo3-macros-backend" -version = "0.22.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1be962f0e06da8f8465729ea2cb71a416d2257dff56cbe40a70d3e62a93ae5d1" -dependencies = [ - "heck 0.5.0", - "proc-macro2", - "pyo3-build-config", - "quote", - "syn 2.0.79", -] - -[[package]] -name = "quick-xml" -version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d3a6e5838b60e0e8fa7a43f22ade549a37d61f8bdbe636d0d7816191de969c2" -dependencies = [ - "memchr", -] - [[package]] name = "quinn" version = "0.11.5" @@ -3114,17 +2537,6 @@ dependencies = [ "bitflags 2.6.0", ] -[[package]] -name = "redox_users" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" -dependencies = [ - "getrandom", - "libredox", - "thiserror", -] - [[package]] name = "regex" version = "1.11.0" @@ -3207,15 +2619,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "rgb" -version = "0.8.50" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57397d16646700483b67d2dd6511d79318f9d057fdbd21a4066aeac8b41d310a" -dependencies = [ - "bytemuck", -] - [[package]] name = "ring" version = "0.17.8" @@ -3231,12 +2634,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "roff" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88f8660c1ff60292143c98d08fc6e2f654d722db50410e3f3797d40baaf9d8f3" - [[package]] name = "rsa" version = "0.9.6" @@ -3400,7 +2797,6 @@ checksum = "09c024468a378b7e36765cd36702b7a90cc3cba11654f6685c8f233408e89e92" dependencies = [ "chrono", "dyn-clone", - "indexmap 1.9.3", "schemars_derive", "serde", "serde_json", @@ -3419,12 +2815,6 @@ dependencies = [ "syn 2.0.79", ] -[[package]] -name = "scoped-tls" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" - [[package]] name = "scopeguard" version = "1.2.0" @@ -3451,19 +2841,6 @@ dependencies = [ "syn 2.0.79", ] -[[package]] -name = "sdk-schemas" -version = "0.1.0" -dependencies = [ - "anyhow", - "bitwarden", - "bitwarden-json", - "bitwarden-uniffi", - "itertools 0.13.0", - "schemars", - "serde_json", -] - [[package]] name = "sec1" version = "0.7.3" @@ -3589,15 +2966,6 @@ dependencies = [ "syn 2.0.79", ] -[[package]] -name = "serde_spanned" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" -dependencies = [ - "serde", -] - [[package]] name = "serde_urlencoded" version = "0.7.1" @@ -3640,19 +3008,6 @@ dependencies = [ "syn 2.0.79", ] -[[package]] -name = "serde_yaml" -version = "0.9.34+deprecated" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" -dependencies = [ - "indexmap 2.6.0", - "itoa", - "ryu", - "serde", - "unsafe-libyaml", -] - [[package]] name = "serdect" version = "0.2.0" @@ -3799,12 +3154,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" -[[package]] -name = "std_prelude" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8207e78455ffdf55661170876f88daf85356e4edd54e0a3dbc79586ca1e50cbe" - [[package]] name = "strsim" version = "0.11.1" @@ -3897,32 +3246,6 @@ dependencies = [ "futures-core", ] -[[package]] -name = "syntect" -version = "5.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "874dcfa363995604333cf947ae9f751ca3af4522c60886774c4963943b4746b1" -dependencies = [ - "bincode", - "bitflags 1.3.2", - "flate2", - "fnv", - "once_cell", - "onig", - "regex-syntax", - "serde", - "serde_derive", - "serde_json", - "thiserror", - "walkdir", -] - -[[package]] -name = "target-lexicon" -version = "0.12.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" - [[package]] name = "tempfile" version = "3.13.0" @@ -4091,40 +3414,6 @@ dependencies = [ "serde", ] -[[package]] -name = "toml" -version = "0.8.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" -dependencies = [ - "serde", - "serde_spanned", - "toml_datetime", - "toml_edit", -] - -[[package]] -name = "toml_datetime" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" -dependencies = [ - "serde", -] - -[[package]] -name = "toml_edit" -version = "0.22.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" -dependencies = [ - "indexmap 2.6.0", - "serde", - "serde_spanned", - "toml_datetime", - "winnow", -] - [[package]] name = "tower-service" version = "0.3.3" @@ -4291,7 +3580,7 @@ dependencies = [ "paste", "serde", "textwrap", - "toml 0.5.11", + "toml", "uniffi_meta", "uniffi_udl", ] @@ -4347,7 +3636,7 @@ dependencies = [ "quote", "serde", "syn 2.0.79", - "toml 0.5.11", + "toml", "uniffi_meta", ] @@ -4389,18 +3678,6 @@ dependencies = [ "weedle2", ] -[[package]] -name = "unindent" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7de7d73e1754487cb58364ee906a499937a0dfabd86bcb980fa99ec8c8fa2ce" - -[[package]] -name = "unsafe-libyaml" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" - [[package]] name = "untrusted" version = "0.9.0" @@ -4570,32 +3847,6 @@ version = "0.2.94" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a42f6c679374623f295a8623adfe63d9284091245c3504bde47c17a3ce2777d9" -[[package]] -name = "wasm-bindgen-test" -version = "0.3.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a93d2a9ae98f1af8953f6415397299d808cce0a24f6d7c613d27bd83edf98da8" -dependencies = [ - "console_error_panic_hook", - "js-sys", - "minicov", - "scoped-tls", - "wasm-bindgen", - "wasm-bindgen-futures", - "wasm-bindgen-test-macro", -] - -[[package]] -name = "wasm-bindgen-test-macro" -version = "0.3.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb8b294691f640bad8f2bb35a11bb28272701b1d687bd5fd661a27684e894d4d" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.79", -] - [[package]] name = "web-sys" version = "0.3.71" @@ -4624,18 +3875,6 @@ dependencies = [ "nom", ] -[[package]] -name = "which" -version = "6.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4ee928febd44d98f2f459a4a79bd4d928591333a494a10a868418ac1b39cf1f" -dependencies = [ - "either", - "home", - "rustix", - "winsafe", -] - [[package]] name = "winapi" version = "0.3.9" @@ -4854,21 +4093,6 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" -[[package]] -name = "winnow" -version = "0.6.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" -dependencies = [ - "memchr", -] - -[[package]] -name = "winsafe" -version = "0.0.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d135d17ab770252ad95e9a872d365cf3090e3be864a34ab46f48555993efc904" - [[package]] name = "wiremock" version = "0.6.2" diff --git a/README.md b/README.md index 14ca1f66..b972a674 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,7 @@ -# Bitwarden SDK +# Bitwarden Internal SDK -This repository houses the Bitwarden SDKs. We currently provide a public Secrets Manager SDK and an -internal SDK for the Bitwarden Password Manager which is used for the native mobile applications. -The SDK is written in Rust and provides a Rust API, CLI and various language bindings. +This repository houses the internal Bitwarden SDKs. We also provide a public +[Secrets Manager SDK](https://github.com/bitwarden/sdk-sm). ### Disclaimer @@ -58,27 +57,6 @@ are: server. - [`bitwarden-api-identity`](./crates/bitwarden-api-identity/): Auto-generated API bindings for the Identity server. -- [`bitwarden-c`](./crates/bitwarden-c/): C bindings for FFI interop. -- [`bitwarden-json`](./crates/bitwarden-json/): JSON wrapper around the `bitwarden` crate. Powers - the other language bindings. -- [`bitwarden-napi`](./crates/bitwarden-napi/): Node-API bindings. -- [`bws`](./crates/bws/): CLI for interacting with the [Bitwarden Secrets Manager][secrets-manager]. - Review the [CLI documentation][bws-help]. -- [`sdk-schemas`](./crates/sdk-schemas/): Generator for the _json schemas_. - -## Schemas - -To minimize the amount of work required to support additional bindings the project is structured -around a `json` based API. With every binding only needing to implement one method, namely -`run_command`. - -To ensure type safety in the API, _json schemas_ are generated from the rust structs in `bitwarden` -using [schemars](https://crates.io/crates/schemars). The _json schemas_ are later used to generate -the API bindings for each language using [QuickType](https://github.com/quicktype/quicktype). - -```bash -npm run schemas -``` ## API Bindings @@ -132,9 +110,6 @@ The list of developer tools is: `cargo install cargo-nextest --locked`. It can be manually run using `cargo nextest run --all-features` -[secrets-manager]: https://bitwarden.com/products/secrets-manager/ -[bws-help]: https://bitwarden.com/help/secrets-manager-cli/ - ## Cargo fmt We use certain unstable features for formatting which require the nightly version of cargo-fmt. diff --git a/crates/bitwarden-c/Cargo.toml b/crates/bitwarden-c/Cargo.toml deleted file mode 100644 index 9e09641f..00000000 --- a/crates/bitwarden-c/Cargo.toml +++ /dev/null @@ -1,25 +0,0 @@ -[package] -name = "bitwarden-c" -version = "0.1.0" -publish = false - -authors.workspace = true -edition.workspace = true -rust-version.workspace = true -homepage.workspace = true -repository.workspace = true -license-file.workspace = true - -[lib] -crate-type = ["staticlib", "cdylib"] -bench = false - -[target.'cfg(not(target_arch="wasm32"))'.dependencies] -tokio = { version = ">=1.28.2, <2.0", features = ["rt-multi-thread", "macros"] } -bitwarden-json = { path = "../bitwarden-json", features = ["secrets"] } - -[dependencies] -env_logger = ">=0.10.0, <0.12" - -[lints] -workspace = true diff --git a/crates/bitwarden-c/src/c.rs b/crates/bitwarden-c/src/c.rs deleted file mode 100644 index 158c3802..00000000 --- a/crates/bitwarden-c/src/c.rs +++ /dev/null @@ -1,58 +0,0 @@ -use std::{ffi::CStr, os::raw::c_char, str}; - -use bitwarden_json::client::Client; - -use crate::{box_ptr, ffi_ref}; - -#[repr(C)] -pub struct CClient { - /// Associates the tokio runtime to the `Client`, ensuring the runtime has the same lifecycle - /// as the `Client`. - runtime: tokio::runtime::Runtime, - client: Client, -} - -#[no_mangle] -pub extern "C" fn run_command(c_str_ptr: *const c_char, client_ptr: *const CClient) -> *mut c_char { - let client = unsafe { ffi_ref!(client_ptr) }; - let input_str = str::from_utf8(unsafe { CStr::from_ptr(c_str_ptr) }.to_bytes()) - .expect("Input should be a valid string"); - - let result = client - .runtime - .block_on(client.client.run_command(input_str)); - - match std::ffi::CString::new(result) { - Ok(cstr) => cstr.into_raw(), - Err(_) => panic!("failed to return command result: null encountered"), - } -} - -// Init client, potential leak! You need to call free_mem after this! -#[no_mangle] -pub extern "C" fn init(c_str_ptr: *const c_char) -> *mut CClient { - // This will only fail if another logger was already initialized, so we can ignore the result - let _ = env_logger::try_init(); - - let runtime = tokio::runtime::Builder::new_multi_thread() - .enable_all() - .build() - .expect("Failed to build tokio runtime"); - - let client = if c_str_ptr.is_null() { - Client::new(None) - } else { - let input_string = str::from_utf8(unsafe { CStr::from_ptr(c_str_ptr) }.to_bytes()) - .expect("Input should be a valid string") - .to_owned(); - Client::new(Some(input_string)) - }; - - box_ptr!(CClient { runtime, client }) -} - -// Free mem -#[no_mangle] -pub extern "C" fn free_mem(client_ptr: *mut CClient) { - std::mem::drop(unsafe { Box::from_raw(client_ptr) }); -} diff --git a/crates/bitwarden-c/src/lib.rs b/crates/bitwarden-c/src/lib.rs deleted file mode 100644 index 2d6961b8..00000000 --- a/crates/bitwarden-c/src/lib.rs +++ /dev/null @@ -1,9 +0,0 @@ -// These are the C bindings, we're going to have to use unsafe raw pointers -#![allow(clippy::not_unsafe_ptr_arg_deref)] - -#[cfg(not(target_arch = "wasm32"))] -pub use c::*; - -#[cfg(not(target_arch = "wasm32"))] -mod c; -mod macros; diff --git a/crates/bitwarden-c/src/macros/ffi.rs b/crates/bitwarden-c/src/macros/ffi.rs deleted file mode 100644 index d7384cd4..00000000 --- a/crates/bitwarden-c/src/macros/ffi.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Get a reference to an object from a pointer -#[macro_export] -macro_rules! ffi_ref { - ($name:ident) => {{ - assert!(!$name.is_null()); - &*$name - }}; -} - -// Returns a raw pointer from an object -#[macro_export] -macro_rules! box_ptr { - ($x:expr) => { - Box::into_raw(Box::new($x)) - }; -} diff --git a/crates/bitwarden-c/src/macros/mod.rs b/crates/bitwarden-c/src/macros/mod.rs deleted file mode 100644 index 57ae9b9e..00000000 --- a/crates/bitwarden-c/src/macros/mod.rs +++ /dev/null @@ -1 +0,0 @@ -mod ffi; diff --git a/crates/bitwarden-json/Cargo.toml b/crates/bitwarden-json/Cargo.toml deleted file mode 100644 index b5b8052b..00000000 --- a/crates/bitwarden-json/Cargo.toml +++ /dev/null @@ -1,29 +0,0 @@ -[package] -name = "bitwarden-json" -version = "0.3.0" -description = """ -JSON bindings for the Bitwarden Secret Manager SDK -""" -keywords = ["bitwarden", "secrets-manager"] -categories = ["api-bindings"] -publish = false - -authors.workspace = true -edition.workspace = true -rust-version.workspace = true -homepage.workspace = true -repository.workspace = true -license-file.workspace = true - -[features] -secrets = ["bitwarden/secrets"] # Secrets manager API - -[dependencies] -bitwarden = { workspace = true } -log = ">=0.4.18, <0.5" -schemars = { workspace = true } -serde = { workspace = true } -serde_json = { workspace = true } - -[lints] -workspace = true diff --git a/crates/bitwarden-json/src/client.rs b/crates/bitwarden-json/src/client.rs deleted file mode 100644 index 8da635a2..00000000 --- a/crates/bitwarden-json/src/client.rs +++ /dev/null @@ -1,102 +0,0 @@ -use bitwarden::ClientSettings; -#[cfg(feature = "secrets")] -use bitwarden::{ - generators::ClientGeneratorExt, - secrets_manager::{ClientProjectsExt, ClientSecretsExt}, -}; - -#[cfg(feature = "secrets")] -use crate::command::{GeneratorsCommand, ProjectsCommand, SecretsCommand}; -use crate::{ - command::Command, - response::{Response, ResponseIntoString}, -}; - -pub struct Client(bitwarden::Client); - -impl Client { - pub fn new(settings_input: Option) -> Self { - let settings = Self::parse_settings(settings_input); - Self(bitwarden::Client::new(settings)) - } - - pub async fn run_command(&self, input_str: &str) -> String { - const SUBCOMMANDS_TO_CLEAN: &[&str] = &["Secrets"]; - let mut cmd_value: serde_json::Value = match serde_json::from_str(input_str) { - Ok(cmd) => cmd, - Err(e) => { - return Response::error(format!("Invalid command string: {}", e)).into_string() - } - }; - - if let Some(cmd_value_map) = cmd_value.as_object_mut() { - cmd_value_map.retain(|_, v| !v.is_null()); - - for &subcommand in SUBCOMMANDS_TO_CLEAN { - if let Some(cmd_value_secrets) = cmd_value_map - .get_mut(subcommand) - .and_then(|v| v.as_object_mut()) - { - cmd_value_secrets.retain(|_, v| !v.is_null()); - } - } - } - - let cmd: Command = match serde_json::from_value(cmd_value) { - Ok(cmd) => cmd, - Err(e) => { - return Response::error(format!("Invalid command value: {}", e)).into_string() - } - }; - - let client = &self.0; - - match cmd { - #[cfg(feature = "secrets")] - Command::LoginAccessToken(req) => { - client.auth().login_access_token(&req).await.into_string() - } - - #[cfg(feature = "secrets")] - Command::Secrets(cmd) => match cmd { - SecretsCommand::Get(req) => client.secrets().get(&req).await.into_string(), - SecretsCommand::GetByIds(req) => { - client.secrets().get_by_ids(req).await.into_string() - } - SecretsCommand::Create(req) => client.secrets().create(&req).await.into_string(), - SecretsCommand::List(req) => client.secrets().list(&req).await.into_string(), - SecretsCommand::Update(req) => client.secrets().update(&req).await.into_string(), - SecretsCommand::Delete(req) => client.secrets().delete(req).await.into_string(), - SecretsCommand::Sync(req) => client.secrets().sync(&req).await.into_string(), - }, - - #[cfg(feature = "secrets")] - Command::Projects(cmd) => match cmd { - ProjectsCommand::Get(req) => client.projects().get(&req).await.into_string(), - ProjectsCommand::Create(req) => client.projects().create(&req).await.into_string(), - ProjectsCommand::List(req) => client.projects().list(&req).await.into_string(), - ProjectsCommand::Update(req) => client.projects().update(&req).await.into_string(), - ProjectsCommand::Delete(req) => client.projects().delete(req).await.into_string(), - }, - - #[cfg(feature = "secrets")] - Command::Generators(cmd) => match cmd { - GeneratorsCommand::GeneratePassword(req) => { - client.generator().password(req).into_string() - } - }, - } - } - - fn parse_settings(settings_input: Option) -> Option { - if let Some(input) = settings_input.as_ref() { - match serde_json::from_str(input) { - Ok(settings) => return Some(settings), - Err(e) => { - log::error!("Failed to parse settings: {}", e); - } - } - } - None - } -} diff --git a/crates/bitwarden-json/src/command.rs b/crates/bitwarden-json/src/command.rs deleted file mode 100644 index faaa8177..00000000 --- a/crates/bitwarden-json/src/command.rs +++ /dev/null @@ -1,144 +0,0 @@ -#[cfg(feature = "secrets")] -use bitwarden::{ - auth::login::AccessTokenLoginRequest, - generators::PasswordGeneratorRequest, - secrets_manager::{ - projects::{ - ProjectCreateRequest, ProjectGetRequest, ProjectPutRequest, ProjectsDeleteRequest, - ProjectsListRequest, - }, - secrets::{ - SecretCreateRequest, SecretGetRequest, SecretIdentifiersRequest, SecretPutRequest, - SecretsDeleteRequest, SecretsGetRequest, SecretsSyncRequest, - }, - }, -}; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -#[derive(Serialize, Deserialize, JsonSchema, Debug)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub enum Command { - #[cfg(feature = "secrets")] - /// Login with Secrets Manager Access Token - /// - /// This command is for initiating an authentication handshake with Bitwarden. - /// - /// Returns: [ApiKeyLoginResponse](bitwarden::auth::login::ApiKeyLoginResponse) - LoginAccessToken(AccessTokenLoginRequest), - - #[cfg(feature = "secrets")] - Secrets(SecretsCommand), - #[cfg(feature = "secrets")] - Projects(ProjectsCommand), - #[cfg(feature = "secrets")] - Generators(GeneratorsCommand), -} - -#[cfg(feature = "secrets")] -#[derive(Serialize, Deserialize, JsonSchema, Debug)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub enum SecretsCommand { - /// > Requires Authentication - /// > Requires using an Access Token for login or calling Sync at least once - /// Retrieve a secret by the provided identifier - /// - /// Returns: [SecretResponse](bitwarden::secrets_manager::secrets::SecretResponse) - Get(SecretGetRequest), - - /// > Requires Authentication - /// > Requires using an Access Token for login or calling Sync at least once - /// Retrieve secrets by the provided identifiers - /// - /// Returns: [SecretsResponse](bitwarden::secrets_manager::secrets::SecretsResponse) - GetByIds(SecretsGetRequest), - - /// > Requires Authentication - /// > Requires using an Access Token for login or calling Sync at least once - /// Creates a new secret in the provided organization using the given data - /// - /// Returns: [SecretResponse](bitwarden::secrets_manager::secrets::SecretResponse) - Create(SecretCreateRequest), - - /// > Requires Authentication - /// > Requires using an Access Token for login or calling Sync at least once - /// Lists all secret identifiers of the given organization, to then retrieve each secret, use - /// `CreateSecret` - /// - /// Returns: [SecretIdentifiersResponse](bitwarden::secrets_manager::secrets::SecretIdentifiersResponse) - List(SecretIdentifiersRequest), - - /// > Requires Authentication - /// > Requires using an Access Token for login or calling Sync at least once - /// Updates an existing secret with the provided ID using the given data - /// - /// Returns: [SecretResponse](bitwarden::secrets_manager::secrets::SecretResponse) - Update(SecretPutRequest), - - /// > Requires Authentication - /// > Requires using an Access Token for login or calling Sync at least once - /// Deletes all the secrets whose IDs match the provided ones - /// - /// Returns: [SecretsDeleteResponse](bitwarden::secrets_manager::secrets::SecretsDeleteResponse) - Delete(SecretsDeleteRequest), - - /// > Requires Authentication - /// > Requires using an Access Token for login - /// Retrieve the secrets accessible by the authenticated machine account - /// Optionally, provide the last synced date to assess whether any changes have occurred - /// If changes are detected, retrieves all the secrets accessible by the authenticated machine - /// account - /// - /// Returns: [SecretsSyncResponse](bitwarden::secrets_manager::secrets::SecretsSyncResponse) - Sync(SecretsSyncRequest), -} - -#[cfg(feature = "secrets")] -#[derive(Serialize, Deserialize, JsonSchema, Debug)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub enum ProjectsCommand { - /// > Requires Authentication - /// > Requires using an Access Token for login or calling Sync at least once - /// Retrieve a project by the provided identifier - /// - /// Returns: [ProjectResponse](bitwarden::secrets_manager::projects::ProjectResponse) - Get(ProjectGetRequest), - - /// > Requires Authentication - /// > Requires using an Access Token for login or calling Sync at least once - /// Creates a new project in the provided organization using the given data - /// - /// Returns: [ProjectResponse](bitwarden::secrets_manager::projects::ProjectResponse) - Create(ProjectCreateRequest), - - /// > Requires Authentication - /// > Requires using an Access Token for login or calling Sync at least once - /// Lists all projects of the given organization - /// - /// Returns: [ProjectsResponse](bitwarden::secrets_manager::projects::ProjectsResponse) - List(ProjectsListRequest), - - /// > Requires Authentication - /// > Requires using an Access Token for login or calling Sync at least once - /// Updates an existing project with the provided ID using the given data - /// - /// Returns: [ProjectResponse](bitwarden::secrets_manager::projects::ProjectResponse) - Update(ProjectPutRequest), - - /// > Requires Authentication - /// > Requires using an Access Token for login or calling Sync at least once - /// Deletes all the projects whose IDs match the provided ones - /// - /// Returns: [ProjectsDeleteResponse](bitwarden::secrets_manager::projects::ProjectsDeleteResponse) - Delete(ProjectsDeleteRequest), -} - -#[cfg(feature = "secrets")] -#[derive(Serialize, Deserialize, JsonSchema, Debug)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub enum GeneratorsCommand { - /// Generate a password - /// - /// Returns: [String] - GeneratePassword(PasswordGeneratorRequest), -} diff --git a/crates/bitwarden-json/src/lib.rs b/crates/bitwarden-json/src/lib.rs deleted file mode 100644 index 832fa316..00000000 --- a/crates/bitwarden-json/src/lib.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub mod client; -pub mod command; -pub mod response; diff --git a/crates/bitwarden-json/src/response.rs b/crates/bitwarden-json/src/response.rs deleted file mode 100644 index b76d97aa..00000000 --- a/crates/bitwarden-json/src/response.rs +++ /dev/null @@ -1,64 +0,0 @@ -use std::error::Error; - -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; - -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub struct Response { - /// Whether or not the SDK request succeeded. - pub success: bool, - /// A message for any error that may occur. Populated if `success` is false. - pub error_message: Option, - /// The response data. Populated if `success` is true. - pub data: Option, -} - -impl Response { - pub fn new(response: Result) -> Self { - match response { - Ok(data) => Self { - success: true, - error_message: None, - data: Some(data), - }, - Err(err) => Self { - success: false, - error_message: Some(err.to_string()), - data: None, - }, - } - } -} - -impl Response<()> { - pub fn error(message: String) -> Self { - Self { - success: false, - error_message: Some(message), - data: None, - } - } -} - -pub(crate) trait ResponseIntoString { - fn into_string(self) -> String; -} - -impl ResponseIntoString for Result { - fn into_string(self) -> String { - Response::new(self).into_string() - } -} - -impl ResponseIntoString for Response { - fn into_string(self) -> String { - match serde_json::to_string(&self) { - Ok(ser) => ser, - Err(e) => { - let error = Response::error(format!("Failed to serialize Response: {}", e)); - serde_json::to_string(&error).expect("Serialize should be infallible") - } - } - } -} diff --git a/crates/bitwarden-napi/.npmignore b/crates/bitwarden-napi/.npmignore deleted file mode 100644 index ec144db2..00000000 --- a/crates/bitwarden-napi/.npmignore +++ /dev/null @@ -1,13 +0,0 @@ -target -Cargo.lock -.cargo -.github -npm -.eslintrc -.prettierignore -rustfmt.toml -yarn.lock -*.node -.yarn -__test__ -renovate.json diff --git a/crates/bitwarden-napi/Cargo.toml b/crates/bitwarden-napi/Cargo.toml deleted file mode 100644 index 7a9deeb8..00000000 --- a/crates/bitwarden-napi/Cargo.toml +++ /dev/null @@ -1,33 +0,0 @@ -[package] -name = "bitwarden-napi" -version = "1.0.0" -description = """ -N-API bindings for the Bitwarden Secrets Manager SDK -""" -keywords = ["bitwarden", "secrets-manager"] -publish = false - -authors.workspace = true -edition.workspace = true -rust-version.workspace = true -homepage.workspace = true -repository.workspace = true -license-file.workspace = true - -[lib] -crate-type = ["cdylib", "rlib"] - -[dependencies] -bitwarden-json = { path = "../bitwarden-json", version = "0.3.0", features = [ - "secrets", -] } -env_logger = "0.11.1" -log = { workspace = true } -napi = { version = "2", features = ["async"] } -napi-derive = "2" - -[build-dependencies] -napi-build = "2.1.0" - -[lints] -workspace = true diff --git a/crates/bitwarden-napi/README.md b/crates/bitwarden-napi/README.md deleted file mode 100644 index 6fce8d06..00000000 --- a/crates/bitwarden-napi/README.md +++ /dev/null @@ -1,32 +0,0 @@ -## Bitwarden Secrets Manager SDK - -Node-API bindings for interacting with the Bitwarden Secrets Manager. This is a beta release and -might be missing some functionality. - -## Getting started - -```ts -import { BitwardenClient, ClientSettings, DeviceType, LogLevel } from "@bitwarden/sdk-napi"; - -// Optional settings -const settings: ClientSettings = { - apiUrl: "https://api.bitwarden.com", - identityUrl: "https://identity.bitwarden.com", - userAgent: "Bitwarden SDK", - deviceType: DeviceType.SDK, -}; - -const accessToken = "-- REDACTED --"; -const stateFile = "some/path/to/state/file"; - -const client = new BitwardenClient(settings, LogLevel.Info); - -// Authenticating using a machine account access token -await client.auth().loginAccessToken(accessToken, stateFile); - -// List secrets -const secrets = await client.secrets().list(); - -// Get a specific secret -const secret = await client.secrets().get("secret-id"); -``` diff --git a/crates/bitwarden-napi/binding.d.ts b/crates/bitwarden-napi/binding.d.ts deleted file mode 100644 index 174d33d9..00000000 --- a/crates/bitwarden-napi/binding.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ - -/* auto-generated by NAPI-RS */ - -export const enum LogLevel { - Trace = 0, - Debug = 1, - Info = 2, - Warn = 3, - Error = 4, -} -export declare class BitwardenClient { - constructor(settingsInput?: string | undefined | null, logLevel?: LogLevel | undefined | null); - runCommand(commandInput: string): Promise; -} diff --git a/crates/bitwarden-napi/binding.js b/crates/bitwarden-napi/binding.js deleted file mode 100644 index 3da97e8f..00000000 --- a/crates/bitwarden-napi/binding.js +++ /dev/null @@ -1,290 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -/* prettier-ignore */ - -/* auto-generated by NAPI-RS */ - -const { existsSync, readFileSync } = require('fs') -const { join } = require("path"); - -const { platform, arch } = process; - -let nativeBinding = null; -let localFileExisted = false; -let loadError = null; - -function isMusl() { - // For Node 10 - if (!process.report || typeof process.report.getReport !== "function") { - try { - const lddPath = require("child_process").execSync("which ldd").toString().trim(); - return readFileSync(lddPath, "utf8").includes("musl"); - } catch (e) { - return true; - } - } else { - const { glibcVersionRuntime } = process.report.getReport().header; - return !glibcVersionRuntime; - } -} - -switch (platform) { - case "android": - switch (arch) { - case "arm64": - localFileExisted = existsSync(join(__dirname, "sdk-napi.android-arm64.node")); - try { - if (localFileExisted) { - nativeBinding = require("./sdk-napi.android-arm64.node"); - } else { - nativeBinding = require("@bitwarden/sdk-napi-android-arm64"); - } - } catch (e) { - loadError = e; - } - break; - case "arm": - localFileExisted = existsSync(join(__dirname, "sdk-napi.android-arm-eabi.node")); - try { - if (localFileExisted) { - nativeBinding = require("./sdk-napi.android-arm-eabi.node"); - } else { - nativeBinding = require("@bitwarden/sdk-napi-android-arm-eabi"); - } - } catch (e) { - loadError = e; - } - break; - default: - throw new Error(`Unsupported architecture on Android ${arch}`); - } - break; - case "win32": - switch (arch) { - case "x64": - localFileExisted = existsSync(join(__dirname, "sdk-napi.win32-x64-msvc.node")); - try { - if (localFileExisted) { - nativeBinding = require("./sdk-napi.win32-x64-msvc.node"); - } else { - nativeBinding = require("@bitwarden/sdk-napi-win32-x64-msvc"); - } - } catch (e) { - loadError = e; - } - break; - case "ia32": - localFileExisted = existsSync(join(__dirname, "sdk-napi.win32-ia32-msvc.node")); - try { - if (localFileExisted) { - nativeBinding = require("./sdk-napi.win32-ia32-msvc.node"); - } else { - nativeBinding = require("@bitwarden/sdk-napi-win32-ia32-msvc"); - } - } catch (e) { - loadError = e; - } - break; - case "arm64": - localFileExisted = existsSync(join(__dirname, "sdk-napi.win32-arm64-msvc.node")); - try { - if (localFileExisted) { - nativeBinding = require("./sdk-napi.win32-arm64-msvc.node"); - } else { - nativeBinding = require("@bitwarden/sdk-napi-win32-arm64-msvc"); - } - } catch (e) { - loadError = e; - } - break; - default: - throw new Error(`Unsupported architecture on Windows: ${arch}`); - } - break; - case "darwin": - localFileExisted = existsSync(join(__dirname, "sdk-napi.darwin-universal.node")); - try { - if (localFileExisted) { - nativeBinding = require("./sdk-napi.darwin-universal.node"); - } else { - nativeBinding = require("@bitwarden/sdk-napi-darwin-universal"); - } - break; - } catch {} - switch (arch) { - case "x64": - localFileExisted = existsSync(join(__dirname, "sdk-napi.darwin-x64.node")); - try { - if (localFileExisted) { - nativeBinding = require("./sdk-napi.darwin-x64.node"); - } else { - nativeBinding = require("@bitwarden/sdk-napi-darwin-x64"); - } - } catch (e) { - loadError = e; - } - break; - case "arm64": - localFileExisted = existsSync(join(__dirname, "sdk-napi.darwin-arm64.node")); - try { - if (localFileExisted) { - nativeBinding = require("./sdk-napi.darwin-arm64.node"); - } else { - nativeBinding = require("@bitwarden/sdk-napi-darwin-arm64"); - } - } catch (e) { - loadError = e; - } - break; - default: - throw new Error(`Unsupported architecture on macOS: ${arch}`); - } - break; - case "freebsd": - if (arch !== "x64") { - throw new Error(`Unsupported architecture on FreeBSD: ${arch}`); - } - localFileExisted = existsSync(join(__dirname, "sdk-napi.freebsd-x64.node")); - try { - if (localFileExisted) { - nativeBinding = require("./sdk-napi.freebsd-x64.node"); - } else { - nativeBinding = require("@bitwarden/sdk-napi-freebsd-x64"); - } - } catch (e) { - loadError = e; - } - break; - case "linux": - switch (arch) { - case "x64": - if (isMusl()) { - localFileExisted = existsSync(join(__dirname, "sdk-napi.linux-x64-musl.node")); - try { - if (localFileExisted) { - nativeBinding = require("./sdk-napi.linux-x64-musl.node"); - } else { - nativeBinding = require("@bitwarden/sdk-napi-linux-x64-musl"); - } - } catch (e) { - loadError = e; - } - } else { - localFileExisted = existsSync(join(__dirname, "sdk-napi.linux-x64-gnu.node")); - try { - if (localFileExisted) { - nativeBinding = require("./sdk-napi.linux-x64-gnu.node"); - } else { - nativeBinding = require("@bitwarden/sdk-napi-linux-x64-gnu"); - } - } catch (e) { - loadError = e; - } - } - break; - case "arm64": - if (isMusl()) { - localFileExisted = existsSync(join(__dirname, "sdk-napi.linux-arm64-musl.node")); - try { - if (localFileExisted) { - nativeBinding = require("./sdk-napi.linux-arm64-musl.node"); - } else { - nativeBinding = require("@bitwarden/sdk-napi-linux-arm64-musl"); - } - } catch (e) { - loadError = e; - } - } else { - localFileExisted = existsSync(join(__dirname, "sdk-napi.linux-arm64-gnu.node")); - try { - if (localFileExisted) { - nativeBinding = require("./sdk-napi.linux-arm64-gnu.node"); - } else { - nativeBinding = require("@bitwarden/sdk-napi-linux-arm64-gnu"); - } - } catch (e) { - loadError = e; - } - } - break; - case "arm": - if (isMusl()) { - localFileExisted = existsSync(join(__dirname, "sdk-napi.linux-arm-musleabihf.node")); - try { - if (localFileExisted) { - nativeBinding = require("./sdk-napi.linux-arm-musleabihf.node"); - } else { - nativeBinding = require("@bitwarden/sdk-napi-linux-arm-musleabihf"); - } - } catch (e) { - loadError = e; - } - } else { - localFileExisted = existsSync(join(__dirname, "sdk-napi.linux-arm-gnueabihf.node")); - try { - if (localFileExisted) { - nativeBinding = require("./sdk-napi.linux-arm-gnueabihf.node"); - } else { - nativeBinding = require("@bitwarden/sdk-napi-linux-arm-gnueabihf"); - } - } catch (e) { - loadError = e; - } - } - break; - case "riscv64": - if (isMusl()) { - localFileExisted = existsSync(join(__dirname, "sdk-napi.linux-riscv64-musl.node")); - try { - if (localFileExisted) { - nativeBinding = require("./sdk-napi.linux-riscv64-musl.node"); - } else { - nativeBinding = require("@bitwarden/sdk-napi-linux-riscv64-musl"); - } - } catch (e) { - loadError = e; - } - } else { - localFileExisted = existsSync(join(__dirname, "sdk-napi.linux-riscv64-gnu.node")); - try { - if (localFileExisted) { - nativeBinding = require("./sdk-napi.linux-riscv64-gnu.node"); - } else { - nativeBinding = require("@bitwarden/sdk-napi-linux-riscv64-gnu"); - } - } catch (e) { - loadError = e; - } - } - break; - case "s390x": - localFileExisted = existsSync(join(__dirname, "sdk-napi.linux-s390x-gnu.node")); - try { - if (localFileExisted) { - nativeBinding = require("./sdk-napi.linux-s390x-gnu.node"); - } else { - nativeBinding = require("@bitwarden/sdk-napi-linux-s390x-gnu"); - } - } catch (e) { - loadError = e; - } - break; - default: - throw new Error(`Unsupported architecture on Linux: ${arch}`); - } - break; - default: - throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`); -} - -if (!nativeBinding) { - if (loadError) { - throw loadError; - } - throw new Error(`Failed to load native binding`); -} - -const { LogLevel, BitwardenClient } = nativeBinding; - -module.exports.LogLevel = LogLevel; -module.exports.BitwardenClient = BitwardenClient; diff --git a/crates/bitwarden-napi/build.rs b/crates/bitwarden-napi/build.rs deleted file mode 100644 index 9fc23678..00000000 --- a/crates/bitwarden-napi/build.rs +++ /dev/null @@ -1,5 +0,0 @@ -extern crate napi_build; - -fn main() { - napi_build::setup(); -} diff --git a/crates/bitwarden-napi/npm/darwin-arm64/LICENSE b/crates/bitwarden-napi/npm/darwin-arm64/LICENSE deleted file mode 100644 index e9d496ff..00000000 --- a/crates/bitwarden-napi/npm/darwin-arm64/LICENSE +++ /dev/null @@ -1,295 +0,0 @@ -BITWARDEN SOFTWARE DEVELOPMENT KIT LICENSE AGREEMENT -Version 1, 17 March 2023 - -1. Introduction - -1.1 The Bitwarden Software Development Kit (referred to in the License Agreement -as the "SDK" and available for download at the following URL -https://github.com/bitwarden/sdk) is licensed to you subject to the terms of -this License Agreement. The License Agreement forms a legally binding contract -between you and the Company in relation to your use of the SDK. - -1.2 "Bitwarden" means the Bitwarden software made available by the Company, -available for download at the following URL, as updated from time to time. - -1.3 A "Compatible Application" means any software program or service that (i) -connects to and interoperates with a current version of the Bitwarden server -products distributed by the Company; and (ii) complies with the Companyâs -acceptable use policy available at the following URL: -https://bitwarden.com/terms/#acceptable_use. - -1.4 "Company" means Bitwarden Inc., organized under the laws of the State of -Delaware. - -2. Accepting this License Agreement - -2.1 In order to access or use the SDK, you must first agree to the License -Agreement. You may not access or use the SDK if you do not accept the License -Agreement. - -2.2 By clicking to accept and/or accessing or using the SDK, you hereby agree to -the terms of the License Agreement. - -2.3 You may not access or use the SDK and may not accept the License Agreement -if you are a person barred from receiving the SDK under the laws of the United -States or other countries, including the country in which you are resident or -from which you access or use the SDK. - -2.4 If you are agreeing to be bound by the License Agreement on behalf of your -employer or any other entity, you represent and warrant that you have full legal -authority to bind your employer or such other entity to the License Agreement. -If you do not have the requisite authority, you may not accept the License -Agreement or you may not access or use the SDK on behalf of your employer or -other entity. - -3. SDK License from Bitwarden - -3.1 Subject to the terms of this License Agreement, Bitwarden grants you a -limited, worldwide, royalty-free, non-assignable, non-exclusive, and -non-sublicensable license to use the SDK solely (a) to develop, test, and -demonstrate a Compatible Application; (b) to develop, test, and run a Compatible -Application for personal use by your family; or (c) to to develop, test, and run -a Compatible Application for the internal business operations of your -organization in connection with a paid license for a Bitwarden server product, -provided that in no case above may the Compatible Application be offered, -licensed, or sold to a third party. - -3.2 You agree that Bitwarden or third parties own all legal right, title and -interest in and to the SDK, including any Intellectual Property Rights that -subsist in the SDK. "Intellectual Property Rights" means any and all rights -under patent law, copyright law, trade secret law, trademark law, and any and -all other proprietary rights. Bitwarden reserves all rights not expressly -granted to you. - -3.3 You may not use this SDK to develop applications for use with software other -than Bitwarden (including non-compatible implementations of Bitwarden) or to -develop another SDK. - -3.4 You may not use the SDK for any purpose not expressly permitted by the -License Agreement. Except for contributions to Bitwarden pursuant to the -Contribution License Agreement available at this URL: -https://cla-assistant.io/bitwarden/clients, or to the extent required by -applicable third party licenses, you may not copy modify, adapt, redistribute, -decompile, reverse engineer, disassemble, or create derivative works of the SDK -or any part of the SDK. - -3.5 Use, reproduction, and distribution of a component of the SDK licensed under -an open source software license are governed solely by the terms of that open -source software license and not the License Agreement. - -3.6 You agree that the form and nature of the SDK that the Company provides may -change without prior notice to you and that future versions of the SDK may be -incompatible with applications developed on previous versions of the SDK. You -agree that the Company may stop (permanently or temporarily) providing the SDK -or any features within the SDK to you or to users generally at the Companyâs -sole discretion, without prior notice to you. - -3.7 Nothing in the License Agreement gives you a right to use any of the -Companyâs trade names, trademarks, service marks, logos, domain names, or other -distinctive brand features. - -3.8 You agree that you will not remove, obscure, or alter any proprietary rights -notices (including copyright and trademark notices) that may be affixed to or -contained within the SDK. - -4. Use of the SDK by You - -4.1 The Company agrees that it obtains no right, title, or interest from you (or -your licensors) under the License Agreement in or to any software applications -that you develop using the SDK, including any Intellectual Property Rights that -subsist in those applications. - -4.2 You agree to use the SDK and write applications only for purposes that are -permitted by (a) the License Agreement and (b) any applicable law, regulation or -generally accepted practices or guidelines in the relevant jurisdictions -(including any laws regarding the export of data or software to and from the -United States or other relevant countries). - -4.3 You agree that if you use the SDK to develop applications for other users, -you will protect the privacy and legal rights of those users. If the users -provide you with user names, passwords, or other login information or personal -information, you must make the users aware that the information will be -available to your application, and you must provide legally adequate privacy -notice and protection for those users. If your application stores personal or -sensitive information provided by users, it must do so securely. If the user -provides your application with Bitwarden Account information, your application -may only use that information to access the user's Bitwarden Account when, and -for the limited purposes for which, the user has given you permission to do so. - -4.4 You agree that you will not engage in any activity with the SDK, including -the development or distribution of an application, that interferes with, -disrupts, damages, or accesses in an unauthorized manner the servers, networks, -or other properties or services of any third party including, but not limited -to, the Company, or any mobile communications carrier or public cloud service. - -4.5 If you use the SDK to retrieve a user's data from Bitwarden, you acknowledge -and agree that you shall retrieve data only with the user's explicit consent and -only when, and for the limited purposes for which, the user has given you -permission to do so. - -4.6 You agree that you are solely responsible for, and that the Company has no -responsibility to you or to any third party for, any data, content, or resources -that you create, transmit or display through Bitwarden and/or applications for -Bitwarden, and for the consequences of your actions (including any loss or -damage which Bitwarden may suffer) by doing so. - -4.7 You agree that you are solely responsible for, and that the Company has no -responsibility to you or to any third party for, any breach of your obligations -under the License Agreement, any applicable third party contract or Terms of -Service, or any applicable law or regulation, and for the consequences -(including any loss or damage which the Company or any third party may suffer) -of any such breach. - -5. Third Party Applications - -5.1 If you use the SDK to integrate or run applications developed by a third -party or that access data, content or resources provided by a third party, you -agree that the Company is not responsible for those applications, data, content, -or resources. You understand that all data, content or resources which you may -access through such third party applications are the sole responsibility of the -person from which they originated and that the Company is not liable for any -loss or damage that you may experience as a result of the use or access of any -of those third party applications, data, content, or resources. - -5.2 You should be aware that the data, content, and resources presented to you -through such a third party application may be protected by intellectual property -rights which are owned by the providers (or by other persons or companies on -their behalf). You acknowledge that your use of such third party applications, -data, content, or resources may be subject to separate terms between you and the -relevant third party. In that case, the License Agreement does not affect your -legal relationship with these third parties. - -6. Use of Bitwarden Server - -You acknowledge and agree that the Bitwarden server products to which any -Compatible Application must connect is protected by intellectual property rights -which are owned by the Company and your use of the Bitwarden server products is -subject to additional terms not set forth in this License Agreement. - -7. Terminating this License Agreement - -7.1 The License Agreement will continue to apply until terminated by either you -or the Company as set out below. - -7.2 If you want to terminate the License Agreement, you may do so by ceasing -your use of the SDK and any relevant developer credentials. - -7.3 The Company may at any time, terminate the License Agreement with you if: - -(a) you have breached any provision of the License Agreement; or - -(b) the Company is required to do so by law; or - -(c) a third party with whom the Company offered certain parts of the SDK to you -has terminated its relationship with the Company or ceased to offer certain -parts of the SDK to either the Company or to you; or - -(d) the Company decides to no longer provide the SDK or certain parts of the SDK -to users in the country in which you are resident or from which you use the -service, or the provision of the SDK or certain SDK services to you by the -Company is, in the Companyâ's sole discretion, no longer commercially viable or -technically practicable. - -7.4 When the License Agreement comes to an end, all of the legal rights, -obligations and liabilities that you and the Company have benefited from, been -subject to (or which have accrued over time whilst the License Agreement has -been in force) or which are expressed to continue indefinitely, shall be -unaffected by this cessation, and the provisions of paragraph 12.8 shall -continue to apply to such rights, obligations and liabilities indefinitely. - -8. NO SUPPORT - -The Company is not obligated under this License Agreement to provide you any -support services for the SDK. Any support provided is at the Companyâs sole -discretion and provided on an "as is" basis and without warranty of any kind. - -9. DISCLAIMER OF WARRANTIES - -9.1 YOU EXPRESSLY UNDERSTAND AND AGREE THAT YOUR USE OF THE SDK IS AT YOUR SOLE -RISK AND THAT THE SDK IS PROVIDED "AS IS" AND "AS AVAILABLE" WITHOUT WARRANTY OF -ANY KIND FROM Bitwarden. - -9.2 YOUR USE OF THE SDK AND ANY MATERIAL DOWNLOADED OR OTHERWISE OBTAINED -THROUGH THE USE OF THE SDK IS AT YOUR OWN DISCRETION AND RISK AND YOU ARE SOLELY -RESPONSIBLE FOR ANY DAMAGE TO YOUR COMPUTER SYSTEM OR OTHER DEVICE OR LOSS OF -DATA THAT RESULTS FROM SUCH USE. - -9.3 THE COMPANY FURTHER EXPRESSLY DISCLAIMS ALL WARRANTIES AND CONDITIONS OF ANY -KIND, WHETHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO THE IMPLIED -WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE -AND NON-INFRINGEMENT. - -10. LIMITATION OF LIABILITY - -YOU EXPRESSLY UNDERSTAND AND AGREE THAT THE COMPANY, ITS SUBSIDIARIES AND -AFFILIATES, AND ITS LICENSORS SHALL NOT BE LIABLE TO YOU UNDER ANY THEORY OF -LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL, -STATUTORY, OR EXEMPLARY DAMAGES THAT MAY BE INCURRED BY YOU, INCLUDING ANY LOSS -OF DATA, WHETHER OR NOT THE COMPANY OR ITS REPRESENTATIVES HAVE BEEN ADVISED OF -OR SHOULD HAVE BEEN AWARE OF THE POSSIBILITY OF ANY SUCH LOSSES ARISING. - -11. Indemnification - -To the maximum extent permitted by law, you agree to defend, indemnify and hold -harmless the Company, its affiliates and their respective directors, officers, -employees and agents from and against any and all claims, actions, suits or -proceedings, as well as any and all losses, liabilities, damages, costs and -expenses (including reasonable attorneys fees) arising out of or accruing from -(a) your use of the SDK, (b) any application you develop on the SDK that -infringes any copyright, trademark, trade secret, trade dress, patent or other -intellectual property right of any person or defames any person or violates -their rights of publicity or privacy, and (c) any non-compliance by you with the -License Agreement. - -12. General Legal Terms - -12.1 The Company may make changes to the License Agreement as it distributes new -versions of the SDK. When these changes are made, the Company will make a new -version of the License Agreement available on the website where the SDK is made -available. - -12.2 The License Agreement constitutes the whole legal agreement between you and -the Company and governs your use of the SDK (excluding any services or software -which the Company may provide to you under a separate written agreement), and -completely replaces any prior agreements between you and the Company in relation -to the SDK. - -12.3 You agree that if the Company does not exercise or enforce any legal right -or remedy which is contained in the License Agreement (or which the Company has -the benefit of under any applicable law), this will not be taken to be a formal -waiver of the Company's rights and that those rights or remedies will still be -available to the Company. - -12.4 If any court of law, having the jurisdiction to decide on this matter, -rules that any provision of the License Agreement is invalid, then that -provision will be removed from the License Agreement without affecting the rest -of the License Agreement. The remaining provisions of the License Agreement will -continue to be valid and enforceable. - -12.5 You acknowledge and agree that each member of the group of companies of -which the Company is the parent shall be third party beneficiaries to the -License Agreement and that such other companies shall be entitled to directly -enforce, and rely upon, any provision of the License Agreement that confers a -benefit on them or rights in favor of them. Other than this, no other person or -company shall be third party beneficiaries to the License Agreement. - -12.6 EXPORT RESTRICTIONS. THE SDK IS SUBJECT TO UNITED STATES EXPORT LAWS AND -REGULATIONS. YOU MUST COMPLY WITH ALL DOMESTIC AND INTERNATIONAL EXPORT LAWS AND -REGULATIONS THAT APPLY TO THE SDK. THESE LAWS INCLUDE RESTRICTIONS ON -DESTINATIONS, END USERS, AND END USE. - -12.7 The rights granted in the License Agreement may not be assigned or -transferred by either you or the Company without the prior written approval of -the other party, provided that the Company may assign this License Agreement -upon notice to you in connection with an acquisition, merger, sale of assets, or -similar corporate change in control for the Company or the Intellectual Property -Rights in the SDK. - -12.8 The License Agreement, and any dispute relating to or arising out of this -License Agreement, shall be governed by the laws of the State of California -without regard to its conflict of laws provisions. You and the Company agree to -submit to the exclusive jurisdiction of the courts located within the county of -Los Angeles, California to resolve any dispute or legal matter arising from the -License Agreement. Notwithstanding this, you agree that the Company shall be -allowed to apply for injunctive remedies, or any equivalent type of urgent legal -relief, in any forum or jurisdiction. diff --git a/crates/bitwarden-napi/npm/darwin-arm64/README.md b/crates/bitwarden-napi/npm/darwin-arm64/README.md deleted file mode 100644 index 57bb349c..00000000 --- a/crates/bitwarden-napi/npm/darwin-arm64/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# `@bitwarden/sdk-napi-darwin-arm64` - -This is the **aarch64-apple-darwin** binary for `@bitwarden/sdk-napi` diff --git a/crates/bitwarden-napi/npm/darwin-arm64/package.json b/crates/bitwarden-napi/npm/darwin-arm64/package.json deleted file mode 100644 index 88e3122c..00000000 --- a/crates/bitwarden-napi/npm/darwin-arm64/package.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@bitwarden/sdk-napi-darwin-arm64", - "version": "1.0.0", - "homepage": "https://github.com/bitwarden/sdk#readme", - "bugs": { - "url": "https://github.com/bitwarden/sdk/issues" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/bitwarden/sdk.git" - }, - "license": "SEE LICENSE IN LICENSE", - "author": "Bitwarden Inc. (https://bitwarden.com)", - "main": "sdk-napi.darwin-arm64.node", - "files": [ - "sdk-napi.darwin-arm64.node" - ], - "engines": { - "node": ">= 10" - }, - "os": [ - "darwin" - ], - "cpu": [ - "arm64" - ], - "publishConfig": { - "access": "public", - "registry": "https://registry.npmjs.org/" - } -} diff --git a/crates/bitwarden-napi/npm/darwin-x64/LICENSE b/crates/bitwarden-napi/npm/darwin-x64/LICENSE deleted file mode 100644 index e9d496ff..00000000 --- a/crates/bitwarden-napi/npm/darwin-x64/LICENSE +++ /dev/null @@ -1,295 +0,0 @@ -BITWARDEN SOFTWARE DEVELOPMENT KIT LICENSE AGREEMENT -Version 1, 17 March 2023 - -1. Introduction - -1.1 The Bitwarden Software Development Kit (referred to in the License Agreement -as the "SDK" and available for download at the following URL -https://github.com/bitwarden/sdk) is licensed to you subject to the terms of -this License Agreement. The License Agreement forms a legally binding contract -between you and the Company in relation to your use of the SDK. - -1.2 "Bitwarden" means the Bitwarden software made available by the Company, -available for download at the following URL, as updated from time to time. - -1.3 A "Compatible Application" means any software program or service that (i) -connects to and interoperates with a current version of the Bitwarden server -products distributed by the Company; and (ii) complies with the Companyâs -acceptable use policy available at the following URL: -https://bitwarden.com/terms/#acceptable_use. - -1.4 "Company" means Bitwarden Inc., organized under the laws of the State of -Delaware. - -2. Accepting this License Agreement - -2.1 In order to access or use the SDK, you must first agree to the License -Agreement. You may not access or use the SDK if you do not accept the License -Agreement. - -2.2 By clicking to accept and/or accessing or using the SDK, you hereby agree to -the terms of the License Agreement. - -2.3 You may not access or use the SDK and may not accept the License Agreement -if you are a person barred from receiving the SDK under the laws of the United -States or other countries, including the country in which you are resident or -from which you access or use the SDK. - -2.4 If you are agreeing to be bound by the License Agreement on behalf of your -employer or any other entity, you represent and warrant that you have full legal -authority to bind your employer or such other entity to the License Agreement. -If you do not have the requisite authority, you may not accept the License -Agreement or you may not access or use the SDK on behalf of your employer or -other entity. - -3. SDK License from Bitwarden - -3.1 Subject to the terms of this License Agreement, Bitwarden grants you a -limited, worldwide, royalty-free, non-assignable, non-exclusive, and -non-sublicensable license to use the SDK solely (a) to develop, test, and -demonstrate a Compatible Application; (b) to develop, test, and run a Compatible -Application for personal use by your family; or (c) to to develop, test, and run -a Compatible Application for the internal business operations of your -organization in connection with a paid license for a Bitwarden server product, -provided that in no case above may the Compatible Application be offered, -licensed, or sold to a third party. - -3.2 You agree that Bitwarden or third parties own all legal right, title and -interest in and to the SDK, including any Intellectual Property Rights that -subsist in the SDK. "Intellectual Property Rights" means any and all rights -under patent law, copyright law, trade secret law, trademark law, and any and -all other proprietary rights. Bitwarden reserves all rights not expressly -granted to you. - -3.3 You may not use this SDK to develop applications for use with software other -than Bitwarden (including non-compatible implementations of Bitwarden) or to -develop another SDK. - -3.4 You may not use the SDK for any purpose not expressly permitted by the -License Agreement. Except for contributions to Bitwarden pursuant to the -Contribution License Agreement available at this URL: -https://cla-assistant.io/bitwarden/clients, or to the extent required by -applicable third party licenses, you may not copy modify, adapt, redistribute, -decompile, reverse engineer, disassemble, or create derivative works of the SDK -or any part of the SDK. - -3.5 Use, reproduction, and distribution of a component of the SDK licensed under -an open source software license are governed solely by the terms of that open -source software license and not the License Agreement. - -3.6 You agree that the form and nature of the SDK that the Company provides may -change without prior notice to you and that future versions of the SDK may be -incompatible with applications developed on previous versions of the SDK. You -agree that the Company may stop (permanently or temporarily) providing the SDK -or any features within the SDK to you or to users generally at the Companyâs -sole discretion, without prior notice to you. - -3.7 Nothing in the License Agreement gives you a right to use any of the -Companyâs trade names, trademarks, service marks, logos, domain names, or other -distinctive brand features. - -3.8 You agree that you will not remove, obscure, or alter any proprietary rights -notices (including copyright and trademark notices) that may be affixed to or -contained within the SDK. - -4. Use of the SDK by You - -4.1 The Company agrees that it obtains no right, title, or interest from you (or -your licensors) under the License Agreement in or to any software applications -that you develop using the SDK, including any Intellectual Property Rights that -subsist in those applications. - -4.2 You agree to use the SDK and write applications only for purposes that are -permitted by (a) the License Agreement and (b) any applicable law, regulation or -generally accepted practices or guidelines in the relevant jurisdictions -(including any laws regarding the export of data or software to and from the -United States or other relevant countries). - -4.3 You agree that if you use the SDK to develop applications for other users, -you will protect the privacy and legal rights of those users. If the users -provide you with user names, passwords, or other login information or personal -information, you must make the users aware that the information will be -available to your application, and you must provide legally adequate privacy -notice and protection for those users. If your application stores personal or -sensitive information provided by users, it must do so securely. If the user -provides your application with Bitwarden Account information, your application -may only use that information to access the user's Bitwarden Account when, and -for the limited purposes for which, the user has given you permission to do so. - -4.4 You agree that you will not engage in any activity with the SDK, including -the development or distribution of an application, that interferes with, -disrupts, damages, or accesses in an unauthorized manner the servers, networks, -or other properties or services of any third party including, but not limited -to, the Company, or any mobile communications carrier or public cloud service. - -4.5 If you use the SDK to retrieve a user's data from Bitwarden, you acknowledge -and agree that you shall retrieve data only with the user's explicit consent and -only when, and for the limited purposes for which, the user has given you -permission to do so. - -4.6 You agree that you are solely responsible for, and that the Company has no -responsibility to you or to any third party for, any data, content, or resources -that you create, transmit or display through Bitwarden and/or applications for -Bitwarden, and for the consequences of your actions (including any loss or -damage which Bitwarden may suffer) by doing so. - -4.7 You agree that you are solely responsible for, and that the Company has no -responsibility to you or to any third party for, any breach of your obligations -under the License Agreement, any applicable third party contract or Terms of -Service, or any applicable law or regulation, and for the consequences -(including any loss or damage which the Company or any third party may suffer) -of any such breach. - -5. Third Party Applications - -5.1 If you use the SDK to integrate or run applications developed by a third -party or that access data, content or resources provided by a third party, you -agree that the Company is not responsible for those applications, data, content, -or resources. You understand that all data, content or resources which you may -access through such third party applications are the sole responsibility of the -person from which they originated and that the Company is not liable for any -loss or damage that you may experience as a result of the use or access of any -of those third party applications, data, content, or resources. - -5.2 You should be aware that the data, content, and resources presented to you -through such a third party application may be protected by intellectual property -rights which are owned by the providers (or by other persons or companies on -their behalf). You acknowledge that your use of such third party applications, -data, content, or resources may be subject to separate terms between you and the -relevant third party. In that case, the License Agreement does not affect your -legal relationship with these third parties. - -6. Use of Bitwarden Server - -You acknowledge and agree that the Bitwarden server products to which any -Compatible Application must connect is protected by intellectual property rights -which are owned by the Company and your use of the Bitwarden server products is -subject to additional terms not set forth in this License Agreement. - -7. Terminating this License Agreement - -7.1 The License Agreement will continue to apply until terminated by either you -or the Company as set out below. - -7.2 If you want to terminate the License Agreement, you may do so by ceasing -your use of the SDK and any relevant developer credentials. - -7.3 The Company may at any time, terminate the License Agreement with you if: - -(a) you have breached any provision of the License Agreement; or - -(b) the Company is required to do so by law; or - -(c) a third party with whom the Company offered certain parts of the SDK to you -has terminated its relationship with the Company or ceased to offer certain -parts of the SDK to either the Company or to you; or - -(d) the Company decides to no longer provide the SDK or certain parts of the SDK -to users in the country in which you are resident or from which you use the -service, or the provision of the SDK or certain SDK services to you by the -Company is, in the Companyâ's sole discretion, no longer commercially viable or -technically practicable. - -7.4 When the License Agreement comes to an end, all of the legal rights, -obligations and liabilities that you and the Company have benefited from, been -subject to (or which have accrued over time whilst the License Agreement has -been in force) or which are expressed to continue indefinitely, shall be -unaffected by this cessation, and the provisions of paragraph 12.8 shall -continue to apply to such rights, obligations and liabilities indefinitely. - -8. NO SUPPORT - -The Company is not obligated under this License Agreement to provide you any -support services for the SDK. Any support provided is at the Companyâs sole -discretion and provided on an "as is" basis and without warranty of any kind. - -9. DISCLAIMER OF WARRANTIES - -9.1 YOU EXPRESSLY UNDERSTAND AND AGREE THAT YOUR USE OF THE SDK IS AT YOUR SOLE -RISK AND THAT THE SDK IS PROVIDED "AS IS" AND "AS AVAILABLE" WITHOUT WARRANTY OF -ANY KIND FROM Bitwarden. - -9.2 YOUR USE OF THE SDK AND ANY MATERIAL DOWNLOADED OR OTHERWISE OBTAINED -THROUGH THE USE OF THE SDK IS AT YOUR OWN DISCRETION AND RISK AND YOU ARE SOLELY -RESPONSIBLE FOR ANY DAMAGE TO YOUR COMPUTER SYSTEM OR OTHER DEVICE OR LOSS OF -DATA THAT RESULTS FROM SUCH USE. - -9.3 THE COMPANY FURTHER EXPRESSLY DISCLAIMS ALL WARRANTIES AND CONDITIONS OF ANY -KIND, WHETHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO THE IMPLIED -WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE -AND NON-INFRINGEMENT. - -10. LIMITATION OF LIABILITY - -YOU EXPRESSLY UNDERSTAND AND AGREE THAT THE COMPANY, ITS SUBSIDIARIES AND -AFFILIATES, AND ITS LICENSORS SHALL NOT BE LIABLE TO YOU UNDER ANY THEORY OF -LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL, -STATUTORY, OR EXEMPLARY DAMAGES THAT MAY BE INCURRED BY YOU, INCLUDING ANY LOSS -OF DATA, WHETHER OR NOT THE COMPANY OR ITS REPRESENTATIVES HAVE BEEN ADVISED OF -OR SHOULD HAVE BEEN AWARE OF THE POSSIBILITY OF ANY SUCH LOSSES ARISING. - -11. Indemnification - -To the maximum extent permitted by law, you agree to defend, indemnify and hold -harmless the Company, its affiliates and their respective directors, officers, -employees and agents from and against any and all claims, actions, suits or -proceedings, as well as any and all losses, liabilities, damages, costs and -expenses (including reasonable attorneys fees) arising out of or accruing from -(a) your use of the SDK, (b) any application you develop on the SDK that -infringes any copyright, trademark, trade secret, trade dress, patent or other -intellectual property right of any person or defames any person or violates -their rights of publicity or privacy, and (c) any non-compliance by you with the -License Agreement. - -12. General Legal Terms - -12.1 The Company may make changes to the License Agreement as it distributes new -versions of the SDK. When these changes are made, the Company will make a new -version of the License Agreement available on the website where the SDK is made -available. - -12.2 The License Agreement constitutes the whole legal agreement between you and -the Company and governs your use of the SDK (excluding any services or software -which the Company may provide to you under a separate written agreement), and -completely replaces any prior agreements between you and the Company in relation -to the SDK. - -12.3 You agree that if the Company does not exercise or enforce any legal right -or remedy which is contained in the License Agreement (or which the Company has -the benefit of under any applicable law), this will not be taken to be a formal -waiver of the Company's rights and that those rights or remedies will still be -available to the Company. - -12.4 If any court of law, having the jurisdiction to decide on this matter, -rules that any provision of the License Agreement is invalid, then that -provision will be removed from the License Agreement without affecting the rest -of the License Agreement. The remaining provisions of the License Agreement will -continue to be valid and enforceable. - -12.5 You acknowledge and agree that each member of the group of companies of -which the Company is the parent shall be third party beneficiaries to the -License Agreement and that such other companies shall be entitled to directly -enforce, and rely upon, any provision of the License Agreement that confers a -benefit on them or rights in favor of them. Other than this, no other person or -company shall be third party beneficiaries to the License Agreement. - -12.6 EXPORT RESTRICTIONS. THE SDK IS SUBJECT TO UNITED STATES EXPORT LAWS AND -REGULATIONS. YOU MUST COMPLY WITH ALL DOMESTIC AND INTERNATIONAL EXPORT LAWS AND -REGULATIONS THAT APPLY TO THE SDK. THESE LAWS INCLUDE RESTRICTIONS ON -DESTINATIONS, END USERS, AND END USE. - -12.7 The rights granted in the License Agreement may not be assigned or -transferred by either you or the Company without the prior written approval of -the other party, provided that the Company may assign this License Agreement -upon notice to you in connection with an acquisition, merger, sale of assets, or -similar corporate change in control for the Company or the Intellectual Property -Rights in the SDK. - -12.8 The License Agreement, and any dispute relating to or arising out of this -License Agreement, shall be governed by the laws of the State of California -without regard to its conflict of laws provisions. You and the Company agree to -submit to the exclusive jurisdiction of the courts located within the county of -Los Angeles, California to resolve any dispute or legal matter arising from the -License Agreement. Notwithstanding this, you agree that the Company shall be -allowed to apply for injunctive remedies, or any equivalent type of urgent legal -relief, in any forum or jurisdiction. diff --git a/crates/bitwarden-napi/npm/darwin-x64/README.md b/crates/bitwarden-napi/npm/darwin-x64/README.md deleted file mode 100644 index 86843f8e..00000000 --- a/crates/bitwarden-napi/npm/darwin-x64/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# `@bitwarden/sdk-napi-darwin-x64` - -This is the **x86_64-apple-darwin** binary for `@bitwarden/sdk-napi` diff --git a/crates/bitwarden-napi/npm/darwin-x64/package.json b/crates/bitwarden-napi/npm/darwin-x64/package.json deleted file mode 100644 index 4650654c..00000000 --- a/crates/bitwarden-napi/npm/darwin-x64/package.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@bitwarden/sdk-napi-darwin-x64", - "version": "1.0.0", - "homepage": "https://github.com/bitwarden/sdk#readme", - "bugs": { - "url": "https://github.com/bitwarden/sdk/issues" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/bitwarden/sdk.git" - }, - "license": "SEE LICENSE IN LICENSE", - "author": "Bitwarden Inc. (https://bitwarden.com)", - "main": "sdk-napi.darwin-x64.node", - "files": [ - "sdk-napi.darwin-x64.node" - ], - "engines": { - "node": ">= 10" - }, - "os": [ - "darwin" - ], - "cpu": [ - "x64" - ], - "publishConfig": { - "access": "public", - "registry": "https://registry.npmjs.org/" - } -} diff --git a/crates/bitwarden-napi/npm/linux-x64-gnu/LICENSE b/crates/bitwarden-napi/npm/linux-x64-gnu/LICENSE deleted file mode 100644 index e9d496ff..00000000 --- a/crates/bitwarden-napi/npm/linux-x64-gnu/LICENSE +++ /dev/null @@ -1,295 +0,0 @@ -BITWARDEN SOFTWARE DEVELOPMENT KIT LICENSE AGREEMENT -Version 1, 17 March 2023 - -1. Introduction - -1.1 The Bitwarden Software Development Kit (referred to in the License Agreement -as the "SDK" and available for download at the following URL -https://github.com/bitwarden/sdk) is licensed to you subject to the terms of -this License Agreement. The License Agreement forms a legally binding contract -between you and the Company in relation to your use of the SDK. - -1.2 "Bitwarden" means the Bitwarden software made available by the Company, -available for download at the following URL, as updated from time to time. - -1.3 A "Compatible Application" means any software program or service that (i) -connects to and interoperates with a current version of the Bitwarden server -products distributed by the Company; and (ii) complies with the Companyâs -acceptable use policy available at the following URL: -https://bitwarden.com/terms/#acceptable_use. - -1.4 "Company" means Bitwarden Inc., organized under the laws of the State of -Delaware. - -2. Accepting this License Agreement - -2.1 In order to access or use the SDK, you must first agree to the License -Agreement. You may not access or use the SDK if you do not accept the License -Agreement. - -2.2 By clicking to accept and/or accessing or using the SDK, you hereby agree to -the terms of the License Agreement. - -2.3 You may not access or use the SDK and may not accept the License Agreement -if you are a person barred from receiving the SDK under the laws of the United -States or other countries, including the country in which you are resident or -from which you access or use the SDK. - -2.4 If you are agreeing to be bound by the License Agreement on behalf of your -employer or any other entity, you represent and warrant that you have full legal -authority to bind your employer or such other entity to the License Agreement. -If you do not have the requisite authority, you may not accept the License -Agreement or you may not access or use the SDK on behalf of your employer or -other entity. - -3. SDK License from Bitwarden - -3.1 Subject to the terms of this License Agreement, Bitwarden grants you a -limited, worldwide, royalty-free, non-assignable, non-exclusive, and -non-sublicensable license to use the SDK solely (a) to develop, test, and -demonstrate a Compatible Application; (b) to develop, test, and run a Compatible -Application for personal use by your family; or (c) to to develop, test, and run -a Compatible Application for the internal business operations of your -organization in connection with a paid license for a Bitwarden server product, -provided that in no case above may the Compatible Application be offered, -licensed, or sold to a third party. - -3.2 You agree that Bitwarden or third parties own all legal right, title and -interest in and to the SDK, including any Intellectual Property Rights that -subsist in the SDK. "Intellectual Property Rights" means any and all rights -under patent law, copyright law, trade secret law, trademark law, and any and -all other proprietary rights. Bitwarden reserves all rights not expressly -granted to you. - -3.3 You may not use this SDK to develop applications for use with software other -than Bitwarden (including non-compatible implementations of Bitwarden) or to -develop another SDK. - -3.4 You may not use the SDK for any purpose not expressly permitted by the -License Agreement. Except for contributions to Bitwarden pursuant to the -Contribution License Agreement available at this URL: -https://cla-assistant.io/bitwarden/clients, or to the extent required by -applicable third party licenses, you may not copy modify, adapt, redistribute, -decompile, reverse engineer, disassemble, or create derivative works of the SDK -or any part of the SDK. - -3.5 Use, reproduction, and distribution of a component of the SDK licensed under -an open source software license are governed solely by the terms of that open -source software license and not the License Agreement. - -3.6 You agree that the form and nature of the SDK that the Company provides may -change without prior notice to you and that future versions of the SDK may be -incompatible with applications developed on previous versions of the SDK. You -agree that the Company may stop (permanently or temporarily) providing the SDK -or any features within the SDK to you or to users generally at the Companyâs -sole discretion, without prior notice to you. - -3.7 Nothing in the License Agreement gives you a right to use any of the -Companyâs trade names, trademarks, service marks, logos, domain names, or other -distinctive brand features. - -3.8 You agree that you will not remove, obscure, or alter any proprietary rights -notices (including copyright and trademark notices) that may be affixed to or -contained within the SDK. - -4. Use of the SDK by You - -4.1 The Company agrees that it obtains no right, title, or interest from you (or -your licensors) under the License Agreement in or to any software applications -that you develop using the SDK, including any Intellectual Property Rights that -subsist in those applications. - -4.2 You agree to use the SDK and write applications only for purposes that are -permitted by (a) the License Agreement and (b) any applicable law, regulation or -generally accepted practices or guidelines in the relevant jurisdictions -(including any laws regarding the export of data or software to and from the -United States or other relevant countries). - -4.3 You agree that if you use the SDK to develop applications for other users, -you will protect the privacy and legal rights of those users. If the users -provide you with user names, passwords, or other login information or personal -information, you must make the users aware that the information will be -available to your application, and you must provide legally adequate privacy -notice and protection for those users. If your application stores personal or -sensitive information provided by users, it must do so securely. If the user -provides your application with Bitwarden Account information, your application -may only use that information to access the user's Bitwarden Account when, and -for the limited purposes for which, the user has given you permission to do so. - -4.4 You agree that you will not engage in any activity with the SDK, including -the development or distribution of an application, that interferes with, -disrupts, damages, or accesses in an unauthorized manner the servers, networks, -or other properties or services of any third party including, but not limited -to, the Company, or any mobile communications carrier or public cloud service. - -4.5 If you use the SDK to retrieve a user's data from Bitwarden, you acknowledge -and agree that you shall retrieve data only with the user's explicit consent and -only when, and for the limited purposes for which, the user has given you -permission to do so. - -4.6 You agree that you are solely responsible for, and that the Company has no -responsibility to you or to any third party for, any data, content, or resources -that you create, transmit or display through Bitwarden and/or applications for -Bitwarden, and for the consequences of your actions (including any loss or -damage which Bitwarden may suffer) by doing so. - -4.7 You agree that you are solely responsible for, and that the Company has no -responsibility to you or to any third party for, any breach of your obligations -under the License Agreement, any applicable third party contract or Terms of -Service, or any applicable law or regulation, and for the consequences -(including any loss or damage which the Company or any third party may suffer) -of any such breach. - -5. Third Party Applications - -5.1 If you use the SDK to integrate or run applications developed by a third -party or that access data, content or resources provided by a third party, you -agree that the Company is not responsible for those applications, data, content, -or resources. You understand that all data, content or resources which you may -access through such third party applications are the sole responsibility of the -person from which they originated and that the Company is not liable for any -loss or damage that you may experience as a result of the use or access of any -of those third party applications, data, content, or resources. - -5.2 You should be aware that the data, content, and resources presented to you -through such a third party application may be protected by intellectual property -rights which are owned by the providers (or by other persons or companies on -their behalf). You acknowledge that your use of such third party applications, -data, content, or resources may be subject to separate terms between you and the -relevant third party. In that case, the License Agreement does not affect your -legal relationship with these third parties. - -6. Use of Bitwarden Server - -You acknowledge and agree that the Bitwarden server products to which any -Compatible Application must connect is protected by intellectual property rights -which are owned by the Company and your use of the Bitwarden server products is -subject to additional terms not set forth in this License Agreement. - -7. Terminating this License Agreement - -7.1 The License Agreement will continue to apply until terminated by either you -or the Company as set out below. - -7.2 If you want to terminate the License Agreement, you may do so by ceasing -your use of the SDK and any relevant developer credentials. - -7.3 The Company may at any time, terminate the License Agreement with you if: - -(a) you have breached any provision of the License Agreement; or - -(b) the Company is required to do so by law; or - -(c) a third party with whom the Company offered certain parts of the SDK to you -has terminated its relationship with the Company or ceased to offer certain -parts of the SDK to either the Company or to you; or - -(d) the Company decides to no longer provide the SDK or certain parts of the SDK -to users in the country in which you are resident or from which you use the -service, or the provision of the SDK or certain SDK services to you by the -Company is, in the Companyâ's sole discretion, no longer commercially viable or -technically practicable. - -7.4 When the License Agreement comes to an end, all of the legal rights, -obligations and liabilities that you and the Company have benefited from, been -subject to (or which have accrued over time whilst the License Agreement has -been in force) or which are expressed to continue indefinitely, shall be -unaffected by this cessation, and the provisions of paragraph 12.8 shall -continue to apply to such rights, obligations and liabilities indefinitely. - -8. NO SUPPORT - -The Company is not obligated under this License Agreement to provide you any -support services for the SDK. Any support provided is at the Companyâs sole -discretion and provided on an "as is" basis and without warranty of any kind. - -9. DISCLAIMER OF WARRANTIES - -9.1 YOU EXPRESSLY UNDERSTAND AND AGREE THAT YOUR USE OF THE SDK IS AT YOUR SOLE -RISK AND THAT THE SDK IS PROVIDED "AS IS" AND "AS AVAILABLE" WITHOUT WARRANTY OF -ANY KIND FROM Bitwarden. - -9.2 YOUR USE OF THE SDK AND ANY MATERIAL DOWNLOADED OR OTHERWISE OBTAINED -THROUGH THE USE OF THE SDK IS AT YOUR OWN DISCRETION AND RISK AND YOU ARE SOLELY -RESPONSIBLE FOR ANY DAMAGE TO YOUR COMPUTER SYSTEM OR OTHER DEVICE OR LOSS OF -DATA THAT RESULTS FROM SUCH USE. - -9.3 THE COMPANY FURTHER EXPRESSLY DISCLAIMS ALL WARRANTIES AND CONDITIONS OF ANY -KIND, WHETHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO THE IMPLIED -WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE -AND NON-INFRINGEMENT. - -10. LIMITATION OF LIABILITY - -YOU EXPRESSLY UNDERSTAND AND AGREE THAT THE COMPANY, ITS SUBSIDIARIES AND -AFFILIATES, AND ITS LICENSORS SHALL NOT BE LIABLE TO YOU UNDER ANY THEORY OF -LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL, -STATUTORY, OR EXEMPLARY DAMAGES THAT MAY BE INCURRED BY YOU, INCLUDING ANY LOSS -OF DATA, WHETHER OR NOT THE COMPANY OR ITS REPRESENTATIVES HAVE BEEN ADVISED OF -OR SHOULD HAVE BEEN AWARE OF THE POSSIBILITY OF ANY SUCH LOSSES ARISING. - -11. Indemnification - -To the maximum extent permitted by law, you agree to defend, indemnify and hold -harmless the Company, its affiliates and their respective directors, officers, -employees and agents from and against any and all claims, actions, suits or -proceedings, as well as any and all losses, liabilities, damages, costs and -expenses (including reasonable attorneys fees) arising out of or accruing from -(a) your use of the SDK, (b) any application you develop on the SDK that -infringes any copyright, trademark, trade secret, trade dress, patent or other -intellectual property right of any person or defames any person or violates -their rights of publicity or privacy, and (c) any non-compliance by you with the -License Agreement. - -12. General Legal Terms - -12.1 The Company may make changes to the License Agreement as it distributes new -versions of the SDK. When these changes are made, the Company will make a new -version of the License Agreement available on the website where the SDK is made -available. - -12.2 The License Agreement constitutes the whole legal agreement between you and -the Company and governs your use of the SDK (excluding any services or software -which the Company may provide to you under a separate written agreement), and -completely replaces any prior agreements between you and the Company in relation -to the SDK. - -12.3 You agree that if the Company does not exercise or enforce any legal right -or remedy which is contained in the License Agreement (or which the Company has -the benefit of under any applicable law), this will not be taken to be a formal -waiver of the Company's rights and that those rights or remedies will still be -available to the Company. - -12.4 If any court of law, having the jurisdiction to decide on this matter, -rules that any provision of the License Agreement is invalid, then that -provision will be removed from the License Agreement without affecting the rest -of the License Agreement. The remaining provisions of the License Agreement will -continue to be valid and enforceable. - -12.5 You acknowledge and agree that each member of the group of companies of -which the Company is the parent shall be third party beneficiaries to the -License Agreement and that such other companies shall be entitled to directly -enforce, and rely upon, any provision of the License Agreement that confers a -benefit on them or rights in favor of them. Other than this, no other person or -company shall be third party beneficiaries to the License Agreement. - -12.6 EXPORT RESTRICTIONS. THE SDK IS SUBJECT TO UNITED STATES EXPORT LAWS AND -REGULATIONS. YOU MUST COMPLY WITH ALL DOMESTIC AND INTERNATIONAL EXPORT LAWS AND -REGULATIONS THAT APPLY TO THE SDK. THESE LAWS INCLUDE RESTRICTIONS ON -DESTINATIONS, END USERS, AND END USE. - -12.7 The rights granted in the License Agreement may not be assigned or -transferred by either you or the Company without the prior written approval of -the other party, provided that the Company may assign this License Agreement -upon notice to you in connection with an acquisition, merger, sale of assets, or -similar corporate change in control for the Company or the Intellectual Property -Rights in the SDK. - -12.8 The License Agreement, and any dispute relating to or arising out of this -License Agreement, shall be governed by the laws of the State of California -without regard to its conflict of laws provisions. You and the Company agree to -submit to the exclusive jurisdiction of the courts located within the county of -Los Angeles, California to resolve any dispute or legal matter arising from the -License Agreement. Notwithstanding this, you agree that the Company shall be -allowed to apply for injunctive remedies, or any equivalent type of urgent legal -relief, in any forum or jurisdiction. diff --git a/crates/bitwarden-napi/npm/linux-x64-gnu/README.md b/crates/bitwarden-napi/npm/linux-x64-gnu/README.md deleted file mode 100644 index 2963e9bc..00000000 --- a/crates/bitwarden-napi/npm/linux-x64-gnu/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# `@bitwarden/sdk-napi-linux-x64-gnu` - -This is the **x86_64-unknown-linux-gnu** binary for `@bitwarden/sdk-napi` diff --git a/crates/bitwarden-napi/npm/linux-x64-gnu/package.json b/crates/bitwarden-napi/npm/linux-x64-gnu/package.json deleted file mode 100644 index ed3b62f8..00000000 --- a/crates/bitwarden-napi/npm/linux-x64-gnu/package.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "@bitwarden/sdk-napi-linux-x64-gnu", - "version": "1.0.0", - "homepage": "https://github.com/bitwarden/sdk#readme", - "bugs": { - "url": "https://github.com/bitwarden/sdk/issues" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/bitwarden/sdk.git" - }, - "license": "SEE LICENSE IN LICENSE", - "author": "Bitwarden Inc. (https://bitwarden.com)", - "main": "sdk-napi.linux-x64-gnu.node", - "files": [ - "sdk-napi.linux-x64-gnu.node" - ], - "engines": { - "node": ">= 10" - }, - "os": [ - "linux" - ], - "cpu": [ - "x64" - ], - "libc": [ - "glibc" - ] -} diff --git a/crates/bitwarden-napi/npm/win32-x64-msvc/LICENSE b/crates/bitwarden-napi/npm/win32-x64-msvc/LICENSE deleted file mode 100644 index e9d496ff..00000000 --- a/crates/bitwarden-napi/npm/win32-x64-msvc/LICENSE +++ /dev/null @@ -1,295 +0,0 @@ -BITWARDEN SOFTWARE DEVELOPMENT KIT LICENSE AGREEMENT -Version 1, 17 March 2023 - -1. Introduction - -1.1 The Bitwarden Software Development Kit (referred to in the License Agreement -as the "SDK" and available for download at the following URL -https://github.com/bitwarden/sdk) is licensed to you subject to the terms of -this License Agreement. The License Agreement forms a legally binding contract -between you and the Company in relation to your use of the SDK. - -1.2 "Bitwarden" means the Bitwarden software made available by the Company, -available for download at the following URL, as updated from time to time. - -1.3 A "Compatible Application" means any software program or service that (i) -connects to and interoperates with a current version of the Bitwarden server -products distributed by the Company; and (ii) complies with the Companyâs -acceptable use policy available at the following URL: -https://bitwarden.com/terms/#acceptable_use. - -1.4 "Company" means Bitwarden Inc., organized under the laws of the State of -Delaware. - -2. Accepting this License Agreement - -2.1 In order to access or use the SDK, you must first agree to the License -Agreement. You may not access or use the SDK if you do not accept the License -Agreement. - -2.2 By clicking to accept and/or accessing or using the SDK, you hereby agree to -the terms of the License Agreement. - -2.3 You may not access or use the SDK and may not accept the License Agreement -if you are a person barred from receiving the SDK under the laws of the United -States or other countries, including the country in which you are resident or -from which you access or use the SDK. - -2.4 If you are agreeing to be bound by the License Agreement on behalf of your -employer or any other entity, you represent and warrant that you have full legal -authority to bind your employer or such other entity to the License Agreement. -If you do not have the requisite authority, you may not accept the License -Agreement or you may not access or use the SDK on behalf of your employer or -other entity. - -3. SDK License from Bitwarden - -3.1 Subject to the terms of this License Agreement, Bitwarden grants you a -limited, worldwide, royalty-free, non-assignable, non-exclusive, and -non-sublicensable license to use the SDK solely (a) to develop, test, and -demonstrate a Compatible Application; (b) to develop, test, and run a Compatible -Application for personal use by your family; or (c) to to develop, test, and run -a Compatible Application for the internal business operations of your -organization in connection with a paid license for a Bitwarden server product, -provided that in no case above may the Compatible Application be offered, -licensed, or sold to a third party. - -3.2 You agree that Bitwarden or third parties own all legal right, title and -interest in and to the SDK, including any Intellectual Property Rights that -subsist in the SDK. "Intellectual Property Rights" means any and all rights -under patent law, copyright law, trade secret law, trademark law, and any and -all other proprietary rights. Bitwarden reserves all rights not expressly -granted to you. - -3.3 You may not use this SDK to develop applications for use with software other -than Bitwarden (including non-compatible implementations of Bitwarden) or to -develop another SDK. - -3.4 You may not use the SDK for any purpose not expressly permitted by the -License Agreement. Except for contributions to Bitwarden pursuant to the -Contribution License Agreement available at this URL: -https://cla-assistant.io/bitwarden/clients, or to the extent required by -applicable third party licenses, you may not copy modify, adapt, redistribute, -decompile, reverse engineer, disassemble, or create derivative works of the SDK -or any part of the SDK. - -3.5 Use, reproduction, and distribution of a component of the SDK licensed under -an open source software license are governed solely by the terms of that open -source software license and not the License Agreement. - -3.6 You agree that the form and nature of the SDK that the Company provides may -change without prior notice to you and that future versions of the SDK may be -incompatible with applications developed on previous versions of the SDK. You -agree that the Company may stop (permanently or temporarily) providing the SDK -or any features within the SDK to you or to users generally at the Companyâs -sole discretion, without prior notice to you. - -3.7 Nothing in the License Agreement gives you a right to use any of the -Companyâs trade names, trademarks, service marks, logos, domain names, or other -distinctive brand features. - -3.8 You agree that you will not remove, obscure, or alter any proprietary rights -notices (including copyright and trademark notices) that may be affixed to or -contained within the SDK. - -4. Use of the SDK by You - -4.1 The Company agrees that it obtains no right, title, or interest from you (or -your licensors) under the License Agreement in or to any software applications -that you develop using the SDK, including any Intellectual Property Rights that -subsist in those applications. - -4.2 You agree to use the SDK and write applications only for purposes that are -permitted by (a) the License Agreement and (b) any applicable law, regulation or -generally accepted practices or guidelines in the relevant jurisdictions -(including any laws regarding the export of data or software to and from the -United States or other relevant countries). - -4.3 You agree that if you use the SDK to develop applications for other users, -you will protect the privacy and legal rights of those users. If the users -provide you with user names, passwords, or other login information or personal -information, you must make the users aware that the information will be -available to your application, and you must provide legally adequate privacy -notice and protection for those users. If your application stores personal or -sensitive information provided by users, it must do so securely. If the user -provides your application with Bitwarden Account information, your application -may only use that information to access the user's Bitwarden Account when, and -for the limited purposes for which, the user has given you permission to do so. - -4.4 You agree that you will not engage in any activity with the SDK, including -the development or distribution of an application, that interferes with, -disrupts, damages, or accesses in an unauthorized manner the servers, networks, -or other properties or services of any third party including, but not limited -to, the Company, or any mobile communications carrier or public cloud service. - -4.5 If you use the SDK to retrieve a user's data from Bitwarden, you acknowledge -and agree that you shall retrieve data only with the user's explicit consent and -only when, and for the limited purposes for which, the user has given you -permission to do so. - -4.6 You agree that you are solely responsible for, and that the Company has no -responsibility to you or to any third party for, any data, content, or resources -that you create, transmit or display through Bitwarden and/or applications for -Bitwarden, and for the consequences of your actions (including any loss or -damage which Bitwarden may suffer) by doing so. - -4.7 You agree that you are solely responsible for, and that the Company has no -responsibility to you or to any third party for, any breach of your obligations -under the License Agreement, any applicable third party contract or Terms of -Service, or any applicable law or regulation, and for the consequences -(including any loss or damage which the Company or any third party may suffer) -of any such breach. - -5. Third Party Applications - -5.1 If you use the SDK to integrate or run applications developed by a third -party or that access data, content or resources provided by a third party, you -agree that the Company is not responsible for those applications, data, content, -or resources. You understand that all data, content or resources which you may -access through such third party applications are the sole responsibility of the -person from which they originated and that the Company is not liable for any -loss or damage that you may experience as a result of the use or access of any -of those third party applications, data, content, or resources. - -5.2 You should be aware that the data, content, and resources presented to you -through such a third party application may be protected by intellectual property -rights which are owned by the providers (or by other persons or companies on -their behalf). You acknowledge that your use of such third party applications, -data, content, or resources may be subject to separate terms between you and the -relevant third party. In that case, the License Agreement does not affect your -legal relationship with these third parties. - -6. Use of Bitwarden Server - -You acknowledge and agree that the Bitwarden server products to which any -Compatible Application must connect is protected by intellectual property rights -which are owned by the Company and your use of the Bitwarden server products is -subject to additional terms not set forth in this License Agreement. - -7. Terminating this License Agreement - -7.1 The License Agreement will continue to apply until terminated by either you -or the Company as set out below. - -7.2 If you want to terminate the License Agreement, you may do so by ceasing -your use of the SDK and any relevant developer credentials. - -7.3 The Company may at any time, terminate the License Agreement with you if: - -(a) you have breached any provision of the License Agreement; or - -(b) the Company is required to do so by law; or - -(c) a third party with whom the Company offered certain parts of the SDK to you -has terminated its relationship with the Company or ceased to offer certain -parts of the SDK to either the Company or to you; or - -(d) the Company decides to no longer provide the SDK or certain parts of the SDK -to users in the country in which you are resident or from which you use the -service, or the provision of the SDK or certain SDK services to you by the -Company is, in the Companyâ's sole discretion, no longer commercially viable or -technically practicable. - -7.4 When the License Agreement comes to an end, all of the legal rights, -obligations and liabilities that you and the Company have benefited from, been -subject to (or which have accrued over time whilst the License Agreement has -been in force) or which are expressed to continue indefinitely, shall be -unaffected by this cessation, and the provisions of paragraph 12.8 shall -continue to apply to such rights, obligations and liabilities indefinitely. - -8. NO SUPPORT - -The Company is not obligated under this License Agreement to provide you any -support services for the SDK. Any support provided is at the Companyâs sole -discretion and provided on an "as is" basis and without warranty of any kind. - -9. DISCLAIMER OF WARRANTIES - -9.1 YOU EXPRESSLY UNDERSTAND AND AGREE THAT YOUR USE OF THE SDK IS AT YOUR SOLE -RISK AND THAT THE SDK IS PROVIDED "AS IS" AND "AS AVAILABLE" WITHOUT WARRANTY OF -ANY KIND FROM Bitwarden. - -9.2 YOUR USE OF THE SDK AND ANY MATERIAL DOWNLOADED OR OTHERWISE OBTAINED -THROUGH THE USE OF THE SDK IS AT YOUR OWN DISCRETION AND RISK AND YOU ARE SOLELY -RESPONSIBLE FOR ANY DAMAGE TO YOUR COMPUTER SYSTEM OR OTHER DEVICE OR LOSS OF -DATA THAT RESULTS FROM SUCH USE. - -9.3 THE COMPANY FURTHER EXPRESSLY DISCLAIMS ALL WARRANTIES AND CONDITIONS OF ANY -KIND, WHETHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO THE IMPLIED -WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE -AND NON-INFRINGEMENT. - -10. LIMITATION OF LIABILITY - -YOU EXPRESSLY UNDERSTAND AND AGREE THAT THE COMPANY, ITS SUBSIDIARIES AND -AFFILIATES, AND ITS LICENSORS SHALL NOT BE LIABLE TO YOU UNDER ANY THEORY OF -LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL, -STATUTORY, OR EXEMPLARY DAMAGES THAT MAY BE INCURRED BY YOU, INCLUDING ANY LOSS -OF DATA, WHETHER OR NOT THE COMPANY OR ITS REPRESENTATIVES HAVE BEEN ADVISED OF -OR SHOULD HAVE BEEN AWARE OF THE POSSIBILITY OF ANY SUCH LOSSES ARISING. - -11. Indemnification - -To the maximum extent permitted by law, you agree to defend, indemnify and hold -harmless the Company, its affiliates and their respective directors, officers, -employees and agents from and against any and all claims, actions, suits or -proceedings, as well as any and all losses, liabilities, damages, costs and -expenses (including reasonable attorneys fees) arising out of or accruing from -(a) your use of the SDK, (b) any application you develop on the SDK that -infringes any copyright, trademark, trade secret, trade dress, patent or other -intellectual property right of any person or defames any person or violates -their rights of publicity or privacy, and (c) any non-compliance by you with the -License Agreement. - -12. General Legal Terms - -12.1 The Company may make changes to the License Agreement as it distributes new -versions of the SDK. When these changes are made, the Company will make a new -version of the License Agreement available on the website where the SDK is made -available. - -12.2 The License Agreement constitutes the whole legal agreement between you and -the Company and governs your use of the SDK (excluding any services or software -which the Company may provide to you under a separate written agreement), and -completely replaces any prior agreements between you and the Company in relation -to the SDK. - -12.3 You agree that if the Company does not exercise or enforce any legal right -or remedy which is contained in the License Agreement (or which the Company has -the benefit of under any applicable law), this will not be taken to be a formal -waiver of the Company's rights and that those rights or remedies will still be -available to the Company. - -12.4 If any court of law, having the jurisdiction to decide on this matter, -rules that any provision of the License Agreement is invalid, then that -provision will be removed from the License Agreement without affecting the rest -of the License Agreement. The remaining provisions of the License Agreement will -continue to be valid and enforceable. - -12.5 You acknowledge and agree that each member of the group of companies of -which the Company is the parent shall be third party beneficiaries to the -License Agreement and that such other companies shall be entitled to directly -enforce, and rely upon, any provision of the License Agreement that confers a -benefit on them or rights in favor of them. Other than this, no other person or -company shall be third party beneficiaries to the License Agreement. - -12.6 EXPORT RESTRICTIONS. THE SDK IS SUBJECT TO UNITED STATES EXPORT LAWS AND -REGULATIONS. YOU MUST COMPLY WITH ALL DOMESTIC AND INTERNATIONAL EXPORT LAWS AND -REGULATIONS THAT APPLY TO THE SDK. THESE LAWS INCLUDE RESTRICTIONS ON -DESTINATIONS, END USERS, AND END USE. - -12.7 The rights granted in the License Agreement may not be assigned or -transferred by either you or the Company without the prior written approval of -the other party, provided that the Company may assign this License Agreement -upon notice to you in connection with an acquisition, merger, sale of assets, or -similar corporate change in control for the Company or the Intellectual Property -Rights in the SDK. - -12.8 The License Agreement, and any dispute relating to or arising out of this -License Agreement, shall be governed by the laws of the State of California -without regard to its conflict of laws provisions. You and the Company agree to -submit to the exclusive jurisdiction of the courts located within the county of -Los Angeles, California to resolve any dispute or legal matter arising from the -License Agreement. Notwithstanding this, you agree that the Company shall be -allowed to apply for injunctive remedies, or any equivalent type of urgent legal -relief, in any forum or jurisdiction. diff --git a/crates/bitwarden-napi/npm/win32-x64-msvc/README.md b/crates/bitwarden-napi/npm/win32-x64-msvc/README.md deleted file mode 100644 index f4861676..00000000 --- a/crates/bitwarden-napi/npm/win32-x64-msvc/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# `@bitwarden/sdk-napi-win32-x64-msvc` - -This is the **x86_64-pc-windows-msvc** binary for `@bitwarden/sdk-napi` diff --git a/crates/bitwarden-napi/npm/win32-x64-msvc/package.json b/crates/bitwarden-napi/npm/win32-x64-msvc/package.json deleted file mode 100644 index 5b2a9312..00000000 --- a/crates/bitwarden-napi/npm/win32-x64-msvc/package.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@bitwarden/sdk-napi-win32-x64-msvc", - "version": "1.0.0", - "homepage": "https://github.com/bitwarden/sdk#readme", - "bugs": { - "url": "https://github.com/bitwarden/sdk/issues" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/bitwarden/sdk.git" - }, - "license": "SEE LICENSE IN LICENSE", - "author": "Bitwarden Inc. (https://bitwarden.com)", - "main": "sdk-napi.win32-x64-msvc.node", - "files": [ - "sdk-napi.win32-x64-msvc.node" - ], - "engines": { - "node": ">= 10" - }, - "os": [ - "win32" - ], - "cpu": [ - "x64" - ], - "publishConfig": { - "access": "public", - "registry": "https://registry.npmjs.org/" - } -} diff --git a/crates/bitwarden-napi/package-lock.json b/crates/bitwarden-napi/package-lock.json deleted file mode 100644 index eaa8d347..00000000 --- a/crates/bitwarden-napi/package-lock.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "name": "@bitwarden/sdk-napi", - "version": "1.0.0", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "@bitwarden/sdk-napi", - "version": "1.0.0", - "license": "SEE LICENSE IN LICENSE", - "devDependencies": { - "@napi-rs/cli": "2.18.4", - "typescript": "5.5.4" - }, - "engines": { - "node": ">= 10" - } - }, - "node_modules/@napi-rs/cli": { - "version": "2.18.4", - "resolved": "https://registry.npmjs.org/@napi-rs/cli/-/cli-2.18.4.tgz", - "integrity": "sha512-SgJeA4df9DE2iAEpr3M2H0OKl/yjtg1BnRI5/JyowS71tUWhrfSu2LT0V3vlHET+g1hBVlrO60PmEXwUEKp8Mg==", - "dev": true, - "license": "MIT", - "bin": { - "napi": "scripts/index.js" - }, - "engines": { - "node": ">= 10" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/Brooooooklyn" - } - }, - "node_modules/typescript": { - "version": "5.5.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.4.tgz", - "integrity": "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==", - "dev": true, - "license": "Apache-2.0", - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=14.17" - } - } - } -} diff --git a/crates/bitwarden-napi/package.json b/crates/bitwarden-napi/package.json deleted file mode 100644 index 31cee632..00000000 --- a/crates/bitwarden-napi/package.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "name": "@bitwarden/sdk-napi", - "version": "1.0.0", - "homepage": "https://github.com/bitwarden/sdk#readme", - "bugs": { - "url": "https://github.com/bitwarden/sdk/issues" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/bitwarden/sdk.git" - }, - "license": "SEE LICENSE IN LICENSE", - "author": "Bitwarden Inc. (https://bitwarden.com)", - "main": "./dist/index.js", - "types": "./dist/index.d.ts", - "files": [ - "binding.js", - "binding.d.ts", - "./dist/", - "./dist/bitwarden_client/" - ], - "scripts": { - "artifacts": "napi artifacts", - "build": "napi build --platform --release --js binding.js --dts binding.d.ts && tsc", - "build-arm64": "napi build --target aarch64-apple-darwin --platform --release --js binding.js --dts binding.d.ts && tsc", - "build:debug": "napi build --platform", - "prepublishOnly": "napi prepublish --skip-gh-release", - "tsc": "tsc", - "version": "napi version" - }, - "devDependencies": { - "@napi-rs/cli": "2.18.4", - "typescript": "5.5.4" - }, - "engines": { - "node": ">= 10" - }, - "publishConfig": { - "access": "public", - "registry": "https://registry.npmjs.org/" - }, - "napi": { - "name": "sdk-napi", - "triples": { - "additional": [ - "aarch64-apple-darwin" - ] - } - } -} diff --git a/crates/bitwarden-napi/src-ts/bitwarden_client/index.ts b/crates/bitwarden-napi/src-ts/bitwarden_client/index.ts deleted file mode 100644 index 3a3765a1..00000000 --- a/crates/bitwarden-napi/src-ts/bitwarden_client/index.ts +++ /dev/null @@ -1,245 +0,0 @@ -import * as rust from "../../binding"; -import { LogLevel } from "../../binding"; -import { - Convert, - ClientSettings, - ProjectResponse, - ProjectsDeleteResponse, - ProjectsResponse, - SecretIdentifiersResponse, - SecretResponse, - SecretsDeleteResponse, - SecretsResponse, - SecretsSyncResponse, -} from "./schemas"; - -function handleResponse(response: { - success: boolean; - errorMessage?: string | null; - data?: T | null; -}): T { - if (!response.success) { - throw new Error(response.errorMessage || ""); - } - - if (response.data === null) { - throw new Error(response.errorMessage || "SDK response data is null"); - } - - return response.data as T; -} - -export class BitwardenClient { - client: rust.BitwardenClient; - - constructor(settings?: ClientSettings, loggingLevel?: LogLevel) { - const settingsJson = settings == null ? null : Convert.clientSettingsToJson(settings); - this.client = new rust.BitwardenClient(settingsJson, loggingLevel ?? LogLevel.Info); - } - - secrets(): SecretsClient { - return new SecretsClient(this.client); - } - - projects(): ProjectsClient { - return new ProjectsClient(this.client); - } - - auth(): AuthClient { - return new AuthClient(this.client); - } -} - -export class SecretsClient { - client: rust.BitwardenClient; - - constructor(client: rust.BitwardenClient) { - this.client = client; - } - - async get(id: string): Promise { - const response = await this.client.runCommand( - Convert.commandToJson({ - secrets: { - get: { id }, - }, - }), - ); - - return handleResponse(Convert.toResponseForSecretResponse(response)); - } - - async getByIds(ids: string[]): Promise { - const response = await this.client.runCommand( - Convert.commandToJson({ - secrets: { - getByIds: { ids }, - }, - }), - ); - - return handleResponse(Convert.toResponseForSecretsResponse(response)); - } - - async create( - organizationId: string, - key: string, - value: string, - note: string, - projectIds: string[], - ): Promise { - const response = await this.client.runCommand( - Convert.commandToJson({ - secrets: { - create: { key, value, note, projectIds, organizationId }, - }, - }), - ); - - return handleResponse(Convert.toResponseForSecretResponse(response)); - } - - async list(organizationId: string): Promise { - const response = await this.client.runCommand( - Convert.commandToJson({ - secrets: { - list: { organizationId }, - }, - }), - ); - - return handleResponse(Convert.toResponseForSecretIdentifiersResponse(response)); - } - - async update( - organizationId: string, - id: string, - key: string, - value: string, - note: string, - projectIds: string[], - ): Promise { - const response = await this.client.runCommand( - Convert.commandToJson({ - secrets: { - update: { id, key, value, note, projectIds, organizationId }, - }, - }), - ); - - return handleResponse(Convert.toResponseForSecretResponse(response)); - } - - async delete(ids: string[]): Promise { - const response = await this.client.runCommand( - Convert.commandToJson({ - secrets: { - delete: { ids }, - }, - }), - ); - - return handleResponse(Convert.toResponseForSecretsDeleteResponse(response)); - } - - async sync(organizationId: string, lastSyncedDate?: Date): Promise { - const response = await this.client.runCommand( - Convert.commandToJson({ - secrets: { - sync: { organizationId, lastSyncedDate }, - }, - }), - ); - - return handleResponse(Convert.toResponseForSecretsSyncResponse(response)); - } -} - -export class ProjectsClient { - client: rust.BitwardenClient; - - constructor(client: rust.BitwardenClient) { - this.client = client; - } - - async get(id: string): Promise { - const response = await this.client.runCommand( - Convert.commandToJson({ - projects: { - get: { id }, - }, - }), - ); - - return handleResponse(Convert.toResponseForProjectResponse(response)); - } - - async create(organizationId: string, name: string): Promise { - const response = await this.client.runCommand( - Convert.commandToJson({ - projects: { - create: { name, organizationId }, - }, - }), - ); - - return handleResponse(Convert.toResponseForProjectResponse(response)); - } - - async list(organizationId: string): Promise { - const response = await this.client.runCommand( - Convert.commandToJson({ - projects: { - list: { organizationId }, - }, - }), - ); - - return handleResponse(Convert.toResponseForProjectsResponse(response)); - } - - async update(organizationId: string, id: string, name: string): Promise { - const response = await this.client.runCommand( - Convert.commandToJson({ - projects: { - update: { id, name, organizationId }, - }, - }), - ); - - return handleResponse(Convert.toResponseForProjectResponse(response)); - } - - async delete(ids: string[]): Promise { - const response = await this.client.runCommand( - Convert.commandToJson({ - projects: { - delete: { ids }, - }, - }), - ); - - return handleResponse(Convert.toResponseForProjectsDeleteResponse(response)); - } -} - -export class AuthClient { - client: rust.BitwardenClient; - - constructor(client: rust.BitwardenClient) { - this.client = client; - } - - async loginAccessToken(accessToken: string, stateFile?: string): Promise { - const response = await this.client.runCommand( - Convert.commandToJson({ - loginAccessToken: { - accessToken, - stateFile, - }, - }), - ); - - handleResponse(Convert.toResponseForAccessTokenLoginResponse(response)); - } -} diff --git a/crates/bitwarden-napi/src-ts/index.ts b/crates/bitwarden-napi/src-ts/index.ts deleted file mode 100644 index 36b0649e..00000000 --- a/crates/bitwarden-napi/src-ts/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from "./bitwarden_client/index"; -export * from "./bitwarden_client/schemas"; -export { LogLevel } from "../binding"; diff --git a/crates/bitwarden-napi/src/client.rs b/crates/bitwarden-napi/src/client.rs deleted file mode 100644 index f41d5c35..00000000 --- a/crates/bitwarden-napi/src/client.rs +++ /dev/null @@ -1,44 +0,0 @@ -extern crate log; - -use bitwarden_json::client::Client as JsonClient; -use napi_derive::napi; - -#[napi] -pub enum LogLevel { - Trace, - Debug, - Info, - Warn, - Error, -} - -fn convert_level(level: LogLevel) -> log::LevelFilter { - match level { - LogLevel::Trace => log::LevelFilter::Trace, - LogLevel::Debug => log::LevelFilter::Debug, - LogLevel::Info => log::LevelFilter::Info, - LogLevel::Warn => log::LevelFilter::Warn, - LogLevel::Error => log::LevelFilter::Error, - } -} - -#[napi] -pub struct BitwardenClient(JsonClient); - -#[napi] -impl BitwardenClient { - #[napi(constructor)] - pub fn new(settings_input: Option, log_level: Option) -> Self { - // This will only fail if another logger was already initialized, so we can ignore the - // result - let _ = env_logger::Builder::from_default_env() - .filter_level(convert_level(log_level.unwrap_or(LogLevel::Info))) - .try_init(); - Self(bitwarden_json::client::Client::new(settings_input)) - } - - #[napi] - pub async fn run_command(&self, command_input: String) -> String { - self.0.run_command(&command_input).await - } -} diff --git a/crates/bitwarden-napi/src/lib.rs b/crates/bitwarden-napi/src/lib.rs deleted file mode 100644 index 37615d41..00000000 --- a/crates/bitwarden-napi/src/lib.rs +++ /dev/null @@ -1,2 +0,0 @@ -#[cfg(not(target_arch = "wasm32"))] -mod client; diff --git a/crates/bitwarden-napi/tsconfig.json b/crates/bitwarden-napi/tsconfig.json deleted file mode 100644 index f977e075..00000000 --- a/crates/bitwarden-napi/tsconfig.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "compilerOptions": { - "target": "es6", - "module": "commonjs", - "outDir": "./dist", - "rootDir": "./src-ts", - "strict": true, - "noImplicitAny": true, - "esModuleInterop": true, - "declaration": true - }, - "include": ["src-ts", "src-ts/bitwarden_client", "src-ts/index.ts"] -} diff --git a/crates/bitwarden-py/Cargo.toml b/crates/bitwarden-py/Cargo.toml deleted file mode 100644 index b637d5fa..00000000 --- a/crates/bitwarden-py/Cargo.toml +++ /dev/null @@ -1,30 +0,0 @@ -[package] -name = "bitwarden-py" -version = "0.1.0" -publish = false - -authors.workspace = true -edition.workspace = true -rust-version.workspace = true -homepage.workspace = true -repository.workspace = true -license-file.workspace = true -keywords.workspace = true - -[lib] -name = "bitwarden_py" -crate-type = ["cdylib"] - -[dependencies] -bitwarden-json = { path = "../bitwarden-json", features = ["secrets"] } -pyo3 = { version = "0.22.1", features = ["extension-module"] } -pyo3-log = "0.11.0" - -[build-dependencies] -pyo3-build-config = { version = "0.22.1" } - -[target.'cfg(not(target_arch="wasm32"))'.dependencies] -tokio = { workspace = true, features = ["rt-multi-thread"] } - -[lints] -workspace = true diff --git a/crates/bitwarden-py/MANIFEST.in b/crates/bitwarden-py/MANIFEST.in deleted file mode 100644 index 7c68298b..00000000 --- a/crates/bitwarden-py/MANIFEST.in +++ /dev/null @@ -1,2 +0,0 @@ -include Cargo.toml -recursive-include src * diff --git a/crates/bitwarden-py/build.rs b/crates/bitwarden-py/build.rs deleted file mode 100644 index dace4a9b..00000000 --- a/crates/bitwarden-py/build.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - pyo3_build_config::add_extension_module_link_args(); -} diff --git a/crates/bitwarden-py/pyproject.toml b/crates/bitwarden-py/pyproject.toml deleted file mode 100644 index 31ffe048..00000000 --- a/crates/bitwarden-py/pyproject.toml +++ /dev/null @@ -1,2 +0,0 @@ -[build-system] -requires = ["setuptools", "wheel", "setuptools-rust"] diff --git a/crates/bitwarden-py/src/client.rs b/crates/bitwarden-py/src/client.rs deleted file mode 100644 index 9c12a624..00000000 --- a/crates/bitwarden-py/src/client.rs +++ /dev/null @@ -1,28 +0,0 @@ -use bitwarden_json::client::Client as JsonClient; -use pyo3::prelude::*; - -#[pyclass] -pub struct BitwardenClient(tokio::runtime::Runtime, JsonClient); - -#[pymethods] -impl BitwardenClient { - #[new] - #[pyo3(signature = (settings_string=None))] - pub fn new(settings_string: Option) -> Self { - // This will only fail if another logger was already initialized, so we can ignore the - // result - let _ = pyo3_log::try_init(); - - let runtime = tokio::runtime::Builder::new_multi_thread() - .enable_all() - .build() - .expect("Failed to build tokio runtime"); - - Self(runtime, JsonClient::new(settings_string)) - } - - #[pyo3(text_signature = "($self, command_input)")] - fn run_command(&self, command_input: String) -> String { - self.0.block_on(self.1.run_command(&command_input)) - } -} diff --git a/crates/bitwarden-py/src/lib.rs b/crates/bitwarden-py/src/lib.rs deleted file mode 100644 index a6cc8dc4..00000000 --- a/crates/bitwarden-py/src/lib.rs +++ /dev/null @@ -1,5 +0,0 @@ -#[cfg(not(target_arch = "wasm32"))] -mod client; - -#[cfg(not(target_arch = "wasm32"))] -mod python_module; diff --git a/crates/bitwarden-py/src/python_module.rs b/crates/bitwarden-py/src/python_module.rs deleted file mode 100644 index 3e21b852..00000000 --- a/crates/bitwarden-py/src/python_module.rs +++ /dev/null @@ -1,9 +0,0 @@ -use pyo3::prelude::*; - -use crate::client::BitwardenClient; - -#[pymodule] -fn bitwarden_py(m: &Bound<'_, PyModule>) -> PyResult<()> { - m.add_class::()?; - Ok(()) -} diff --git a/crates/bitwarden-wasm-internal/Cargo.toml b/crates/bitwarden-wasm-internal/Cargo.toml index 4f68c08d..cd2c0484 100644 --- a/crates/bitwarden-wasm-internal/Cargo.toml +++ b/crates/bitwarden-wasm-internal/Cargo.toml @@ -15,7 +15,7 @@ keywords.workspace = true crate-type = ["cdylib"] [dependencies] -bitwarden = { workspace = true, features = ["wasm"] } +bitwarden-core = { workspace = true, features = ["wasm"] } console_error_panic_hook = "0.1.7" console_log = { version = "1.0.0", features = ["color"] } js-sys = "0.3.68" diff --git a/crates/bitwarden-wasm-internal/src/client.rs b/crates/bitwarden-wasm-internal/src/client.rs index 994af1fc..8f2fa80d 100644 --- a/crates/bitwarden-wasm-internal/src/client.rs +++ b/crates/bitwarden-wasm-internal/src/client.rs @@ -1,7 +1,7 @@ extern crate console_error_panic_hook; use std::rc::Rc; -use bitwarden::{Client, ClientSettings}; +use bitwarden_core::{Client, ClientSettings}; use log::{set_max_level, Level}; use wasm_bindgen::prelude::*; diff --git a/crates/bitwarden-wasm/Cargo.toml b/crates/bitwarden-wasm/Cargo.toml deleted file mode 100644 index fd3c278f..00000000 --- a/crates/bitwarden-wasm/Cargo.toml +++ /dev/null @@ -1,43 +0,0 @@ -[package] -name = "bitwarden-wasm" -version = "0.1.0" -publish = false - -authors.workspace = true -edition.workspace = true -rust-version.workspace = true -homepage.workspace = true -repository.workspace = true -license-file.workspace = true -keywords.workspace = true - -[lib] -crate-type = ["cdylib"] - -[dependencies] -argon2 = { version = ">=0.5.0, <0.6", features = [ - "alloc", - "zeroize", -], default-features = false } -bitwarden-json = { path = "../bitwarden-json", features = ["secrets"] } -console_error_panic_hook = "0.1.7" -console_log = { version = "1.0.0", features = ["color"] } -js-sys = "0.3.68" -log = "0.4.20" -serde = { version = "1.0.196", features = ["derive"] } -wasm-bindgen = { version = "0.2.91", features = ["serde-serialize"] } -wasm-bindgen-futures = "0.4.41" - -[dev-dependencies] -wasm-bindgen-test = "0.3.41" - -[target.'cfg(target_arch = "wasm32")'.dependencies] -chrono = { version = ">=0.4.26, <0.5", features = [ - "clock", - "serde", - "std", - "wasmbind", -], default-features = false } - -[lints] -workspace = true diff --git a/crates/bitwarden-wasm/README.md b/crates/bitwarden-wasm/README.md deleted file mode 100644 index 6fa8870f..00000000 --- a/crates/bitwarden-wasm/README.md +++ /dev/null @@ -1,23 +0,0 @@ -# Bitwarden-wasm - -Requirements: - -- `wasm32-unknown-unknown` rust target. -- `wasm-bindgen-cli` installed. -- `binaryen` installed for `wasm-opt` and `wasm2js`. - -```bash -rustup target add wasm32-unknown-unknown -cargo install -f wasm-bindgen-cli -brew install binaryen -``` - -#### Build - -```bash -# dev -./build.sh - -# release -./build.sh -r -``` diff --git a/crates/bitwarden-wasm/build.sh b/crates/bitwarden-wasm/build.sh deleted file mode 100755 index d49b12de..00000000 --- a/crates/bitwarden-wasm/build.sh +++ /dev/null @@ -1,23 +0,0 @@ -# Move to the root of the repository -cd "$(dirname "$0")" -cd ../../ - -if [ "$1" != "-r" ]; then - # Dev - cargo build -p bitwarden-wasm --target wasm32-unknown-unknown - wasm-bindgen --target bundler --out-dir languages/js/wasm ./target/wasm32-unknown-unknown/debug/bitwarden_wasm.wasm - wasm-bindgen --target nodejs --out-dir languages/js/wasm/node ./target/wasm32-unknown-unknown/debug/bitwarden_wasm.wasm -else - # Release - cargo build -p bitwarden-wasm --target wasm32-unknown-unknown --release - wasm-bindgen --target bundler --out-dir languages/js/wasm ./target/wasm32-unknown-unknown/release/bitwarden_wasm.wasm - wasm-bindgen --target nodejs --out-dir languages/js/wasm/node ./target/wasm32-unknown-unknown/release/bitwarden_wasm.wasm -fi - -# Optimize size -wasm-opt -Os ./languages/js/wasm/bitwarden_wasm_bg.wasm -o ./languages/js/wasm/bitwarden_wasm_bg.wasm -wasm-opt -Os ./languages/js/wasm/node/bitwarden_wasm_bg.wasm -o ./languages/js/wasm/node/bitwarden_wasm_bg.wasm - -# Transpile to JS -wasm2js ./languages/js/wasm/bitwarden_wasm_bg.wasm -o ./languages/js/wasm/bitwarden_wasm_bg.wasm.js -npx terser ./languages/js/wasm/bitwarden_wasm_bg.wasm.js -o ./languages/js/wasm/bitwarden_wasm_bg.wasm.js diff --git a/crates/bitwarden-wasm/src/client.rs b/crates/bitwarden-wasm/src/client.rs deleted file mode 100644 index e130705c..00000000 --- a/crates/bitwarden-wasm/src/client.rs +++ /dev/null @@ -1,80 +0,0 @@ -extern crate console_error_panic_hook; -use std::rc::Rc; - -use argon2::{Algorithm, Argon2, Params, Version}; -use bitwarden_json::client::Client as JsonClient; -use js_sys::Promise; -use log::{set_max_level, Level}; -use wasm_bindgen::prelude::*; -use wasm_bindgen_futures::future_to_promise; - -#[wasm_bindgen] -pub enum LogLevel { - Trace, - Debug, - Info, - Warn, - Error, -} - -fn convert_level(level: LogLevel) -> Level { - match level { - LogLevel::Trace => Level::Trace, - LogLevel::Debug => Level::Debug, - LogLevel::Info => Level::Info, - LogLevel::Warn => Level::Warn, - LogLevel::Error => Level::Error, - } -} - -// Rc<...> is to avoid needing to take ownership of the Client during our async run_command -// function https://github.com/rustwasm/wasm-bindgen/issues/2195#issuecomment-799588401 -#[wasm_bindgen] -pub struct BitwardenClient(Rc); - -#[wasm_bindgen] -impl BitwardenClient { - #[wasm_bindgen(constructor)] - pub fn new(settings_input: Option, log_level: Option) -> Self { - console_error_panic_hook::set_once(); - let log_level = convert_level(log_level.unwrap_or(LogLevel::Info)); - if let Err(_e) = console_log::init_with_level(log_level) { - set_max_level(log_level.to_level_filter()) - } - - Self(Rc::new(bitwarden_json::client::Client::new(settings_input))) - } - - #[wasm_bindgen] - pub fn run_command(&self, js_input: String) -> Promise { - let rc = self.0.clone(); - future_to_promise(async move { - let result = rc.run_command(&js_input).await; - Ok(result.into()) - }) - } -} - -#[wasm_bindgen] -pub fn argon2( - password: &[u8], - salt: &[u8], - iterations: u32, - memory: u32, - parallelism: u32, -) -> Result, JsError> { - let argon = Argon2::new( - Algorithm::Argon2id, - Version::V0x13, - Params::new( - memory * 1024, // Convert MiB to KiB - iterations, - parallelism, - Some(32), - )?, - ); - - let mut hash = [0u8; 32]; - argon.hash_password_into(password, salt, &mut hash)?; - Ok(hash.to_vec()) -} diff --git a/crates/bitwarden-wasm/src/lib.rs b/crates/bitwarden-wasm/src/lib.rs deleted file mode 100644 index b79c47fc..00000000 --- a/crates/bitwarden-wasm/src/lib.rs +++ /dev/null @@ -1 +0,0 @@ -mod client; diff --git a/crates/bitwarden/CHANGELOG.md b/crates/bitwarden/CHANGELOG.md deleted file mode 100644 index 5d3eefa9..00000000 --- a/crates/bitwarden/CHANGELOG.md +++ /dev/null @@ -1,83 +0,0 @@ -# Changelog - -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project -adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - -## [Unreleased] - -### Added - -- Support for secrets sync (#678) -- Password generator (#986) - -### Changed - -- `ClientSettings` and `DeviceType` is now exported in the root module (#805) -- Secrets Manager now requires `bitwarden::secrets_manager::ClientSecretsExt` and - `bitwarden::secrets_manager::ClientProjectsExt` to be imported in order to access `secrets()` and - `projects` on the client (#798) -- Updated MSRV `1.75.0` (#980) - -### Removed - -- The deprecated `client.access_token_login()` is now removed. Please use - `client.auth().login_access_token()` instead. (#806) - -## [0.5.0] - 2024-04-26 - -### Changed - -- Switched TLS backend to `rustls`, removing the dependency on `OpenSSL`. (#374) -- `client::AccessToken` is now `auth::AccessToken`. (#656) - -### Fixed - -- Fix renew for service account access token logins (#702) - -## [0.4.0] - 2023-12-21 - -### Added - -- Support for basic state to avoid reauthenticating when creating a new `Client`. This is a breaking - change because of adding `state_file` to the `AccessTokenLoginRequest` struct. (#388) - -### Deprecated - -- `client.access_token_login()` is now deprecated and will be removed in a future release. Please - use `client.auth().login_access_token()` instead. (#319) - -## [0.3.1] - 2023-10-13 - -### Changed - -- `auth::request::AccessTokenLoginRequest` moved to `auth::login::AccessTokenLoginRequest` (#178) -- Support for fetching multiple secrets by ids (#150) - -## [0.3.0] - 2023-07-26 - -### Deprecated - -- The secrets manager SDK is now hidden behind a `secrets` feature flag. Make sure to enable this - flag in your `Cargo.toml` file. At the moment the flag is enabled by default for compatibility - reasons, but this is considered deprecated and the flag will be made opt-in eventually. - -### Added - -- Support for creating and editing secrets (#77) -- Support for creating and editing projects (#53) - -### Changed - -- Folder structure, update `use` declarations (#68) - -### Fixed - -- Improve login error handling (#109) - -## [0.2.1] - 2023-03-22 - -### Fixed - -- Add user agent to login requests (#11) diff --git a/crates/bitwarden/Cargo.toml b/crates/bitwarden/Cargo.toml deleted file mode 100644 index 3626f9d1..00000000 --- a/crates/bitwarden/Cargo.toml +++ /dev/null @@ -1,39 +0,0 @@ -[package] -name = "bitwarden" -description = """ -Bitwarden Secrets Manager SDK -""" -keywords = ["bitwarden", "secrets-manager"] - -version.workspace = true -authors.workspace = true -edition.workspace = true -rust-version.workspace = true -homepage.workspace = true -repository.workspace = true -license-file.workspace = true - -[features] -default = ["secrets"] - -no-memory-hardening = [ - "bitwarden-core/no-memory-hardening", -] # Disable memory hardening features -secrets = [ - "bitwarden-core/secrets", - "dep:bitwarden-sm", - "dep:bitwarden-generators", -] # Secrets manager API -wasm = ["bitwarden-core/wasm"] # WASM support - -[dependencies] -bitwarden-core = { workspace = true } -bitwarden-generators = { workspace = true, optional = true } -bitwarden-sm = { workspace = true, optional = true } -thiserror = { workspace = true } - -[dev-dependencies] -uuid = { workspace = true } - -[lints] -workspace = true diff --git a/crates/bitwarden/README.md b/crates/bitwarden/README.md deleted file mode 100644 index 010a6462..00000000 --- a/crates/bitwarden/README.md +++ /dev/null @@ -1,58 +0,0 @@ -# Bitwarden Secrets Manager SDK - -A Rust client SDK to interact with the -[Bitwarden Secrets Manager](https://bitwarden.com/products/secrets-manager/). This is a beta release -and might be missing some functionality. - -## Usage - -```toml -[dependencies] -bitwarden = { "*", features = ["secrets"] } -``` - -## Minimum Supported Rust Version - -Rust **1.75** or higher. - -## Example - -```rust -use bitwarden::{ - auth::login::AccessTokenLoginRequest, - error::Result, - secrets_manager::{secrets::SecretIdentifiersRequest, ClientSecretsExt}, - Client, ClientSettings, DeviceType, -}; -use uuid::Uuid; - -async fn test() -> Result<()> { - // Use the default values - let mut client = Client::new(None); - - // Or set your own values - 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 mut client = Client::new(Some(settings)); - - // Before we operate, we need to authenticate with a token - let token = AccessTokenLoginRequest { - access_token: String::from(""), - state_file: None, - }; - client.auth().login_access_token(&token).await.unwrap(); - - let org_id = SecretIdentifiersRequest { - organization_id: Uuid::parse_str("00000000-0000-0000-0000-000000000000").unwrap(), - }; - println!( - "Stored secrets: {:#?}", - client.secrets().list(&org_id).await.unwrap() - ); - Ok(()) -} -``` diff --git a/crates/bitwarden/src/error.rs b/crates/bitwarden/src/error.rs deleted file mode 100644 index 163ccc20..00000000 --- a/crates/bitwarden/src/error.rs +++ /dev/null @@ -1,24 +0,0 @@ -//! Errors that can occur when using this SDK - -use std::fmt::Debug; - -use thiserror::Error; - -#[derive(Debug, Error)] -pub enum Error { - #[error(transparent)] - Core(#[from] bitwarden_core::Error), -} - -// Ensure that the error messages implement Send and Sync -#[cfg(test)] -const _: () = { - fn assert_send() {} - fn assert_sync() {} - fn assert_all() { - assert_send::(); - assert_sync::(); - } -}; - -pub type Result = std::result::Result; diff --git a/crates/bitwarden/src/lib.rs b/crates/bitwarden/src/lib.rs deleted file mode 100644 index 77a063f5..00000000 --- a/crates/bitwarden/src/lib.rs +++ /dev/null @@ -1,72 +0,0 @@ -//! # Bitwarden -//! -//! A Rust client SDK to interact with the Bitwarden Secrets Manager. -//! This is a beta release and might be missing some functionality. -//! -//! To use this crate, add it to your `Cargo.toml`: -//! -//! ```ini -//! [dependencies] -//! bitwarden = { "*", features = ["secrets"] } -//! ``` -//! -//! # Basic setup -//! -//! All operations in this crate are done via a [Client]: -//! -//! ```rust -//! use bitwarden::{ -//! auth::login::AccessTokenLoginRequest, -//! error::Result, -//! secrets_manager::{secrets::SecretIdentifiersRequest, ClientSecretsExt}, -//! Client, ClientSettings, DeviceType, -//! }; -//! use uuid::Uuid; -//! -//! async fn test() -> Result<()> { -//! // Use the default values -//! let mut client = Client::new(None); -//! -//! // Or set your own values -//! 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 mut client = Client::new(Some(settings)); -//! -//! // Before we operate, we need to authenticate with a token -//! let token = AccessTokenLoginRequest { -//! access_token: String::from(""), -//! state_file: None, -//! }; -//! client.auth().login_access_token(&token).await.unwrap(); -//! -//! let org_id = SecretIdentifiersRequest { -//! organization_id: Uuid::parse_str("00000000-0000-0000-0000-000000000000").unwrap(), -//! }; -//! println!( -//! "Stored secrets: {:#?}", -//! client.secrets().list(&org_id).await.unwrap() -//! ); -//! Ok(()) -//! } -//! ``` - -// Ensure the readme docs compile -#[doc = include_str!("../README.md")] -mod readme {} - -pub use bitwarden_core::*; -pub mod error; - -#[cfg(feature = "secrets")] -pub mod generators { - pub use bitwarden_generators::{ClientGeneratorExt, PasswordError, PasswordGeneratorRequest}; -} - -#[cfg(feature = "secrets")] -pub mod secrets_manager { - pub use bitwarden_sm::*; -} diff --git a/crates/bws/CHANGELOG.md b/crates/bws/CHANGELOG.md deleted file mode 100644 index 2690c14f..00000000 --- a/crates/bws/CHANGELOG.md +++ /dev/null @@ -1,78 +0,0 @@ -# Changelog - -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project -adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - -## [Unreleased] - -### Added - -- The ability to edit unassigned secrets with direct permissions. (#906) - -### Changed - -- Updated MSRV `1.75.0` (#980) - -### Removed - -- The deprecated `action type` commands are now removed. Please use `type action` instead. (#836) - -## [0.5.0] - 2024-04-26 - -### Added - -- Add a `BWS_CONFIG_FILE` environment variable to specify the location of the config file (#571) -- The `bws` CLI is now available as a Docker image (`docker run -it bitwarden/bws --help`) (#305) -- The `bws` CLI releases are now code signed on Windows and Mac (#534, #535) - -### Fixed - -- Re-add output options to the help menu after they were accidentally removed (#477) - -### Changed - -- Switched TLS backend to `rusttls`, removing the dependency on `OpenSSL` (#374) -- Updated MSRV for `bws` to `1.71.0` (#589) - -## [0.4.0] - 2023-12-21 - -### Added - -- Ability to output secrets in an `env` format with `bws` (#320) -- Basic state to avoid reauthenticating every run, used when setting the `state_file_dir` key in the - config (#388) - -## [0.3.1] - 2023-10-13 - -### Added - -- Support for shell autocompletion with the `bws completions` command (#103) -- When running `bws` with no args, the help text is now printed to `stderr` instead of `stdout` to - be consistent with `bws subcommand` behavior (#190) - -## [0.3.0] - 2023-07-26 - -### Deprecated - -- Switched command order from `action type` to `type action`, please re-read the help documentation - (#76) - -### Added - -- Ability to create and edit projects (#53) -- Ability to create and edit secrets (#77) -- Support `NO_COLOR` environment variable to disable CLI colors (#61) -- Support for `CLICOLOR_FORCE` (#74) - -### Fixed - -- Improve login error handling (#109) -- Respect users color choice for errors (#61) - -## [0.2.1] - 2023-03-22 - -### Fixed - -- Add user agent to login requests (#11) diff --git a/crates/bws/Cargo.toml b/crates/bws/Cargo.toml deleted file mode 100644 index 08e3941f..00000000 --- a/crates/bws/Cargo.toml +++ /dev/null @@ -1,60 +0,0 @@ -[package] -name = "bws" -version = "1.0.0" -description = """ -Bitwarden Secrets Manager CLI -""" -keywords = ["bitwarden", "secrets-manager", "cli"] -exclude = ["Dockerfile*", "entitlements.plist"] - -authors.workspace = true -edition.workspace = true -rust-version.workspace = true -homepage.workspace = true -repository.workspace = true -license-file.workspace = true - -[dependencies] -bat = { version = "0.24.0", features = [ - "regex-onig", -], default-features = false } -bitwarden = { workspace = true, features = ["secrets"] } -bitwarden-cli = { workspace = true } -chrono = { version = "0.4.38", features = [ - "clock", - "std", -], default-features = false } -clap = { version = "4.5.4", features = ["derive", "env", "string"] } -clap_complete = "4.5.2" -color-eyre = "0.6.3" -comfy-table = "7.1.1" -directories = "5.0.1" -env_logger = "0.11.1" -itertools = "0.13.0" -log = "0.4.20" -regex = { version = "1.10.3", features = [ - "std", - "perf", -], default-features = false } -serde = "1.0.196" -serde_json = "1.0.113" -serde_yaml = "0.9" -supports-color = "3.0.0" -thiserror = "1.0.57" -tokio = { workspace = true, features = ["rt-multi-thread"] } -toml = "0.8.10" -uuid = { version = "1.7.0", features = ["serde"] } -which = "6.0.1" - -[build-dependencies] -bitwarden-cli = { workspace = true } -clap = { version = "4.5.4", features = ["derive", "string"] } -clap_complete = "4.5.2" -clap_mangen = "0.2.20" -uuid = { version = "1.7.0" } - -[dev-dependencies] -tempfile = "3.10.0" - -[lints] -workspace = true diff --git a/crates/bws/Dockerfile b/crates/bws/Dockerfile deleted file mode 100644 index 07f9f3a7..00000000 --- a/crates/bws/Dockerfile +++ /dev/null @@ -1,57 +0,0 @@ -############################################### -# Build stage # -############################################### -FROM --platform=$BUILDPLATFORM rust:1.81 AS build - -# Docker buildx supplies the value for this arg -ARG TARGETPLATFORM - -RUN apt-get update && apt-get install -y --no-install-recommends \ - ca-certificates \ - && rm -rf /var/lib/apt/lists/* - -# Copy required project files -COPY . /app - -# Build project -WORKDIR /app/crates/bws -RUN cargo build --release --bin bws - -# Bundle bws dependencies -RUN mkdir /lib-bws -RUN mkdir /lib64-bws - -RUN ldd /app/target/release/bws | tr -s '[:blank:]' '\n' | grep '^/lib' | xargs -I % cp % /lib-bws -RUN ldd /app/target/release/bws | tr -s '[:blank:]' '\n' | grep '^/lib64' | xargs -I % cp % /lib64-bws - -# Make a user and HOME directory for the app stage -RUN useradd -m app - -############################################### -# App stage # -############################################### -FROM scratch - -ARG TARGETPLATFORM -LABEL com.bitwarden.product="bitwarden" - -# Set a HOME directory and copy the user file -COPY --from=build /home/app /home/app -COPY --from=build /etc/passwd /etc/passwd -ENV HOME=/home/app -WORKDIR /home/app - -# Switch to the app user -USER app - -# Copy built project from the build stage -COPY --from=build /app/target/release/bws /bin/bws - -# Copy certs -COPY --from=build /etc/ssl/certs /etc/ssl/certs - -# Copy bws dependencies -COPY --from=build /lib-bws /lib -COPY --from=build /lib64-bws /lib64 - -ENTRYPOINT ["bws"] diff --git a/crates/bws/Dockerfile.dockerignore b/crates/bws/Dockerfile.dockerignore deleted file mode 100644 index 50f4b123..00000000 --- a/crates/bws/Dockerfile.dockerignore +++ /dev/null @@ -1,4 +0,0 @@ -* -!crates/* -!Cargo.toml -!Cargo.lock diff --git a/crates/bws/README.md b/crates/bws/README.md deleted file mode 100644 index 524a168a..00000000 --- a/crates/bws/README.md +++ /dev/null @@ -1,94 +0,0 @@ -# Bitwarden Secrets Manager CLI - -A Rust CLI for interacting with the -[Bitwarden Secrets Manager](https://bitwarden.com/products/secrets-manager/). This is a beta release -and might be missing some functionality. - -## Install - -We offer three ways to install bws: - -### Cargo (crates.io) - -Download bws via `cargo` from [crates.io](https://crates.io): - -```bash -cargo install bws --locked -``` - -### Install Script (from GitHub Releases) - -Linux/macOS: `curl https://bws.bitwarden.com/install | sh` - -Windows: `iwr https://bws.bitwarden.com/install | iex` - -An optional `-u/--uninstall` flag can be passed to the POSIX script to uninstall the CLI. The -PowerShell version accepts an equivalent `-Uninstall` flag. The uninstallation process will remove -the `bws` binary and the configuration directory (`~/.bws`). - -### GitHub Releases (Manual) - -Download a pre-built binary from the [Releases](https://github.com/bitwarden/sdk/releases) page. - -## Usage - -```bash -bws --help -``` - -## How to enable shell autocompletions - -### Zsh - -If completion is not enabled already, you need to enable it first: - -```zsh -echo "autoload -U compinit; compinit" >> ~/.zshrc -``` - -Enable autocompletions for the current user: - -```zsh -echo 'source <(/path/to/bws completions zsh)' >> ~/.zshrc -``` - -### Bash - -Enable autocompletions for the current user: - -```zsh -echo 'source <(/path/to/bws completions bash)' >> ~/.bashrc -``` - -For more detailed documentation, please refer to the -[Secrets Manager CLI help article](https://bitwarden.com/help/secrets-manager-cli/). - -## Docker - -We also provide a docker image preloaded with the `bws` cli. - -```bash -# From the root of the repository -docker build -f crates/bws/Dockerfile -t bitwarden/bws . - -docker run --rm -it bitwarden/bws --help -``` - -To use a configuration file, utilize docker -[bind mounting](https://docs.docker.com/storage/bind-mounts/) to expose it to the container: - -```bash -docker run --rm -it -v "$HOME"/.bws:/home/app/.bws bitwarden/bws --help -``` - -## How to build manpages - -The manpages get built during compilation of the `bws` crate through the use of a build script. The -output path of this build script can be located as follows: - -``` -MANPAGES_DIR=$(cargo build -p bws --message-format json | jq -r --slurp '.[] | select (.reason == "build-script-executed") | select(.package_id|contains("crates/bws")) .out_dir') -``` - -After running the provided commands, the built manpages should be located in -`$MANPAGES_DIR/manpages` diff --git a/crates/bws/build.rs b/crates/bws/build.rs deleted file mode 100644 index be056237..00000000 --- a/crates/bws/build.rs +++ /dev/null @@ -1,14 +0,0 @@ -include!("src/cli.rs"); - -fn main() -> Result<(), std::io::Error> { - use std::{env, fs, path::Path}; - - let out_dir = env::var_os("OUT_DIR").expect("OUT_DIR exists"); - let path = Path::new(&out_dir).join("manpages"); - fs::create_dir_all(&path).expect("OUT_DIR is writable"); - - let cmd = ::command(); - clap_mangen::generate_to(cmd, &path)?; - - Ok(()) -} diff --git a/crates/bws/entitlements.plist b/crates/bws/entitlements.plist deleted file mode 100644 index aeaa1504..00000000 --- a/crates/bws/entitlements.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - com.apple.security.cs.allow-unsigned-executable-memory - - - \ No newline at end of file diff --git a/crates/bws/scripts/install.ps1 b/crates/bws/scripts/install.ps1 deleted file mode 100755 index daa5cf9d..00000000 --- a/crates/bws/scripts/install.ps1 +++ /dev/null @@ -1,108 +0,0 @@ -param ( - [switch]$Uninstall -) - -$ErrorActionPreference = "Stop" - -$defaultBwsVersion = "1.0.0" -$bwsVersion = if ($env:bwsVersion) { $env:bwsVersion } else { $defaultBwsVersion } -$installDir = [Environment]::GetFolderPath([Environment+SpecialFolder]::LocalApplicationData) | Join-Path -ChildPath "Programs" | Join-Path -ChildPath "Bitwarden" - -# https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-processor#properties -$processorArch = (Get-CimInstance -ClassName Win32_Processor).Architecture -if ($processorArch -eq 9) { - $arch = "x86_64" -} elseif ($processorArch -eq 12) { - $arch = "aarch64" -} else { - throw "Unsupported architecture: $processorArch" -} - -function Test-BwsInstallation { - $existingBws = Get-Command bws -ErrorAction SilentlyContinue - if ($null -ne $existingBws) { - $userInput = Read-Host "bws is already installed at $($existingBws.Source). Do you want to overwrite it? (Y/N)" - if ($userInput -ne "Y") { - Write-Host "Installation cancelled by user." - exit - } - } -} - -function Invoke-BwsDownload { - Write-Host "Detected architecture: $arch" - - $bwsUrl = "https://github.com/bitwarden/sdk/releases/download/bws-v$bwsVersion/bws-$arch-pc-windows-msvc-$bwsVersion.zip" - Write-Host "Downloading bws from: $bwsUrl" - $outputPath = Join-Path $env:TEMP "bws.zip" - Invoke-WebRequest -Uri $bwsUrl -OutFile $outputPath - return $outputPath -} - -function Test-Checksum { - param($zipPath) - Write-Host "Validating checksum..." - - $checksumUrl = "https://github.com/bitwarden/sdk/releases/download/bws-v$bwsVersion/bws-sha256-checksums-$bwsVersion.txt" - $checksumFile = Join-Path $env:TEMP "bws-checksums.txt" - Invoke-WebRequest -Uri $checksumUrl -OutFile $checksumFile - - $expectedChecksum = (Get-Content $checksumFile | Where-Object { $_ -match "bws-$arch-pc-windows-msvc-$bwsVersion.zip" }).Split(" ")[0] - $actualChecksum = (Get-FileHash -Algorithm SHA256 -Path $zipPath).Hash - - if ($actualChecksum -ne $expectedChecksum) { - throw "Checksum validation failed. Expected: $expectedChecksum, Actual: $actualChecksum" - } else { - Write-Host "Checksum validation successful." - } -} - -function Install-Bws { - param($zipPath) - Write-Host "Installing bws..." - New-Item -ItemType Directory -Force -Path $installDir | Out-Null - Expand-Archive -Force $zipPath -DestinationPath $installDir - Write-Host "bws installed to $installDir" - setx PATH "$env:PATH;$installDir" - Write-Host "$installDir has been added to your PATH" - Write-Host "Please restart your shell to use bws" -} - -function Test-Bws { - Write-Host "Checking bws..." - $bwsPath = Join-Path $installDir "bws.exe" - if (Test-Path $bwsPath) { - Write-Host "bws is installed at $bwsPath" - } else { - throw "bws is not installed" - } -} - -function Remove-Bws { - Write-Host "Uninstalling bws..." - - if (Test-Path $installDir) { - Remove-Item -Path $installDir -Recurse -Force - Write-Host "bws uninstalled from $installDir" - } else { - Write-Host "bws installation directory not found at $installDir. Skipping removal." - } - - $configDir = "$env:USERPROFILE\.bws" - if (Test-Path $configDir -PathType Container) { - Remove-Item -Path $configDir -Recurse -Force - Write-Host "bws config directory removed from $configDir" - } else { - Write-Host "bws config directory not found at $configDir. Skipping removal." - } -} - -if ($Uninstall) { - Remove-Bws -} else { - Test-BwsInstallation - $zipPath = Invoke-BwsDownload - Test-Checksum -zipPath $zipPath - Install-Bws -zipPath $zipPath - Test-Bws -} diff --git a/crates/bws/scripts/install.sh b/crates/bws/scripts/install.sh deleted file mode 100755 index 6cd7fe01..00000000 --- a/crates/bws/scripts/install.sh +++ /dev/null @@ -1,180 +0,0 @@ -#!/bin/sh - -################################################## -# An installer for the bws command line utility. # -################################################## - -DEFAULT_BWS_VERSION="1.0.0" -BWS_VERSION="${BWS_VERSION:-$DEFAULT_BWS_VERSION}" - -main() { - case "$1" in - -u | --uninstall) - uninstall_bws - ;; - *) - check_required - platform_detect - arch_detect - download_bws - validate_checksum - install_bws - ;; - esac -} - -error() { - echo "$1" >&2 - echo "Exiting..." >&2 - exit 1 -} - -check_required() { - if ! command -v curl >/dev/null && ! command -v wget >/dev/null; then - error "curl or wget is required to download bws." - fi - - if ! command -v unzip >/dev/null; then - error "unzip is required to install bws." - fi -} - -can_sudo() { - if command -v sudo >/dev/null; then - echo "Attempting to install bws with sudo. Please enter your password if prompted." - if sudo -v 2>/dev/null; then - echo "sudo is available and we have the necessary permissions." - echo "Installing bws to /usr/local/bin..." - return 0 - else - echo "sudo is available, but we failed to authenticate." - return 1 - fi - else - echo "sudo is not available." - return 1 - fi -} - -platform_detect() { - if [ "$(uname -s)" = "Linux" ]; then - PLATFORM="unknown-linux-gnu" - elif [ "$(uname -s)" = "Darwin" ]; then - PLATFORM="apple-darwin" - else - error "Unsupported platform: $(uname -s)" - fi -} - -arch_detect() { - if [ "$(uname -m)" = "x86_64" ]; then - ARCH="x86_64" - elif [ "$(uname -m)" = "aarch64" ]; then # Linux uname output - ARCH="aarch64" - elif [ "$(uname -m)" = "arm64" ]; then # Darwin uname output - ARCH="aarch64" - else - error "Unsupported architecture: $(uname -m)" - fi -} - -checksum() { - if command -v sha256sum >/dev/null; then - sha256sum "$1" - else - shasum -a 256 "$1" - fi -} - -downloader() { - if command -v curl >/dev/null; then - curl -L -o "$2" "$1" - else - wget -O "$2" "$1" - fi -} - -extract() { - unzip -o "$1" -d "$2" -} - -download_bws() { - bws_url="https://github.com/bitwarden/sdk/releases/download/bws-v${BWS_VERSION}/bws-${ARCH}-${PLATFORM}-${BWS_VERSION}.zip" - echo "Downloading bws from: $bws_url" - tmp_dir="$(mktemp -d)" - downloader "$bws_url" "$tmp_dir/bws.zip" -} - -validate_checksum() { - checksum_url="https://github.com/bitwarden/sdk/releases/download/bws-v${BWS_VERSION}/bws-sha256-checksums-${BWS_VERSION}.txt" - echo "Downloading checksum file from: $checksum_url" - checksum_file="$tmp_dir/bws-checksums.txt" - downloader "$checksum_url" "$checksum_file" - - expected_checksum="$(grep "bws-${ARCH}-${PLATFORM}-${BWS_VERSION}.zip" "$checksum_file" | awk '{print $1}')" - actual_checksum="$(checksum "$tmp_dir/bws.zip" | awk '{print $1}')" - - if [ "$actual_checksum" != "$expected_checksum" ]; then - error "Checksum validation failed. Expected: $expected_checksum, Actual: $actual_checksum" - else - echo "Checksum validation successful." - fi -} - -install_bws() { - echo "Installing bws..." - extract "$tmp_dir/bws.zip" "$tmp_dir" - chmod +x "$tmp_dir/bws" - - if can_sudo; then - sudo install -m 755 "$tmp_dir/bws" /usr/local/bin/bws - - if ! command -v bws >/dev/null; then - error "Installation failed. bws was not found in /usr/local/bin" - fi - - echo "bws installed to /usr/local/bin/bws" - else - echo "Installing to your \$HOME directory..." - user_bin_dir="${HOME}/.local/bin" - mkdir -p "${user_bin_dir}" - install -m 755 "$tmp_dir/bws" "${user_bin_dir}/bws" - - if ! command -v "${user_bin_dir}/bws" >/dev/null; then - error "Installation failed. bws was not found in ${user_bin_dir}" - fi - - echo "bws installed at ${user_bin_dir}/bws" - echo "Please add ${user_bin_dir} to your PATH by adding the following line to your ~/.profile or shell rc file:" - echo "export PATH=\"\$PATH:${user_bin_dir}\"" - fi - - rm -rf "$tmp_dir" -} - -uninstall_bws() { - if command -v bws >/dev/null; then - echo "Uninstalling bws..." - if can_sudo; then - sudo rm "$(command -v bws)" - else - rm "$(command -v bws)" - fi - - # Safely remove the configuration directory - if [ -n "$HOME" ]; then - echo "Removing bws configuration directory at ${HOME}/.bws" - echo "If you use another directory for your configuration, you may want to remove it manually." - rm -rf "${HOME}/.bws" - else - echo "HOME environment variable is not set. Cannot safely remove .bws directory." - fi - - echo "bws uninstalled successfully." - else - echo "bws is not installed." - fi - exit 0 -} - -main "$@" diff --git a/crates/bws/src/cli.rs b/crates/bws/src/cli.rs deleted file mode 100644 index 9c81e8bf..00000000 --- a/crates/bws/src/cli.rs +++ /dev/null @@ -1,169 +0,0 @@ -use std::path::PathBuf; - -use bitwarden_cli::Color; -use clap::{ArgGroup, Parser, Subcommand, ValueEnum}; -use clap_complete::Shell; -use uuid::Uuid; - -pub(crate) const ACCESS_TOKEN_KEY_VAR_NAME: &str = "BWS_ACCESS_TOKEN"; -pub(crate) const CONFIG_FILE_KEY_VAR_NAME: &str = "BWS_CONFIG_FILE"; -pub(crate) const PROFILE_KEY_VAR_NAME: &str = "BWS_PROFILE"; -pub(crate) const SERVER_URL_KEY_VAR_NAME: &str = "BWS_SERVER_URL"; -pub(crate) const UUIDS_AS_KEYNAMES_VAR_NAME: &str = "BWS_UUIDS_AS_KEYNAMES"; - -pub(crate) const DEFAULT_CONFIG_FILENAME: &str = "config"; -pub(crate) const DEFAULT_CONFIG_DIRECTORY: &str = ".config/bws"; - -#[allow(non_camel_case_types)] -#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, ValueEnum, Debug)] -pub(crate) enum ProfileKey { - server_base, - server_api, - server_identity, - state_dir, - state_opt_out, -} - -#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, ValueEnum, Debug)] -#[allow(clippy::upper_case_acronyms)] -pub(crate) enum Output { - JSON, - YAML, - Env, - Table, - TSV, - None, -} - -#[derive(Parser, Debug)] -#[command(name = "bws", version, about = "Bitwarden Secrets CLI", long_about = None)] -pub(crate) struct Cli { - // Optional as a workaround for https://github.com/clap-rs/clap/issues/3572 - #[command(subcommand)] - pub(crate) command: Option, - - #[arg(short = 'o', long, global = true, value_enum, default_value_t = Output::JSON, help="Output format")] - pub(crate) output: Output, - - #[arg(short = 'c', long, global = true, value_enum, default_value_t = Color::Auto, help="Use colors in the output")] - pub(crate) color: Color, - - #[arg(short = 't', long, global = true, env = ACCESS_TOKEN_KEY_VAR_NAME, hide_env_values = true, help="Specify access token for the service account")] - pub(crate) access_token: Option, - - #[arg( - short = 'f', - long, - global = true, - env = CONFIG_FILE_KEY_VAR_NAME, - help = format!("[default: ~/{}/{}] Config file to use", DEFAULT_CONFIG_DIRECTORY, DEFAULT_CONFIG_FILENAME) - )] - pub(crate) config_file: Option, - - #[arg(short = 'p', long, global = true, env = PROFILE_KEY_VAR_NAME, help="Profile to use from the config file")] - pub(crate) profile: Option, - - #[arg(short = 'u', long, global = true, env = SERVER_URL_KEY_VAR_NAME, help="Override the server URL from the config file")] - pub(crate) server_url: Option, -} - -#[derive(Subcommand, Debug)] -pub(crate) enum Commands { - #[command(long_about = "Configure the CLI", arg_required_else_help(true))] - Config { - name: Option, - value: Option, - - #[arg(short = 'd', long)] - delete: bool, - }, - - #[command(long_about = "Generate shell completion files")] - Completions { shell: Option }, - - #[command(long_about = "Commands available on Projects")] - Project { - #[command(subcommand)] - cmd: ProjectCommand, - }, - #[command(long_about = "Commands available on Secrets")] - Secret { - #[command(subcommand)] - cmd: SecretCommand, - }, - #[command(long_about = "Run a command with secrets injected")] - Run { - #[arg(help = "The command to run")] - command: Vec, - #[arg(long, help = "The shell to use")] - shell: Option, - #[arg( - long, - help = "Don't inherit environment variables from the current shell" - )] - no_inherit_env: bool, - #[arg(long, help = "The ID of the project to use")] - project_id: Option, - #[arg( - long, - global = true, - env = UUIDS_AS_KEYNAMES_VAR_NAME, - help = "Use the secret UUID (in its POSIX form) instead of the key name for the environment variable" - )] - uuids_as_keynames: bool, - }, -} - -#[derive(Subcommand, Debug)] -pub(crate) enum SecretCommand { - Create { - key: String, - value: String, - - #[arg(help = "The ID of the project this secret will be added to")] - project_id: Uuid, - - #[arg(long, help = "An optional note to add to the secret")] - note: Option, - }, - Delete { - secret_ids: Vec, - }, - #[clap(group = ArgGroup::new("edit_field").required(true).multiple(true))] - Edit { - secret_id: Uuid, - #[arg(long, group = "edit_field")] - key: Option, - #[arg(long, group = "edit_field")] - value: Option, - #[arg(long, group = "edit_field")] - note: Option, - #[arg(long, group = "edit_field")] - project_id: Option, - }, - Get { - secret_id: Uuid, - }, - List { - project_id: Option, - }, -} - -#[derive(Subcommand, Debug)] -pub(crate) enum ProjectCommand { - Create { - name: String, - }, - Delete { - project_ids: Vec, - }, - Edit { - project_id: Uuid, - #[arg(long, group = "edit_field")] - name: String, - }, - Get { - project_id: Uuid, - }, - List, -} diff --git a/crates/bws/src/command/mod.rs b/crates/bws/src/command/mod.rs deleted file mode 100644 index 98287e45..00000000 --- a/crates/bws/src/command/mod.rs +++ /dev/null @@ -1,67 +0,0 @@ -pub(crate) mod project; -pub(crate) mod run; -pub(crate) mod secret; - -use std::{path::PathBuf, str::FromStr}; - -use bitwarden::auth::AccessToken; -use clap::CommandFactory; -use clap_complete::Shell; -use color_eyre::eyre::{bail, Result}; - -use crate::{config, util, Cli, ProfileKey}; - -pub(crate) fn completions(shell: Option) -> Result<()> { - let Some(shell) = shell.or_else(Shell::from_env) else { - bail!("Couldn't autodetect a valid shell. Run `bws completions --help` for more info."); - }; - - let mut cmd = Cli::command(); - let name = cmd.get_name().to_string(); - clap_complete::generate(shell, &mut cmd, name, &mut std::io::stdout()); - - Ok(()) -} - -pub(crate) fn config( - name: Option, - value: Option, - delete: bool, - profile: Option, - access_token: Option, - config_file: Option, -) -> Result<()> { - let profile = if let Some(profile) = profile { - profile - } else if let Some(access_token) = access_token { - AccessToken::from_str(&access_token)? - .access_token_id - .to_string() - } else { - String::from("default") - }; - - if delete { - config::delete_profile(config_file.as_deref(), profile)?; - println!("Profile deleted successfully!"); - } else { - let (name, value) = match (name, value) { - (None, None) => bail!("Missing `name` and `value`"), - (None, Some(_)) => bail!("Missing `value`"), - (Some(_), None) => bail!("Missing `name`"), - (Some(ProfileKey::state_opt_out), Some(value)) => { - if util::string_to_bool(value.as_str()).is_err() { - bail!("Profile key \"state_opt_out\" must be \"true\" or \"false\""); - } else { - (ProfileKey::state_opt_out, value) - } - } - (Some(name), Some(value)) => (name, value), - }; - - config::update_profile(config_file.as_deref(), profile, name, value)?; - println!("Profile updated successfully!"); - }; - - Ok(()) -} diff --git a/crates/bws/src/command/project.rs b/crates/bws/src/command/project.rs deleted file mode 100644 index 3b521e2c..00000000 --- a/crates/bws/src/command/project.rs +++ /dev/null @@ -1,141 +0,0 @@ -use bitwarden::{ - secrets_manager::{ - projects::{ - ProjectCreateRequest, ProjectGetRequest, ProjectPutRequest, ProjectsDeleteRequest, - ProjectsListRequest, - }, - ClientProjectsExt, - }, - Client, -}; -use color_eyre::eyre::{bail, Result}; -use uuid::Uuid; - -use crate::{ - render::{serialize_response, OutputSettings}, - ProjectCommand, -}; - -pub(crate) async fn process_command( - command: ProjectCommand, - client: Client, - organization_id: Uuid, - output_settings: OutputSettings, -) -> Result<()> { - match command { - ProjectCommand::List => list(client, organization_id, output_settings).await, - ProjectCommand::Get { project_id } => get(client, project_id, output_settings).await, - ProjectCommand::Create { name } => { - create(client, organization_id, name, output_settings).await - } - ProjectCommand::Edit { project_id, name } => { - edit(client, organization_id, project_id, name, output_settings).await - } - ProjectCommand::Delete { project_ids } => delete(client, project_ids).await, - } -} - -pub(crate) async fn list( - client: Client, - organization_id: Uuid, - output_settings: OutputSettings, -) -> Result<()> { - let projects = client - .projects() - .list(&ProjectsListRequest { organization_id }) - .await? - .data; - serialize_response(projects, output_settings); - - Ok(()) -} - -pub(crate) async fn get( - client: Client, - project_id: Uuid, - output_settings: OutputSettings, -) -> Result<()> { - let project = client - .projects() - .get(&ProjectGetRequest { id: project_id }) - .await?; - serialize_response(project, output_settings); - - Ok(()) -} - -pub(crate) async fn create( - client: Client, - organization_id: Uuid, - name: String, - output_settings: OutputSettings, -) -> Result<()> { - let project = client - .projects() - .create(&ProjectCreateRequest { - organization_id, - name, - }) - .await?; - serialize_response(project, output_settings); - - Ok(()) -} - -pub(crate) async fn edit( - client: Client, - organization_id: Uuid, - project_id: Uuid, - name: String, - output_settings: OutputSettings, -) -> Result<()> { - let project = client - .projects() - .update(&ProjectPutRequest { - id: project_id, - organization_id, - name, - }) - .await?; - serialize_response(project, output_settings); - - Ok(()) -} - -pub(crate) async fn delete(client: Client, project_ids: Vec) -> Result<()> { - let count = project_ids.len(); - - let result = client - .projects() - .delete(ProjectsDeleteRequest { ids: project_ids }) - .await?; - - let projects_failed: Vec<(Uuid, String)> = result - .data - .into_iter() - .filter_map(|r| r.error.map(|e| (r.id, e))) - .collect(); - let deleted_projects = count - projects_failed.len(); - - match deleted_projects { - 2.. => println!("{} projects deleted successfully.", deleted_projects), - 1 => println!("{} project deleted successfully.", deleted_projects), - _ => (), - } - - match projects_failed.len() { - 2.. => eprintln!("{} projects had errors:", projects_failed.len()), - 1 => eprintln!("{} project had an error:", projects_failed.len()), - _ => (), - } - - for project in &projects_failed { - eprintln!("{}: {}", project.0, project.1); - } - - if !projects_failed.is_empty() { - bail!("Errors when attempting to delete projects."); - } - - Ok(()) -} diff --git a/crates/bws/src/command/run.rs b/crates/bws/src/command/run.rs deleted file mode 100644 index 6548778e..00000000 --- a/crates/bws/src/command/run.rs +++ /dev/null @@ -1,149 +0,0 @@ -use std::{ - collections::HashMap, - io::{IsTerminal, Read}, - process, -}; - -use bitwarden::{ - secrets_manager::{ - secrets::{SecretIdentifiersByProjectRequest, SecretIdentifiersRequest, SecretsGetRequest}, - ClientSecretsExt, - }, - Client, -}; -use color_eyre::eyre::{bail, Result}; -use itertools::Itertools; -use uuid::Uuid; -use which::which; - -use crate::{ - util::{is_valid_posix_name, uuid_to_posix}, - ACCESS_TOKEN_KEY_VAR_NAME, -}; - -// Essential environment variables that should be preserved even when `--no-inherit-env` is used -const WINDOWS_ESSENTIAL_VARS: &[&str] = &["SystemRoot", "ComSpec", "windir"]; - -pub(crate) async fn run( - client: Client, - organization_id: Uuid, - project_id: Option, - uuids_as_keynames: bool, - no_inherit_env: bool, - shell: Option, - command: Vec, -) -> Result { - let is_windows = std::env::consts::OS == "windows"; - - let shell = shell.unwrap_or_else(|| { - if is_windows { - "powershell".to_string() - } else { - "sh".to_string() - } - }); - - if which(&shell).is_err() { - bail!("Shell '{}' not found", shell); - } - - let user_command = if command.is_empty() { - if std::io::stdin().is_terminal() { - bail!("No command provided"); - } - - let mut buffer = String::new(); - std::io::stdin().read_to_string(&mut buffer)?; - buffer - } else { - command.join(" ") - }; - - let res = if let Some(project_id) = project_id { - client - .secrets() - .list_by_project(&SecretIdentifiersByProjectRequest { project_id }) - .await? - } else { - client - .secrets() - .list(&SecretIdentifiersRequest { organization_id }) - .await? - }; - - let secret_ids = res.data.into_iter().map(|e| e.id).collect(); - let secrets = client - .secrets() - .get_by_ids(SecretsGetRequest { ids: secret_ids }) - .await? - .data; - - if !uuids_as_keynames { - if let Some(duplicate) = secrets.iter().map(|s| &s.key).duplicates().next() { - bail!("Multiple secrets with name: '{}'. Use --uuids-as-keynames or use unique names for secrets", duplicate); - } - } - - let environment: HashMap = secrets - .into_iter() - .map(|s| { - if uuids_as_keynames { - (uuid_to_posix(&s.id), s.value) - } else { - (s.key, s.value) - } - }) - .inspect(|(k, _)| { - if !is_valid_posix_name(k) { - eprintln!( - "Warning: secret '{}' does not have a POSIX-compliant name", - k - ); - } - }) - .collect(); - - let mut command = process::Command::new(shell); - command - .arg("-c") - .arg(&user_command) - .stdout(process::Stdio::inherit()) - .stderr(process::Stdio::inherit()); - - if no_inherit_env { - let path = std::env::var("PATH").unwrap_or_else(|_| match is_windows { - true => "C:\\Windows;C:\\Windows\\System32".to_string(), - false => "/bin:/usr/bin".to_string(), - }); - - command.env_clear(); - - // Preserve essential PowerShell environment variables on Windows - if is_windows { - for &var in WINDOWS_ESSENTIAL_VARS { - if let Ok(value) = std::env::var(var) { - command.env(var, value); - } - } - } - - command.env("PATH", path); // PATH is always necessary - command.envs(environment); - } else { - command.env_remove(ACCESS_TOKEN_KEY_VAR_NAME); - command.envs(environment); - } - - // propagate the exit status from the child process - match command.spawn() { - Ok(mut child) => match child.wait() { - Ok(exit_status) => Ok(exit_status.code().unwrap_or(1)), - Err(e) => { - bail!("Failed to wait for process: {}", e) - } - }, - Err(e) => { - bail!("Failed to execute process: {}", e) - } - } -} diff --git a/crates/bws/src/command/secret.rs b/crates/bws/src/command/secret.rs deleted file mode 100644 index 0f1aa398..00000000 --- a/crates/bws/src/command/secret.rs +++ /dev/null @@ -1,221 +0,0 @@ -use bitwarden::{ - secrets_manager::{ - secrets::{ - SecretCreateRequest, SecretGetRequest, SecretIdentifiersByProjectRequest, - SecretIdentifiersRequest, SecretPutRequest, SecretsDeleteRequest, SecretsGetRequest, - }, - ClientSecretsExt, - }, - Client, -}; -use color_eyre::eyre::{bail, Result}; -use uuid::Uuid; - -use crate::{ - render::{serialize_response, OutputSettings}, - SecretCommand, -}; - -#[derive(Debug)] -pub(crate) struct SecretCreateCommandModel { - pub(crate) key: String, - pub(crate) value: String, - pub(crate) note: Option, - pub(crate) project_id: Uuid, -} - -#[derive(Debug)] -pub(crate) struct SecretEditCommandModel { - pub(crate) id: Uuid, - pub(crate) key: Option, - pub(crate) value: Option, - pub(crate) note: Option, - pub(crate) project_id: Option, -} - -pub(crate) async fn process_command( - command: SecretCommand, - client: Client, - organization_id: Uuid, - output_settings: OutputSettings, -) -> Result<()> { - match command { - SecretCommand::List { project_id } => { - list(client, organization_id, project_id, output_settings).await - } - SecretCommand::Get { secret_id } => get(client, secret_id, output_settings).await, - SecretCommand::Create { - key, - value, - note, - project_id, - } => { - create( - client, - organization_id, - SecretCreateCommandModel { - key, - value, - note, - project_id, - }, - output_settings, - ) - .await - } - SecretCommand::Edit { - secret_id, - key, - value, - note, - project_id, - } => { - edit( - client, - organization_id, - SecretEditCommandModel { - id: secret_id, - key, - value, - note, - project_id, - }, - output_settings, - ) - .await - } - SecretCommand::Delete { secret_ids } => delete(client, secret_ids).await, - } -} - -pub(crate) async fn list( - client: Client, - organization_id: Uuid, - project_id: Option, - output_settings: OutputSettings, -) -> Result<()> { - let res = if let Some(project_id) = project_id { - client - .secrets() - .list_by_project(&SecretIdentifiersByProjectRequest { project_id }) - .await? - } else { - client - .secrets() - .list(&SecretIdentifiersRequest { organization_id }) - .await? - }; - - let secret_ids = res.data.into_iter().map(|e| e.id).collect(); - let secrets = client - .secrets() - .get_by_ids(SecretsGetRequest { ids: secret_ids }) - .await? - .data; - serialize_response(secrets, output_settings); - - Ok(()) -} - -pub(crate) async fn get( - client: Client, - secret_id: Uuid, - output_settings: OutputSettings, -) -> Result<()> { - let secret = client - .secrets() - .get(&SecretGetRequest { id: secret_id }) - .await?; - serialize_response(secret, output_settings); - - Ok(()) -} - -pub(crate) async fn create( - client: Client, - organization_id: Uuid, - secret: SecretCreateCommandModel, - output_settings: OutputSettings, -) -> Result<()> { - let secret = client - .secrets() - .create(&SecretCreateRequest { - organization_id, - key: secret.key, - value: secret.value, - note: secret.note.unwrap_or_default(), - project_ids: Some(vec![secret.project_id]), - }) - .await?; - serialize_response(secret, output_settings); - - Ok(()) -} - -pub(crate) async fn edit( - client: Client, - organization_id: Uuid, - secret: SecretEditCommandModel, - output_settings: OutputSettings, -) -> Result<()> { - let old_secret = client - .secrets() - .get(&SecretGetRequest { id: secret.id }) - .await?; - - let new_secret = client - .secrets() - .update(&SecretPutRequest { - id: secret.id, - organization_id, - key: secret.key.unwrap_or(old_secret.key), - value: secret.value.unwrap_or(old_secret.value), - note: secret.note.unwrap_or(old_secret.note), - project_ids: secret - .project_id - .or(old_secret.project_id) - .map(|id| vec![id]), - }) - .await?; - serialize_response(new_secret, output_settings); - - Ok(()) -} - -pub(crate) async fn delete(client: Client, secret_ids: Vec) -> Result<()> { - let count = secret_ids.len(); - - let result = client - .secrets() - .delete(SecretsDeleteRequest { ids: secret_ids }) - .await?; - - let secrets_failed: Vec<(Uuid, String)> = result - .data - .into_iter() - .filter_map(|r| r.error.map(|e| (r.id, e))) - .collect(); - let deleted_secrets = count - secrets_failed.len(); - - match deleted_secrets { - 2.. => println!("{} secrets deleted successfully.", deleted_secrets), - 1 => println!("{} secret deleted successfully.", deleted_secrets), - _ => (), - } - - match secrets_failed.len() { - 2.. => eprintln!("{} secrets had errors:", secrets_failed.len()), - 1 => eprintln!("{} secret had an error:", secrets_failed.len()), - _ => (), - } - - for secret in &secrets_failed { - eprintln!("{}: {}", secret.0, secret.1); - } - - if !secrets_failed.is_empty() { - bail!("Errors when attempting to delete secrets."); - } - - Ok(()) -} diff --git a/crates/bws/src/config.rs b/crates/bws/src/config.rs deleted file mode 100644 index 9fd91849..00000000 --- a/crates/bws/src/config.rs +++ /dev/null @@ -1,217 +0,0 @@ -use std::{ - collections::HashMap, - fs::read_to_string, - path::{Path, PathBuf}, -}; - -use color_eyre::eyre::{bail, Result}; -use directories::BaseDirs; -use serde::{Deserialize, Serialize}; - -use crate::cli::{ProfileKey, DEFAULT_CONFIG_DIRECTORY, DEFAULT_CONFIG_FILENAME}; - -#[derive(Debug, Serialize, Deserialize, Default)] -pub(crate) struct Config { - pub profiles: HashMap, -} - -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Default)] -pub(crate) struct Profile { - pub server_base: Option, - pub server_api: Option, - pub server_identity: Option, - pub state_dir: Option, - pub state_opt_out: Option, -} - -impl ProfileKey { - fn update_profile_value(&self, p: &mut Profile, value: String) { - match self { - ProfileKey::server_base => p.server_base = Some(value), - ProfileKey::server_api => p.server_api = Some(value), - ProfileKey::server_identity => p.server_identity = Some(value), - ProfileKey::state_dir => p.state_dir = Some(value), - ProfileKey::state_opt_out => p.state_opt_out = Some(value), - } - } -} - -fn get_config_path(config_file: Option<&Path>, ensure_folder_exists: bool) -> Result { - let config_file = match config_file { - Some(path) => path.to_owned(), - None => { - let Some(base_dirs) = BaseDirs::new() else { - bail!("A valid home directory doesn't exist"); - }; - base_dirs - .home_dir() - .join(DEFAULT_CONFIG_DIRECTORY) - .join(DEFAULT_CONFIG_FILENAME) - } - }; - - if ensure_folder_exists { - if let Some(parent_folder) = config_file.parent() { - std::fs::create_dir_all(parent_folder)?; - } - } - - Ok(config_file) -} - -pub(crate) fn load_config(config_file: Option<&Path>, must_exist: bool) -> Result { - let file = get_config_path(config_file, false)?; - - let content = match file.exists() { - true => read_to_string(file), - false if must_exist => bail!("Config file doesn't exist"), - false => return Ok(Config::default()), - }; - - let config: Config = toml::from_str(&content?)?; - Ok(config) -} - -fn write_config(config: Config, config_file: Option<&Path>) -> Result<()> { - let file = get_config_path(config_file, true)?; - - let content = toml::to_string_pretty(&config)?; - - std::fs::write(file, content)?; - Ok(()) -} - -pub(crate) fn update_profile( - config_file: Option<&Path>, - profile: String, - name: ProfileKey, - value: String, -) -> Result<()> { - let mut config = load_config(config_file, false)?; - - let p = config.profiles.entry(profile).or_default(); - name.update_profile_value(p, value); - - write_config(config, config_file)?; - Ok(()) -} - -pub(crate) fn delete_profile(config_file: Option<&Path>, profile: String) -> Result<()> { - let mut config = load_config(config_file, true)?; - - if !config.profiles.contains_key(&profile) { - bail!("Profile does not exist"); - } - - config.profiles.remove(&profile); - - write_config(config, config_file)?; - Ok(()) -} - -impl Profile { - pub(crate) fn from_url(url: &str) -> Result { - if !url.starts_with("http://") && !url.starts_with("https://") { - bail!("Server URL must start with http:// or https://, the provided URL is: `{url}`"); - } - - Ok(Profile { - server_base: Some(url.to_string()), - server_api: None, - server_identity: None, - state_dir: None, - state_opt_out: None, - }) - } - pub(crate) fn api_url(&self) -> Result { - if let Some(api) = &self.server_api { - return Ok(api.clone()); - } - - if let Some(base) = &self.server_base { - return Ok(format!("{base}/api")); - } - - bail!("Profile has no `server_base` or `server_api`"); - } - - pub(crate) fn identity_url(&self) -> Result { - if let Some(identity) = &self.server_identity { - return Ok(identity.clone()); - } - - if let Some(base) = &self.server_base { - return Ok(format!("{base}/identity")); - } - - bail!("Profile has no `server_base` or `server_identity`"); - } -} - -impl Config { - pub(crate) fn select_profile( - &self, - profile: &str, - profile_defined: bool, - ) -> Result> { - if let Some(profile) = self.profiles.get(profile) { - return Ok(Some(profile.clone())); - } - - if profile_defined { - bail!("The specified profile does not exist"); - } - - if let Some(profile) = self.profiles.get("default") { - return Ok(Some(profile.clone())); - } - - Ok(None) - } -} - -#[cfg(test)] -mod tests { - use std::io::Write; - - use tempfile::NamedTempFile; - - use super::*; - - #[test] - fn config_doesnt_exist() { - let c = load_config(Some(Path::new("non_existing")), true); - assert!(c.is_err()); - - let c = load_config(None, false); - assert!(c.is_ok()); - } - - #[test] - fn config_exist() { - let tmpfile = NamedTempFile::new().unwrap(); - write!(tmpfile.as_file(), "[profiles]").unwrap(); - - let c = load_config(Some(Path::new(tmpfile.as_ref())), true); - let config = c.unwrap(); - assert_eq!(0, config.profiles.len()); - } - - #[test] - fn config_exist_with_profile() { - let tmpfile = NamedTempFile::new().unwrap(); - write!( - tmpfile.as_file(), - "[profiles.default] - server_base = \"https://bitwarden.com\" - " - ) - .unwrap(); - - let c = load_config(Some(Path::new(tmpfile.as_ref())), true); - assert_eq!( - "https://bitwarden.com", - c.unwrap().profiles["default"].server_base.as_ref().unwrap() - ); - } -} diff --git a/crates/bws/src/main.rs b/crates/bws/src/main.rs deleted file mode 100644 index e77c8fd2..00000000 --- a/crates/bws/src/main.rs +++ /dev/null @@ -1,195 +0,0 @@ -use std::{path::PathBuf, str::FromStr}; - -use bitwarden::{ - auth::{login::AccessTokenLoginRequest, AccessToken}, - ClientSettings, -}; -use bitwarden_cli::install_color_eyre; -use clap::{CommandFactory, Parser}; -use color_eyre::eyre::{bail, Result}; -use config::Profile; -use log::error; -use render::OutputSettings; - -mod cli; -mod command; -mod config; -mod render; -mod state; -mod util; - -use crate::cli::*; - -#[tokio::main(flavor = "current_thread")] -async fn main() -> Result<()> { - env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("info")).init(); - - process_commands().await -} - -#[allow(clippy::comparison_chain)] -async fn process_commands() -> Result<()> { - let cli = Cli::parse(); - let color = cli.color; - - install_color_eyre(color)?; - - let Some(command) = cli.command else { - let mut cmd = Cli::command(); - eprintln!("{}", cmd.render_help().ansi()); - std::process::exit(1); - }; - - // These commands don't require authentication, so we process them first - match command { - Commands::Completions { shell } => { - return command::completions(shell); - } - Commands::Config { - name, - value, - delete, - } => { - return command::config( - name, - value, - delete, - cli.profile, - cli.access_token, - cli.config_file, - ); - } - _ => (), - } - - let access_token = match cli.access_token { - Some(key) => key, - None => bail!("Missing access token"), - }; - let access_token_obj: AccessToken = access_token.parse()?; - - let profile = get_config_profile( - &cli.server_url, - &cli.profile, - &cli.config_file, - &access_token, - )?; - - let settings = profile - .clone() - .map(|p| -> Result<_> { - Ok(ClientSettings { - identity_url: p.identity_url()?, - api_url: p.api_url()?, - ..Default::default() - }) - }) - .transpose()?; - - let state_file = match get_state_opt_out(&profile) { - true => None, - false => match state::get_state_file( - profile.and_then(|p| p.state_dir).map(Into::into), - access_token_obj.access_token_id.to_string(), - ) { - Ok(state_file) => Some(state_file), - Err(e) => { - eprintln!("Warning: {}\nRetrieving the state file failed. Attempting to continue without using state. Please set \"state_dir\" in your config file to avoid authentication limits.", e); - None - } - }, - }; - - let client = bitwarden::Client::new(settings); - - // Load session or return if no session exists - let _ = client - .auth() - .login_access_token(&AccessTokenLoginRequest { - access_token, - state_file, - }) - .await?; - - let organization_id = match client.internal.get_access_token_organization() { - Some(id) => id, - None => { - error!("Access token isn't associated to an organization."); - return Ok(()); - } - }; - - let output_settings = OutputSettings::new(cli.output, color); - - // And finally we process all the commands which require authentication - match command { - Commands::Project { cmd } => { - command::project::process_command(cmd, client, organization_id, output_settings).await - } - - Commands::Secret { cmd } => { - command::secret::process_command(cmd, client, organization_id, output_settings).await - } - - Commands::Run { - command, - shell, - no_inherit_env, - project_id, - uuids_as_keynames, - } => { - let exit_code = command::run::run( - client, - organization_id, - project_id, - uuids_as_keynames, - no_inherit_env, - shell, - command, - ) - .await?; - - // exit with the exit code from the child process - std::process::exit(exit_code); - } - - Commands::Config { .. } | Commands::Completions { .. } => { - unreachable!() - } - } -} - -fn get_config_profile( - server_url: &Option, - profile: &Option, - config_file: &Option, - access_token: &str, -) -> Result, color_eyre::Report> { - let profile = if let Some(server_url) = server_url { - Some(config::Profile::from_url(server_url)?) - } else { - let profile_defined = profile.is_some(); - - let profile_key = if let Some(profile) = profile { - profile.to_owned() - } else { - AccessToken::from_str(access_token)? - .access_token_id - .to_string() - }; - - let config = config::load_config(config_file.as_deref(), config_file.is_some())?; - config.select_profile(&profile_key, profile_defined)? - }; - Ok(profile) -} - -fn get_state_opt_out(profile: &Option) -> bool { - if let Some(profile) = profile { - if let Some(state_opt_out) = &profile.state_opt_out { - return util::string_to_bool(state_opt_out).unwrap_or(false); - } - } - - false -} diff --git a/crates/bws/src/render.rs b/crates/bws/src/render.rs deleted file mode 100644 index bf0c26f6..00000000 --- a/crates/bws/src/render.rs +++ /dev/null @@ -1,154 +0,0 @@ -use bitwarden::secrets_manager::{projects::ProjectResponse, secrets::SecretResponse}; -use bitwarden_cli::Color; -use chrono::{DateTime, Utc}; -use comfy_table::Table; -use serde::Serialize; - -use crate::{cli::Output, util::is_valid_posix_name}; - -const ASCII_HEADER_ONLY: &str = " -- "; - -pub(crate) struct OutputSettings { - pub(crate) output: Output, - pub(crate) color: Color, -} - -impl OutputSettings { - pub(crate) fn new(output: Output, color: Color) -> Self { - OutputSettings { output, color } - } -} - -pub(crate) fn serialize_response, const N: usize>( - data: T, - output_settings: OutputSettings, -) { - match output_settings.output { - Output::JSON => { - let mut text = - serde_json::to_string_pretty(&data).expect("Serialize should be infallible"); - // Yaml/table/tsv serializations add a newline at the end, so we do the same here for - // consistency - text.push('\n'); - pretty_print("json", &text, output_settings.color); - } - Output::YAML => { - let text = serde_yaml::to_string(&data).expect("Serialize should be infallible"); - pretty_print("yaml", &text, output_settings.color); - } - Output::Env => { - let mut commented_out = false; - let mut text: Vec = data - .get_values() - .into_iter() - .map(|row| { - if is_valid_posix_name(&row[1]) { - format!("{}=\"{}\"", row[1], row[2]) - } else { - commented_out = true; - format!("# {}=\"{}\"", row[1], row[2].replace('\n', "\n# ")) - } - }) - .collect(); - - if commented_out { - text.push(String::from( - "\n# one or more secrets have been commented-out due to a problematic key name", - )); - } - - pretty_print( - "sh", - &format!("{}\n", text.join("\n")), - output_settings.color, - ); - } - Output::Table => { - let mut table = Table::new(); - table - .load_preset(ASCII_HEADER_ONLY) - .set_header(T::get_headers()) - .add_rows(data.get_values()); - - println!("{table}"); - } - Output::TSV => { - println!("{}", T::get_headers().join("\t")); - - let rows: Vec = data - .get_values() - .into_iter() - .map(|row| row.join("\t")) - .collect(); - println!("{}", rows.join("\n")); - } - Output::None => {} - } -} - -fn pretty_print(language: &str, data: &str, color: Color) { - if color.is_enabled() { - bat::PrettyPrinter::new() - .input_from_bytes(data.as_bytes()) - .language(language) - .print() - .expect("Input is valid"); - } else { - print!("{}", data); - } -} - -// We're using const generics for the array lengths to make sure the header count and value count -// match -pub(crate) trait TableSerialize: Sized { - fn get_headers() -> [&'static str; N]; - fn get_values(&self) -> Vec<[String; N]>; -} - -// Generic impl for Vec so we can call `serialize_response` with both individual -// elements and lists of elements, like we do with the JSON and YAML cases -impl, const N: usize> TableSerialize for Vec { - fn get_headers() -> [&'static str; N] { - T::get_headers() - } - fn get_values(&self) -> Vec<[String; N]> { - let mut values = Vec::new(); - for t in self { - values.append(&mut t.get_values()); - } - values - } -} - -fn format_date(date: &DateTime) -> String { - date.format("%Y-%m-%d %H:%M:%S").to_string() -} - -impl TableSerialize<3> for ProjectResponse { - fn get_headers() -> [&'static str; 3] { - ["ID", "Name", "Creation Date"] - } - - fn get_values(&self) -> Vec<[String; 3]> { - vec![[ - self.id.to_string(), - self.name.clone(), - format_date(&self.creation_date), - ]] - } -} - -impl TableSerialize<4> for SecretResponse { - fn get_headers() -> [&'static str; 4] { - ["ID", "Key", "Value", "Creation Date"] - } - - fn get_values(&self) -> Vec<[String; 4]> { - vec![[ - self.id.to_string(), - self.key.clone(), - self.value.clone(), - format_date(&self.creation_date), - ]] - } -} diff --git a/crates/bws/src/state.rs b/crates/bws/src/state.rs deleted file mode 100644 index b5756a05..00000000 --- a/crates/bws/src/state.rs +++ /dev/null @@ -1,32 +0,0 @@ -use std::path::PathBuf; - -use color_eyre::eyre::{bail, Result}; -use directories::BaseDirs; - -use crate::DEFAULT_CONFIG_DIRECTORY; - -pub(crate) const DEFAULT_STATE_DIRECTORY: &str = "state"; - -pub(crate) fn get_state_file( - state_dir: Option, - access_token_id: String, -) -> Result { - let mut state_dir = match state_dir { - Some(state_dir) => state_dir, - None => { - if let Some(base_dirs) = BaseDirs::new() { - base_dirs - .home_dir() - .join(DEFAULT_CONFIG_DIRECTORY) - .join(DEFAULT_STATE_DIRECTORY) - } else { - bail!("A valid home directory doesn't exist"); - } - } - }; - - std::fs::create_dir_all(&state_dir)?; - state_dir.push(access_token_id); - - Ok(state_dir) -} diff --git a/crates/bws/src/util.rs b/crates/bws/src/util.rs deleted file mode 100644 index a86f0f56..00000000 --- a/crates/bws/src/util.rs +++ /dev/null @@ -1,93 +0,0 @@ -use regex::Regex; -use uuid::Uuid; - -const VALID_POSIX_NAME_REGEX: &str = "^[a-zA-Z_][a-zA-Z0-9_]*$"; -const STRING_TO_BOOL_ERROR_MESSAGE: &str = "Could not convert string to bool"; - -pub(crate) fn is_valid_posix_name(input_text: &str) -> bool { - Regex::new(VALID_POSIX_NAME_REGEX) - .expect("VALID_POSIX_NAME_REGEX to be a valid regex") - .is_match(input_text) -} - -pub(crate) fn string_to_bool(value: &str) -> Result { - match value.trim().to_lowercase().as_str() { - "true" | "1" => Ok(true), - "false" | "0" => Ok(false), - _ => Err(STRING_TO_BOOL_ERROR_MESSAGE), - } -} - -/// Converts a UUID to a POSIX-compliant environment variable name. -/// -/// POSIX environment variable names must start with a letter or an underscore -/// and can only contain letters, numbers, and underscores. -pub(crate) fn uuid_to_posix(uuid: &Uuid) -> String { - format!("_{}", uuid.to_string().replace('-', "_")) -} - -mod tests { - #[allow(unused_imports)] - use super::*; - - #[test] - fn test_is_valid_posix_name_true() { - assert!(is_valid_posix_name("a_valid_name")); - assert!(is_valid_posix_name("another_valid_name")); - assert!(is_valid_posix_name("_another_valid_name")); - assert!(is_valid_posix_name("ANOTHER_ONE")); - assert!(is_valid_posix_name( - "abcdefghijklmnopqrstuvwxyz__ABCDEFGHIJKLMNOPQRSTUVWXYZ__0123456789" - )); - } - - #[test] - fn test_is_valid_posix_name_false() { - assert!(!is_valid_posix_name("")); - assert!(!is_valid_posix_name("1a")); - assert!(!is_valid_posix_name("a bad name")); - assert!(!is_valid_posix_name("another-bad-name")); - assert!(!is_valid_posix_name("a\nbad\nname")); - } - - #[test] - fn test_uuid_to_posix_success() { - assert_eq!( - "_759130d0_29dd_48bd_831a_e3bdbafeeb6e", - uuid_to_posix( - &uuid::Uuid::parse_str("759130d0-29dd-48bd-831a-e3bdbafeeb6e").expect("valid uuid") - ) - ); - assert!(is_valid_posix_name(&uuid_to_posix(&uuid::Uuid::new_v4()))); - } - - #[test] - fn test_string_to_bool_true_true() { - let result = string_to_bool("true"); - assert_eq!(result, Ok(true)); - } - - #[test] - fn test_string_to_bool_one_true() { - let result = string_to_bool("1"); - assert_eq!(result, Ok(true)); - } - - #[test] - fn test_string_to_bool_false_false() { - let result = string_to_bool("false"); - assert_eq!(result, Ok(false)); - } - - #[test] - fn test_string_to_bool_zero_false() { - let result = string_to_bool("0"); - assert_eq!(result, Ok(false)); - } - - #[test] - fn test_string_to_bool_bad_string_errors() { - let result = string_to_bool("hello world"); - assert_eq!(result, Err(STRING_TO_BOOL_ERROR_MESSAGE)); - } -} diff --git a/crates/sdk-schemas/Cargo.toml b/crates/sdk-schemas/Cargo.toml deleted file mode 100644 index 13a66487..00000000 --- a/crates/sdk-schemas/Cargo.toml +++ /dev/null @@ -1,23 +0,0 @@ -[package] -name = "sdk-schemas" -version = "0.1.0" -publish = false - -authors.workspace = true -edition.workspace = true -rust-version.workspace = true -homepage.workspace = true -repository.workspace = true -license-file.workspace = true -keywords.workspace = true - -[features] - -[dependencies] -anyhow = "1.0.82" -bitwarden = { workspace = true } -bitwarden-json = { path = "../bitwarden-json" } -bitwarden-uniffi = { path = "../bitwarden-uniffi", optional = true } -itertools = "0.13.0" -schemars = { workspace = true, features = ["preserve_order"] } -serde_json = "1.0.113" diff --git a/crates/sdk-schemas/src/main.rs b/crates/sdk-schemas/src/main.rs deleted file mode 100644 index 2db3ce5f..00000000 --- a/crates/sdk-schemas/src/main.rs +++ /dev/null @@ -1,118 +0,0 @@ -use std::{fs::File, io::Write}; - -use anyhow::Result; -use schemars::{schema::RootSchema, schema_for, JsonSchema}; - -/// Creates a json schema file for any type passed in using Schemars. The filename and path of the -/// generated schema file is derived from the namespace passed into the macro or supplied as the -/// first argument. -/// -/// The schema filename is given by the last namespace element and trims off any `>` characters. -/// This means the filename will represent the last _generic_ type of the type given. -/// -/// The schema path is rooted at the current working directory. -/// -/// # Usage -/// -/// ## Fully generated -/// -/// Subpath is equal to the namespace except the last two elements, which are assumed to be -/// a filename and struct name. -/// -/// Min namespace length is currently 3. -/// -/// ### Examples -/// -/// ``` -/// write_schema_for!(request::command::Command); -/// ``` -/// will generate `Command.json` at `{{pwd}}/request/Command.json` -/// -/// ``` -/// write_schema_for!(response::two_factor_login_response::two_factor_providers::TwoFactorProviders); -/// ``` -/// will generate `TwoFactorProviders.json` at -/// `{{pwd}}/response/two_factor_login_response/TwoFactorProviders.json` -/// -/// ## Path specified -/// -/// You can also specify a custom path and type, separated by a comman -/// -/// ### Examples -/// -/// ``` -/// write_schema_for!("path/to/folder", Request); -/// ``` -/// will generate `Response.json` at `{{pwd}}/path/to/folder/Response.json` -macro_rules! write_schema_for { - ($type:ty) => { - use itertools::Itertools; - - let schema = schema_for!($type); - - let type_name = stringify!($type); - let path: Vec<&str> = type_name.split("::").collect(); - let dir_path = - String::from("support/schemas/") + &path.iter().take(path.len() - 2).join("/"); - - write_schema(schema, dir_path, type_name.to_string())?; - }; - ($path:literal, $type:ty) => { - let schema = schema_for!($type); - - write_schema( - schema, - String::from("support/schemas/") + $path, - stringify!($type).to_string(), - )?; - }; -} - -fn write_schema(schema: RootSchema, dir_path: String, type_name: String) -> Result<()> { - let file_name = type_name - .split("::") - .last() - .unwrap() - .to_string() - .trim_end_matches('>') - .to_string() - + ".json"; - - let content = serde_json::to_string_pretty(&schema)?; - let _ = std::fs::create_dir_all(&dir_path); - let mut file = File::create(format!("{}/{}", dir_path, file_name))?; - writeln!(&mut file, "{}", &content)?; - Ok(()) -} - -use bitwarden_json::response::Response; - -#[allow(dead_code)] -#[derive(JsonSchema)] -struct SchemaTypes { - // Input types for new Client - client_settings: bitwarden::ClientSettings, - - // Input types for Client::run_command - input_command: bitwarden_json::command::Command, - - // Output types for Client::run_command - api_key_login: Response, - password_login: Response, - login_access_token: Response, - secret_identifiers: Response, - secret: Response, - secrets: Response, - secrets_delete: Response, - secrets_sync: Response, - project: Response, - projects: Response, - projects_delete: Response, - password: Response, -} - -fn main() -> Result<()> { - write_schema_for!("schema_types", SchemaTypes); - - Ok(()) -} diff --git a/languages/cpp/CMakeBuild.md b/languages/cpp/CMakeBuild.md deleted file mode 100644 index b75da5c1..00000000 --- a/languages/cpp/CMakeBuild.md +++ /dev/null @@ -1,61 +0,0 @@ -# CMake Build - -## Introduction - -Cmake is used to build the C++ Bitwarden client library. Output should be placed in the build directory. -The output contains two dynamic libraries: - -- The C++ client `BitwardenClient` -- The Bitwarden library used by the C++ client `bitwarden_c`. - -See how to use these libraries in the [example use guide](./examples/ExampleUse.md) - -## Prerequisites - -- Cmake installed, minimum version 3.15 -- `schemas.hpp` generated into `include` directory -- installed `nlohmann-json` library -- installed `boost` library - -## Build Commands - -One should be in the root directory of the C++ wrapper (the same level where is CMakeLists.txt placed). Paths of the -three libraries should be placed inside the cmake build command: - -```bash -mkdir -p build -cd build -cmake .. -DNLOHMANN=/path/to/include/nlohmann -DBOOST=/path/to/include/boost -DTARGET=relative/path/to/libbitwarden_c -cmake --build . -``` - -## IDE Support - -You may need to manually set the CMake `TARGET` variable for your IDE. For CLion, add the following to the CMake options -settings: - -```bash -# macOS example --DTARGET=../../target/release/libbitwarden_c.dylib -``` - -## Example - -### macOS - -#### Install Prerequisites - -```bash -brew install cmake -brew install boost -brew install nlohmann-json -``` - -#### Build - -```bash -mkdir -p build -cd build -cmake .. -DNLOHMANN=/opt/homebrew/include -DBOOST=/opt/homebrew/include -DTARGET=../../target/release/libbitwarden_c.dylib -cmake --build . -``` diff --git a/languages/cpp/CMakeLists.txt b/languages/cpp/CMakeLists.txt deleted file mode 100644 index e6ad7f4f..00000000 --- a/languages/cpp/CMakeLists.txt +++ /dev/null @@ -1,37 +0,0 @@ -cmake_minimum_required(VERSION 3.15) -project(BitwardenClient) - -set(CMAKE_CXX_STANDARD 20) -set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) - -# Set placeholders to be passed from command line -set(NLOHMANN_JSON_INCLUDE_DIR_PLACEHOLDER ${NLOHMANN}) -set(BOOST_INCLUDE_DIR_PLACEHOLDER ${BOOST}) -set(TARGET_INCLUDE_DIR_PLACEHOLDER ${TARGET}) - -# Specify the locations of nlohmann.json and Boost libraries -find_path(NLOHMANN_JSON_INCLUDE_DIR nlohmann/json.hpp HINTS ${NLOHMANN_JSON_INCLUDE_DIR_PLACEHOLDER}) -find_path(BOOST_INCLUDE_DIR boost/optional.hpp HINTS ${BOOST_INCLUDE_DIR_PLACEHOLDER}) - -# Include directories for library -include_directories(include ${NLOHMANN_JSON_INCLUDE_DIR} ${BOOST_INCLUDE_DIR}) - -# Add library source files -file(GLOB SOURCES "src/*.cpp") - -# Add library source files along with the schemas.cpp file -add_library(BitwardenClient SHARED ${SOURCES} ${SCHEMAS_SOURCE}) - -# Set path for native library loading -set(LIB_BITWARDEN_C "${CMAKE_SOURCE_DIR}/${TARGET}") - -# Copy the library to the build directory before building -add_custom_command( - TARGET BitwardenClient PRE_BUILD - COMMAND ${CMAKE_COMMAND} -E copy - ${LIB_BITWARDEN_C} - $ -) - -# Link libraries -target_link_libraries(BitwardenClient PRIVATE ${LIB_BITWARDEN_C}) diff --git a/languages/cpp/README.md b/languages/cpp/README.md deleted file mode 100644 index fb714a20..00000000 --- a/languages/cpp/README.md +++ /dev/null @@ -1,112 +0,0 @@ -# Bitwarden Secrets Manager SDK - -C++ bindings for interacting with the [Bitwarden Secrets Manager]. This is a beta release and might be missing some functionality. - -## Create access token - -Review the help documentation on [Access Tokens] - -## Usage code snippets - -### Client settings - -```c++ -// Optional - if not stressed, then default values are used -BitwardenSettings bitwardenSettings; -bitwardenSettings.set_api_url(""); -bitwardenSettings.set_identity_url(""); -``` - - -### Create new Bitwarden client - -```c++ -std::string accessToken = ""; -std::string stateFile = ""; -// Optional - argument in BitwardenClient -BitwardenClient bitwardenClient = BitwardenClient(bitwardenSettings); -bitwardenClient.loginAccessToken(accessToken, stateFile); -``` - -### Create new project - -```c++ -boost::uuids::uuid organizationUuid = boost::uuids::string_generator()(""); -ProjectResponse projectResponseCreate = bitwardenClient.createProject(organizationUuid, "TestProject"); -boost::uuids::uuid projectId = boost::uuids::string_generator()(projectResponseCreate.get_id()); -``` - -### List all projects - -```c++ -ProjectsResponse projectResponseList = bitwardenClient.listProjects(organizationUuid); -``` - -### Get project details - -```c++ -ProjectResponse projectResponseGet = bitwardenClient.getProject(projectId); -``` - -### Update project - -```c++ -ProjectResponse projectResponseUpdate = bitwardenClient.updateProject(organizationUuid, projectId, "TestProjectUpdated"); -``` - -### Delete projects - -```c++ -ProjectsDeleteResponse projectsDeleteResponse = bitwardenClient.deleteProjects({projectId}); -``` - -### Add new secret - -```c++ -std::string key = "key"; -std::string value = "value"; -std::string note = "note"; -SecretResponse secretResponseCreate = bitwardenClient.createSecret(organizationUuid, key, value, note, {projectId}); -boost::uuids::uuid secretId = boost::uuids::string_generator()(secretResponseCreate.get_id()); -``` - -### List secrets - -```c++ -SecretIdentifiersResponse secretIdentifiersResponse = bitwardenClient.listSecrets(organizationUuid); -``` - -### Get secret details - -```c++ -SecretResponse secretResponseGet = bitwardenClient.getSecret(secretId); -``` - -### Get multiple secrets by ids - -```c++ -std::vector secretIds = {secretId, secretId2}; -SecretsResponse secretsResponseGet = bitwardenClient.getSecrets(secretIds); -``` - -### Update secret - -```c++ -SecretResponse secretResponseUpdate = bitwardenClient.updateSecret(organizationUuid, secretId, "key2", "value2", "note2", {projectId}); -``` - -### Sync secrets - -```c++ -std::chrono::system_clock::time_point lastSyncedDate = std::chrono::system_clock::now(); -SecretsSyncResponse secretsSyncResponse = bitwardenClient.sync(orgnizationUuid, lastSyncedDate); -``` - -# Delete secrets - -```c++ -SecretsDeleteResponse secretsDeleteResponse = bitwardenClient.deleteSecrets({secretId}); -``` - -[Access Tokens]: https://bitwarden.com/help/access-tokens/ -[Bitwarden Secrets Manager]: https://bitwarden.com/products/secrets-manager/ diff --git a/languages/cpp/examples/ExampleUse.md b/languages/cpp/examples/ExampleUse.md deleted file mode 100644 index f5ec6f6f..00000000 --- a/languages/cpp/examples/ExampleUse.md +++ /dev/null @@ -1,108 +0,0 @@ -# Examples - -## Prerequisites - -### Bitwarden Libraries - -Have the two Bitwarden libraries at the same path: - -- `BitwardenClient` -- `bitwarden_c` - -For each OS the library files will be the following: - -- macOS: `libBitwardenClient.dylib` and `libbitwarden_c.dylib` -- Linux: `libBitwardenClient.so` and `libbitwarden_c.so` -- Windows: `BitwardenClient.dll` and `bitwarden_c.dll` - -Follow the [cmake build guide](../CMakeBuild.md) to create the libraries locally. - -### Include Directory - -`include` directory contains: - -- `BitwardenLibrary.h` -- `BitwardenClient.h` -- `BitwardenSettings.h` -- `CommandRunner.h` -- `Projects.h` -- `Secrets.h` -- `schemas.hpp` - -### Other Libraries - -- `nlohmann-json` () -- `boost` () - -### Compiling - -Use g++/clang++ for compiling. - -Example of the folder structure (macOS): - -```text ---root - --build - `libBitwardenClient.dylib` - `libbitwarden_c.dylib` - --include - --`BitwardenLibrary.h` - --`BitwardenClient.h` - --`BitwardenSettings.h` - --`CommandRunner.h` - --`Projects.h` - --`Secrets.h` - --`schemas.hpp` - --examples - --`Wrapper.cpp` -``` - -Set the environment variable path for the Bitwarden libraries. - -For macOS: - -```bash -export DYLD_LIBRARY_PATH=/path/to/your/library:$DYLD_LIBRARY_PATH -``` - -For Linux: - -```bash -export LD_LIBRARY_PATH=/path/to/your/library:$LD_LIBRARY_PATH -``` - -For Windows: - -```shell - set "PATH=%PATH%;C:\path\to\your\library" -``` - -Set environment variables used in `Wrapper.cpp`: - -```bash -export ACCESS_TOKEN=<"access-token"> -export ORGANIZATION_ID=<"organization-id"> -export API_URL=http://localhost:4000 -export IDENTITY_URL=http://localhost:33656 -``` - -Compile: - -```bash -cd examples -clang++ -std=c++20 -I../include -I/path/to/include/nlohmann -I/path/to/include/boost -L../build/ -o MyBitwardenApp Wrapper.cpp -lBitwardenClient -ldl -``` - -for Windows `-ldl` should be excluded, - -for macOS nlohmann and boost libraries installed with homebrew the following can be used: - -```bash --I/opt/homebrew/include -``` - -The result is `MyBitwardenApp` in the `examples` directory, and can be ran from the `examples` directory: - -```bash -./MyBitwardenApp -``` diff --git a/languages/cpp/examples/Wrapper.cpp b/languages/cpp/examples/Wrapper.cpp deleted file mode 100644 index 7790adfb..00000000 --- a/languages/cpp/examples/Wrapper.cpp +++ /dev/null @@ -1,131 +0,0 @@ -#include "BitwardenClient.h" -#include -#include -#include - -int main() { - // Retrieve access token and organization ID from environment variables - const char *accessTokenEnv = std::getenv("ACCESS_TOKEN"); - const char *organizationIdEnv = std::getenv("ORGANIZATION_ID"); - - // Use optional state file for authentication - const char *stateFile = std::getenv("STATE_FILE"); - - const char *apiUrl = std::getenv("API_URL"); - const char *identityUrl = std::getenv("IDENTITY_URL"); - - if (!accessTokenEnv || !organizationIdEnv) { - std::cerr << "Error: Environment variables ACCESS_TOKEN or ORGANIZATION_ID not set." << std::endl; - return 1; - } - - std::string accessToken = accessTokenEnv; - std::string organizationId = organizationIdEnv; - - // Configuring the URLS is optional; if unset, use bitwarden.com - BitwardenSettings bitwardenSettings; - if (apiUrl != nullptr && identityUrl != nullptr) { - bitwardenSettings.set_api_url(apiUrl); - bitwardenSettings.set_identity_url(identityUrl); - } else { - std::cerr << "Info: API_URL and IDENTITY_URL are not set, using default values..." << std::endl; - } - - // Create a Bitwarden client instance - BitwardenClient bitwardenClient(bitwardenSettings); - - // Access token login - if (stateFile != nullptr) { - bitwardenClient.loginAccessToken(accessToken, stateFile); - } else { - bitwardenClient.loginAccessToken(accessToken); - } - - // Convert organization ID to UUID - boost::uuids::uuid organizationUuid = boost::uuids::string_generator()(organizationId); - - // Create a new project - std::cout << "Projects:\n"; - ProjectResponse projectResponseCreate = bitwardenClient.createProject(organizationUuid, "NewTestProject"); - boost::uuids::uuid projectId = boost::uuids::string_generator()(projectResponseCreate.get_id()); - - std::cout << "\tcreateProject: '" << projectResponseCreate.get_name() << "'\n\n"; - - // List projects - ProjectsResponse projectResponseList = bitwardenClient.listProjects(organizationUuid); - std::cout << "\tlistProjects:\n"; - for (const ProjectResponse& project : projectResponseList.get_data()) { - std::cout << "\t\tID: '" << project.get_id() << "', Name: '" << project.get_name() << "'\n"; - } - std::cout << '\n'; - - // Get project details - ProjectResponse projectResponseGet = bitwardenClient.getProject(projectId); - std::cout << "\tgetProject:\n\t\tID: '" << projectResponseGet.get_id() << "', Name: '" << projectResponseGet.get_name() << "'\n\n"; - - // Update project - ProjectResponse projectResponseUpdate = bitwardenClient.updateProject(organizationUuid, projectId, "NewTestProject2"); - std::cout << "\tupdateProject: '" << projectResponseUpdate.get_name() << "'\n\n"; - - // Secrets - std::string key = "key"; - std::string value = "value"; - std::string note = "note"; - - // Sync secrets - std::cout << "Secrets:\n"; - std::cout << "\tSyncing secrets...\n"; - SecretsSyncResponse secretsSyncResponse = bitwardenClient.sync(organizationUuid, {}); - std::chrono::system_clock::time_point lastSyncedDate = std::chrono::system_clock::now(); - std::cout << "\t\tSync has changes: '" << (secretsSyncResponse.get_has_changes() ? "true" : "false") << "'\n\n"; - - std::cout << "\tSyncing again to ensure no changes since last sync...\n"; - secretsSyncResponse = bitwardenClient.sync(organizationUuid, lastSyncedDate); - std::cout << "\t\tSync has changes: '" << (secretsSyncResponse.get_has_changes() ? "true" : "false") << "'\n\n"; - - // Create a new secret - SecretResponse secretResponseCreate = bitwardenClient.createSecret(organizationUuid, key, value, note, {projectId}); - boost::uuids::uuid secretId = boost::uuids::string_generator()(secretResponseCreate.get_id()); - - std::cout << "\tcreateSecret: '" << secretResponseCreate.get_key() << "'\n\n"; - - // List secrets - SecretIdentifiersResponse secretIdentifiersResponse = bitwardenClient.listSecrets(organizationUuid); - std::cout << "\tlistSecrets:\n"; - for (const SecretIdentifierResponse& secretIdentifier : secretIdentifiersResponse.get_data()) { - std::cout << "\t\tID: '" << secretIdentifier.get_id() << "'\n"; - } - std::cout << '\n'; - - // Get secret details - SecretResponse secretResponseGet = bitwardenClient.getSecret(secretId); - std::cout << "\tgetSecret: '" << secretResponseGet.get_key() << "'\n\n"; - - // Get secrets by IDs - std::cout << "\tgetSecretsByIds:\n"; - SecretsResponse secretsResponseGetByIds = bitwardenClient.getSecretsByIds({secretId}); - for (const SecretResponse& secret : secretsResponseGetByIds.get_data()) { - std::cout << "\t\tID: '" << secret.get_id() << "', Key: '" << secret.get_key() << "'\n"; - } - std::cout << '\n'; - - // Update secret - key = "updated-key"; - value = "updated-value"; - note = "updated-note"; - SecretResponse responseForSecretResponseUpdate = bitwardenClient.updateSecret( - organizationUuid, secretId, key, value, note, {projectId}); - - std::cout << "\tupdateSecret: '" << responseForSecretResponseUpdate.get_key() << "'\n\n"; - - // Delete secrets - std::cout << "Deleting projects and secrets...\n"; - SecretsDeleteResponse secretsDeleteResponse = bitwardenClient.deleteSecrets({secretId}); - std::cout << "\tdeleteSecrets: '" << secretsDeleteResponse.get_data()[0].get_id() << "'\n\n"; - - // Delete projects - ProjectsDeleteResponse projectsDeleteResponse = bitwardenClient.deleteProjects({projectId}); - std::cout << "\tdeleteProjects: '" << projectsDeleteResponse.get_data()[0].get_id() << "'\n\n"; - - return 0; -} diff --git a/languages/cpp/include/BitwardenClient.h b/languages/cpp/include/BitwardenClient.h deleted file mode 100644 index 2910c49b..00000000 --- a/languages/cpp/include/BitwardenClient.h +++ /dev/null @@ -1,38 +0,0 @@ -#pragma once - -#include "CommandRunner.h" -#include "BitwardenSettings.h" -#include "Projects.h" -#include "Secrets.h" -#include -#include - -class BitwardenClient { -public: - explicit BitwardenClient(const BitwardenSettings& bitwardenSettings = BitwardenSettings()); - ~BitwardenClient(); - - void loginAccessToken(const std::string& accessToken, const std::string& stateFile = ""); - ProjectResponse getProject(const boost::uuids::uuid& id); - ProjectResponse createProject(const boost::uuids::uuid& organizationId, const std::string& name); - ProjectResponse updateProject(const boost::uuids::uuid& organizationId, const boost::uuids::uuid& id, const std::string& name); - ProjectsDeleteResponse deleteProjects(const std::vector& ids); - ProjectsResponse listProjects(const boost::uuids::uuid &organizationId); - SecretResponse getSecret(const boost::uuids::uuid& id); - SecretsResponse getSecretsByIds(const std::vector& ids); - SecretResponse createSecret(const boost::uuids::uuid& organizationId, const std::string& key, const std::string& value, const std::string& note, const std::vector& projectIds); - SecretResponse updateSecret(const boost::uuids::uuid& organizationId, const boost::uuids::uuid& id, const std::string& key, const std::string& value, const std::string& note, const std::vector& projectIds); - SecretsDeleteResponse deleteSecrets(const std::vector& ids); - SecretIdentifiersResponse listSecrets(const boost::uuids::uuid& organizationId); - SecretsSyncResponse sync(const boost::uuids::uuid &organizationId, const std::chrono::system_clock::time_point &lastSyncedDate); - -private: - BitwardenLibrary* library; - void* client; - CommandRunner* commandRunner; - Projects projects; - Secrets secrets; - bool isClientOpen; - ClientSettings clientSettings; - -}; diff --git a/languages/cpp/include/BitwardenLibrary.h b/languages/cpp/include/BitwardenLibrary.h deleted file mode 100644 index 5fee7872..00000000 --- a/languages/cpp/include/BitwardenLibrary.h +++ /dev/null @@ -1,27 +0,0 @@ -#pragma once - -#include - -#ifdef _WIN32 -#include -#else -#include -#endif - -class BitwardenLibrary { -public: - BitwardenLibrary(const std::string& providedLibraryPath); - ~BitwardenLibrary(); - - void* init(const char* clientSettingsJson); - void free_mem(void* client); - const char* run_command(const char* commandJson, void* client); - -private: -#ifdef _WIN32 - HMODULE libraryHandle; -#else - void* libraryHandle; -#endif -}; - diff --git a/languages/cpp/include/BitwardenSettings.h b/languages/cpp/include/BitwardenSettings.h deleted file mode 100644 index 4d075ed0..00000000 --- a/languages/cpp/include/BitwardenSettings.h +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once - -#include - -class BitwardenSettings { -public: - BitwardenSettings() = default; - ~BitwardenSettings() = default; - - const std::string& get_api_url() const { return api_url; } - void set_api_url(const std::string& value) { api_url = value; } - - const std::string& get_identity_url() const { return identity_url; } - void set_identity_url(const std::string& value) { identity_url = value; } - -private: - std::string api_url; - std::string identity_url; -}; diff --git a/languages/cpp/include/CommandRunner.h b/languages/cpp/include/CommandRunner.h deleted file mode 100644 index 9aa6cbe9..00000000 --- a/languages/cpp/include/CommandRunner.h +++ /dev/null @@ -1,45 +0,0 @@ -#pragma once - -#include -#include -#include "BitwardenLibrary.h" -#include "schemas.hpp" -#include - -using namespace Bitwarden::Sdk; - -class CommandRunner { -public: - CommandRunner(BitwardenLibrary* library, void* client); - - template - R runCommand(const Command& command, Func deserializer); - - - -private: - BitwardenLibrary* library; - void* client; - - std::string commandToString(const Command& command); - nlohmann::json filterNullObjects(const nlohmann::json& input); -}; - -template -R CommandRunner::runCommand(const Command& command, Func deserializer) { - // Serialize the Command object to a JSON string - std::string jsonString = commandToString(command); - const char* jsonCStr = jsonString.c_str(); - const char* response = library->run_command(jsonCStr, client); - - // Deserialize the response using the provided deserializer function - T deserialized = deserializer(response); - - // Unwrap the response and throw an exception if it was not successful - if (!deserialized.get_success()) { - throw std::runtime_error(*deserialized.get_error_message()); - } - - return deserialized.get_data().get(); -} - diff --git a/languages/cpp/include/Projects.h b/languages/cpp/include/Projects.h deleted file mode 100644 index 27511c32..00000000 --- a/languages/cpp/include/Projects.h +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once - -#include -#include -#include "CommandRunner.h" - -class Projects { -public: - Projects(CommandRunner* commandRunner); - - ProjectResponse get(const boost::uuids::uuid& id); - ProjectResponse create(const boost::uuids::uuid& organizationId, const std::string& name); - ProjectResponse update(const boost::uuids::uuid& organizationId, const boost::uuids::uuid& id, const std::string& name); - ProjectsDeleteResponse deleteProjects(const std::vector& ids); - ProjectsResponse list(const boost::uuids::uuid& organizationId); - -private: - CommandRunner* commandRunner; -}; diff --git a/languages/cpp/include/Secrets.h b/languages/cpp/include/Secrets.h deleted file mode 100644 index 5c5a3275..00000000 --- a/languages/cpp/include/Secrets.h +++ /dev/null @@ -1,24 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include "CommandRunner.h" - -class Secrets { -public: - Secrets(CommandRunner* commandRunner); - - SecretResponse get(const boost::uuids::uuid& id); - SecretsResponse getByIds(const std::vector &ids); - SecretResponse create(const boost::uuids::uuid& organizationId, const std::string& key, const std::string& value, const std::string& note, const std::vector& projectIds); - SecretResponse update(const boost::uuids::uuid& organizationId, const boost::uuids::uuid& id, const std::string& key, const std::string& value, const std::string& note, const std::vector& projectIds); - SecretsDeleteResponse deleteSecrets(const std::vector& ids); - SecretIdentifiersResponse list(const boost::uuids::uuid& organizationId); - SecretsSyncResponse sync(const boost::uuids::uuid& organizationId, const boost::optional& lastSyncedDate); - -private: - CommandRunner* commandRunner; -}; - diff --git a/languages/cpp/src/BitwardenClient.cpp b/languages/cpp/src/BitwardenClient.cpp deleted file mode 100644 index 2d11977d..00000000 --- a/languages/cpp/src/BitwardenClient.cpp +++ /dev/null @@ -1,160 +0,0 @@ -#include "BitwardenClient.h" -#include -#include - -BitwardenClient::BitwardenClient(const BitwardenSettings& bitwardenSettings) - : library(nullptr), commandRunner(nullptr), isClientOpen(false), projects(nullptr), secrets(nullptr) { - - // Set default values for optional strings - boost::optional apiUrl = bitwardenSettings.get_api_url().empty() - ? boost::optional("https://api.bitwarden.com") - : boost::optional(bitwardenSettings.get_api_url()); - - boost::optional identityUrl = bitwardenSettings.get_identity_url().empty() - ? boost::optional("https://identity.bitwarden.com") - : boost::optional(bitwardenSettings.get_identity_url()); - - boost::optional user_agent = boost::optional("Bitwarden CPP-SDK"); - - // Set values in clientSettings - clientSettings.set_device_type(Bitwarden::Sdk::DeviceType::SDK); - clientSettings.set_user_agent(user_agent); - clientSettings.set_api_url(apiUrl); - clientSettings.set_identity_url(identityUrl); - - nlohmann::json jsonClientSettings; - Bitwarden::Sdk::to_json(jsonClientSettings, clientSettings); - - std::string jsonClientSettingsString = jsonClientSettings.dump(); - const char* jsonClientSettingsCStr = jsonClientSettingsString.c_str(); - - try { - library = new BitwardenLibrary("./"); - client = library->init(jsonClientSettingsCStr); - commandRunner = new CommandRunner(library, client); - projects = Projects(commandRunner); - secrets = Secrets(commandRunner); - isClientOpen = true; - } catch (const std::exception& ex) { - std::cerr << "Failed to initialize: " << ex.what() << std::endl; - throw ex; - } -} - -BitwardenClient::~BitwardenClient() { - if (library) { - delete commandRunner; - library->free_mem(client); - delete library; - isClientOpen = false; - } -} - -void BitwardenClient::loginAccessToken(const std::string& accessToken, const std::string& stateFile) { - Command command; - AccessTokenLoginRequest accessTokenLoginRequest; - accessTokenLoginRequest.set_access_token(accessToken); - accessTokenLoginRequest.set_state_file(stateFile); - command.set_login_access_token(accessTokenLoginRequest); - - auto deserializer = [](const char* response) -> ResponseForApiKeyLoginResponse { - nlohmann::json jsonResponse = nlohmann::json::parse(response); - ResponseForApiKeyLoginResponse loginResponse; - Bitwarden::Sdk::from_json(jsonResponse, loginResponse); - return loginResponse; - }; - try { - commandRunner->runCommand(command, deserializer); - } catch (const std::exception& ex) { - std::cerr << "Error in accessTokenLogin: " << ex.what() << std::endl; - throw ex; - } -} - -ProjectResponse BitwardenClient::getProject(const boost::uuids::uuid& id){ - if (!isClientOpen) { - throw std::runtime_error("Client is not open."); - } - return projects.get(id); -} - -ProjectResponse BitwardenClient::createProject(const boost::uuids::uuid& organizationId, const std::string& name){ - if (!isClientOpen) { - throw std::runtime_error("Client is not open."); - } - return projects.create(organizationId, name); -} - -ProjectResponse BitwardenClient::updateProject(const boost::uuids::uuid& organizationId, const boost::uuids::uuid& id, const std::string& name){ - if (!isClientOpen) { - throw std::runtime_error("Client is not open."); - } - return projects.update(organizationId, id, name); -} - -ProjectsDeleteResponse BitwardenClient::deleteProjects(const std::vector& ids) { - if (!isClientOpen) { - throw std::runtime_error("Client is not open."); - } - return projects.deleteProjects(ids); - -} - -ProjectsResponse BitwardenClient::listProjects(const boost::uuids::uuid &organizationId) { - if (!isClientOpen) { - throw std::runtime_error("Client is not open."); - } - return projects.list(organizationId); - -} - -SecretResponse BitwardenClient::getSecret(const boost::uuids::uuid& id){ - if (!isClientOpen) { - throw std::runtime_error("Client is not open."); - } - return secrets.get(id); -} - -SecretsResponse BitwardenClient::getSecretsByIds(const std::vector& ids){ - if (!isClientOpen) { - throw std::runtime_error("Client is not open."); - } - return secrets.getByIds(ids); -} - -SecretResponse BitwardenClient::createSecret(const boost::uuids::uuid& organizationId, const std::string& key, const std::string& value, const std::string& note, const std::vector& projectIds){ - if (!isClientOpen) { - throw std::runtime_error("Client is not open."); - } - return secrets.create(organizationId, key, value, note, projectIds); -} - -SecretResponse BitwardenClient::updateSecret(const boost::uuids::uuid& organizationId, const boost::uuids::uuid& id, const std::string& key, const std::string& value, const std::string& note, const std::vector& projectIds){ - if (!isClientOpen) { - throw std::runtime_error("Client is not open."); - } - return secrets.update(organizationId, id, key, value, note, projectIds); -} - -SecretsDeleteResponse BitwardenClient::deleteSecrets(const std::vector& ids) { - if (!isClientOpen) { - throw std::runtime_error("Client is not open."); - } - return secrets.deleteSecrets(ids); - -} - -SecretIdentifiersResponse BitwardenClient::listSecrets(const boost::uuids::uuid &organizationId) { - if (!isClientOpen) { - throw std::runtime_error("Client is not open."); - } - return secrets.list(organizationId); - -} - -SecretsSyncResponse BitwardenClient::sync(const boost::uuids::uuid &organizationId, const std::chrono::system_clock::time_point &lastSyncedDate) { - if (!isClientOpen) { - throw std::runtime_error("Client is not open."); - } - return secrets.sync(organizationId, lastSyncedDate); -} diff --git a/languages/cpp/src/BitwardenLibrary.cpp b/languages/cpp/src/BitwardenLibrary.cpp deleted file mode 100644 index 0af59278..00000000 --- a/languages/cpp/src/BitwardenLibrary.cpp +++ /dev/null @@ -1,107 +0,0 @@ -#include "BitwardenLibrary.h" -#include - -BitwardenLibrary::BitwardenLibrary(const std::string& providedLibraryPath) : libraryHandle(nullptr) { - std::string libraryExtension; - std::string libraryNameUnix = "libbitwarden_c"; - std::string libraryNameWin = "bitwarden_c"; -#if defined(_WIN32) - libraryExtension = ".dll"; -#elif defined(__linux__) - libraryExtension = ".so"; -#elif defined(__APPLE__) - libraryExtension = ".dylib"; -#else - // Unsupported platform - std::cerr << "Unsupported platform." << std::endl; - return; -#endif - - // Load the dynamic library -#ifdef _WIN32 - std::string libraryPath = providedLibraryPath + libraryNameWin + libraryExtension; - // Load the dynamic library on Windows - libraryHandle = LoadLibraryA(libraryPath.c_str()); - - if (!libraryHandle) { - std::cerr << "Failed to load the Bitwarden library." << std::endl; - } -#else - std::string libraryPath = providedLibraryPath + libraryNameUnix + libraryExtension; - // Load the dynamic library on Unix-based systems (Linux, macOS) - libraryHandle = dlopen(libraryPath.c_str(), RTLD_NOW); - - if (!libraryHandle) { - std::cerr << "Failed to load the Bitwarden library: " << dlerror() << std::endl; - } -#endif -} - -BitwardenLibrary::~BitwardenLibrary() { - if (libraryHandle) { -#ifdef _WIN32 - FreeLibrary(libraryHandle); -#else - dlclose(libraryHandle); -#endif - } -} - -void* BitwardenLibrary::init(const char* clientSettingsJson) { - typedef void* (*InitFunction)(const char*); - InitFunction initFunction = nullptr; - -#ifdef _WIN32 - // Get the address of the init function on Windows - initFunction = reinterpret_cast(GetProcAddress(libraryHandle, "init")); -#else - // Get the address of the init function on Unix-based systems - initFunction = reinterpret_cast(dlsym(libraryHandle, "init")); -#endif - - if (initFunction) { - return initFunction(clientSettingsJson); - } - - std::cerr << "Failed to load init function from the Bitwarden library: " << std::endl; - return nullptr; -} - -void BitwardenLibrary::free_mem(void* client) { - typedef void (*FreeMemFunction)(void*); - FreeMemFunction freeMemFunction = nullptr; - -#ifdef _WIN32 - // Get the address of the free_mem function on Windows - freeMemFunction = reinterpret_cast(GetProcAddress(libraryHandle, "free_mem")); -#else - // Get the address of the free_mem function on Unix-based systems - freeMemFunction = reinterpret_cast(dlsym(libraryHandle, "free_mem")); -#endif - - if (freeMemFunction) { - freeMemFunction(client); - } else { - std::cerr << "Failed to load free_mem function from the Bitwarden library." << std::endl; - } -} - -const char* BitwardenLibrary::run_command(const char* commandJson, void* client) { - typedef const char* (*RunCommandFunction)(const char*, void*); - RunCommandFunction runCommandFunction = nullptr; - -#ifdef _WIN32 - // Get the address of the run_command function on Windows - runCommandFunction = reinterpret_cast(GetProcAddress(libraryHandle, "run_command")); -#else - // Get the address of the run_command function on Unix-based systems - runCommandFunction = reinterpret_cast(dlsym(libraryHandle, "run_command")); -#endif - - if (runCommandFunction) { - return runCommandFunction(commandJson, client); - } - - std::cerr << "Failed to load run_command function from the Bitwarden library." << std::endl; - return nullptr; -} diff --git a/languages/cpp/src/CommandRunner.cpp b/languages/cpp/src/CommandRunner.cpp deleted file mode 100644 index 032347f3..00000000 --- a/languages/cpp/src/CommandRunner.cpp +++ /dev/null @@ -1,49 +0,0 @@ -#include "CommandRunner.h" -#include -#include -#include - - -CommandRunner::CommandRunner(BitwardenLibrary* library, void* client) : library(library), client(client) {} - -// Function to recursively filter out objects with all null values -nlohmann::json CommandRunner::filterNullObjects(const nlohmann::json& input) { - nlohmann::json result; - - for (auto it = input.begin(); it != input.end(); ++it) { - if (!it.value().is_null()) { - if (it.value().is_object()) { - // Recursively filter nested objects - json nestedFiltered = filterNullObjects(it.value()); - if (!nestedFiltered.empty()) { - result[it.key()] = nestedFiltered; - } - } else { - result[it.key()] = it.value(); - } - } - } - - return result; -} - -// Implement the commandToString function -std::string CommandRunner::commandToString(const Command& command) { - try { - // Create an nlohmann::json object from the Command object - nlohmann::json jsonCommand; - nlohmann::json filteredJsonCommand; - - Bitwarden::Sdk::to_json(jsonCommand, command); - - filteredJsonCommand = filterNullObjects(jsonCommand); - - // Convert the JSON to a string - std::string jsonCommandString = filteredJsonCommand.dump(); - - return jsonCommandString; - } catch (const std::exception& ex) { - std::cerr << "Error: " << ex.what() << std::endl; - throw ex; - } -} diff --git a/languages/cpp/src/Projects.cpp b/languages/cpp/src/Projects.cpp deleted file mode 100644 index b2fa1c68..00000000 --- a/languages/cpp/src/Projects.cpp +++ /dev/null @@ -1,132 +0,0 @@ -#include "Projects.h" -#include -#include -#include -#include -#include - -Projects::Projects(CommandRunner* commandRunner) : commandRunner(commandRunner) {} - -auto projectsDeserializer = [](const char* response) -> ResponseForProjectResponse { - nlohmann::json jsonResponse = nlohmann::json::parse(response); - ResponseForProjectResponse projectResponse; - Bitwarden::Sdk::from_json(jsonResponse, projectResponse); - return projectResponse; -}; - -auto deleteProjectsDeserializer = [](const char* response) -> ResponseForProjectsDeleteResponse { - nlohmann::json jsonResponse = nlohmann::json::parse(response); - ResponseForProjectsDeleteResponse deleteProjectsResponse; - Bitwarden::Sdk::from_json(jsonResponse, deleteProjectsResponse); - return deleteProjectsResponse; -}; - -auto projectListDeserializer = [](const char* response) -> ResponseForProjectsResponse { - nlohmann::json jsonResponse = nlohmann::json::parse(response); - ResponseForProjectsResponse listResponse; - Bitwarden::Sdk::from_json(jsonResponse, listResponse); - return listResponse; -}; - -ProjectResponse Projects::get(const boost::uuids::uuid& id) { - Command command; - ProjectsCommand projectsCommand; - ProjectGetRequest projectGetRequest; - - std::string idStr = boost::uuids::to_string(id); - projectGetRequest.set_id(idStr); - - projectsCommand.set_get(projectGetRequest); - command.set_projects(projectsCommand); - - try { - return commandRunner->runCommand(command, projectsDeserializer); - } catch (const std::exception& ex) { - std::cerr << "Error in getProject: " << ex.what() << std::endl; - throw ex; - } -} - -ProjectResponse Projects::create(const boost::uuids::uuid& organizationId, const std::string& name) { - Command command; - ProjectsCommand projectsCommand; - ProjectCreateRequest projectCreateRequest; - - std::string orgIdStr = boost::uuids::to_string(organizationId); - projectCreateRequest.set_organization_id(orgIdStr); - - projectCreateRequest.set_name(name); - projectsCommand.set_create(projectCreateRequest); - command.set_projects(projectsCommand); - - try { - return commandRunner->runCommand(command, projectsDeserializer); - } catch (const std::exception& ex) { - std::cerr << "Error in createProject: " << ex.what() << std::endl; - throw ex; - } -} - -ProjectResponse Projects::update(const boost::uuids::uuid& organizationId, const boost::uuids::uuid& id, const std::string& name) { - Command command; - ProjectsCommand projectsCommand; - ProjectPutRequest projectPutRequest; - - std::string idStr = boost::uuids::to_string(id); - projectPutRequest.set_id(idStr); - - std::string orgIdStr = boost::uuids::to_string(organizationId); - projectPutRequest.set_organization_id(orgIdStr); - - projectPutRequest.set_name(name); - projectsCommand.set_update(projectPutRequest); - command.set_projects(projectsCommand); - - try { - return commandRunner->runCommand(command, projectsDeserializer); - } catch (const std::exception& ex) { - std::cerr << "Error in updateProject: " << ex.what() << std::endl; - throw ex; - } -} - -ProjectsDeleteResponse Projects::deleteProjects(const std::vector& ids) { - Command command; - ProjectsCommand projectsCommand; - ProjectsDeleteRequest projectsDeleteRequest; - - std::vector idStrs; - for (const auto& id : ids) { - idStrs.push_back(boost::uuids::to_string(id)); - } - projectsDeleteRequest.set_ids(idStrs); - - projectsCommand.set_projects_command_delete(projectsDeleteRequest); - command.set_projects(projectsCommand); - - try { - return commandRunner->runCommand(command, deleteProjectsDeserializer); - } catch (const std::exception& ex) { - std::cerr << "Error in deleteProjects: " << ex.what() << std::endl; - throw ex; - } -} - -ProjectsResponse Projects::list(const boost::uuids::uuid& organizationId) { - Command command; - ProjectsCommand projectsCommand; - ProjectsListRequest projectsListRequest; - - std::string orgIdStr = boost::uuids::to_string(organizationId); - projectsListRequest.set_organization_id(orgIdStr); - - projectsCommand.set_list(projectsListRequest); - command.set_projects(projectsCommand); - - try { - return commandRunner->runCommand(command, projectListDeserializer); - } catch (const std::exception& ex) { - std::cerr << "Error in listProjects: " << ex.what() << std::endl; - throw ex; - } -} diff --git a/languages/cpp/src/Secrets.cpp b/languages/cpp/src/Secrets.cpp deleted file mode 100644 index 1fff9441..00000000 --- a/languages/cpp/src/Secrets.cpp +++ /dev/null @@ -1,230 +0,0 @@ -#include "Secrets.h" -#include -#include -#include -#include