Skip to content

Commit c41601a

Browse files
authored
Merge branch 'main' into km/pin-unlock
2 parents cb8bfb5 + f52e521 commit c41601a

File tree

82 files changed

+1724
-243
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+1724
-243
lines changed

.github/workflows/build-android.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ on:
66
branches:
77
- "main"
88
workflow_dispatch:
9+
inputs:
10+
update-android-repo:
11+
description: "Update Android Repo - Opens a PR updating the SDK in bitwarden/android"
12+
type: boolean
13+
default: false
914

1015
defaults:
1116
run:
@@ -59,6 +64,9 @@ jobs:
5964
name: Combine
6065
runs-on: ubuntu-24.04
6166
needs: build
67+
outputs:
68+
sdk-package-id: ${{ steps.publish.outputs.sdk-package-id }}
69+
sdk-version: ${{ steps.publish.outputs.sdk-version }}
6270
permissions:
6371
contents: read
6472
packages: write
@@ -118,7 +126,53 @@ jobs:
118126
./gradlew build --warning-mode all --stacktrace
119127
120128
- name: Publish
129+
id: publish
121130
run: ./gradlew sdk:publish
122131
working-directory: crates/bitwarden-uniffi/kotlin
123132
env:
124133
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
134+
135+
update:
136+
name: Trigger SDK update in Android repo
137+
runs-on: ubuntu-24.04
138+
if: (github.ref == 'refs/heads/main' && github.event_name == 'push') || inputs.update-android-repo
139+
needs: combine
140+
permissions:
141+
id-token: write
142+
143+
steps:
144+
- name: Log in to Azure
145+
uses: bitwarden/gh-actions/azure-login@main
146+
with:
147+
subscription_id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
148+
tenant_id: ${{ secrets.AZURE_TENANT_ID }}
149+
client_id: ${{ secrets.AZURE_CLIENT_ID }}
150+
151+
- name: Get Azure Key Vault secrets
152+
id: get-kv-secrets
153+
uses: bitwarden/gh-actions/get-keyvault-secrets@main
154+
with:
155+
keyvault: gh-org-bitwarden
156+
secrets: "BW-GHAPP-ID,BW-GHAPP-KEY"
157+
158+
- name: Log out from Azure
159+
uses: bitwarden/gh-actions/azure-logout@main
160+
161+
- name: Generate GH App token
162+
uses: actions/create-github-app-token@0f859bf9e69e887678d5bbfbee594437cb440ffe # v2.1.1
163+
id: app-token
164+
with:
165+
app-id: ${{ steps.get-kv-secrets.outputs.BW-GHAPP-ID }}
166+
private-key: ${{ steps.get-kv-secrets.outputs.BW-GHAPP-KEY }}
167+
owner: bitwarden
168+
repositories: android
169+
permission-actions: write
170+
171+
- name: Call SDLC SDK Update workflow in Android repo
172+
env:
173+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
174+
_SDK_PACKAGE: ${{ needs.combine.outputs.sdk-package-id }}
175+
_SDK_VERSION: ${{ needs.combine.outputs.sdk-version }}
176+
run: |
177+
echo "🚀 Triggering sdlc-sdk-update.yml workflow in bitwarden/android repo..."
178+
gh workflow run sdlc-sdk-update.yml --repo bitwarden/android --ref main -f run-mode=Update -f sdk-package=$_SDK_PACKAGE -f sdk-version=$_SDK_VERSION

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npx lint-staged

Cargo.lock

Lines changed: 54 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ bitwarden-cli = { path = "crates/bitwarden-cli", version = "=1.0.0" }
2626
bitwarden-collections = { path = "crates/bitwarden-collections", version = "=1.0.0" }
2727
bitwarden-core = { path = "crates/bitwarden-core", version = "=1.0.0" }
2828
bitwarden-crypto = { path = "crates/bitwarden-crypto", version = "=1.0.0" }
29+
bitwarden-encoding = { path = "crates/bitwarden-encoding", version = "=1.0.0" }
2930
bitwarden-error = { path = "crates/bitwarden-error", version = "=1.0.0" }
3031
bitwarden-error-macro = { path = "crates/bitwarden-error-macro", version = "=1.0.0" }
3132
bitwarden-exporters = { path = "crates/bitwarden-exporters", version = "=1.0.0" }
@@ -49,6 +50,7 @@ chrono = { version = ">=0.4.26, <0.5", features = [
4950
"serde",
5051
"std",
5152
], default-features = false }
53+
data-encoding = ">=2.0, <3"
5254
js-sys = { version = ">=0.3.72, <0.4" }
5355
log = ">=0.4.18, <0.5"
5456
proc-macro2 = ">=1.0.89, <2"

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ are:
6363

6464
## API Bindings
6565

66-
We autogenerate the server bindings
67-
using[openapi-generator](https://github.com/OpenAPITools/openapi-generator). To do this, we first
68-
need to build the internal swagger documentation.
66+
We autogenerate the server bindings using
67+
[openapi-generator](https://github.com/OpenAPITools/openapi-generator). To do this, we first need to
68+
build the internal swagger documentation.
6969

7070
### Swagger generation
7171

bitwarden_license/bitwarden-sm/src/projects/create.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use bitwarden_api_api::models::ProjectCreateRequestModel;
2-
use bitwarden_core::{key_management::SymmetricKeyId, Client};
2+
use bitwarden_core::{key_management::SymmetricKeyId, Client, OrganizationId};
33
use bitwarden_crypto::PrimitiveEncryptable;
44
use schemars::JsonSchema;
55
use serde::{Deserialize, Serialize};
@@ -28,7 +28,7 @@ pub(crate) async fn create_project(
2828
input.validate()?;
2929

3030
let key_store = client.internal.get_key_store();
31-
let key = SymmetricKeyId::Organization(input.organization_id);
31+
let key = SymmetricKeyId::Organization(OrganizationId::new(input.organization_id));
3232

3333
let project = Some(ProjectCreateRequestModel {
3434
name: input

bitwarden_license/bitwarden-sm/src/projects/project_response.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use bitwarden_api_api::models::ProjectResponseModel;
22
use bitwarden_core::{
33
key_management::{KeyIds, SymmetricKeyId},
4-
require,
4+
require, OrganizationId,
55
};
66
use bitwarden_crypto::{Decryptable, EncString, KeyStoreContext};
77
use chrono::{DateTime, Utc};
@@ -28,7 +28,7 @@ impl ProjectResponse {
2828
ctx: &mut KeyStoreContext<KeyIds>,
2929
) -> Result<Self, SecretsManagerError> {
3030
let organization_id = require!(response.organization_id);
31-
let key = SymmetricKeyId::Organization(organization_id);
31+
let key = SymmetricKeyId::Organization(OrganizationId::new(organization_id));
3232

3333
let name = require!(response.name)
3434
.parse::<EncString>()?

bitwarden_license/bitwarden-sm/src/projects/update.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use bitwarden_api_api::models::ProjectUpdateRequestModel;
2-
use bitwarden_core::{key_management::SymmetricKeyId, Client};
2+
use bitwarden_core::{key_management::SymmetricKeyId, Client, OrganizationId};
33
use bitwarden_crypto::PrimitiveEncryptable;
44
use schemars::JsonSchema;
55
use serde::{Deserialize, Serialize};
@@ -30,7 +30,7 @@ pub(crate) async fn update_project(
3030
input.validate()?;
3131

3232
let key_store = client.internal.get_key_store();
33-
let key = SymmetricKeyId::Organization(input.organization_id);
33+
let key = SymmetricKeyId::Organization(OrganizationId::new(input.organization_id));
3434

3535
let project = Some(ProjectUpdateRequestModel {
3636
name: input

bitwarden_license/bitwarden-sm/src/secrets/create.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use bitwarden_api_api::models::SecretCreateRequestModel;
2-
use bitwarden_core::{key_management::SymmetricKeyId, Client};
2+
use bitwarden_core::{key_management::SymmetricKeyId, Client, OrganizationId};
33
use bitwarden_crypto::PrimitiveEncryptable;
44
use schemars::JsonSchema;
55
use serde::{Deserialize, Serialize};
@@ -36,7 +36,7 @@ pub(crate) async fn create_secret(
3636
input.validate()?;
3737

3838
let key_store = client.internal.get_key_store();
39-
let key = SymmetricKeyId::Organization(input.organization_id);
39+
let key = SymmetricKeyId::Organization(OrganizationId::new(input.organization_id));
4040

4141
let secret = {
4242
let mut ctx = key_store.context();

bitwarden_license/bitwarden-sm/src/secrets/list.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use bitwarden_api_api::models::{
44
use bitwarden_core::{
55
client::Client,
66
key_management::{KeyIds, SymmetricKeyId},
7-
require,
7+
require, OrganizationId,
88
};
99
use bitwarden_crypto::{Decryptable, EncString, KeyStoreContext};
1010
use schemars::JsonSchema;
@@ -99,7 +99,7 @@ impl SecretIdentifierResponse {
9999
ctx: &mut KeyStoreContext<KeyIds>,
100100
) -> Result<SecretIdentifierResponse, SecretsManagerError> {
101101
let organization_id = require!(response.organization_id);
102-
let enc_key = SymmetricKeyId::Organization(organization_id);
102+
let enc_key = SymmetricKeyId::Organization(OrganizationId::new(organization_id));
103103

104104
let key = require!(response.key)
105105
.parse::<EncString>()?

0 commit comments

Comments
 (0)