diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 2698af8..ec0c52c 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -9,50 +9,11 @@ # Shared workflows ownership -## BRE & SM teams shared ownership -.github/workflows/build-cli-docker.yml @bitwarden/dept-bre @bitwarden/team-secrets-manager-dev -.github/workflows/build-cli.yml @bitwarden/dept-bre @bitwarden/team-secrets-manager-dev -.github/workflows/build-cpp.yml @bitwarden/dept-bre @bitwarden/team-secrets-manager-dev -.github/workflows/build-dotnet.yml @bitwarden/dept-bre @bitwarden/team-secrets-manager-dev -.github/workflows/build-go.yml @bitwarden/dept-bre @bitwarden/team-secrets-manager-dev -.github/workflows/build-java.yml @bitwarden/dept-bre @bitwarden/team-secrets-manager-dev -.github/workflows/build-napi.yml @bitwarden/dept-bre @bitwarden/team-secrets-manager-dev -.github/workflows/build-python-wheels.yml @bitwarden/dept-bre @bitwarden/team-secrets-manager-dev -.github/workflows/build-ruby.yml @bitwarden/dept-bre @bitwarden/team-secrets-manager-dev -.github/workflows/release-bws.yml @bitwarden/dept-bre @bitwarden/team-secrets-manager-dev -.github/workflows/release-cpp.yml @bitwarden/dept-bre @bitwarden/team-secrets-manager-dev -.github/workflows/release-dotnet.yml @bitwarden/dept-bre @bitwarden/team-secrets-manager-dev -.github/workflows/release-go.yml @bitwarden/dept-bre @bitwarden/team-secrets-manager-dev -.github/workflows/release-java.yml @bitwarden/dept-bre @bitwarden/team-secrets-manager-dev -.github/workflows/release-napi.yml @bitwarden/dept-bre @bitwarden/team-secrets-manager-dev -.github/workflows/release-python.yml @bitwarden/dept-bre @bitwarden/team-secrets-manager-dev -.github/workflows/release-ruby.yml @bitwarden/dept-bre @bitwarden/team-secrets-manager-dev - ## Multiple owners .github/workflows/build-android.yml .github/workflows/build-rust-crates.yml -.github/workflows/build-rust-cross-platform.yml .github/workflows/build-swift.yml .github/workflows/build-wasm-internal.yml -.github/workflows/build-wasm.yml .github/workflows/release-rust-crates.yml .github/workflows/release-swift.yml -.github/workflows/release-wasm.yml .github/workflows/version-bump.yml - - - -# 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 - -## Docker files have shared ownership ## -**/Dockerfile -**/*.Dockerfile -**/.dockerignore -**/entrypoint.sh diff --git a/.github/ISSUE_TEMPLATE/cli.yml b/.github/ISSUE_TEMPLATE/cli.yml deleted file mode 100644 index b747873..0000000 --- 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 61d7e2b..0000000 --- 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 c5bb87a..0000000 --- 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-android.yml b/.github/workflows/build-android.yml index 49ee208..ba8d6e9 100644 --- a/.github/workflows/build-android.yml +++ b/.github/workflows/build-android.yml @@ -91,10 +91,10 @@ jobs: working-directory: languages/kotlin/sdk/src/main/jniLibs run: | mkdir armeabi-v7a arm64-v8a x86 x86_64 - mv /home/runner/work/sdk/sdk/android-armv7-linux-androideabi/libbitwarden_uniffi.so ./armeabi-v7a/libbitwarden_uniffi.so - mv /home/runner/work/sdk/sdk/android-aarch64-linux-android/libbitwarden_uniffi.so ./arm64-v8a/libbitwarden_uniffi.so - mv /home/runner/work/sdk/sdk/android-i686-linux-android/libbitwarden_uniffi.so ./x86/libbitwarden_uniffi.so - mv /home/runner/work/sdk/sdk/android-x86_64-linux-android/libbitwarden_uniffi.so ./x86_64/libbitwarden_uniffi.so + mv /home/runner/work/sdk-internal/sdk-internal/android-armv7-linux-androideabi/libbitwarden_uniffi.so ./armeabi-v7a/libbitwarden_uniffi.so + mv /home/runner/work/sdk-internal/sdk-internal/android-aarch64-linux-android/libbitwarden_uniffi.so ./arm64-v8a/libbitwarden_uniffi.so + mv /home/runner/work/sdk-internal/sdk-internal/android-i686-linux-android/libbitwarden_uniffi.so ./x86/libbitwarden_uniffi.so + mv /home/runner/work/sdk-internal/sdk-internal/android-x86_64-linux-android/libbitwarden_uniffi.so ./x86_64/libbitwarden_uniffi.so - name: Generate bindings working-directory: languages/kotlin diff --git a/.github/workflows/build-cli-docker.yml b/.github/workflows/build-cli-docker.yml deleted file mode 100644 index abf1c3a..0000000 --- a/.github/workflows/build-cli-docker.yml +++ /dev/null @@ -1,142 +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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - - - 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@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.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@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6.9.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 05f4cd2..0000000 --- a/.github/workflows/build-cli.yml +++ /dev/null @@ -1,466 +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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - - - 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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - - - name: Install rust - uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # stable - with: - toolchain: stable - targets: ${{ matrix.settings.target }} - - - name: Cache cargo registry - uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2.7.5 - 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@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 - 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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - - - name: Install rust - uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # stable - with: - toolchain: stable - targets: ${{ matrix.settings.target }} - - - name: Cache cargo registry - uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2.7.5 - 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@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 - 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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - - - 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@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2.7.5 - 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@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 - 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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - - - 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@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 - 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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - - - name: Install rust - uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # stable - with: - toolchain: stable - - - name: Cache cargo registry - uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2.7.5 - 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@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 - 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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - - - name: Install rust - uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # stable - with: - toolchain: stable - - - name: Cache cargo registry - uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2.7.5 - 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@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 - 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 2cd9991..0000000 --- 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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - - - 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@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 - 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 974c7e5..0000000 --- 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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - - - 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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - - - 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@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 - 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 0a84e72..0000000 --- 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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - - - name: Setup Go environment - uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 - with: - go-version: ${{ env.GO_VERSION }} - - - name: Cache dependencies - uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4.1.1 - 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 abeabe9..0000000 --- a/.github/workflows/build-java.yml +++ /dev/null @@ -1,87 +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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - - - 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@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 - with: - name: build - path: ${{ github.workspace }}/languages/java/build - if-no-files-found: error - - - name: Upload Java SDK Build - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 - 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@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 - 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 cae88a1..0000000 --- a/.github/workflows/build-napi.yml +++ /dev/null @@ -1,90 +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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - - - 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@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2.7.5 - 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@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 - 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 da3305e..0000000 --- a/.github/workflows/build-python-wheels.yml +++ /dev/null @@ -1,121 +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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - - - 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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - - - 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@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2.7.5 - 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@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 - 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@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 - 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 3ac79de..0000000 --- a/.github/workflows/build-ruby.yml +++ /dev/null @@ -1,94 +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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - - - name: Set up Ruby - uses: ruby/setup-ruby@f26937343756480a8cb3ae1f623b9c8d89ed6984 # v1.196.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@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 - with: - path: bitwarden-sdk-secrets-*.gem - name: bitwarden-sdk-secrets diff --git a/.github/workflows/build-rust-crates.yml b/.github/workflows/build-rust-crates.yml index bc00dd9..6c43341 100644 --- a/.github/workflows/build-rust-crates.yml +++ b/.github/workflows/build-rust-crates.yml @@ -25,7 +25,6 @@ jobs: - windows-latest package: - - bitwarden - bitwarden-api-api - bitwarden-api-identity - bitwarden-crypto diff --git a/.github/workflows/build-rust-cross-platform.yml b/.github/workflows/build-rust-cross-platform.yml deleted file mode 100644 index 7014bf9..0000000 --- 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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - - - name: Install rust - uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # stable - with: - toolchain: stable - - - name: Cache cargo registry - uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2.7.5 - - - 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@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 - with: - name: libbitwarden_c_files-${{ matrix.settings.target }} - path: target/${{ matrix.settings.target }}/release/*bitwarden_c* - - - name: Upload Artifact - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 - 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 e1924ca..0000000 --- a/.github/workflows/build-wasm.yml +++ /dev/null @@ -1,75 +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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - - - 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: 1.81.0 - targets: wasm32-unknown-unknown - - - name: Cache cargo registry - uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2.7.5 - with: - key: wasm-cargo-cache - - - name: Install wasm-bindgen-cli - run: cargo install wasm-bindgen-cli --version 0.2.95 - - - name: Build - run: ./build.sh -r - - - name: Upload artifact - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 - 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/minimum-rust-version.yml b/.github/workflows/minimum-rust-version.yml index 812822c..0557948 100644 --- a/.github/workflows/minimum-rust-version.yml +++ b/.github/workflows/minimum-rust-version.yml @@ -42,4 +42,4 @@ jobs: key: msrv-${{ matrix.settings.target }}-cargo-${{ matrix.settings.os }} - name: cargo check MSRV - run: cargo check -p bitwarden --all-features + run: cargo check --all-features diff --git a/.github/workflows/publish-bws.yml b/.github/workflows/publish-bws.yml deleted file mode 100644 index 3f4245b..0000000 --- a/.github/workflows/publish-bws.yml +++ /dev/null @@ -1,214 +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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - - - 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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - - - 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@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2.7.5 - - - 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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - 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@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.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@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6.9.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 624cf94..0000000 --- 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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - - - 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 84ce0a9..0000000 --- a/.github/workflows/publish-java.yml +++ /dev/null @@ -1,127 +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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - - - 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 -rc '.[] | select(.tag_name | contains("java")) | .tag_name' | head -1) - VERSION=$(echo $TAG_NAME | grep -oE '[0-9]+\.[0-9]+\.[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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - 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 5c7aca1..0000000 --- a/.github/workflows/publish-napi.yml +++ /dev/null @@ -1,154 +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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - - - 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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - 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@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4 - 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 d3965f7..0000000 --- a/.github/workflows/publish-php.yml +++ /dev/null @@ -1,269 +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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - - - 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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - - - 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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - 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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - 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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - 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 bfc6b7a..0000000 --- a/.github/workflows/publish-python.yml +++ /dev/null @@ -1,131 +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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - - - 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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - 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 827377c..0000000 --- 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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - - - 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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - 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 95779b7..0000000 --- a/.github/workflows/publish-wasm.yml +++ /dev/null @@ -1,137 +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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - - - 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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - with: - ref: ${{ needs.setup.outputs.tag_name }} - - - name: Setup Node - uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4 - 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 9063ca6..0000000 --- a/.github/workflows/release-bws.yml +++ /dev/null @@ -1,76 +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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - - - 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 77bc894..0000000 --- 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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - - - 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 f968eba..0000000 --- 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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - - - 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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - - - 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 4138c72..0000000 --- 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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - - - 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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - 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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - 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 863a898..0000000 --- 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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - - - 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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - - - 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 65534e8..0000000 --- a/.github/workflows/release-napi.yml +++ /dev/null @@ -1,95 +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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - - - 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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - - - 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 a634a2d..0000000 --- a/.github/workflows/release-python.yml +++ /dev/null @@ -1,79 +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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - - - 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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - - - 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-ruby.yml b/.github/workflows/release-ruby.yml deleted file mode 100644 index 9fb3349..0000000 --- a/.github/workflows/release-ruby.yml +++ /dev/null @@ -1,71 +0,0 @@ -name: Release Ruby SDK -run-name: Release Ruby 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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - - - 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/ruby/lib/version.rb | grep -Eo 'VERSION = "[0-9]+\.[0-9]+\.[0-9]+"' | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+') - echo "version=$VERSION" >> $GITHUB_OUTPUT - - release: - name: Create GitHub release - runs-on: ubuntu-22.04 - needs: setup - steps: - - name: Checkout Repository - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - - - name: Download ruby artifact - uses: bitwarden/gh-actions/download-artifacts@main - with: - workflow: build-ruby.yml - workflow_conclusion: success - branch: main - artifacts: bitwarden-sdk-secrets - - - 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: ruby-v${{ env.PKG_VERSION }} - name: Ruby v${{ env.PKG_VERSION }} - body: "" - token: ${{ secrets.GITHUB_TOKEN }} - draft: true - artifacts: | - bitwarden-sdk-secrets-${{ env.PKG_VERSION }}.gem diff --git a/.github/workflows/release-wasm.yml b/.github/workflows/release-wasm.yml deleted file mode 100644 index 982a31e..0000000 --- a/.github/workflows/release-wasm.yml +++ /dev/null @@ -1,77 +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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - - - 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@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - - - 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 a313970..5812667 100644 --- a/.github/workflows/rust-test.yml +++ b/.github/workflows/rust-test.yml @@ -16,7 +16,6 @@ jobs: runs-on: ubuntu-22.04 needs: - test - - wasm steps: - run: exit 0 @@ -45,8 +44,7 @@ jobs: uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2.7.5 - 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 @@ -75,33 +73,3 @@ jobs: uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0 env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - - wasm: - name: WASM - - runs-on: ubuntu-22.04 - - steps: - - name: Checkout - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 - - - name: Install rust - uses: dtolnay/rust-toolchain@7b1c307e0dcbda6122208f10795a713336a9b35a # stable - with: - toolchain: stable - targets: wasm32-unknown-unknown - - - name: Cache cargo registry - uses: Swatinem/rust-cache@82a92a6e8fbeee089604da2575dc567ae9ddeaab # v2.7.5 - - - name: Check - run: cargo check -p bitwarden-wasm --target wasm32-unknown-unknown - - - name: Install wasm-pack - run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh - - - name: Wasm-pack test firefox - run: wasm-pack test --headless --firefox crates/bitwarden-wasm - - - name: Wasm-pack test chrome - run: wasm-pack test --headless --chrome crates/bitwarden-wasm diff --git a/.github/workflows/version-bump.yml b/.github/workflows/version-bump.yml index 47642e1..6a33fe4 100644 --- a/.github/workflows/version-bump.yml +++ b/.github/workflows/version-bump.yml @@ -9,16 +9,7 @@ on: required: true type: choice options: - - bitwarden - - bws - - napi - - python-sdk - - ruby-sdk - - go-sdk - - dotnet-sdk - - php-sdk - - java-sdk - - cpp-sdk + - bitwarden-core version_number: description: "New version (example: '2024.1.0')" required: true @@ -89,72 +80,10 @@ 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 + - name: Bump bitwarden-core crate Version + if: ${{ inputs.project == 'bitwarden-core' }} + run: cargo set-version -p bitwarden-core ${{ inputs.version_number }} ############################ # VERSION BUMP SECTION END # diff --git a/.gitignore b/.gitignore index 4a1d79f..cea87cc 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 1624394..13f89e9 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 7da474a..3bbf9af 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 71400c0..0000000 --- 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 10edbfb..0000000 --- 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 e9b7646..be749ab 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" @@ -142,15 +127,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.89" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6" - -[[package]] -name = "arc-swap" -version = "1.7.1" +version = "1.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69f7f8c3906b62b754cd5326047894316021dcfe5a194c8ea52bdd94934a3457" +checksum = "37bf3594c4c988a53154954629820791dde498571819ae4ca50ca811e060cc95" [[package]] name = "argon2" @@ -188,7 +167,7 @@ dependencies = [ "proc-macro2", "quote", "serde", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -237,7 +216,7 @@ checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -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" @@ -543,40 +474,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" @@ -664,23 +561,6 @@ dependencies = [ "wasm-bindgen", ] -[[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" @@ -724,16 +604,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" @@ -758,42 +628,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.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8334215b81e418a0a7bdb8ef0849474f40bb10c8b71f1c4ed315cff49f32494d" - [[package]] name = "byteorder" version = "1.5.0" @@ -806,12 +640,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" @@ -861,9 +689,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.30" +version = "1.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b16803a61b81d9eabb7eae2588776c4c1e584b738ede45fdbb4c972cec1e9945" +checksum = "c2e7962b54006dcfcc61cb72735f4d89bb97061dd6a7ed882ec6b8ee53714c6f" dependencies = [ "shlex", ] @@ -955,15 +783,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" @@ -973,7 +792,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -982,28 +801,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" @@ -1059,19 +856,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" @@ -1099,24 +883,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" @@ -1152,15 +918,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" @@ -1309,16 +1066,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" @@ -1340,7 +1087,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -1351,7 +1098,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -1430,7 +1177,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -1440,7 +1187,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab63b0e2bf4d5928aff72e83a7dace85d7bba5fe12dcc3c5a572d78caffd3f3c" dependencies = [ "derive_builder_core", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -1455,27 +1202,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" @@ -1525,21 +1251,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" @@ -1616,16 +1327,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" @@ -1706,7 +1407,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -1793,19 +1494,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" @@ -1923,15 +1611,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" @@ -1986,9 +1665,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "1.4.1" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05" +checksum = "bbbff0a806a4728c99295b254c8838933b5b082d75e3cb70c8dab21fdfbcfa9a" dependencies = [ "bytes", "futures-channel", @@ -2108,12 +1787,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" @@ -2234,9 +1907,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.159" +version = "0.2.161" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" +checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1" [[package]] name = "libloading" @@ -2254,16 +1927,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" @@ -2292,15 +1955,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" @@ -2329,16 +1983,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" @@ -2354,15 +1998,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" @@ -2387,64 +2022,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "napi" -version = "2.16.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a84fdaf64da2b2d86b1be5db1b81963353bf00f7bef4b9e2668bbe6f72e8eb3" -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" @@ -2464,15 +2041,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" @@ -2561,28 +2129,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" @@ -2595,12 +2141,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" @@ -2734,15 +2274,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" @@ -2800,31 +2331,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" @@ -2853,12 +2365,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" @@ -2909,9 +2415,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.87" +version = "1.0.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3e4daa0dcf6feba26f985457cdf104d4b4256fc5a09547140f3631bb076b19a" +checksum = "7c3a7fc5db1e57d5a779a352c8cdb57b29aa4c40cc69c3a68a7fedc815fbf2f9" dependencies = [ "unicode-ident", ] @@ -2921,89 +2427,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.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00e89ce2565d6044ca31a3eb79a334c3a79a841120a98f64eea9f579564cb691" -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.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8afbaf3abd7325e08f35ffb8deb5892046fcb2608b703db6a583a5ba4cea01e" -dependencies = [ - "once_cell", - "target-lexicon", -] - -[[package]] -name = "pyo3-ffi" -version = "0.22.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec15a5ba277339d04763f4c23d85987a5b08cbb494860be141e6a10a8eb88022" -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.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15e0f01b5364bcfbb686a52fc4181d412b708a68ed20c330db9fc8d2c2bf5a43" -dependencies = [ - "proc-macro2", - "pyo3-macros-backend", - "quote", - "syn 2.0.79", -] - -[[package]] -name = "pyo3-macros-backend" -version = "0.22.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a09b550200e1e5ed9176976d0060cbc2ea82dc8515da07885e7b8153a85caacb" -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" @@ -3120,17 +2543,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" @@ -3213,15 +2625,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" @@ -3237,12 +2640,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" @@ -3290,9 +2687,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.14" +version = "0.23.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "415d9944693cb90382053259f89fbb077ea730ad7273047ec63b19bc9b160ba8" +checksum = "5fbb44d7acc4e873d613422379f69f237a1b141928c02f6bc6ccfddddc2d7993" dependencies = [ "once_cell", "ring", @@ -3326,9 +2723,9 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e696e35370c65c9c541198af4543ccd580cf17fc25d8e05c5a242b202488c55" +checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b" [[package]] name = "rustls-platform-verifier" @@ -3370,9 +2767,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" +checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" [[package]] name = "ryu" @@ -3406,7 +2803,6 @@ checksum = "09c024468a378b7e36765cd36702b7a90cc3cba11654f6685c8f233408e89e92" dependencies = [ "chrono", "dyn-clone", - "indexmap 1.9.3", "schemars_derive", "serde", "serde_json", @@ -3422,15 +2818,9 @@ dependencies = [ "proc-macro2", "quote", "serde_derive_internals", - "syn 2.0.79", + "syn 2.0.82", ] -[[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" @@ -3454,20 +2844,7 @@ checksum = "7f81c2fde025af7e69b1d1420531c8a8811ca898919db177141a85313b1cb932" dependencies = [ "proc-macro2", "quote", - "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", + "syn 2.0.82", ] [[package]] @@ -3546,7 +2923,7 @@ checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -3557,14 +2934,14 @@ checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] name = "serde_json" -version = "1.0.128" +version = "1.0.132" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" +checksum = "d726bfaff4b320266d395898905d0eba0345aae23b54aee3a737e260fd46db03" dependencies = [ "indexmap 2.6.0", "itoa", @@ -3592,16 +2969,7 @@ checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" dependencies = [ "proc-macro2", "quote", - "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", + "syn 2.0.82", ] [[package]] @@ -3643,20 +3011,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "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", + "syn 2.0.82", ] [[package]] @@ -3805,12 +3160,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" @@ -3842,7 +3191,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -3855,7 +3204,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -3885,9 +3234,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.79" +version = "2.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" +checksum = "83540f837a8afc019423a8edb95b52a8effe46957ee402287f4292fae35be021" dependencies = [ "proc-macro2", "quote", @@ -3903,32 +3252,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" @@ -3968,7 +3291,7 @@ checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -4061,7 +3384,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -4097,40 +3420,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" @@ -4205,7 +3494,7 @@ dependencies = [ "proc-macro2", "quote", "serde_derive_internals", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -4216,12 +3505,9 @@ checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "unicase" -version = "2.7.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89" -dependencies = [ - "version_check", -] +checksum = "7e51b68083f157f853b6379db119d1c1be0e6e4dec98101079dec41f6f5cf6df" [[package]] name = "unicode-bidi" @@ -4297,7 +3583,7 @@ dependencies = [ "paste", "serde", "textwrap", - "toml 0.5.11", + "toml", "uniffi_meta", "uniffi_udl", ] @@ -4320,7 +3606,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2c801f0f05b06df456a2da4c41b9c2c4fdccc6b9916643c6c67275c4c9e4d07" dependencies = [ "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -4352,8 +3638,8 @@ dependencies = [ "proc-macro2", "quote", "serde", - "syn 2.0.79", - "toml 0.5.11", + "syn 2.0.82", + "toml", "uniffi_meta", ] @@ -4395,18 +3681,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" @@ -4432,9 +3706,9 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "uuid" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314" +checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a" dependencies = [ "getrandom", "serde", @@ -4467,7 +3741,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -4531,7 +3805,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", "wasm-bindgen-shared", ] @@ -4565,7 +3839,7 @@ checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -4576,32 +3850,6 @@ version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" -[[package]] -name = "wasm-bindgen-test" -version = "0.3.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d381749acb0943d357dcbd8f0b100640679883fcdeeef04def49daf8d33a5426" -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.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c97b2ef2c8d627381e51c071c2ab328eac606d3f69dd82bcbca20a9e389d95f0" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.79", -] - [[package]] name = "web-sys" version = "0.3.72" @@ -4630,18 +3878,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" @@ -4860,21 +4096,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" @@ -4917,7 +4138,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] @@ -4938,7 +4159,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.79", + "syn 2.0.82", ] [[package]] diff --git a/README.md b/README.md index 14ca1f6..b972a67 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 9e09641..0000000 --- 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 158c380..0000000 --- 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 2d6961b..0000000 --- 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 d7384cd..0000000 --- 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 57ae9b9..0000000 --- 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 b5b8052..0000000 --- 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 8da635a..0000000 --- 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 faaa817..0000000 --- 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 832fa31..0000000 --- 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 b76d97a..0000000 --- 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 ec144db..0000000 --- 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 7a9deeb..0000000 --- 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 6fce8d0..0000000 --- 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 174d33d..0000000 --- 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 3da97e8..0000000 --- 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 9fc2367..0000000 --- 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 e9d496f..0000000 --- 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 57bb349..0000000 --- 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 88e3122..0000000 --- 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 e9d496f..0000000 --- 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 86843f8..0000000 --- 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 4650654..0000000 --- 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 e9d496f..0000000 --- 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 2963e9b..0000000 --- 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 ed3b62f..0000000 --- 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 e9d496f..0000000 --- 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 f486167..0000000 --- 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 5b2a931..0000000 --- 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 eaa8d34..0000000 --- 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 31cee63..0000000 --- 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 3a3765a..0000000 --- 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 36b0649..0000000 --- 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 f41d5c3..0000000 --- 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 37615d4..0000000 --- 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 f977e07..0000000 --- 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 b637d5f..0000000 --- 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 7c68298..0000000 --- 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 dace4a9..0000000 --- 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 31ffe04..0000000 --- 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 9c12a62..0000000 --- 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 a6cc8dc..0000000 --- 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 3e21b85..0000000 --- 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/Cargo.toml b/crates/bitwarden-wasm/Cargo.toml deleted file mode 100644 index b57a019..0000000 --- a/crates/bitwarden-wasm/Cargo.toml +++ /dev/null @@ -1,44 +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"] } -# 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] -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 6fa8870..0000000 --- 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 d49b12d..0000000 --- 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 e130705..0000000 --- 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 b79c47f..0000000 --- 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 f43c14f..0000000 --- a/crates/bitwarden/CHANGELOG.md +++ /dev/null @@ -1,85 +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] - -## [1.0.0] - 2024-09-26 - -### 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 3626f9d..0000000 --- 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 010a646..0000000 --- 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 163ccc2..0000000 --- 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 77a063f..0000000 --- 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 19b1010..0000000 --- a/crates/bws/CHANGELOG.md +++ /dev/null @@ -1,85 +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] - -## [1.0.0] - 2024-09-26 - -### Added - -- The ability to edit unassigned secrets with direct permissions. (#906) -- The `run` command, to run commands with secrets (#621) - -### Changed - -- Updated MSRV `1.75.0` (#980) -- Use state files by default. You can opt out of this behavior with the new `state_opt_out` key. - (#930) - - Opt out documentation can be found - [here](https://bitwarden.com/help/secrets-manager-cli/#config-state) - -### 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 08e3941..0000000 --- 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 07f9f3a..0000000 --- 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 50f4b12..0000000 --- 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 524a168..0000000 --- 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 be05623..0000000 --- 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 aeaa150..0000000 --- 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 daa5cf9..0000000 --- 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 6cd7fe0..0000000 --- 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 9c81e8b..0000000 --- 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 98287e4..0000000 --- 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 3b521e2..0000000 --- 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 6548778..0000000 --- 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 0f1aa39..0000000 --- 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 9fd9184..0000000 --- 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 e77c8fd..0000000 --- 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 bf0c26f..0000000 --- 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 b5756a0..0000000 --- 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 a86f0f5..0000000 --- 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 13a6648..0000000 --- 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 2db3ce5..0000000 --- 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 b75da5c..0000000 --- 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 e6ad7f4..0000000 --- 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 fb714a2..0000000 --- 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 f5ec6f6..0000000 --- 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 7790adf..0000000 --- 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 2910c49..0000000 --- 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 5fee787..0000000 --- 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 4d075ed..0000000 --- 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 9aa6cbe..0000000 --- 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 27511c3..0000000 --- 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 5c5a327..0000000 --- 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 2d11977..0000000 --- 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 0af5927..0000000 --- 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 032347f..0000000 --- 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 b2fa1c6..0000000 --- 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 1fff944..0000000 --- a/languages/cpp/src/Secrets.cpp +++ /dev/null @@ -1,230 +0,0 @@ -#include "Secrets.h" -#include -#include -#include -#include - -Secrets::Secrets(CommandRunner* commandRunner) : commandRunner(commandRunner) {} - -auto secretsDeserializer = [](const std::string& response) -> ResponseForSecretResponse { - nlohmann::json jsonResponse = nlohmann::json::parse(response); - ResponseForSecretResponse secretResponse; - Bitwarden::Sdk::from_json(jsonResponse, secretResponse); - return secretResponse; -}; - -auto secretsByIdsDeserializer = [](const std::string& response) -> ResponseForSecretsResponse { - nlohmann::json jsonResponse = nlohmann::json::parse(response); - ResponseForSecretsResponse secretsResponse; - Bitwarden::Sdk::from_json(jsonResponse, secretsResponse); - return secretsResponse; -}; - -auto deleteSecretsDeserializer = [](const std::string& response) -> ResponseForSecretsDeleteResponse { - nlohmann::json jsonResponse = nlohmann::json::parse(response); - ResponseForSecretsDeleteResponse deleteSecretsResponse; - Bitwarden::Sdk::from_json(jsonResponse, deleteSecretsResponse); - return deleteSecretsResponse; -}; - -auto secretListDeserializer = [](const std::string& response) -> ResponseForSecretIdentifiersResponse { - nlohmann::json jsonResponse = nlohmann::json::parse(response); - ResponseForSecretIdentifiersResponse listResponse; - Bitwarden::Sdk::from_json(jsonResponse, listResponse); - return listResponse; -}; - -auto secretsSyncDeserializer = [](const std::string& response) -> ResponseForSecretsSyncResponse { - nlohmann::json jsonResponse = nlohmann::json::parse(response); - ResponseForSecretsSyncResponse syncResponse; - Bitwarden::Sdk::from_json(jsonResponse, syncResponse); - return syncResponse; -}; - -SecretResponse Secrets::get(const boost::uuids::uuid& id) { - Command command; - SecretsCommand secretsCommand; - SecretGetRequest secretGetRequest; - - std::string idStr = boost::uuids::to_string(id); - secretGetRequest.set_id(idStr); - - secretsCommand.set_get(secretGetRequest); - command.set_secrets(secretsCommand); - - try { - return commandRunner->runCommand(command, secretsDeserializer); - } catch (const std::exception& ex) { - std::cerr << "Error in getSecret: " << ex.what() << std::endl; - throw ex; - } -} - -SecretsResponse Secrets::getByIds(const std::vector& ids) { - Command command; - SecretsCommand secretsCommand; - SecretsGetRequest secretsGetRequest; - - std::vector idsStr; - for (const auto& id : ids) { - idsStr.push_back(boost::uuids::to_string(id)); - } - secretsGetRequest.set_ids(idsStr); - - secretsCommand.set_get_by_ids(secretsGetRequest); - command.set_secrets(secretsCommand); - - try { - return commandRunner->runCommand(command, secretsByIdsDeserializer); - } catch (const std::exception& ex) { - std::cerr << "Error in getSecretsByIds: " << ex.what() << std::endl; - throw ex; - } -} - -SecretResponse Secrets::create(const boost::uuids::uuid& organizationId, const std::string& key, const std::string& value, const std::string& note, const std::vector& projectIds) { - Command command; - SecretsCommand secretsCommand; - SecretCreateRequest secretCreateRequest; - - std::string orgIdStr = boost::uuids::to_string(organizationId); - secretCreateRequest.set_organization_id(orgIdStr); - - secretCreateRequest.set_key(key); - secretCreateRequest.set_value(value); - secretCreateRequest.set_note(note); - - std::vector projectIdsStr; - for (const auto& projectId : projectIds) { - projectIdsStr.push_back(boost::uuids::to_string(projectId)); - } - secretCreateRequest.set_project_ids(projectIdsStr); - - secretsCommand.set_create(secretCreateRequest); - command.set_secrets(secretsCommand); - - try { - return commandRunner->runCommand(command, secretsDeserializer); - } catch (const std::exception& ex) { - std::cerr << "Error in createSecret: " << ex.what() << std::endl; - throw ex; - } -} - -SecretResponse Secrets::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) { - Command command; - SecretsCommand secretsCommand; - SecretPutRequest secretPutRequest; - - std::string idStr = boost::uuids::to_string(id); - secretPutRequest.set_id(idStr); - - std::string orgIdStr = boost::uuids::to_string(organizationId); - secretPutRequest.set_organization_id(orgIdStr); - - secretPutRequest.set_key(key); - secretPutRequest.set_value(value); - secretPutRequest.set_note(note); - - std::vector projectIdsStr; - for (const auto& projectId : projectIds) { - projectIdsStr.push_back(boost::uuids::to_string(projectId)); - } - secretPutRequest.set_project_ids(projectIdsStr); - - secretsCommand.set_update(secretPutRequest); - command.set_secrets(secretsCommand); - - try { - return commandRunner->runCommand(command, secretsDeserializer); - } catch (const std::exception& ex) { - std::cerr << "Error in updateSecret: " << ex.what() << std::endl; - throw ex; - } -} - -SecretsDeleteResponse Secrets::deleteSecrets(const std::vector& ids) { - Command command; - SecretsCommand secretsCommand; - SecretsDeleteRequest secretsDeleteRequest; - - std::vector idsStr; - for (const auto& id : ids) { - idsStr.push_back(boost::uuids::to_string(id)); - } - secretsDeleteRequest.set_ids(idsStr); - - secretsCommand.set_secrets_command_delete(secretsDeleteRequest); - command.set_secrets(secretsCommand); - - try { - return commandRunner->runCommand(command, deleteSecretsDeserializer); - } catch (const std::exception& ex) { - std::cerr << "Error in deleteSecrets: " << ex.what() << std::endl; - throw ex; - } -} - -SecretIdentifiersResponse Secrets::list(const boost::uuids::uuid& organizationId) { - Command command; - SecretsCommand secretsCommand; - SecretIdentifiersRequest secretIdentifiersRequest; - - std::string orgIdStr = boost::uuids::to_string(organizationId); - secretIdentifiersRequest.set_organization_id(orgIdStr); - - secretsCommand.set_list(secretIdentifiersRequest); - command.set_secrets(secretsCommand); - - try { - return commandRunner->runCommand(command, secretListDeserializer); - } catch (const std::exception& ex) { - std::cerr << "Error in listSecret: " << ex.what() << std::endl; - throw ex; - } -} - -SecretsSyncResponse Secrets::sync(const boost::uuids::uuid& organizationId, const boost::optional& lastSyncedDate) { - Command command; - SecretsCommand secretsCommand; - SecretsSyncRequest secretsSyncRequest; - - std::string orgIdStr = boost::uuids::to_string(organizationId); - secretsSyncRequest.set_organization_id(orgIdStr); - - if (lastSyncedDate.has_value()) { - auto timePoint = lastSyncedDate.value(); - - // Get time as time_t and milliseconds - auto timeT = std::chrono::system_clock::to_time_t(timePoint); - auto milliseconds = std::chrono::duration_cast(timePoint.time_since_epoch()) % 1000; - - // Convert to a tm struct - std::tm tm = *std::gmtime(&timeT); - - // Create a string stream to format the date and time - std::stringstream dateStream; - dateStream << std::put_time(&tm, "%Y-%m-%dT%H:%M:%S"); - - // Add milliseconds - dateStream << '.' << std::setw(3) << std::setfill('0') << milliseconds.count() << 'Z'; - - // Convert to string - std::string dateStr = dateStream.str(); - - // Set the last synced date - secretsSyncRequest.set_last_synced_date(dateStr); - } else { - secretsSyncRequest.set_last_synced_date(boost::none); - } - - secretsCommand.set_sync(secretsSyncRequest); - command.set_secrets(secretsCommand); - - try { - return commandRunner->runCommand(command, secretsSyncDeserializer); - } catch (const std::exception& ex) { - std::cerr << "Error in syncSecrets: " << ex.what() << std::endl; - throw ex; - } -} diff --git a/languages/cpp/vcpkg.json b/languages/cpp/vcpkg.json deleted file mode 100644 index 8e5b968..0000000 --- a/languages/cpp/vcpkg.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "name": "bitwarden-sdk-secrets", - "version": "0.1.0", - "homepage": "https://github.com/bitwarden/sdk/tree/languages/cpp", - "description": "Bitwarden Secrets Manager SDK for C++", - "dependencies": [ - "boost-uuid", - "boost-optional", - "nlohmann-json" - ] -} diff --git a/languages/csharp/.editorconfig b/languages/csharp/.editorconfig deleted file mode 100644 index 21d7ac4..0000000 --- a/languages/csharp/.editorconfig +++ /dev/null @@ -1,125 +0,0 @@ -# EditorConfig is awesome: http://EditorConfig.org - -# top-most EditorConfig file -root = true - -# Don't use tabs for indentation. -[*] -indent_style = space -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true -guidelines = 120 -# (Please don't specify an indent_size here; that has too many unintended consequences.) - -# Code files -[*.{cs,csx,vb,vbx}] -indent_size = 4 -charset = utf-8-bom - -# Xml project files -[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}] -indent_size = 2 - -# Xml config files -[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}] -indent_size = 2 - -# JSON files -[*.json] -indent_size = 2 - -# Dotnet code style settings: -[*.{cs,vb}] -# Sort using and Import directives with System.* appearing first -dotnet_sort_system_directives_first = true -# Avoid "this." and "Me." if not necessary -dotnet_style_qualification_for_field = false:suggestion -dotnet_style_qualification_for_property = false:suggestion -dotnet_style_qualification_for_method = false:suggestion -dotnet_style_qualification_for_event = false:suggestion - -# Use language keywords instead of framework type names for type references -dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion -dotnet_style_predefined_type_for_member_access = true:suggestion - -# Suggest more modern language features when available -dotnet_style_object_initializer = true:suggestion -dotnet_style_collection_initializer = true:suggestion -dotnet_style_coalesce_expression = true:suggestion -dotnet_style_null_propagation = true:suggestion -dotnet_style_explicit_tuple_names = true:suggestion - -# Prefix private members with underscore -dotnet_naming_rule.private_members_with_underscore.symbols = private_fields -dotnet_naming_rule.private_members_with_underscore.style = prefix_underscore -dotnet_naming_rule.private_members_with_underscore.severity = suggestion - -dotnet_naming_symbols.private_fields.applicable_kinds = field -dotnet_naming_symbols.private_fields.applicable_accessibilities = private - -dotnet_naming_style.prefix_underscore.capitalization = camel_case -dotnet_naming_style.prefix_underscore.required_prefix = _ - -# Async methods should have "Async" suffix -dotnet_naming_rule.async_methods_end_in_async.symbols = any_async_methods -dotnet_naming_rule.async_methods_end_in_async.style = end_in_async -dotnet_naming_rule.async_methods_end_in_async.severity = suggestion - -dotnet_naming_symbols.any_async_methods.applicable_kinds = method -dotnet_naming_symbols.any_async_methods.applicable_accessibilities = * -dotnet_naming_symbols.any_async_methods.required_modifiers = async - -dotnet_naming_style.end_in_async.required_prefix = -dotnet_naming_style.end_in_async.required_suffix = Async -dotnet_naming_style.end_in_async.capitalization = pascal_case -dotnet_naming_style.end_in_async.word_separator = - -# Obsolete warnings, this should be removed or changed to warning once we address some of the obsolete items. -dotnet_diagnostic.CS0618.severity = suggestion - -# Obsolete warnings, this should be removed or changed to warning once we address some of the obsolete items. -dotnet_diagnostic.CS0612.severity = suggestion - -# Remove unnecessary using directives https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0005 -dotnet_diagnostic.IDE0005.severity = warning - -# CSharp code style settings: -[*.cs] -# Prefer "var" everywhere -csharp_style_var_for_built_in_types = true:suggestion -csharp_style_var_when_type_is_apparent = true:suggestion -csharp_style_var_elsewhere = true:suggestion - -# Prefer method-like constructs to have a expression-body -csharp_style_expression_bodied_methods = true:none -csharp_style_expression_bodied_constructors = true:none -csharp_style_expression_bodied_operators = true:none - -# Prefer property-like constructs to have an expression-body -csharp_style_expression_bodied_properties = true:none -csharp_style_expression_bodied_indexers = true:none -csharp_style_expression_bodied_accessors = true:none - -# Suggest more modern language features when available -csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion -csharp_style_pattern_matching_over_as_with_null_check = true:suggestion -csharp_style_inlined_variable_declaration = true:suggestion -csharp_style_throw_expression = true:suggestion -csharp_style_conditional_delegate_call = true:suggestion - -# Newline settings -csharp_new_line_before_open_brace = all -csharp_new_line_before_else = true -csharp_new_line_before_catch = true -csharp_new_line_before_finally = true -csharp_new_line_before_members_in_object_initializers = true -csharp_new_line_before_members_in_anonymous_types = true - -# Namespace settings -csharp_style_namespace_declarations = file_scoped:warning - -# Switch expression -dotnet_diagnostic.CS8509.severity = error # missing switch case for named enum value -dotnet_diagnostic.CS8524.severity = none # missing switch case for unnamed enum value diff --git a/languages/csharp/Bitwarden.Sdk.Samples/Bitwarden.Sdk.Samples.csproj b/languages/csharp/Bitwarden.Sdk.Samples/Bitwarden.Sdk.Samples.csproj deleted file mode 100644 index 5b189d8..0000000 --- a/languages/csharp/Bitwarden.Sdk.Samples/Bitwarden.Sdk.Samples.csproj +++ /dev/null @@ -1,14 +0,0 @@ - - - - Exe - net6.0 - enable - enable - - - - - - - diff --git a/languages/csharp/Bitwarden.Sdk.Samples/Program.cs b/languages/csharp/Bitwarden.Sdk.Samples/Program.cs deleted file mode 100644 index e80d120..0000000 --- a/languages/csharp/Bitwarden.Sdk.Samples/Program.cs +++ /dev/null @@ -1,73 +0,0 @@ -using Bitwarden.Sdk; - -// Get environment variables -var identityUrl = Environment.GetEnvironmentVariable("IDENTITY_URL")!; -var apiUrl = Environment.GetEnvironmentVariable("API_URL")!; -var organizationId = Guid.Parse(Environment.GetEnvironmentVariable("ORGANIZATION_ID")!); -var accessToken = Environment.GetEnvironmentVariable("ACCESS_TOKEN")!; -var stateFile = Environment.GetEnvironmentVariable("STATE_FILE")!; - -// Create the SDK Client -using var bitwardenClient = new BitwardenClient(new BitwardenSettings -{ - ApiUrl = apiUrl, - IdentityUrl = identityUrl -}); - -// Authenticate -bitwardenClient.Auth.LoginAccessToken(accessToken, stateFile); - -// Projects List -var projectsList = bitwardenClient.Projects.List(organizationId).Data; -Console.WriteLine("A list of all projects:"); -foreach (ProjectResponse pr in projectsList) -{ - Console.WriteLine(" Project: " + pr.Name); -} - -Console.Write("Press enter to continue..."); -Console.ReadLine(); - -// Projects Create, Update, & Get -Console.WriteLine("Creating and updating a project"); -var projectResponse = bitwardenClient.Projects.Create(organizationId, "NewTestProject"); -projectResponse = bitwardenClient.Projects.Update(organizationId, projectResponse.Id, "NewTestProject Renamed"); -projectResponse = bitwardenClient.Projects.Get(projectResponse.Id); -Console.WriteLine("Here is the project we created and updated:"); -Console.WriteLine(projectResponse.Name); - -Console.Write("Press enter to continue..."); -Console.ReadLine(); - -// Secrets list -var secretsList = bitwardenClient.Secrets.List(organizationId).Data; -Console.WriteLine("A list of all secrets:"); -foreach (SecretIdentifierResponse sr in secretsList) -{ - Console.WriteLine(" Secret: " + sr.Key); -} - -Console.Write("Press enter to continue..."); -Console.ReadLine(); - -// Secrets Create, Update, Get -Console.WriteLine("Creating and updating a secret"); -var secretResponse = bitwardenClient.Secrets.Create(organizationId, "New Secret", "the secret value", "the secret note", new[] { projectResponse.Id }); -secretResponse = bitwardenClient.Secrets.Update(organizationId, secretResponse.Id, "New Secret Name", "the secret value", "the secret note", new[] { projectResponse.Id }); -secretResponse = bitwardenClient.Secrets.Get(secretResponse.Id); -Console.WriteLine("Here is the secret we created and updated:"); -Console.WriteLine(secretResponse.Key); - -Console.Write("Press enter to continue..."); -Console.ReadLine(); - -// Secrets GetByIds -var secretsResponse = bitwardenClient.Secrets.GetByIds(new[] { secretResponse.Id }); - -// Secrets Sync -var syncResponse = bitwardenClient.Secrets.Sync(organizationId, null); - -// Secrets & Projects Delete -Console.WriteLine("Deleting our secret and project"); -bitwardenClient.Secrets.Delete(new[] { secretResponse.Id }); -bitwardenClient.Projects.Delete(new[] { projectResponse.Id }); diff --git a/languages/csharp/Bitwarden.Sdk/AuthClient.cs b/languages/csharp/Bitwarden.Sdk/AuthClient.cs deleted file mode 100644 index e801f2a..0000000 --- a/languages/csharp/Bitwarden.Sdk/AuthClient.cs +++ /dev/null @@ -1,21 +0,0 @@ -namespace Bitwarden.Sdk; - -public class AuthClient -{ - private readonly CommandRunner _commandRunner; - - internal AuthClient(CommandRunner commandRunner) - { - _commandRunner = commandRunner; - } - - public void LoginAccessToken(string accessToken, string stateFile = "") - { - var command = new Command { LoginAccessToken = new AccessTokenLoginRequest { AccessToken = accessToken, StateFile = stateFile } }; - var response = _commandRunner.RunCommand(command); - if (response is not { Success: true }) - { - throw new BitwardenAuthException(response != null ? response.ErrorMessage : "Login failed"); - } - } -} diff --git a/languages/csharp/Bitwarden.Sdk/Bitwarden.Sdk.csproj b/languages/csharp/Bitwarden.Sdk/Bitwarden.Sdk.csproj deleted file mode 100644 index a7c82e4..0000000 --- a/languages/csharp/Bitwarden.Sdk/Bitwarden.Sdk.csproj +++ /dev/null @@ -1,77 +0,0 @@ - - - - net6.0 - enable - enable - Bitwarden.Sdk - - Bitwarden Secrets Manager SDK - Bitwarden Inc. - .NET bindings for interacting with the Bitwarden Secrets Manager - Bitwarden Inc. - SDK - - https://github.com/bitwarden/sdk/tree/main/languages/csharp - Git - - https://bitwarden.com/products/secrets-manager/ - Bitwarden.Secrets.Sdk - bitwarden.png - Bitwarden;Secrets Manager;Sdk;.NET - README.md - LICENSE.txt - 0.1.0 - - - - - - - - - - - - - - - 4 - - - - Always - true - - - Always - true - - - Always - true - - - - - Always - true - runtimes/osx-x64/native - - - Always - true - runtimes/osx-arm64/native - - - Always - true - runtimes/linux-x64/native - - - Always - true - runtimes/win-x64/native - - - \ No newline at end of file diff --git a/languages/csharp/Bitwarden.Sdk/BitwardenAuthException.cs b/languages/csharp/Bitwarden.Sdk/BitwardenAuthException.cs deleted file mode 100644 index 7bb9f87..0000000 --- a/languages/csharp/Bitwarden.Sdk/BitwardenAuthException.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace Bitwarden.Sdk; - -public class BitwardenAuthException : Exception -{ - public BitwardenAuthException(string message) : base(message) - { - } - - public BitwardenAuthException(string message, Exception innerException) - : base(message, innerException) - { - } -} diff --git a/languages/csharp/Bitwarden.Sdk/BitwardenClient.cs b/languages/csharp/Bitwarden.Sdk/BitwardenClient.cs deleted file mode 100644 index 2f10e0c..0000000 --- a/languages/csharp/Bitwarden.Sdk/BitwardenClient.cs +++ /dev/null @@ -1,31 +0,0 @@ -namespace Bitwarden.Sdk; - -public sealed class BitwardenClient : IDisposable -{ - private readonly CommandRunner _commandRunner; - private readonly BitwardenSafeHandle _handle; - - public BitwardenClient(BitwardenSettings? settings = null) - { - var clientSettings = new ClientSettings - { - ApiUrl = settings?.ApiUrl!, - IdentityUrl = settings?.IdentityUrl!, - UserAgent = "Bitwarden DOTNET-SDK" - }; - - _handle = BitwardenLibrary.Init(clientSettings.ToJson()); - _commandRunner = new CommandRunner(_handle); - Projects = new ProjectsClient(_commandRunner); - Secrets = new SecretsClient(_commandRunner); - Auth = new AuthClient(_commandRunner); - } - - public ProjectsClient Projects { get; } - - public SecretsClient Secrets { get; } - - public AuthClient Auth { get; set; } - - public void Dispose() => _handle.Dispose(); -} diff --git a/languages/csharp/Bitwarden.Sdk/BitwardenException.cs b/languages/csharp/Bitwarden.Sdk/BitwardenException.cs deleted file mode 100644 index 1cf6aba..0000000 --- a/languages/csharp/Bitwarden.Sdk/BitwardenException.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace Bitwarden.Sdk; - -public class BitwardenException : Exception -{ - public BitwardenException(string message) : base(message) - { - } - - public BitwardenException(string message, Exception innerException) - : base(message, innerException) - { - } -} diff --git a/languages/csharp/Bitwarden.Sdk/BitwardenLibrary.cs b/languages/csharp/Bitwarden.Sdk/BitwardenLibrary.cs deleted file mode 100644 index ada3994..0000000 --- a/languages/csharp/Bitwarden.Sdk/BitwardenLibrary.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.Runtime.InteropServices; - -namespace Bitwarden.Sdk; - -internal static class BitwardenLibrary -{ - [DllImport("bitwarden_c", CallingConvention = CallingConvention.Cdecl)] - private static extern BitwardenSafeHandle init(string settings); - - [DllImport("bitwarden_c", CallingConvention = CallingConvention.Cdecl)] - private static extern void free_mem(IntPtr handle); - - [DllImport("bitwarden_c", CallingConvention = CallingConvention.Cdecl)] - private static extern string run_command(string json, BitwardenSafeHandle handle); - - internal static BitwardenSafeHandle Init(string settings) => init(settings); - - internal static void FreeMemory(IntPtr handle) => free_mem(handle); - - internal static string RunCommand(string json, BitwardenSafeHandle handle) => run_command(json, handle); -} diff --git a/languages/csharp/Bitwarden.Sdk/BitwardenSafeHandle.cs b/languages/csharp/Bitwarden.Sdk/BitwardenSafeHandle.cs deleted file mode 100644 index 7939aab..0000000 --- a/languages/csharp/Bitwarden.Sdk/BitwardenSafeHandle.cs +++ /dev/null @@ -1,17 +0,0 @@ -using Microsoft.Win32.SafeHandles; - -namespace Bitwarden.Sdk; - -internal class BitwardenSafeHandle : SafeHandleZeroOrMinusOneIsInvalid -{ - public BitwardenSafeHandle() : base(true) - { - SetHandle(handle); - } - - protected override bool ReleaseHandle() - { - BitwardenLibrary.FreeMemory(handle); - return true; - } -} diff --git a/languages/csharp/Bitwarden.Sdk/BitwardenSettings.cs b/languages/csharp/Bitwarden.Sdk/BitwardenSettings.cs deleted file mode 100644 index a7ccdcd..0000000 --- a/languages/csharp/Bitwarden.Sdk/BitwardenSettings.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace Bitwarden.Sdk; - -public class BitwardenSettings -{ - /// - /// The api url of the targeted Bitwarden instance. Defaults to `https://api.bitwarden.com` - /// - public string? ApiUrl { get; set; } - - /// - /// The identity url of the targeted Bitwarden instance. Defaults to `https://identity.bitwarden.com` - /// - public string? IdentityUrl { get; set; } -} diff --git a/languages/csharp/Bitwarden.Sdk/CommandRunner.cs b/languages/csharp/Bitwarden.Sdk/CommandRunner.cs deleted file mode 100644 index fbd6b7e..0000000 --- a/languages/csharp/Bitwarden.Sdk/CommandRunner.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.Text.Json; - -namespace Bitwarden.Sdk; - -internal class CommandRunner -{ - private readonly BitwardenSafeHandle _handle; - - internal CommandRunner(BitwardenSafeHandle handle) - { - _handle = handle; - } - - internal T? RunCommand(Command command) - { - var req = JsonSerializer.Serialize(command, Converter.Settings); - var result = BitwardenLibrary.RunCommand(req, _handle); - return JsonSerializer.Deserialize(result, Converter.Settings); - } -} diff --git a/languages/csharp/Bitwarden.Sdk/ProjectsClient.cs b/languages/csharp/Bitwarden.Sdk/ProjectsClient.cs deleted file mode 100644 index 47a4193..0000000 --- a/languages/csharp/Bitwarden.Sdk/ProjectsClient.cs +++ /dev/null @@ -1,94 +0,0 @@ -namespace Bitwarden.Sdk; - -public class ProjectsClient -{ - private readonly CommandRunner _commandRunner; - - internal ProjectsClient(CommandRunner commandRunner) - { - _commandRunner = commandRunner; - } - - public ProjectResponse Get(Guid id) - { - var command = new Command { Projects = new ProjectsCommand { Get = new ProjectGetRequest { Id = id } } }; - var result = _commandRunner.RunCommand(command); - - if (result is { Success: true }) - { - return result.Data; - } - - throw new BitwardenException(result != null ? result.ErrorMessage : "Project not found"); - } - - public ProjectResponse Create(Guid organizationId, string name) - { - var command = new Command - { - Projects = new ProjectsCommand - { - Create = new ProjectCreateRequest { OrganizationId = organizationId, Name = name } - } - }; - var result = _commandRunner.RunCommand(command); - - if (result is { Success: true }) - { - return result.Data; - } - - throw new BitwardenException(result != null ? result.ErrorMessage : "Project create failed"); - } - - public ProjectResponse Update(Guid organizationId, Guid id, string name) - { - var command = new Command - { - Projects = new ProjectsCommand - { - Update = new ProjectPutRequest { Id = id, OrganizationId = organizationId, Name = name } - } - }; - var result = _commandRunner.RunCommand(command); - - if (result is { Success: true }) - { - return result.Data; - } - - throw new BitwardenException(result != null ? result.ErrorMessage : "Project update failed"); - } - - public ProjectsDeleteResponse Delete(Guid[] ids) - { - var command = new Command - { - Projects = new ProjectsCommand { Delete = new ProjectsDeleteRequest { Ids = ids } } - }; - var result = _commandRunner.RunCommand(command); - - if (result is { Success: true }) - { - return result.Data; - } - - throw new BitwardenException(result != null ? result.ErrorMessage : "Project delete failed"); - } - - public ProjectsResponse List(Guid organizationId) - { - var command = new Command - { - Projects = new ProjectsCommand { List = new ProjectsListRequest { OrganizationId = organizationId } } - }; - var result = _commandRunner.RunCommand(command); - - if (result is { Success: true }) - { - return result.Data; - } - - throw new BitwardenException(result != null ? result.ErrorMessage : "No projects for given organization"); - } -} diff --git a/languages/csharp/Bitwarden.Sdk/SecretsClient.cs b/languages/csharp/Bitwarden.Sdk/SecretsClient.cs deleted file mode 100644 index 5dd77fc..0000000 --- a/languages/csharp/Bitwarden.Sdk/SecretsClient.cs +++ /dev/null @@ -1,145 +0,0 @@ -namespace Bitwarden.Sdk; - -public class SecretsClient -{ - private readonly CommandRunner _commandRunner; - - internal SecretsClient(CommandRunner commandRunner) - { - _commandRunner = commandRunner; - } - - public SecretResponse Get(Guid id) - { - var command = new Command { Secrets = new SecretsCommand { Get = new SecretGetRequest { Id = id } } }; - var result = _commandRunner.RunCommand(command); - - if (result is { Success: true }) - { - return result.Data; - } - - throw new BitwardenException(result != null ? result.ErrorMessage : "Secret not found"); - } - - public SecretsResponse GetByIds(Guid[] ids) - { - var command = new Command { Secrets = new SecretsCommand { GetByIds = new SecretsGetRequest { Ids = ids } } }; - var result = _commandRunner.RunCommand(command); - - if (result is { Success: true }) - { - return result.Data; - } - - throw new BitwardenException(result != null ? result.ErrorMessage : "Secret not found"); - } - - public SecretResponse Create(Guid organizationId, string key, string value, string note, Guid[] projectIds) - { - var command = new Command - { - Secrets = new SecretsCommand - { - Create = new SecretCreateRequest - { - Key = key, - Value = value, - Note = note, - OrganizationId = organizationId, - ProjectIds = projectIds - } - } - }; - - var result = _commandRunner.RunCommand(command); - - if (result is { Success: true }) - { - return result.Data; - } - - throw new BitwardenException(result != null ? result.ErrorMessage : "Secret create failed"); - } - - public SecretResponse Update(Guid organizationId, Guid id, string key, string value, string note, Guid[] projectIds) - { - var command = new Command - { - Secrets = new SecretsCommand - { - Update = new SecretPutRequest - { - Id = id, - Key = key, - Value = value, - Note = note, - OrganizationId = organizationId, - ProjectIds = projectIds - } - } - }; - - var result = _commandRunner.RunCommand(command); - - if (result is { Success: true }) - { - return result.Data; - } - - throw new BitwardenException(result != null ? result.ErrorMessage : "Secret update failed"); - } - - public SecretsDeleteResponse Delete(Guid[] ids) - { - var command = new Command { Secrets = new SecretsCommand { Delete = new SecretsDeleteRequest { Ids = ids } } }; - var result = _commandRunner.RunCommand(command); - - if (result is { Success: true }) - { - return result.Data; - } - - throw new BitwardenException(result != null ? result.ErrorMessage : "Secrets delete failed"); - } - - public SecretIdentifiersResponse List(Guid organizationId) - { - var command = new Command - { - Secrets = new SecretsCommand { List = new SecretIdentifiersRequest { OrganizationId = organizationId } } - }; - var result = _commandRunner.RunCommand(command); - - if (result is { Success: true }) - { - return result.Data; - } - - throw new BitwardenException(result != null ? result.ErrorMessage : "No secrets for given organization"); - } - - public SecretsSyncResponse Sync(Guid organizationId, DateTimeOffset? lastSyncedDate) - { - var command = new Command - { - Secrets = new SecretsCommand - { - Sync = new SecretsSyncRequest - { - OrganizationId = organizationId, - LastSyncedDate = lastSyncedDate - } - } - }; - - var result = _commandRunner.RunCommand(command); - - if (result is { Success: true }) - { - return result.Data; - } - - throw new BitwardenException(result != null ? result.ErrorMessage : "Secret update failed"); - } -} diff --git a/languages/csharp/Bitwarden.Sdk/bitwarden.png b/languages/csharp/Bitwarden.Sdk/bitwarden.png deleted file mode 100644 index 681629a..0000000 Binary files a/languages/csharp/Bitwarden.Sdk/bitwarden.png and /dev/null differ diff --git a/languages/csharp/Bitwarden.sln b/languages/csharp/Bitwarden.sln deleted file mode 100644 index 4cf8d14..0000000 --- a/languages/csharp/Bitwarden.sln +++ /dev/null @@ -1,22 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bitwarden.Sdk", "Bitwarden.Sdk\Bitwarden.Sdk.csproj", "{DADE59E5-E573-430A-8EB2-BC21D8E8C1D3}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bitwarden.Sdk.Samples", "Bitwarden.Sdk.Samples\Bitwarden.Sdk.Samples.csproj", "{CA9F8EDC-643F-4624-AC00-F741E1F30CA4}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {DADE59E5-E573-430A-8EB2-BC21D8E8C1D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {DADE59E5-E573-430A-8EB2-BC21D8E8C1D3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DADE59E5-E573-430A-8EB2-BC21D8E8C1D3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {DADE59E5-E573-430A-8EB2-BC21D8E8C1D3}.Release|Any CPU.Build.0 = Release|Any CPU - {CA9F8EDC-643F-4624-AC00-F741E1F30CA4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CA9F8EDC-643F-4624-AC00-F741E1F30CA4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CA9F8EDC-643F-4624-AC00-F741E1F30CA4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CA9F8EDC-643F-4624-AC00-F741E1F30CA4}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection -EndGlobal diff --git a/languages/csharp/LICENSE.txt b/languages/csharp/LICENSE.txt deleted file mode 100644 index e9d496f..0000000 --- a/languages/csharp/LICENSE.txt +++ /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/languages/csharp/README.md b/languages/csharp/README.md deleted file mode 100644 index ece863f..0000000 --- a/languages/csharp/README.md +++ /dev/null @@ -1,89 +0,0 @@ -# Bitwarden Secrets Manager SDK - -.NET 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 - -### Create new Bitwarden client - -```csharp -const string accessToken = ""; -const string stateFile = ""; - -using var bitwardenClient = new BitwardenClient(new BitwardenSettings -{ - ApiUrl = apiUrl, - IdentityUrl = identityUrl -}); - -bitwardenClient.LoginAccessToken(accessToken, stateFile); -``` - -### Create new project - -```csharp -var organizationId = Guid.Parse(""); -var projectResponse = bitwardenClient.Projects().Create(organizationId, "TestProject"); -``` - -### List all projects - -```csharp -var response = bitwardenClient.Projects.List(organizationId); -``` - -### Update project - -```csharp -var projectId = projectResponse.Id; -projectResponse = bitwardenClient.Projects.Get(projectId); -projectResponse = bitwardenClient.Projects.Update(organizationId, projectId, "TestProjectUpdated"); -``` - -### Add new secret - -```csharp -var key = "key"; -var value = "value"; -var note = "note"; -var secretResponse = bitwardenClient.Secrets.Create(organizationId, key, value, note, new[] { projectId }); -``` - -### Update secret -```csharp -var secretId = secretResponse.Id; -secretResponse = bitwardenClient.Secrets.Get(secretId); -secretResponse = bitwardenClient.Secrets.Update(organizationId, secretId, "key2", "value2", "note2", new[] { projectId }); -``` - -### Secret GetByIds - -```csharp -var secretsResponse = bitwardenClient.Secrets.GetByIds(new[] { secretResponse.Id }); -``` - -### List secrets - -```csharp -var secretIdentifiersResponse = bitwardenClient.Secrets.List(organizationId); -``` - -### Sync secrets - -```csharp -var syncResponse = bitwardenClient.Secrets.Sync(organizationId, null); -``` - -# Delete secret or project - -```csharp -bitwardenClient.Secrets.Delete(new [] { secretId }); -bitwardenClient.Projects.Delete(new [] { projectId }); -``` - -[Access Tokens]: https://bitwarden.com/help/access-tokens/ -[Bitwarden Secrets Manager]: https://bitwarden.com/products/secrets-manager/ diff --git a/languages/csharp/global.json b/languages/csharp/global.json deleted file mode 100644 index 391ba3c..0000000 --- a/languages/csharp/global.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "sdk": { - "version": "8.0.100", - "rollForward": "latestFeature" - } -} diff --git a/languages/go/.version b/languages/go/.version deleted file mode 100644 index e6d5cb8..0000000 --- a/languages/go/.version +++ /dev/null @@ -1 +0,0 @@ -1.0.2 \ No newline at end of file diff --git a/languages/go/INSTRUCTIONS.md b/languages/go/INSTRUCTIONS.md deleted file mode 100644 index 1c97024..0000000 --- a/languages/go/INSTRUCTIONS.md +++ /dev/null @@ -1,150 +0,0 @@ -# Instructions - -This guide is for developers who want to use the Bitwarden Go SDK module in their own Go projects. Please see the main [README](./README.md) and [example.go](./example/example.go) file for examples. - -## Supported Targets - -The Bitwarden Go SDK module utilizes FFI calls to the Bitwarden Rust SDK via [cgo](https://pkg.go.dev/cmd/cgo). The module supports the following statically linked targets: - -- Linux `x86-64` & `arm64` -- macOS `x86-64` & `arm64` -- Windows `x86-64` - -## Linux - -### Prerequisites - -- [Go](https://go.dev/dl) -- A C toolchain - -We recommend the [MUSL toolchain](https://musl.libc.org). You can install this on most debian based systems with: - -```shell -sudo apt install musl-tools -``` - -### Set Go Environment Info - -#### Enable cgo - -```shell -go env -w CGO_ENABLED=1 -``` - -#### Set the C compiler - -```shell -go env -w CC=musl-gcc -``` - -#### Verify -```shell -go env -``` - -### Install the Bitwarden Go SDK - -#### Adding the Module - -```shell -go get github.com/bitwarden/sdk-go -``` - -#### Build - -```shell -go build -ldflags '-linkmode external -extldflags "-static -Wl,-unresolved-symbols=ignore-all"' -``` - -## macOS - -### Prerequisites - -- [Go](https://go.dev/dl) -- A C toolchain - -[Clang](https://clang.llvm.org/get_started.html) is the default C and C++ toolchain on Mac OS. The easiest way to ensure you have the toolchain is to install the Xcode Command Line tools. - -You can install Clang with: - - -```shell -xcode-select --install -``` - -### Set Go Environment Info - -#### Enable cgo - -```shell -go env -w CGO_ENABLED=1 -``` - -#### Set the C & C++ compilers - -```shell -go env -w CC=clang CXX=clang++ -``` - -#### Verify -```shell -go env -``` - -### Install the Bitwarden Go SDK - -#### Adding the Module - -```shell -go get github.com/bitwarden/sdk-go -``` - -#### Build - -```shell -go build -``` - -## Windows - -### Prerequisites - -- [Go](https://go.dev/dl) -- [GCC](https://gcc.gnu.org) - -Go [documentation](https://go.dev/wiki/cgo) recommends the mingw-w64 gcc compiler. - -We recommend following the Visual Studio Code [guide](https://code.visualstudio.com/docs/cpp/config-mingw#_installing-the-mingww64-toolchain) for installing the mingw-w64 toolchain. - -### Set Go Environment Info - -#### Enable cgo - -```shell -go env -w CGO_ENABLED=1 -``` - -#### Set the C & C++ compilers - -```shell -go env -w CC=gcc CXX=g++ -``` - -#### Verify -```shell -go env -``` - -### Install the Bitwarden Go SDK - -#### Adding the Module - -```shell -go get github.com/bitwarden/sdk-go -``` - -#### Build - -```shell -go build -``` diff --git a/languages/go/README.md b/languages/go/README.md deleted file mode 100644 index 8332f5d..0000000 --- a/languages/go/README.md +++ /dev/null @@ -1,143 +0,0 @@ -# Bitwarden SDK in Go - -This SDK is designed to interact with Bitwarden services in Go. It includes implementations for -managing projects and secrets, as well as a client interface to facilitate operations like login. - -## Prerequisites - -- Go installed -- C environment to run CGO - -## Installation - -Follow the installation instructions [here](./INSTRUCTIONS.md). - -## Table of Contents - -- [Initialization](#initialization) -- [Login](#login) -- [Projects](#projects) -- [Secrets](#secrets) -- [Close Client](#close-client) - ---- - -### Initialization - -To initialize the client, you need to import the SDK and create a new `BitwardenClient` instance. - -```go -import "github.com/bitwarden/sdk-go" - -bitwardenClient, _ := sdk.NewBitwardenClient(&apiURL, &identityURL) -``` - ---- - -### Login - -To login using an access token. Define some `stateFile` and pass it to use state, or pass `nil` -instead to not use state. - -```go -stateFile := os.Getenv("STATE_FILE") - -err := bitwardenClient.AccessTokenLogin(accessToken, &stateFile) -``` - ---- - -### Projects - -#### Create a Project - -```go -project, err := bitwardenClient.Projects().Create("organization_id", "project_name") -``` - -#### List Projects - -```go -projects, err := bitwardenClient.Projects().List("organization_id") -``` - -#### Get a Project - -```go -project, err := bitwardenClient.Projects().Get("project_id") -``` - -#### Update a Project - -```go -project, err := bitwardenClient.Projects().Update("project_id", "organization_id", "new_project_name") -``` - -#### Delete Projects - -```go -project, err := bitwardenClient.Projects().Delete([]string{"project_id_1", "project_id_2"}) -``` - ---- - -### Secrets - -#### Create a Secret - -```go -secret, err := bitwardenClient.Secrets().Create("key", "value", "note", "organization_id", []string{"project_id"}) -``` - -#### List Secrets - -```go -secrets, err := bitwardenClient.Secrets().List("organization_id") -``` - -#### Get a Secret - -```go -secret, err := bitwardenClient.Secrets().Get("secret_id") -``` - -#### Get Multiple Secrets by IDs - -```go -secrets, err := bitwardenClient.Secrets().GetByIDS([]string{"secret_ids"}) -``` - -#### Update a Secret - -```go -secret, err := bitwardenClient.Secrets().Update("secret_id", "new_key", "new_value", "new_note", "organization_id", []string{"project_id"}) -``` - -#### Delete Secrets - -```go -secret, err := bitwardenClient.Secrets().Delete([]string{"secret_id_1", "secret_id_2"}) -``` - -#### Secrets Sync - -```go -secretsSync, err := bitwardenClient.Secrets().Sync("organization_id", nil) - -lastSyncedDate := time.Now() -secretsSync, err = bitwardenClient.Secrets().Sync("organization_id", lastSyncedDate) -``` - ---- - -### Close Client - -To free up resources: - -```go -defer bitwardenClient.Close() -``` - ---- - -For more detailed information, refer to the code comments and method signatures. diff --git a/languages/go/bitwarden_client.go b/languages/go/bitwarden_client.go deleted file mode 100644 index 121eda0..0000000 --- a/languages/go/bitwarden_client.go +++ /dev/null @@ -1,85 +0,0 @@ -package sdk - -import ( - "encoding/json" - - "github.com/bitwarden/sdk-go/internal/cinterface" -) - -type BitwardenClientInterface interface { - AccessTokenLogin(accessToken string, stateFile *string) error - Projects() ProjectsInterface - Secrets() SecretsInterface - Generators() GeneratorsInterface - Close() -} - -type BitwardenClient struct { - client cinterface.ClientPointer - lib cinterface.BitwardenLibrary - commandRunner CommandRunnerInterface - projects ProjectsInterface - secrets SecretsInterface - generators GeneratorsInterface -} - -func NewBitwardenClient(apiURL *string, identityURL *string) (BitwardenClientInterface, error) { - deviceType := DeviceType("SDK") - userAgent := "Bitwarden GOLANG-SDK" - clientSettings := ClientSettings{ - APIURL: apiURL, - IdentityURL: identityURL, - UserAgent: &userAgent, - DeviceType: &deviceType, - } - - settingsJSON, err := json.Marshal(clientSettings) - if err != nil { - return nil, err - } - - lib := cinterface.NewBitwardenLibrary() - client, err := lib.Init(string(settingsJSON)) - if err != nil { - return nil, err - } - runner := NewCommandRunner(client, lib) - - return &BitwardenClient{ - lib: lib, - client: client, - commandRunner: runner, - projects: NewProjects(runner), - secrets: NewSecrets(runner), - generators: NewGenerators(runner), - }, nil -} - -func (c *BitwardenClient) AccessTokenLogin(accessToken string, stateFile *string) error { - req := AccessTokenLoginRequest{AccessToken: accessToken, StateFile: stateFile} - command := Command{LoginAccessToken: &req} - - responseStr, err := c.commandRunner.RunCommand(command) - if err != nil { - return err - } - - var response APIKeyLoginResponse - return checkSuccessAndError(responseStr, &response) -} - -func (c *BitwardenClient) Projects() ProjectsInterface { - return c.projects -} - -func (c *BitwardenClient) Secrets() SecretsInterface { - return c.secrets -} - -func (c *BitwardenClient) Generators() GeneratorsInterface { - return c.generators -} - -func (c *BitwardenClient) Close() { - c.lib.FreeMem(c.client) -} diff --git a/languages/go/command_runner.go b/languages/go/command_runner.go deleted file mode 100644 index 1bbe09a..0000000 --- a/languages/go/command_runner.go +++ /dev/null @@ -1,37 +0,0 @@ -package sdk - -import ( - "encoding/json" - - "github.com/bitwarden/sdk-go/internal/cinterface" -) - -type CommandRunnerInterface interface { - RunCommand(command Command) (string, error) -} - -type CommandRunner struct { - client cinterface.ClientPointer - lib cinterface.BitwardenLibrary -} - -func NewCommandRunner(client cinterface.ClientPointer, lib cinterface.BitwardenLibrary) *CommandRunner { - return &CommandRunner{ - client: client, - lib: lib, - } -} - -func (c *CommandRunner) RunCommand(command Command) (string, error) { - commandJSON, err := json.Marshal(command) - if err != nil { - return "", err - } - - responseStr, err := c.lib.RunCommand(string(commandJSON), c.client) - if err != nil { - return "", err - } - - return responseStr, nil -} diff --git a/languages/go/example/example.go b/languages/go/example/example.go deleted file mode 100644 index 06cfcd4..0000000 --- a/languages/go/example/example.go +++ /dev/null @@ -1,137 +0,0 @@ -package main - -import ( - "encoding/json" - "fmt" - "log" - "os" - - sdk "github.com/bitwarden/sdk-go" - "github.com/gofrs/uuid" -) - -func main() { - // Configuring the URLS is optional, set them to nil to use the default values - apiURL := os.Getenv("API_URL") - identityURL := os.Getenv("IDENTITY_URL") - - bitwardenClient, _ := sdk.NewBitwardenClient(&apiURL, &identityURL) - - accessToken := os.Getenv("ACCESS_TOKEN") - organizationIDStr := os.Getenv("ORGANIZATION_ID") - projectName := os.Getenv("PROJECT_NAME") - - // Configuring the stateFile is optional, pass nil - // in AccessTokenLogin() to not use state - stateFile := os.Getenv("STATE_FILE") - - if projectName == "" { - projectName = "NewTestProject" // default value - } - - err := bitwardenClient.AccessTokenLogin(accessToken, &stateFile) - if err != nil { - panic(err) - } - - organizationID, err := uuid.FromString(organizationIDStr) - if err != nil { - panic(err) - } - - project, err := bitwardenClient.Projects().Create(organizationID.String(), projectName) - if err != nil { - panic(err) - } - fmt.Println(project) - projectID := project.ID - fmt.Println(projectID) - - if _, err = bitwardenClient.Projects().List(organizationID.String()); err != nil { - panic(err) - } - - if _, err = bitwardenClient.Projects().Get(projectID); err != nil { - panic(err) - } - - if _, err = bitwardenClient.Projects().Update(projectID, organizationID.String(), projectName+"2"); err != nil { - panic(err) - } - - key := "key" - value := "value" - note := "note" - - secret, err := bitwardenClient.Secrets().Create(key, value, note, organizationID.String(), []string{projectID}) - if err != nil { - panic(err) - } - secretID := secret.ID - - if _, err = bitwardenClient.Secrets().List(organizationID.String()); err != nil { - panic(err) - } - - if _, err = bitwardenClient.Secrets().Get(secretID); err != nil { - panic(err) - } - - if _, err = bitwardenClient.Secrets().Update(secretID, key, value, note, organizationID.String(), []string{projectID}); err != nil { - panic(err) - } - - if _, err = bitwardenClient.Secrets().Delete([]string{secretID}); err != nil { - panic(err) - } - - if _, err = bitwardenClient.Projects().Delete([]string{projectID}); err != nil { - panic(err) - } - - secretIdentifiers, err := bitwardenClient.Secrets().List(organizationID.String()) - if err != nil { - panic(err) - } - - // Get secrets with a list of IDs - secretIDs := make([]string, len(secretIdentifiers.Data)) - for i, identifier := range secretIdentifiers.Data { - secretIDs[i] = identifier.ID - } - - secrets, err := bitwardenClient.Secrets().GetByIDS(secretIDs) - if err != nil { - log.Fatalf("Error getting secrets: %v", err) - } - - jsonSecrets, err := json.MarshalIndent(secrets, "", " ") - if err != nil { - log.Fatalf("Error marshalling secrets to JSON: %v", err) - } - - fmt.Println(string(jsonSecrets)) - - // Generate a password which can be used as a secret value - request := sdk.PasswordGeneratorRequest{ - AvoidAmbiguous: true, - Length: 64, - Lowercase: true, - MinLowercase: new(int64), - MinNumber: new(int64), - MinSpecial: new(int64), - MinUppercase: new(int64), - Numbers: true, - Special: true, - Uppercase: true, - } - password, err := bitwardenClient.Generators().GeneratePassword(request) - - if err != nil { - panic(err) - } - - fmt.Println(*password) - - defer bitwardenClient.Close() -} diff --git a/languages/go/example/go.mod b/languages/go/example/go.mod deleted file mode 100644 index cb09b70..0000000 --- a/languages/go/example/go.mod +++ /dev/null @@ -1,10 +0,0 @@ -module example - -replace github.com/bitwarden/sdk-go => ../ - -go 1.21 - -require ( - github.com/bitwarden/sdk-go v0.0.0-00010101000000-000000000000 - github.com/gofrs/uuid v4.4.0+incompatible -) diff --git a/languages/go/example/go.sum b/languages/go/example/go.sum deleted file mode 100644 index c0ad687..0000000 --- a/languages/go/example/go.sum +++ /dev/null @@ -1,2 +0,0 @@ -github.com/gofrs/uuid v4.4.0+incompatible h1:3qXRTX8/NbyulANqlc0lchS1gqAVxRgsuW1YrTJupqA= -github.com/gofrs/uuid v4.4.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= diff --git a/languages/go/generators.go b/languages/go/generators.go deleted file mode 100644 index 8d72c9a..0000000 --- a/languages/go/generators.go +++ /dev/null @@ -1,35 +0,0 @@ -package sdk - -type GeneratorsInterface interface { - GeneratePassword(request PasswordGeneratorRequest) (*string, error) -} - -type Generators struct { - CommandRunner CommandRunnerInterface -} - -func NewGenerators(commandRunner CommandRunnerInterface) *Generators { - return &Generators{CommandRunner: commandRunner} -} - -func (s *Generators) executeCommand(command Command, target interface{}) error { - responseStr, err := s.CommandRunner.RunCommand(command) - if err != nil { - return err - } - return checkSuccessAndError(responseStr, target) -} - -func (s *Generators) GeneratePassword(request PasswordGeneratorRequest) (*string, error) { - command := Command{ - Generators: &GeneratorsCommand{ - GeneratePassword: request, - }, - } - - var response string - if err := s.executeCommand(command, &response); err != nil { - return nil, err - } - return &response, nil -} diff --git a/languages/go/go.mod b/languages/go/go.mod deleted file mode 100644 index ae9f501..0000000 --- a/languages/go/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module github.com/bitwarden/sdk-go - -go 1.21 diff --git a/languages/go/go.sum b/languages/go/go.sum deleted file mode 100644 index e69de29..0000000 diff --git a/languages/go/internal/cinterface/bitwarden_library.go b/languages/go/internal/cinterface/bitwarden_library.go deleted file mode 100644 index 69d7527..0000000 --- a/languages/go/internal/cinterface/bitwarden_library.go +++ /dev/null @@ -1,58 +0,0 @@ -package cinterface - -import ( - "fmt" - "unsafe" -) - -/* -#cgo LDFLAGS: -lbitwarden_c -#cgo linux,amd64 LDFLAGS: -L ./lib/linux-x64 -#cgo linux,arm64 LDFLAGS: -L ./lib/linux-arm64 -#cgo darwin,amd64 LDFLAGS: -L ./lib/darwin-x64 -framework Security -framework SystemConfiguration -#cgo darwin,arm64 LDFLAGS: -L ./lib/darwin-arm64 -framework Security -framework SystemConfiguration -#cgo windows,amd64 LDFLAGS: -L ./lib/windows-x64 -lbitwarden_c -ladvapi32 -lbcrypt -lcrypt32 -lcryptnet -lkernel32 -lncrypt -lntdll -luserenv -lws2_32 -lmsvcrt -loleaut32 -lruntimeobject -#include -typedef void* ClientPtr; -extern char* run_command(const char *command, ClientPtr client); -extern ClientPtr init(const char *clientSettings); -extern void free_mem(ClientPtr client); -*/ -import "C" - -type ClientPointer struct { - Pointer C.ClientPtr -} - -type BitwardenLibrary interface { - Init(clientSettings string) (ClientPointer, error) - FreeMem(client ClientPointer) - RunCommand(command string, client ClientPointer) (string, error) -} - -type BitwardenLibraryImpl struct{} - -func NewBitwardenLibrary() BitwardenLibrary { - return &BitwardenLibraryImpl{} -} - -func (b *BitwardenLibraryImpl) Init(clientSettings string) (ClientPointer, error) { - ptr := C.init(C.CString(clientSettings)) - if ptr == nil { - return ClientPointer{}, fmt.Errorf("initialization failed") - } - return ClientPointer{Pointer: ptr}, nil -} - -func (b *BitwardenLibraryImpl) FreeMem(client ClientPointer) { - C.free_mem(client.Pointer) -} - -func (b *BitwardenLibraryImpl) RunCommand(command string, client ClientPointer) (string, error) { - cstr := C.run_command(C.CString(command), client.Pointer) - if cstr == nil { - return "", fmt.Errorf("run command failed") - } - defer C.free(unsafe.Pointer(cstr)) - return C.GoString(cstr), nil -} diff --git a/languages/go/project.go b/languages/go/project.go deleted file mode 100644 index 24a30a7..0000000 --- a/languages/go/project.go +++ /dev/null @@ -1,107 +0,0 @@ -package sdk - -type ProjectsInterface interface { - Create(organizationID string, name string) (*ProjectResponse, error) - List(organizationID string) (*ProjectsResponse, error) - Get(projectID string) (*ProjectResponse, error) - Update(projectID string, organizationID string, name string) (*ProjectResponse, error) - Delete(projectIDs []string) (*ProjectsDeleteResponse, error) -} - -type Projects struct { - CommandRunner CommandRunnerInterface -} - -func NewProjects(commandRunner CommandRunnerInterface) *Projects { - return &Projects{CommandRunner: commandRunner} -} - -func (p *Projects) Get(id string) (*ProjectResponse, error) { - command := Command{ - Projects: &ProjectsCommand{ - Get: &ProjectGetRequest{ - ID: id, - }, - }, - } - var response ProjectResponse - if err := p.executeCommand(command, &response); err != nil { - return nil, err - } - return &response, nil -} - -func (p *Projects) Create(organizationID string, name string) (*ProjectResponse, error) { - command := Command{ - Projects: &ProjectsCommand{ - Create: &ProjectCreateRequest{ - OrganizationID: organizationID, - Name: name, - }, - }, - } - - var response ProjectResponse - if err := p.executeCommand(command, &response); err != nil { - return nil, err - } - return &response, nil -} - -func (p *Projects) List(organizationID string) (*ProjectsResponse, error) { - command := Command{ - Projects: &ProjectsCommand{ - List: &ProjectsListRequest{ - OrganizationID: organizationID, - }, - }, - } - - var response ProjectsResponse - if err := p.executeCommand(command, &response); err != nil { - return nil, err - } - return &response, nil -} - -func (p *Projects) Update(projectID, organizationID, name string) (*ProjectResponse, error) { - command := Command{ - Projects: &ProjectsCommand{ - Update: &ProjectPutRequest{ - ID: projectID, - OrganizationID: organizationID, - Name: name, - }, - }, - } - - var response ProjectResponse - if err := p.executeCommand(command, &response); err != nil { - return nil, err - } - return &response, nil -} - -func (p *Projects) Delete(projectIDs []string) (*ProjectsDeleteResponse, error) { - command := Command{ - Projects: &ProjectsCommand{ - Delete: &ProjectsDeleteRequest{ - IDS: projectIDs, - }, - }, - } - - var response ProjectsDeleteResponse - if err := p.executeCommand(command, &response); err != nil { - return nil, err - } - return &response, nil -} - -func (p *Projects) executeCommand(command Command, target interface{}) error { - responseStr, err := p.CommandRunner.RunCommand(command) - if err != nil { - return err - } - return checkSuccessAndError(responseStr, target) -} diff --git a/languages/go/secrets.go b/languages/go/secrets.go deleted file mode 100644 index 825a0f1..0000000 --- a/languages/go/secrets.go +++ /dev/null @@ -1,151 +0,0 @@ -package sdk - -import "time" - -type SecretsInterface interface { - Create(key, value, note string, organizationID string, projectIDs []string) (*SecretResponse, error) - List(organizationID string) (*SecretIdentifiersResponse, error) - Get(secretID string) (*SecretResponse, error) - GetByIDS(secretIDs []string) (*SecretsResponse, error) - Update(secretID string, key, value, note string, organizationID string, projectIDs []string) (*SecretResponse, error) - Delete(secretIDs []string) (*SecretsDeleteResponse, error) - Sync(organizationID string, lastSyncedDate *time.Time) (*SecretsSyncResponse, error) -} - -type Secrets struct { - CommandRunner CommandRunnerInterface -} - -func NewSecrets(commandRunner CommandRunnerInterface) *Secrets { - return &Secrets{CommandRunner: commandRunner} -} - -func (s *Secrets) executeCommand(command Command, target interface{}) error { - responseStr, err := s.CommandRunner.RunCommand(command) - if err != nil { - return err - } - return checkSuccessAndError(responseStr, target) -} - -func (s *Secrets) Create(key, value, note string, organizationID string, projectIDs []string) (*SecretResponse, error) { - command := Command{ - Secrets: &SecretsCommand{ - Create: &SecretCreateRequest{ - Key: key, - Value: value, - Note: note, - OrganizationID: organizationID, - ProjectIDS: projectIDs, - }, - }, - } - - var response SecretResponse - if err := s.executeCommand(command, &response); err != nil { - return nil, err - } - return &response, nil -} - -func (s *Secrets) List(organizationID string) (*SecretIdentifiersResponse, error) { - command := Command{ - Secrets: &SecretsCommand{ - List: &SecretIdentifiersRequest{ - OrganizationID: organizationID, - }, - }, - } - - var response SecretIdentifiersResponse - if err := s.executeCommand(command, &response); err != nil { - return nil, err - } - return &response, nil -} - -func (s *Secrets) Get(id string) (*SecretResponse, error) { - command := Command{ - Secrets: &SecretsCommand{ - Get: &SecretGetRequest{ - ID: id, - }, - }, - } - - var response SecretResponse - if err := s.executeCommand(command, &response); err != nil { - return nil, err - } - return &response, nil -} - -func (s *Secrets) GetByIDS(ids []string) (*SecretsResponse, error) { - command := Command{ - Secrets: &SecretsCommand{ - GetByIDS: &SecretsGetRequest{ - IDS: ids, - }, - }, - } - - var response SecretsResponse - if err := s.executeCommand(command, &response); err != nil { - return nil, err - } - return &response, nil -} - -func (s *Secrets) Update(id string, key, value, note string, organizationID string, projectIDs []string) (*SecretResponse, error) { - command := Command{ - Secrets: &SecretsCommand{ - Update: &SecretPutRequest{ - ID: id, - Key: key, - Value: value, - Note: note, - OrganizationID: organizationID, - ProjectIDS: projectIDs, - }, - }, - } - - var response SecretResponse - if err := s.executeCommand(command, &response); err != nil { - return nil, err - } - return &response, nil -} - -func (s *Secrets) Delete(ids []string) (*SecretsDeleteResponse, error) { - command := Command{ - Secrets: &SecretsCommand{ - Delete: &SecretsDeleteRequest{ - IDS: ids, - }, - }, - } - - var response SecretsDeleteResponse - if err := s.executeCommand(command, &response); err != nil { - return nil, err - } - return &response, nil -} - -func (s *Secrets) Sync(organizationID string, lastSyncedDate *time.Time) (*SecretsSyncResponse, error) { - command := Command{ - Secrets: &SecretsCommand{ - Sync: &SecretsSyncRequest{ - OrganizationID: organizationID, - LastSyncedDate: lastSyncedDate, - }, - }, - } - - var response SecretsSyncResponse - if err := s.executeCommand(command, &response); err != nil { - return nil, err - } - return &response, nil -} diff --git a/languages/go/util.go b/languages/go/util.go deleted file mode 100644 index 01ab357..0000000 --- a/languages/go/util.go +++ /dev/null @@ -1,33 +0,0 @@ -package sdk - -import ( - "encoding/json" - "fmt" -) - -func checkSuccessAndError(responseStr string, v interface{}) error { - var wrapper struct { - Success bool `json:"success"` - ErrorMessage *string `json:"errorMessage"` - Data *json.RawMessage `json:"data"` - } - - err := json.Unmarshal([]byte(responseStr), &wrapper) - if err != nil { - return fmt.Errorf("failed to unmarshal wrapper response: %v", err) - } - - if !wrapper.Success { - if wrapper.ErrorMessage != nil { - return fmt.Errorf("API error: %s", *wrapper.ErrorMessage) - } - return fmt.Errorf("API error: unknown") - } - - err = json.Unmarshal(*wrapper.Data, &v) - if err != nil { - return fmt.Errorf("failed to unmarshal response: %v", err) - } - - return nil -} diff --git a/languages/java/.gitignore b/languages/java/.gitignore deleted file mode 100644 index b5b6c56..0000000 --- a/languages/java/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -target -.gradle -src/main/resources diff --git a/languages/java/INSTALL.md b/languages/java/INSTALL.md deleted file mode 100644 index 73e4747..0000000 --- a/languages/java/INSTALL.md +++ /dev/null @@ -1,52 +0,0 @@ -# Java build - -## Introduction - -Gradle is used to build Java Bitwarden client library. - -The output of the build is placed in `build/libs` directory and should contain `BitwardenSDK.jar` file. - -## Prerequisites - -- JDK 17 installed. -- Bitwarden SDK native library build. See [SDK README.md](../../README.md) for instructions. - -## Build Commands - -```shell -./gradlew build -``` - -## Example - -### macOS - -#### Install Prerequisites - -Use brew to install JDK 17. - -```shell -brew install --cask temurin@17 -brew install jenv -export PATH="$HOME/.jenv/bin:$PATH" -eval "$(jenv init -)" -jenv add /Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home -jenv shell 17 -``` - -#### Build Commands - -```shell -./gradlew build -``` - -## Example SDK Usage Project - -```shell -export ACCESS_TOKEN="" -export ORGANIZATION_ID="" -export API_URL="https://api.bitwarden.com" -export IDENTITY_URL="https://identity.bitwarden.com" - -./gradlew :example:run -``` diff --git a/languages/java/README.md b/languages/java/README.md deleted file mode 100644 index b4db447..0000000 --- a/languages/java/README.md +++ /dev/null @@ -1,108 +0,0 @@ -# Bitwarden Secrets Manager SDK - -Java 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 - -### Create new Bitwarden client - -```java -import com.bitwarden.sdk.*; -import com.bitwarden.sdk.schema.*; - -import java.lang.System; -import java.util.UUID; -import java.time.OffsetDateTime; - -String stateFile = System.getenv("STATE_FILE"); - -BitwardenSettings bitwardenSettings = new BitwardenSettings(); -bitwardenSettings.setApiUrl("https://api.bitwarden.com"); -bitwardenSettings.setIdentityUrl("https://identity.bitwarden.com"); -BitwardenClient bitwardenClient = new BitwardenClient(bitwardenSettings); -bitwardenClient.auth().loginAccessToken("", stateFile); -``` - -### Create new project - -```java -UUID organizationId = UUID.fromString(""); -var projectResponse = bitwardenClient.projects().create(organizationId, "TestProject"); -UUID projectId = projectResponse.getID(); -``` - -### Get project - -```java -var projectResponse = bitwardenClient.projects().get(projectId); -``` - -### List all projects - -```java -var projectsResponse = bitwardenClient.projects().list(organizationId); -``` - -### Update project - -```java -var projectResponse = bitwardenClient.projects().update(organizationId, projectId, "TestProjectUpdated"); -``` - -### Add new secret - -```java -String key = "key"; -String value = "value"; -String note = "note"; -var secretResponse = bitwardenClient.secrets().create(organizationId, key, value, note, new UUID[]{projectId}); -UUID secretId = secretResponse.getID(); -``` - -### Get secret - -```java -var secretResponse = bitwardenClient.secrets().get(secretId); -``` - -### Get secrets by ids - -```java -SecretsResponse secretsByIds = bitwardenClient.secrets().getByIds(new UUID[]{secretId}); -for (SecretResponse sr : secretsByIds.getData()) { - System.out.println(sr.getKey()); -} -``` - -### Update secret - -```java -var secretResponse = bitwardenClient.secrets().update(organizationId, secretId, key2, value2, note2, new UUID[]{projectId}); -``` - -### List secrets - -```java -var secretIdentifiersResponse = bitwardenClient.secrets().list(organizationId); -``` - -### Secrets sync -```java -SecretsSyncResponse syncResponse = bitwardenClient.secrets().sync(organizationId, OffsetDateTime.now()); -System.out.println("Has changes: " + syncResponse.getHasChanges()); -``` - -### Delete secret or project - -```java -bitwardenClient.secrets().delete(new UUID[]{secretId}); -bitwardenClient.projects().delete(new UUID[]{projectId}); -``` - -[Access Tokens]: https://bitwarden.com/help/access-tokens/ -[Bitwarden Secrets Manager]: https://bitwarden.com/products/secrets-manager/ diff --git a/languages/java/build.gradle b/languages/java/build.gradle deleted file mode 100644 index 7e98de1..0000000 --- a/languages/java/build.gradle +++ /dev/null @@ -1,100 +0,0 @@ -/* - * This file was generated by the Gradle 'init' task. - */ - -plugins { - id 'java-library' - id 'maven-publish' -} - -repositories { - mavenLocal() - maven { - url = uri('https://repo.maven.apache.org/maven2/') - } - - dependencies { - api 'com.fasterxml.jackson.core:jackson-core:2.9.10' - api 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.9.10' - api 'net.java.dev.jna:jna-platform:5.12.1' - } - - description = 'Bitwarden Secrets Manager Java SDK' - java.sourceCompatibility = JavaVersion.VERSION_1_8 - - publishing { - publications { - maven(MavenPublication) { - groupId = 'com.bitwarden' - artifactId = 'sdk-secrets' - - // Determine the version from the git history. - // - // PRs: use the branch name. - // Main: Grab it from `crates/bitwarden/Cargo.toml` - - def branchName = "git branch --show-current".execute().text.trim() - version = "1.0.1" - - afterEvaluate { - from components.java - } - } - } - repositories { - maven { - name = "GitHubPackages" - url = "https://maven.pkg.github.com/bitwarden/sdk" - credentials { - username = System.getenv("GITHUB_ACTOR") - password = System.getenv("GITHUB_TOKEN") - } - } - maven { - name = "OSSRH" - url = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/" - credentials { - username = System.getenv("MAVEN_USERNAME") - password = System.getenv("MAVEN_PASSWORD") - } - } - } - } -} - -tasks.withType(JavaCompile) { - options.encoding = 'UTF-8' -} - -tasks.withType(Javadoc) { - options.encoding = 'UTF-8' - failOnError = false -} - -java { - withJavadocJar() - withSourcesJar() -} - -jar { - // Copy native library to jar resources for local gradle build - if (System.getenv("GITHUB_TOKEN") == null) { - from('../../target/debug') { - include '*libbitwarden_c*.dylib' - into "darwin-x86-64" - } - from('../../target/debug') { - include '*libbitwarden_c*.dylib' - into "darwin-aarch64" - } - from('../../target/debug') { - include '*libbitwarden_c*.so' - into "linux-x86-64" - } - from('../../target/debug') { - include '*bitwarden_c*.dll' - into "win32-x86-64" - } - } -} - diff --git a/languages/java/example/Example.java b/languages/java/example/Example.java deleted file mode 100644 index cc34c2a..0000000 --- a/languages/java/example/Example.java +++ /dev/null @@ -1,73 +0,0 @@ -import java.lang.System; -import java.util.UUID; -import java.time.OffsetDateTime; - -import com.bitwarden.sdk.*; -import com.bitwarden.sdk.schema.*; - -class Example { - public static void main(String[] args) { - if (!System.getenv().containsKey("ACCESS_TOKEN") || !System.getenv().containsKey("ORGANIZATION_ID")) { - System.err.println("Missing environment variable ACCESS_TOKEN or ORGANIZATION_ID"); - System.exit(1); - } - - String accessToken = System.getenv("ACCESS_TOKEN"); - UUID organizationId = UUID.fromString(System.getenv("ORGANIZATION_ID")); - - String apiUrl = System.getenv("API_URL"); - String identityUrl = System.getenv("IDENTITY_URL"); - String stateFile = System.getenv("STATE_FILE"); - - // Configuring the URLS is optional, remove them to use the default values - BitwardenSettings bitwardenSettings = new BitwardenSettings(); - bitwardenSettings.setApiUrl(apiUrl); - bitwardenSettings.setIdentityUrl(identityUrl); - - try (BitwardenClient client = new BitwardenClient(bitwardenSettings)) { - client.auth().loginAccessToken(accessToken, stateFile); - - ProjectResponse project = client.projects().create(organizationId, "Test Project from Java SDK"); - System.out.println("Project CREATE, id: " + project.getID()); - - project = client.projects().get(project.getID()); - System.out.println("Project GET, id: " + project.getID()); - - ProjectsResponse projects = client.projects().list(organizationId); - System.out.println("Projects LIST, count: " + projects.getData().length); - - client.projects().update(organizationId, project.getID(), "Updated Test Project"); - project = client.projects().get(project.getID()); - System.out.println("Project UPDATE, new name: " + project.getName()); - - SecretResponse secret = client.secrets().create(organizationId, "Secret Key", "Secret Value", "Secret Note", new UUID[]{project.getID()}); - System.out.println("Secret CREATE, id: " + secret.getID()); - - secret = client.secrets().get(secret.getID()); - System.out.println("Secret GET, id: " + secret.getID()); - - SecretIdentifiersResponse secrets = client.secrets().list(organizationId); - System.out.println("Secrets LIST, count: " + secrets.getData().length); - - client.secrets().update(organizationId, secret.getID(), "Updated Key", "Updated Value", "Updated Note", new UUID[]{project.getID()}); - secret = client.secrets().get(secret.getID()); - System.out.println("Secret UPDATE, new key: " + secret.getKey()); - - SecretsResponse secretsByIds = client.secrets().getByIds(new UUID[]{secret.getID()}); - System.out.println("Getting secrets by ids, here are the keys of the retrieved secrets..."); - for (SecretResponse sr : secretsByIds.getData()) { - System.out.println(" " + sr.getKey()); - } - - SecretsSyncResponse syncResponse = client.secrets().sync(organizationId, OffsetDateTime.now()); - System.out.println("Running a secrets sync request based on the current time..."); - System.out.println("Has changes: " + syncResponse.getHasChanges()); - - System.out.println("Deleting the created secret and project..."); - client.secrets().delete(new UUID[]{secret.getID()}); - client.projects().delete(new UUID[]{project.getID()}); - - System.out.println("Execution complete."); - } - } -} diff --git a/languages/java/example/build.gradle b/languages/java/example/build.gradle deleted file mode 100644 index 73025e5..0000000 --- a/languages/java/example/build.gradle +++ /dev/null @@ -1,23 +0,0 @@ -plugins { - id 'application' -} - -repositories { - mavenLocal() - mavenCentral() -} - -dependencies { - implementation rootProject -} - -application { - mainClass = 'Example' -} - -sourceSets { - main { - java.srcDirs += '.' - } -} - diff --git a/languages/java/gradle/wrapper/gradle-wrapper.jar b/languages/java/gradle/wrapper/gradle-wrapper.jar deleted file mode 100644 index 7f93135..0000000 Binary files a/languages/java/gradle/wrapper/gradle-wrapper.jar and /dev/null differ diff --git a/languages/java/gradle/wrapper/gradle-wrapper.properties b/languages/java/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index b82aa23..0000000 --- a/languages/java/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,7 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip -networkTimeout=10000 -validateDistributionUrl=true -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/languages/java/gradlew b/languages/java/gradlew deleted file mode 100755 index 0adc8e1..0000000 --- a/languages/java/gradlew +++ /dev/null @@ -1,249 +0,0 @@ -#!/bin/sh - -# -# Copyright © 2015-2021 the original authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -############################################################################## -# -# Gradle start up script for POSIX generated by Gradle. -# -# Important for running: -# -# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is -# noncompliant, but you have some other compliant shell such as ksh or -# bash, then to run this script, type that shell name before the whole -# command line, like: -# -# ksh Gradle -# -# Busybox and similar reduced shells will NOT work, because this script -# requires all of these POSIX shell features: -# * functions; -# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», -# «${var#prefix}», «${var%suffix}», and «$( cmd )»; -# * compound commands having a testable exit status, especially «case»; -# * various built-in commands including «command», «set», and «ulimit». -# -# Important for patching: -# -# (2) This script targets any POSIX shell, so it avoids extensions provided -# by Bash, Ksh, etc; in particular arrays are avoided. -# -# The "traditional" practice of packing multiple parameters into a -# space-separated string is a well documented source of bugs and security -# problems, so this is (mostly) avoided, by progressively accumulating -# options in "$@", and eventually passing that to Java. -# -# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, -# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; -# see the in-line comments for details. -# -# There are tweaks for specific operating systems such as AIX, CygWin, -# Darwin, MinGW, and NonStop. -# -# (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt -# within the Gradle project. -# -# You can find Gradle at https://github.com/gradle/gradle/. -# -############################################################################## - -# Attempt to set APP_HOME - -# Resolve links: $0 may be a link -app_path=$0 - -# Need this for daisy-chained symlinks. -while - APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path - [ -h "$app_path" ] -do - ls=$( ls -ld "$app_path" ) - link=${ls#*' -> '} - case $link in #( - /*) app_path=$link ;; #( - *) app_path=$APP_HOME$link ;; - esac -done - -# This is normally unused -# shellcheck disable=SC2034 -APP_BASE_NAME=${0##*/} -# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) -APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD=maximum - -warn () { - echo "$*" -} >&2 - -die () { - echo - echo "$*" - echo - exit 1 -} >&2 - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "$( uname )" in #( - CYGWIN* ) cygwin=true ;; #( - Darwin* ) darwin=true ;; #( - MSYS* | MINGW* ) msys=true ;; #( - NONSTOP* ) nonstop=true ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD=$JAVA_HOME/jre/sh/java - else - JAVACMD=$JAVA_HOME/bin/java - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD=java - if ! command -v java >/dev/null 2>&1 - then - die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -fi - -# Increase the maximum file descriptors if we can. -if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then - case $MAX_FD in #( - max*) - # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 - MAX_FD=$( ulimit -H -n ) || - warn "Could not query maximum file descriptor limit" - esac - case $MAX_FD in #( - '' | soft) :;; #( - *) - # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 - ulimit -n "$MAX_FD" || - warn "Could not set maximum file descriptor limit to $MAX_FD" - esac -fi - -# Collect all arguments for the java command, stacking in reverse order: -# * args from the command line -# * the main class name -# * -classpath -# * -D...appname settings -# * --module-path (only if needed) -# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. - -# For Cygwin or MSYS, switch paths to Windows format before running java -if "$cygwin" || "$msys" ; then - APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) - - JAVACMD=$( cygpath --unix "$JAVACMD" ) - - # Now convert the arguments - kludge to limit ourselves to /bin/sh - for arg do - if - case $arg in #( - -*) false ;; # don't mess with options #( - /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath - [ -e "$t" ] ;; #( - *) false ;; - esac - then - arg=$( cygpath --path --ignore --mixed "$arg" ) - fi - # Roll the args list around exactly as many times as the number of - # args, so each arg winds up back in the position where it started, but - # possibly modified. - # - # NB: a `for` loop captures its iteration list before it begins, so - # changing the positional parameters here affects neither the number of - # iterations, nor the values presented in `arg`. - shift # remove old arg - set -- "$@" "$arg" # push replacement arg - done -fi - - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. - -set -- \ - "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ - "$@" - -# Stop when "xargs" is not available. -if ! command -v xargs >/dev/null 2>&1 -then - die "xargs is not available" -fi - -# Use "xargs" to parse quoted args. -# -# With -n1 it outputs one arg per line, with the quotes and backslashes removed. -# -# In Bash we could simply go: -# -# readarray ARGS < <( xargs -n1 <<<"$var" ) && -# set -- "${ARGS[@]}" "$@" -# -# but POSIX shell has neither arrays nor command substitution, so instead we -# post-process each arg (as a line of input to sed) to backslash-escape any -# character that might be a shell metacharacter, then use eval to reverse -# that process (while maintaining the separation between arguments), and wrap -# the whole thing up as a single "set" statement. -# -# This will of course break if any of these variables contains a newline or -# an unmatched quote. -# - -eval "set -- $( - printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | - xargs -n1 | - sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | - tr '\n' ' ' - )" '"$@"' - -exec "$JAVACMD" "$@" diff --git a/languages/java/gradlew.bat b/languages/java/gradlew.bat deleted file mode 100644 index 6689b85..0000000 --- a/languages/java/gradlew.bat +++ /dev/null @@ -1,92 +0,0 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%"=="" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%"=="" set DIRNAME=. -@rem This is normally unused -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if %ERRORLEVEL% equ 0 goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if %ERRORLEVEL% equ 0 goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -set EXIT_CODE=%ERRORLEVEL% -if %EXIT_CODE% equ 0 set EXIT_CODE=1 -if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% -exit /b %EXIT_CODE% - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/languages/java/settings.gradle b/languages/java/settings.gradle deleted file mode 100644 index bdf7a7e..0000000 --- a/languages/java/settings.gradle +++ /dev/null @@ -1,7 +0,0 @@ -/* - * This file was generated by the Gradle 'init' task. - */ - -rootProject.name = 'BitwardenSDK' - -include "example" diff --git a/languages/java/src/main/java/com/bitwarden/sdk/AuthClient.java b/languages/java/src/main/java/com/bitwarden/sdk/AuthClient.java deleted file mode 100644 index b4c26eb..0000000 --- a/languages/java/src/main/java/com/bitwarden/sdk/AuthClient.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.bitwarden.sdk; - -import com.bitwarden.sdk.schema.*; - -import java.util.function.Function; - -public class AuthClient { - - private final CommandRunner commandRunner; - - AuthClient(CommandRunner commandRunner) { - this.commandRunner = commandRunner; - } - - public APIKeyLoginResponse loginAccessToken(String accessToken, String stateFile) { - Command command = new Command(); - AccessTokenLoginRequest accessTokenLoginRequest = new AccessTokenLoginRequest(); - accessTokenLoginRequest.setAccessToken(accessToken); - accessTokenLoginRequest.setStateFile(stateFile); - - command.setLoginAccessToken(accessTokenLoginRequest); - - ResponseForAPIKeyLoginResponse response = commandRunner.runCommand(command, - BitwardenClient.throwingFunctionWrapper(Converter::ResponseForAPIKeyLoginResponseFromJsonString)); - - if (response == null || !response.getSuccess()) { - throw new BitwardenClientException(response != null ? response.getErrorMessage() : "Login failed"); - } - - return response.getData(); - } -} diff --git a/languages/java/src/main/java/com/bitwarden/sdk/BitwardenClient.java b/languages/java/src/main/java/com/bitwarden/sdk/BitwardenClient.java deleted file mode 100644 index bed2998..0000000 --- a/languages/java/src/main/java/com/bitwarden/sdk/BitwardenClient.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.bitwarden.sdk; - -import com.bitwarden.sdk.schema.*; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.sun.jna.Native; -import com.sun.jna.Pointer; - -import java.util.function.Function; - -public class BitwardenClient implements AutoCloseable { - - private final Pointer client; - - private final BitwardenLibrary library; - - private final CommandRunner commandRunner; - - private boolean isClientOpen; - - private final ProjectsClient projects; - - private final SecretsClient secrets; - - private final AuthClient auth; - - public BitwardenClient(BitwardenSettings bitwardenSettings) { - ClientSettings clientSettings = new ClientSettings(); - clientSettings.setAPIURL(bitwardenSettings.getApiUrl()); - clientSettings.setIdentityURL(bitwardenSettings.getIdentityUrl()); - clientSettings.setDeviceType(DeviceType.SDK); - clientSettings.setUserAgent("Bitwarden JAVA-SDK"); - - library = Native.load("bitwarden_c", BitwardenLibrary.class); - - try { - client = library.init(Converter.ClientSettingsToJsonString(clientSettings)); - } catch (JsonProcessingException e) { - throw new BitwardenClientException("Error while processing client settings"); - } - - commandRunner = new CommandRunner(library, client); - projects = new ProjectsClient(commandRunner); - secrets = new SecretsClient(commandRunner); - auth = new AuthClient(commandRunner); - isClientOpen = true; - } - - static Function throwingFunctionWrapper(ThrowingFunction throwingFunction) { - return i -> { - try { - return throwingFunction.accept(i); - } catch (Exception ex) { - throw new BitwardenClientException("Response failed", ex); - } - }; - } - - public ProjectsClient projects() { - return projects; - } - - public SecretsClient secrets() { - return secrets; - } - - public AuthClient auth() { - return auth; - } - - @Override - public void close() { - if (isClientOpen) { - library.free_mem(client); - isClientOpen = false; - } - } -} diff --git a/languages/java/src/main/java/com/bitwarden/sdk/BitwardenClientException.java b/languages/java/src/main/java/com/bitwarden/sdk/BitwardenClientException.java deleted file mode 100644 index e1bc9d4..0000000 --- a/languages/java/src/main/java/com/bitwarden/sdk/BitwardenClientException.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.bitwarden.sdk; - -public class BitwardenClientException extends RuntimeException { - - public BitwardenClientException(String message) { - super(message); - } - - public BitwardenClientException(String message, Exception ex) { - super(message, ex); - } -} diff --git a/languages/java/src/main/java/com/bitwarden/sdk/BitwardenLibrary.java b/languages/java/src/main/java/com/bitwarden/sdk/BitwardenLibrary.java deleted file mode 100644 index 73d8145..0000000 --- a/languages/java/src/main/java/com/bitwarden/sdk/BitwardenLibrary.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.bitwarden.sdk; - -import com.sun.jna.Library; -import com.sun.jna.Pointer; - -public interface BitwardenLibrary extends Library { - - Pointer init(String clientSettings); - - void free_mem(Pointer client); - - String run_command(String command, Pointer client); -} diff --git a/languages/java/src/main/java/com/bitwarden/sdk/BitwardenSettings.java b/languages/java/src/main/java/com/bitwarden/sdk/BitwardenSettings.java deleted file mode 100644 index 7112297..0000000 --- a/languages/java/src/main/java/com/bitwarden/sdk/BitwardenSettings.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.bitwarden.sdk; - -public class BitwardenSettings { - - private String apiUrl; - - private String identityUrl; - - public BitwardenSettings() { - } - - public BitwardenSettings(String apiUrl, String identityUrl) { - this.apiUrl = apiUrl; - this.identityUrl = identityUrl; - } - - public String getApiUrl() { - return apiUrl; - } - - public void setApiUrl(String apiUrl) { - this.apiUrl = apiUrl; - } - - public String getIdentityUrl() { - return identityUrl; - } - - public void setIdentityUrl(String identityUrl) { - this.identityUrl = identityUrl; - } -} diff --git a/languages/java/src/main/java/com/bitwarden/sdk/CommandRunner.java b/languages/java/src/main/java/com/bitwarden/sdk/CommandRunner.java deleted file mode 100644 index 11a1008..0000000 --- a/languages/java/src/main/java/com/bitwarden/sdk/CommandRunner.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.bitwarden.sdk; - -import com.bitwarden.sdk.schema.Command; -import com.bitwarden.sdk.schema.Converter; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.sun.jna.Pointer; - -import java.io.IOException; -import java.util.function.Function; - -class CommandRunner { - - private final BitwardenLibrary library; - - private final Pointer client; - - CommandRunner(BitwardenLibrary library, Pointer client) { - this.library = library; - this.client = client; - } - - T runCommand(Command command, Function deserializer) { - String response = null; - - try { - response = library.run_command(commandToString(command), client); - } catch (IOException e) { - throw new RuntimeException(e); - } - - return deserializer.apply(response); - } - - private String commandToString(Command command) throws IOException { - // Removes null properties from the generated converter output to avoid command errors - String inputJson = Converter.CommandToJsonString(command); - - ObjectMapper mapper = new ObjectMapper(); - mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); - - Object inputObject = mapper.readValue(inputJson, Object.class); - return mapper.writeValueAsString(inputObject); - } -} diff --git a/languages/java/src/main/java/com/bitwarden/sdk/ProjectsClient.java b/languages/java/src/main/java/com/bitwarden/sdk/ProjectsClient.java deleted file mode 100644 index eb96b82..0000000 --- a/languages/java/src/main/java/com/bitwarden/sdk/ProjectsClient.java +++ /dev/null @@ -1,109 +0,0 @@ -package com.bitwarden.sdk; - -import com.bitwarden.sdk.schema.*; - -import java.util.UUID; - -public class ProjectsClient { - - private final CommandRunner commandRunner; - - ProjectsClient(CommandRunner commandRunner) { - this.commandRunner = commandRunner; - } - - public ProjectResponse get(UUID id) { - Command command = new Command(); - ProjectsCommand projectsCommand = new ProjectsCommand(); - ProjectGetRequest projectGetRequest = new ProjectGetRequest(); - projectGetRequest.setID(id); - projectsCommand.setGet(projectGetRequest); - command.setProjects(projectsCommand); - - ResponseForProjectResponse response = commandRunner.runCommand(command, - BitwardenClient.throwingFunctionWrapper(Converter::ResponseForProjectResponseFromJsonString)); - - if (response == null || !response.getSuccess()) { - throw new BitwardenClientException(response != null ? response.getErrorMessage() : "Project not found"); - } - - return response.getData(); - } - - public ProjectResponse create(UUID organizationId, String name) { - Command command = new Command(); - ProjectsCommand projectsCommand = new ProjectsCommand(); - ProjectCreateRequest projectCreateRequest = new ProjectCreateRequest(); - projectCreateRequest.setOrganizationID(organizationId); - projectCreateRequest.setName(name); - projectsCommand.setCreate(projectCreateRequest); - command.setProjects(projectsCommand); - - ResponseForProjectResponse response = commandRunner.runCommand(command, - BitwardenClient.throwingFunctionWrapper(Converter::ResponseForProjectResponseFromJsonString)); - - if (response == null || !response.getSuccess()) { - throw new BitwardenClientException(response != null ? response.getErrorMessage() : "Project create failed"); - } - - return response.getData(); - } - - public ProjectResponse update(UUID organizationId, UUID id, String name) { - Command command = new Command(); - ProjectsCommand projectsCommand = new ProjectsCommand(); - ProjectPutRequest projectPutRequest = new ProjectPutRequest(); - projectPutRequest.setID(id); - projectPutRequest.setOrganizationID(organizationId); - projectPutRequest.setName(name); - projectsCommand.setUpdate(projectPutRequest); - command.setProjects(projectsCommand); - - ResponseForProjectResponse response = commandRunner.runCommand(command, - BitwardenClient.throwingFunctionWrapper(Converter::ResponseForProjectResponseFromJsonString)); - - if (response == null || !response.getSuccess()) { - throw new BitwardenClientException(response != null ? response.getErrorMessage() : "Project update failed"); - } - - return response.getData(); - } - - public ProjectsDeleteResponse delete(UUID[] ids) { - Command command = new Command(); - ProjectsCommand projectsCommand = new ProjectsCommand(); - ProjectsDeleteRequest projectsDeleteRequest = new ProjectsDeleteRequest(); - projectsDeleteRequest.setIDS(ids); - projectsCommand.setDelete(projectsDeleteRequest); - command.setProjects(projectsCommand); - - ResponseForProjectsDeleteResponse response = commandRunner.runCommand(command, - BitwardenClient.throwingFunctionWrapper(Converter::ResponseForProjectsDeleteResponseFromJsonString)); - - if (response == null || !response.getSuccess()) { - throw new BitwardenClientException(response != null ? - response.getErrorMessage() : "Projects update failed"); - } - - return response.getData(); - } - - public ProjectsResponse list(UUID organizationId) { - Command command = new Command(); - ProjectsCommand projectsCommand = new ProjectsCommand(); - ProjectsListRequest projectsListRequest = new ProjectsListRequest(); - projectsListRequest.setOrganizationID(organizationId); - projectsCommand.setList(projectsListRequest); - command.setProjects(projectsCommand); - - ResponseForProjectsResponse response = commandRunner.runCommand(command, - BitwardenClient.throwingFunctionWrapper(Converter::ResponseForProjectsResponseFromJsonString)); - - if (response == null || !response.getSuccess()) { - throw new BitwardenClientException(response != null ? - response.getErrorMessage() : "No projects for given organization"); - } - - return response.getData(); - } -} diff --git a/languages/java/src/main/java/com/bitwarden/sdk/SecretsClient.java b/languages/java/src/main/java/com/bitwarden/sdk/SecretsClient.java deleted file mode 100644 index 6332444..0000000 --- a/languages/java/src/main/java/com/bitwarden/sdk/SecretsClient.java +++ /dev/null @@ -1,152 +0,0 @@ -package com.bitwarden.sdk; - -import com.bitwarden.sdk.schema.*; - -import java.util.UUID; -import java.time.OffsetDateTime; - -public class SecretsClient { - - private final CommandRunner commandRunner; - - SecretsClient(CommandRunner commandRunner) { - this.commandRunner = commandRunner; - } - - public SecretResponse get(UUID id) { - Command command = new Command(); - SecretsCommand secretsCommand = new SecretsCommand(); - SecretGetRequest secretGetRequest = new SecretGetRequest(); - secretGetRequest.setID(id); - secretsCommand.setGet(secretGetRequest); - command.setSecrets(secretsCommand); - - ResponseForSecretResponse response = commandRunner.runCommand(command, - BitwardenClient.throwingFunctionWrapper(Converter::ResponseForSecretResponseFromJsonString)); - - if (response == null || !response.getSuccess()) { - throw new BitwardenClientException(response != null ? response.getErrorMessage() : "Secret not found"); - } - - return response.getData(); - } - - public SecretResponse create(UUID organizationId, String key, String value, String note, UUID[] projectIds) { - Command command = new Command(); - SecretsCommand secretsCommand = new SecretsCommand(); - SecretCreateRequest secretCreateRequest = new SecretCreateRequest(); - secretCreateRequest.setKey(key); - secretCreateRequest.setValue(value); - secretCreateRequest.setNote(note); - secretCreateRequest.setOrganizationID(organizationId); - secretCreateRequest.setProjectIDS(projectIds); - secretsCommand.setCreate(secretCreateRequest); - command.setSecrets(secretsCommand); - - ResponseForSecretResponse response = commandRunner.runCommand(command, - BitwardenClient.throwingFunctionWrapper(Converter::ResponseForSecretResponseFromJsonString)); - - if (response == null || !response.getSuccess()) { - throw new BitwardenClientException(response != null ? response.getErrorMessage() : "Secret create failed"); - } - - return response.getData(); - } - - public SecretResponse update(UUID organizationId, UUID id, String key, String value, String note, UUID[] projectIds) { - Command command = new Command(); - SecretsCommand secretsCommand = new SecretsCommand(); - SecretPutRequest secretPutRequest = new SecretPutRequest(); - secretPutRequest.setID(id); - secretPutRequest.setKey(key); - secretPutRequest.setValue(value); - secretPutRequest.setNote(note); - secretPutRequest.setOrganizationID(organizationId); - secretPutRequest.setProjectIDS(projectIds); - secretsCommand.setUpdate(secretPutRequest); - command.setSecrets(secretsCommand); - - ResponseForSecretResponse response = commandRunner.runCommand(command, - BitwardenClient.throwingFunctionWrapper(Converter::ResponseForSecretResponseFromJsonString)); - - if (response == null || !response.getSuccess()) { - throw new BitwardenClientException(response != null ? response.getErrorMessage() : "Secret update failed"); - } - - return response.getData(); - } - - public SecretsDeleteResponse delete(UUID[] ids) { - Command command = new Command(); - SecretsCommand secretsCommand = new SecretsCommand(); - SecretsDeleteRequest secretsDeleteRequest = new SecretsDeleteRequest(); - secretsDeleteRequest.setIDS(ids); - secretsCommand.setDelete(secretsDeleteRequest); - command.setSecrets(secretsCommand); - - ResponseForSecretsDeleteResponse response = commandRunner.runCommand(command, - BitwardenClient.throwingFunctionWrapper(Converter::ResponseForSecretsDeleteResponseFromJsonString)); - - if (response == null || !response.getSuccess()) { - throw new BitwardenClientException(response != null ? response.getErrorMessage() : "Secrets delete failed"); - } - - return response.getData(); - } - - public SecretIdentifiersResponse list(UUID organizationId) { - Command command = new Command(); - SecretsCommand secretsCommand = new SecretsCommand(); - SecretIdentifiersRequest secretIdentifiersRequest = new SecretIdentifiersRequest(); - secretIdentifiersRequest.setOrganizationID(organizationId); - secretsCommand.setList(secretIdentifiersRequest); - command.setSecrets(secretsCommand); - - ResponseForSecretIdentifiersResponse response = commandRunner.runCommand(command, - BitwardenClient.throwingFunctionWrapper(Converter::ResponseForSecretIdentifiersResponseFromJsonString)); - - if (response == null || !response.getSuccess()) { - throw new BitwardenClientException(response != null ? - response.getErrorMessage() : "No secrets for given organization"); - } - - return response.getData(); - } - - public SecretsResponse getByIds(UUID[] ids) { - Command command = new Command(); - SecretsCommand secretsCommand = new SecretsCommand(); - SecretsGetRequest secretsGetRequest = new SecretsGetRequest(); - secretsGetRequest.setIDS(ids); - secretsCommand.setGetByIDS(secretsGetRequest); - command.setSecrets(secretsCommand); - - ResponseForSecretsResponse response = commandRunner.runCommand(command, - BitwardenClient.throwingFunctionWrapper(Converter::ResponseForSecretsResponseFromJsonString)); - - if (response == null || !response.getSuccess()) { - throw new BitwardenClientException(response != null ? response.getErrorMessage() : "Secret(s) not found"); - } - - return response.getData(); - } - - public SecretsSyncResponse sync(UUID organizationId, OffsetDateTime lastSyncedDate) { - Command command = new Command(); - SecretsCommand secretsCommand = new SecretsCommand(); - SecretsSyncRequest secretsSyncRequest = new SecretsSyncRequest(); - secretsSyncRequest.setOrganizationID(organizationId); - secretsSyncRequest.setLastSyncedDate(lastSyncedDate); - secretsCommand.setSync(secretsSyncRequest); - command.setSecrets(secretsCommand); - - ResponseForSecretsSyncResponse response = commandRunner.runCommand(command, - BitwardenClient.throwingFunctionWrapper(Converter::ResponseForSecretsSyncResponseFromJsonString)); - - if (response == null || !response.getSuccess()) { - throw new BitwardenClientException(response != null ? response.getErrorMessage() : "Secrets sync failed"); - } - - return response.getData(); - } -} diff --git a/languages/java/src/main/java/com/bitwarden/sdk/ThrowingFunction.java b/languages/java/src/main/java/com/bitwarden/sdk/ThrowingFunction.java deleted file mode 100644 index cab5b10..0000000 --- a/languages/java/src/main/java/com/bitwarden/sdk/ThrowingFunction.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.bitwarden.sdk; - -@FunctionalInterface -public interface ThrowingFunction { - - R accept(T t) throws E; -} diff --git a/languages/js/example/index.js b/languages/js/example/index.js deleted file mode 100644 index 8da3fc5..0000000 --- a/languages/js/example/index.js +++ /dev/null @@ -1,32 +0,0 @@ -const { BitwardenClient: BitwardenClientWasm, LogLevel } = require("@bitwarden/sdk-wasm"); -const sdk = require("@bitwarden/sdk-client"); - -async function main() { - const settings = { - apiUrl: process.env.API_URL, - identityUrl: process.env.IDENTITY_URL, - }; - - const client = new sdk.BitwardenClient( - new BitwardenClientWasm(JSON.stringify(settings), LogLevel.Debug), - ); - - const organization_id = process.env.ORGANIZATION_ID; - await client.accessTokenLogin(process.env.ACCESS_TOKEN); - - const project = await client.projects().create("test", organization_id); - const projects = await client.projects().list(organization_id); - console.log(projects.data); - - const secret = await client - .secrets() - .create("test-secret", "My secret!", "This is my secret", [project.id], organization_id); - const secrets = await client.secrets().list(organization_id); - console.log(secrets.data); - - console.log(project, secret); - - await client.projects().delete([project.id]); - await client.secrets().delete([secret.id]); -} -main(); diff --git a/languages/js/example/package-lock.json b/languages/js/example/package-lock.json deleted file mode 100644 index 2b70169..0000000 --- a/languages/js/example/package-lock.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "sdk-example", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "sdk-example", - "dependencies": { - "@bitwarden/sdk-client": "../sdk-client", - "@bitwarden/sdk-wasm": "../wasm" - } - }, - "../sdk-client": { - "name": "@bitwarden/sdk-client", - "devDependencies": { - "@types/node": "^20.0.0", - "rimraf": "^6.0.0", - "typescript": "^5.0.3" - } - }, - "../wasm": { - "name": "@bitwarden/sdk-wasm", - "version": "0.1.0" - }, - "node_modules/@bitwarden/sdk-client": { - "resolved": "../sdk-client", - "link": true - }, - "node_modules/@bitwarden/sdk-wasm": { - "resolved": "../wasm", - "link": true - } - } -} diff --git a/languages/js/example/package.json b/languages/js/example/package.json deleted file mode 100644 index 836e530..0000000 --- a/languages/js/example/package.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "name": "sdk-example", - "main": "index.js", - "scripts": { - "start": "node index.js" - }, - "dependencies": { - "@bitwarden/sdk-client": "../sdk-client", - "@bitwarden/sdk-wasm": "../wasm" - } -} diff --git a/languages/js/sdk-client/.gitignore b/languages/js/sdk-client/.gitignore deleted file mode 100644 index 29f7d8b..0000000 --- a/languages/js/sdk-client/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -node_modules -pkg diff --git a/languages/js/sdk-client/package-lock.json b/languages/js/sdk-client/package-lock.json deleted file mode 100644 index 5911a33..0000000 --- a/languages/js/sdk-client/package-lock.json +++ /dev/null @@ -1,574 +0,0 @@ -{ - "name": "@bitwarden/sdk-client", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "@bitwarden/sdk-client", - "devDependencies": { - "@types/node": "^20.0.0", - "rimraf": "^6.0.0", - "typescript": "^5.0.3" - } - }, - "node_modules/@isaacs/cliui": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", - "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", - "dev": true, - "license": "ISC", - "dependencies": { - "string-width": "^5.1.2", - "string-width-cjs": "npm:string-width@^4.2.0", - "strip-ansi": "^7.0.1", - "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", - "wrap-ansi": "^8.1.0", - "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@types/node": { - "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": { - "undici-types": "~6.19.2" - } - }, - "node_modules/ansi-regex": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", - "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-regex?sponsor=1" - } - }, - "node_modules/ansi-styles": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", - "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true, - "license": "MIT" - }, - "node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true, - "license": "MIT" - }, - "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", - "dev": true, - "license": "MIT", - "dependencies": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/eastasianwidth": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", - "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", - "dev": true, - "license": "MIT" - }, - "node_modules/emoji-regex": { - "version": "9.2.2", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", - "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", - "dev": true, - "license": "MIT" - }, - "node_modules/foreground-child": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.0.tgz", - "integrity": "sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg==", - "dev": true, - "license": "ISC", - "dependencies": { - "cross-spawn": "^7.0.0", - "signal-exit": "^4.0.1" - }, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/glob": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-11.0.0.tgz", - "integrity": "sha512-9UiX/Bl6J2yaBbxKoEBRm4Cipxgok8kQYcOPEhScPwebu2I0HoQOuYdIO6S3hLuWoZgpDpwQZMzTFxgpkyT76g==", - "dev": true, - "license": "ISC", - "dependencies": { - "foreground-child": "^3.1.0", - "jackspeak": "^4.0.1", - "minimatch": "^10.0.0", - "minipass": "^7.1.2", - "package-json-from-dist": "^1.0.0", - "path-scurry": "^2.0.0" - }, - "bin": { - "glob": "dist/esm/bin.mjs" - }, - "engines": { - "node": "20 || >=22" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "dev": true, - "license": "ISC" - }, - "node_modules/jackspeak": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-4.0.2.tgz", - "integrity": "sha512-bZsjR/iRjl1Nk1UkjGpAzLNfQtzuijhn2g+pbZb98HQ1Gk8vM9hfbxeMBP+M2/UUdwj0RqGG3mlvk2MsAqwvEw==", - "dev": true, - "license": "BlueOak-1.0.0", - "dependencies": { - "@isaacs/cliui": "^8.0.2" - }, - "engines": { - "node": "20 || >=22" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/lru-cache": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.0.1.tgz", - "integrity": "sha512-CgeuL5uom6j/ZVrg7G/+1IXqRY8JXX4Hghfy5YE0EhoYQWvndP1kufu58cmZLNIDKnRhZrXfdS9urVWx98AipQ==", - "dev": true, - "license": "ISC", - "engines": { - "node": "20 || >=22" - } - }, - "node_modules/minimatch": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.0.1.tgz", - "integrity": "sha512-ethXTt3SGGR+95gudmqJ1eNhRO7eGEGIgYA9vnPatK4/etz2MEVDno5GMCibdMTuBMyElzIlgxMna3K94XDIDQ==", - "dev": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": "20 || >=22" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/minipass": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", - "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", - "dev": true, - "license": "ISC", - "engines": { - "node": ">=16 || 14 >=14.17" - } - }, - "node_modules/package-json-from-dist": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz", - "integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==", - "dev": true, - "license": "BlueOak-1.0.0" - }, - "node_modules/path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/path-scurry": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.0.tgz", - "integrity": "sha512-ypGJsmGtdXUOeM5u93TyeIEfEhM6s+ljAhrk5vAvSx8uyY/02OvrZnA0YNGUrPXfpJMgI1ODd3nwz8Npx4O4cg==", - "dev": true, - "license": "BlueOak-1.0.0", - "dependencies": { - "lru-cache": "^11.0.0", - "minipass": "^7.1.2" - }, - "engines": { - "node": "20 || >=22" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/rimraf": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-6.0.1.tgz", - "integrity": "sha512-9dkvaxAsk/xNXSJzMgFqqMCuFgt2+KsOFek3TMLfo8NCPfWpBmqwyNn5Y+NX56QUYfCtsyhF3ayiboEoUmJk/A==", - "dev": true, - "license": "ISC", - "dependencies": { - "glob": "^11.0.0", - "package-json-from-dist": "^1.0.0" - }, - "bin": { - "rimraf": "dist/esm/bin.mjs" - }, - "engines": { - "node": "20 || >=22" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dev": true, - "license": "MIT", - "dependencies": { - "shebang-regex": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/signal-exit": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", - "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", - "dev": true, - "license": "ISC", - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/string-width": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", - "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", - "dev": true, - "license": "MIT", - "dependencies": { - "eastasianwidth": "^0.2.0", - "emoji-regex": "^9.2.2", - "strip-ansi": "^7.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/string-width-cjs": { - "name": "string-width", - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "license": "MIT", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/string-width-cjs/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/string-width-cjs/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true, - "license": "MIT" - }, - "node_modules/string-width-cjs/node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-ansi": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", - "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^6.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/strip-ansi?sponsor=1" - } - }, - "node_modules/strip-ansi-cjs": { - "name": "strip-ansi", - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-ansi-cjs/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/typescript": { - "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": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=14.17" - } - }, - "node_modules/undici-types": { - "version": "6.19.8", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", - "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==", - "dev": true, - "license": "MIT" - }, - "node_modules/which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "license": "ISC", - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "node-which": "bin/node-which" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/wrap-ansi": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", - "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^6.1.0", - "string-width": "^5.0.1", - "strip-ansi": "^7.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/wrap-ansi-cjs": { - "name": "wrap-ansi", - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/wrap-ansi-cjs/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/wrap-ansi-cjs/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/wrap-ansi-cjs/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true, - "license": "MIT" - }, - "node_modules/wrap-ansi-cjs/node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "license": "MIT", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/wrap-ansi-cjs/node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - } - } -} diff --git a/languages/js/sdk-client/package.json b/languages/js/sdk-client/package.json deleted file mode 100644 index 17269ac..0000000 --- a/languages/js/sdk-client/package.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "@bitwarden/sdk-client", - "exports": { - ".": { - "types": "./dist/src/lib.d.ts", - "default": "./dist/src/lib.js" - } - }, - "main": "dist/src/lib.js", - "types": "dist/src/lib.d.ts", - "scripts": { - "build": "npm run clean && tsc", - "clean": "rimraf dist" - }, - "devDependencies": { - "@types/node": "^20.0.0", - "rimraf": "^6.0.0", - "typescript": "^5.0.3" - } -} diff --git a/languages/js/sdk-client/src/client.ts b/languages/js/sdk-client/src/client.ts deleted file mode 100644 index 0f06889..0000000 --- a/languages/js/sdk-client/src/client.ts +++ /dev/null @@ -1,197 +0,0 @@ -import { - Convert, - ProjectResponse, - ProjectsDeleteResponse, - ProjectsResponse, - SecretIdentifiersResponse, - SecretResponse, - SecretsDeleteResponse, -} from "./schemas"; - -interface BitwardenSDKClient { - run_command(js_input: string): Promise; -} - -function handleResponse(response: { success: boolean; errorMessage?: string; data?: T }): T { - if (!response.success) { - throw new Error(response.errorMessage); - } - return response.data as T; -} - -export class BitwardenClient { - client: BitwardenSDKClient; - - constructor(client: BitwardenSDKClient) { - this.client = client; - } - - async accessTokenLogin(accessToken: string): Promise { - const response = await this.client.run_command( - Convert.commandToJson({ - accessTokenLogin: { - accessToken, - }, - }), - ); - - handleResponse(Convert.toResponseForAccessTokenLoginResponse(response)); - } - - secrets(): SecretsClient { - return new SecretsClient(this.client); - } - - projects(): ProjectsClient { - return new ProjectsClient(this.client); - } -} - -export class SecretsClient { - client: BitwardenSDKClient; - - constructor(client: BitwardenSDKClient) { - this.client = client; - } - - async get(id: string): Promise { - const response = await this.client.run_command( - Convert.commandToJson({ - secrets: { - get: { id }, - }, - }), - ); - - return handleResponse(Convert.toResponseForSecretResponse(response)); - } - - async create( - key: string, - value: string, - note: string, - projectIds: string[], - organizationId: string, - ): Promise { - const response = await this.client.run_command( - Convert.commandToJson({ - secrets: { - create: { key, value, note, projectIds, organizationId }, - }, - }), - ); - - return handleResponse(Convert.toResponseForSecretResponse(response)); - } - - async list(organizationId: string): Promise { - const response = await this.client.run_command( - Convert.commandToJson({ - secrets: { - list: { organizationId }, - }, - }), - ); - - return handleResponse(Convert.toResponseForSecretIdentifiersResponse(response)); - } - - async update( - id: string, - key: string, - value: string, - note: string, - projectIds: string[], - organizationId: string, - ): Promise { - const response = await this.client.run_command( - 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.run_command( - Convert.commandToJson({ - secrets: { - delete: { ids }, - }, - }), - ); - - return handleResponse(Convert.toResponseForSecretsDeleteResponse(response)); - } -} - -export class ProjectsClient { - client: BitwardenSDKClient; - - constructor(client: BitwardenSDKClient) { - this.client = client; - } - - async get(id: string): Promise { - const response = await this.client.run_command( - Convert.commandToJson({ - projects: { - get: { id }, - }, - }), - ); - - return handleResponse(Convert.toResponseForProjectResponse(response)); - } - - async create(name: string, organizationId: string): Promise { - const response = await this.client.run_command( - Convert.commandToJson({ - projects: { - create: { name, organizationId }, - }, - }), - ); - - return handleResponse(Convert.toResponseForProjectResponse(response)); - } - - async list(organizationId: string): Promise { - const response = await this.client.run_command( - Convert.commandToJson({ - projects: { - list: { organizationId }, - }, - }), - ); - - return handleResponse(Convert.toResponseForProjectsResponse(response)); - } - - async update(id: string, name: string, organizationId: string): Promise { - const response = await this.client.run_command( - Convert.commandToJson({ - projects: { - update: { id, name, organizationId }, - }, - }), - ); - - return handleResponse(Convert.toResponseForProjectResponse(response)); - } - - async delete(ids: string[]): Promise { - const response = await this.client.run_command( - Convert.commandToJson({ - projects: { - delete: { ids }, - }, - }), - ); - - return handleResponse(Convert.toResponseForProjectsDeleteResponse(response)); - } -} diff --git a/languages/js/sdk-client/src/lib.ts b/languages/js/sdk-client/src/lib.ts deleted file mode 100644 index 7fd93ce..0000000 --- a/languages/js/sdk-client/src/lib.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from "./client"; -export * from "./schemas"; diff --git a/languages/js/sdk-client/tsconfig.json b/languages/js/sdk-client/tsconfig.json deleted file mode 100644 index 987e8d6..0000000 --- a/languages/js/sdk-client/tsconfig.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "compilerOptions": { - "outDir": "./dist/", - "module": "commonjs", - "target": "es5", - "moduleResolution": "node", - "sourceMap": true, - "composite": true, - "declarationMap": true - }, - "include": ["./src/**/*"], -} diff --git a/languages/js/wasm/.gitignore b/languages/js/wasm/.gitignore deleted file mode 100644 index c4f6a47..0000000 --- a/languages/js/wasm/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -bitwarden_wasm_bg.js -bitwarden_wasm_bg.wasm -bitwarden_wasm_bg.wasm.d.ts -bitwarden_wasm_bg.wasm.js -bitwarden_wasm.d.ts -bitwarden_wasm.js diff --git a/languages/js/wasm/index.js b/languages/js/wasm/index.js deleted file mode 100644 index c2b5120..0000000 --- a/languages/js/wasm/index.js +++ /dev/null @@ -1,25 +0,0 @@ -// https://stackoverflow.com/a/47880734 -const supported = (() => { - try { - if (typeof WebAssembly === "object" - && typeof WebAssembly.instantiate === "function") { - const module = new WebAssembly.Module(Uint8Array.of(0x0, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00)); - if (module instanceof WebAssembly.Module) - return new WebAssembly.Instance(module) instanceof WebAssembly.Instance; - } - } catch (e) { - } - return false; -})(); - -let wasm; - -if (supported) { - wasm = await import('./bitwarden_wasm_bg.wasm'); -} else { - wasm = await import('./bitwarden_wasm_bg.wasm.js'); -} - -import { __wbg_set_wasm } from "./bitwarden_wasm_bg.js"; -__wbg_set_wasm(wasm); -export * from "./bitwarden_wasm_bg.js"; diff --git a/languages/js/wasm/package.json b/languages/js/wasm/package.json deleted file mode 100644 index eadbb5f..0000000 --- a/languages/js/wasm/package.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name": "@bitwarden/sdk-wasm", - "version": "0.1.0", - "files": [ - "bitwarden_wasm_bg.js", - "bitwarden_wasm_bg.wasm", - "bitwarden_wasm_bg.wasm.d.ts", - "bitwarden_wasm_bg.wasm.js", - "bitwarden_wasm.d.ts", - "bitwarden_wasm.js", - "index.js", - "node/bitwarden_wasm_bg.wasm", - "node/bitwarden_wasm_bg.wasm.d.ts", - "node/bitwarden_wasm.d.ts", - "node/bitwarden_wasm.js" - ], - "main": "node/bitwarden_wasm.js", - "module": "index.js", - "types": "bitwarden_wasm.d.ts", - "scripts": {}, - "sideEffects": [ - "./bitwarden_wasm.js", - "./snippets/*" - ] -} diff --git a/languages/kotlin/sdk/build.gradle b/languages/kotlin/sdk/build.gradle index 2006e46..ebcb083 100644 --- a/languages/kotlin/sdk/build.gradle +++ b/languages/kotlin/sdk/build.gradle @@ -76,7 +76,7 @@ publishing { repositories { maven { name = 'GitHubPackages' - url = 'https://maven.pkg.github.com/bitwarden/sdk' + url = 'https://maven.pkg.github.com/bitwarden/sdk-internal' credentials { username = System.getenv('GITHUB_ACTOR') password = System.getenv('GITHUB_TOKEN') @@ -96,12 +96,12 @@ File findRustlsPlatformVerifierClassesJar() { }.standardOutput.asText.get() def dependencyJson = new groovy.json.JsonSlurper().parseText(dependencyText) - def manifestPath = file(dependencyJson.packages.find { it.name == "rustls-platform-verifier-android" }.manifest_path) + def manifestPath = file(dependencyJson.packages.find { it.name == 'rustls-platform-verifier-android' }.manifest_path) def aar = fileTree(manifestPath.parentFile).matching { - include "maven/rustls/rustls-platform-verifier/*/rustls-platform-verifier-*.aar" + include 'maven/rustls/rustls-platform-verifier/*/rustls-platform-verifier-*.aar' }.getSingleFile() - return zipTree(aar).matching { include 'classes.jar'}.getSingleFile() + return zipTree(aar).matching { include 'classes.jar' }.getSingleFile() } dependencies { diff --git a/languages/php/.gitignore b/languages/php/.gitignore deleted file mode 100644 index 5d6ed42..0000000 --- a/languages/php/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -.DS_Store -vendor -src/lib/ -src/Schemas/ diff --git a/languages/php/INSTALL.md b/languages/php/INSTALL.md deleted file mode 100644 index 2990533..0000000 --- a/languages/php/INSTALL.md +++ /dev/null @@ -1,56 +0,0 @@ -# PHP Installation - -## Introduction - -Composer is used to build the PHP Bitwarden client library. - -## Prerequisites - -- PHP >= 8.0 -- FFI extension enabled in PHP configuration -- Composer -- Bitwarden SDK native library. - - Expected in one of below locations, depending on the OS and architecture. - The `src` is relative path to the [src](./src) directory. - - Windows x86_64: `src\lib\windows-x64\bitwarden_c.dll` - - Linux x86_64: `src/lib/linux-x64/libbitwarden_c.so` - - macOS x86_64: `src/lib/macos-x64/libbitwarden_c.dylib` - - macOS aarch64: `src/lib/macos-arm64/libbitwarden_c.dylib` - - If you prefer to build the SDK yourself, see the [SDK README.md](../../README.md) for instructions. - -## Build Commands - -```shell -composer install -``` - -## Example - -### macOS - -#### Install Prerequisites - -Use brew Composer and PHP - -```shell -brew install php -brew install composer -``` - -#### Build Commands - -```shell -composer install -``` - -## Example SDK Usage Project - -```shell -export ACCESS_TOKEN="" -export STATE_FILE="" -export ORGANIZATION_ID="" -export API_URL="https://api.bitwarden.com" -export IDENTITY_URL="https://identity.bitwarden.com" - -php example.php -``` diff --git a/languages/php/README.md b/languages/php/README.md deleted file mode 100644 index 61991bd..0000000 --- a/languages/php/README.md +++ /dev/null @@ -1,121 +0,0 @@ -# Bitwarden Secrets Manager SDK wrapper for PHP - -PHP bindings for interacting with the [Bitwarden Secrets Manager]. This is a beta release and might be missing some functionality. - -## Installation - -See the [installation instructions](./INSTALL.md) - -## Usage - -### Create access token - -To interact with the client first you need to obtain the access token from Bitwarden. -Review the help documentation on [Access Tokens]. - -### Create new Bitwarden client - -```php -require_once 'vendor/autoload.php'; - -$access_token = ""; -$state_file = ""; -$organization_id = ""; -$api_url = "https://api.bitwarden.com"; -$identity_url = "https://identity.bitwarden.com"; - -$bitwarden_settings = new \Bitwarden\Sdk\BitwardenSettings($api_url, $identity_url); - -$bitwarden_client = new \Bitwarden\Sdk\BitwardenClient($bitwarden_settings); -$bitwarden_client->auth->login_access_token($access_token, $state_file); -``` - -Initialize `BitwardenSettings` by passing `$api_url` and `$identity_url` or set to null to use the defaults. -The default for `api_url` is `https://api.bitwarden.com` and for `identity_url` is `https://identity.bitwarden.com`. - -### Create new project - -```php -$name = "PHP project"; -$res = $bitwarden_client->projects->create($organization_id, $name); -$project_id = $res->id; -``` - -### Get project - -```php -$res = $bitwarden_client->projects->get($project_id); -``` - -### List all projects - -```php -$res = $bitwarden_client->projects->list($organization_id); -``` - -### Update project - -```php -$name = "Updated PHP project"; -$res = $bitwarden_client->projects->update($organization_id, $project_id, $name); -``` - -### Delete project - -```php -$res = $bitwarden_client->projects->delete([$project_id]); -``` - -### Create new secret - -```php -$key = "Secret key"; -$note = "Secret note"; -$value = "Secret value"; -$res = $bitwarden_client->secrets->create($organization_id, $key, $value, $note, [$project_id]); -$secret_id = $res->id; -``` - -### Get secret - -```php -$res = $bitwarden_client->secrets->get($secret_id); -``` - -### Get multiple secrets - -```php -$res = $bitwarden_client->secrets->get_by_ids([$secret_id]); -``` - -### List all secrets - -```php -$res = $bitwarden_client->secrets->list($organization_id); -``` - -### Update secret - -```php -$key = "Updated key"; -$note = "Updated note"; -$value = "Updated value"; -$res = $bitwarden_client->secrets->update($organization_id, $secret_id, $key, $value, $note, [$project_id]); -``` - -### Sync secrets - -```php -$last_synced_date = "2024-09-01T00:00:00Z"; -$res = $bitwarden_client->secrets->sync($organization_id, $last_synced_date); -``` - -### Delete secret - -```php -$res = $bitwarden_client->secrets->delete([$secret_id]); -``` - -[Access Tokens]: https://bitwarden.com/help/access-tokens/ - -[Bitwarden Secrets Manager]: https://bitwarden.com/products/secrets-manager/ diff --git a/languages/php/composer.json b/languages/php/composer.json deleted file mode 100644 index 6df44ed..0000000 --- a/languages/php/composer.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "bitwarden/sdk-secrets", - "description": "PHP bindings for interacting with the Bitwarden Secrets Manager. This is a beta release and might be missing some functionality.", - "type": "library", - "keywords": ["bitwarden","sdk","password-manager"], - "homepage": "https://github.com/bitwarden/sdk", - "version": "1.0.0", - "require": { - "php": "^8.0", - "ext-ffi": "*" - }, - "autoload": { - "psr-4": { - "Bitwarden\\Sdk\\": "src/" - }, - "files": ["src/Schemas/Schemas.php"] - }, - "authors": [ - { - "name": "Bitwarden Inc." - } - ] -} diff --git a/languages/php/composer.lock b/languages/php/composer.lock deleted file mode 100644 index 1875113..0000000 --- a/languages/php/composer.lock +++ /dev/null @@ -1,21 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", - "This file is @generated automatically" - ], - "content-hash": "1769eb8cdcb42d17f993aa0ef123895b", - "packages": [], - "packages-dev": [], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": [], - "prefer-stable": false, - "prefer-lowest": false, - "platform": { - "php": "^8.0", - "ext-ffi": "*" - }, - "platform-dev": [], - "plugin-api-version": "2.6.0" -} diff --git a/languages/php/example.php b/languages/php/example.php deleted file mode 100644 index 864a4ca..0000000 --- a/languages/php/example.php +++ /dev/null @@ -1,103 +0,0 @@ -auth->login_access_token($access_token, $state_file); - - // create project - print("Projects:\n"); - $res = $bitwarden_client->projects->create($organization_id, 'php project'); - $project_id = $res->id; - print("\tcreate: '" . $project_id . "'\n\n"); - - // get project - $res = $bitwarden_client->projects->get($project_id); - print("\tget: '" . $res->name . "'\n\n"); - - // list projects - $res = $bitwarden_client->projects->list($organization_id); - print("\tlist:\n"); - foreach ($res->data as $project) { - print("\t\tID: '" . $project->id . "', Name: '" . $project->name . "'\n"); - } - print("\n"); - - // update project - $res = $bitwarden_client->projects->update($organization_id, $project_id, 'php test project'); - print("\tupdate: '" . $res->name . "'\n\n"); - - // sync secrets - print("Secrets:\n"); - print("\tSyncing secrets...\n"); - $res = $bitwarden_client->secrets->sync($organization_id, null); - $now = new DateTime(); - $now_string = $now->format('Y-m-d\TH:i:s.u\Z'); - print("\t\tSync has changes: " . ($res->hasChanges ? 'true' : 'false') . "\n\n"); - - print("\tSyncing again to ensure no changes since last sync...\n"); - $res = $bitwarden_client->secrets->sync($organization_id, $now_string); - print("\t\tSync has changes: " . ($res->hasChanges ? 'true' : 'false') . "\n\n"); - - // create secret - $res = $bitwarden_client->secrets->create($organization_id, "New Key", "New value", "New note", [$project_id]); - $secret_id = $res->id; - print("\tcreate: '" . $secret_id . "'\n\n"); - - // get secret - $res = $bitwarden_client->secrets->get($secret_id); - print("\tget: '" . $res->key . "'\n\n"); - - // get multiple secrets by ids - $res = $bitwarden_client->secrets->get_by_ids([$secret_id]); - print("\tget_by_ids:\n"); - foreach ($res->data as $secret) { - print("\t\tID: '" . $secret->id . "', Key: '" . $secret->key . "'\n"); - } - print("\n"); - - // list secrets - $res = $bitwarden_client->secrets->list($organization_id); - print("\tlist:\n"); - foreach ($res->data as $secret) { - print("\t\tID: '" . $secret->id . "', Key: '" . $secret->key . "'\n"); - } - print("\n"); - - // update secret - $res = $bitwarden_client->secrets->update($organization_id, $secret_id, "Updated key", "Updated value", "Updated note", [$project_id]); - print("\tupdate: '" . $res->key . "'\n\n"); - - // delete secret - print("Cleaning up secrets and projects:\n"); - $res = $bitwarden_client->secrets->delete([$secret_id]); - print("\tdelete:\n"); - foreach ($res->data as $secret) { - print("\t\tdeleted secret: '" . $secret->id . "'\n"); - } - print("\n"); - - // delete project - $res = $bitwarden_client->projects->delete([$project_id]); - print("\tdelete:\n"); - foreach ($res->data as $project) { - print("\t\tdeleted project: '" . $project->id . "'\n"); - } - print("\n"); - -} catch (Exception $e) { - print("Error: " . $e->getMessage() . "\n"); - exit(1); -} diff --git a/languages/php/src/AuthClient.php b/languages/php/src/AuthClient.php deleted file mode 100644 index 449c769..0000000 --- a/languages/php/src/AuthClient.php +++ /dev/null @@ -1,35 +0,0 @@ -commandRunner = $commandRunner; - } - - /** - * @throws Exception - */ - public function login_access_token(string $access_token, ?string $state_file): void - { - $access_token_request = new AccessTokenLoginRequest($access_token, $state_file); - $command = new Command(passwordLogin: null, apiKeyLogin: null, loginAccessToken: $access_token_request, - getUserApiKey: null, fingerprint: null, sync: null, secrets: null, projects: null, generators: null); - try { - $result = $this->commandRunner->run($command); - if (!isset($result->authenticated) || !$result->authenticated) { - throw new Exception("Unauthorized"); - } - } catch (Exception $exception) { - throw new Exception("Authorization error: " . $exception->getMessage()); - } - } -} diff --git a/languages/php/src/BitwardenClient.php b/languages/php/src/BitwardenClient.php deleted file mode 100644 index c125b6a..0000000 --- a/languages/php/src/BitwardenClient.php +++ /dev/null @@ -1,45 +0,0 @@ -clientSettings = new ClientSettings(apiUrl: $bitwardenSettings->get_api_url(), - deviceType: DeviceType::$SDK, identityUrl: $bitwardenSettings->get_identity_url(), - userAgent: "Bitwarden PHP-SDK"); - - $this->bitwarden_lib = new BitwardenLib(); - $this->bitwarden_lib->init($this->clientSettings); - - $this->commandRunner = new CommandRunner($this->bitwarden_lib); - $this->projects = new ProjectsClient($this->commandRunner); - $this->secrets = new SecretsClient($this->commandRunner); - $this->auth = new AuthClient($this->commandRunner); - } - - public function __destruct() - { - $this->bitwarden_lib->free_mem(); - } -} diff --git a/languages/php/src/BitwardenLib.php b/languages/php/src/BitwardenLib.php deleted file mode 100644 index 53be329..0000000 --- a/languages/php/src/BitwardenLib.php +++ /dev/null @@ -1,112 +0,0 @@ -ffi = FFI::cdef(' - void* init(const char* param); - char* run_command(void* c_str_ptr, void* client_ptr); - void free_mem(void* client_ptr);', - $lib_file - ); - } - - /** - * @throws JsonException - * @throws Exception - */ - public function init(ClientSettings $client_settings): FFI\CData - { - $encoded_json = $this::json_encode_sdk_format($client_settings->to()); - $this->handle = $this->ffi->init($encoded_json); - return $this->handle; - } - - /** - * @throws JsonException - * @throws Exception - */ - public function run_command(Command $command): stdClass - { - $encoded_json = $this::json_encode_sdk_format($command->to()); - try { - $result = $this->ffi->run_command($encoded_json, $this->handle); - return json_decode(FFI::string($result)); - } catch (FFI\Exception $e) { - throw new RuntimeException('Error occurred during FFI operation: ' . $e->getMessage()); - } - } - - public function free_mem(): void - { - $this->ffi->free_mem($this->handle); - } - - /** - * @throws JsonException - */ - private static function json_encode_sdk_format($object): string - { - $withoutNull = function ($a) use (&$withoutNull) { - if (is_object($a)) { - $a = array_filter((array)$a); - foreach ($a as $k => $v) { - $a[$k] = $withoutNull($v); - } - - return (object)$a; - } - - return $a; - }; - - $object_no_nulls = $withoutNull($object); - - return json_encode($object_no_nulls, JSON_THROW_ON_ERROR | JSON_UNESCAPED_SLASHES); - } -} diff --git a/languages/php/src/BitwardenSettings.php b/languages/php/src/BitwardenSettings.php deleted file mode 100644 index b3d62bc..0000000 --- a/languages/php/src/BitwardenSettings.php +++ /dev/null @@ -1,26 +0,0 @@ -api_url = $api_url; - $this->identity_url = $identity_url; - } - - public function get_api_url(): ?string - { - return $this->api_url; - } - - public function get_identity_url(): ?string - { - return $this->identity_url; - } -} diff --git a/languages/php/src/CommandRunner.php b/languages/php/src/CommandRunner.php deleted file mode 100644 index 532b962..0000000 --- a/languages/php/src/CommandRunner.php +++ /dev/null @@ -1,33 +0,0 @@ -bitwardenLib = $bitwardenLib; - } - - /** - * @throws Exception - */ - public function run(Command $command): stdClass - { - $result = $this->bitwardenLib->run_command($command); - if ($result->success) { - return $result->data; - } - - if (isset($result->errorMessage)) { - throw new Exception($result->errorMessage); - } - throw new Exception("Unknown error occurred"); - } -} diff --git a/languages/php/src/ProjectsClient.php b/languages/php/src/ProjectsClient.php deleted file mode 100644 index cca44f1..0000000 --- a/languages/php/src/ProjectsClient.php +++ /dev/null @@ -1,94 +0,0 @@ -commandRunner = $commandRunner; - } - - /** - * @throws Exception - */ - public function get(string $project_id): stdClass - { - $project_get_request = new ProjectGetRequest($project_id); - $project_get_request->validate(); - $project_command = new ProjectsCommand(get: $project_get_request, create: null, list: null, update: null, - delete: null); - return $this->run_project_command($project_command); - } - - /** - * @throws Exception - */ - public function list(string $organization_id): stdClass - { - $project_list_request = new ProjectsListRequest($organization_id); - $project_list_request->validate(); - $project_command = new ProjectsCommand(get: null, create: null, list: $project_list_request, update: null, - delete: null); - return $this->run_project_command($project_command); - } - - /** - * @throws Exception - */ - public function create(string $organization_id, string $project_name): stdClass - { - $project_create_request = new ProjectCreateRequest(name: $project_name, organizationId: $organization_id); - $project_create_request->validate(); - $project_command = new ProjectsCommand(get: null, create: $project_create_request, list: null, update: null, - delete: null); - return $this->run_project_command($project_command); - } - - /** - * @throws Exception - */ - public function update(string $organization_id, string $project_id, string $project_name): stdClass - { - $project_put_request = new ProjectPutRequest(id: $project_id, name: $project_name, - organizationId: $organization_id); - $project_put_request->validate(); - $project_command = new ProjectsCommand(get: null, create: null, list: null, update: $project_put_request, - delete: null); - return $this->run_project_command($project_command); - } - - /** - * @throws Exception - */ - public function delete(array $ids): stdClass - { - $projects_delete_request = new ProjectsDeleteRequest($ids); - $projects_delete_request->validate(); - $project_command = new ProjectsCommand(get: null, create: null, list: null, update: null, - delete: $projects_delete_request); - return $this->run_project_command($project_command); - } - - /** - * @throws Exception - */ - public function run_project_command($projectCommand): stdClass - { - $command = new Command(passwordLogin: null, apiKeyLogin: null, loginAccessToken: null, getUserApiKey: null, - fingerprint: null, sync: null, secrets: null, projects: $projectCommand, generators: null); - return $this->commandRunner->run($command); - } -} diff --git a/languages/php/src/SecretsClient.php b/languages/php/src/SecretsClient.php deleted file mode 100644 index 85bc334..0000000 --- a/languages/php/src/SecretsClient.php +++ /dev/null @@ -1,125 +0,0 @@ -commandRunner = $commandRunner; - } - - /** - * @throws Exception - */ - public function get(string $secret_id): stdClass - { - $secret_get_request = new SecretGetRequest($secret_id); - $secret_get_request->validate(); - $secrets_command = new SecretsCommand(get: $secret_get_request, getByIds: null, create: null, list: null, - update: null, delete: null, sync: null); - return $this->run_secret_command($secrets_command); - } - - /** - * @throws Exception - */ - public function get_by_ids(array $secret_ids): stdClass - { - $project_get_by_ids_request = new SecretsGetRequest($secret_ids); - $project_get_by_ids_request->validate(); - $secrets_command = new SecretsCommand(get: null, getByIds: $project_get_by_ids_request, create: null, list: null, - update: null, delete: null, sync: null); - return $this->run_secret_command($secrets_command); - } - - /** - * @throws Exception - */ - public function list(string $organization_id): stdClass - { - $secrets_list_request = new SecretIdentifiersRequest($organization_id); - $secrets_list_request->validate(); - $secrets_command = new SecretsCommand(get: null, getByIds: null, create: null, list: $secrets_list_request, - update: null, delete: null, sync: null); - return $this->run_secret_command($secrets_command); - } - - /** - * @throws Exception - */ - public function create(string $organization_id, string $key, string $value, string $note, array $project_ids): stdClass - { - $secrets_create_request = new SecretCreateRequest(key: $key, note: $note, organizationId: $organization_id, - projectIds: $project_ids, value: $value); - $secrets_create_request->validate(); - $secrets_command = new SecretsCommand(get: null, getByIds: null, create: $secrets_create_request, list: null, - update: null, delete: null, sync: null); - return $this->run_secret_command($secrets_command); - } - - /** - * @throws Exception - */ - public function update(string $organization_id, string $id, string $key, string $value, string $note, array $project_ids): stdClass - { - $secrets_put_request = new SecretPutRequest(id: $id, key: $key, note: $note, organizationId: $organization_id, - projectIds: $project_ids, value: $value); - $secrets_put_request->validate(); - $secrets_command = new SecretsCommand(get: null, getByIds: null, create: null, list: null, - update: $secrets_put_request, delete: null, sync: null); - return $this->run_secret_command($secrets_command); - } - - /** - * @throws Exception - */ - public function delete(array $secrets_ids): stdClass - { - $secrets_delete_request = new SecretsDeleteRequest($secrets_ids); - $secrets_delete_request->validate(); - $secrets_command = new SecretsCommand(get: null, getByIds: null, create: null, list: null, - update: null, delete: $secrets_delete_request, sync: null); - return $this->run_secret_command($secrets_command); - } - - /** - * @throws Exception - */ - public function sync(string $organization_id, ?string $last_synced_date): stdClass - { - if (empty($last_synced_date)) { - $last_synced_date = "1970-01-01T00:00:00.000Z"; - } - - $secrets_sync_request = new SecretsSyncRequest(lastSyncedDate: $last_synced_date, organizationId: $organization_id); - $secrets_sync_request->validate(); - $secrets_command = new SecretsCommand(get: null, getByIds: null, create: null, list: null, - update: null, delete: null, sync: $secrets_sync_request); - return $this->run_secret_command($secrets_command); - } - - /** - * @throws Exception - */ - public function run_secret_command($secretsCommand): stdClass - { - $command = new Command(passwordLogin: null, apiKeyLogin: null, loginAccessToken: null, getUserApiKey: null, - fingerprint: null, sync: null, secrets: $secretsCommand, projects: null, generators: null); - return $this->commandRunner->run($command); - } -} diff --git a/languages/python/.gitignore b/languages/python/.gitignore deleted file mode 100644 index 495f629..0000000 --- a/languages/python/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -*.egg-info -bitwarden_py*.so -__pycache__ -.venv diff --git a/languages/python/README.md b/languages/python/README.md deleted file mode 100644 index 29f3f97..0000000 --- a/languages/python/README.md +++ /dev/null @@ -1,59 +0,0 @@ -# Build locally -## Requirements - -- Python 3 -- Rust -- `maturin` (install with `pip install maturin`) -- `npm` - -## Build - -```bash -npm install -npm run schemas # generate schemas.py - -cd languages/python/ -``` - -You will need to build and run the script using a virtual environment. -This will be slightly different depending on the OS you are using: - -```bash -# --- Linux/macOS --- -python3 -m venv .venv -source .venv/bin/activate - -# --- Windows --- -python -m venv venv - -venv\Scripts\activate.bat # cmd.exe -venv\Scripts\Activate.ps1 # Powershell -``` - -## Run - -```bash -maturin develop -python3 ./example.py - -deactivate # run this to close the virtual session -``` - -You can now import `BitwardenClient` in your Python code with: -```python -from bitwarden_sdk import BitwardenClient -``` - -# Use without building locally - -```bash -pip install bitwarden-sdk -``` - -# Run - -Set the `ORGANIZATION_ID` and `ACCESS_TOKEN` environment variables to your organization ID and access token, respectively. - -```bash -python3 ./example.py -``` diff --git a/languages/python/bitwarden_sdk/__init__.py b/languages/python/bitwarden_sdk/__init__.py deleted file mode 100644 index f1712c7..0000000 --- a/languages/python/bitwarden_sdk/__init__.py +++ /dev/null @@ -1,13 +0,0 @@ -"""The official Bitwarden client library for Python.""" - -__version__ = "1.0.0" - -from .bitwarden_client import * -from .schemas import * - -__doc__ = bitwarden_client.__doc__ -if hasattr(bitwarden_client, "__all__"): - __all__ = bitwarden_client.__all__ - -if hasattr(schemas, "__all__"): - __all__ += schemas.__all__ diff --git a/languages/python/bitwarden_sdk/bitwarden_client.py b/languages/python/bitwarden_sdk/bitwarden_client.py deleted file mode 100644 index ac51e8d..0000000 --- a/languages/python/bitwarden_sdk/bitwarden_client.py +++ /dev/null @@ -1,170 +0,0 @@ -import json -from typing import Any, List, Optional -from uuid import UUID -import bitwarden_py - -from .schemas import (ClientSettings, Command, ResponseForSecretIdentifiersResponse, ResponseForSecretResponse, - ResponseForSecretsResponse, ResponseForSecretsDeleteResponse, SecretCreateRequest, - SecretGetRequest, SecretsGetRequest, SecretIdentifiersRequest, SecretPutRequest, - SecretsCommand, SecretsDeleteRequest, SecretsSyncRequest, AccessTokenLoginRequest, - ResponseForSecretsSyncResponse, ResponseForAccessTokenLoginResponse, - ResponseForProjectResponse, ProjectsCommand, ProjectCreateRequest, ProjectGetRequest, - ProjectPutRequest, ProjectsListRequest, ResponseForProjectsResponse, - ResponseForProjectsDeleteResponse, ProjectsDeleteRequest) - - -class BitwardenClient: - def __init__(self, settings: ClientSettings = None): - if settings is None: - self.inner = bitwarden_py.BitwardenClient(None) - else: - settings_json = json.dumps(settings.to_dict()) - self.inner = bitwarden_py.BitwardenClient(settings_json) - - def auth(self): - return AuthClient(self) - - def secrets(self): - return SecretsClient(self) - - def projects(self): - return ProjectsClient(self) - - def _run_command(self, command: Command) -> Any: - response_json = self.inner.run_command(json.dumps(command.to_dict())) - response = json.loads(response_json) - - if response["success"] == False: - raise Exception(response["errorMessage"]) - - return response - - -class AuthClient: - def __init__(self, client: BitwardenClient): - self.client = client - - def login_access_token(self, access_token: str, - state_file: str = None) -> ResponseForAccessTokenLoginResponse: - result = self.client._run_command( - Command(login_access_token=AccessTokenLoginRequest(access_token, state_file)) - ) - return ResponseForAccessTokenLoginResponse.from_dict(result) - - -class SecretsClient: - def __init__(self, client: BitwardenClient): - self.client = client - - def get(self, id: str) -> ResponseForSecretResponse: - result = self.client._run_command( - Command(secrets=SecretsCommand(get=SecretGetRequest(id))) - ) - return ResponseForSecretResponse.from_dict(result) - - def get_by_ids(self, ids: List[UUID]) -> ResponseForSecretsResponse: - result = self.client._run_command( - Command(secrets=SecretsCommand( - get_by_ids=SecretsGetRequest(ids)) - )) - return ResponseForSecretsResponse.from_dict(result) - - def create( - self, - organization_id: UUID, - key: str, - value: str, - note: Optional[str], - project_ids: Optional[List[UUID]] = None, - ) -> ResponseForSecretResponse: - if note is None: - # secrets api does not accept empty notes - note = "" - result = self.client._run_command( - Command(secrets=SecretsCommand( - create=SecretCreateRequest(key, note, organization_id, value, project_ids))) - ) - return ResponseForSecretResponse.from_dict(result) - - def list(self, organization_id: str) -> ResponseForSecretIdentifiersResponse: - result = self.client._run_command( - Command(secrets=SecretsCommand( - list=SecretIdentifiersRequest(organization_id))) - ) - return ResponseForSecretIdentifiersResponse.from_dict(result) - - def update( - self, - organization_id: str, - id: str, - key: str, - value: str, - note: Optional[str], - project_ids: Optional[List[UUID]] = None, - ) -> ResponseForSecretResponse: - if note is None: - # secrets api does not accept empty notes - note = "" - result = self.client._run_command( - Command(secrets=SecretsCommand(update=SecretPutRequest( - id, key, note, organization_id, value, project_ids))) - ) - return ResponseForSecretResponse.from_dict(result) - - def delete(self, ids: List[str]) -> ResponseForSecretsDeleteResponse: - result = self.client._run_command( - Command(secrets=SecretsCommand(delete=SecretsDeleteRequest(ids))) - ) - return ResponseForSecretsDeleteResponse.from_dict(result) - - def sync(self, organization_id: str, last_synced_date: Optional[str]) -> ResponseForSecretsSyncResponse: - result = self.client._run_command( - Command(secrets=SecretsCommand(sync=SecretsSyncRequest(organization_id, last_synced_date))) - ) - return ResponseForSecretsSyncResponse.from_dict(result) - - -class ProjectsClient: - def __init__(self, client: BitwardenClient): - self.client = client - - def get(self, id: str) -> ResponseForProjectResponse: - result = self.client._run_command( - Command(projects=ProjectsCommand(get=ProjectGetRequest(id))) - ) - return ResponseForProjectResponse.from_dict(result) - - def create(self, - organization_id: str, - name: str, - ) -> ResponseForProjectResponse: - result = self.client._run_command( - Command(projects=ProjectsCommand( - create=ProjectCreateRequest(name, organization_id))) - ) - return ResponseForProjectResponse.from_dict(result) - - def list(self, organization_id: str) -> ResponseForProjectsResponse: - result = self.client._run_command( - Command(projects=ProjectsCommand( - list=ProjectsListRequest(organization_id))) - ) - return ResponseForProjectsResponse.from_dict(result) - - def update( - self, - organization_id: str, - id: str, - name: str, - ) -> ResponseForProjectResponse: - result = self.client._run_command( - Command(projects=ProjectsCommand(update=ProjectPutRequest( - id, name, organization_id))) - ) - return ResponseForProjectResponse.from_dict(result) - - def delete(self, ids: List[str]) -> ResponseForProjectsDeleteResponse: - result = self.client._run_command( - Command(projects=ProjectsCommand(delete=ProjectsDeleteRequest(ids))) - ) - return ResponseForProjectsDeleteResponse.from_dict(result) diff --git a/languages/python/example.py b/languages/python/example.py deleted file mode 100755 index ee3690d..0000000 --- a/languages/python/example.py +++ /dev/null @@ -1,83 +0,0 @@ -#!/usr/bin/env python3 -import logging -import os -from datetime import datetime, timezone - -from bitwarden_sdk import BitwardenClient, DeviceType, client_settings_from_dict - -# Create the BitwardenClient, which is used to interact with the SDK -client = BitwardenClient( - client_settings_from_dict( - { - "apiUrl": os.getenv("API_URL", "http://localhost:4000"), - "deviceType": DeviceType.SDK, - "identityUrl": os.getenv("IDENTITY_URL", "http://localhost:33656"), - "userAgent": "Python", - } - ) -) - -# Add some logging & set the org id -logging.basicConfig(level=logging.DEBUG) -organization_id = os.getenv("ORGANIZATION_ID") - -# Set the state file location -# Note: the path must exist, the file will be created & managed by the sdk -state_path = os.getenv("STATE_FILE") - -# Attempt to authenticate with the Secrets Manager Access Token -client.auth().login_access_token(os.getenv("ACCESS_TOKEN"), state_path) - -# -- Example Project Commands -- - -project = client.projects().create(organization_id, "ProjectName") -project2 = client.projects().create(organization_id, "AnotherProject") -updated_project = client.projects().update( - organization_id, project.data.id, "Cool New Project Name" -) -get_that_project = client.projects().get(project.data.id) - -input("Press Enter to delete the project...") -client.projects().delete([project.data.id]) - -print(client.projects().list(organization_id)) - -# -- Example Secret Commands -- - -if client.secrets().sync(organization_id, None).data.has_changes is True: - print("There are changes to sync") -else: - print("No changes to sync") - -last_synced_date = datetime.now(tz=timezone.utc) -print(client.secrets().sync(organization_id, last_synced_date)) - -secret = client.secrets().create( - organization_id, - "TEST_SECRET", - "This is a test secret", - "Secret1234!", - [project2.data.id], -) -secret2 = client.secrets().create( - organization_id, - "ANOTHER_SECRET", - "Secret1234!", - None, - [project2.data.id], -) -secret_updated = client.secrets().update( - organization_id, - secret.data.id, - "TEST_SECRET_UPDATED", - "This as an updated test secret", - "Secret1234!_updated", - [project2.data.id], -) -secrets_retrieved = client.secrets().get_by_ids([secret.data.id, secret2.data.id]) - -# cleanup -input("Press Enter to cleanup secrets and projects...") -client.secrets().delete([secret.id for secret in secrets_retrieved.data.data]) - -client.projects().delete([project2.data.id]) diff --git a/languages/python/openapitools.json b/languages/python/openapitools.json deleted file mode 100644 index 92036ec..0000000 --- a/languages/python/openapitools.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json", - "spaces": 2, - "generator-cli": { - "version": "6.0.0" - } -} diff --git a/languages/python/pyproject.toml b/languages/python/pyproject.toml deleted file mode 100644 index a4ab1f6..0000000 --- a/languages/python/pyproject.toml +++ /dev/null @@ -1,29 +0,0 @@ -[build-system] -build-backend = "maturin" -requires = ["maturin>=1.0,<2.0", "setuptools_rust>=1.8.1"] - -[project] -authors = [{ name = "Bitwarden", email = "support@bitwarden.com" }] -classifiers = [ - "Development Status :: 4 - Beta", - "Intended Audience :: Developers", - "License :: Other/Proprietary License", - "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Rust", - "Topic :: Security", -] -dependencies = ["dateutils >= 0.6.6"] -description = "A Bitwarden Client for python" -name = "bitwarden_sdk" -readme = "README.md" -requires-python = ">=3.0" -version = "1.0.0" - -[tool.maturin] -bindings = "pyo3" -compatibility = "2_28" -include = [ - { path = "bitwarden_sdk/*.py", format = ["sdist", "wheel"] } -] -manifest-path = "../../crates/bitwarden-py/Cargo.toml" -python-packages = ["bitwarden_sdk"] diff --git a/languages/ruby/.gitignore b/languages/ruby/.gitignore deleted file mode 100644 index 92b76b4..0000000 --- a/languages/ruby/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -*.lock -*.gem -bitwarden_sdk_secrets/lib/schemas.rb -bitwarden_sdk_secrets/pkg diff --git a/languages/ruby/CHANGELOG.md b/languages/ruby/CHANGELOG.md deleted file mode 100644 index 0c842ec..0000000 --- a/languages/ruby/CHANGELOG.md +++ /dev/null @@ -1,6 +0,0 @@ -## [Unreleased] - -## [0.1.0] - 2024-02-23 - -- Initial release - diff --git a/languages/ruby/README.md b/languages/ruby/README.md deleted file mode 100644 index 790008b..0000000 --- a/languages/ruby/README.md +++ /dev/null @@ -1,140 +0,0 @@ -# Bitwarden Secrets Manager SDK - -Ruby bindings for interacting with the [Bitwarden Secrets Manager]. This is a beta release and might -be missing some functionality. - -## Installation - -Requirements: Ruby >= 3.0 - -Install gem: `gem install bitwarden-sdk-secrets` - -Import it: `require 'bitwarden-sdk-secrets'` - -## Usage - -To interact with client first you need to obtain access token from Bitwarden. Client will be -initialized with default client settings if they are not provided via env variables. - -```ruby -require 'bitwarden-sdk-secrets' - -# then you can initialize BitwardenSettings: -bitwarden_settings = BitwardenSDK::BitwardenSettings.new( - 'https://api.bitwarden.com', - 'https://identity.bitwarden.com' -) - -# By passing these setting you can initialize BitwardenClient - -bw_client = BitwardenSDK::BitwardenClient.new(bitwarden_settings) -response = bw_client.auth.login_access_token(token, state_file) -puts response -``` - -After successful authorization you can interact with client to manage your projects and secrets. - -```ruby - -# CREATE project -project_name = 'Test project 1' -response = bw_client.projects.create(organization_id, project_name) -puts response -project_id = response['id'] - -# GET project -response = bw_client.projects.get(project_id) -puts response - -# LIST projects -response = bw_client.projects.list(organization_id) -puts response - -# UPDATE projects -name = 'Updated test project 1' -response = bw_client.projects.update(organization_id, project_id, name) -puts response - -# DELETE project -response = bw_client.projects.delete_projects([project_id]) -puts response -``` - -Similarly, you interact with secrets: - -```ruby -# CREATE secret -key = 'AWS-SES' -note = 'Private account' -value = '8t27.dfj;' -response = bw_client.secrets.create(organization_id, key, value, note, [project_id]) -puts response -secret_id = response['id'] - -# GET secret -response = bw_client.secrets.get(secret_id) -puts response - -# GET secret by ids -response = bw_client.secrets.get_by_ids([secret_id]) -puts response - -# LIST secrets -response = bw_client.secrets.list(organization_id) -puts response - -# SYNC secrets -response = bw_client.secrets.sync(organization_id, nil) -last_synced_date = Time.now.utc.strftime('%Y-%m-%dT%H:%M:%S.%6NZ') -puts response - -response = bw_client.secrets.sync(organization_id, last_synced_date) -puts response - -# UPDATE secret -note = 'updated password' -value = '7I.ert10AjK' -response = bw_client.secrets.update(organization_id, secret_id, key, value, note, [project_id]) -puts response - -# DELETE secret -response = bw_client.secrets.delete([secret_id]) -puts response -``` - -## Development - -Prerequisites: - -- Ruby >= 3.0 installed -- Generate schemas `npm run schemas` - -```bash -# Navigate to the ruby language folder -cd languages/ruby - -# Make the binary folder if it doesn't exist already -mkdir -p ./bitwarden_sdk_secrets/lib/macos-arm64 - -# Build and copy the bitwarden-c library -cargo build --package bitwarden-c -cp ../../target/debug/libbitwarden_c.dylib ./bitwarden_sdk_secrets/lib/macos-arm64/libbitwarden_c.dylib - -# Install ruby dependencies -cd ./bitwarden_sdk_secrets -bundle install - -# Install the gem -bundle exec rake install - -## Run example tests -cd .. -export ACCESS_TOKEN="" -export ORGANIZATION_ID="" - -export API_URL=http://localhost:4000 -export IDENTITY_URL=http://localhost:33656 -ruby examples/example.rb -``` - -[Bitwarden Secrets Manager]: https://bitwarden.com/products/secrets-manager/ diff --git a/languages/ruby/bitwarden_sdk_secrets/Gemfile b/languages/ruby/bitwarden_sdk_secrets/Gemfile deleted file mode 100644 index 0f39634..0000000 --- a/languages/ruby/bitwarden_sdk_secrets/Gemfile +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true - -source "https://rubygems.org" - -# Specify your gem's dependencies in exmp.gemspec -gemspec - -gem "rake", "~> 13.0" -gem "rspec", "~> 3.0" -gem "rubocop", "~> 1.21" diff --git a/languages/ruby/bitwarden_sdk_secrets/Rakefile b/languages/ruby/bitwarden_sdk_secrets/Rakefile deleted file mode 100644 index 30550c5..0000000 --- a/languages/ruby/bitwarden_sdk_secrets/Rakefile +++ /dev/null @@ -1,11 +0,0 @@ -# frozen_string_literal: true - -require "bundler/gem_tasks" -require "rubocop/rake_task" -require 'rspec/core/rake_task' - -RSpec::Core::RakeTask.new - -RuboCop::RakeTask.new - -task default: :rubocop diff --git a/languages/ruby/bitwarden_sdk_secrets/bitwarden-sdk-secrets.gemspec b/languages/ruby/bitwarden_sdk_secrets/bitwarden-sdk-secrets.gemspec deleted file mode 100644 index 457e60a..0000000 --- a/languages/ruby/bitwarden_sdk_secrets/bitwarden-sdk-secrets.gemspec +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -require_relative 'lib/version' - -Gem::Specification.new do |spec| - spec.name = 'bitwarden-sdk-secrets' - spec.version = BitwardenSDKSecrets::VERSION - spec.authors = ['Bitwarden Inc.'] - spec.email = ['hello@bitwarden_sdk.com'] - - spec.summary = 'Bitwarden Secrets Manager SDK.' - spec.description = 'Ruby wrapper for Bitwarden secrets manager SDK.' - spec.homepage = 'https://bitwarden.com/products/secrets-manager/' - spec.required_ruby_version = '>= 3.0.0' - - spec.metadata['homepage_uri'] = spec.homepage - spec.metadata['source_code_uri'] = 'https://github.com/bitwarden/sdk' - spec.metadata['changelog_uri'] = 'https://github.com/bitwarden/sdk/blob/main/languages/ruby/CHANGELOG.md' - - # Specify which files should be added to the gem when it is released. - # The `git ls-files -z` loads the files in the RubyGem that have been added into git. - spec.files = Dir.chdir(__dir__) do - `git ls-files -z`.split("\x0").reject do |f| - (File.expand_path(f) == __FILE__) || f.start_with?(*%w[bin/ test/ spec/ features/ .git Gemfile]) - end - end - - spec.files += Dir.glob('lib/linux-x64/**/*') - spec.files += Dir.glob('lib/macos-x64/**/*') - spec.files += Dir.glob('lib/windows-x64/**/*') - spec.files += Dir.glob('lib/macos-arm64/**/*') - spec.files += Dir.glob('lib/schemas.rb') - - spec.bindir = 'exe' - spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) } - spec.require_paths = ['lib'] - - # Uncomment to register a new dependency of your gem - # spec.add_dependency "example-gem", "~> 1.0" - spec.add_dependency 'dry-struct', '~> 1.6' - spec.add_dependency 'dry-types', '~> 1.7' - spec.add_dependency 'ffi', '~> 1.15' - spec.add_dependency 'json', '~> 2.6' - spec.add_dependency 'rake', '~> 13.0' - spec.add_dependency 'rubocop', '~> 1.21' - -end diff --git a/languages/ruby/bitwarden_sdk_secrets/lib/auth.rb b/languages/ruby/bitwarden_sdk_secrets/lib/auth.rb deleted file mode 100644 index 481f302..0000000 --- a/languages/ruby/bitwarden_sdk_secrets/lib/auth.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true -require_relative 'bitwarden_error' - -module BitwardenSDKSecrets - class AuthClient - def initialize(command_runner) - @command_runner = command_runner - end - - def login_access_token(access_token, state_file = nil) - access_token_request = AccessTokenLoginRequest.new(access_token: access_token, state_file: state_file) - @command_runner.run(SelectiveCommand.new(login_access_token: access_token_request)) - nil - end - end -end diff --git a/languages/ruby/bitwarden_sdk_secrets/lib/bitwarden-sdk-secrets.rb b/languages/ruby/bitwarden_sdk_secrets/lib/bitwarden-sdk-secrets.rb deleted file mode 100644 index 4cd1c25..0000000 --- a/languages/ruby/bitwarden_sdk_secrets/lib/bitwarden-sdk-secrets.rb +++ /dev/null @@ -1,52 +0,0 @@ -# frozen_string_literal: true - -require 'json' -require 'dry-types' - -require_relative 'schemas' -require_relative 'extended_schemas/schemas' -require_relative 'command_runner' -require_relative 'bitwarden_lib' -require_relative 'bitwarden_error' -require_relative 'projects' -require_relative 'secrets' -require_relative 'auth' - -module BitwardenSDKSecrets - class BitwardenSettings - attr_accessor :api_url, :identity_url - - def initialize(api_url, identity_url) - # if api_url.nil? || identity_url.nil? - # raise ArgumentError, "api_url and identity_url cannot be nil" - # end - - @api_url = api_url - @identity_url = identity_url - end - end - - class BitwardenClient - attr_reader :bitwarden, :projects, :secrets, :auth - - def initialize(bitwarden_settings) - client_settings = ClientSettings.new( - api_url: bitwarden_settings.api_url, - identity_url: bitwarden_settings.identity_url, - user_agent: 'Bitwarden RUBY-SDK', - device_type: nil - ) - - @bitwarden = BitwardenLib - @handle = @bitwarden.init(client_settings.to_dynamic.compact.to_json) - @command_runner = CommandRunner.new(@bitwarden, @handle) - @projects = ProjectsClient.new(@command_runner) - @secrets = SecretsClient.new(@command_runner) - @auth = AuthClient.new(@command_runner) - end - - def free_mem - @bitwarden.free_mem(@handle) - end - end -end diff --git a/languages/ruby/bitwarden_sdk_secrets/lib/bitwarden_error.rb b/languages/ruby/bitwarden_sdk_secrets/lib/bitwarden_error.rb deleted file mode 100644 index b2239e2..0000000 --- a/languages/ruby/bitwarden_sdk_secrets/lib/bitwarden_error.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -module BitwardenSDKSecrets - class BitwardenError < StandardError - def initialize(message = 'Error getting response') - super(message) - end - end -end diff --git a/languages/ruby/bitwarden_sdk_secrets/lib/bitwarden_lib.rb b/languages/ruby/bitwarden_sdk_secrets/lib/bitwarden_lib.rb deleted file mode 100644 index 05ab514..0000000 --- a/languages/ruby/bitwarden_sdk_secrets/lib/bitwarden_lib.rb +++ /dev/null @@ -1,35 +0,0 @@ -# frozen_string_literal: true - -require 'ffi' - -module BitwardenSDKSecrets - module BitwardenLib - extend FFI::Library - - def self.mac_with_intel? - `uname -m`.strip == 'x86_64' - end - - ffi_lib case RUBY_PLATFORM - when /darwin/ - local_file = if mac_with_intel? - File.expand_path('macos-x64/libbitwarden_c.dylib', __dir__) - else - File.expand_path('macos-arm64/libbitwarden_c.dylib', __dir__) - end - File.exist?(local_file) ? local_file : File.expand_path('../../../../target/debug/libbitwarden_c.dylib', __dir__) - when /linux/ - local_file = File.expand_path('linux-x64/libbitwarden_c.so', __dir__) - File.exist?(local_file) ? local_file : File.expand_path('../../../../target/debug/libbitwarden_c.so', __dir__) - when /mswin|mingw/ - local_file = File.expand_path('windows-x64/bitwarden_c.dll', __dir__) - File.exist?(local_file) ? local_file : File.expand_path('../../../../target/debug/bitwarden_c.dll', __dir__) - else - raise "Unsupported platform: #{RUBY_PLATFORM}" - end - - attach_function :init, [:string], :pointer - attach_function :run_command, %i[string pointer], :string - attach_function :free_mem, [:pointer], :void - end -end diff --git a/languages/ruby/bitwarden_sdk_secrets/lib/command_runner.rb b/languages/ruby/bitwarden_sdk_secrets/lib/command_runner.rb deleted file mode 100644 index 80e846a..0000000 --- a/languages/ruby/bitwarden_sdk_secrets/lib/command_runner.rb +++ /dev/null @@ -1,15 +0,0 @@ -# frozen_string_literal: true - -module BitwardenSDKSecrets - class CommandRunner - def initialize(bitwarden_sdk, handle) - @bitwarden_sdk = bitwarden_sdk - @handle = handle - end - - # @param [Dry-Struct] cmd - def run(cmd) - @bitwarden_sdk.run_command(cmd.to_json, @handle) - end - end -end diff --git a/languages/ruby/bitwarden_sdk_secrets/lib/extended_schemas/schemas.rb b/languages/ruby/bitwarden_sdk_secrets/lib/extended_schemas/schemas.rb deleted file mode 100644 index bcdfa5e..0000000 --- a/languages/ruby/bitwarden_sdk_secrets/lib/extended_schemas/schemas.rb +++ /dev/null @@ -1,78 +0,0 @@ - -module BitwardenSDKSecrets - class SelectiveCommand < Command - attribute :password_login, PasswordLoginRequest.optional.default(nil) - attribute :api_key_login, APIKeyLoginRequest.optional.default(nil) - attribute :login_access_token, AccessTokenLoginRequest.optional.default(nil) - attribute :get_user_api_key, SecretVerificationRequest.optional.default(nil) - attribute :fingerprint, FingerprintRequest.optional.default(nil) - attribute :sync, SyncRequest.optional.default(nil) - attribute :secrets, SecretsCommand.optional.default(nil) - attribute :projects, ProjectsCommand.optional.default(nil) - attribute :generators, GeneratorsCommand.optional.default(nil) - - def to_dynamic - { - "passwordLogin" => password_login&.to_dynamic, - "apiKeyLogin" => api_key_login&.to_dynamic, - "loginAccessToken" => login_access_token&.to_dynamic, - "getUserApiKey" => get_user_api_key&.to_dynamic, - "fingerprint" => fingerprint&.to_dynamic, - "sync" => sync&.to_dynamic, - "secrets" => secrets&.to_dynamic, - "projects" => projects&.to_dynamic, - "generators" => generators&.to_dynamic, - }.compact - end - end - - class SelectiveProjectsCommand < ProjectsCommand - attribute :get, ProjectGetRequest.optional.default(nil) - attribute :create, ProjectCreateRequest.optional.default(nil) - attribute :list, ProjectsListRequest.optional.default(nil) - attribute :update, ProjectPutRequest.optional.default(nil) - attribute :delete, ProjectsDeleteRequest.optional.default(nil) - - def to_dynamic - { - "get" => get&.to_dynamic, - "create" => create&.to_dynamic, - "list" => list&.to_dynamic, - "update" => update&.to_dynamic, - "delete" => delete&.to_dynamic, - }.compact - end - end - - class SelectiveSecretsCommand < SecretsCommand - attribute :get, SecretGetRequest.optional.default(nil) - attribute :get_by_ids, SecretsGetRequest.optional.default(nil) - attribute :create, SecretCreateRequest.optional.default(nil) - attribute :list, SecretIdentifiersRequest.optional.default(nil) - attribute :update, SecretPutRequest.optional.default(nil) - attribute :delete, SecretsDeleteRequest.optional.default(nil) - attribute :sync, SecretsSyncRequest.optional.default(nil) - - def to_dynamic - { - "get" => get&.to_dynamic, - "getByIds" => get_by_ids&.to_dynamic, - "create" => create&.to_dynamic, - "list" => list&.to_dynamic, - "update" => update&.to_dynamic, - "delete" => delete&.to_dynamic, - "sync" => sync&.to_dynamic, - }.compact - end - end - - class SelectiveGeneratorsCommand < GeneratorsCommand - attribute :generate_password, PasswordGeneratorRequest.optional.default(nil) - - def to_dynamic - { - "generate_password" => generate_password&.to_dynamic, - }.compact - end - end -end diff --git a/languages/ruby/bitwarden_sdk_secrets/lib/projects.rb b/languages/ruby/bitwarden_sdk_secrets/lib/projects.rb deleted file mode 100644 index bf4e903..0000000 --- a/languages/ruby/bitwarden_sdk_secrets/lib/projects.rb +++ /dev/null @@ -1,116 +0,0 @@ -# frozen_string_literal: true - -require_relative 'bitwarden_error' - -module BitwardenSDKSecrets - class ProjectsClient - def initialize(command_runner) - @command_runner = command_runner - end - - def create(organization_id, project_name) - project_create_request = ProjectCreateRequest.new( - project_create_request_name: project_name, - organization_id: organization_id - ) - command = create_command( - create: project_create_request - ) - response = parse_response(command) - - projects_response = ResponseForProjectResponse.from_json!(response).to_dynamic - - if projects_response.key?('success') && projects_response['success'] == true && - projects_response.key?('data') - return projects_response['data'] - end - - error_response(projects_response) - end - - def get(project_id) - project_get_request = ProjectGetRequest.new(id: project_id) - command = create_command(get: project_get_request) - response = parse_response(command) - - projects_response = ResponseForProjectResponse.from_json!(response).to_dynamic - - if projects_response.key?('success') && projects_response['success'] == true && - projects_response.key?('data') - return projects_response['data'] - end - - error_response(projects_response) - end - - def list(organization_id) - project_list_request = ProjectsListRequest.new(organization_id: organization_id) - command = create_command(list: project_list_request) - response = parse_response(command) - - projects_response = ResponseForProjectsResponse.from_json!(response).to_dynamic - - if projects_response.key?('success') && projects_response['success'] == true && - projects_response.key?('data') && projects_response['data'].key?('data') - return projects_response['data']['data'] - end - - error_response(projects_response) - end - - def update(organization_id, id, project_put_request_name) - project_put_request = ProjectPutRequest.new( - id: id, - project_put_request_name: project_put_request_name, - organization_id: organization_id - ) - command = create_command( - update: project_put_request - ) - response = parse_response(command) - - projects_response = ResponseForProjectResponse.from_json!(response).to_dynamic - - if projects_response.key?('success') && projects_response['success'] == true && - projects_response.key?('data') - return projects_response['data'] - end - - error_response(projects_response) - end - - def delete(ids) - project_delete_request = ProjectsDeleteRequest.new(ids: ids) - command = create_command(delete: project_delete_request) - response = parse_response(command) - - projects_response = ResponseForProjectsDeleteResponse.from_json!(response).to_dynamic - - if projects_response.key?('success') && projects_response['success'] == true && - projects_response.key?('data') && projects_response['data'].key?('data') - return projects_response['data']['data'] - end - - error_response(projects_response) - end - - private - - def error_response(response) - raise BitwardenError, response['errorMessage'] if response.key?('errorMessage') - - raise BitwardenError, 'Error while getting response' - end - - def create_command(commands) - SelectiveCommand.new(projects: SelectiveProjectsCommand.new(commands)) - end - - def parse_response(command) - response = @command_runner.run(command) - raise BitwardenError, 'Error getting response' if response.nil? - - response - end - end -end diff --git a/languages/ruby/bitwarden_sdk_secrets/lib/secrets.rb b/languages/ruby/bitwarden_sdk_secrets/lib/secrets.rb deleted file mode 100644 index 5dda988..0000000 --- a/languages/ruby/bitwarden_sdk_secrets/lib/secrets.rb +++ /dev/null @@ -1,140 +0,0 @@ -# frozen_string_literal: true - -require 'json' - -module BitwardenSDKSecrets - class SecretsClient - def initialize(command_runner) - @command_runner = command_runner - end - - def get(id) - command = create_command(get: SecretGetRequest.new(id: id)) - response = run_command(command) - - secrets_response = ResponseForSecretResponse.from_json!(response).to_dynamic - - if secrets_response.key?('success') && secrets_response['success'] == true && - secrets_response.key?('data') - return secrets_response['data'] - end - - error_response(secrets_response) - end - - def get_by_ids(ids) - command = create_command(get_by_ids: SecretsGetRequest.new(ids: ids)) - response = run_command(command) - - secrets_response = ResponseForSecretIdentifiersResponse.from_json!(response).to_dynamic - - if secrets_response.key?('success') && secrets_response['success'] == true && - secrets_response.key?('data') && secrets_response['data'].key?('data') - return secrets_response['data']['data'] - end - - error_response(secrets_response) - end - - def sync(organization_id, last_synced_date) - command = create_command( - sync: SecretsSyncRequest.new(organization_id: organization_id, last_synced_date: last_synced_date) - ) - response = run_command(command) - - secrets_response = ResponseForSecretsSyncResponse.from_json!(response).to_dynamic - - if secrets_response.key?('success') && secrets_response['success'] == true && - secrets_response.key?('data') - return secrets_response['data'] - end - - error_response(secrets_response) - end - - def create(organization_id, key, value, note, project_ids) - command = create_command( - create: SecretCreateRequest.new( - key: key, note: note, organization_id: organization_id, project_ids: project_ids, value: value - ) - ) - response = run_command(command) - - secrets_response = ResponseForSecretResponse.from_json!(response).to_dynamic - - if secrets_response.key?('success') && secrets_response['success'] == true && - secrets_response.key?('data') - return secrets_response['data'] - end - - error_response(secrets_response) - end - - def list(organization_id) - command = create_command(list: SecretIdentifiersRequest.new(organization_id: organization_id)) - response = run_command(command) - - secrets_response = ResponseForSecretIdentifiersResponse.from_json!(response).to_dynamic - - if secrets_response.key?('success') && secrets_response['success'] == true && - secrets_response.key?('data') && secrets_response['data'].key?('data') - return secrets_response['data']['data'] - end - - error_response(secrets_response) - end - - def update(organization_id, id, key, value, note, project_ids) - command = create_command( - update: SecretPutRequest.new( - id: id, key: key, note: note, organization_id: organization_id, project_ids: project_ids, value: value - ) - ) - response = run_command(command) - - secrets_response = ResponseForSecretResponse.from_json!(response).to_dynamic - - if secrets_response.key?('success') && secrets_response['success'] == true && - secrets_response.key?('data') - return secrets_response['data'] - end - - error_response(secrets_response) - end - - def delete(ids) - command = create_command(delete: SecretsDeleteRequest.new(ids: ids)) - response = run_command(command) - - secrets_response = ResponseForSecretsDeleteResponse.from_json!(response).to_dynamic - - if secrets_response.key?('success') && secrets_response['success'] == true && - secrets_response.key?('data') && secrets_response['data'].key?('data') - return secrets_response['data']['data'] - end - - error_response(secrets_response) - end - - private - - def error_response(response) - if response['errorMessage'] - raise BitwardenError, response['errorMessage'] if response.key?('errorMessage') - else - raise BitwardenError, 'Error while getting response' - end - end - - def create_command(commands) - SelectiveCommand.new(secrets: SelectiveSecretsCommand.new(commands)) - end - - def run_command(command) - response = @command_runner.run(command) - raise BitwardenError, 'Error getting response' if response.nil? - - response - end - end -end diff --git a/languages/ruby/bitwarden_sdk_secrets/lib/version.rb b/languages/ruby/bitwarden_sdk_secrets/lib/version.rb deleted file mode 100644 index 39b47b4..0000000 --- a/languages/ruby/bitwarden_sdk_secrets/lib/version.rb +++ /dev/null @@ -1,5 +0,0 @@ -# frozen_string_literal: true - -module BitwardenSDKSecrets - VERSION = '1.0.0' -end diff --git a/languages/ruby/bitwarden_sdk_secrets/sig/auth.rbs b/languages/ruby/bitwarden_sdk_secrets/sig/auth.rbs deleted file mode 100644 index 4e75cf4..0000000 --- a/languages/ruby/bitwarden_sdk_secrets/sig/auth.rbs +++ /dev/null @@ -1,9 +0,0 @@ -module BitwardenSDKSecrets - class AuthClient - @command_runner: untyped - - def initialize: (untyped command_runner) -> void - - def login_access_token: (untyped access_token, ?untyped? state_file) -> nil - end -end diff --git a/languages/ruby/bitwarden_sdk_secrets/sig/bitwarden-sdk-secrets.rbs b/languages/ruby/bitwarden_sdk_secrets/sig/bitwarden-sdk-secrets.rbs deleted file mode 100644 index ffca59e..0000000 --- a/languages/ruby/bitwarden_sdk_secrets/sig/bitwarden-sdk-secrets.rbs +++ /dev/null @@ -1,39 +0,0 @@ -module BitwardenSDKSecrets - class BitwardenSettings - @api_url: untyped - - @identity_url: untyped - - attr_accessor api_url: untyped - - attr_accessor identity_url: untyped - - def initialize: (untyped api_url, untyped identity_url) -> void - end - - class BitwardenClient - @bitwarden: untyped - - @handle: untyped - - @command_runner: untyped - - @projects: untyped - - @secrets: untyped - - @auth: untyped - - attr_reader bitwarden: untyped - - attr_reader projects: untyped - - attr_reader secrets: untyped - - attr_reader auth: untyped - - def initialize: (untyped bitwarden_settings) -> void - - def free_mem: () -> untyped - end -end diff --git a/languages/ruby/bitwarden_sdk_secrets/sig/bitwarden_error.rbs b/languages/ruby/bitwarden_sdk_secrets/sig/bitwarden_error.rbs deleted file mode 100644 index 99c60f4..0000000 --- a/languages/ruby/bitwarden_sdk_secrets/sig/bitwarden_error.rbs +++ /dev/null @@ -1,5 +0,0 @@ -module BitwardenSDKSecrets - class BitwardenError < StandardError - def initialize: (?::String message) -> void - end -end diff --git a/languages/ruby/bitwarden_sdk_secrets/sig/bitwarden_lib.rbs b/languages/ruby/bitwarden_sdk_secrets/sig/bitwarden_lib.rbs deleted file mode 100644 index 6038fbf..0000000 --- a/languages/ruby/bitwarden_sdk_secrets/sig/bitwarden_lib.rbs +++ /dev/null @@ -1,7 +0,0 @@ -module BitwardenSDKSecrets - module BitwardenLib - extend FFI::Library - - def self.mac_with_intel?: () -> untyped - end -end diff --git a/languages/ruby/bitwarden_sdk_secrets/sig/command_runner.rbs b/languages/ruby/bitwarden_sdk_secrets/sig/command_runner.rbs deleted file mode 100644 index 4836790..0000000 --- a/languages/ruby/bitwarden_sdk_secrets/sig/command_runner.rbs +++ /dev/null @@ -1,12 +0,0 @@ -module BitwardenSDKSecrets - class CommandRunner - @bitwarden_sdk: untyped - - @handle: untyped - - def initialize: (untyped bitwarden_sdk, untyped handle) -> void - - # @param [Dry-Struct] cmd - def run: (untyped cmd) -> untyped - end -end diff --git a/languages/ruby/bitwarden_sdk_secrets/sig/projects.rbs b/languages/ruby/bitwarden_sdk_secrets/sig/projects.rbs deleted file mode 100644 index e68df3d..0000000 --- a/languages/ruby/bitwarden_sdk_secrets/sig/projects.rbs +++ /dev/null @@ -1,25 +0,0 @@ -module BitwardenSDKSecrets - class ProjectsClient - @command_runner: untyped - - def initialize: (untyped command_runner) -> void - - def create: (untyped organization_id, untyped project_name) -> untyped - - def get: (untyped project_id) -> untyped - - def list: (untyped organization_id) -> untyped - - def update: (untyped organization_id, untyped id, untyped project_put_request_name) -> untyped - - def delete: (untyped ids) -> untyped - - private - - def error_response: (untyped response) -> untyped - - def create_command: (untyped commands) -> untyped - - def parse_response: (untyped command) -> untyped - end -end diff --git a/languages/ruby/bitwarden_sdk_secrets/sig/secrets.rbs b/languages/ruby/bitwarden_sdk_secrets/sig/secrets.rbs deleted file mode 100644 index 8590fd8..0000000 --- a/languages/ruby/bitwarden_sdk_secrets/sig/secrets.rbs +++ /dev/null @@ -1,29 +0,0 @@ -module BitwardenSDKSecrets - class SecretsClient - @command_runner: untyped - - def initialize: (untyped command_runner) -> void - - def get: (untyped id) -> untyped - - def get_by_ids: (untyped ids) -> untyped - - def sync: (untyped organization_id, untyped last_synced_date) -> untyped - - def create: (untyped organization_id, untyped key, untyped value, untyped note, untyped project_ids) -> untyped - - def list: (untyped organization_id) -> untyped - - def update: (untyped organization_id, untyped id, untyped key, untyped value, untyped note, untyped project_ids) -> untyped - - def delete: (untyped ids) -> untyped - - private - - def error_response: (untyped response) -> (untyped | nil | untyped) - - def create_command: (untyped commands) -> untyped - - def run_command: (untyped command) -> untyped - end -end diff --git a/languages/ruby/bitwarden_sdk_secrets/sig/version.rbs b/languages/ruby/bitwarden_sdk_secrets/sig/version.rbs deleted file mode 100644 index 869b679..0000000 --- a/languages/ruby/bitwarden_sdk_secrets/sig/version.rbs +++ /dev/null @@ -1,3 +0,0 @@ -module BitwardenSDKSecrets - VERSION: "0.2.0" -end diff --git a/languages/ruby/bitwarden_sdk_secrets/spec/settings_spec.rb b/languages/ruby/bitwarden_sdk_secrets/spec/settings_spec.rb deleted file mode 100644 index 9db0e34..0000000 --- a/languages/ruby/bitwarden_sdk_secrets/spec/settings_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -require 'schemas' -require 'extended_schemas/schemas' - -describe ClientSettings do - it "test" do - client_settings = ClientSettings.new( - api_url: nil, - identity_url: nil, - user_agent: 'Bitwarden RUBY-SDK', - device_type: nil - ) - - expect(client_settings.to_dynamic.compact.to_json).to eq('{"userAgent":"Bitwarden RUBY-SDK"}') - end -end diff --git a/languages/ruby/examples/example.rb b/languages/ruby/examples/example.rb deleted file mode 100644 index 29a6867..0000000 --- a/languages/ruby/examples/example.rb +++ /dev/null @@ -1,77 +0,0 @@ -# NOTE - for example purpose only - import gem instead -require 'bitwarden-sdk-secrets' - -token = ENV['ACCESS_TOKEN'] -organization_id = ENV['ORGANIZATION_ID'] -state_file = ENV['STATE_FILE'] - -# Configuring the URLS is optional, set them to nil to use the default values -api_url = ENV['API_URL'] -identity_url = ENV['IDENTITY_URL'] - -bitwarden_settings = BitwardenSDKSecrets::BitwardenSettings.new(api_url, identity_url) - -bw_client = BitwardenSDKSecrets::BitwardenClient.new(bitwarden_settings) -response = bw_client.auth.login_access_token(token, state_file) -puts response - -# CREATE project -project_name = 'Test project 1' -response = bw_client.projects.create(organization_id, project_name) -puts response -project_id = response['id'] - -# GET project -response = bw_client.projects.get(project_id) -puts response - -# LIST projects -response = bw_client.projects.list(organization_id) -puts response - -# UPDATE projects -name = 'Updated test project 1' -response = bw_client.projects.update(organization_id, project_id, name) -puts response - -# CREATE secret -key = 'AWS-SES' -note = 'Private account' -value = '8t27.dfj;' -response = bw_client.secrets.create(organization_id, key, value, note, [project_id]) -puts response -secret_id = response['id'] - -# GET secret -response = bw_client.secrets.get(secret_id) -puts response - -# GET secret by ids -response = bw_client.secrets.get_by_ids([secret_id]) -puts response - -# LIST secrets -response = bw_client.secrets.list(organization_id) -puts response - -# SYNC secrets -response = bw_client.secrets.sync(organization_id, nil) -last_synced_date = Time.now.utc.strftime('%Y-%m-%dT%H:%M:%S.%6NZ') -puts response - -response = bw_client.secrets.sync(organization_id, last_synced_date) -puts response - -# UPDATE secret -note = 'updated password' -value = '7I.ert10AjK' -response = bw_client.secrets.update(organization_id, secret_id, key, value, note, [project_id]) -puts response - -# DELETE secret -response = bw_client.secrets.delete([secret_id]) -puts response - -# DELETE project -response = bw_client.projects.delete([project_id]) -puts response diff --git a/languages/ruby/gen_ruby_typedefs.sh b/languages/ruby/gen_ruby_typedefs.sh deleted file mode 100755 index acd2bcc..0000000 --- a/languages/ruby/gen_ruby_typedefs.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash -# shellcheck disable=SC3044,SC3020 - -# bail if rbs is not installed -if ! command -v rbs &>/dev/null; then - echo "rbs could not be found" - exit -fi - -# use consistent repository root to avoid relative paths -REPO_ROOT="$(git rev-parse --show-toplevel)" -pushd "$REPO_ROOT"/languages/ruby || exit - -# delete existing typedefs -rm -rf bitwarden_sdk_secrets/sig/* -mkdir -p bitwarden_sdk_secrets/sig - -# generate typedefs -RUBY_LIB_FILES="$(find bitwarden_sdk_secrets/lib -name "*.rb")" - -for file in $RUBY_LIB_FILES; do - rbs prototype rb "$file" >bitwarden_sdk_secrets/sig/"$(basename "$file" .rb).rbs" - rm -f bitwarden_sdk_secrets/sig/schemas.rbs -done - -popd || exit diff --git a/package-lock.json b/package-lock.json index bdf9b48..6dc40fe 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,20 +1,16 @@ { - "name": "@bitwarden/sdk", + "name": "@bitwarden/sdk-internal", "version": "0.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "@bitwarden/sdk", + "name": "@bitwarden/sdk-internal", "version": "0.0.0", "license": "SEE LICENSE IN LICENSE", "devDependencies": { - "@openapitools/openapi-generator-cli": "2.14.0", - "prettier": "3.3.3", - "quicktype-core": "23.0.170", - "rimraf": "6.0.1", - "ts-node": "10.9.2", - "typescript": "5.5.4" + "@openapitools/openapi-generator-cli": "2.13.4", + "prettier": "3.3.3" } }, "node_modules/@babel/runtime": { @@ -22,7 +18,6 @@ "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.25.7.tgz", "integrity": "sha512-FjoyLe754PMiYsFaN5C94ttGiOmBNYTf6pLr4xXHAT5uctHb092PBszndLDR5XA/jghQvn4n7JMHl7dmTgbm9w==", "dev": true, - "license": "MIT", "dependencies": { "regenerator-runtime": "^0.14.0" }, @@ -30,173 +25,20 @@ "node": ">=6.9.0" } }, - "node_modules/@cspotcode/source-map-support": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", - "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jridgewell/trace-mapping": "0.3.9" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@glideapps/ts-necessities": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/@glideapps/ts-necessities/-/ts-necessities-2.2.3.tgz", - "integrity": "sha512-gXi0awOZLHk3TbW55GZLCPP6O+y/b5X1pBXKBVckFONSwF1z1E5ND2BGJsghQFah+pW7pkkyFb2VhUQI2qhL5w==", - "dev": true, - "license": "MIT" - }, - "node_modules/@isaacs/cliui": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", - "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", - "dev": true, - "license": "ISC", - "dependencies": { - "string-width": "^5.1.2", - "string-width-cjs": "npm:string-width@^4.2.0", - "strip-ansi": "^7.0.1", - "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", - "wrap-ansi": "^8.1.0", - "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@isaacs/cliui/node_modules/ansi-regex": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", - "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-regex?sponsor=1" - } - }, - "node_modules/@isaacs/cliui/node_modules/ansi-styles": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", - "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/@isaacs/cliui/node_modules/emoji-regex": { - "version": "9.2.2", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", - "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", - "dev": true, - "license": "MIT" - }, - "node_modules/@isaacs/cliui/node_modules/string-width": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", - "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", - "dev": true, - "license": "MIT", - "dependencies": { - "eastasianwidth": "^0.2.0", - "emoji-regex": "^9.2.2", - "strip-ansi": "^7.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/@isaacs/cliui/node_modules/strip-ansi": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", - "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^6.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/strip-ansi?sponsor=1" - } - }, - "node_modules/@isaacs/cliui/node_modules/wrap-ansi": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", - "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^6.1.0", - "string-width": "^5.0.1", - "strip-ansi": "^7.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/@jridgewell/resolve-uri": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", - "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", - "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.9", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", - "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jridgewell/resolve-uri": "^3.0.3", - "@jridgewell/sourcemap-codec": "^1.4.10" - } - }, "node_modules/@lukeed/csprng": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@lukeed/csprng/-/csprng-1.1.0.tgz", "integrity": "sha512-Z7C/xXCiGWsg0KuKsHTKJxbWhpI3Vs5GwLfOean7MGyVFGqdRgBbAjOCh6u4bbjPc/8MJ2pZmK/0DLdCbivLDA==", "dev": true, - "license": "MIT", "engines": { "node": ">=8" } }, "node_modules/@nestjs/axios": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@nestjs/axios/-/axios-3.0.3.tgz", - "integrity": "sha512-h6TCn3yJwD6OKqqqfmtRS5Zo4E46Ip2n+gK1sqwzNBC+qxQ9xpCu+ODVRFur6V3alHSCSBxb3nNtt73VEdluyA==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@nestjs/axios/-/axios-3.0.2.tgz", + "integrity": "sha512-Z6GuOUdNQjP7FX+OuV2Ybyamse+/e0BFdTWBX5JxpBDKA+YkdLynDgG6HTF04zy6e9zPa19UX0WA2VDoehwhXQ==", "dev": true, - "license": "MIT", "peerDependencies": { "@nestjs/common": "^7.0.0 || ^8.0.0 || ^9.0.0 || ^10.0.0", "axios": "^1.3.1", @@ -204,14 +46,13 @@ } }, "node_modules/@nestjs/common": { - "version": "10.4.3", - "resolved": "https://registry.npmjs.org/@nestjs/common/-/common-10.4.3.tgz", - "integrity": "sha512-4hbLd3XIJubHSylYd/1WSi4VQvG68KM/ECYpMDqA3k3J1/T17SAg40sDoq3ZoO5OZgU0xuNyjuISdOTjs11qVg==", + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/@nestjs/common/-/common-10.3.0.tgz", + "integrity": "sha512-DGv34UHsZBxCM3H5QGE2XE/+oLJzz5+714JQjBhjD9VccFlQs3LRxo/epso4l7nJIiNlZkPyIUC8WzfU/5RTsQ==", "dev": true, - "license": "MIT", "dependencies": { "iterare": "1.2.1", - "tslib": "2.7.0", + "tslib": "2.6.2", "uid": "2.0.2" }, "funding": { @@ -221,7 +62,7 @@ "peerDependencies": { "class-transformer": "*", "class-validator": "*", - "reflect-metadata": "^0.1.12 || ^0.2.0", + "reflect-metadata": "^0.1.12", "rxjs": "^7.1.0" }, "peerDependenciesMeta": { @@ -234,18 +75,17 @@ } }, "node_modules/@nestjs/core": { - "version": "10.4.3", - "resolved": "https://registry.npmjs.org/@nestjs/core/-/core-10.4.3.tgz", - "integrity": "sha512-6OQz+5C8mT8yRtfvE5pPCq+p6w5jDot+oQku1KzQ24ABn+lay1KGuJwcKZhdVNuselx+8xhdMxknZTA8wrGLIg==", + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/@nestjs/core/-/core-10.3.0.tgz", + "integrity": "sha512-N06P5ncknW/Pm8bj964WvLIZn2gNhHliCBoAO1LeBvNImYkecqKcrmLbY49Fa1rmMfEM3MuBHeDys3edeuYAOA==", "dev": true, "hasInstallScript": true, - "license": "MIT", "dependencies": { "@nuxtjs/opencollective": "0.3.2", "fast-safe-stringify": "2.1.1", "iterare": "1.2.1", - "path-to-regexp": "3.3.0", - "tslib": "2.7.0", + "path-to-regexp": "3.2.0", + "tslib": "2.6.2", "uid": "2.0.2" }, "funding": { @@ -257,7 +97,7 @@ "@nestjs/microservices": "^10.0.0", "@nestjs/platform-express": "^10.0.0", "@nestjs/websockets": "^10.0.0", - "reflect-metadata": "^0.1.12 || ^0.2.0", + "reflect-metadata": "^0.1.12", "rxjs": "^7.1.0" }, "peerDependenciesMeta": { @@ -277,7 +117,6 @@ "resolved": "https://registry.npmjs.org/@nuxtjs/opencollective/-/opencollective-0.3.2.tgz", "integrity": "sha512-um0xL3fO7Mf4fDxcqx9KryrB7zgRM5JSlvGN5AGkP6JLM5XEKyjeAiPbNxdXVXQ16isuAhYpvP88NgL2BGd6aA==", "dev": true, - "license": "MIT", "dependencies": { "chalk": "^4.1.0", "consola": "^2.15.0", @@ -292,127 +131,47 @@ } }, "node_modules/@openapitools/openapi-generator-cli": { - "version": "2.14.0", - "resolved": "https://registry.npmjs.org/@openapitools/openapi-generator-cli/-/openapi-generator-cli-2.14.0.tgz", - "integrity": "sha512-k+ioQLtXLXgNbhQbp1UOxtaUnnYTWwAPev88hP5qauFA+eq4NyeQGNojknFssXg2x0VT0TUGmU3PZ2DiQ70IVg==", + "version": "2.13.4", + "resolved": "https://registry.npmjs.org/@openapitools/openapi-generator-cli/-/openapi-generator-cli-2.13.4.tgz", + "integrity": "sha512-4JKyrk55ohQK2FcuZbPdNvxdyXD14jjOIvE8hYjJ+E1cHbRbfXQXbYnjTODFE52Gx8eAxz8C9icuhDYDLn7nww==", "dev": true, "hasInstallScript": true, - "license": "Apache-2.0", "dependencies": { - "@nestjs/axios": "3.0.3", - "@nestjs/common": "10.4.3", - "@nestjs/core": "10.4.3", + "@nestjs/axios": "3.0.2", + "@nestjs/common": "10.3.0", + "@nestjs/core": "10.3.0", "@nuxtjs/opencollective": "0.3.2", - "axios": "1.7.7", + "axios": "1.6.8", "chalk": "4.1.2", "commander": "8.3.0", "compare-versions": "4.1.4", "concurrently": "6.5.1", "console.table": "0.10.0", "fs-extra": "10.1.0", - "glob": "9.3.5", - "https-proxy-agent": "7.0.5", + "glob": "7.2.3", + "https-proxy-agent": "7.0.4", "inquirer": "8.2.6", "lodash": "4.17.21", "reflect-metadata": "0.1.13", "rxjs": "7.8.1", - "tslib": "2.7.0" + "tslib": "2.6.2" }, "bin": { "openapi-generator-cli": "main.js" }, "engines": { - "node": ">=16" + "node": ">=10.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/openapi_generator" } }, - "node_modules/@tsconfig/node10": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.11.tgz", - "integrity": "sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==", - "dev": true, - "license": "MIT" - }, - "node_modules/@tsconfig/node12": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", - "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", - "dev": true, - "license": "MIT" - }, - "node_modules/@tsconfig/node14": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", - "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", - "dev": true, - "license": "MIT" - }, - "node_modules/@tsconfig/node16": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", - "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/node": { - "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, - "dependencies": { - "undici-types": "~6.19.2" - } - }, - "node_modules/abort-controller": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", - "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", - "dev": true, - "license": "MIT", - "dependencies": { - "event-target-shim": "^5.0.0" - }, - "engines": { - "node": ">=6.5" - } - }, - "node_modules/acorn": { - "version": "8.12.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz", - "integrity": "sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==", - "dev": true, - "license": "MIT", - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/acorn-walk": { - "version": "8.3.4", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.4.tgz", - "integrity": "sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==", - "dev": true, - "license": "MIT", - "dependencies": { - "acorn": "^8.11.0" - }, - "engines": { - "node": ">=0.4.0" - } - }, "node_modules/agent-base": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.1.tgz", "integrity": "sha512-H0TSyFNDMomMNJQBn8wFV5YC/2eJ+VXECwOadZJT554xP6cODZHPX3H9QMQECxvrgiSOP1pHjy1sMWQVYJOUOA==", "dev": true, - "license": "MIT", "dependencies": { "debug": "^4.3.4" }, @@ -425,7 +184,6 @@ "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", "dev": true, - "license": "MIT", "dependencies": { "type-fest": "^0.21.3" }, @@ -441,7 +199,6 @@ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "dev": true, - "license": "MIT", "engines": { "node": ">=8" } @@ -451,7 +208,6 @@ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, - "license": "MIT", "dependencies": { "color-convert": "^2.0.1" }, @@ -462,26 +218,17 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/arg": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", - "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", - "dev": true, - "license": "MIT" - }, "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/axios": { - "version": "1.7.7", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.7.tgz", - "integrity": "sha512-S4kL7XrjgBmvdGut0sN3yJxqYzrDOnivkBiN0OFs6hLiUam3UPvswUo0kqGyhqUZGEOytHyumEdXsAkgCOUf3Q==", + "version": "1.6.8", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.8.tgz", + "integrity": "sha512-v/ZHtJDU39mDpyBoFVkETcd/uNdxrWRrg3bKpOKzXFA6Bvqopts6ALSMU3y6ijYxbw2B+wPrIv46egTzJXCLGQ==", "dev": true, - "license": "MIT", "dependencies": { "follow-redirects": "^1.15.6", "form-data": "^4.0.0", @@ -492,8 +239,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/base64-js": { "version": "1.5.1", @@ -513,15 +259,13 @@ "type": "consulting", "url": "https://feross.org/support" } - ], - "license": "MIT" + ] }, "node_modules/bl": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", "dev": true, - "license": "MIT", "dependencies": { "buffer": "^5.5.0", "inherits": "^2.0.4", @@ -529,22 +273,15 @@ } }, "node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, - "license": "MIT", "dependencies": { - "balanced-match": "^1.0.0" + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" } }, - "node_modules/browser-or-node": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/browser-or-node/-/browser-or-node-3.0.0.tgz", - "integrity": "sha512-iczIdVJzGEYhP5DqQxYM9Hh7Ztpqqi+CXZpSmX8ALFs9ecXkQIeqRyM6TfxEfMVpwhl3dSuDvxdzzo9sUOIVBQ==", - "dev": true, - "license": "MIT" - }, "node_modules/buffer": { "version": "5.7.1", "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", @@ -564,7 +301,6 @@ "url": "https://feross.org/support" } ], - "license": "MIT", "dependencies": { "base64-js": "^1.3.1", "ieee754": "^1.1.13" @@ -575,7 +311,6 @@ "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, - "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -591,15 +326,13 @@ "version": "0.7.0", "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/cli-cursor": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", "dev": true, - "license": "MIT", "dependencies": { "restore-cursor": "^3.1.0" }, @@ -612,7 +345,6 @@ "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.9.2.tgz", "integrity": "sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg==", "dev": true, - "license": "MIT", "engines": { "node": ">=6" }, @@ -625,7 +357,6 @@ "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-3.0.0.tgz", "integrity": "sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw==", "dev": true, - "license": "ISC", "engines": { "node": ">= 10" } @@ -635,7 +366,6 @@ "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", "dev": true, - "license": "ISC", "dependencies": { "string-width": "^4.2.0", "strip-ansi": "^6.0.0", @@ -647,7 +377,6 @@ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", "dev": true, - "license": "MIT", "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", @@ -665,24 +394,15 @@ "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", "integrity": "sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==", "dev": true, - "license": "MIT", "engines": { "node": ">=0.8" } }, - "node_modules/collection-utils": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/collection-utils/-/collection-utils-1.0.1.tgz", - "integrity": "sha512-LA2YTIlR7biSpXkKYwwuzGjwL5rjWEZVOSnvdUc7gObvWe4WkjxOpfrdhoP7Hs09YWDVfg0Mal9BpAqLfVEzQg==", - "dev": true, - "license": "Apache-2.0" - }, "node_modules/color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, - "license": "MIT", "dependencies": { "color-name": "~1.1.4" }, @@ -694,15 +414,13 @@ "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", "dev": true, - "license": "MIT", "dependencies": { "delayed-stream": "~1.0.0" }, @@ -715,7 +433,6 @@ "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz", "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==", "dev": true, - "license": "MIT", "engines": { "node": ">= 12" } @@ -724,15 +441,19 @@ "version": "4.1.4", "resolved": "https://registry.npmjs.org/compare-versions/-/compare-versions-4.1.4.tgz", "integrity": "sha512-FemMreK9xNyL8gQevsdRMrvO4lFCkQP7qbuktn1q8ndcNk1+0mz7lgE7b/sNvbhVgY4w6tMN1FDp6aADjqw2rw==", - "dev": true, - "license": "MIT" + "dev": true + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true }, "node_modules/concurrently": { "version": "6.5.1", "resolved": "https://registry.npmjs.org/concurrently/-/concurrently-6.5.1.tgz", "integrity": "sha512-FlSwNpGjWQfRwPLXvJ/OgysbBxPkWpiVjy1042b0U7on7S7qwwMIILRj7WTN1mTgqa582bG6NFuScOoh6Zgdag==", "dev": true, - "license": "MIT", "dependencies": { "chalk": "^4.1.0", "date-fns": "^2.16.1", @@ -755,7 +476,6 @@ "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz", "integrity": "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==", "dev": true, - "license": "Apache-2.0", "dependencies": { "tslib": "^1.9.0" }, @@ -768,7 +488,6 @@ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", "dev": true, - "license": "MIT", "dependencies": { "has-flag": "^4.0.0" }, @@ -783,22 +502,19 @@ "version": "1.14.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "dev": true, - "license": "0BSD" + "dev": true }, "node_modules/consola": { "version": "2.15.3", "resolved": "https://registry.npmjs.org/consola/-/consola-2.15.3.tgz", "integrity": "sha512-9vAdYbHj6x2fLKC4+oPH0kFzY/orMZyG2Aj+kNylHxKGJ/Ed4dpNyAQYwJOdqO4zdM7XpVHmyejQDcQHrnuXbw==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/console.table": { "version": "0.10.0", "resolved": "https://registry.npmjs.org/console.table/-/console.table-0.10.0.tgz", "integrity": "sha512-dPyZofqggxuvSf7WXvNjuRfnsOk1YazkVP8FdxH4tcH2c37wc79/Yl6Bhr7Lsu00KMgy2ql/qCMuNu8xctZM8g==", "dev": true, - "license": "MIT", "dependencies": { "easy-table": "1.1.0" }, @@ -806,44 +522,11 @@ "node": "> 0.10" } }, - "node_modules/create-require": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", - "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/cross-fetch": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-4.0.0.tgz", - "integrity": "sha512-e4a5N8lVvuLgAWgnCrLr2PP0YyDOTHa9H/Rj54dirp61qXnNq46m82bRhNqIA5VccJtWBvPTFRV3TtvHUKPB1g==", - "dev": true, - "license": "MIT", - "dependencies": { - "node-fetch": "^2.6.12" - } - }, - "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", - "dev": true, - "license": "MIT", - "dependencies": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - }, - "engines": { - "node": ">= 8" - } - }, "node_modules/date-fns": { "version": "2.30.0", "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.30.0.tgz", "integrity": "sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==", "dev": true, - "license": "MIT", "dependencies": { "@babel/runtime": "^7.21.0" }, @@ -860,7 +543,6 @@ "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", "dev": true, - "license": "MIT", "dependencies": { "ms": "^2.1.3" }, @@ -878,7 +560,6 @@ "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.4.tgz", "integrity": "sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A==", "dev": true, - "license": "MIT", "dependencies": { "clone": "^1.0.2" }, @@ -891,34 +572,15 @@ "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", "dev": true, - "license": "MIT", "engines": { "node": ">=0.4.0" } }, - "node_modules/diff": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", - "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.3.1" - } - }, - "node_modules/eastasianwidth": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", - "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", - "dev": true, - "license": "MIT" - }, "node_modules/easy-table": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/easy-table/-/easy-table-1.1.0.tgz", "integrity": "sha512-oq33hWOSSnl2Hoh00tZWaIPi1ievrD9aFG82/IgjlycAnW9hHx5PkJiXpxPsgEE+H7BsbVQXFVFST8TEXS6/pA==", "dev": true, - "license": "MIT", "optionalDependencies": { "wcwidth": ">=1.0.1" } @@ -927,15 +589,13 @@ "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/escalade": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", "dev": true, - "license": "MIT", "engines": { "node": ">=6" } @@ -945,37 +605,15 @@ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", "dev": true, - "license": "MIT", "engines": { "node": ">=0.8.0" } }, - "node_modules/event-target-shim": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", - "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/events": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", - "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.8.x" - } - }, "node_modules/external-editor": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==", "dev": true, - "license": "MIT", "dependencies": { "chardet": "^0.7.0", "iconv-lite": "^0.4.24", @@ -989,15 +627,13 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz", "integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/figures": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", "dev": true, - "license": "MIT", "dependencies": { "escape-string-regexp": "^1.0.5" }, @@ -1019,7 +655,6 @@ "url": "https://github.com/sponsors/RubenVerborgh" } ], - "license": "MIT", "engines": { "node": ">=4.0" }, @@ -1029,42 +664,11 @@ } } }, - "node_modules/foreground-child": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.0.tgz", - "integrity": "sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg==", - "dev": true, - "license": "ISC", - "dependencies": { - "cross-spawn": "^7.0.0", - "signal-exit": "^4.0.1" - }, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/foreground-child/node_modules/signal-exit": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", - "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", - "dev": true, - "license": "ISC", - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/form-data": { "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": { "asynckit": "^0.4.0", "combined-stream": "^1.0.8", @@ -1079,7 +683,6 @@ "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", "dev": true, - "license": "MIT", "dependencies": { "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", @@ -1093,105 +696,58 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", - "dev": true, - "license": "ISC" + "dev": true }, "node_modules/get-caller-file": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", "dev": true, - "license": "ISC", "engines": { "node": "6.* || 8.* || >= 10.*" } }, "node_modules/glob": { - "version": "9.3.5", - "resolved": "https://registry.npmjs.org/glob/-/glob-9.3.5.tgz", - "integrity": "sha512-e1LleDykUz2Iu+MTYdkSsuWX8lvAjAcs0Xef0lNIu0S2wOAzuTxCJtcd9S3cijlwYF18EsU3rzb8jPVobxDh9Q==", + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", "dev": true, - "license": "ISC", "dependencies": { "fs.realpath": "^1.0.0", - "minimatch": "^8.0.2", - "minipass": "^4.2.4", - "path-scurry": "^1.6.1" + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" }, "engines": { - "node": ">=16 || 14 >=14.17" + "node": "*" }, "funding": { "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/glob/node_modules/lru-cache": { - "version": "10.4.3", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", - "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", - "dev": true, - "license": "ISC" - }, - "node_modules/glob/node_modules/minipass": { - "version": "4.2.8", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-4.2.8.tgz", - "integrity": "sha512-fNzuVyifolSLFL4NzpF+wEF4qrgqaaKX0haXPQEdQ7NKAN+WecoKMHV09YcuL/DHxrUsYQOK3MiuDf7Ip2OXfQ==", - "dev": true, - "license": "ISC", - "engines": { - "node": ">=8" - } - }, - "node_modules/glob/node_modules/path-scurry": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz", - "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", - "dev": true, - "license": "BlueOak-1.0.0", - "dependencies": { - "lru-cache": "^10.2.0", - "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" - }, - "engines": { - "node": ">=16 || 14 >=14.18" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/glob/node_modules/path-scurry/node_modules/minipass": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", - "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", - "dev": true, - "license": "ISC", - "engines": { - "node": ">=16 || 14 >=14.17" - } - }, "node_modules/graceful-fs": { "version": "4.2.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", - "dev": true, - "license": "ISC" + "dev": true }, "node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true, - "license": "MIT", "engines": { "node": ">=8" } }, "node_modules/https-proxy-agent": { - "version": "7.0.5", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.5.tgz", - "integrity": "sha512-1e4Wqeblerz+tMKPIq2EMGiiWW1dIjZOksyHWSUm1rmuvw/how9hBHZ38lAGj5ID4Ik6EdkOw7NmWPy6LAwalw==", + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.4.tgz", + "integrity": "sha512-wlwpilI7YdjSkWaQ/7omYBMTliDcmCN8OLihO6I9B86g06lMyAoqgoDpV0XqoaPOKj+0DIdAvnsWfyAAhmimcg==", "dev": true, - "license": "MIT", "dependencies": { "agent-base": "^7.0.2", "debug": "4" @@ -1205,7 +761,6 @@ "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", "dev": true, - "license": "MIT", "dependencies": { "safer-buffer": ">= 2.1.2 < 3" }, @@ -1231,22 +786,30 @@ "type": "consulting", "url": "https://feross.org/support" } - ], - "license": "BSD-3-Clause" + ] + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", + "dev": true, + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } }, "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true, - "license": "ISC" + "dev": true }, "node_modules/inquirer": { "version": "8.2.6", "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-8.2.6.tgz", "integrity": "sha512-M1WuAmb7pn9zdFRtQYk26ZBoY043Sse0wVDdk4Bppr+JOXyQYybdtvK+l9wUibhtjdjvtoiNy8tk+EgsYIUqKg==", "dev": true, - "license": "MIT", "dependencies": { "ansi-escapes": "^4.2.1", "chalk": "^4.1.1", @@ -1273,7 +836,6 @@ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", "dev": true, - "license": "MIT", "engines": { "node": ">=8" } @@ -1283,7 +845,6 @@ "resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-1.0.0.tgz", "integrity": "sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w==", "dev": true, - "license": "MIT", "engines": { "node": ">=8" } @@ -1293,7 +854,6 @@ "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", "dev": true, - "license": "MIT", "engines": { "node": ">=10" }, @@ -1301,59 +861,20 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/is-url": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/is-url/-/is-url-1.2.4.tgz", - "integrity": "sha512-ITvGim8FhRiYe4IQ5uHSkj7pVaPDrCTkNd3yq3cV7iZAcJdHTUMPMEHcqSOy9xZ9qFenQCvi+2wjH9a1nXqHww==", - "dev": true, - "license": "MIT" - }, - "node_modules/isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "dev": true, - "license": "ISC" - }, "node_modules/iterare": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/iterare/-/iterare-1.2.1.tgz", "integrity": "sha512-RKYVTCjAnRthyJes037NX/IiqeidgN1xc3j1RjFfECFp28A1GVwK9nA+i0rJPaHqSZwygLzRnFlzUuHFoWWy+Q==", "dev": true, - "license": "ISC", "engines": { "node": ">=6" } }, - "node_modules/jackspeak": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-4.0.2.tgz", - "integrity": "sha512-bZsjR/iRjl1Nk1UkjGpAzLNfQtzuijhn2g+pbZb98HQ1Gk8vM9hfbxeMBP+M2/UUdwj0RqGG3mlvk2MsAqwvEw==", - "dev": true, - "license": "BlueOak-1.0.0", - "dependencies": { - "@isaacs/cliui": "^8.0.2" - }, - "engines": { - "node": "20 || >=22" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/js-base64": { - "version": "3.7.7", - "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-3.7.7.tgz", - "integrity": "sha512-7rCnleh0z2CkXhH67J8K1Ytz0b2Y+yxTPL+/KOJoa20hfnVQ/3/T6W/KflYI4bRHRagNeXeU2bkNGI3v1oS/lw==", - "dev": true, - "license": "BSD-3-Clause" - }, "node_modules/jsonfile": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", "dev": true, - "license": "MIT", "dependencies": { "universalify": "^2.0.0" }, @@ -1365,15 +886,13 @@ "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/log-symbols": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", "dev": true, - "license": "MIT", "dependencies": { "chalk": "^4.1.0", "is-unicode-supported": "^0.1.0" @@ -1385,29 +904,11 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/lru-cache": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.0.1.tgz", - "integrity": "sha512-CgeuL5uom6j/ZVrg7G/+1IXqRY8JXX4Hghfy5YE0EhoYQWvndP1kufu58cmZLNIDKnRhZrXfdS9urVWx98AipQ==", - "dev": true, - "license": "ISC", - "engines": { - "node": "20 || >=22" - } - }, - "node_modules/make-error": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", - "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", - "dev": true, - "license": "ISC" - }, "node_modules/mime-db": { "version": "1.52.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", "dev": true, - "license": "MIT", "engines": { "node": ">= 0.6" } @@ -1417,7 +918,6 @@ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", "dev": true, - "license": "MIT", "dependencies": { "mime-db": "1.52.0" }, @@ -1430,57 +930,39 @@ "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", "dev": true, - "license": "MIT", "engines": { "node": ">=6" } }, "node_modules/minimatch": { - "version": "8.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-8.0.4.tgz", - "integrity": "sha512-W0Wvr9HyFXZRGIDgCicunpQ299OKXs9RgZfaukz4qAW/pJhcpUfupc9c+OObPOFueNy8VSrZgEmDtk6Kh4WzDA==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, - "license": "ISC", "dependencies": { - "brace-expansion": "^2.0.1" + "brace-expansion": "^1.1.7" }, "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/minipass": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", - "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", - "dev": true, - "license": "ISC", - "engines": { - "node": ">=16 || 14 >=14.17" + "node": "*" } }, "node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/mute-stream": { "version": "0.0.8", "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", - "dev": true, - "license": "ISC" + "dev": true }, "node_modules/node-fetch": { "version": "2.7.0", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", "dev": true, - "license": "MIT", "dependencies": { "whatwg-url": "^5.0.0" }, @@ -1496,12 +978,20 @@ } } }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "dependencies": { + "wrappy": "1" + } + }, "node_modules/onetime": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", "dev": true, - "license": "MIT", "dependencies": { "mimic-fn": "^2.1.0" }, @@ -1517,7 +1007,6 @@ "resolved": "https://registry.npmjs.org/ora/-/ora-5.4.1.tgz", "integrity": "sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ==", "dev": true, - "license": "MIT", "dependencies": { "bl": "^4.1.0", "chalk": "^4.1.0", @@ -1541,75 +1030,30 @@ "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", "integrity": "sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==", "dev": true, - "license": "MIT", "engines": { "node": ">=0.10.0" } }, - "node_modules/package-json-from-dist": { + "node_modules/path-is-absolute": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz", - "integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", "dev": true, - "license": "BlueOak-1.0.0" - }, - "node_modules/pako": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", - "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==", - "dev": true, - "license": "(MIT AND Zlib)" - }, - "node_modules/path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "dev": true, - "license": "MIT", "engines": { - "node": ">=8" - } - }, - "node_modules/path-scurry": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.0.tgz", - "integrity": "sha512-ypGJsmGtdXUOeM5u93TyeIEfEhM6s+ljAhrk5vAvSx8uyY/02OvrZnA0YNGUrPXfpJMgI1ODd3nwz8Npx4O4cg==", - "dev": true, - "license": "BlueOak-1.0.0", - "dependencies": { - "lru-cache": "^11.0.0", - "minipass": "^7.1.2" - }, - "engines": { - "node": "20 || >=22" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" + "node": ">=0.10.0" } }, "node_modules/path-to-regexp": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-3.3.0.tgz", - "integrity": "sha512-qyCH421YQPS2WFDxDjftfc1ZR5WKQzVzqsp4n9M2kQhVOo/ByahFoUNJfl58kOcEGfQ//7weFTDhm+ss8Ecxgw==", - "dev": true, - "license": "MIT" - }, - "node_modules/pluralize": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-8.0.0.tgz", - "integrity": "sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-3.2.0.tgz", + "integrity": "sha512-jczvQbCUS7XmS7o+y1aEO9OBVFeZBQ1MDSEqmO7xSoPgOPoowY/SxLpZ6Vh97/8qHZOteiCKb7gkG9gA2ZUxJA==", + "dev": true }, "node_modules/prettier": { "version": "3.3.3", "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz", "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==", "dev": true, - "license": "MIT", "bin": { "prettier": "bin/prettier.cjs" }, @@ -1620,94 +1064,17 @@ "url": "https://github.com/prettier/prettier?sponsor=1" } }, - "node_modules/process": { - "version": "0.11.10", - "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", - "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.6.0" - } - }, "node_modules/proxy-from-env": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", - "dev": true, - "license": "MIT" - }, - "node_modules/quicktype-core": { - "version": "23.0.170", - "resolved": "https://registry.npmjs.org/quicktype-core/-/quicktype-core-23.0.170.tgz", - "integrity": "sha512-ZsjveG0yJUIijUx4yQshzyQ5EAXKbFSBTQJHnJ+KoSZVxcS+m3GcmDpzrdUIRYMhgLaF11ZGvLSYi5U0xcwemw==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "@glideapps/ts-necessities": "2.2.3", - "browser-or-node": "^3.0.0", - "collection-utils": "^1.0.1", - "cross-fetch": "^4.0.0", - "is-url": "^1.2.4", - "js-base64": "^3.7.7", - "lodash": "^4.17.21", - "pako": "^1.0.6", - "pluralize": "^8.0.0", - "readable-stream": "4.5.2", - "unicode-properties": "^1.4.1", - "urijs": "^1.19.1", - "wordwrap": "^1.0.0", - "yaml": "^2.4.1" - } - }, - "node_modules/quicktype-core/node_modules/buffer": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", - "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT", - "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" - } - }, - "node_modules/quicktype-core/node_modules/readable-stream": { - "version": "4.5.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.5.2.tgz", - "integrity": "sha512-yjavECdqeZ3GLXNgRXgeQEdz9fvDDkNKyHnbHRFtOr7/LcfgBcmct7t/ET+HaCTqfh06OzoAxrkN/IfjJBVe+g==", - "dev": true, - "license": "MIT", - "dependencies": { - "abort-controller": "^3.0.0", - "buffer": "^6.0.3", - "events": "^3.3.0", - "process": "^0.11.10", - "string_decoder": "^1.3.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - } + "dev": true }, "node_modules/readable-stream": { "version": "3.6.2", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", "dev": true, - "license": "MIT", "dependencies": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", @@ -1721,22 +1088,19 @@ "version": "0.1.13", "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.13.tgz", "integrity": "sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg==", - "dev": true, - "license": "Apache-2.0" + "dev": true }, "node_modules/regenerator-runtime": { "version": "0.14.1", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", "dev": true, - "license": "MIT", "engines": { "node": ">=0.10.0" } @@ -1746,7 +1110,6 @@ "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", "dev": true, - "license": "MIT", "dependencies": { "onetime": "^5.1.0", "signal-exit": "^3.0.2" @@ -1755,72 +1118,11 @@ "node": ">=8" } }, - "node_modules/rimraf": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-6.0.1.tgz", - "integrity": "sha512-9dkvaxAsk/xNXSJzMgFqqMCuFgt2+KsOFek3TMLfo8NCPfWpBmqwyNn5Y+NX56QUYfCtsyhF3ayiboEoUmJk/A==", - "dev": true, - "license": "ISC", - "dependencies": { - "glob": "^11.0.0", - "package-json-from-dist": "^1.0.0" - }, - "bin": { - "rimraf": "dist/esm/bin.mjs" - }, - "engines": { - "node": "20 || >=22" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/rimraf/node_modules/glob": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-11.0.0.tgz", - "integrity": "sha512-9UiX/Bl6J2yaBbxKoEBRm4Cipxgok8kQYcOPEhScPwebu2I0HoQOuYdIO6S3hLuWoZgpDpwQZMzTFxgpkyT76g==", - "dev": true, - "license": "ISC", - "dependencies": { - "foreground-child": "^3.1.0", - "jackspeak": "^4.0.1", - "minimatch": "^10.0.0", - "minipass": "^7.1.2", - "package-json-from-dist": "^1.0.0", - "path-scurry": "^2.0.0" - }, - "bin": { - "glob": "dist/esm/bin.mjs" - }, - "engines": { - "node": "20 || >=22" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/rimraf/node_modules/minimatch": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.0.1.tgz", - "integrity": "sha512-ethXTt3SGGR+95gudmqJ1eNhRO7eGEGIgYA9vnPatK4/etz2MEVDno5GMCibdMTuBMyElzIlgxMna3K94XDIDQ==", - "dev": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": "20 || >=22" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/run-async": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz", "integrity": "sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==", "dev": true, - "license": "MIT", "engines": { "node": ">=0.12.0" } @@ -1830,7 +1132,6 @@ "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz", "integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==", "dev": true, - "license": "Apache-2.0", "dependencies": { "tslib": "^2.1.0" } @@ -1853,45 +1154,19 @@ "type": "consulting", "url": "https://feross.org/support" } - ], - "license": "MIT" + ] }, "node_modules/safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "dev": true, - "license": "MIT" - }, - "node_modules/shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dev": true, - "license": "MIT", - "dependencies": { - "shebang-regex": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } + "dev": true }, "node_modules/signal-exit": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", - "dev": true, - "license": "ISC" + "dev": true }, "node_modules/spawn-command": { "version": "0.0.2", @@ -1904,7 +1179,6 @@ "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", "dev": true, - "license": "MIT", "dependencies": { "safe-buffer": "~5.2.0" } @@ -1914,23 +1188,6 @@ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", "dev": true, - "license": "MIT", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/string-width-cjs": { - "name": "string-width", - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "license": "MIT", "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -1945,21 +1202,6 @@ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-ansi-cjs": { - "name": "strip-ansi", - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "license": "MIT", "dependencies": { "ansi-regex": "^5.0.1" }, @@ -1972,7 +1214,6 @@ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, - "license": "MIT", "dependencies": { "has-flag": "^4.0.0" }, @@ -1984,22 +1225,13 @@ "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", - "dev": true, - "license": "MIT" - }, - "node_modules/tiny-inflate": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/tiny-inflate/-/tiny-inflate-1.0.3.tgz", - "integrity": "sha512-pkY1fj1cKHb2seWDy0B16HeWyczlJA9/WW3u3c4z/NiWDsO3DOU5D7nhTLE9CF0yXv/QZFY7sEJmj24dK+Rrqw==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/tmp": { "version": "0.0.33", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", "dev": true, - "license": "MIT", "dependencies": { "os-tmpdir": "~1.0.2" }, @@ -2011,76 +1243,28 @@ "version": "0.0.3", "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/tree-kill": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz", "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==", "dev": true, - "license": "MIT", "bin": { "tree-kill": "cli.js" } }, - "node_modules/ts-node": { - "version": "10.9.2", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", - "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@cspotcode/source-map-support": "^0.8.0", - "@tsconfig/node10": "^1.0.7", - "@tsconfig/node12": "^1.0.7", - "@tsconfig/node14": "^1.0.0", - "@tsconfig/node16": "^1.0.2", - "acorn": "^8.4.1", - "acorn-walk": "^8.1.1", - "arg": "^4.1.0", - "create-require": "^1.1.0", - "diff": "^4.0.1", - "make-error": "^1.1.1", - "v8-compile-cache-lib": "^3.0.1", - "yn": "3.1.1" - }, - "bin": { - "ts-node": "dist/bin.js", - "ts-node-cwd": "dist/bin-cwd.js", - "ts-node-esm": "dist/bin-esm.js", - "ts-node-script": "dist/bin-script.js", - "ts-node-transpile-only": "dist/bin-transpile.js", - "ts-script": "dist/bin-script-deprecated.js" - }, - "peerDependencies": { - "@swc/core": ">=1.2.50", - "@swc/wasm": ">=1.2.50", - "@types/node": "*", - "typescript": ">=2.7" - }, - "peerDependenciesMeta": { - "@swc/core": { - "optional": true - }, - "@swc/wasm": { - "optional": true - } - } - }, "node_modules/tslib": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.7.0.tgz", - "integrity": "sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==", - "dev": true, - "license": "0BSD" + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", + "dev": true }, "node_modules/type-fest": { "version": "0.21.3", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", "dev": true, - "license": "(MIT OR CC0-1.0)", "engines": { "node": ">=10" }, @@ -2088,26 +1272,11 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "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" - } - }, "node_modules/uid": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/uid/-/uid-2.0.2.tgz", "integrity": "sha512-u3xV3X7uzvi5b1MncmZo3i2Aw222Zk1keqLA1YkHldREkAhAqi65wuPfe7lHx8H/Wzy+8CE7S7uS3jekIM5s8g==", "dev": true, - "license": "MIT", "dependencies": { "@lukeed/csprng": "^1.0.0" }, @@ -2115,80 +1284,26 @@ "node": ">=8" } }, - "node_modules/undici-types": { - "version": "6.19.8", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", - "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==", - "dev": true, - "license": "MIT", - "peer": true - }, - "node_modules/unicode-properties": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/unicode-properties/-/unicode-properties-1.4.1.tgz", - "integrity": "sha512-CLjCCLQ6UuMxWnbIylkisbRj31qxHPAurvena/0iwSVbQ2G1VY5/HjV0IRabOEbDHlzZlRdCrD4NhB0JtU40Pg==", - "dev": true, - "license": "MIT", - "dependencies": { - "base64-js": "^1.3.0", - "unicode-trie": "^2.0.0" - } - }, - "node_modules/unicode-trie": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/unicode-trie/-/unicode-trie-2.0.0.tgz", - "integrity": "sha512-x7bc76x0bm4prf1VLg79uhAzKw8DVboClSN5VxJuQ+LKDOVEW9CdH+VY7SP+vX7xCYQqzzgQpFqz15zeLvAtZQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "pako": "^0.2.5", - "tiny-inflate": "^1.0.0" - } - }, - "node_modules/unicode-trie/node_modules/pako": { - "version": "0.2.9", - "resolved": "https://registry.npmjs.org/pako/-/pako-0.2.9.tgz", - "integrity": "sha512-NUcwaKxUxWrZLpDG+z/xZaCgQITkA/Dv4V/T6bw7VON6l1Xz/VnrBqrYjZQ12TamKHzITTfOEIYUj48y2KXImA==", - "dev": true, - "license": "MIT" - }, "node_modules/universalify": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", "dev": true, - "license": "MIT", "engines": { "node": ">= 10.0.0" } }, - "node_modules/urijs": { - "version": "1.19.11", - "resolved": "https://registry.npmjs.org/urijs/-/urijs-1.19.11.tgz", - "integrity": "sha512-HXgFDgDommxn5/bIv0cnQZsPhHDA90NPHD6+c/v21U5+Sx5hoP8+dP9IZXBU1gIfvdRfhG8cel9QNPeionfcCQ==", - "dev": true, - "license": "MIT" - }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", - "dev": true, - "license": "MIT" - }, - "node_modules/v8-compile-cache-lib": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", - "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", - "dev": true, - "license": "MIT" + "dev": true }, "node_modules/wcwidth": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", "integrity": "sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==", "dev": true, - "license": "MIT", "dependencies": { "defaults": "^1.0.3" } @@ -2197,49 +1312,23 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", - "dev": true, - "license": "BSD-2-Clause" + "dev": true }, "node_modules/whatwg-url": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", "dev": true, - "license": "MIT", "dependencies": { "tr46": "~0.0.3", "webidl-conversions": "^3.0.0" } }, - "node_modules/which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "license": "ISC", - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "node-which": "bin/node-which" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/wordwrap": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", - "integrity": "sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==", - "dev": true, - "license": "MIT" - }, "node_modules/wrap-ansi": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", "dev": true, - "license": "MIT", "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", @@ -2249,54 +1338,26 @@ "node": ">=8" } }, - "node_modules/wrap-ansi-cjs": { - "name": "wrap-ansi", - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true }, "node_modules/y18n": { "version": "5.0.8", "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", "dev": true, - "license": "ISC", "engines": { "node": ">=10" } }, - "node_modules/yaml": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.6.0.tgz", - "integrity": "sha512-a6ae//JvKDEra2kdi1qzCyrJW/WZCgFi8ydDV+eXExl95t+5R+ijnqHJbz9tmMh8FUjx3iv2fCQ4dclAQlO2UQ==", - "dev": true, - "license": "ISC", - "bin": { - "yaml": "bin.mjs" - }, - "engines": { - "node": ">= 14" - } - }, "node_modules/yargs": { "version": "16.2.0", "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", "dev": true, - "license": "MIT", "dependencies": { "cliui": "^7.0.2", "escalade": "^3.1.1", @@ -2315,20 +1376,9 @@ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", "dev": true, - "license": "ISC", "engines": { "node": ">=10" } - }, - "node_modules/yn": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", - "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } } } } diff --git a/package.json b/package.json index fada308..cc26959 100644 --- a/package.json +++ b/package.json @@ -1,14 +1,14 @@ { - "name": "@bitwarden/sdk", + "name": "@bitwarden/sdk-internal", "version": "0.0.0", "description": "", - "homepage": "https://github.com/bitwarden/sdk#readme", + "homepage": "https://github.com/bitwarden/sdk-internal#readme", "bugs": { - "url": "https://github.com/bitwarden/sdk/issues" + "url": "https://github.com/bitwarden/sdk-internal/issues" }, "repository": { "type": "git", - "url": "git+https://github.com/bitwarden/sdk.git" + "url": "git+https://github.com/bitwarden/sdk-internal.git" }, "license": "SEE LICENSE IN LICENSE", "author": "Bitwarden Inc. (https://bitwarden.com)", @@ -16,15 +16,10 @@ "scripts": { "lint": "prettier --check .", "prettier": "prettier --write .", - "schemas": "rimraf ./support/schemas && cargo run --bin sdk-schemas --all-features && ts-node ./support/scripts/schemas.ts", "test": "echo \"Error: no test specified\" && exit 1" }, "devDependencies": { - "@openapitools/openapi-generator-cli": "2.14.0", - "prettier": "3.3.3", - "quicktype-core": "23.0.170", - "rimraf": "6.0.1", - "ts-node": "10.9.2", - "typescript": "5.5.4" + "@openapitools/openapi-generator-cli": "2.13.4", + "prettier": "3.3.3" } } diff --git a/sig/bitwarden_sdk/bitwarden_client.rbs b/sig/bitwarden_sdk/bitwarden_client.rbs deleted file mode 100644 index 1ff97eb..0000000 --- a/sig/bitwarden_sdk/bitwarden_client.rbs +++ /dev/null @@ -1,5 +0,0 @@ -module BitwardenSDK - class BitwardenClient - attr_reader project_client: ProjectsClient - end -end diff --git a/support/scripts/schemas.ts b/support/scripts/schemas.ts deleted file mode 100644 index 873a9de..0000000 --- a/support/scripts/schemas.ts +++ /dev/null @@ -1,138 +0,0 @@ -import { - quicktype, - quicktypeMultiFile, - InputData, - JSONSchemaInput, - FetchingJSONSchemaStore, -} from "quicktype-core"; - -import fs from "fs"; - -async function main() { - const schemaInput = new JSONSchemaInput(new FetchingJSONSchemaStore()); - const inputData = new InputData(); - inputData.addInput(schemaInput); - inputData.addSource( - "schema", - { - name: "SchemaTypes", - uris: ["support/schemas/schema_types/SchemaTypes.json#/definitions/"], - }, - () => new JSONSchemaInput(new FetchingJSONSchemaStore()), - ); - - const ts = await quicktype({ - inputData, - lang: "typescript", - rendererOptions: {}, - }); - - writeToFile("./languages/js/sdk-client/src/schemas.ts", ts.lines); - writeToFile("./crates/bitwarden-napi/src-ts/bitwarden_client/schemas.ts", ts.lines); - - const python = await quicktype({ - inputData, - lang: "python", - rendererOptions: { - "python-version": "3.7", - }, - }); - - writeToFile("./languages/python/bitwarden_sdk/schemas.py", python.lines); - - const ruby = await quicktype({ - inputData, - lang: "ruby", - rendererOptions: { - "ruby-version": "3.0", - }, - }); - - writeToFile("./languages/ruby/bitwarden_sdk_secrets/lib/schemas.rb", ruby.lines); - - const csharp = await quicktype({ - inputData, - lang: "csharp", - rendererOptions: { - namespace: "Bitwarden.Sdk", - framework: "SystemTextJson", - "csharp-version": "6", - }, - }); - - writeToFile("./languages/csharp/Bitwarden.Sdk/schemas.cs", csharp.lines); - - const cpp = await quicktype({ - inputData, - lang: "cpp", - rendererOptions: { - namespace: "Bitwarden::Sdk", - "include-location": "global-include", - }, - }); - - cpp.lines.forEach((line, idx) => { - // Replace DOMAIN for URI_DOMAIN, because DOMAIN is an already defined macro - cpp.lines[idx] = line.replace(/DOMAIN/g, "URI_DOMAIN"); - }); - - writeToFile("./languages/cpp/include/schemas.hpp", cpp.lines); - - const go = await quicktype({ - inputData, - lang: "go", - rendererOptions: { - package: "sdk", - "omit-empty": true, - }, - }); - - writeToFile("./languages/go/schema.go", go.lines); - - const java = await quicktypeMultiFile({ - inputData, - lang: "java", - rendererOptions: { - package: "com.bitwarden.sdk.schema", - "java-version": "8", - }, - }); - - const javaDir = "./languages/java/src/main/java/com/bitwarden/sdk/schema/"; - if (!fs.existsSync(javaDir)) { - fs.mkdirSync(javaDir); - } - java.forEach((file, path) => { - writeToFile(javaDir + path, file.lines); - }); - - const php = await quicktype({ - inputData, - lang: "php", - inferUuids: false, - inferDateTimes: false, - rendererOptions: { - "acronym-style": "camel", - "with-get": false, - }, - }); - - const phpDir = "./languages/php/src/Schemas/"; - if (!fs.existsSync(phpDir)) { - fs.mkdirSync(phpDir); - } - - php.lines.splice(1, 0, "namespace Bitwarden\\Sdk\\Schemas;", "use stdClass;", "use Exception;"); - - writeToFile("./languages/php/src/Schemas/Schemas.php", php.lines); -} - -main(); - -function writeToFile(filename: string, lines: string[]) { - const output = fs.createWriteStream(filename); - lines.forEach((line) => { - output.write(line + "\n"); - }); - output.close(); -}