mirror of
https://github.com/bitwarden/mobile
synced 2025-12-05 23:53:33 +00:00
Compare commits
3 Commits
beta-nativ
...
feature/PM
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
95ccf1da08 | ||
|
|
ea44a84596 | ||
|
|
62f3fd5b5c |
39
.github/CODEOWNERS
vendored
39
.github/CODEOWNERS
vendored
@@ -1,39 +0,0 @@
|
|||||||
# Please sort into logical groups with comment headers. Sort groups in order of specificity.
|
|
||||||
# For example, default owners should always be the first group.
|
|
||||||
# Sort lines alphabetically within these groups to avoid accidentally adding duplicates.
|
|
||||||
#
|
|
||||||
# https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners
|
|
||||||
|
|
||||||
# Default file owners
|
|
||||||
* @bitwarden/dept-development-mobile
|
|
||||||
|
|
||||||
# DevOps for Actions and other workflow changes
|
|
||||||
.github/workflows @bitwarden/dept-devops
|
|
||||||
|
|
||||||
## Auth team files ##
|
|
||||||
|
|
||||||
## Platform team files ##
|
|
||||||
appIcons @bitwarden/team-platform-dev
|
|
||||||
build.cake @bitwarden/team-platform-dev
|
|
||||||
|
|
||||||
## Vault team files ##
|
|
||||||
src/watchOS @bitwarden/team-vault-dev
|
|
||||||
|
|
||||||
## Tools team files ##
|
|
||||||
src/Core/Services/EmailForwarders @bitwarden/team-tools-dev
|
|
||||||
|
|
||||||
## Crowdin Sync files ##
|
|
||||||
src/App/Resources @bitwarden/team-tools-dev
|
|
||||||
src/watchOS/bitwarden/bitwarden\ WatchKit\ Extension/Localization @bitwarden/team-tools-dev
|
|
||||||
store/apple @bitwarden/team-tools-dev
|
|
||||||
store/google @bitwarden/team-tools-dev
|
|
||||||
|
|
||||||
## Locales ##
|
|
||||||
src/App/Resources/AppResources.Designer.cs
|
|
||||||
src/App/Resources/AppResources.resx
|
|
||||||
src/watchOS/bitwarden/bitwarden\ WatchKit\ Extension/Localization/en.lproj
|
|
||||||
store/apple/en
|
|
||||||
store/google/en
|
|
||||||
|
|
||||||
## Utils ##
|
|
||||||
store/google/Publisher
|
|
||||||
17
.github/renovate.json
vendored
17
.github/renovate.json
vendored
@@ -2,21 +2,22 @@
|
|||||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||||
"extends": [
|
"extends": [
|
||||||
"config:base",
|
"config:base",
|
||||||
"github>bitwarden/renovate-config:pin-actions",
|
|
||||||
":combinePatchMinorReleases",
|
":combinePatchMinorReleases",
|
||||||
":dependencyDashboard",
|
":dependencyDashboard",
|
||||||
":maintainLockFilesWeekly",
|
":maintainLockFilesWeekly",
|
||||||
":pinAllExceptPeerDependencies",
|
":pinAllExceptPeerDependencies",
|
||||||
":prConcurrentLimit10",
|
":prConcurrentLimit10",
|
||||||
":rebaseStalePrs",
|
":rebaseStalePrs",
|
||||||
":separateMajorReleases",
|
"schedule:weekends",
|
||||||
"group:monorepos",
|
":separateMajorReleases"
|
||||||
"schedule:weekends"
|
|
||||||
],
|
],
|
||||||
"enabledManagers": ["github-actions", "npm", "nuget"],
|
"enabledManagers": ["cargo", "github-actions", "npm", "nuget"],
|
||||||
"commitMessagePrefix": "[deps]:",
|
|
||||||
"commitMessageTopic": "{{depName}}",
|
|
||||||
"packageRules": [
|
"packageRules": [
|
||||||
|
{
|
||||||
|
"groupName": "cargo minor",
|
||||||
|
"matchManagers": ["cargo"],
|
||||||
|
"matchUpdateTypes": ["minor", "patch"]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"groupName": "gh minor",
|
"groupName": "gh minor",
|
||||||
"matchManagers": ["github-actions"],
|
"matchManagers": ["github-actions"],
|
||||||
@@ -31,6 +32,6 @@
|
|||||||
"groupName": "nuget minor",
|
"groupName": "nuget minor",
|
||||||
"matchManagers": ["nuget"],
|
"matchManagers": ["nuget"],
|
||||||
"matchUpdateTypes": ["minor", "patch"]
|
"matchUpdateTypes": ["minor", "patch"]
|
||||||
}
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
220
.github/workflows/build.yml
vendored
220
.github/workflows/build.yml
vendored
@@ -9,14 +9,15 @@ on:
|
|||||||
paths-ignore:
|
paths-ignore:
|
||||||
- ".github/workflows/**"
|
- ".github/workflows/**"
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
inputs: {}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
cloc:
|
cloc:
|
||||||
name: CLOC
|
name: CLOC
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||||
|
|
||||||
- name: Set up CLOC
|
- name: Set up CLOC
|
||||||
run: |
|
run: |
|
||||||
@@ -29,13 +30,13 @@ jobs:
|
|||||||
|
|
||||||
setup:
|
setup:
|
||||||
name: Setup
|
name: Setup
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-20.04
|
||||||
outputs:
|
outputs:
|
||||||
rc_branch_exists: ${{ steps.branch-check.outputs.rc_branch_exists }}
|
rc_branch_exists: ${{ steps.branch-check.outputs.rc_branch_exists }}
|
||||||
hotfix_branch_exists: ${{ steps.branch-check.outputs.hotfix_branch_exists }}
|
hotfix_branch_exists: ${{ steps.branch-check.outputs.hotfix_branch_exists }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||||
with:
|
with:
|
||||||
submodules: 'true'
|
submodules: 'true'
|
||||||
|
|
||||||
@@ -53,6 +54,7 @@ jobs:
|
|||||||
else
|
else
|
||||||
echo "hotfix_branch_exists=0" >> $GITHUB_OUTPUT
|
echo "hotfix_branch_exists=0" >> $GITHUB_OUTPUT
|
||||||
fi
|
fi
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
|
||||||
android:
|
android:
|
||||||
@@ -69,23 +71,31 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
nuget-version: 5.9.0
|
nuget-version: 5.9.0
|
||||||
|
|
||||||
- name: Set up .NET
|
|
||||||
uses: actions/setup-dotnet@4d6c8fcf3c8f7a60068d26b594648e99df24cee3 # v4.0.0
|
|
||||||
with:
|
|
||||||
dotnet-version: '3.1.x'
|
|
||||||
|
|
||||||
- name: Set up MSBuild
|
- name: Set up MSBuild
|
||||||
uses: microsoft/setup-msbuild@031090342aeefe171e49f3820f3b52110c66e402 # v1.3.2
|
uses: microsoft/setup-msbuild@1ff57057b5cfdc39105cd07a01d78e9b0ea0c14c # v1.3.1
|
||||||
|
|
||||||
- name: Setup Windows builder
|
- name: Setup Windows builder
|
||||||
run: choco install checksum --no-progress
|
run: choco install checksum --no-progress
|
||||||
|
|
||||||
- name: Install Microsoft OpenJDK 11
|
- name: Work Around for broken Windows 2022 Runner Image
|
||||||
run: |
|
run: |
|
||||||
choco install microsoft-openjdk11 --no-progress
|
Set-Location "C:\Program Files (x86)\Microsoft Visual Studio\Installer\"
|
||||||
Write-Output "JAVA_HOME=$(Get-ChildItem -Path 'C:\Program Files\Microsoft\jdk*' | Select -First 1 -ExpandProperty FullName)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
$InstallPath = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise"
|
||||||
Write-Output "Java Home: $env:JAVA_HOME"
|
$componentsToAdd = @(
|
||||||
|
"Component.Xamarin"
|
||||||
|
)
|
||||||
|
[string]$workloadArgs = $componentsToAdd | ForEach-Object {" --add " + $_}
|
||||||
|
$Arguments = ('/c', "vs_installer.exe", 'modify', '--installPath', "`"$InstallPath`"",$workloadArgs, '--quiet', '--norestart', '--nocache')
|
||||||
|
$process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden
|
||||||
|
if ($process.ExitCode -eq 0)
|
||||||
|
{
|
||||||
|
Write-Host "components have been successfully added"
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Write-Host "components were not installed"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
- name: Print environment
|
- name: Print environment
|
||||||
run: |
|
run: |
|
||||||
nuget help | grep Version
|
nuget help | grep Version
|
||||||
@@ -95,10 +105,9 @@ jobs:
|
|||||||
echo "GitHub event: $GITHUB_EVENT"
|
echo "GitHub event: $GITHUB_EVENT"
|
||||||
|
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Decrypt secrets
|
- name: Decrypt secrets
|
||||||
env:
|
env:
|
||||||
DECRYPT_FILE_PASSWORD: ${{ secrets.DECRYPT_FILE_PASSWORD }}
|
DECRYPT_FILE_PASSWORD: ${{ secrets.DECRYPT_FILE_PASSWORD }}
|
||||||
@@ -112,7 +121,6 @@ jobs:
|
|||||||
gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPT_FILE_PASSWORD" \
|
gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPT_FILE_PASSWORD" \
|
||||||
--output $HOME/secrets/play_creds.json ./.github/secrets/play_creds.json.gpg
|
--output $HOME/secrets/play_creds.json ./.github/secrets/play_creds.json.gpg
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Decrypt secrets - Google Services
|
- name: Decrypt secrets - Google Services
|
||||||
if: ${{ matrix.variant == 'prod' }}
|
if: ${{ matrix.variant == 'prod' }}
|
||||||
env:
|
env:
|
||||||
@@ -121,7 +129,6 @@ jobs:
|
|||||||
gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPT_FILE_PASSWORD" \
|
gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPT_FILE_PASSWORD" \
|
||||||
--output ./src/Android/google-services.json ./.github/secrets/google-services.json.gpg
|
--output ./src/Android/google-services.json ./.github/secrets/google-services.json.gpg
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Increment version
|
- name: Increment version
|
||||||
run: |
|
run: |
|
||||||
BUILD_NUMBER=$((3000 + $GITHUB_RUN_NUMBER))
|
BUILD_NUMBER=$((3000 + $GITHUB_RUN_NUMBER))
|
||||||
@@ -139,15 +146,18 @@ jobs:
|
|||||||
|
|
||||||
- name: Restore tools
|
- name: Restore tools
|
||||||
run: dotnet tool restore
|
run: dotnet tool restore
|
||||||
|
shell: pwsh
|
||||||
|
|
||||||
- name: Verify Format
|
- name: Verify Format
|
||||||
run: dotnet tool run dotnet-format --check
|
run: dotnet tool run dotnet-format --check
|
||||||
|
shell: pwsh
|
||||||
|
|
||||||
- name: Run Core tests
|
- name: Run Core tests
|
||||||
run: dotnet test test/Core.Test/Core.Test.csproj --logger "trx;LogFileName=test-results.trx"
|
run: dotnet test test/Core.Test/Core.Test.csproj --logger "trx;LogFileName=test-results.trx"
|
||||||
|
shell: pwsh
|
||||||
|
|
||||||
- name: Report test results
|
- name: Report test results
|
||||||
uses: dorny/test-reporter@eaa763f6ffc21c7a37837f56cd5f9737f27fc6c8 # v1.8.0
|
uses: dorny/test-reporter@c9b3d0e2bd2a4e96aaf424dbaa31c46b42318226 # v1.6.0
|
||||||
if: always()
|
if: always()
|
||||||
with:
|
with:
|
||||||
name: Test Results
|
name: Test Results
|
||||||
@@ -171,6 +181,8 @@ jobs:
|
|||||||
Write-Output "########################################"
|
Write-Output "########################################"
|
||||||
msbuild "$($env:GITHUB_WORKSPACE + "/src/Android/Android.csproj")" "/p:Configuration=$configuration"
|
msbuild "$($env:GITHUB_WORKSPACE + "/src/Android/Android.csproj")" "/p:Configuration=$configuration"
|
||||||
|
|
||||||
|
shell: pwsh
|
||||||
|
|
||||||
- name: Sign Android Build
|
- name: Sign Android Build
|
||||||
env:
|
env:
|
||||||
PLAY_KEYSTORE_PASSWORD: ${{ secrets.PLAY_KEYSTORE_PASSWORD }}
|
PLAY_KEYSTORE_PASSWORD: ${{ secrets.PLAY_KEYSTORE_PASSWORD }}
|
||||||
@@ -217,10 +229,10 @@ jobs:
|
|||||||
$signedApkDestPath = $($env:GITHUB_WORKSPACE + "/$($packageName).apk");
|
$signedApkDestPath = $($env:GITHUB_WORKSPACE + "/$($packageName).apk");
|
||||||
|
|
||||||
Copy-Item $signedApkPath $signedApkDestPath
|
Copy-Item $signedApkPath $signedApkDestPath
|
||||||
|
shell: pwsh
|
||||||
- name: Upload Prod .aab artifact
|
- name: Upload Prod .aab artifact
|
||||||
if: ${{ matrix.variant == 'prod' }}
|
if: ${{ matrix.variant == 'prod' }}
|
||||||
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535 # v3.0.0
|
||||||
with:
|
with:
|
||||||
name: com.x8bit.bitwarden.aab
|
name: com.x8bit.bitwarden.aab
|
||||||
path: ./com.x8bit.bitwarden.aab
|
path: ./com.x8bit.bitwarden.aab
|
||||||
@@ -228,7 +240,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Upload Prod .apk artifact
|
- name: Upload Prod .apk artifact
|
||||||
if: ${{ matrix.variant == 'prod' }}
|
if: ${{ matrix.variant == 'prod' }}
|
||||||
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535 # v3.0.0
|
||||||
with:
|
with:
|
||||||
name: com.x8bit.bitwarden.apk
|
name: com.x8bit.bitwarden.apk
|
||||||
path: ./com.x8bit.bitwarden.apk
|
path: ./com.x8bit.bitwarden.apk
|
||||||
@@ -236,7 +248,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Upload Other .apk artifact
|
- name: Upload Other .apk artifact
|
||||||
if: ${{ matrix.variant != 'prod' }}
|
if: ${{ matrix.variant != 'prod' }}
|
||||||
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535 # v3.0.0
|
||||||
with:
|
with:
|
||||||
name: com.x8bit.bitwarden.${{ matrix.variant }}.apk
|
name: com.x8bit.bitwarden.${{ matrix.variant }}.apk
|
||||||
path: ./com.x8bit.bitwarden.${{ matrix.variant }}.apk
|
path: ./com.x8bit.bitwarden.${{ matrix.variant }}.apk
|
||||||
@@ -256,7 +268,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Upload .apk sha file for prod
|
- name: Upload .apk sha file for prod
|
||||||
if: ${{ matrix.variant == 'prod' }}
|
if: ${{ matrix.variant == 'prod' }}
|
||||||
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535 # v3.0.0
|
||||||
with:
|
with:
|
||||||
name: bw-android-apk-sha256.txt
|
name: bw-android-apk-sha256.txt
|
||||||
path: ./bw-android-apk-sha256.txt
|
path: ./bw-android-apk-sha256.txt
|
||||||
@@ -264,14 +276,14 @@ jobs:
|
|||||||
|
|
||||||
- name: Upload .apk sha file for other
|
- name: Upload .apk sha file for other
|
||||||
if: ${{ matrix.variant != 'prod' }}
|
if: ${{ matrix.variant != 'prod' }}
|
||||||
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535 # v3.0.0
|
||||||
with:
|
with:
|
||||||
name: bw-android-${{ matrix.variant }}-apk-sha256.txt
|
name: bw-android-${{ matrix.variant }}-apk-sha256.txt
|
||||||
path: ./bw-android-${{ matrix.variant }}-apk-sha256.txt
|
path: ./bw-android-${{ matrix.variant }}-apk-sha256.txt
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
|
||||||
- name: Deploy to Play Store
|
- name: Deploy to Play Store
|
||||||
if: ${{ matrix.variant == 'prod' && (( github.ref == 'refs/heads/main'
|
if: ${{ matrix.variant == 'prod' && (( github.ref == 'refs/heads/master'
|
||||||
&& needs.setup.outputs.rc_branch_exists == 0
|
&& needs.setup.outputs.rc_branch_exists == 0
|
||||||
&& needs.setup.outputs.hotfix_branch_exists == 0)
|
&& needs.setup.outputs.hotfix_branch_exists == 0)
|
||||||
|| (github.ref == 'refs/heads/rc' && needs.setup.outputs.hotfix_branch_exists == 0)
|
|| (github.ref == 'refs/heads/rc' && needs.setup.outputs.hotfix_branch_exists == 0)
|
||||||
@@ -296,16 +308,30 @@ jobs:
|
|||||||
nuget-version: 5.9.0
|
nuget-version: 5.9.0
|
||||||
|
|
||||||
- name: Set up MSBuild
|
- name: Set up MSBuild
|
||||||
uses: microsoft/setup-msbuild@031090342aeefe171e49f3820f3b52110c66e402 # v1.3.2
|
uses: microsoft/setup-msbuild@1ff57057b5cfdc39105cd07a01d78e9b0ea0c14c # v1.3.1
|
||||||
|
|
||||||
- name: Setup Windows builder
|
- name: Setup Windows builder
|
||||||
run: choco install checksum --no-progress
|
run: choco install checksum --no-progress
|
||||||
|
|
||||||
- name: Install Microsoft OpenJDK 11
|
- name: Work Around for broken Windows 2022 Runner Image
|
||||||
run: |
|
run: |
|
||||||
choco install microsoft-openjdk11 --no-progress
|
Set-Location "C:\Program Files (x86)\Microsoft Visual Studio\Installer\"
|
||||||
Write-Output "JAVA_HOME=$(Get-ChildItem -Path 'C:\Program Files\Microsoft\jdk*' | Select -First 1 -ExpandProperty FullName)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
$InstallPath = "C:\Program Files\Microsoft Visual Studio\2022\Enterprise"
|
||||||
Write-Output "Java Home: $env:JAVA_HOME"
|
$componentsToAdd = @(
|
||||||
|
"Component.Xamarin"
|
||||||
|
)
|
||||||
|
[string]$workloadArgs = $componentsToAdd | ForEach-Object {" --add " + $_}
|
||||||
|
$Arguments = ('/c', "vs_installer.exe", 'modify', '--installPath', "`"$InstallPath`"",$workloadArgs, '--quiet', '--norestart', '--nocache')
|
||||||
|
$process = Start-Process -FilePath cmd.exe -ArgumentList $Arguments -Wait -PassThru -WindowStyle Hidden
|
||||||
|
if ($process.ExitCode -eq 0)
|
||||||
|
{
|
||||||
|
Write-Host "components have been successfully added"
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Write-Host "components were not installed"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
- name: Print environment
|
- name: Print environment
|
||||||
run: |
|
run: |
|
||||||
@@ -316,7 +342,7 @@ jobs:
|
|||||||
echo "GitHub event: $GITHUB_EVENT"
|
echo "GitHub event: $GITHUB_EVENT"
|
||||||
|
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||||
|
|
||||||
- name: Decrypt secrets
|
- name: Decrypt secrets
|
||||||
env:
|
env:
|
||||||
@@ -410,6 +436,7 @@ jobs:
|
|||||||
$appCenterNode.ParentNode.RemoveChild($appCenterNode);
|
$appCenterNode.ParentNode.RemoveChild($appCenterNode);
|
||||||
|
|
||||||
$xml.Save($corePath);
|
$xml.Save($corePath);
|
||||||
|
shell: pwsh
|
||||||
|
|
||||||
- name: Restore packages
|
- name: Restore packages
|
||||||
run: nuget restore
|
run: nuget restore
|
||||||
@@ -423,6 +450,7 @@ jobs:
|
|||||||
Write-Output "########################################"
|
Write-Output "########################################"
|
||||||
|
|
||||||
msbuild "$($env:GITHUB_WORKSPACE + "/src/Android/Android.csproj")" "/p:Configuration=$configuration"
|
msbuild "$($env:GITHUB_WORKSPACE + "/src/Android/Android.csproj")" "/p:Configuration=$configuration"
|
||||||
|
shell: pwsh
|
||||||
|
|
||||||
- name: Sign for F-Droid
|
- name: Sign for F-Droid
|
||||||
env:
|
env:
|
||||||
@@ -446,9 +474,10 @@ jobs:
|
|||||||
$signedApkDestPath = $($env:GITHUB_WORKSPACE + "/com.x8bit.bitwarden-fdroid.apk");
|
$signedApkDestPath = $($env:GITHUB_WORKSPACE + "/com.x8bit.bitwarden-fdroid.apk");
|
||||||
|
|
||||||
Copy-Item $signedApkPath $signedApkDestPath
|
Copy-Item $signedApkPath $signedApkDestPath
|
||||||
|
shell: pwsh
|
||||||
|
|
||||||
- name: Upload F-Droid .apk artifact
|
- name: Upload F-Droid .apk artifact
|
||||||
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535 # v3.0.0
|
||||||
with:
|
with:
|
||||||
name: com.x8bit.bitwarden-fdroid.apk
|
name: com.x8bit.bitwarden-fdroid.apk
|
||||||
path: ./com.x8bit.bitwarden-fdroid.apk
|
path: ./com.x8bit.bitwarden-fdroid.apk
|
||||||
@@ -460,7 +489,7 @@ jobs:
|
|||||||
-t sha256 | Out-File -Encoding ASCII ./bw-fdroid-apk-sha256.txt
|
-t sha256 | Out-File -Encoding ASCII ./bw-fdroid-apk-sha256.txt
|
||||||
|
|
||||||
- name: Upload F-Droid sha file
|
- name: Upload F-Droid sha file
|
||||||
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535 # v3.0.0
|
||||||
with:
|
with:
|
||||||
name: bw-fdroid-apk-sha256.txt
|
name: bw-fdroid-apk-sha256.txt
|
||||||
path: ./bw-fdroid-apk-sha256.txt
|
path: ./bw-fdroid-apk-sha256.txt
|
||||||
@@ -486,21 +515,28 @@ jobs:
|
|||||||
echo "GitHub event: $GITHUB_EVENT"
|
echo "GitHub event: $GITHUB_EVENT"
|
||||||
|
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||||
with:
|
with:
|
||||||
submodules: 'true'
|
submodules: 'true'
|
||||||
|
|
||||||
- name: Login to Azure - CI Subscription
|
- name: Login to Azure - CI Subscription
|
||||||
uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0
|
uses: Azure/login@1f63701bf3e6892515f1b7ce2d2bf1708b46beaf # v1.4.3
|
||||||
with:
|
with:
|
||||||
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
|
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
|
||||||
|
|
||||||
- name: Retrieve secrets
|
- name: Retrieve secrets
|
||||||
id: retrieve-secrets
|
id: retrieve-secrets
|
||||||
uses: bitwarden/gh-actions/get-keyvault-secrets@main
|
env:
|
||||||
with:
|
KEYVAULT: bitwarden-ci
|
||||||
keyvault: "bitwarden-ci"
|
SECRETS: |
|
||||||
secrets: "appcenter-ios-token"
|
appcenter-ios-token
|
||||||
|
run: |
|
||||||
|
for i in ${SECRETS//,/ }
|
||||||
|
do
|
||||||
|
VALUE=$(az keyvault secret show --vault-name $KEYVAULT --name $i --query value --output tsv)
|
||||||
|
echo "::add-mask::$VALUE"
|
||||||
|
echo "$i=$VALUE" >> $GITHUB_OUTPUT
|
||||||
|
done
|
||||||
|
|
||||||
- name: Decrypt secrets
|
- name: Decrypt secrets
|
||||||
env:
|
env:
|
||||||
@@ -529,6 +565,7 @@ jobs:
|
|||||||
./.github/secrets/dist_watch_app_extension.mobileprovision.gpg
|
./.github/secrets/dist_watch_app_extension.mobileprovision.gpg
|
||||||
gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPT_FILE_PASSWORD" \
|
gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPT_FILE_PASSWORD" \
|
||||||
--output ./src/watchOS/bitwarden/GoogleService-Info.plist ./.github/secrets/GoogleService-Info.plist.gpg
|
--output ./src/watchOS/bitwarden/GoogleService-Info.plist ./.github/secrets/GoogleService-Info.plist.gpg
|
||||||
|
shell: bash
|
||||||
|
|
||||||
- name: Increment version
|
- name: Increment version
|
||||||
run: |
|
run: |
|
||||||
@@ -544,6 +581,8 @@ jobs:
|
|||||||
perl -0777 -pi.bak -e 's/<key>CFBundleVersion<\/key>\s*<string>1<\/string>/<key>CFBundleVersion<\/key>\n\t<string>'"$BUILD_NUMBER"'<\/string>/' ./src/iOS.ShareExtension/Info.plist
|
perl -0777 -pi.bak -e 's/<key>CFBundleVersion<\/key>\s*<string>1<\/string>/<key>CFBundleVersion<\/key>\n\t<string>'"$BUILD_NUMBER"'<\/string>/' ./src/iOS.ShareExtension/Info.plist
|
||||||
cd src/watchOS/bitwarden
|
cd src/watchOS/bitwarden
|
||||||
agvtool new-version -all $BUILD_NUMBER
|
agvtool new-version -all $BUILD_NUMBER
|
||||||
|
cd ../../..
|
||||||
|
shell: bash
|
||||||
|
|
||||||
- name: Update Entitlements
|
- name: Update Entitlements
|
||||||
run: |
|
run: |
|
||||||
@@ -552,6 +591,7 @@ jobs:
|
|||||||
echo "########################################"
|
echo "########################################"
|
||||||
|
|
||||||
perl -0777 -pi.bak -e 's/<key>aps-environment<\/key>\s*<string>development<\/string>/<key>aps-environment<\/key>\n\t<string>production<\/string>/' ./src/iOS/Entitlements.plist
|
perl -0777 -pi.bak -e 's/<key>aps-environment<\/key>\s*<string>development<\/string>/<key>aps-environment<\/key>\n\t<string>production<\/string>/' ./src/iOS/Entitlements.plist
|
||||||
|
shell: bash
|
||||||
|
|
||||||
- name: Set up Keychain
|
- name: Set up Keychain
|
||||||
env:
|
env:
|
||||||
@@ -568,6 +608,7 @@ jobs:
|
|||||||
security import ~/secrets/iphone-distribution-cert.p12 -k build.keychain -P $DIST_CERT_PASSWORD \
|
security import ~/secrets/iphone-distribution-cert.p12 -k build.keychain -P $DIST_CERT_PASSWORD \
|
||||||
-T /usr/bin/codesign -T /usr/bin/security
|
-T /usr/bin/codesign -T /usr/bin/security
|
||||||
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $KEYCHAIN_PASSWORD build.keychain
|
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $KEYCHAIN_PASSWORD build.keychain
|
||||||
|
shell: bash
|
||||||
|
|
||||||
- name: Set up provisioning profiles
|
- name: Set up provisioning profiles
|
||||||
run: |
|
run: |
|
||||||
@@ -598,6 +639,7 @@ jobs:
|
|||||||
|
|
||||||
WATCH_APP_EXTENSION_UUID=$(grep UUID -A1 -a $WATCH_APP_EXTENSION_PROFILE_PATH | grep -io "[-A-F0-9]\{36\}")
|
WATCH_APP_EXTENSION_UUID=$(grep UUID -A1 -a $WATCH_APP_EXTENSION_PROFILE_PATH | grep -io "[-A-F0-9]\{36\}")
|
||||||
cp $WATCH_APP_EXTENSION_PROFILE_PATH "$PROFILES_DIR_PATH/$WATCH_APP_EXTENSION_UUID.mobileprovision"
|
cp $WATCH_APP_EXTENSION_PROFILE_PATH "$PROFILES_DIR_PATH/$WATCH_APP_EXTENSION_UUID.mobileprovision"
|
||||||
|
shell: bash
|
||||||
|
|
||||||
- name: Bulid WatchApp
|
- name: Bulid WatchApp
|
||||||
run: |
|
run: |
|
||||||
@@ -610,6 +652,7 @@ jobs:
|
|||||||
echo "########################################"
|
echo "########################################"
|
||||||
echo "##### Done"
|
echo "##### Done"
|
||||||
echo "########################################"
|
echo "########################################"
|
||||||
|
shell: bash
|
||||||
|
|
||||||
- name: Restore packages
|
- name: Restore packages
|
||||||
run: nuget restore
|
run: nuget restore
|
||||||
@@ -619,22 +662,6 @@ jobs:
|
|||||||
$configuration = "AppStore";
|
$configuration = "AppStore";
|
||||||
$platform = "iPhone";
|
$platform = "iPhone";
|
||||||
|
|
||||||
Write-Output "########################################"
|
|
||||||
Write-Output "##### Archive $configuration Configuration for $platform Platform"
|
|
||||||
Write-Output "########################################"
|
|
||||||
msbuild "$($env:GITHUB_WORKSPACE + "/src/iOS/iOS.csproj")" "/p:Platform=$platform" `
|
|
||||||
"/p:Configuration=$configuration" "/p:ArchiveOnBuild=true" "/t:`"Build`""
|
|
||||||
|
|
||||||
Write-Output "########################################"
|
|
||||||
Write-Output "##### Done"
|
|
||||||
Write-Output "########################################"
|
|
||||||
shell: pwsh
|
|
||||||
|
|
||||||
- name: Archive Build for Mobile Automation
|
|
||||||
run: |
|
|
||||||
$configuration = "Release";
|
|
||||||
$platform = "iPhoneSimulator";
|
|
||||||
|
|
||||||
Write-Output "########################################"
|
Write-Output "########################################"
|
||||||
Write-Output "##### Archive $configuration Configuration for $platform Platform"
|
Write-Output "##### Archive $configuration Configuration for $platform Platform"
|
||||||
Write-Output "########################################"
|
Write-Output "########################################"
|
||||||
@@ -655,14 +682,7 @@ jobs:
|
|||||||
|
|
||||||
xcodebuild -exportArchive -archivePath $ARCHIVE_PATH -exportPath $EXPORT_PATH \
|
xcodebuild -exportArchive -archivePath $ARCHIVE_PATH -exportPath $EXPORT_PATH \
|
||||||
-exportOptionsPlist $EXPORT_OPTIONS_PATH
|
-exportOptionsPlist $EXPORT_OPTIONS_PATH
|
||||||
|
shell: bash
|
||||||
- name: Export .app for Automation CI
|
|
||||||
run: |
|
|
||||||
ARCHIVE_PATH="./src/iOS/bin/iPhoneSimulator/Release/BitwardeniOS.app"
|
|
||||||
EXPORT_PATH="./bitwarden-export"
|
|
||||||
|
|
||||||
zip -r -q BitwardeniOS.app.zip $ARCHIVE_PATH
|
|
||||||
mv BitwardeniOS.app.zip $EXPORT_PATH
|
|
||||||
|
|
||||||
- name: Copy all dSYMs files to upload
|
- name: Copy all dSYMs files to upload
|
||||||
run: |
|
run: |
|
||||||
@@ -675,9 +695,10 @@ jobs:
|
|||||||
cp -r -v $ARCHIVE_DSYMS_PATH $EXPORT_PATH
|
cp -r -v $ARCHIVE_DSYMS_PATH $EXPORT_PATH
|
||||||
mkdir $WATCH_DSYMS_EXPORT_PATH
|
mkdir $WATCH_DSYMS_EXPORT_PATH
|
||||||
cp -r -v $WATCH_ARCHIVE_DSYMS_PATH $WATCH_DSYMS_EXPORT_PATH
|
cp -r -v $WATCH_ARCHIVE_DSYMS_PATH $WATCH_DSYMS_EXPORT_PATH
|
||||||
|
shell: bash
|
||||||
|
|
||||||
- name: Upload App Store .ipa & dSYMs artifacts
|
- name: Upload App Store .ipa & dSYMs artifacts
|
||||||
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
|
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535 # v3.0.0
|
||||||
with:
|
with:
|
||||||
name: Bitwarden iOS
|
name: Bitwarden iOS
|
||||||
path: |
|
path: |
|
||||||
@@ -685,16 +706,9 @@ jobs:
|
|||||||
./bitwarden-export/dSYMs/*.*
|
./bitwarden-export/dSYMs/*.*
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
|
||||||
- name: Upload .app file for Automation CI
|
|
||||||
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
|
|
||||||
with:
|
|
||||||
name: BitwardeniOS.app.zip
|
|
||||||
path: ./bitwarden-export/BitwardeniOS.app.zip
|
|
||||||
if-no-files-found: error
|
|
||||||
|
|
||||||
- name: Install AppCenter CLI
|
- name: Install AppCenter CLI
|
||||||
if: |
|
if: |
|
||||||
(github.ref == 'refs/heads/main'
|
(github.ref == 'refs/heads/master'
|
||||||
&& needs.setup.outputs.rc_branch_exists == 0
|
&& needs.setup.outputs.rc_branch_exists == 0
|
||||||
&& needs.setup.outputs.hotfix_branch_exists == 0)
|
&& needs.setup.outputs.hotfix_branch_exists == 0)
|
||||||
|| (github.ref == 'refs/heads/rc' && needs.setup.outputs.hotfix_branch_exists == 0)
|
|| (github.ref == 'refs/heads/rc' && needs.setup.outputs.hotfix_branch_exists == 0)
|
||||||
@@ -703,7 +717,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Upload dSYMs to App Center
|
- name: Upload dSYMs to App Center
|
||||||
if: |
|
if: |
|
||||||
(github.ref == 'refs/heads/main'
|
(github.ref == 'refs/heads/master'
|
||||||
&& needs.setup.outputs.rc_branch_exists == 0
|
&& needs.setup.outputs.rc_branch_exists == 0
|
||||||
&& needs.setup.outputs.hotfix_branch_exists == 0)
|
&& needs.setup.outputs.hotfix_branch_exists == 0)
|
||||||
|| (github.ref == 'refs/heads/rc' && needs.setup.outputs.hotfix_branch_exists == 0)
|
|| (github.ref == 'refs/heads/rc' && needs.setup.outputs.hotfix_branch_exists == 0)
|
||||||
@@ -711,24 +725,27 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
APPCENTER_IOS_TOKEN: ${{ steps.retrieve-secrets.outputs.appcenter-ios-token }}
|
APPCENTER_IOS_TOKEN: ${{ steps.retrieve-secrets.outputs.appcenter-ios-token }}
|
||||||
run: appcenter crashes upload-symbols -a bitwarden/bitwarden -s "./bitwarden-export/dSYMs" --token $APPCENTER_IOS_TOKEN
|
run: appcenter crashes upload-symbols -a bitwarden/bitwarden -s "./bitwarden-export/dSYMs" --token $APPCENTER_IOS_TOKEN
|
||||||
|
shell: bash
|
||||||
|
|
||||||
- name: Upload Watch dSYMs to Firebase Crashlytics
|
- name: Upload Watch dSYMs to Firebase Crashlytics
|
||||||
if: |
|
if: |
|
||||||
(github.ref == 'refs/heads/main'
|
(github.ref == 'refs/heads/master'
|
||||||
&& needs.setup.outputs.rc_branch_exists == 0
|
&& needs.setup.outputs.rc_branch_exists == 0
|
||||||
&& needs.setup.outputs.hotfix_branch_exists == 0)
|
&& needs.setup.outputs.hotfix_branch_exists == 0)
|
||||||
|| (github.ref == 'refs/heads/rc' && needs.setup.outputs.hotfix_branch_exists == 0)
|
|| (github.ref == 'refs/heads/rc' && needs.setup.outputs.hotfix_branch_exists == 0)
|
||||||
|| github.ref == 'refs/heads/hotfix-rc'
|
|| github.ref == 'refs/heads/hotfix-rc'
|
||||||
run: |
|
run: |
|
||||||
|
|
||||||
echo "########################################"
|
echo "########################################"
|
||||||
echo "##### Uploading Watch dSYMs to Firebase"
|
echo "##### Uploading Watch dSYMs to Firebase"
|
||||||
echo "########################################"
|
echo "########################################"
|
||||||
|
|
||||||
find "$HOME/Library/Developer/XCode/DerivedData" -name "upload-symbols" -exec chmod +x {} \; -exec {} -gsp "./src/watchOS/bitwarden/GoogleService-Info.plist" -p ios "./bitwarden-export/Watch_dSYMs" \;
|
find "$HOME/Library/Developer/XCode/DerivedData" -name "upload-symbols" -exec chmod +x {} \; -exec {} -gsp "./src/watchOS/bitwarden/GoogleService-Info.plist" -p ios "./bitwarden-export/Watch_dSYMs" \;
|
||||||
|
shell: bash
|
||||||
|
|
||||||
- name: Deploy to App Store
|
- name: Deploy to App Store
|
||||||
if: |
|
if: |
|
||||||
(github.ref == 'refs/heads/main'
|
(github.ref == 'refs/heads/master'
|
||||||
&& needs.setup.outputs.rc_branch_exists == 0
|
&& needs.setup.outputs.rc_branch_exists == 0
|
||||||
&& needs.setup.outputs.hotfix_branch_exists == 0)
|
&& needs.setup.outputs.hotfix_branch_exists == 0)
|
||||||
|| (github.ref == 'refs/heads/rc' && needs.setup.outputs.hotfix_branch_exists == 0)
|
|| (github.ref == 'refs/heads/rc' && needs.setup.outputs.hotfix_branch_exists == 0)
|
||||||
@@ -739,42 +756,50 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
xcrun altool --upload-app --type ios --file "./bitwarden-export/Bitwarden.ipa" \
|
xcrun altool --upload-app --type ios --file "./bitwarden-export/Bitwarden.ipa" \
|
||||||
--username "$APPLE_ID_USERNAME" --password "$APPLE_ID_PASSWORD"
|
--username "$APPLE_ID_USERNAME" --password "$APPLE_ID_PASSWORD"
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
|
||||||
crowdin-push:
|
crowdin-push:
|
||||||
name: Crowdin Push
|
name: Crowdin Push
|
||||||
if: github.ref == 'refs/heads/main'
|
if: github.ref == 'refs/heads/master'
|
||||||
needs:
|
needs:
|
||||||
- android
|
- android
|
||||||
- f-droid
|
- f-droid
|
||||||
- ios
|
- ios
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-20.04
|
||||||
env:
|
env:
|
||||||
_CROWDIN_PROJECT_ID: "269690"
|
_CROWDIN_PROJECT_ID: "269690"
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||||
|
|
||||||
- name: Login to Azure - CI Subscription
|
- name: Login to Azure - CI Subscription
|
||||||
uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0
|
uses: Azure/login@1f63701bf3e6892515f1b7ce2d2bf1708b46beaf # v1.4.3
|
||||||
with:
|
with:
|
||||||
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
|
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
|
||||||
|
|
||||||
- name: Retrieve secrets
|
- name: Retrieve secrets
|
||||||
id: retrieve-secrets
|
id: retrieve-secrets
|
||||||
uses: bitwarden/gh-actions/get-keyvault-secrets@main
|
env:
|
||||||
with:
|
KEYVAULT: bitwarden-ci
|
||||||
keyvault: "bitwarden-ci"
|
SECRETS: |
|
||||||
secrets: "crowdin-api-token"
|
crowdin-api-token
|
||||||
|
run: |
|
||||||
|
for i in ${SECRETS//,/ }
|
||||||
|
do
|
||||||
|
VALUE=$(az keyvault secret show --vault-name $KEYVAULT --name $i --query value --output tsv)
|
||||||
|
echo "::add-mask::$VALUE"
|
||||||
|
echo "$i=$VALUE" >> $GITHUB_OUTPUT
|
||||||
|
done
|
||||||
|
|
||||||
- name: Upload Sources
|
- name: Upload Sources
|
||||||
uses: crowdin/github-action@6fb7e99759b996fd142995636fd8c88c1fb8ecd9 # v1.16.1
|
uses: crowdin/github-action@965d501f160af7b1f88aed4c29154b0caf1e94b9 # v1.9.0
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
CROWDIN_API_TOKEN: ${{ steps.retrieve-secrets.outputs.crowdin-api-token }}
|
CROWDIN_API_TOKEN: ${{ steps.retrieve-secrets.outputs.crowdin-api-token }}
|
||||||
with:
|
with:
|
||||||
config: crowdin.yml
|
config: crowdin.yml
|
||||||
crowdin_branch_name: main
|
crowdin_branch_name: master
|
||||||
upload_sources: true
|
upload_sources: true
|
||||||
upload_translations: false
|
upload_translations: false
|
||||||
|
|
||||||
@@ -782,7 +807,7 @@ jobs:
|
|||||||
check-failures:
|
check-failures:
|
||||||
name: Check for failures
|
name: Check for failures
|
||||||
if: always()
|
if: always()
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-20.04
|
||||||
needs:
|
needs:
|
||||||
- cloc
|
- cloc
|
||||||
- android
|
- android
|
||||||
@@ -792,7 +817,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Check if any job failed
|
- name: Check if any job failed
|
||||||
if: |
|
if: |
|
||||||
(github.ref == 'refs/heads/main')
|
(github.ref == 'refs/heads/master')
|
||||||
|| (github.ref == 'refs/heads/rc')
|
|| (github.ref == 'refs/heads/rc')
|
||||||
|| (github.ref == 'refs/heads/hotfix-rc')
|
|| (github.ref == 'refs/heads/hotfix-rc')
|
||||||
env:
|
env:
|
||||||
@@ -815,18 +840,25 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Login to Azure - CI Subscription
|
- name: Login to Azure - CI Subscription
|
||||||
uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0
|
uses: Azure/login@1f63701bf3e6892515f1b7ce2d2bf1708b46beaf # v1.4.3
|
||||||
if: failure()
|
if: failure()
|
||||||
with:
|
with:
|
||||||
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
|
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
|
||||||
|
|
||||||
- name: Retrieve secrets
|
- name: Retrieve secrets
|
||||||
id: retrieve-secrets
|
id: retrieve-secrets
|
||||||
uses: bitwarden/gh-actions/get-keyvault-secrets@main
|
|
||||||
if: failure()
|
if: failure()
|
||||||
with:
|
env:
|
||||||
keyvault: "bitwarden-ci"
|
KEYVAULT: bitwarden-ci
|
||||||
secrets: "devops-alerts-slack-webhook-url"
|
SECRETS: |
|
||||||
|
devops-alerts-slack-webhook-url
|
||||||
|
run: |
|
||||||
|
for i in ${SECRETS//,/ }
|
||||||
|
do
|
||||||
|
VALUE=$(az keyvault secret show --vault-name $KEYVAULT --name $i --query value --output tsv)
|
||||||
|
echo "::add-mask::$VALUE"
|
||||||
|
echo "$i=$VALUE" >> $GITHUB_OUTPUT
|
||||||
|
done
|
||||||
|
|
||||||
- name: Notify Slack on failure
|
- name: Notify Slack on failure
|
||||||
uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f # v2.0.0
|
uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f # v2.0.0
|
||||||
|
|||||||
10
.github/workflows/crowdin-pull.yml
vendored
10
.github/workflows/crowdin-pull.yml
vendored
@@ -15,28 +15,28 @@ jobs:
|
|||||||
_CROWDIN_PROJECT_ID: "269690"
|
_CROWDIN_PROJECT_ID: "269690"
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
|
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||||
|
|
||||||
- name: Login to Azure - CI Subscription
|
- name: Login to Azure - CI Subscription
|
||||||
uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0
|
uses: Azure/login@1f63701bf3e6892515f1b7ce2d2bf1708b46beaf # v1.4.3
|
||||||
with:
|
with:
|
||||||
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
|
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
|
||||||
|
|
||||||
- name: Retrieve secrets
|
- name: Retrieve secrets
|
||||||
id: retrieve-secrets
|
id: retrieve-secrets
|
||||||
uses: bitwarden/gh-actions/get-keyvault-secrets@main
|
uses: bitwarden/gh-actions/get-keyvault-secrets@34ecb67b2a357795dc893549df0795e7383ff50f
|
||||||
with:
|
with:
|
||||||
keyvault: "bitwarden-ci"
|
keyvault: "bitwarden-ci"
|
||||||
secrets: "crowdin-api-token, github-gpg-private-key, github-gpg-private-key-passphrase"
|
secrets: "crowdin-api-token, github-gpg-private-key, github-gpg-private-key-passphrase"
|
||||||
|
|
||||||
- name: Download translations
|
- name: Download translations
|
||||||
uses: crowdin/github-action@6fb7e99759b996fd142995636fd8c88c1fb8ecd9 # v1.16.1
|
uses: crowdin/github-action@965d501f160af7b1f88aed4c29154b0caf1e94b9 # v1.9.0
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
CROWDIN_API_TOKEN: ${{ steps.retrieve-secrets.outputs.crowdin-api-token }}
|
CROWDIN_API_TOKEN: ${{ steps.retrieve-secrets.outputs.crowdin-api-token }}
|
||||||
with:
|
with:
|
||||||
config: crowdin.yml
|
config: crowdin.yml
|
||||||
crowdin_branch_name: main
|
crowdin_branch_name: master
|
||||||
upload_sources: false
|
upload_sources: false
|
||||||
upload_translations: false
|
upload_translations: false
|
||||||
download_translations: true
|
download_translations: true
|
||||||
|
|||||||
2
.github/workflows/pr-labeler.yml
vendored
2
.github/workflows/pr-labeler.yml
vendored
@@ -12,6 +12,6 @@ jobs:
|
|||||||
pull-requests: write
|
pull-requests: write
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/labeler@ac9175f8a1f3625fd0d4fb234536d26811351594 # v4.3.0
|
- uses: actions/labeler@ba790c862c380240c6d5e7427be5ace9a05c754b # v4.0.3
|
||||||
with:
|
with:
|
||||||
sync-labels: true
|
sync-labels: true
|
||||||
|
|||||||
24
.github/workflows/release.yml
vendored
24
.github/workflows/release.yml
vendored
@@ -38,11 +38,11 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
|
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||||
|
|
||||||
- name: Check Release Version
|
- name: Check Release Version
|
||||||
id: version
|
id: version
|
||||||
uses: bitwarden/gh-actions/release-version-check@main
|
uses: bitwarden/gh-actions/release-version-check@34ecb67b2a357795dc893549df0795e7383ff50f
|
||||||
with:
|
with:
|
||||||
release-type: ${{ github.event.inputs.release_type }}
|
release-type: ${{ github.event.inputs.release_type }}
|
||||||
project-type: xamarin
|
project-type: xamarin
|
||||||
@@ -68,7 +68,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Download all artifacts
|
- name: Download all artifacts
|
||||||
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
|
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
|
||||||
uses: dawidd6/action-download-artifact@268677152d06ba59fcec7a7f0b5d961b6ccd7e1e # v2.28.0
|
uses: dawidd6/action-download-artifact@246dbf436b23d7c49e21a7ab8204ca9ecd1fe615 # v2.27.0
|
||||||
with:
|
with:
|
||||||
workflow: build.yml
|
workflow: build.yml
|
||||||
workflow_conclusion: success
|
workflow_conclusion: success
|
||||||
@@ -76,18 +76,18 @@ jobs:
|
|||||||
|
|
||||||
- name: Dry Run - Download all artifacts
|
- name: Dry Run - Download all artifacts
|
||||||
if: ${{ github.event.inputs.release_type == 'Dry Run' }}
|
if: ${{ github.event.inputs.release_type == 'Dry Run' }}
|
||||||
uses: dawidd6/action-download-artifact@268677152d06ba59fcec7a7f0b5d961b6ccd7e1e # v2.28.0
|
uses: dawidd6/action-download-artifact@246dbf436b23d7c49e21a7ab8204ca9ecd1fe615 # v2.27.0
|
||||||
with:
|
with:
|
||||||
workflow: build.yml
|
workflow: build.yml
|
||||||
workflow_conclusion: success
|
workflow_conclusion: success
|
||||||
branch: main
|
branch: master
|
||||||
|
|
||||||
- name: Prep Bitwarden iOS release asset
|
- name: Prep Bitwarden iOS release asset
|
||||||
run: zip -r Bitwarden\ iOS.zip Bitwarden\ iOS
|
run: zip -r Bitwarden\ iOS.zip Bitwarden\ iOS
|
||||||
|
|
||||||
- name: Create release
|
- name: Create release
|
||||||
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
|
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
|
||||||
uses: ncipollo/release-action@6c75be85e571768fa31b40abf38de58ba0397db5 # v1.13.0
|
uses: ncipollo/release-action@40bb172bd05f266cf9ba4ff965cb61e9ee5f6d01 # v1.9.0
|
||||||
with:
|
with:
|
||||||
artifacts: "./com.x8bit.bitwarden.aab/com.x8bit.bitwarden.aab,
|
artifacts: "./com.x8bit.bitwarden.aab/com.x8bit.bitwarden.aab,
|
||||||
./com.x8bit.bitwarden.apk/com.x8bit.bitwarden.apk,
|
./com.x8bit.bitwarden.apk/com.x8bit.bitwarden.apk,
|
||||||
@@ -126,11 +126,11 @@ jobs:
|
|||||||
if: inputs.fdroid_publish
|
if: inputs.fdroid_publish
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
|
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||||
|
|
||||||
- name: Download F-Droid .apk artifact
|
- name: Download F-Droid .apk artifact
|
||||||
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
|
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
|
||||||
uses: dawidd6/action-download-artifact@268677152d06ba59fcec7a7f0b5d961b6ccd7e1e # v2.28.0
|
uses: dawidd6/action-download-artifact@246dbf436b23d7c49e21a7ab8204ca9ecd1fe615 # v2.27.0
|
||||||
with:
|
with:
|
||||||
workflow: build.yml
|
workflow: build.yml
|
||||||
workflow_conclusion: success
|
workflow_conclusion: success
|
||||||
@@ -139,17 +139,17 @@ jobs:
|
|||||||
|
|
||||||
- name: Dry Run - Download F-Droid .apk artifact
|
- name: Dry Run - Download F-Droid .apk artifact
|
||||||
if: ${{ github.event.inputs.release_type == 'Dry Run' }}
|
if: ${{ github.event.inputs.release_type == 'Dry Run' }}
|
||||||
uses: dawidd6/action-download-artifact@268677152d06ba59fcec7a7f0b5d961b6ccd7e1e # v2.28.0
|
uses: dawidd6/action-download-artifact@246dbf436b23d7c49e21a7ab8204ca9ecd1fe615 # v2.27.0
|
||||||
with:
|
with:
|
||||||
workflow: build.yml
|
workflow: build.yml
|
||||||
workflow_conclusion: success
|
workflow_conclusion: success
|
||||||
branch: main
|
branch: master
|
||||||
name: com.x8bit.bitwarden-fdroid.apk
|
name: com.x8bit.bitwarden-fdroid.apk
|
||||||
|
|
||||||
- name: Set up Node
|
- name: Set up Node
|
||||||
uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1
|
uses: actions/setup-node@1f8c6b94b26d0feae1e387ca63ccbdc44d27b561 # v2.5.1
|
||||||
with:
|
with:
|
||||||
node-version: '16.x'
|
node-version: '10.x'
|
||||||
|
|
||||||
- name: Set up F-Droid server
|
- name: Set up F-Droid server
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
4
.github/workflows/stale-bot.yml
vendored
4
.github/workflows/stale-bot.yml
vendored
@@ -11,7 +11,7 @@ jobs:
|
|||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- name: 'Run stale action'
|
- name: 'Run stale action'
|
||||||
uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # v9.0.0
|
uses: actions/stale@3cc123766321e9f15a6676375c154ccffb12a358 # v5.0.0
|
||||||
with:
|
with:
|
||||||
stale-issue-label: 'needs-reply'
|
stale-issue-label: 'needs-reply'
|
||||||
stale-pr-label: 'needs-changes'
|
stale-pr-label: 'needs-changes'
|
||||||
@@ -27,4 +27,4 @@ jobs:
|
|||||||
|
|
||||||
If you’re still working on this, please respond here after you’ve made the changes we’ve requested and our team will re-open it for further review.
|
If you’re still working on this, please respond here after you’ve made the changes we’ve requested and our team will re-open it for further review.
|
||||||
|
|
||||||
Please make sure to resolve any conflicts with the main branch before requesting another review.
|
Please make sure to resolve any conflicts with the master branch before requesting another review.
|
||||||
|
|||||||
13
.github/workflows/version-auto-bump.yml
vendored
13
.github/workflows/version-auto-bump.yml
vendored
@@ -14,7 +14,7 @@ jobs:
|
|||||||
version_number: ${{ steps.version.outputs.new-version }}
|
version_number: ${{ steps.version.outputs.new-version }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Branch
|
- name: Checkout Branch
|
||||||
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
|
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||||
|
|
||||||
- name: Calculate bumped version
|
- name: Calculate bumped version
|
||||||
id: version
|
id: version
|
||||||
@@ -32,9 +32,14 @@ jobs:
|
|||||||
echo "new-version=$NEW_VER" >> $GITHUB_OUTPUT
|
echo "new-version=$NEW_VER" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
trigger_version_bump:
|
trigger_version_bump:
|
||||||
name: Bump version to ${{ needs.setup.outputs.version_number }}
|
name: "Version bump"
|
||||||
needs: setup
|
runs-on: ubuntu-22.04
|
||||||
|
needs:
|
||||||
|
- setup
|
||||||
|
steps:
|
||||||
|
- name: Bump version to ${{ needs.setup.outputs.version_number }}
|
||||||
uses: ./.github/workflows/version-bump.yml
|
uses: ./.github/workflows/version-bump.yml
|
||||||
|
secrets:
|
||||||
|
AZURE_PROD_KV_CREDENTIALS: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
|
||||||
with:
|
with:
|
||||||
version_number: ${{ needs.setup.outputs.version_number }}
|
version_number: ${{ needs.setup.outputs.version_number }}
|
||||||
secrets: inherit
|
|
||||||
159
.github/workflows/version-bump.yml
vendored
159
.github/workflows/version-bump.yml
vendored
@@ -1,45 +1,43 @@
|
|||||||
---
|
---
|
||||||
name: Version Bump
|
name: Version Bump
|
||||||
run-name: Version Bump - v${{ inputs.version_number }}
|
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
version_number:
|
version_number:
|
||||||
description: "New version (example: '2024.1.0')"
|
description: "New Version"
|
||||||
|
required: true
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
version_number:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
secrets:
|
||||||
|
AZURE_PROD_KV_CREDENTIALS:
|
||||||
required: true
|
required: true
|
||||||
cut_rc_branch:
|
|
||||||
description: "Cut RC branch?"
|
|
||||||
default: true
|
|
||||||
type: boolean
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
bump_version:
|
bump_version:
|
||||||
name: "Bump Version to v${{ inputs.version_number }}"
|
name: "Create version_bump_${{ github.event.inputs.version_number }} branch"
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
|
- name: Checkout Branch
|
||||||
|
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
|
||||||
|
|
||||||
- name: Login to Azure - CI Subscription
|
- name: Login to Azure - CI Subscription
|
||||||
uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0
|
uses: Azure/login@1f63701bf3e6892515f1b7ce2d2bf1708b46beaf # v1.4.3
|
||||||
with:
|
with:
|
||||||
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
|
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
|
||||||
|
|
||||||
- name: Retrieve secrets
|
- name: Retrieve secrets
|
||||||
id: retrieve-secrets
|
id: retrieve-secrets
|
||||||
uses: bitwarden/gh-actions/get-keyvault-secrets@main
|
uses: bitwarden/gh-actions/get-keyvault-secrets@34ecb67b2a357795dc893549df0795e7383ff50f
|
||||||
with:
|
with:
|
||||||
keyvault: "bitwarden-ci"
|
keyvault: "bitwarden-ci"
|
||||||
secrets: "github-gpg-private-key,
|
secrets: "github-gpg-private-key, github-gpg-private-key-passphrase"
|
||||||
github-gpg-private-key-passphrase,
|
|
||||||
github-pat-bitwarden-devops-bot-repo-scope"
|
|
||||||
|
|
||||||
- name: Checkout Branch
|
|
||||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
|
||||||
with:
|
|
||||||
ref: main
|
|
||||||
repository: bitwarden/mobile
|
|
||||||
|
|
||||||
- name: Import GPG key
|
- name: Import GPG key
|
||||||
uses: crazy-max/ghaction-import-gpg@d6f3f49f3345e29369fe57596a3ca8f94c4d2ca7 # v5.4.0
|
uses: crazy-max/ghaction-import-gpg@111c56156bcc6918c056dbef52164cfa583dc549 # v5.2.0
|
||||||
with:
|
with:
|
||||||
gpg_private_key: ${{ steps.retrieve-secrets.outputs.github-gpg-private-key }}
|
gpg_private_key: ${{ steps.retrieve-secrets.outputs.github-gpg-private-key }}
|
||||||
passphrase: ${{ steps.retrieve-secrets.outputs.github-gpg-private-key-passphrase }}
|
passphrase: ${{ steps.retrieve-secrets.outputs.github-gpg-private-key-passphrase }}
|
||||||
@@ -47,68 +45,37 @@ jobs:
|
|||||||
git_commit_gpgsign: true
|
git_commit_gpgsign: true
|
||||||
|
|
||||||
- name: Create Version Branch
|
- name: Create Version Branch
|
||||||
id: create-branch
|
run: git switch -c version_bump_${{ github.event.inputs.version_number }}
|
||||||
run: |
|
|
||||||
NAME=version_bump_${{ github.ref_name }}_${{ inputs.version_number }}
|
|
||||||
git switch -c $NAME
|
|
||||||
echo "name=$NAME" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: Install xmllint
|
|
||||||
run: sudo apt install -y libxml2-utils
|
|
||||||
|
|
||||||
- name: Verify input version
|
|
||||||
env:
|
|
||||||
NEW_VERSION: ${{ inputs.version_number }}
|
|
||||||
run: |
|
|
||||||
CURRENT_VERSION=$(xmllint --xpath '
|
|
||||||
string(/manifest/@*[local-name()="versionName"
|
|
||||||
and namespace-uri()="http://schemas.android.com/apk/res/android"])
|
|
||||||
' src/Android/Properties/AndroidManifest.xml)
|
|
||||||
|
|
||||||
# Error if version has not changed.
|
|
||||||
if [[ "$NEW_VERSION" == "$CURRENT_VERSION" ]]; then
|
|
||||||
echo "Version has not changed."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check if version is newer.
|
|
||||||
printf '%s\n' "${CURRENT_VERSION}" "${NEW_VERSION}" | sort -C -V
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
echo "Version check successful."
|
|
||||||
else
|
|
||||||
echo "Version check failed."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Bump Version - Android XML
|
- name: Bump Version - Android XML
|
||||||
uses: bitwarden/gh-actions/version-bump@main
|
uses: bitwarden/gh-actions/version-bump@34ecb67b2a357795dc893549df0795e7383ff50f
|
||||||
with:
|
with:
|
||||||
version: ${{ inputs.version_number }}
|
version: ${{ github.event.inputs.version_number }}
|
||||||
file_path: "src/Android/Properties/AndroidManifest.xml"
|
file_path: "./src/Android/Properties/AndroidManifest.xml"
|
||||||
|
|
||||||
- name: Bump Version - iOS.Autofill
|
- name: Bump Version - iOS.Autofill
|
||||||
uses: bitwarden/gh-actions/version-bump@main
|
uses: bitwarden/gh-actions/version-bump@34ecb67b2a357795dc893549df0795e7383ff50f
|
||||||
with:
|
with:
|
||||||
version: ${{ inputs.version_number }}
|
version: ${{ github.event.inputs.version_number }}
|
||||||
file_path: "src/iOS.Autofill/Info.plist"
|
file_path: "./src/iOS.Autofill/Info.plist"
|
||||||
|
|
||||||
- name: Bump Version - iOS.Extension
|
- name: Bump Version - iOS.Extension
|
||||||
uses: bitwarden/gh-actions/version-bump@main
|
uses: bitwarden/gh-actions/version-bump@34ecb67b2a357795dc893549df0795e7383ff50f
|
||||||
with:
|
with:
|
||||||
version: ${{ inputs.version_number }}
|
version: ${{ github.event.inputs.version_number }}
|
||||||
file_path: "src/iOS.Extension/Info.plist"
|
file_path: "./src/iOS.Extension/Info.plist"
|
||||||
|
|
||||||
- name: Bump Version - iOS.ShareExtension
|
- name: Bump Version - iOS.ShareExtension
|
||||||
uses: bitwarden/gh-actions/version-bump@main
|
uses: bitwarden/gh-actions/version-bump@34ecb67b2a357795dc893549df0795e7383ff50f
|
||||||
with:
|
with:
|
||||||
version: ${{ inputs.version_number }}
|
version: ${{ github.event.inputs.version_number }}
|
||||||
file_path: "src/iOS.ShareExtension/Info.plist"
|
file_path: "./src/iOS.ShareExtension/Info.plist"
|
||||||
|
|
||||||
- name: Bump Version - iOS
|
- name: Bump Version - iOS
|
||||||
uses: bitwarden/gh-actions/version-bump@main
|
uses: bitwarden/gh-actions/version-bump@34ecb67b2a357795dc893549df0795e7383ff50f
|
||||||
with:
|
with:
|
||||||
version: ${{ inputs.version_number }}
|
version: ${{ github.event.inputs.version_number }}
|
||||||
file_path: "src/iOS/Info.plist"
|
file_path: "./src/iOS/Info.plist"
|
||||||
|
|
||||||
- name: Setup git
|
- name: Setup git
|
||||||
run: |
|
run: |
|
||||||
@@ -127,24 +94,22 @@ jobs:
|
|||||||
|
|
||||||
- name: Commit files
|
- name: Commit files
|
||||||
if: ${{ steps.version-changed.outputs.changes_to_commit == 'TRUE' }}
|
if: ${{ steps.version-changed.outputs.changes_to_commit == 'TRUE' }}
|
||||||
run: git commit -m "Bumped version to ${{ inputs.version_number }}" -a
|
run: git commit -m "Bumped version to ${{ github.event.inputs.version_number }}" -a
|
||||||
|
|
||||||
- name: Push changes
|
- name: Push changes
|
||||||
if: ${{ steps.version-changed.outputs.changes_to_commit == 'TRUE' }}
|
if: ${{ steps.version-changed.outputs.changes_to_commit == 'TRUE' }}
|
||||||
env:
|
run: git push -u origin version_bump_${{ github.event.inputs.version_number }}
|
||||||
PR_BRANCH: ${{ steps.create-branch.outputs.name }}
|
|
||||||
run: git push -u origin $PR_BRANCH
|
|
||||||
|
|
||||||
- name: Create Version PR
|
- name: Create Version PR
|
||||||
if: ${{ steps.version-changed.outputs.changes_to_commit == 'TRUE' }}
|
if: ${{ steps.version-changed.outputs.changes_to_commit == 'TRUE' }}
|
||||||
id: create-pr
|
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ steps.retrieve-secrets.outputs.github-pat-bitwarden-devops-bot-repo-scope }}
|
PR_BRANCH: "version_bump_${{ github.event.inputs.version_number }}"
|
||||||
PR_BRANCH: ${{ steps.create-branch.outputs.name }}
|
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
||||||
TITLE: "Bump version to ${{ inputs.version_number }}"
|
BASE_BRANCH: master
|
||||||
|
TITLE: "Bump version to ${{ github.event.inputs.version_number }}"
|
||||||
run: |
|
run: |
|
||||||
PR_URL=$(gh pr create --title "$TITLE" \
|
gh pr create --title "$TITLE" \
|
||||||
--base "main" \
|
--base "$BASE" \
|
||||||
--head "$PR_BRANCH" \
|
--head "$PR_BRANCH" \
|
||||||
--label "version update" \
|
--label "version update" \
|
||||||
--label "automated pr" \
|
--label "automated pr" \
|
||||||
@@ -157,42 +122,4 @@ jobs:
|
|||||||
- [X] Other
|
- [X] Other
|
||||||
|
|
||||||
## Objective
|
## Objective
|
||||||
Automated version bump to ${{ inputs.version_number }}")
|
Automated version bump to ${{ github.event.inputs.version_number }}"
|
||||||
echo "pr_number=${PR_URL##*/}" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: Approve PR
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
PR_NUMBER: ${{ steps.create-pr.outputs.pr_number }}
|
|
||||||
run: gh pr review $PR_NUMBER --approve
|
|
||||||
|
|
||||||
- name: Merge PR
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ steps.retrieve-secrets.outputs.github-pat-bitwarden-devops-bot-repo-scope }}
|
|
||||||
PR_NUMBER: ${{ steps.create-pr.outputs.pr_number }}
|
|
||||||
run: gh pr merge $PR_NUMBER --squash --auto --delete-branch
|
|
||||||
|
|
||||||
cut_rc:
|
|
||||||
name: Cut RC branch
|
|
||||||
needs: bump_version
|
|
||||||
if: ${{ inputs.cut_rc_branch == true }}
|
|
||||||
runs-on: ubuntu-22.04
|
|
||||||
steps:
|
|
||||||
- name: Checkout Branch
|
|
||||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
|
||||||
with:
|
|
||||||
ref: main
|
|
||||||
|
|
||||||
- name: Check if RC branch exists
|
|
||||||
run: |
|
|
||||||
remote_rc_branch_check=$(git ls-remote --heads origin rc | wc -l)
|
|
||||||
if [[ "${remote_rc_branch_check}" -gt 0 ]]; then
|
|
||||||
echo "Remote RC branch exists."
|
|
||||||
echo "Please delete current RC branch before running again."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Cut RC branch
|
|
||||||
run: |
|
|
||||||
git switch --quiet --create rc
|
|
||||||
git push --quiet --set-upstream origin rc
|
|
||||||
|
|||||||
2
.github/workflows/workflow-linter.yml
vendored
2
.github/workflows/workflow-linter.yml
vendored
@@ -8,4 +8,4 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
call-workflow:
|
call-workflow:
|
||||||
uses: bitwarden/gh-actions/.github/workflows/workflow-linter.yml@main
|
uses: bitwarden/gh-actions/.github/workflows/workflow-linter.yml@34ecb67b2a357795dc893549df0795e7383ff50f
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
# Bitwarden Mobile Application
|
# Bitwarden Mobile Application
|
||||||
|
|
||||||
<a href="https://play.google.com/store/apps/details?id=com.x8bit.bitwarden" target="_blank"><img alt="Get it on Google Play" src="https://imgur.com/YQzmZi9.png" width="153" height="46"></a> <a href="https://mobileapp.bitwarden.com/fdroid/" target="_blank"><img alt="Get it on F-Droid" src="https://i.imgur.com/HDicnzz.png" width="154" height="46"></a> <a href="https://itunes.apple.com/us/app/bitwarden-free-password-manager/id1137397744?mt=8" target="_blank"><img src="https://imgur.com/GdGqPMY.png" width="135" height="40"></a>
|
<a href="https://play.google.com/store/apps/details?id=com.x8bit.bitwarden" target="_blank"><img alt="Get it on Google Play" src="https://imgur.com/YQzmZi9.png" width="153" height="46"></a> <a href="https://mobileapp.bitwarden.com/fdroid/" target="_blank"><img alt="Get it on Google Play" src="https://i.imgur.com/HDicnzz.png" width="154" height="46"></a> <a href="https://itunes.apple.com/us/app/bitwarden-free-password-manager/id1137397744?mt=8" target="_blank"><img src="https://imgur.com/GdGqPMY.png" width="135" height="40"></a>
|
||||||
|
|
||||||
The Bitwarden mobile application is written in C# with Xamarin Android, Xamarin iOS, and Xamarin Forms.
|
The Bitwarden mobile application is written in C# with Xamarin Android, Xamarin iOS, and Xamarin Forms.
|
||||||
|
|
||||||
|
|||||||
@@ -46,6 +46,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "iOS.ShareExtension", "src\i
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "iOS.Autofill", "src\iOS.Autofill\iOS.Autofill.csproj", "{8A3ECD75-3EC8-4CB3-B3A2-A73A724C279A}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "iOS.Autofill", "src\iOS.Autofill\iOS.Autofill.csproj", "{8A3ECD75-3EC8-4CB3-B3A2-A73A724C279A}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XamariniOS17CredentialProviderBinding", "lib\ios\iOS17CredentialProvider\XamariniOS17CredentialProvider\XamariniOS17CredentialProviderBinding\XamariniOS17CredentialProviderBinding.csproj", "{63938BA1-0F72-4BFD-B7A4-823C146E43B4}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Ad-Hoc|Any CPU = Ad-Hoc|Any CPU
|
Ad-Hoc|Any CPU = Ad-Hoc|Any CPU
|
||||||
@@ -446,6 +448,36 @@ Global
|
|||||||
{8A3ECD75-3EC8-4CB3-B3A2-A73A724C279A}.Release|iPhone.Build.0 = Release|iPhone
|
{8A3ECD75-3EC8-4CB3-B3A2-A73A724C279A}.Release|iPhone.Build.0 = Release|iPhone
|
||||||
{8A3ECD75-3EC8-4CB3-B3A2-A73A724C279A}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
|
{8A3ECD75-3EC8-4CB3-B3A2-A73A724C279A}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
|
||||||
{8A3ECD75-3EC8-4CB3-B3A2-A73A724C279A}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
|
{8A3ECD75-3EC8-4CB3-B3A2-A73A724C279A}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
|
||||||
|
{63938BA1-0F72-4BFD-B7A4-823C146E43B4}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{63938BA1-0F72-4BFD-B7A4-823C146E43B4}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{63938BA1-0F72-4BFD-B7A4-823C146E43B4}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU
|
||||||
|
{63938BA1-0F72-4BFD-B7A4-823C146E43B4}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU
|
||||||
|
{63938BA1-0F72-4BFD-B7A4-823C146E43B4}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||||
|
{63938BA1-0F72-4BFD-B7A4-823C146E43B4}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU
|
||||||
|
{63938BA1-0F72-4BFD-B7A4-823C146E43B4}.AppStore|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{63938BA1-0F72-4BFD-B7A4-823C146E43B4}.AppStore|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{63938BA1-0F72-4BFD-B7A4-823C146E43B4}.AppStore|iPhone.ActiveCfg = Release|Any CPU
|
||||||
|
{63938BA1-0F72-4BFD-B7A4-823C146E43B4}.AppStore|iPhone.Build.0 = Release|Any CPU
|
||||||
|
{63938BA1-0F72-4BFD-B7A4-823C146E43B4}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||||
|
{63938BA1-0F72-4BFD-B7A4-823C146E43B4}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU
|
||||||
|
{63938BA1-0F72-4BFD-B7A4-823C146E43B4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{63938BA1-0F72-4BFD-B7A4-823C146E43B4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{63938BA1-0F72-4BFD-B7A4-823C146E43B4}.Debug|iPhone.ActiveCfg = Debug|Any CPU
|
||||||
|
{63938BA1-0F72-4BFD-B7A4-823C146E43B4}.Debug|iPhone.Build.0 = Debug|Any CPU
|
||||||
|
{63938BA1-0F72-4BFD-B7A4-823C146E43B4}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
|
||||||
|
{63938BA1-0F72-4BFD-B7A4-823C146E43B4}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
|
||||||
|
{63938BA1-0F72-4BFD-B7A4-823C146E43B4}.FDroid|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{63938BA1-0F72-4BFD-B7A4-823C146E43B4}.FDroid|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{63938BA1-0F72-4BFD-B7A4-823C146E43B4}.FDroid|iPhone.ActiveCfg = Release|Any CPU
|
||||||
|
{63938BA1-0F72-4BFD-B7A4-823C146E43B4}.FDroid|iPhone.Build.0 = Release|Any CPU
|
||||||
|
{63938BA1-0F72-4BFD-B7A4-823C146E43B4}.FDroid|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||||
|
{63938BA1-0F72-4BFD-B7A4-823C146E43B4}.FDroid|iPhoneSimulator.Build.0 = Release|Any CPU
|
||||||
|
{63938BA1-0F72-4BFD-B7A4-823C146E43B4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{63938BA1-0F72-4BFD-B7A4-823C146E43B4}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{63938BA1-0F72-4BFD-B7A4-823C146E43B4}.Release|iPhone.ActiveCfg = Release|Any CPU
|
||||||
|
{63938BA1-0F72-4BFD-B7A4-823C146E43B4}.Release|iPhone.Build.0 = Release|Any CPU
|
||||||
|
{63938BA1-0F72-4BFD-B7A4-823C146E43B4}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
||||||
|
{63938BA1-0F72-4BFD-B7A4-823C146E43B4}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
@@ -464,6 +496,7 @@ Global
|
|||||||
{8AE548D9-A567-4E97-995E-93EC7DB0FDE0} = {8904C536-C67D-420F-9971-51B26574C3AA}
|
{8AE548D9-A567-4E97-995E-93EC7DB0FDE0} = {8904C536-C67D-420F-9971-51B26574C3AA}
|
||||||
{F8C3F648-EA5A-4719-8005-85D1690B1655} = {D10CA4A9-F866-40E1-B658-F69051236C71}
|
{F8C3F648-EA5A-4719-8005-85D1690B1655} = {D10CA4A9-F866-40E1-B658-F69051236C71}
|
||||||
{8A3ECD75-3EC8-4CB3-B3A2-A73A724C279A} = {D10CA4A9-F866-40E1-B658-F69051236C71}
|
{8A3ECD75-3EC8-4CB3-B3A2-A73A724C279A} = {D10CA4A9-F866-40E1-B658-F69051236C71}
|
||||||
|
{63938BA1-0F72-4BFD-B7A4-823C146E43B4} = {D10CA4A9-F866-40E1-B658-F69051236C71}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {7D436EA3-8B7E-45D2-8D14-0730BD2E0410}
|
SolutionGuid = {7D436EA3-8B7E-45D2-8D14-0730BD2E0410}
|
||||||
|
|||||||
12
crowdin.yml
12
crowdin.yml
@@ -38,15 +38,3 @@ files:
|
|||||||
pt-PT: pt-PT
|
pt-PT: pt-PT
|
||||||
en-GB: en-GB
|
en-GB: en-GB
|
||||||
en-IN: en-IN
|
en-IN: en-IN
|
||||||
- source: "/src/watchOS/bitwarden/bitwarden WatchKit Extension/Localization/en.lproj/Localizable.strings"
|
|
||||||
dest: "/src/watchOS/bitwarden/bitwarden WatchKit Extension/Localization/en.lproj/%original_file_name%"
|
|
||||||
translation: "/src/watchOS/bitwarden/bitwarden WatchKit Extension/Localization//%two_letters_code%.lproj/%original_file_name%"
|
|
||||||
update_option: update_as_unapproved
|
|
||||||
languages_mapping:
|
|
||||||
two_letters_code:
|
|
||||||
zh-CN: zh-Hans
|
|
||||||
zh-TW: zh-Hant
|
|
||||||
pt-BR: pt-BR
|
|
||||||
pt-PT: pt-PT
|
|
||||||
en-GB: en-GB
|
|
||||||
en-IN: en-IN
|
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"sdk": {
|
|
||||||
"version": "7.0.400",
|
|
||||||
"rollForward": "latestPatch",
|
|
||||||
"allowPrerelease": false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 16
|
||||||
|
VisualStudioVersion = 25.0.1706.0
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XamariniOS17CredentialProviderBinding", "XamariniOS17CredentialProviderBinding\XamariniOS17CredentialProviderBinding.csproj", "{63938BA1-0F72-4BFD-B7A4-823C146E43B4}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{63938BA1-0F72-4BFD-B7A4-823C146E43B4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{63938BA1-0F72-4BFD-B7A4-823C146E43B4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{63938BA1-0F72-4BFD-B7A4-823C146E43B4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{63938BA1-0F72-4BFD-B7A4-823C146E43B4}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {5EE0FEF7-C01A-4CAF-BCF0-3A1B818D056A}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
||||||
@@ -0,0 +1,141 @@
|
|||||||
|
using System;
|
||||||
|
using AuthenticationServices;
|
||||||
|
using Foundation;
|
||||||
|
using ObjCRuntime;
|
||||||
|
|
||||||
|
namespace XamariniOS17CredentialProviderBinding
|
||||||
|
{
|
||||||
|
interface IASCredentialProviderCompatDelegate { }
|
||||||
|
|
||||||
|
// @protocol ASCredentialProviderCompatDelegate
|
||||||
|
[Protocol, Model(AutoGeneratedName = true)]
|
||||||
|
interface ASCredentialProviderCompatDelegate
|
||||||
|
{
|
||||||
|
// @required -(void)prepareInterfaceToProvideCredentialCompatFor:(ASCredentialRequestCompat * _Nonnull)credentialRequest;
|
||||||
|
[iOS(17, 0)]
|
||||||
|
[Abstract]
|
||||||
|
[Export("prepareInterfaceToProvideCredentialCompatFor:")]
|
||||||
|
void PrepareInterfaceToProvideCredentialCompatFor(ASCredentialRequestCompat credentialRequest);
|
||||||
|
|
||||||
|
// @required -(void)provideCredentialWithoutUserInteractionCompatFor:(ASCredentialRequestCompat * _Nonnull)credentialRequest;
|
||||||
|
[iOS(17, 0)]
|
||||||
|
[Abstract]
|
||||||
|
[Export("provideCredentialWithoutUserInteractionCompatFor:")]
|
||||||
|
void ProvideCredentialWithoutUserInteractionCompatFor(ASCredentialRequestCompat credentialRequest);
|
||||||
|
|
||||||
|
// @required -(void)prepareInterfaceCompatForPasskeyRegistration:(ASCredentialRequestCompat * _Nonnull)registrationRequest;
|
||||||
|
[iOS(17, 0)]
|
||||||
|
[Abstract]
|
||||||
|
[Export("prepareInterfaceCompatForPasskeyRegistration:")]
|
||||||
|
void PrepareInterfaceCompatForPasskeyRegistration(ASCredentialRequestCompat registrationRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
// @interface ASCredentialRequestCompat : NSObject
|
||||||
|
[iOS(17, 0)]
|
||||||
|
[BaseType (typeof(NSObject))]
|
||||||
|
[DisableDefaultCtor]
|
||||||
|
interface ASCredentialRequestCompat
|
||||||
|
{
|
||||||
|
// @property (nonatomic) enum ASCredentialRequestCompatType type;
|
||||||
|
[Export("type", ArgumentSemantic.Assign)]
|
||||||
|
ASCredentialRequestCompatType Type { get; set; }
|
||||||
|
|
||||||
|
// @property (nonatomic, strong) id<ASCredentialIdentity> _Nonnull credentialIdentity;
|
||||||
|
//[Export("credentialIdentity", ArgumentSemantic.Strong)]
|
||||||
|
//ASCredentialIdentity CredentialIdentity { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
// @property (readonly, nonatomic, strong) ASPasswordCredentialIdentity * _Nullable passwordCredentialIdentity;
|
||||||
|
[iOS(17, 0)]
|
||||||
|
[NullAllowed, Export("passwordCredentialIdentity", ArgumentSemantic.Strong)]
|
||||||
|
ASPasswordCredentialIdentity PasswordCredentialIdentity { get; }
|
||||||
|
|
||||||
|
// @property (readonly, nonatomic, strong) ASPasskeyCredentialIdentityCompat * _Nullable passkeyCredentialIdentity;
|
||||||
|
[iOS(17, 0)]
|
||||||
|
[NullAllowed, Export("passkeyCredentialIdentity", ArgumentSemantic.Strong)]
|
||||||
|
ASPasskeyCredentialIdentityCompat PasskeyCredentialIdentity { get; }
|
||||||
|
}
|
||||||
|
|
||||||
|
// @interface ASPasskeyCredentialIdentityCompat : NSObject
|
||||||
|
[BaseType(typeof(NSObject))]
|
||||||
|
[DisableDefaultCtor]
|
||||||
|
interface ASPasskeyCredentialIdentityCompat
|
||||||
|
{
|
||||||
|
// @property (copy, nonatomic) NSString * _Nonnull relyingPartyIdentifier;
|
||||||
|
[Export("relyingPartyIdentifier")]
|
||||||
|
string RelyingPartyIdentifier { get; set; }
|
||||||
|
|
||||||
|
// @property (copy, nonatomic) NSString * _Nonnull userName;
|
||||||
|
[Export("userName")]
|
||||||
|
string UserName { get; set; }
|
||||||
|
|
||||||
|
// @property (copy, nonatomic) NSData * _Nonnull credentialID;
|
||||||
|
[Export("credentialID", ArgumentSemantic.Copy)]
|
||||||
|
NSData CredentialID { get; set; }
|
||||||
|
|
||||||
|
// @property (copy, nonatomic) NSData * _Nonnull userHandle;
|
||||||
|
[Export("userHandle", ArgumentSemantic.Copy)]
|
||||||
|
NSData UserHandle { get; set; }
|
||||||
|
|
||||||
|
// @property (copy, nonatomic) NSString * _Nullable recordIdentifier;
|
||||||
|
[NullAllowed, Export("recordIdentifier")]
|
||||||
|
string RecordIdentifier { get; set; }
|
||||||
|
|
||||||
|
// @property (nonatomic) NSInteger rank;
|
||||||
|
[Export("rank")]
|
||||||
|
nint Rank { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
// @interface BaseASCredentialProviderViewController : ASCredentialProviderViewController
|
||||||
|
[BaseType (typeof(ASCredentialProviderViewController))]
|
||||||
|
interface BaseASCredentialProviderViewController
|
||||||
|
{
|
||||||
|
// -(void)prepareInterfaceToProvideCredentialForRequest:(id<ASCredentialRequest> _Nonnull)credentialRequest;
|
||||||
|
//[Export ("prepareInterfaceToProvideCredentialForRequest:")]
|
||||||
|
//void PrepareInterfaceToProvideCredentialForRequest (ASCredentialRequest credentialRequest);
|
||||||
|
|
||||||
|
//// -(void)provideCredentialWithoutUserInteractionForRequest:(id<ASCredentialRequest> _Nonnull)credentialRequest;
|
||||||
|
//[Export ("provideCredentialWithoutUserInteractionForRequest:")]
|
||||||
|
//void ProvideCredentialWithoutUserInteractionForRequest (ASCredentialRequest credentialRequest);
|
||||||
|
|
||||||
|
//// -(void)prepareInterfaceForPasskeyRegistration:(id<ASCredentialRequest> _Nonnull)registrationRequest;
|
||||||
|
//[Export ("prepareInterfaceForPasskeyRegistration:")]
|
||||||
|
//void PrepareInterfaceForPasskeyRegistration (ASCredentialRequest registrationRequest);
|
||||||
|
|
||||||
|
// -(void)prepareInterfaceToProvideCredentialCompatFor:(ASCredentialRequestCompat * _Nonnull)credentialRequest;
|
||||||
|
//[Export ("prepareInterfaceToProvideCredentialCompatFor:")]
|
||||||
|
// [Abstract]
|
||||||
|
// void PrepareInterfaceToProvideCredentialCompatFor (ASCredentialRequestCompat credentialRequest);
|
||||||
|
|
||||||
|
//// -(void)provideCredentialWithoutUserInteractionCompatFor:(ASCredentialRequestCompat * _Nonnull)credentialRequest;
|
||||||
|
//[Export ("provideCredentialWithoutUserInteractionCompatFor:")]
|
||||||
|
// [Abstract]
|
||||||
|
// void ProvideCredentialWithoutUserInteractionCompatFor (ASCredentialRequestCompat credentialRequest);
|
||||||
|
|
||||||
|
//// -(void)prepareInterfaceCompatForPasskeyRegistration:(ASCredentialRequestCompat * _Nonnull)registrationRequest;
|
||||||
|
//[Export ("prepareInterfaceCompatForPasskeyRegistration:")]
|
||||||
|
// [Abstract]
|
||||||
|
// void PrepareInterfaceCompatForPasskeyRegistration (ASCredentialRequestCompat registrationRequest);
|
||||||
|
|
||||||
|
[iOS(17, 0)]
|
||||||
|
[Export("SetCompatDelegate:")]
|
||||||
|
void SetCompatDelegate(IASCredentialProviderCompatDelegate @delegate);
|
||||||
|
|
||||||
|
// -(instancetype _Nonnull)initWithNibName:(NSString * _Nullable)nibNameOrNil bundle:(NSBundle * _Nullable)nibBundleOrNil __attribute__((objc_designated_initializer));
|
||||||
|
[Export ("initWithNibName:bundle:")]
|
||||||
|
[DesignatedInitializer]
|
||||||
|
IntPtr Constructor ([NullAllowed] string nibNameOrNil, [NullAllowed] NSBundle nibBundleOrNil);
|
||||||
|
|
||||||
|
//// -(instancetype _Nullable)initWithCoder:(NSCoder * _Nonnull)coder __attribute__((objc_designated_initializer));
|
||||||
|
//[Export ("initWithCoder:")]
|
||||||
|
//[DesignatedInitializer]
|
||||||
|
// IntPtr Constructor (NSCoder coder);
|
||||||
|
}
|
||||||
|
|
||||||
|
// @interface MyTest : NSObject
|
||||||
|
[BaseType(typeof(NSObject))]
|
||||||
|
//[DisableDefaultCtor]
|
||||||
|
interface MyTest
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
|
using Foundation;
|
||||||
|
|
||||||
|
// This attribute allows you to mark your assemblies as “safe to link”.
|
||||||
|
// When the attribute is present, the linker—if enabled—will process the assembly
|
||||||
|
// even if you’re using the “Link SDK assemblies only” option, which is the default for device builds.
|
||||||
|
|
||||||
|
[assembly: LinkerSafe]
|
||||||
|
|
||||||
|
// Information about this assembly is defined by the following attributes.
|
||||||
|
// Change them to the values specific to your project.
|
||||||
|
|
||||||
|
[assembly: AssemblyTitle("NativeLibrary")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("NativeLibrary")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2017")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
|
||||||
|
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
|
||||||
|
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
|
||||||
|
|
||||||
|
[assembly: AssemblyVersion("1.0.*")]
|
||||||
|
|
||||||
|
// The following attributes are used to specify the signing key for the assembly,
|
||||||
|
// if desired. See the Mono documentation for more information about signing.
|
||||||
|
|
||||||
|
//[assembly: AssemblyDelaySign(false)]
|
||||||
|
//[assembly: AssemblyKeyFile("")]
|
||||||
|
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
using ObjCRuntime;
|
||||||
|
|
||||||
|
namespace XamariniOS17CredentialProviderBinding
|
||||||
|
{
|
||||||
|
[Native]
|
||||||
|
public enum ASCredentialRequestCompatType : long
|
||||||
|
{
|
||||||
|
word = 0,
|
||||||
|
keyAssertion = 1
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectTypeGuids>{8FFB629D-F513-41CE-95D2-7ECE97B6EEEC};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||||
|
<ProjectGuid>{63938BA1-0F72-4BFD-B7A4-823C146E43B4}</ProjectGuid>
|
||||||
|
<TemplateGuid>{b6f3ff35-79b2-4f25-a2fc-60a7cf61013b}</TemplateGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<RootNamespace>NativeLibrary</RootNamespace>
|
||||||
|
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
|
||||||
|
<AssemblyName>NativeLibrary</AssemblyName>
|
||||||
|
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>portable</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
|
<DebugType>portable</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release</OutputPath>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="Xamarin.iOS" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="Resources\" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ObjcBindingApiDefinition Include="ApiDefinitions.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ObjcBindingCoreSource Include="StructsAndEnums.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<NativeReference Include="..\..\iOS17CredentialProvider\build\Release-fat\iOS17CredentialProvider.framework">
|
||||||
|
<Kind>Framework</Kind>
|
||||||
|
<SmartLink>True</SmartLink>
|
||||||
|
<ForceLoad>False</ForceLoad>
|
||||||
|
<WeakFrameworks>Foundation AuthenticationServices</WeakFrameworks>
|
||||||
|
</NativeReference>
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.ObjCBinding.CSharp.targets" />
|
||||||
|
</Project>
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
echo "Building framework"
|
||||||
|
|
||||||
|
xcodebuild -sdk iphonesimulator17.0 -project "iOS17CredentialProvider.xcodeproj" -configuration Release -arch x86_64
|
||||||
|
xcodebuild -sdk iphoneos17.0 -project "iOS17CredentialProvider.xcodeproj" -configuration Release
|
||||||
|
cd build
|
||||||
|
cp -R "Release-iphoneos" "Release-fat"
|
||||||
|
cp -R "Release-iphonesimulator/iOS17CredentialProvider.framework/Modules/iOS17CredentialProvider.swiftmodule/" "Release-fat/iOS17CredentialProvider.framework/Modules/iOS17CredentialProvider.swiftmodule/"
|
||||||
|
lipo -create -output "Release-fat/iOS17CredentialProvider.framework/iOS17CredentialProvider" "Release-iphoneos/iOS17CredentialProvider.framework/iOS17CredentialProvider" "Release-iphonesimulator/iOS17CredentialProvider.framework/iOS17CredentialProvider"
|
||||||
|
|
||||||
|
echo "Sharpie creating binding definitions"
|
||||||
|
|
||||||
|
sharpie bind --sdk=iphoneos17.0 --output="XamarinApiDef" --namespace="Binding" --scope="Release-iphoneos/iOS17CredentialProvider.framework/Headers/" "Release-iphoneos/iOS17CredentialProvider.framework/Headers/iOS17CredentialProvider-Swift.h"
|
||||||
|
|
||||||
|
echo "Done!"
|
||||||
@@ -0,0 +1,357 @@
|
|||||||
|
// !$*UTF8*$!
|
||||||
|
{
|
||||||
|
archiveVersion = 1;
|
||||||
|
classes = {
|
||||||
|
};
|
||||||
|
objectVersion = 56;
|
||||||
|
objects = {
|
||||||
|
|
||||||
|
/* Begin PBXBuildFile section */
|
||||||
|
B72040A62A4E421C00E62648 /* iOS17CredentialProvider.docc in Sources */ = {isa = PBXBuildFile; fileRef = B72040A52A4E421C00E62648 /* iOS17CredentialProvider.docc */; };
|
||||||
|
B72040A72A4E421C00E62648 /* iOS17CredentialProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = B72040A42A4E421C00E62648 /* iOS17CredentialProvider.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
|
B72040AE2A535D6500E62648 /* BaseASCredentialProviderViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B72040AD2A535D6500E62648 /* BaseASCredentialProviderViewController.swift */; };
|
||||||
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
|
/* Begin PBXFileReference section */
|
||||||
|
B72040A12A4E421C00E62648 /* iOS17CredentialProvider.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = iOS17CredentialProvider.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
|
B72040A42A4E421C00E62648 /* iOS17CredentialProvider.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = iOS17CredentialProvider.h; sourceTree = "<group>"; };
|
||||||
|
B72040A52A4E421C00E62648 /* iOS17CredentialProvider.docc */ = {isa = PBXFileReference; lastKnownFileType = folder.documentationcatalog; path = iOS17CredentialProvider.docc; sourceTree = "<group>"; };
|
||||||
|
B72040AD2A535D6500E62648 /* BaseASCredentialProviderViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseASCredentialProviderViewController.swift; sourceTree = "<group>"; };
|
||||||
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
|
B720409E2A4E421C00E62648 /* Frameworks */ = {
|
||||||
|
isa = PBXFrameworksBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
|
/* End PBXFrameworksBuildPhase section */
|
||||||
|
|
||||||
|
/* Begin PBXGroup section */
|
||||||
|
B72040972A4E421C00E62648 = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
B72040A32A4E421C00E62648 /* iOS17CredentialProvider */,
|
||||||
|
B72040A22A4E421C00E62648 /* Products */,
|
||||||
|
);
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
B72040A22A4E421C00E62648 /* Products */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
B72040A12A4E421C00E62648 /* iOS17CredentialProvider.framework */,
|
||||||
|
);
|
||||||
|
name = Products;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
B72040A32A4E421C00E62648 /* iOS17CredentialProvider */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
B72040A42A4E421C00E62648 /* iOS17CredentialProvider.h */,
|
||||||
|
B72040A52A4E421C00E62648 /* iOS17CredentialProvider.docc */,
|
||||||
|
B72040AD2A535D6500E62648 /* BaseASCredentialProviderViewController.swift */,
|
||||||
|
);
|
||||||
|
path = "iOS17CredentialProvider";
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
/* End PBXGroup section */
|
||||||
|
|
||||||
|
/* Begin PBXHeadersBuildPhase section */
|
||||||
|
B720409C2A4E421C00E62648 /* Headers */ = {
|
||||||
|
isa = PBXHeadersBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
B72040A72A4E421C00E62648 /* iOS17CredentialProvider.h in Headers */,
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
|
/* End PBXHeadersBuildPhase section */
|
||||||
|
|
||||||
|
/* Begin PBXNativeTarget section */
|
||||||
|
B72040A02A4E421C00E62648 /* iOS17CredentialProvider */ = {
|
||||||
|
isa = PBXNativeTarget;
|
||||||
|
buildConfigurationList = B72040AA2A4E421C00E62648 /* Build configuration list for PBXNativeTarget "iOS17CredentialProvider" */;
|
||||||
|
buildPhases = (
|
||||||
|
B720409C2A4E421C00E62648 /* Headers */,
|
||||||
|
B720409D2A4E421C00E62648 /* Sources */,
|
||||||
|
B720409E2A4E421C00E62648 /* Frameworks */,
|
||||||
|
B720409F2A4E421C00E62648 /* Resources */,
|
||||||
|
);
|
||||||
|
buildRules = (
|
||||||
|
);
|
||||||
|
dependencies = (
|
||||||
|
);
|
||||||
|
name = "iOS17CredentialProvider";
|
||||||
|
productName = "iOS17CredentialProvider";
|
||||||
|
productReference = B72040A12A4E421C00E62648 /* iOS17CredentialProvider.framework */;
|
||||||
|
productType = "com.apple.product-type.framework";
|
||||||
|
};
|
||||||
|
/* End PBXNativeTarget section */
|
||||||
|
|
||||||
|
/* Begin PBXProject section */
|
||||||
|
B72040982A4E421C00E62648 /* Project object */ = {
|
||||||
|
isa = PBXProject;
|
||||||
|
attributes = {
|
||||||
|
BuildIndependentTargetsInParallel = 1;
|
||||||
|
LastUpgradeCheck = 1500;
|
||||||
|
TargetAttributes = {
|
||||||
|
B72040A02A4E421C00E62648 = {
|
||||||
|
CreatedOnToolsVersion = 15.0;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
buildConfigurationList = B720409B2A4E421C00E62648 /* Build configuration list for PBXProject "iOS17CredentialProvider" */;
|
||||||
|
compatibilityVersion = "Xcode 14.0";
|
||||||
|
developmentRegion = en;
|
||||||
|
hasScannedForEncodings = 0;
|
||||||
|
knownRegions = (
|
||||||
|
en,
|
||||||
|
Base,
|
||||||
|
);
|
||||||
|
mainGroup = B72040972A4E421C00E62648;
|
||||||
|
productRefGroup = B72040A22A4E421C00E62648 /* Products */;
|
||||||
|
projectDirPath = "";
|
||||||
|
projectRoot = "";
|
||||||
|
targets = (
|
||||||
|
B72040A02A4E421C00E62648 /* iOS17CredentialProvider */,
|
||||||
|
);
|
||||||
|
};
|
||||||
|
/* End PBXProject section */
|
||||||
|
|
||||||
|
/* Begin PBXResourcesBuildPhase section */
|
||||||
|
B720409F2A4E421C00E62648 /* Resources */ = {
|
||||||
|
isa = PBXResourcesBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
|
/* End PBXResourcesBuildPhase section */
|
||||||
|
|
||||||
|
/* Begin PBXSourcesBuildPhase section */
|
||||||
|
B720409D2A4E421C00E62648 /* Sources */ = {
|
||||||
|
isa = PBXSourcesBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
B72040A62A4E421C00E62648 /* iOS17CredentialProvider.docc in Sources */,
|
||||||
|
B72040AE2A535D6500E62648 /* BaseASCredentialProviderViewController.swift in Sources */,
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
|
/* End PBXSourcesBuildPhase section */
|
||||||
|
|
||||||
|
/* Begin XCBuildConfiguration section */
|
||||||
|
B72040A82A4E421C00E62648 /* Debug */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||||
|
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
|
||||||
|
CLANG_ANALYZER_NONNULL = YES;
|
||||||
|
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||||
|
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
|
||||||
|
CLANG_ENABLE_MODULES = YES;
|
||||||
|
CLANG_ENABLE_OBJC_ARC = YES;
|
||||||
|
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||||
|
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||||
|
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||||
|
CLANG_WARN_COMMA = YES;
|
||||||
|
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||||
|
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||||
|
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||||
|
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||||
|
CLANG_WARN_EMPTY_BODY = YES;
|
||||||
|
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||||
|
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||||
|
CLANG_WARN_INT_CONVERSION = YES;
|
||||||
|
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||||
|
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||||
|
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||||
|
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||||
|
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||||
|
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||||
|
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||||
|
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||||
|
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||||
|
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||||
|
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||||
|
COPY_PHASE_STRIP = NO;
|
||||||
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
|
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||||
|
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||||
|
ENABLE_TESTABILITY = YES;
|
||||||
|
ENABLE_USER_SCRIPT_SANDBOXING = YES;
|
||||||
|
GCC_C_LANGUAGE_STANDARD = gnu17;
|
||||||
|
GCC_DYNAMIC_NO_PIC = NO;
|
||||||
|
GCC_NO_COMMON_BLOCKS = YES;
|
||||||
|
GCC_OPTIMIZATION_LEVEL = 0;
|
||||||
|
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||||
|
"DEBUG=1",
|
||||||
|
"$(inherited)",
|
||||||
|
);
|
||||||
|
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||||
|
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||||
|
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||||
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||||
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
|
IPHONEOS_DEPLOYMENT_TARGET = 17.0;
|
||||||
|
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
|
||||||
|
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||||
|
MTL_FAST_MATH = YES;
|
||||||
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
|
SDKROOT = iphoneos;
|
||||||
|
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)";
|
||||||
|
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||||
|
VERSIONING_SYSTEM = "apple-generic";
|
||||||
|
VERSION_INFO_PREFIX = "";
|
||||||
|
};
|
||||||
|
name = Debug;
|
||||||
|
};
|
||||||
|
B72040A92A4E421C00E62648 /* Release */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||||
|
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
|
||||||
|
CLANG_ANALYZER_NONNULL = YES;
|
||||||
|
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||||
|
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
|
||||||
|
CLANG_ENABLE_MODULES = YES;
|
||||||
|
CLANG_ENABLE_OBJC_ARC = YES;
|
||||||
|
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||||
|
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||||
|
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||||
|
CLANG_WARN_COMMA = YES;
|
||||||
|
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||||
|
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||||
|
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||||
|
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||||
|
CLANG_WARN_EMPTY_BODY = YES;
|
||||||
|
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||||
|
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||||
|
CLANG_WARN_INT_CONVERSION = YES;
|
||||||
|
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||||
|
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||||
|
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||||
|
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||||
|
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||||
|
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||||
|
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||||
|
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||||
|
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||||
|
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||||
|
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||||
|
COPY_PHASE_STRIP = NO;
|
||||||
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
|
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||||
|
ENABLE_NS_ASSERTIONS = NO;
|
||||||
|
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||||
|
ENABLE_USER_SCRIPT_SANDBOXING = YES;
|
||||||
|
GCC_C_LANGUAGE_STANDARD = gnu17;
|
||||||
|
GCC_NO_COMMON_BLOCKS = YES;
|
||||||
|
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||||
|
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||||
|
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||||
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||||
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
|
IPHONEOS_DEPLOYMENT_TARGET = 17.0;
|
||||||
|
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
|
||||||
|
MTL_ENABLE_DEBUG_INFO = NO;
|
||||||
|
MTL_FAST_MATH = YES;
|
||||||
|
SDKROOT = iphoneos;
|
||||||
|
SWIFT_COMPILATION_MODE = wholemodule;
|
||||||
|
VALIDATE_PRODUCT = YES;
|
||||||
|
VERSIONING_SYSTEM = "apple-generic";
|
||||||
|
VERSION_INFO_PREFIX = "";
|
||||||
|
};
|
||||||
|
name = Release;
|
||||||
|
};
|
||||||
|
B72040AB2A4E421C00E62648 /* Debug */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
CODE_SIGN_STYLE = Automatic;
|
||||||
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
|
DEFINES_MODULE = YES;
|
||||||
|
DEVELOPMENT_TEAM = LTZ2PFU5D6;
|
||||||
|
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||||
|
DYLIB_CURRENT_VERSION = 1;
|
||||||
|
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||||
|
ENABLE_MODULE_VERIFIER = YES;
|
||||||
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
|
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||||
|
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||||
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
|
"$(inherited)",
|
||||||
|
"@executable_path/Frameworks",
|
||||||
|
"@loader_path/Frameworks",
|
||||||
|
);
|
||||||
|
MARKETING_VERSION = 1.0;
|
||||||
|
MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
|
||||||
|
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20";
|
||||||
|
PRODUCT_BUNDLE_IDENTIFIER = "com.8bit.bitwarden.iOS17CredentialProvider";
|
||||||
|
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
|
||||||
|
SKIP_INSTALL = YES;
|
||||||
|
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||||
|
SWIFT_VERSION = 5.0;
|
||||||
|
TARGETED_DEVICE_FAMILY = "1,2";
|
||||||
|
};
|
||||||
|
name = Debug;
|
||||||
|
};
|
||||||
|
B72040AC2A4E421C00E62648 /* Release */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
CODE_SIGN_STYLE = Automatic;
|
||||||
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
|
DEFINES_MODULE = YES;
|
||||||
|
DEVELOPMENT_TEAM = LTZ2PFU5D6;
|
||||||
|
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||||
|
DYLIB_CURRENT_VERSION = 1;
|
||||||
|
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||||
|
ENABLE_MODULE_VERIFIER = YES;
|
||||||
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
|
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||||
|
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||||
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
|
"$(inherited)",
|
||||||
|
"@executable_path/Frameworks",
|
||||||
|
"@loader_path/Frameworks",
|
||||||
|
);
|
||||||
|
MARKETING_VERSION = 1.0;
|
||||||
|
MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
|
||||||
|
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20";
|
||||||
|
PRODUCT_BUNDLE_IDENTIFIER = "com.8bit.bitwarden.iOS17CredentialProvider";
|
||||||
|
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
|
||||||
|
SKIP_INSTALL = YES;
|
||||||
|
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||||
|
SWIFT_VERSION = 5.0;
|
||||||
|
TARGETED_DEVICE_FAMILY = "1,2";
|
||||||
|
};
|
||||||
|
name = Release;
|
||||||
|
};
|
||||||
|
/* End XCBuildConfiguration section */
|
||||||
|
|
||||||
|
/* Begin XCConfigurationList section */
|
||||||
|
B720409B2A4E421C00E62648 /* Build configuration list for PBXProject "iOS17CredentialProvider" */ = {
|
||||||
|
isa = XCConfigurationList;
|
||||||
|
buildConfigurations = (
|
||||||
|
B72040A82A4E421C00E62648 /* Debug */,
|
||||||
|
B72040A92A4E421C00E62648 /* Release */,
|
||||||
|
);
|
||||||
|
defaultConfigurationIsVisible = 0;
|
||||||
|
defaultConfigurationName = Release;
|
||||||
|
};
|
||||||
|
B72040AA2A4E421C00E62648 /* Build configuration list for PBXNativeTarget "iOS17CredentialProvider" */ = {
|
||||||
|
isa = XCConfigurationList;
|
||||||
|
buildConfigurations = (
|
||||||
|
B72040AB2A4E421C00E62648 /* Debug */,
|
||||||
|
B72040AC2A4E421C00E62648 /* Release */,
|
||||||
|
);
|
||||||
|
defaultConfigurationIsVisible = 0;
|
||||||
|
defaultConfigurationName = Release;
|
||||||
|
};
|
||||||
|
/* End XCConfigurationList section */
|
||||||
|
};
|
||||||
|
rootObject = B72040982A4E421C00E62648 /* Project object */;
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Workspace
|
||||||
|
version = "1.0">
|
||||||
|
<FileRef
|
||||||
|
location = "self:">
|
||||||
|
</FileRef>
|
||||||
|
</Workspace>
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>IDEDidComputeMac32BitWarning</key>
|
||||||
|
<true/>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Scheme
|
||||||
|
LastUpgradeVersion = "1500"
|
||||||
|
version = "1.7">
|
||||||
|
<BuildAction
|
||||||
|
parallelizeBuildables = "YES"
|
||||||
|
buildImplicitDependencies = "YES">
|
||||||
|
<BuildActionEntries>
|
||||||
|
<BuildActionEntry
|
||||||
|
buildForTesting = "YES"
|
||||||
|
buildForRunning = "YES"
|
||||||
|
buildForProfiling = "YES"
|
||||||
|
buildForArchiving = "YES"
|
||||||
|
buildForAnalyzing = "YES">
|
||||||
|
<BuildableReference
|
||||||
|
BuildableIdentifier = "primary"
|
||||||
|
BlueprintIdentifier = "B72040A02A4E421C00E62648"
|
||||||
|
BuildableName = "iOS17CredentialProvider.framework"
|
||||||
|
BlueprintName = "iOS17CredentialProvider"
|
||||||
|
ReferencedContainer = "container:iOS17CredentialProvider.xcodeproj">
|
||||||
|
</BuildableReference>
|
||||||
|
</BuildActionEntry>
|
||||||
|
</BuildActionEntries>
|
||||||
|
</BuildAction>
|
||||||
|
<TestAction
|
||||||
|
buildConfiguration = "Debug"
|
||||||
|
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||||
|
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||||
|
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||||
|
shouldAutocreateTestPlan = "YES">
|
||||||
|
</TestAction>
|
||||||
|
<LaunchAction
|
||||||
|
buildConfiguration = "Release"
|
||||||
|
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||||
|
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||||
|
launchStyle = "0"
|
||||||
|
useCustomWorkingDirectory = "NO"
|
||||||
|
ignoresPersistentStateOnLaunch = "NO"
|
||||||
|
debugDocumentVersioning = "YES"
|
||||||
|
debugServiceExtension = "internal"
|
||||||
|
allowLocationSimulation = "YES">
|
||||||
|
</LaunchAction>
|
||||||
|
<ProfileAction
|
||||||
|
buildConfiguration = "Release"
|
||||||
|
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||||
|
savedToolIdentifier = ""
|
||||||
|
useCustomWorkingDirectory = "NO"
|
||||||
|
debugDocumentVersioning = "YES">
|
||||||
|
<MacroExpansion>
|
||||||
|
<BuildableReference
|
||||||
|
BuildableIdentifier = "primary"
|
||||||
|
BlueprintIdentifier = "B72040A02A4E421C00E62648"
|
||||||
|
BuildableName = "iOS17CredentialProvider.framework"
|
||||||
|
BlueprintName = "iOS17CredentialProvider"
|
||||||
|
ReferencedContainer = "container:iOS17CredentialProvider.xcodeproj">
|
||||||
|
</BuildableReference>
|
||||||
|
</MacroExpansion>
|
||||||
|
</ProfileAction>
|
||||||
|
<AnalyzeAction
|
||||||
|
buildConfiguration = "Debug">
|
||||||
|
</AnalyzeAction>
|
||||||
|
<ArchiveAction
|
||||||
|
buildConfiguration = "Release"
|
||||||
|
revealArchiveInOrganizer = "YES">
|
||||||
|
</ArchiveAction>
|
||||||
|
</Scheme>
|
||||||
@@ -0,0 +1,188 @@
|
|||||||
|
//
|
||||||
|
// BaseASCredentialProviderViewController.swift
|
||||||
|
// iOS17CredentialProvider
|
||||||
|
//
|
||||||
|
// Created by Federico Maccaroni on 03/07/2023.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import AuthenticationServices
|
||||||
|
|
||||||
|
@objc(ASCredentialRequestCompatType)
|
||||||
|
public enum ASCredentialRequestCompatType : Int, @unchecked Sendable {
|
||||||
|
case password = 0
|
||||||
|
|
||||||
|
case passkeyAssertion = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
@objc(ASPasskeyCredentialIdentityCompat)
|
||||||
|
public class ASPasskeyCredentialIdentityCompat : NSObject {
|
||||||
|
|
||||||
|
init(relyingPartyIdentifier: String, userName: String, credentialID: Data, userHandle: Data, recordIdentifier: String? = nil, rank: Int) {
|
||||||
|
self.relyingPartyIdentifier = relyingPartyIdentifier
|
||||||
|
self.userName = userName
|
||||||
|
self.credentialID = credentialID
|
||||||
|
self.userHandle = userHandle
|
||||||
|
self.recordIdentifier = recordIdentifier
|
||||||
|
self.rank = rank
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The relying party identifier of this passkey credential.
|
||||||
|
@discussion This field is reported as the serviceIdentifier property of ASCredentialIdentity.
|
||||||
|
*/
|
||||||
|
@objc
|
||||||
|
public var relyingPartyIdentifier: String
|
||||||
|
|
||||||
|
|
||||||
|
/** The user name of this passkey credential.
|
||||||
|
@discussion This field is reported as the user property of ASCredentialIdentity.
|
||||||
|
*/
|
||||||
|
@objc
|
||||||
|
public var userName: String
|
||||||
|
|
||||||
|
|
||||||
|
/** The credential ID of this passkey credential.
|
||||||
|
@discussion This field is used to identify the correct credential to use based on relying party request parameters.
|
||||||
|
*/
|
||||||
|
@objc
|
||||||
|
public var credentialID: Data
|
||||||
|
|
||||||
|
|
||||||
|
/** The user handle of this passkey credential.
|
||||||
|
@discussion This field is used to identify the correct credential to use based on relying party request parameters.
|
||||||
|
*/
|
||||||
|
@objc
|
||||||
|
public var userHandle: Data
|
||||||
|
|
||||||
|
|
||||||
|
/** Get the record identifier.
|
||||||
|
@result The record identifier.
|
||||||
|
@discussion You can utilize the record identifier to uniquely identify the credential identity in your local database.
|
||||||
|
*/
|
||||||
|
@objc
|
||||||
|
public var recordIdentifier: String?
|
||||||
|
|
||||||
|
|
||||||
|
/** Get or set the rank of the credential identity object.
|
||||||
|
@discussion The system may utilize the rank to decide which credential identity precedes the other
|
||||||
|
if two identities have the same service identifier. A credential identity with a larger rank value
|
||||||
|
precedes one with a smaller value if both credential identities have the same service identifier.
|
||||||
|
The default value of this property is 0.
|
||||||
|
*/
|
||||||
|
@objc
|
||||||
|
public var rank: Int
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 17.0, *)
|
||||||
|
@objc(ASCredentialRequestCompat)
|
||||||
|
public class ASCredentialRequestCompat : NSObject {
|
||||||
|
|
||||||
|
/** The type of credential used for this request.
|
||||||
|
*/
|
||||||
|
@objc
|
||||||
|
public var type: ASCredentialRequestCompatType
|
||||||
|
|
||||||
|
|
||||||
|
/** The credential identity selected by the user to authenticate.
|
||||||
|
*/
|
||||||
|
@available(iOS 17.0, *)
|
||||||
|
var credentialIdentity: ASCredentialIdentity
|
||||||
|
|
||||||
|
@available(iOS 17.0, *)
|
||||||
|
@objc
|
||||||
|
public var passwordCredentialIdentity: ASPasswordCredentialIdentity? {
|
||||||
|
guard type == .password, let password = credentialIdentity as? ASPasswordCredentialIdentity else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return password
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 17.0, *)
|
||||||
|
@objc
|
||||||
|
public var passkeyCredentialIdentity: ASPasskeyCredentialIdentityCompat? {
|
||||||
|
guard type == .passkeyAssertion, let passkey = credentialIdentity as? ASPasskeyCredentialIdentity else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return ASPasskeyCredentialIdentityCompat(relyingPartyIdentifier: passkey.relyingPartyIdentifier, userName: passkey.userName, credentialID: passkey.credentialID, userHandle: passkey.userHandle, recordIdentifier: passkey.recordIdentifier, rank: passkey.rank)
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 17.0, *)
|
||||||
|
init(type: ASCredentialRequestCompatType, credentialIdentity: ASCredentialIdentity) {
|
||||||
|
self.type = type
|
||||||
|
self.credentialIdentity = credentialIdentity
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@objc(BaseASCredentialProviderViewController)
|
||||||
|
open class BaseASCredentialProviderViewController : ASCredentialProviderViewController
|
||||||
|
{
|
||||||
|
// MARK: iOS 17 new methods
|
||||||
|
|
||||||
|
@available(iOS 17.0, *)
|
||||||
|
override final public func prepareInterfaceToProvideCredential(for credentialRequest: ASCredentialRequest) {
|
||||||
|
guard let compatDelegate = compatDelegate else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
compatDelegate.prepareInterfaceToProvideCredentialCompat(for: convertRequestToCompat(from: credentialRequest))
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 17.0, *)
|
||||||
|
override final public func provideCredentialWithoutUserInteraction(for credentialRequest: ASCredentialRequest) {
|
||||||
|
guard let compatDelegate = compatDelegate else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
compatDelegate.provideCredentialWithoutUserInteractionCompat(for: convertRequestToCompat(from: credentialRequest))
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 17.0, *)
|
||||||
|
override final public func prepareInterface(forPasskeyRegistration registrationRequest: ASCredentialRequest) {
|
||||||
|
guard let compatDelegate = compatDelegate else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
compatDelegate.prepareInterfaceCompat(forPasskeyRegistration: convertRequestToCompat(from: registrationRequest))
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: Compat
|
||||||
|
|
||||||
|
var compatDelegate: ASCredentialProviderCompatDelegate? = nil;
|
||||||
|
|
||||||
|
@objc
|
||||||
|
@available(iOS 17.0, *)
|
||||||
|
public func SetCompatDelegate(_ delegate: ASCredentialProviderCompatDelegate)
|
||||||
|
{
|
||||||
|
compatDelegate = delegate
|
||||||
|
}
|
||||||
|
|
||||||
|
@available(iOS 17.0, *)
|
||||||
|
func convertRequestToCompat(from credentialRequest: ASCredentialRequest) -> ASCredentialRequestCompat {
|
||||||
|
return ASCredentialRequestCompat(
|
||||||
|
type: credentialRequest.type == .password ? .password : .passkeyAssertion,
|
||||||
|
credentialIdentity: credentialRequest.credentialIdentity)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@objc(ASCredentialProviderCompatDelegate)
|
||||||
|
public protocol ASCredentialProviderCompatDelegate
|
||||||
|
{
|
||||||
|
@available(iOS 17.0, *)
|
||||||
|
@objc
|
||||||
|
func prepareInterfaceToProvideCredentialCompat(for credentialRequest: ASCredentialRequestCompat)
|
||||||
|
|
||||||
|
@available(iOS 17.0, *)
|
||||||
|
@objc
|
||||||
|
func provideCredentialWithoutUserInteractionCompat(for credentialRequest: ASCredentialRequestCompat)
|
||||||
|
|
||||||
|
@available(iOS 17.0, *)
|
||||||
|
@objc
|
||||||
|
func prepareInterfaceCompat(forPasskeyRegistration registrationRequest: ASCredentialRequestCompat)
|
||||||
|
}
|
||||||
|
|
||||||
|
@objc(MyTest)
|
||||||
|
public class MyTest : NSObject
|
||||||
|
{
|
||||||
|
var a: String
|
||||||
|
|
||||||
|
init(a: String) {
|
||||||
|
self.a = a
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
# ``iOS17CredentialProvider``
|
||||||
|
|
||||||
|
<!--@START_MENU_TOKEN@-->Summary<!--@END_MENU_TOKEN@-->
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
<!--@START_MENU_TOKEN@-->Text<!--@END_MENU_TOKEN@-->
|
||||||
|
|
||||||
|
## Topics
|
||||||
|
|
||||||
|
### <!--@START_MENU_TOKEN@-->Group<!--@END_MENU_TOKEN@-->
|
||||||
|
|
||||||
|
- <!--@START_MENU_TOKEN@-->``Symbol``<!--@END_MENU_TOKEN@-->
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
//
|
||||||
|
// iOS17CredentialProvider.h
|
||||||
|
// iOS17CredentialProvider
|
||||||
|
//
|
||||||
|
// Created by Federico Maccaroni on 29/06/2023.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
//! Project version number for iOS17CredentialProvider.
|
||||||
|
FOUNDATION_EXPORT double iOS17CredentialProviderVersionNumber;
|
||||||
|
|
||||||
|
//! Project version string for iOS17CredentialProvider.
|
||||||
|
FOUNDATION_EXPORT const unsigned char iOS17CredentialProviderVersionString[];
|
||||||
|
|
||||||
|
// In this header, you should import all the public headers of your framework using statements like #import <iOS17CredentialProvider/PublicHeader.h>
|
||||||
|
|
||||||
|
|
||||||
2
package-lock.json
generated
2
package-lock.json
generated
@@ -8,7 +8,7 @@
|
|||||||
"name": "bitwarden-mobile",
|
"name": "bitwarden-mobile",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"gh-pages": "3.2.3"
|
"gh-pages": "^3.2.3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/array-union": {
|
"node_modules/array-union": {
|
||||||
|
|||||||
@@ -6,6 +6,6 @@
|
|||||||
"clean:l10n": "git push origin --delete l10n_master"
|
"clean:l10n": "git push origin --delete l10n_master"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"gh-pages": "3.2.3"
|
"gh-pages": "^3.2.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,7 +107,6 @@ namespace Bit.Droid.Accessibility
|
|||||||
new Browser("org.bromite.chromium", "url_bar"),
|
new Browser("org.bromite.chromium", "url_bar"),
|
||||||
new Browser("org.chromium.chrome", "url_bar"),
|
new Browser("org.chromium.chrome", "url_bar"),
|
||||||
new Browser("org.codeaurora.swe.browser", "url_bar"),
|
new Browser("org.codeaurora.swe.browser", "url_bar"),
|
||||||
new Browser("org.cromite.cromite", "url_bar"),
|
|
||||||
new Browser("org.gnu.icecat", "url_bar_title,mozac_browser_toolbar_url_view"), // 2nd = Anticipation
|
new Browser("org.gnu.icecat", "url_bar_title,mozac_browser_toolbar_url_view"), // 2nd = Anticipation
|
||||||
new Browser("org.mozilla.fenix", "mozac_browser_toolbar_url_view"),
|
new Browser("org.mozilla.fenix", "mozac_browser_toolbar_url_view"),
|
||||||
new Browser("org.mozilla.fenix.nightly", "mozac_browser_toolbar_url_view"), // [DEPRECATED ENTRY]
|
new Browser("org.mozilla.fenix.nightly", "mozac_browser_toolbar_url_view"), // [DEPRECATED ENTRY]
|
||||||
|
|||||||
@@ -77,21 +77,21 @@
|
|||||||
<PackageReference Include="Portable.BouncyCastle">
|
<PackageReference Include="Portable.BouncyCastle">
|
||||||
<Version>1.9.0</Version>
|
<Version>1.9.0</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Xamarin.AndroidX.AppCompat" Version="1.6.1.3" />
|
<PackageReference Include="Xamarin.AndroidX.AppCompat" Version="1.5.1.1" />
|
||||||
<PackageReference Include="Xamarin.AndroidX.AutoFill" Version="1.1.0.18" />
|
<PackageReference Include="Xamarin.AndroidX.AutoFill" Version="1.1.0.16" />
|
||||||
<PackageReference Include="Xamarin.AndroidX.CardView" Version="1.0.0.21" />
|
<PackageReference Include="Xamarin.AndroidX.CardView" Version="1.0.0.19" />
|
||||||
<PackageReference Include="Xamarin.AndroidX.Core" Version="1.10.1.2" />
|
<PackageReference Include="Xamarin.AndroidX.Core" Version="1.10.0" />
|
||||||
<PackageReference Include="Xamarin.AndroidX.MediaRouter" Version="1.4.0.2" />
|
<PackageReference Include="Xamarin.AndroidX.MediaRouter" Version="1.3.1.1" />
|
||||||
<PackageReference Include="Xamarin.Essentials">
|
<PackageReference Include="Xamarin.Essentials">
|
||||||
<Version>1.8.0</Version>
|
<Version>1.7.5</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Xamarin.Firebase.Messaging">
|
<PackageReference Include="Xamarin.Firebase.Messaging">
|
||||||
<Version>123.1.2.2</Version>
|
<Version>123.1.1.1</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Xamarin.Google.Android.Material" Version="1.9.0.2" />
|
<PackageReference Include="Xamarin.Google.Android.Material" Version="1.8.0" />
|
||||||
<PackageReference Include="Xamarin.Google.Dagger" Version="2.46.1.2" />
|
<PackageReference Include="Xamarin.Google.Dagger" Version="2.44.2.1" />
|
||||||
<PackageReference Include="Xamarin.GooglePlayServices.SafetyNet">
|
<PackageReference Include="Xamarin.GooglePlayServices.SafetyNet">
|
||||||
<Version>118.0.1.5</Version>
|
<Version>118.0.1.3</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -233,26 +233,6 @@
|
|||||||
<SubType></SubType>
|
<SubType></SubType>
|
||||||
<Generator></Generator>
|
<Generator></Generator>
|
||||||
</AndroidResource>
|
</AndroidResource>
|
||||||
<AndroidResource Include="Resources\layout\validatable_input_dialog_layout.xml">
|
|
||||||
<SubType></SubType>
|
|
||||||
<Generator></Generator>
|
|
||||||
</AndroidResource>
|
|
||||||
<AndroidResource Include="Resources\drawable\empty_uris_placeholder.xml">
|
|
||||||
<SubType></SubType>
|
|
||||||
<Generator></Generator>
|
|
||||||
</AndroidResource>
|
|
||||||
<AndroidResource Include="Resources\drawable\empty_uris_placeholder_dark.xml">
|
|
||||||
<SubType></SubType>
|
|
||||||
<Generator></Generator>
|
|
||||||
</AndroidResource>
|
|
||||||
<AndroidResource Include="Resources\drawable\empty_login_requests.xml">
|
|
||||||
<SubType></SubType>
|
|
||||||
<Generator></Generator>
|
|
||||||
</AndroidResource>
|
|
||||||
<AndroidResource Include="Resources\drawable\empty_login_requests_dark.xml">
|
|
||||||
<SubType></SubType>
|
|
||||||
<Generator></Generator>
|
|
||||||
</AndroidResource>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<AndroidResource Include="Resources\drawable\splash_screen.xml" />
|
<AndroidResource Include="Resources\drawable\splash_screen.xml" />
|
||||||
|
|||||||
Binary file not shown.
@@ -20,7 +20,6 @@ using AndroidX.AutoFill.Inline.V1;
|
|||||||
using Bit.Core.Abstractions;
|
using Bit.Core.Abstractions;
|
||||||
using SaveFlags = Android.Service.Autofill.SaveFlags;
|
using SaveFlags = Android.Service.Autofill.SaveFlags;
|
||||||
using Bit.Droid.Utilities;
|
using Bit.Droid.Utilities;
|
||||||
using Bit.Core.Services;
|
|
||||||
|
|
||||||
namespace Bit.Droid.Autofill
|
namespace Bit.Droid.Autofill
|
||||||
{
|
{
|
||||||
@@ -128,7 +127,6 @@ namespace Bit.Droid.Autofill
|
|||||||
"org.bromite.chromium",
|
"org.bromite.chromium",
|
||||||
"org.chromium.chrome",
|
"org.chromium.chrome",
|
||||||
"org.codeaurora.swe.browser",
|
"org.codeaurora.swe.browser",
|
||||||
"org.cromite.cromite",
|
|
||||||
"org.gnu.icecat",
|
"org.gnu.icecat",
|
||||||
"org.mozilla.fenix",
|
"org.mozilla.fenix",
|
||||||
"org.mozilla.fenix.nightly",
|
"org.mozilla.fenix.nightly",
|
||||||
@@ -154,9 +152,8 @@ namespace Bit.Droid.Autofill
|
|||||||
"androidapp://com.oneplus.applocker",
|
"androidapp://com.oneplus.applocker",
|
||||||
};
|
};
|
||||||
|
|
||||||
public static async Task<List<FilledItem>> GetFillItemsAsync(Parser parser, ICipherService cipherService, IUserVerificationService userVerificationService)
|
public static async Task<List<FilledItem>> GetFillItemsAsync(Parser parser, ICipherService cipherService)
|
||||||
{
|
{
|
||||||
var userHasMasterPassword = await userVerificationService.HasMasterPasswordAsync();
|
|
||||||
if (parser.FieldCollection.FillableForLogin)
|
if (parser.FieldCollection.FillableForLogin)
|
||||||
{
|
{
|
||||||
var ciphers = await cipherService.GetAllDecryptedByUrlAsync(parser.Uri);
|
var ciphers = await cipherService.GetAllDecryptedByUrlAsync(parser.Uri);
|
||||||
@@ -164,14 +161,14 @@ namespace Bit.Droid.Autofill
|
|||||||
{
|
{
|
||||||
var allCiphers = ciphers.Item1.ToList();
|
var allCiphers = ciphers.Item1.ToList();
|
||||||
allCiphers.AddRange(ciphers.Item2.ToList());
|
allCiphers.AddRange(ciphers.Item2.ToList());
|
||||||
var nonPromptCiphers = allCiphers.Where(cipher => !userHasMasterPassword || cipher.Reprompt == CipherRepromptType.None);
|
var nonPromptCiphers = allCiphers.Where(cipher => cipher.Reprompt == CipherRepromptType.None);
|
||||||
return nonPromptCiphers.Select(c => new FilledItem(c)).ToList();
|
return nonPromptCiphers.Select(c => new FilledItem(c)).ToList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (parser.FieldCollection.FillableForCard)
|
else if (parser.FieldCollection.FillableForCard)
|
||||||
{
|
{
|
||||||
var ciphers = await cipherService.GetAllDecryptedAsync();
|
var ciphers = await cipherService.GetAllDecryptedAsync();
|
||||||
return ciphers.Where(c => c.Type == CipherType.Card && (!userHasMasterPassword || c.Reprompt == CipherRepromptType.None)).Select(c => new FilledItem(c)).ToList();
|
return ciphers.Where(c => c.Type == CipherType.Card && c.Reprompt == CipherRepromptType.None).Select(c => new FilledItem(c)).ToList();
|
||||||
}
|
}
|
||||||
return new List<FilledItem>();
|
return new List<FilledItem>();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ using Android.Widget;
|
|||||||
using Bit.Core;
|
using Bit.Core;
|
||||||
using Bit.Core.Abstractions;
|
using Bit.Core.Abstractions;
|
||||||
using Bit.Core.Enums;
|
using Bit.Core.Enums;
|
||||||
using Bit.Core.Services;
|
|
||||||
using Bit.Core.Utilities;
|
using Bit.Core.Utilities;
|
||||||
|
|
||||||
namespace Bit.Droid.Autofill
|
namespace Bit.Droid.Autofill
|
||||||
@@ -27,7 +26,6 @@ namespace Bit.Droid.Autofill
|
|||||||
private IPolicyService _policyService;
|
private IPolicyService _policyService;
|
||||||
private IStateService _stateService;
|
private IStateService _stateService;
|
||||||
private LazyResolve<ILogger> _logger = new LazyResolve<ILogger>("logger");
|
private LazyResolve<ILogger> _logger = new LazyResolve<ILogger>("logger");
|
||||||
private IUserVerificationService _userVerificationService;
|
|
||||||
|
|
||||||
public async override void OnFillRequest(FillRequest request, CancellationSignal cancellationSignal,
|
public async override void OnFillRequest(FillRequest request, CancellationSignal cancellationSignal,
|
||||||
FillCallback callback)
|
FillCallback callback)
|
||||||
@@ -66,9 +64,11 @@ namespace Bit.Droid.Autofill
|
|||||||
var locked = await _vaultTimeoutService.IsLockedAsync();
|
var locked = await _vaultTimeoutService.IsLockedAsync();
|
||||||
if (!locked)
|
if (!locked)
|
||||||
{
|
{
|
||||||
_cipherService ??= ServiceContainer.Resolve<ICipherService>();
|
if (_cipherService == null)
|
||||||
_userVerificationService ??= ServiceContainer.Resolve<IUserVerificationService>();
|
{
|
||||||
items = await AutofillHelpers.GetFillItemsAsync(parser, _cipherService, _userVerificationService);
|
_cipherService = ServiceContainer.Resolve<ICipherService>("cipherService");
|
||||||
|
}
|
||||||
|
items = await AutofillHelpers.GetFillItemsAsync(parser, _cipherService);
|
||||||
}
|
}
|
||||||
|
|
||||||
// build response
|
// build response
|
||||||
|
|||||||
@@ -3,11 +3,5 @@
|
|||||||
public static class Constants
|
public static class Constants
|
||||||
{
|
{
|
||||||
public const string PACKAGE_NAME = "com.x8bit.bitwarden";
|
public const string PACKAGE_NAME = "com.x8bit.bitwarden";
|
||||||
public const string TEMP_CAMERA_IMAGE_NAME = "temp_camera_image.jpg";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// This directory must also be declared in filepaths.xml
|
|
||||||
/// </summary>
|
|
||||||
public const string TEMP_CAMERA_IMAGE_DIR = "camera_temp";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ namespace Bit.Droid
|
|||||||
{
|
{
|
||||||
ListenYubiKey((bool)message.Data);
|
ListenYubiKey((bool)message.Data);
|
||||||
}
|
}
|
||||||
else if (message.Command is ThemeManager.UPDATED_THEME_MESSAGE_KEY)
|
else if (message.Command == "updatedTheme")
|
||||||
{
|
{
|
||||||
Xamarin.Forms.Device.BeginInvokeOnMainThread(() => AppearanceAdjustments());
|
Xamarin.Forms.Device.BeginInvokeOnMainThread(() => AppearanceAdjustments());
|
||||||
}
|
}
|
||||||
@@ -238,23 +238,19 @@ namespace Bit.Droid
|
|||||||
Android.Net.Uri uri = null;
|
Android.Net.Uri uri = null;
|
||||||
string fileName = null;
|
string fileName = null;
|
||||||
if (data != null && data.Data != null)
|
if (data != null && data.Data != null)
|
||||||
{
|
|
||||||
if (data.Data.ToString()?.Contains(Constants.PACKAGE_NAME) != true)
|
|
||||||
{
|
{
|
||||||
uri = data.Data;
|
uri = data.Data;
|
||||||
fileName = AndroidHelpers.GetFileName(ApplicationContext, uri);
|
fileName = AndroidHelpers.GetFileName(ApplicationContext, uri);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// camera
|
// camera
|
||||||
var tmpDir = new Java.IO.File(FilesDir, Constants.TEMP_CAMERA_IMAGE_DIR);
|
var file = new Java.IO.File(FilesDir, "temp_camera_photo.jpg");
|
||||||
var file = new Java.IO.File(tmpDir, Constants.TEMP_CAMERA_IMAGE_NAME);
|
|
||||||
uri = FileProvider.GetUriForFile(this, "com.x8bit.bitwarden.fileprovider", file);
|
uri = FileProvider.GetUriForFile(this, "com.x8bit.bitwarden.fileprovider", file);
|
||||||
fileName = $"photo_{DateTime.UtcNow.ToString("yyyyMMddHHmmss")}.jpg";
|
fileName = $"photo_{DateTime.UtcNow.ToString("yyyyMMddHHmmss")}.jpg";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (uri == null || fileName == null)
|
if (uri == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,9 +68,9 @@ namespace Bit.Droid
|
|||||||
ServiceContainer.Register<IDeleteAccountActionFlowExecutioner>("deleteAccountActionFlowExecutioner", deleteAccountActionFlowExecutioner);
|
ServiceContainer.Register<IDeleteAccountActionFlowExecutioner>("deleteAccountActionFlowExecutioner", deleteAccountActionFlowExecutioner);
|
||||||
|
|
||||||
var verificationActionsFlowHelper = new VerificationActionsFlowHelper(
|
var verificationActionsFlowHelper = new VerificationActionsFlowHelper(
|
||||||
|
ServiceContainer.Resolve<IKeyConnectorService>("keyConnectorService"),
|
||||||
ServiceContainer.Resolve<IPasswordRepromptService>("passwordRepromptService"),
|
ServiceContainer.Resolve<IPasswordRepromptService>("passwordRepromptService"),
|
||||||
ServiceContainer.Resolve<ICryptoService>("cryptoService"),
|
ServiceContainer.Resolve<ICryptoService>("cryptoService"));
|
||||||
ServiceContainer.Resolve<IUserVerificationService>());
|
|
||||||
ServiceContainer.Register<IVerificationActionsFlowHelper>("verificationActionsFlowHelper", verificationActionsFlowHelper);
|
ServiceContainer.Register<IVerificationActionsFlowHelper>("verificationActionsFlowHelper", verificationActionsFlowHelper);
|
||||||
|
|
||||||
var accountsManager = new AccountsManager(
|
var accountsManager = new AccountsManager(
|
||||||
@@ -156,11 +156,10 @@ namespace Bit.Droid
|
|||||||
messagingService, broadcasterService);
|
messagingService, broadcasterService);
|
||||||
var autofillHandler = new AutofillHandler(stateService, messagingService, clipboardService,
|
var autofillHandler = new AutofillHandler(stateService, messagingService, clipboardService,
|
||||||
platformUtilsService, new LazyResolve<IEventService>());
|
platformUtilsService, new LazyResolve<IEventService>());
|
||||||
|
var biometricService = new BiometricService(stateService);
|
||||||
var cryptoFunctionService = new PclCryptoFunctionService(cryptoPrimitiveService);
|
var cryptoFunctionService = new PclCryptoFunctionService(cryptoPrimitiveService);
|
||||||
var cryptoService = new CryptoService(stateService, cryptoFunctionService, logger);
|
var cryptoService = new CryptoService(stateService, cryptoFunctionService);
|
||||||
var biometricService = new BiometricService(stateService, cryptoService);
|
var passwordRepromptService = new MobilePasswordRepromptService(platformUtilsService, cryptoService);
|
||||||
var userPinService = new UserPinService(stateService, cryptoService);
|
|
||||||
var passwordRepromptService = new MobilePasswordRepromptService(platformUtilsService, cryptoService, stateService);
|
|
||||||
|
|
||||||
ServiceContainer.Register<ISynchronousStorageService>(preferencesStorage);
|
ServiceContainer.Register<ISynchronousStorageService>(preferencesStorage);
|
||||||
ServiceContainer.Register<IBroadcasterService>("broadcasterService", broadcasterService);
|
ServiceContainer.Register<IBroadcasterService>("broadcasterService", broadcasterService);
|
||||||
@@ -183,7 +182,6 @@ namespace Bit.Droid
|
|||||||
ServiceContainer.Register<ICryptoService>("cryptoService", cryptoService);
|
ServiceContainer.Register<ICryptoService>("cryptoService", cryptoService);
|
||||||
ServiceContainer.Register<IPasswordRepromptService>("passwordRepromptService", passwordRepromptService);
|
ServiceContainer.Register<IPasswordRepromptService>("passwordRepromptService", passwordRepromptService);
|
||||||
ServiceContainer.Register<IAvatarImageSourcePool>("avatarImageSourcePool", new AvatarImageSourcePool());
|
ServiceContainer.Register<IAvatarImageSourcePool>("avatarImageSourcePool", new AvatarImageSourcePool());
|
||||||
ServiceContainer.Register<IUserPinService>(userPinService);
|
|
||||||
|
|
||||||
// Push
|
// Push
|
||||||
#if FDROID
|
#if FDROID
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:versionCode="1" android:versionName="2024.2.0" android:installLocation="internalOnly" package="com.x8bit.bitwarden">
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:versionCode="1" android:versionName="2023.5.1" android:installLocation="internalOnly" package="com.x8bit.bitwarden">
|
||||||
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="33" />
|
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="33" />
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
<uses-permission android:name="android.permission.NFC" />
|
<uses-permission android:name="android.permission.NFC" />
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
using System.ComponentModel;
|
using System;
|
||||||
using Android.Content;
|
|
||||||
using Android.OS;
|
|
||||||
using Bit.App.Controls;
|
using Bit.App.Controls;
|
||||||
using Bit.Droid.Renderers;
|
using System.ComponentModel;
|
||||||
using Xamarin.Forms;
|
|
||||||
using Xamarin.Forms.Platform.Android;
|
using Xamarin.Forms.Platform.Android;
|
||||||
|
using Android.Content;
|
||||||
|
using Xamarin.Forms;
|
||||||
|
using Bit.Droid.Renderers;
|
||||||
|
|
||||||
[assembly: ExportRenderer(typeof(CustomLabel), typeof(CustomLabelRenderer))]
|
[assembly: ExportRenderer(typeof(CustomLabel), typeof(CustomLabelRenderer))]
|
||||||
namespace Bit.Droid.Renderers
|
namespace Bit.Droid.Renderers
|
||||||
@@ -15,19 +15,6 @@ namespace Bit.Droid.Renderers
|
|||||||
: base(context)
|
: base(context)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
protected override void OnElementChanged(ElementChangedEventArgs<Label> e)
|
|
||||||
{
|
|
||||||
base.OnElementChanged(e);
|
|
||||||
|
|
||||||
if (Control != null && e.NewElement is CustomLabel label)
|
|
||||||
{
|
|
||||||
if (label.FontWeight.HasValue && Build.VERSION.SdkInt >= BuildVersionCodes.P)
|
|
||||||
{
|
|
||||||
Control.Typeface = Android.Graphics.Typeface.Create(null, label.FontWeight.Value, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
|
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||||
{
|
{
|
||||||
var label = sender as CustomLabel;
|
var label = sender as CustomLabel;
|
||||||
@@ -41,3 +28,4 @@ namespace Bit.Droid.Renderers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,41 +0,0 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt"
|
|
||||||
android:viewportWidth="200"
|
|
||||||
android:viewportHeight="143"
|
|
||||||
android:width="200dp"
|
|
||||||
android:height="143dp">
|
|
||||||
<path
|
|
||||||
android:pathData="M34 43H10C6.68629 43 4 45.6863 4 49V109C4 112.314 6.68629 115 10 115H34C37.3137 115 40 112.314 40 109V49C40 45.6863 37.3137 43 34 43ZM10 39C4.47715 39 0 43.4772 0 49V109C0 114.523 4.47715 119 10 119H34C39.5228 119 44 114.523 44 109V49C44 43.4772 39.5228 39 34 39H10Z"
|
|
||||||
android:fillType="evenOdd"
|
|
||||||
android:fillColor="#89929F" />
|
|
||||||
<path
|
|
||||||
android:pathData="M20.3701 47.809C20.3701 47.2567 20.8178 46.809 21.3701 46.809H22.6122C23.1645 46.809 23.6122 47.2567 23.6122 47.809C23.6122 48.3612 23.1645 48.809 22.6122 48.809H21.3701C20.8178 48.809 20.3701 48.3612 20.3701 47.809Z"
|
|
||||||
android:fillType="evenOdd"
|
|
||||||
android:fillColor="#89929F" />
|
|
||||||
<path
|
|
||||||
android:pathData="M68 120C68 119.448 68.4477 119 69 119H127C127.552 119 128 119.448 128 120C128 120.552 127.552 121 127 121H69C68.4477 121 68 120.552 68 120Z"
|
|
||||||
android:fillType="evenOdd"
|
|
||||||
android:fillColor="#89929F" />
|
|
||||||
<path
|
|
||||||
android:pathData="M87.7402 120V102.236H89.7402V120H87.7402Z"
|
|
||||||
android:fillType="evenOdd"
|
|
||||||
android:fillColor="#89929F" />
|
|
||||||
<path
|
|
||||||
android:pathData="M107.71 120V102.236H109.71V120H107.71Z"
|
|
||||||
android:fillType="evenOdd"
|
|
||||||
android:fillColor="#89929F" />
|
|
||||||
<path
|
|
||||||
android:pathData="M27 25C27 17.268 33.268 11 41 11H157C164.732 11 171 17.268 171 25V31H167V25C167 19.4772 162.523 15 157 15H41C35.4772 15 31 19.4772 31 25V41H27V25ZM42 99H127V103H42V99Z"
|
|
||||||
android:fillType="evenOdd"
|
|
||||||
android:fillColor="#89929F" />
|
|
||||||
<path
|
|
||||||
android:pathData="M35 26C35 22.134 38.134 19 42 19H156C159.866 19 163 22.134 163 26V31H161V26C161 23.2386 158.761 21 156 21H42C39.2386 21 37 23.2386 37 26V41H35V26ZM42 93H127V95H42V93Z"
|
|
||||||
android:fillType="evenOdd"
|
|
||||||
android:fillColor="#89929F" />
|
|
||||||
<path
|
|
||||||
android:pathData="M125 39C125 33.4771 129.477 29 135 29H188C193.523 29 198 33.4772 198 39V119C198 124.523 193.523 129 188 129H135C129.477 129 125 124.523 125 119V39ZM135 33C131.686 33 129 35.6863 129 39V119C129 122.314 131.686 125 135 125H188C191.314 125 194 122.314 194 119V39C194 35.6863 191.314 33 188 33H135Z"
|
|
||||||
android:fillType="evenOdd"
|
|
||||||
android:fillColor="#89929F" />
|
|
||||||
<path
|
|
||||||
android:pathData="M164 120C164 121.105 163.105 122 162 122C160.895 122 160 121.105 160 120C160 118.895 160.895 118 162 118C163.105 118 164 118.895 164 120Z"
|
|
||||||
android:fillColor="#89929F" />
|
|
||||||
</vector>
|
|
||||||
@@ -1,41 +0,0 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt"
|
|
||||||
android:viewportWidth="200"
|
|
||||||
android:viewportHeight="143"
|
|
||||||
android:width="200dp"
|
|
||||||
android:height="143dp">
|
|
||||||
<path
|
|
||||||
android:pathData="M34 43H10C6.68629 43 4 45.6863 4 49V109C4 112.314 6.68629 115 10 115H34C37.3137 115 40 112.314 40 109V49C40 45.6863 37.3137 43 34 43ZM10 39C4.47715 39 0 43.4772 0 49V109C0 114.523 4.47715 119 10 119H34C39.5228 119 44 114.523 44 109V49C44 43.4772 39.5228 39 34 39H10Z"
|
|
||||||
android:fillType="evenOdd"
|
|
||||||
android:fillColor="#A3A3A3" />
|
|
||||||
<path
|
|
||||||
android:pathData="M20.3701 47.809C20.3701 47.2567 20.8178 46.809 21.3701 46.809H22.6122C23.1645 46.809 23.6122 47.2567 23.6122 47.809C23.6122 48.3612 23.1645 48.809 22.6122 48.809H21.3701C20.8178 48.809 20.3701 48.3612 20.3701 47.809Z"
|
|
||||||
android:fillType="evenOdd"
|
|
||||||
android:fillColor="#A3A3A3" />
|
|
||||||
<path
|
|
||||||
android:pathData="M68 120C68 119.448 68.4477 119 69 119H127C127.552 119 128 119.448 128 120C128 120.552 127.552 121 127 121H69C68.4477 121 68 120.552 68 120Z"
|
|
||||||
android:fillType="evenOdd"
|
|
||||||
android:fillColor="#A3A3A3" />
|
|
||||||
<path
|
|
||||||
android:pathData="M87.7402 120V102.236H89.7402V120H87.7402Z"
|
|
||||||
android:fillType="evenOdd"
|
|
||||||
android:fillColor="#A3A3A3" />
|
|
||||||
<path
|
|
||||||
android:pathData="M107.71 120V102.236H109.71V120H107.71Z"
|
|
||||||
android:fillType="evenOdd"
|
|
||||||
android:fillColor="#A3A3A3" />
|
|
||||||
<path
|
|
||||||
android:pathData="M27 25C27 17.268 33.268 11 41 11H157C164.732 11 171 17.268 171 25V31H167V25C167 19.4772 162.523 15 157 15H41C35.4772 15 31 19.4772 31 25V41H27V25ZM42 99H127V103H42V99Z"
|
|
||||||
android:fillType="evenOdd"
|
|
||||||
android:fillColor="#A3A3A3" />
|
|
||||||
<path
|
|
||||||
android:pathData="M35 26C35 22.134 38.134 19 42 19H156C159.866 19 163 22.134 163 26V31H161V26C161 23.2386 158.761 21 156 21H42C39.2386 21 37 23.2386 37 26V41H35V26ZM42 93H127V95H42V93Z"
|
|
||||||
android:fillType="evenOdd"
|
|
||||||
android:fillColor="#A3A3A3" />
|
|
||||||
<path
|
|
||||||
android:pathData="M125 39C125 33.4771 129.477 29 135 29H188C193.523 29 198 33.4772 198 39V119C198 124.523 193.523 129 188 129H135C129.477 129 125 124.523 125 119V39ZM135 33C131.686 33 129 35.6863 129 39V119C129 122.314 131.686 125 135 125H188C191.314 125 194 122.314 194 119V39C194 35.6863 191.314 33 188 33H135Z"
|
|
||||||
android:fillType="evenOdd"
|
|
||||||
android:fillColor="#A3A3A3" />
|
|
||||||
<path
|
|
||||||
android:pathData="M164 120C164 121.105 163.105 122 162 122C160.895 122 160 121.105 160 120C160 118.895 160.895 118 162 118C163.105 118 164 118.895 164 120Z"
|
|
||||||
android:fillColor="#A3A3A3" />
|
|
||||||
</vector>
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt"
|
|
||||||
android:viewportWidth="129"
|
|
||||||
android:viewportHeight="124"
|
|
||||||
android:width="129dp"
|
|
||||||
android:height="124dp">
|
|
||||||
<path
|
|
||||||
android:pathData="M126.8227 61.9441A59.6843 59.6843 0 0 1 7.4541 61.9441A59.6843 59.6843 0 0 1 126.8227 61.9441Z"
|
|
||||||
android:fillColor="#F0F0F0"
|
|
||||||
android:strokeColor="#89929F"
|
|
||||||
android:strokeWidth="3" />
|
|
||||||
<path
|
|
||||||
android:pathData="M21.6167 100.851C52.597 103.31 79.6937 80.3264 82.1391 49.5156C83.6205 30.8497 76.0789 14.8844 62.7275 3.63385"
|
|
||||||
android:strokeColor="#89929F"
|
|
||||||
android:strokeWidth="1.5"
|
|
||||||
android:strokeLineCap="round" />
|
|
||||||
<path
|
|
||||||
android:pathData="M14.5633 34.2845C12.2035 66.7711 38.5225 96.3429 72.6666 98.8232C74.2596 98.9389 78.629 98.9975 80.1951 99C84.6245 98.8232 97.8063 96.593 106.813 91.8485C113.439 88.3581 119.745 84.6984 124.644 79.1121"
|
|
||||||
android:strokeColor="#89929F"
|
|
||||||
android:strokeWidth="1.5"
|
|
||||||
android:strokeLineCap="round" />
|
|
||||||
<path
|
|
||||||
android:pathData="M124.502 48.5051C106.554 24.3817 68.8237 21.6709 41.4178 42.0617C24.8146 54.4149 14.7327 72.4183 13.9255 90.1427"
|
|
||||||
android:strokeColor="#89929F"
|
|
||||||
android:strokeWidth="1.5"
|
|
||||||
android:strokeLineCap="round" />
|
|
||||||
<path
|
|
||||||
android:pathData="M83.4034 28.3934A5 5 0 0 1 73.4034 28.3934A5 5 0 0 1 83.4034 28.3934Z"
|
|
||||||
android:fillColor="#89929F" />
|
|
||||||
<path
|
|
||||||
android:pathData="M24.7698 66.5518A5 5 0 0 1 14.7698 66.5518A5 5 0 0 1 24.7698 66.5518Z"
|
|
||||||
android:fillColor="#89929F" />
|
|
||||||
<path
|
|
||||||
android:pathData="M57.344 94.4726A5 5 0 0 1 47.344 94.4726A5 5 0 0 1 57.344 94.4726Z"
|
|
||||||
android:fillColor="#89929F" />
|
|
||||||
</vector>
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt"
|
|
||||||
android:viewportWidth="129"
|
|
||||||
android:viewportHeight="124"
|
|
||||||
android:width="129dp"
|
|
||||||
android:height="124dp">
|
|
||||||
<path
|
|
||||||
android:pathData="M126.8227 61.9441A59.6843 59.6843 0 0 1 7.4541 61.9441A59.6843 59.6843 0 0 1 126.8227 61.9441Z"
|
|
||||||
android:fillColor="@android:color/transparent"
|
|
||||||
android:strokeColor="#A3A3A3"
|
|
||||||
android:strokeWidth="3" />
|
|
||||||
<path
|
|
||||||
android:pathData="M21.6167 100.851C52.597 103.31 79.6937 80.3264 82.1391 49.5156C83.6205 30.8497 76.0789 14.8844 62.7275 3.63385"
|
|
||||||
android:strokeColor="#A3A3A3"
|
|
||||||
android:strokeWidth="1.5"
|
|
||||||
android:strokeLineCap="round" />
|
|
||||||
<path
|
|
||||||
android:pathData="M14.5633 34.2845C12.2035 66.7711 38.5225 96.3429 72.6666 98.8232C74.2596 98.9389 78.629 98.9975 80.1951 99C84.6245 98.8232 97.8063 96.593 106.813 91.8485C113.439 88.3581 119.745 84.6984 124.644 79.1121"
|
|
||||||
android:strokeColor="#A3A3A3"
|
|
||||||
android:strokeWidth="1.5"
|
|
||||||
android:strokeLineCap="round" />
|
|
||||||
<path
|
|
||||||
android:pathData="M124.502 48.5051C106.554 24.3817 68.8237 21.6709 41.4178 42.0617C24.8146 54.4149 14.7327 72.4183 13.9255 90.1427"
|
|
||||||
android:strokeColor="#A3A3A3"
|
|
||||||
android:strokeWidth="1.5"
|
|
||||||
android:strokeLineCap="round" />
|
|
||||||
<path
|
|
||||||
android:pathData="M83.4034 28.3934A5 5 0 0 1 73.4034 28.3934A5 5 0 0 1 83.4034 28.3934Z"
|
|
||||||
android:fillColor="#A3A3A3" />
|
|
||||||
<path
|
|
||||||
android:pathData="M24.7698 66.5518A5 5 0 0 1 14.7698 66.5518A5 5 0 0 1 24.7698 66.5518Z"
|
|
||||||
android:fillColor="#A3A3A3" />
|
|
||||||
<path
|
|
||||||
android:pathData="M57.344 94.4726A5 5 0 0 1 47.344 94.4726A5 5 0 0 1 57.344 94.4726Z"
|
|
||||||
android:fillColor="#A3A3A3" />
|
|
||||||
</vector>
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:paddingLeft="30dp"
|
|
||||||
android:paddingRight="30dp">
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/lblHeader"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textSize="@dimen/dialog_header_text_size"
|
|
||||||
android:layout_marginTop="5dp"
|
|
||||||
android:layout_marginBottom="-3dp"
|
|
||||||
android:labelFor="@+id/txtValue"/>
|
|
||||||
<EditText
|
|
||||||
android:id="@id/txtValue"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textSize="@dimen/dialog_input_text_size"/>
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/lblValueSubinfo"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textSize="@dimen/dialog_sub_value_info_text_size"/>
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
@@ -2,7 +2,4 @@
|
|||||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
<dimen name="design_bottom_navigation_text_size" tools:override="true">15sp</dimen>
|
<dimen name="design_bottom_navigation_text_size" tools:override="true">15sp</dimen>
|
||||||
<dimen name="design_bottom_navigation_active_text_size" tools:override="true">15sp</dimen>
|
<dimen name="design_bottom_navigation_active_text_size" tools:override="true">15sp</dimen>
|
||||||
<dimen name="dialog_input_text_size">16sp</dimen>
|
|
||||||
<dimen name="dialog_header_text_size">12sp</dimen>
|
|
||||||
<dimen name="dialog_sub_value_info_text_size">12sp</dimen>
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -236,9 +236,6 @@
|
|||||||
<compatibility-package
|
<compatibility-package
|
||||||
android:name="org.codeaurora.swe.browser"
|
android:name="org.codeaurora.swe.browser"
|
||||||
android:maxLongVersionCode="10000000000"/>
|
android:maxLongVersionCode="10000000000"/>
|
||||||
<compatibility-package
|
|
||||||
android:name="org.cromite.cromite"
|
|
||||||
android:maxLongVersionCode="10000000000"/>
|
|
||||||
<compatibility-package
|
<compatibility-package
|
||||||
android:name="org.gnu.icecat"
|
android:name="org.gnu.icecat"
|
||||||
android:maxLongVersionCode="10000000000"/>
|
android:maxLongVersionCode="10000000000"/>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<paths xmlns:android="http://schemas.android.com/apk/res/android">
|
<paths xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<cache-path name="cache" path="." />
|
<cache-path name="cache" path="." />
|
||||||
<files-path name="temp_camera_images" path="camera_temp/" />
|
<files-path name="internal" path="." />
|
||||||
</paths>
|
</paths>
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Android.OS;
|
using Android.OS;
|
||||||
using Android.Security.Keystore;
|
using Android.Security.Keystore;
|
||||||
using Bit.App.Services;
|
|
||||||
using Bit.Core.Abstractions;
|
using Bit.Core.Abstractions;
|
||||||
using Bit.Core.Services;
|
using Bit.Core.Services;
|
||||||
using Java.Security;
|
using Java.Security;
|
||||||
@@ -10,8 +9,10 @@ using Javax.Crypto;
|
|||||||
|
|
||||||
namespace Bit.Droid.Services
|
namespace Bit.Droid.Services
|
||||||
{
|
{
|
||||||
public class BiometricService : BaseBiometricService
|
public class BiometricService : IBiometricService
|
||||||
{
|
{
|
||||||
|
private readonly IStateService _stateService;
|
||||||
|
|
||||||
private const string KeyName = "com.8bit.bitwarden.biometric_integrity";
|
private const string KeyName = "com.8bit.bitwarden.biometric_integrity";
|
||||||
|
|
||||||
private const string KeyStoreName = "AndroidKeyStore";
|
private const string KeyStoreName = "AndroidKeyStore";
|
||||||
@@ -23,14 +24,14 @@ namespace Bit.Droid.Services
|
|||||||
|
|
||||||
private readonly KeyStore _keystore;
|
private readonly KeyStore _keystore;
|
||||||
|
|
||||||
public BiometricService(IStateService stateService, ICryptoService cryptoService)
|
public BiometricService(IStateService stateService)
|
||||||
: base(stateService, cryptoService)
|
|
||||||
{
|
{
|
||||||
|
_stateService = stateService;
|
||||||
_keystore = KeyStore.GetInstance(KeyStoreName);
|
_keystore = KeyStore.GetInstance(KeyStoreName);
|
||||||
_keystore.Load(null);
|
_keystore.Load(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task<bool> SetupBiometricAsync(string bioIntegritySrcKey = null)
|
public async Task<bool> SetupBiometricAsync(string bioIntegritySrcKey = null)
|
||||||
{
|
{
|
||||||
if (Build.VERSION.SdkInt >= BuildVersionCodes.M)
|
if (Build.VERSION.SdkInt >= BuildVersionCodes.M)
|
||||||
{
|
{
|
||||||
@@ -40,7 +41,7 @@ namespace Bit.Droid.Services
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override async Task<bool> IsSystemBiometricIntegrityValidAsync(string bioIntegritySrcKey = null)
|
public async Task<bool> IsSystemBiometricIntegrityValidAsync(string bioIntegritySrcKey = null)
|
||||||
{
|
{
|
||||||
if (Build.VERSION.SdkInt < BuildVersionCodes.M)
|
if (Build.VERSION.SdkInt < BuildVersionCodes.M)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13,13 +13,12 @@ using Android.Views.InputMethods;
|
|||||||
using Android.Widget;
|
using Android.Widget;
|
||||||
using Bit.App.Abstractions;
|
using Bit.App.Abstractions;
|
||||||
using Bit.App.Resources;
|
using Bit.App.Resources;
|
||||||
using Bit.App.Utilities;
|
|
||||||
using Bit.App.Utilities.Prompts;
|
|
||||||
using Bit.Core.Abstractions;
|
using Bit.Core.Abstractions;
|
||||||
using Bit.Core.Enums;
|
using Bit.Core.Enums;
|
||||||
|
using Bit.Core.Utilities;
|
||||||
using Bit.Droid.Utilities;
|
using Bit.Droid.Utilities;
|
||||||
using Plugin.CurrentActivity;
|
using Plugin.CurrentActivity;
|
||||||
using Xamarin.Forms.Platform.Android;
|
using static Bit.App.Pages.SettingsPageViewModel;
|
||||||
|
|
||||||
namespace Bit.Droid.Services
|
namespace Bit.Droid.Services
|
||||||
{
|
{
|
||||||
@@ -210,7 +209,10 @@ namespace Bit.Droid.Services
|
|||||||
}
|
}
|
||||||
if (numericKeyboard)
|
if (numericKeyboard)
|
||||||
{
|
{
|
||||||
SetNumericKeyboardTo(input);
|
input.InputType = InputTypes.ClassNumber | InputTypes.NumberFlagDecimal | InputTypes.NumberFlagSigned;
|
||||||
|
#pragma warning disable CS0618 // Type or member is obsolete
|
||||||
|
input.KeyListener = DigitsKeyListener.GetInstance(false, false);
|
||||||
|
#pragma warning restore CS0618 // Type or member is obsolete
|
||||||
}
|
}
|
||||||
if (password)
|
if (password)
|
||||||
{
|
{
|
||||||
@@ -246,83 +248,6 @@ namespace Bit.Droid.Services
|
|||||||
return result.Task;
|
return result.Task;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<ValidatablePromptResponse?> DisplayValidatablePromptAsync(ValidatablePromptConfig config)
|
|
||||||
{
|
|
||||||
var activity = (MainActivity)CrossCurrentActivity.Current.Activity;
|
|
||||||
if (activity == null)
|
|
||||||
{
|
|
||||||
return Task.FromResult<ValidatablePromptResponse?>(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
var alertBuilder = new AlertDialog.Builder(activity);
|
|
||||||
alertBuilder.SetTitle(config.Title);
|
|
||||||
var view = activity.LayoutInflater.Inflate(Resource.Layout.validatable_input_dialog_layout, null);
|
|
||||||
alertBuilder.SetView(view);
|
|
||||||
|
|
||||||
var result = new TaskCompletionSource<ValidatablePromptResponse?>();
|
|
||||||
|
|
||||||
alertBuilder.SetOnCancelListener(new BasicDialogWithResultCancelListener(result));
|
|
||||||
alertBuilder.SetPositiveButton(config.OkButtonText ?? AppResources.Ok, listener: null);
|
|
||||||
alertBuilder.SetNegativeButton(config.CancelButtonText ?? AppResources.Cancel, (sender, args) => result.TrySetResult(null));
|
|
||||||
if (!string.IsNullOrEmpty(config.ThirdButtonText))
|
|
||||||
{
|
|
||||||
alertBuilder.SetNeutralButton(config.ThirdButtonText, (sender, args) => result.TrySetResult(new ValidatablePromptResponse(null, true)));
|
|
||||||
}
|
|
||||||
|
|
||||||
var alert = alertBuilder.Create();
|
|
||||||
|
|
||||||
var input = view.FindViewById<EditText>(Resource.Id.txtValue);
|
|
||||||
var lblHeader = view.FindViewById<TextView>(Resource.Id.lblHeader);
|
|
||||||
var lblValueSubinfo = view.FindViewById<TextView>(Resource.Id.lblValueSubinfo);
|
|
||||||
|
|
||||||
lblHeader.Text = config.Subtitle;
|
|
||||||
lblValueSubinfo.Text = config.ValueSubInfo;
|
|
||||||
|
|
||||||
var defaultSubInfoColor = lblValueSubinfo.TextColors;
|
|
||||||
|
|
||||||
input.InputType = InputTypes.ClassText;
|
|
||||||
|
|
||||||
if (config.NumericKeyboard)
|
|
||||||
{
|
|
||||||
SetNumericKeyboardTo(input);
|
|
||||||
}
|
|
||||||
|
|
||||||
input.ImeOptions = input.ImeOptions | (ImeAction)ImeFlags.NoPersonalizedLearning | (ImeAction)ImeFlags.NoExtractUi;
|
|
||||||
input.Text = config.Text ?? string.Empty;
|
|
||||||
input.SetSelection(config.Text?.Length ?? 0);
|
|
||||||
input.AfterTextChanged += (sender, args) =>
|
|
||||||
{
|
|
||||||
if (lblValueSubinfo.Text != config.ValueSubInfo)
|
|
||||||
{
|
|
||||||
lblValueSubinfo.Text = config.ValueSubInfo;
|
|
||||||
lblHeader.SetTextColor(defaultSubInfoColor);
|
|
||||||
lblValueSubinfo.SetTextColor(defaultSubInfoColor);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
alert.Window.SetSoftInputMode(SoftInput.StateVisible);
|
|
||||||
alert.Show();
|
|
||||||
|
|
||||||
var positiveButton = alert.GetButton((int)DialogButtonType.Positive);
|
|
||||||
positiveButton.Click += (sender, args) =>
|
|
||||||
{
|
|
||||||
var error = config.ValidateText(input.Text);
|
|
||||||
if (error != null)
|
|
||||||
{
|
|
||||||
lblHeader.SetTextColor(ThemeManager.GetResourceColor("DangerColor").ToAndroid());
|
|
||||||
lblValueSubinfo.SetTextColor(ThemeManager.GetResourceColor("DangerColor").ToAndroid());
|
|
||||||
lblValueSubinfo.Text = error;
|
|
||||||
lblValueSubinfo.SendAccessibilityEvent(Android.Views.Accessibility.EventTypes.ViewFocused);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
result.TrySetResult(new ValidatablePromptResponse(input.Text, false));
|
|
||||||
alert.Dismiss();
|
|
||||||
};
|
|
||||||
|
|
||||||
return result.Task;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void RateApp()
|
public void RateApp()
|
||||||
{
|
{
|
||||||
var activity = (MainActivity)CrossCurrentActivity.Current.Activity;
|
var activity = (MainActivity)CrossCurrentActivity.Current.Activity;
|
||||||
@@ -547,12 +472,6 @@ namespace Bit.Droid.Services
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool SupportsAutofillServices() => Build.VERSION.SdkInt >= BuildVersionCodes.O;
|
|
||||||
|
|
||||||
public bool SupportsInlineAutofill() => Build.VERSION.SdkInt >= BuildVersionCodes.R;
|
|
||||||
|
|
||||||
public bool SupportsDrawOver() => Build.VERSION.SdkInt >= BuildVersionCodes.M;
|
|
||||||
|
|
||||||
private Intent RateIntentForUrl(string url, Activity activity)
|
private Intent RateIntentForUrl(string url, Activity activity)
|
||||||
{
|
{
|
||||||
var intent = new Intent(Intent.ActionView, Android.Net.Uri.Parse($"{url}?id={activity.PackageName}"));
|
var intent = new Intent(Intent.ActionView, Android.Net.Uri.Parse($"{url}?id={activity.PackageName}"));
|
||||||
@@ -606,61 +525,5 @@ namespace Bit.Droid.Services
|
|||||||
// only used by iOS
|
// only used by iOS
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetAutofillAccessibilityDescription()
|
|
||||||
{
|
|
||||||
if (Build.VERSION.SdkInt <= BuildVersionCodes.LollipopMr1)
|
|
||||||
{
|
|
||||||
return AppResources.AccessibilityDescription;
|
|
||||||
}
|
|
||||||
if (Build.VERSION.SdkInt <= BuildVersionCodes.M)
|
|
||||||
{
|
|
||||||
return AppResources.AccessibilityDescription2;
|
|
||||||
}
|
|
||||||
if (Build.VERSION.SdkInt <= BuildVersionCodes.NMr1)
|
|
||||||
{
|
|
||||||
return AppResources.AccessibilityDescription3;
|
|
||||||
}
|
|
||||||
|
|
||||||
return AppResources.AccessibilityDescription4;
|
|
||||||
}
|
|
||||||
|
|
||||||
public string GetAutofillDrawOverDescription()
|
|
||||||
{
|
|
||||||
if (Build.VERSION.SdkInt <= BuildVersionCodes.M)
|
|
||||||
{
|
|
||||||
return AppResources.DrawOverDescription;
|
|
||||||
}
|
|
||||||
if (Build.VERSION.SdkInt <= BuildVersionCodes.NMr1)
|
|
||||||
{
|
|
||||||
return AppResources.DrawOverDescription2;
|
|
||||||
}
|
|
||||||
|
|
||||||
return AppResources.DrawOverDescription3;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SetNumericKeyboardTo(EditText editText)
|
|
||||||
{
|
|
||||||
editText.InputType = InputTypes.ClassNumber | InputTypes.NumberFlagDecimal | InputTypes.NumberFlagSigned;
|
|
||||||
#pragma warning disable CS0618 // Type or member is obsolete
|
|
||||||
editText.KeyListener = DigitsKeyListener.GetInstance(false, false);
|
|
||||||
#pragma warning restore CS0618 // Type or member is obsolete
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class BasicDialogWithResultCancelListener : Java.Lang.Object, IDialogInterfaceOnCancelListener
|
|
||||||
{
|
|
||||||
private readonly TaskCompletionSource<ValidatablePromptResponse?> _taskCompletionSource;
|
|
||||||
|
|
||||||
public BasicDialogWithResultCancelListener(TaskCompletionSource<ValidatablePromptResponse?> taskCompletionSource)
|
|
||||||
{
|
|
||||||
_taskCompletionSource = taskCompletionSource;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnCancel(IDialogInterface dialog)
|
|
||||||
{
|
|
||||||
_taskCompletionSource?.TrySetResult(null);
|
|
||||||
dialog?.Dismiss();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -190,8 +190,7 @@ namespace Bit.Droid.Services
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var tmpDir = new Java.IO.File(activity.FilesDir, Constants.TEMP_CAMERA_IMAGE_DIR);
|
var file = new Java.IO.File(activity.FilesDir, "temp_camera_photo.jpg");
|
||||||
var file = new Java.IO.File(tmpDir, Constants.TEMP_CAMERA_IMAGE_NAME);
|
|
||||||
if (!file.Exists())
|
if (!file.Exists())
|
||||||
{
|
{
|
||||||
file.ParentFile.Mkdirs();
|
file.ParentFile.Mkdirs();
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
using Android.Content;
|
using Android.Content;
|
||||||
using Android.OS;
|
using Android.OS;
|
||||||
using Java.Lang;
|
|
||||||
|
|
||||||
namespace Bit.Droid.Utilities
|
namespace Bit.Droid.Utilities
|
||||||
{
|
{
|
||||||
@@ -14,12 +13,7 @@ namespace Bit.Droid.Utilities
|
|||||||
// Note: getting the bundle like this will cause to call unparcel() internally
|
// Note: getting the bundle like this will cause to call unparcel() internally
|
||||||
var b = intent?.Extras?.GetBundle("trashstringwhichhasnousebuttocheckunparcel");
|
var b = intent?.Extras?.GetBundle("trashstringwhichhasnousebuttocheckunparcel");
|
||||||
}
|
}
|
||||||
catch (Exception ex) when
|
catch (BadParcelableException)
|
||||||
(
|
|
||||||
ex is BadParcelableException ||
|
|
||||||
ex is ClassNotFoundException ||
|
|
||||||
ex is RuntimeException
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
intent.ReplaceExtras((Bundle)null);
|
intent.ReplaceExtras((Bundle)null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Bit.App.Utilities.Prompts;
|
|
||||||
using Bit.Core.Enums;
|
using Bit.Core.Enums;
|
||||||
using Bit.Core.Models;
|
using Bit.Core.Models;
|
||||||
|
|
||||||
@@ -19,7 +18,6 @@ namespace Bit.App.Abstractions
|
|||||||
Task<string> DisplayPromptAync(string title = null, string description = null, string text = null,
|
Task<string> DisplayPromptAync(string title = null, string description = null, string text = null,
|
||||||
string okButtonText = null, string cancelButtonText = null, bool numericKeyboard = false,
|
string okButtonText = null, string cancelButtonText = null, bool numericKeyboard = false,
|
||||||
bool autofocus = true, bool password = false);
|
bool autofocus = true, bool password = false);
|
||||||
Task<ValidatablePromptResponse?> DisplayValidatablePromptAsync(ValidatablePromptConfig config);
|
|
||||||
Task<string> DisplayAlertAsync(string title, string message, string cancel, params string[] buttons);
|
Task<string> DisplayAlertAsync(string title, string message, string cancel, params string[] buttons);
|
||||||
Task<string> DisplayActionSheetAsync(string title, string cancel, string destruction, params string[] buttons);
|
Task<string> DisplayActionSheetAsync(string title, string cancel, string destruction, params string[] buttons);
|
||||||
|
|
||||||
@@ -28,9 +26,6 @@ namespace Bit.App.Abstractions
|
|||||||
bool SupportsNfc();
|
bool SupportsNfc();
|
||||||
bool SupportsCamera();
|
bool SupportsCamera();
|
||||||
bool SupportsFido2();
|
bool SupportsFido2();
|
||||||
bool SupportsAutofillServices();
|
|
||||||
bool SupportsInlineAutofill();
|
|
||||||
bool SupportsDrawOver();
|
|
||||||
|
|
||||||
bool LaunchApp(string appName);
|
bool LaunchApp(string appName);
|
||||||
void RateApp();
|
void RateApp();
|
||||||
@@ -44,7 +39,5 @@ namespace Bit.App.Abstractions
|
|||||||
Task SetScreenCaptureAllowedAsync();
|
Task SetScreenCaptureAllowedAsync();
|
||||||
void OpenAppSettings();
|
void OpenAppSettings();
|
||||||
void CloseExtensionPopUp();
|
void CloseExtensionPopUp();
|
||||||
string GetAutofillAccessibilityDescription();
|
|
||||||
string GetAutofillDrawOverDescription();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Bit.Core.Enums;
|
|
||||||
|
|
||||||
namespace Bit.App.Abstractions
|
namespace Bit.App.Abstractions
|
||||||
{
|
{
|
||||||
@@ -7,8 +6,10 @@ namespace Bit.App.Abstractions
|
|||||||
{
|
{
|
||||||
string[] ProtectedFields { get; }
|
string[] ProtectedFields { get; }
|
||||||
|
|
||||||
Task<bool> PromptAndCheckPasswordIfNeededAsync(CipherRepromptType repromptType = CipherRepromptType.Password);
|
Task<bool> ShowPasswordPromptAsync();
|
||||||
|
|
||||||
Task<(string password, bool valid)> ShowPasswordPromptAndGetItAsync();
|
Task<(string password, bool valid)> ShowPasswordPromptAndGetItAsync();
|
||||||
|
|
||||||
|
Task<bool> Enabled();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,9 +16,9 @@
|
|||||||
<PackageReference Include="Plugin.Fingerprint" Version="2.1.5" />
|
<PackageReference Include="Plugin.Fingerprint" Version="2.1.5" />
|
||||||
<PackageReference Include="SkiaSharp.Views.Forms" Version="2.88.3" />
|
<PackageReference Include="SkiaSharp.Views.Forms" Version="2.88.3" />
|
||||||
<PackageReference Include="Xamarin.CommunityToolkit" Version="2.0.6" />
|
<PackageReference Include="Xamarin.CommunityToolkit" Version="2.0.6" />
|
||||||
<PackageReference Include="Xamarin.Essentials" Version="1.8.0" />
|
<PackageReference Include="Xamarin.Essentials" Version="1.7.5" />
|
||||||
<PackageReference Include="Xamarin.FFImageLoading.Forms" Version="2.4.11.982" />
|
<PackageReference Include="Xamarin.FFImageLoading.Forms" Version="2.4.11.982" />
|
||||||
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2612" />
|
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2578" />
|
||||||
<PackageReference Include="ZXing.Net.Mobile" Version="2.4.1" />
|
<PackageReference Include="ZXing.Net.Mobile" Version="2.4.1" />
|
||||||
<PackageReference Include="ZXing.Net.Mobile.Forms" Version="2.4.1" />
|
<PackageReference Include="ZXing.Net.Mobile.Forms" Version="2.4.1" />
|
||||||
<PackageReference Include="MessagePack" Version="2.4.59" />
|
<PackageReference Include="MessagePack" Version="2.4.59" />
|
||||||
@@ -59,6 +59,9 @@
|
|||||||
<Compile Update="Pages\Settings\ExtensionPage.xaml.cs">
|
<Compile Update="Pages\Settings\ExtensionPage.xaml.cs">
|
||||||
<DependentUpon>ExtensionPage.xaml</DependentUpon>
|
<DependentUpon>ExtensionPage.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Update="Pages\Settings\AutofillServicesPage.xaml.cs">
|
||||||
|
<DependentUpon>AutofillServicesPage.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Update="Pages\Settings\FolderAddEditPage.xaml.cs">
|
<Compile Update="Pages\Settings\FolderAddEditPage.xaml.cs">
|
||||||
<DependentUpon>FolderAddEditPage.xaml</DependentUpon>
|
<DependentUpon>FolderAddEditPage.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -68,6 +71,12 @@
|
|||||||
<Compile Update="Pages\Settings\ExportVaultPage.xaml.cs">
|
<Compile Update="Pages\Settings\ExportVaultPage.xaml.cs">
|
||||||
<DependentUpon>ExportVaultPage.xaml</DependentUpon>
|
<DependentUpon>ExportVaultPage.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Update="Pages\Settings\OptionsPage.xaml.cs">
|
||||||
|
<DependentUpon>OptionsPage.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Update="Pages\Settings\SyncPage.xaml.cs">
|
||||||
|
<DependentUpon>SyncPage.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Update="Pages\Vault\AttachmentsPage.xaml.cs">
|
<Compile Update="Pages\Vault\AttachmentsPage.xaml.cs">
|
||||||
<DependentUpon>AttachmentsPage.xaml</DependentUpon>
|
<DependentUpon>AttachmentsPage.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -137,8 +146,6 @@
|
|||||||
<Folder Include="Controls\IconLabelButton\" />
|
<Folder Include="Controls\IconLabelButton\" />
|
||||||
<Folder Include="Controls\PasswordStrengthProgressBar\" />
|
<Folder Include="Controls\PasswordStrengthProgressBar\" />
|
||||||
<Folder Include="Utilities\Automation\" />
|
<Folder Include="Utilities\Automation\" />
|
||||||
<Folder Include="Utilities\Prompts\" />
|
|
||||||
<Folder Include="Controls\Settings\" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -435,7 +442,5 @@
|
|||||||
<None Remove="MessagePack.MSBuild.Tasks" />
|
<None Remove="MessagePack.MSBuild.Tasks" />
|
||||||
<None Remove="Controls\PasswordStrengthProgressBar\" />
|
<None Remove="Controls\PasswordStrengthProgressBar\" />
|
||||||
<None Remove="Utilities\Automation\" />
|
<None Remove="Utilities\Automation\" />
|
||||||
<None Remove="Utilities\Prompts\" />
|
|
||||||
<None Remove="Controls\Settings\" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ namespace Bit.App
|
|||||||
_messagingService.Send("showDialogResolve", new Tuple<int, bool>(details.DialogId, confirmed));
|
_messagingService.Send("showDialogResolve", new Tuple<int, bool>(details.DialogId, confirmed));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else if (message.Command == AppHelpers.RESUMED_MESSAGE_COMMAND)
|
else if (message.Command == "resumed")
|
||||||
{
|
{
|
||||||
if (Device.RuntimePlatform == Device.iOS)
|
if (Device.RuntimePlatform == Device.iOS)
|
||||||
{
|
{
|
||||||
@@ -171,11 +171,6 @@ namespace Bit.App
|
|||||||
new NavigationPage(new UpdateTempPasswordPage()));
|
new NavigationPage(new UpdateTempPasswordPage()));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else if (message.Command == Constants.ForceSetPassword)
|
|
||||||
{
|
|
||||||
await Device.InvokeOnMainThreadAsync(() => Application.Current.MainPage.Navigation.PushModalAsync(
|
|
||||||
new NavigationPage(new SetPasswordPage(orgIdentifier: (string)message.Data))));
|
|
||||||
}
|
|
||||||
else if (message.Command == "syncCompleted")
|
else if (message.Command == "syncCompleted")
|
||||||
{
|
{
|
||||||
await _configService.GetAsync(true);
|
await _configService.GetAsync(true);
|
||||||
@@ -370,7 +365,7 @@ namespace Bit.App
|
|||||||
await Device.InvokeOnMainThreadAsync(() =>
|
await Device.InvokeOnMainThreadAsync(() =>
|
||||||
{
|
{
|
||||||
ThemeManager.SetTheme(Current.Resources);
|
ThemeManager.SetTheme(Current.Resources);
|
||||||
_messagingService.Send(ThemeManager.UPDATED_THEME_MESSAGE_KEY);
|
_messagingService.Send("updatedTheme");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ namespace Bit.App.Controls
|
|||||||
|
|
||||||
public bool ShowHostname
|
public bool ShowHostname
|
||||||
{
|
{
|
||||||
get => !string.IsNullOrWhiteSpace(AccountView.Hostname);
|
get => !string.IsNullOrWhiteSpace(AccountView.Hostname) && AccountView.Hostname != "vault.bitwarden.com";
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsActive
|
public bool IsActive
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ namespace Bit.App.Controls
|
|||||||
public bool ShowIconImage
|
public bool ShowIconImage
|
||||||
{
|
{
|
||||||
get => WebsiteIconsEnabled
|
get => WebsiteIconsEnabled
|
||||||
&& !string.IsNullOrWhiteSpace(Cipher.LaunchUri)
|
&& !string.IsNullOrWhiteSpace(Cipher.Login?.Uri)
|
||||||
&& IconImageSource != null;
|
&& IconImageSource != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,7 +41,7 @@ namespace Bit.App.Controls
|
|||||||
{
|
{
|
||||||
if (_iconImageSource == string.Empty) // default value since icon source can return null
|
if (_iconImageSource == string.Empty) // default value since icon source can return null
|
||||||
{
|
{
|
||||||
_iconImageSource = IconImageHelper.GetIconImage(Cipher);
|
_iconImageSource = IconImageHelper.GetLoginIconImage(Cipher);
|
||||||
}
|
}
|
||||||
return _iconImageSource;
|
return _iconImageSource;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Xamarin.Forms;
|
using System;
|
||||||
|
using Xamarin.Forms;
|
||||||
|
|
||||||
namespace Bit.App.Controls
|
namespace Bit.App.Controls
|
||||||
{
|
{
|
||||||
@@ -7,7 +8,6 @@ namespace Bit.App.Controls
|
|||||||
public CustomLabel()
|
public CustomLabel()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public int? FontWeight { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,29 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<ContentView
|
|
||||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
|
||||||
xmlns:controls="clr-namespace:Bit.App.Controls"
|
|
||||||
x:Class="Bit.App.Controls.ExternalLinkItemView"
|
|
||||||
xmlns:core="clr-namespace:Bit.Core;assembly=BitwardenCore"
|
|
||||||
x:Name="_contentView">
|
|
||||||
<ContentView.GestureRecognizers>
|
|
||||||
<TapGestureRecognizer Command="{Binding GoToLinkCommand, Mode=OneWay, Source={x:Reference _contentView}}" />
|
|
||||||
</ContentView.GestureRecognizers>
|
|
||||||
<StackLayout
|
|
||||||
Orientation="Horizontal">
|
|
||||||
<controls:CustomLabel
|
|
||||||
Text="{Binding Title, Mode=OneWay, Source={x:Reference _contentView}}"
|
|
||||||
HorizontalOptions="StartAndExpand"
|
|
||||||
LineBreakMode="TailTruncation" />
|
|
||||||
|
|
||||||
<controls:IconLabel
|
|
||||||
Text="{Binding Source={x:Static core:BitwardenIcons.ShareSquare}}"
|
|
||||||
TextColor="{DynamicResource TextColor}"
|
|
||||||
HorizontalOptions="End"
|
|
||||||
VerticalOptions="Center"
|
|
||||||
AutomationProperties.IsInAccessibleTree="True"
|
|
||||||
AutomationProperties.Name="{Binding Title, Mode=OneWay, Source={x:Reference _contentView}}" />
|
|
||||||
|
|
||||||
</StackLayout>
|
|
||||||
</ContentView>
|
|
||||||
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
using System.Windows.Input;
|
|
||||||
using Xamarin.Forms;
|
|
||||||
|
|
||||||
namespace Bit.App.Controls
|
|
||||||
{
|
|
||||||
public partial class ExternalLinkItemView : ContentView
|
|
||||||
{
|
|
||||||
public static readonly BindableProperty TitleProperty = BindableProperty.Create(
|
|
||||||
nameof(Title), typeof(string), typeof(ExternalLinkItemView), null, BindingMode.OneWay);
|
|
||||||
|
|
||||||
public static readonly BindableProperty GoToLinkCommandProperty = BindableProperty.Create(
|
|
||||||
nameof(GoToLinkCommand), typeof(ICommand), typeof(ExternalLinkItemView));
|
|
||||||
|
|
||||||
public ExternalLinkItemView()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
|
|
||||||
public string Title
|
|
||||||
{
|
|
||||||
get { return (string)GetValue(TitleProperty); }
|
|
||||||
set { SetValue(TitleProperty, value); }
|
|
||||||
}
|
|
||||||
|
|
||||||
public ICommand GoToLinkCommand
|
|
||||||
{
|
|
||||||
get => GetValue(GoToLinkCommandProperty) as ICommand;
|
|
||||||
set => SetValue(GoToLinkCommandProperty, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
using System.Runtime.CompilerServices;
|
|
||||||
using Bit.App.Utilities;
|
|
||||||
using Xamarin.Forms;
|
|
||||||
|
|
||||||
namespace Bit.App.Controls
|
|
||||||
{
|
|
||||||
public class BaseSettingItemView : ContentView
|
|
||||||
{
|
|
||||||
public static readonly BindableProperty TitleProperty = BindableProperty.Create(
|
|
||||||
nameof(Title), typeof(string), typeof(SwitchItemView), null);
|
|
||||||
|
|
||||||
public static readonly BindableProperty SubtitleProperty = BindableProperty.Create(
|
|
||||||
nameof(Subtitle), typeof(string), typeof(SwitchItemView), null);
|
|
||||||
|
|
||||||
public string Title
|
|
||||||
{
|
|
||||||
get { return (string)GetValue(TitleProperty); }
|
|
||||||
set { SetValue(TitleProperty, value); }
|
|
||||||
}
|
|
||||||
|
|
||||||
public string Subtitle
|
|
||||||
{
|
|
||||||
get { return (string)GetValue(SubtitleProperty); }
|
|
||||||
set { SetValue(SubtitleProperty, value); }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<controls:BaseSettingItemView
|
|
||||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
|
||||||
xmlns:controls="clr-namespace:Bit.App.Controls"
|
|
||||||
x:Class="Bit.App.Controls.SettingChooserItemView"
|
|
||||||
x:Name="_contentView"
|
|
||||||
ControlTemplate="{StaticResource SettingControlTemplate}">
|
|
||||||
<controls:BaseSettingItemView.GestureRecognizers>
|
|
||||||
<TapGestureRecognizer Command="{Binding ChooseCommand, Mode=OneWay, Source={x:Reference _contentView}}" />
|
|
||||||
</controls:BaseSettingItemView.GestureRecognizers>
|
|
||||||
|
|
||||||
<controls:CustomLabel
|
|
||||||
Text="{Binding DisplayValue, Source={x:Reference _contentView}}"
|
|
||||||
HorizontalTextAlignment="End"
|
|
||||||
TextColor="{DynamicResource MutedColor}"
|
|
||||||
StyleClass="list-sub" />
|
|
||||||
|
|
||||||
</controls:BaseSettingItemView>
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
using System.Windows.Input;
|
|
||||||
using Xamarin.Forms;
|
|
||||||
|
|
||||||
namespace Bit.App.Controls
|
|
||||||
{
|
|
||||||
public partial class SettingChooserItemView : BaseSettingItemView
|
|
||||||
{
|
|
||||||
public static readonly BindableProperty DisplayValueProperty = BindableProperty.Create(
|
|
||||||
nameof(DisplayValue), typeof(string), typeof(SettingChooserItemView), null);
|
|
||||||
|
|
||||||
public static readonly BindableProperty ChooseCommandProperty = BindableProperty.Create(
|
|
||||||
nameof(ChooseCommand), typeof(ICommand), typeof(ExternalLinkItemView));
|
|
||||||
|
|
||||||
public string DisplayValue
|
|
||||||
{
|
|
||||||
get { return (string)GetValue(DisplayValueProperty); }
|
|
||||||
set { SetValue(DisplayValueProperty, value); }
|
|
||||||
}
|
|
||||||
|
|
||||||
public SettingChooserItemView()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
|
|
||||||
public ICommand ChooseCommand
|
|
||||||
{
|
|
||||||
get => GetValue(ChooseCommandProperty) as ICommand;
|
|
||||||
set => SetValue(ChooseCommandProperty, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<controls:BaseSettingItemView
|
|
||||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
|
||||||
xmlns:controls="clr-namespace:Bit.App.Controls"
|
|
||||||
x:Class="Bit.App.Controls.SwitchItemView"
|
|
||||||
x:Name="_contentView"
|
|
||||||
ControlTemplate="{StaticResource SettingControlTemplate}">
|
|
||||||
<controls:BaseSettingItemView.GestureRecognizers>
|
|
||||||
<TapGestureRecognizer Tapped="ContentView_Tapped" />
|
|
||||||
</controls:BaseSettingItemView.GestureRecognizers>
|
|
||||||
|
|
||||||
<Switch
|
|
||||||
x:Name="_switch"
|
|
||||||
HeightRequest="20"
|
|
||||||
Scale="{OnPlatform iOS=0.8, Android=1}"
|
|
||||||
IsToggled="{Binding IsToggled, Mode=TwoWay, Source={x:Reference _contentView}}"
|
|
||||||
AutomationId="{Binding SwitchAutomationId, Mode=OneWay, Source={x:Reference _contentView}}"/>
|
|
||||||
</controls:BaseSettingItemView>
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
using System.Windows.Input;
|
|
||||||
using Xamarin.Forms;
|
|
||||||
|
|
||||||
namespace Bit.App.Controls
|
|
||||||
{
|
|
||||||
public partial class SwitchItemView : BaseSettingItemView
|
|
||||||
{
|
|
||||||
public static readonly BindableProperty IsToggledProperty = BindableProperty.Create(
|
|
||||||
nameof(IsToggled), typeof(bool), typeof(SwitchItemView), null, BindingMode.TwoWay);
|
|
||||||
|
|
||||||
public static readonly BindableProperty SwitchAutomationIdProperty = BindableProperty.Create(
|
|
||||||
nameof(SwitchAutomationId), typeof(string), typeof(SwitchItemView), null, BindingMode.OneWay);
|
|
||||||
|
|
||||||
public static readonly BindableProperty ToggleSwitchCommandProperty = BindableProperty.Create(
|
|
||||||
nameof(ToggleSwitchCommand), typeof(ICommand), typeof(ExternalLinkItemView));
|
|
||||||
|
|
||||||
public SwitchItemView()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsToggled
|
|
||||||
{
|
|
||||||
get { return (bool)GetValue(IsToggledProperty); }
|
|
||||||
set { SetValue(IsToggledProperty, value); }
|
|
||||||
}
|
|
||||||
|
|
||||||
public string SwitchAutomationId
|
|
||||||
{
|
|
||||||
get { return (string)GetValue(SwitchAutomationIdProperty); }
|
|
||||||
set { SetValue(SwitchAutomationIdProperty, value); }
|
|
||||||
}
|
|
||||||
|
|
||||||
public ICommand ToggleSwitchCommand
|
|
||||||
{
|
|
||||||
get => GetValue(ToggleSwitchCommandProperty) as ICommand;
|
|
||||||
set => SetValue(ToggleSwitchCommandProperty, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ContentView_Tapped(System.Object sender, System.EventArgs e)
|
|
||||||
{
|
|
||||||
_switch.IsToggled = !_switch.IsToggled;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -3,7 +3,7 @@ using System.Threading.Tasks;
|
|||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using Bit.App.Resources;
|
using Bit.App.Resources;
|
||||||
using Bit.Core.Abstractions;
|
using Bit.Core.Abstractions;
|
||||||
using Bit.Core.Enums;
|
using Bit.Core.Models.Data;
|
||||||
using Bit.Core.Utilities;
|
using Bit.Core.Utilities;
|
||||||
using Xamarin.CommunityToolkit.ObjectModel;
|
using Xamarin.CommunityToolkit.ObjectModel;
|
||||||
|
|
||||||
@@ -19,25 +19,14 @@ namespace Bit.App.Pages
|
|||||||
_environmentService = ServiceContainer.Resolve<IEnvironmentService>("environmentService");
|
_environmentService = ServiceContainer.Resolve<IEnvironmentService>("environmentService");
|
||||||
|
|
||||||
PageTitle = AppResources.Settings;
|
PageTitle = AppResources.Settings;
|
||||||
SubmitCommand = new AsyncCommand(SubmitAsync, onException: ex => OnSubmitException(ex), allowsMultipleExecutions: false);
|
BaseUrl = _environmentService.BaseUrl == EnvironmentUrlData.DefaultEU.Base || EnvironmentUrlData.DefaultUS.Base == _environmentService.BaseUrl ?
|
||||||
Init();
|
string.Empty : _environmentService.BaseUrl;
|
||||||
}
|
|
||||||
|
|
||||||
public void Init()
|
|
||||||
{
|
|
||||||
if (_environmentService.SelectedRegion != Region.SelfHosted ||
|
|
||||||
_environmentService.BaseUrl == Region.US.BaseUrl() ||
|
|
||||||
_environmentService.BaseUrl == Region.EU.BaseUrl())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
BaseUrl = _environmentService.BaseUrl;
|
|
||||||
WebVaultUrl = _environmentService.WebVaultUrl;
|
WebVaultUrl = _environmentService.WebVaultUrl;
|
||||||
ApiUrl = _environmentService.ApiUrl;
|
ApiUrl = _environmentService.ApiUrl;
|
||||||
IdentityUrl = _environmentService.IdentityUrl;
|
IdentityUrl = _environmentService.IdentityUrl;
|
||||||
IconsUrl = _environmentService.IconsUrl;
|
IconsUrl = _environmentService.IconsUrl;
|
||||||
NotificationsUrls = _environmentService.NotificationsUrl;
|
NotificationsUrls = _environmentService.NotificationsUrl;
|
||||||
|
SubmitCommand = new AsyncCommand(SubmitAsync, onException: ex => OnSubmitException(ex), allowsMultipleExecutions: false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ICommand SubmitCommand { get; }
|
public ICommand SubmitCommand { get; }
|
||||||
@@ -57,7 +46,8 @@ namespace Bit.App.Pages
|
|||||||
await Page.DisplayAlert(AppResources.AnErrorHasOccurred, AppResources.EnvironmentPageUrlsError, AppResources.Ok);
|
await Page.DisplayAlert(AppResources.AnErrorHasOccurred, AppResources.EnvironmentPageUrlsError, AppResources.Ok);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var urls = new Core.Models.Data.EnvironmentUrlData
|
|
||||||
|
var resUrls = await _environmentService.SetUrlsAsync(new Core.Models.Data.EnvironmentUrlData
|
||||||
{
|
{
|
||||||
Base = BaseUrl,
|
Base = BaseUrl,
|
||||||
Api = ApiUrl,
|
Api = ApiUrl,
|
||||||
@@ -65,8 +55,7 @@ namespace Bit.App.Pages
|
|||||||
WebVault = WebVaultUrl,
|
WebVault = WebVaultUrl,
|
||||||
Icons = IconsUrl,
|
Icons = IconsUrl,
|
||||||
Notifications = NotificationsUrls
|
Notifications = NotificationsUrls
|
||||||
};
|
});
|
||||||
var resUrls = await _environmentService.SetRegionAsync(urls.Region, urls);
|
|
||||||
|
|
||||||
// re-set urls since service can change them, ex: prefixing https://
|
// re-set urls since service can change them, ex: prefixing https://
|
||||||
BaseUrl = resUrls.Base;
|
BaseUrl = resUrls.Base;
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ namespace Bit.App.Pages
|
|||||||
}
|
}
|
||||||
_broadcasterService.Subscribe(nameof(HomePage), (message) =>
|
_broadcasterService.Subscribe(nameof(HomePage), (message) =>
|
||||||
{
|
{
|
||||||
if (message.Command is ThemeManager.UPDATED_THEME_MESSAGE_KEY)
|
if (message.Command == "updatedTheme")
|
||||||
{
|
{
|
||||||
Device.BeginInvokeOnMainThread(() =>
|
Device.BeginInvokeOnMainThread(() =>
|
||||||
{
|
{
|
||||||
@@ -74,7 +74,7 @@ namespace Bit.App.Pages
|
|||||||
});
|
});
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await _vm.UpdateEnvironmentAsync();
|
await _vm.UpdateEnvironment();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,21 +3,21 @@ using System.Threading.Tasks;
|
|||||||
using Bit.App.Abstractions;
|
using Bit.App.Abstractions;
|
||||||
using Bit.App.Controls;
|
using Bit.App.Controls;
|
||||||
using Bit.App.Resources;
|
using Bit.App.Resources;
|
||||||
using Bit.App.Styles;
|
|
||||||
using Bit.App.Utilities;
|
using Bit.App.Utilities;
|
||||||
using Bit.Core;
|
using Bit.Core;
|
||||||
using Bit.Core.Abstractions;
|
using Bit.Core.Abstractions;
|
||||||
using Bit.Core.Models.Data;
|
using Bit.Core.Models.Data;
|
||||||
|
using Bit.Core.Models.Response;
|
||||||
|
using Bit.Core.Services;
|
||||||
using Bit.Core.Utilities;
|
using Bit.Core.Utilities;
|
||||||
using Xamarin.CommunityToolkit.ObjectModel;
|
using Xamarin.CommunityToolkit.ObjectModel;
|
||||||
|
using Xamarin.Essentials;
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
using BwRegion = Bit.Core.Enums.Region;
|
|
||||||
|
|
||||||
namespace Bit.App.Pages
|
namespace Bit.App.Pages
|
||||||
{
|
{
|
||||||
public class HomeViewModel : BaseViewModel
|
public class HomeViewModel : BaseViewModel
|
||||||
{
|
{
|
||||||
|
|
||||||
private readonly IStateService _stateService;
|
private readonly IStateService _stateService;
|
||||||
private readonly IMessagingService _messagingService;
|
private readonly IMessagingService _messagingService;
|
||||||
private readonly IPlatformUtilsService _platformUtilsService;
|
private readonly IPlatformUtilsService _platformUtilsService;
|
||||||
@@ -30,6 +30,8 @@ namespace Bit.App.Pages
|
|||||||
private bool _rememberEmail;
|
private bool _rememberEmail;
|
||||||
private string _email;
|
private string _email;
|
||||||
private string _selectedEnvironmentName;
|
private string _selectedEnvironmentName;
|
||||||
|
private bool _isEmailEnabled;
|
||||||
|
private bool _canLogin;
|
||||||
private bool _displayEuEnvironment;
|
private bool _displayEuEnvironment;
|
||||||
|
|
||||||
public HomeViewModel()
|
public HomeViewModel()
|
||||||
@@ -84,7 +86,7 @@ namespace Bit.App.Pages
|
|||||||
set => SetProperty(ref _selectedEnvironmentName, value);
|
set => SetProperty(ref _selectedEnvironmentName, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string RegionText => $"{AppResources.LoggingInOn}:";
|
public string RegionText => $"{AppResources.Region}:";
|
||||||
public bool CanContinue => !string.IsNullOrEmpty(Email);
|
public bool CanContinue => !string.IsNullOrEmpty(Email);
|
||||||
|
|
||||||
public FormattedString CreateAccountText
|
public FormattedString CreateAccountText
|
||||||
@@ -165,12 +167,12 @@ namespace Bit.App.Pages
|
|||||||
{
|
{
|
||||||
_displayEuEnvironment = await _configService.GetFeatureFlagBoolAsync(Constants.DisplayEuEnvironmentFlag);
|
_displayEuEnvironment = await _configService.GetFeatureFlagBoolAsync(Constants.DisplayEuEnvironmentFlag);
|
||||||
var options = _displayEuEnvironment
|
var options = _displayEuEnvironment
|
||||||
? new string[] { BwRegion.US.Domain(), BwRegion.EU.Domain(), AppResources.SelfHosted }
|
? new string[] { AppResources.US, AppResources.EU, AppResources.SelfHosted }
|
||||||
: new string[] { BwRegion.US.Domain(), AppResources.SelfHosted };
|
: new string[] { AppResources.US, AppResources.SelfHosted };
|
||||||
|
|
||||||
await Device.InvokeOnMainThreadAsync(async () =>
|
await Device.InvokeOnMainThreadAsync(async () =>
|
||||||
{
|
{
|
||||||
var result = await Page.DisplayActionSheet(AppResources.LoggingInOn, AppResources.Cancel, null, options);
|
var result = await Page.DisplayActionSheet(AppResources.DataRegion, AppResources.Cancel, null, options);
|
||||||
|
|
||||||
if (result is null || result == AppResources.Cancel)
|
if (result is null || result == AppResources.Cancel)
|
||||||
{
|
{
|
||||||
@@ -183,23 +185,35 @@ namespace Bit.App.Pages
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await _environmentService.SetRegionAsync(result == BwRegion.EU.Domain() ? BwRegion.EU : BwRegion.US);
|
await _environmentService.SetUrlsAsync(result == AppResources.EU ? EnvironmentUrlData.DefaultEU : EnvironmentUrlData.DefaultUS);
|
||||||
await _configService.GetAsync(true);
|
await _configService.GetAsync(true);
|
||||||
SelectedEnvironmentName = result;
|
SelectedEnvironmentName = result;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task UpdateEnvironmentAsync()
|
public async Task UpdateEnvironment()
|
||||||
{
|
{
|
||||||
var region = _environmentService.SelectedRegion;
|
var environmentsSaved = await _stateService.GetPreAuthEnvironmentUrlsAsync();
|
||||||
if (region == BwRegion.SelfHosted)
|
if (environmentsSaved == null || environmentsSaved.IsEmpty)
|
||||||
{
|
{
|
||||||
SelectedEnvironmentName = AppResources.SelfHosted;
|
await _environmentService.SetUrlsAsync(EnvironmentUrlData.DefaultUS);
|
||||||
await _configService.GetAsync(true);
|
environmentsSaved = EnvironmentUrlData.DefaultUS;
|
||||||
|
SelectedEnvironmentName = AppResources.US;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (environmentsSaved.Base == EnvironmentUrlData.DefaultUS.Base)
|
||||||
|
{
|
||||||
|
SelectedEnvironmentName = AppResources.US;
|
||||||
|
}
|
||||||
|
else if (environmentsSaved.Base == EnvironmentUrlData.DefaultEU.Base)
|
||||||
|
{
|
||||||
|
SelectedEnvironmentName = AppResources.EU;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SelectedEnvironmentName = region.Domain();
|
await _configService.GetAsync(true);
|
||||||
|
SelectedEnvironmentName = AppResources.SelfHosted;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@
|
|||||||
<StackLayout StyleClass="box">
|
<StackLayout StyleClass="box">
|
||||||
<Grid
|
<Grid
|
||||||
StyleClass="box-row"
|
StyleClass="box-row"
|
||||||
IsVisible="{Binding PinEnabled}"
|
IsVisible="{Binding PinLock}"
|
||||||
Padding="0, 10, 0, 0">
|
Padding="0, 10, 0, 0">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
@@ -89,7 +89,7 @@
|
|||||||
<Grid
|
<Grid
|
||||||
x:Name="_passwordGrid"
|
x:Name="_passwordGrid"
|
||||||
StyleClass="box-row"
|
StyleClass="box-row"
|
||||||
IsVisible="{Binding PinEnabled, Converter={StaticResource inverseBool}}"
|
IsVisible="{Binding PinLock, Converter={StaticResource inverseBool}}"
|
||||||
Padding="0, 10, 0, 0">
|
Padding="0, 10, 0, 0">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
|
|||||||
@@ -20,14 +20,13 @@ namespace Bit.App.Pages
|
|||||||
private bool _promptedAfterResume;
|
private bool _promptedAfterResume;
|
||||||
private bool _appeared;
|
private bool _appeared;
|
||||||
|
|
||||||
public LockPage(AppOptions appOptions = null, bool autoPromptBiometric = true, bool checkPendingAuthRequests = true)
|
public LockPage(AppOptions appOptions = null, bool autoPromptBiometric = true)
|
||||||
{
|
{
|
||||||
_appOptions = appOptions;
|
_appOptions = appOptions;
|
||||||
_autoPromptBiometric = autoPromptBiometric;
|
_autoPromptBiometric = autoPromptBiometric;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_broadcasterService = ServiceContainer.Resolve<IBroadcasterService>();
|
_broadcasterService = ServiceContainer.Resolve<IBroadcasterService>();
|
||||||
_vm = BindingContext as LockPageViewModel;
|
_vm = BindingContext as LockPageViewModel;
|
||||||
_vm.CheckPendingAuthRequests = checkPendingAuthRequests;
|
|
||||||
_vm.Page = this;
|
_vm.Page = this;
|
||||||
_vm.UnlockedAction = () => Device.BeginInvokeOnMainThread(async () => await UnlockedAsync());
|
_vm.UnlockedAction = () => Device.BeginInvokeOnMainThread(async () => await UnlockedAsync());
|
||||||
|
|
||||||
@@ -45,7 +44,7 @@ namespace Bit.App.Pages
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (_vm?.PinEnabled ?? false)
|
if (_vm?.PinLock ?? false)
|
||||||
{
|
{
|
||||||
return _pin;
|
return _pin;
|
||||||
}
|
}
|
||||||
@@ -55,7 +54,7 @@ namespace Bit.App.Pages
|
|||||||
|
|
||||||
public async Task PromptBiometricAfterResumeAsync()
|
public async Task PromptBiometricAfterResumeAsync()
|
||||||
{
|
{
|
||||||
if (_vm.BiometricEnabled)
|
if (_vm.BiometricLock)
|
||||||
{
|
{
|
||||||
await Task.Delay(500);
|
await Task.Delay(500);
|
||||||
if (!_promptedAfterResume)
|
if (!_promptedAfterResume)
|
||||||
@@ -92,13 +91,13 @@ namespace Bit.App.Pages
|
|||||||
|
|
||||||
_vm.FocusSecretEntry += PerformFocusSecretEntry;
|
_vm.FocusSecretEntry += PerformFocusSecretEntry;
|
||||||
|
|
||||||
if (!_vm.BiometricEnabled)
|
if (!_vm.BiometricLock)
|
||||||
{
|
{
|
||||||
RequestFocus(SecretEntry);
|
RequestFocus(SecretEntry);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!_vm.HasMasterPassword && !_vm.PinEnabled)
|
if (_vm.UsingKeyConnector && !_vm.PinLock)
|
||||||
{
|
{
|
||||||
_passwordGrid.IsVisible = false;
|
_passwordGrid.IsVisible = false;
|
||||||
_unlockButton.IsVisible = false;
|
_unlockButton.IsVisible = false;
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ using Bit.App.Utilities;
|
|||||||
using Bit.Core;
|
using Bit.Core;
|
||||||
using Bit.Core.Abstractions;
|
using Bit.Core.Abstractions;
|
||||||
using Bit.Core.Enums;
|
using Bit.Core.Enums;
|
||||||
using Bit.Core.Exceptions;
|
|
||||||
using Bit.Core.Models.Domain;
|
using Bit.Core.Models.Domain;
|
||||||
using Bit.Core.Models.Request;
|
using Bit.Core.Models.Request;
|
||||||
using Bit.Core.Services;
|
using Bit.Core.Services;
|
||||||
@@ -28,27 +27,27 @@ namespace Bit.App.Pages
|
|||||||
private readonly IEnvironmentService _environmentService;
|
private readonly IEnvironmentService _environmentService;
|
||||||
private readonly IStateService _stateService;
|
private readonly IStateService _stateService;
|
||||||
private readonly IBiometricService _biometricService;
|
private readonly IBiometricService _biometricService;
|
||||||
private readonly IUserVerificationService _userVerificationService;
|
private readonly IKeyConnectorService _keyConnectorService;
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IWatchDeviceService _watchDeviceService;
|
private readonly IWatchDeviceService _watchDeviceService;
|
||||||
private readonly WeakEventManager<int?> _secretEntryFocusWeakEventManager = new WeakEventManager<int?>();
|
private readonly WeakEventManager<int?> _secretEntryFocusWeakEventManager = new WeakEventManager<int?>();
|
||||||
private readonly IPolicyService _policyService;
|
private readonly IPolicyService _policyService;
|
||||||
private readonly IPasswordGenerationService _passwordGenerationService;
|
private readonly IPasswordGenerationService _passwordGenerationService;
|
||||||
private IDeviceTrustCryptoService _deviceTrustCryptoService;
|
|
||||||
private readonly ISyncService _syncService;
|
|
||||||
private string _email;
|
private string _email;
|
||||||
private string _masterPassword;
|
private string _masterPassword;
|
||||||
private string _pin;
|
private string _pin;
|
||||||
private bool _showPassword;
|
private bool _showPassword;
|
||||||
private PinLockType _pinStatus;
|
private bool _pinLock;
|
||||||
private bool _pinEnabled;
|
private bool _biometricLock;
|
||||||
private bool _biometricEnabled;
|
|
||||||
private bool _biometricIntegrityValid = true;
|
private bool _biometricIntegrityValid = true;
|
||||||
private bool _biometricButtonVisible;
|
private bool _biometricButtonVisible;
|
||||||
private bool _hasMasterPassword;
|
private bool _usingKeyConnector;
|
||||||
private string _biometricButtonText;
|
private string _biometricButtonText;
|
||||||
private string _loggedInAsText;
|
private string _loggedInAsText;
|
||||||
private string _lockedVerifyText;
|
private string _lockedVerifyText;
|
||||||
|
private bool _isPinProtected;
|
||||||
|
private bool _isPinProtectedWithKey;
|
||||||
|
|
||||||
public LockPageViewModel()
|
public LockPageViewModel()
|
||||||
{
|
{
|
||||||
@@ -61,20 +60,17 @@ namespace Bit.App.Pages
|
|||||||
_environmentService = ServiceContainer.Resolve<IEnvironmentService>("environmentService");
|
_environmentService = ServiceContainer.Resolve<IEnvironmentService>("environmentService");
|
||||||
_stateService = ServiceContainer.Resolve<IStateService>("stateService");
|
_stateService = ServiceContainer.Resolve<IStateService>("stateService");
|
||||||
_biometricService = ServiceContainer.Resolve<IBiometricService>("biometricService");
|
_biometricService = ServiceContainer.Resolve<IBiometricService>("biometricService");
|
||||||
_userVerificationService = ServiceContainer.Resolve<IUserVerificationService>();
|
_keyConnectorService = ServiceContainer.Resolve<IKeyConnectorService>("keyConnectorService");
|
||||||
_logger = ServiceContainer.Resolve<ILogger>("logger");
|
_logger = ServiceContainer.Resolve<ILogger>("logger");
|
||||||
_watchDeviceService = ServiceContainer.Resolve<IWatchDeviceService>();
|
_watchDeviceService = ServiceContainer.Resolve<IWatchDeviceService>();
|
||||||
_policyService = ServiceContainer.Resolve<IPolicyService>();
|
_policyService = ServiceContainer.Resolve<IPolicyService>();
|
||||||
_passwordGenerationService = ServiceContainer.Resolve<IPasswordGenerationService>();
|
_passwordGenerationService = ServiceContainer.Resolve<IPasswordGenerationService>();
|
||||||
_deviceTrustCryptoService = ServiceContainer.Resolve<IDeviceTrustCryptoService>();
|
|
||||||
_syncService = ServiceContainer.Resolve<ISyncService>();
|
|
||||||
|
|
||||||
PageTitle = AppResources.VerifyMasterPassword;
|
PageTitle = AppResources.VerifyMasterPassword;
|
||||||
TogglePasswordCommand = new Command(TogglePassword);
|
TogglePasswordCommand = new Command(TogglePassword);
|
||||||
SubmitCommand = new Command(async () => await SubmitAsync());
|
SubmitCommand = new Command(async () => await SubmitAsync());
|
||||||
|
|
||||||
AccountSwitchingOverlayViewModel =
|
AccountSwitchingOverlayViewModel = new AccountSwitchingOverlayViewModel(_stateService, _messagingService, _logger)
|
||||||
new AccountSwitchingOverlayViewModel(_stateService, _messagingService, _logger)
|
|
||||||
{
|
{
|
||||||
AllowAddAccountRow = true,
|
AllowAddAccountRow = true,
|
||||||
AllowActiveAccountSelection = true
|
AllowActiveAccountSelection = true
|
||||||
@@ -104,21 +100,21 @@ namespace Bit.App.Pages
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool PinEnabled
|
public bool PinLock
|
||||||
{
|
{
|
||||||
get => _pinEnabled;
|
get => _pinLock;
|
||||||
set => SetProperty(ref _pinEnabled, value);
|
set => SetProperty(ref _pinLock, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool HasMasterPassword
|
public bool UsingKeyConnector
|
||||||
{
|
{
|
||||||
get => _hasMasterPassword;
|
get => _usingKeyConnector;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool BiometricEnabled
|
public bool BiometricLock
|
||||||
{
|
{
|
||||||
get => _biometricEnabled;
|
get => _biometricLock;
|
||||||
set => SetProperty(ref _biometricEnabled, value);
|
set => SetProperty(ref _biometricLock, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool BiometricIntegrityValid
|
public bool BiometricIntegrityValid
|
||||||
@@ -151,18 +147,12 @@ namespace Bit.App.Pages
|
|||||||
set => SetProperty(ref _lockedVerifyText, value);
|
set => SetProperty(ref _lockedVerifyText, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CheckPendingAuthRequests { get; set; }
|
|
||||||
|
|
||||||
public AccountSwitchingOverlayViewModel AccountSwitchingOverlayViewModel { get; }
|
public AccountSwitchingOverlayViewModel AccountSwitchingOverlayViewModel { get; }
|
||||||
|
|
||||||
public Command SubmitCommand { get; }
|
public Command SubmitCommand { get; }
|
||||||
public Command TogglePasswordCommand { get; }
|
public Command TogglePasswordCommand { get; }
|
||||||
|
|
||||||
public string ShowPasswordIcon => ShowPassword ? BitwardenIcons.EyeSlash : BitwardenIcons.Eye;
|
public string ShowPasswordIcon => ShowPassword ? BitwardenIcons.EyeSlash : BitwardenIcons.Eye;
|
||||||
public string PasswordVisibilityAccessibilityText => ShowPassword
|
public string PasswordVisibilityAccessibilityText => ShowPassword ? AppResources.PasswordIsVisibleTapToHide : AppResources.PasswordIsNotVisibleTapToShow;
|
||||||
? AppResources.PasswordIsVisibleTapToHide
|
|
||||||
: AppResources.PasswordIsNotVisibleTapToShow;
|
|
||||||
|
|
||||||
public Action UnlockedAction { get; set; }
|
public Action UnlockedAction { get; set; }
|
||||||
public event Action<int?> FocusSecretEntry
|
public event Action<int?> FocusSecretEntry
|
||||||
{
|
{
|
||||||
@@ -172,33 +162,18 @@ namespace Bit.App.Pages
|
|||||||
|
|
||||||
public async Task InitAsync()
|
public async Task InitAsync()
|
||||||
{
|
{
|
||||||
var pendingRequest = await _stateService.GetPendingAdminAuthRequestAsync();
|
(_isPinProtected, _isPinProtectedWithKey) = await _vaultTimeoutService.IsPinLockSetAsync();
|
||||||
if (pendingRequest != null && CheckPendingAuthRequests)
|
PinLock = (_isPinProtected && await _stateService.GetPinProtectedKeyAsync() != null) ||
|
||||||
|
_isPinProtectedWithKey;
|
||||||
|
BiometricLock = await _vaultTimeoutService.IsBiometricLockSetAsync() && await _cryptoService.HasKeyAsync();
|
||||||
|
|
||||||
|
// Users with key connector and without biometric or pin has no MP to unlock with
|
||||||
|
_usingKeyConnector = await _keyConnectorService.GetUsesKeyConnector();
|
||||||
|
if (_usingKeyConnector && !(BiometricLock || PinLock))
|
||||||
{
|
{
|
||||||
await _vaultTimeoutService.LogOutAsync();
|
await _vaultTimeoutService.LogOutAsync();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_pinStatus = await _vaultTimeoutService.GetPinLockTypeAsync();
|
|
||||||
|
|
||||||
var ephemeralPinSet = await _stateService.GetPinKeyEncryptedUserKeyEphemeralAsync()
|
|
||||||
?? await _stateService.GetPinProtectedKeyAsync();
|
|
||||||
PinEnabled = (_pinStatus == PinLockType.Transient && ephemeralPinSet != null) ||
|
|
||||||
_pinStatus == PinLockType.Persistent;
|
|
||||||
|
|
||||||
BiometricEnabled = await IsBiometricsEnabledAsync();
|
|
||||||
|
|
||||||
// Users without MP and without biometric or pin has no MP to unlock with
|
|
||||||
_hasMasterPassword = await _userVerificationService.HasMasterPasswordAsync();
|
|
||||||
if (await _stateService.IsAuthenticatedAsync()
|
|
||||||
&& !_hasMasterPassword
|
|
||||||
&& !BiometricEnabled
|
|
||||||
&& !PinEnabled)
|
|
||||||
{
|
|
||||||
await _vaultTimeoutService.LogOutAsync();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_email = await _stateService.GetEmailAsync();
|
_email = await _stateService.GetEmailAsync();
|
||||||
if (string.IsNullOrWhiteSpace(_email))
|
if (string.IsNullOrWhiteSpace(_email))
|
||||||
{
|
{
|
||||||
@@ -206,22 +181,33 @@ namespace Bit.App.Pages
|
|||||||
_logger.Exception(new NullReferenceException("Email not found in storage"));
|
_logger.Exception(new NullReferenceException("Email not found in storage"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
var webVault = _environmentService.GetWebVaultUrl(true);
|
||||||
LoggedInAsText = string.Format(AppResources.LoggedInAsOn, _email, _environmentService.GetCurrentDomain());
|
if (string.IsNullOrWhiteSpace(webVault))
|
||||||
if (PinEnabled)
|
{
|
||||||
|
webVault = "https://bitwarden.com";
|
||||||
|
}
|
||||||
|
var webVaultHostname = CoreHelpers.GetHostname(webVault);
|
||||||
|
LoggedInAsText = string.Format(AppResources.LoggedInAsOn, _email, webVaultHostname);
|
||||||
|
if (PinLock)
|
||||||
{
|
{
|
||||||
PageTitle = AppResources.VerifyPIN;
|
PageTitle = AppResources.VerifyPIN;
|
||||||
LockedVerifyText = AppResources.VaultLockedPIN;
|
LockedVerifyText = AppResources.VaultLockedPIN;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PageTitle = _hasMasterPassword ? AppResources.VerifyMasterPassword : AppResources.UnlockVault;
|
if (_usingKeyConnector)
|
||||||
LockedVerifyText = _hasMasterPassword
|
{
|
||||||
? AppResources.VaultLockedMasterPassword
|
PageTitle = AppResources.UnlockVault;
|
||||||
: AppResources.VaultLockedIdentity;
|
LockedVerifyText = AppResources.VaultLockedIdentity;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PageTitle = AppResources.VerifyMasterPassword;
|
||||||
|
LockedVerifyText = AppResources.VaultLockedMasterPassword;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BiometricEnabled)
|
if (BiometricLock)
|
||||||
{
|
{
|
||||||
BiometricIntegrityValid = await _platformUtilsService.IsBiometricIntegrityValidAsync();
|
BiometricIntegrityValid = await _platformUtilsService.IsBiometricIntegrityValidAsync();
|
||||||
if (!_biometricIntegrityValid)
|
if (!_biometricIntegrityValid)
|
||||||
@@ -237,98 +223,59 @@ namespace Bit.App.Pages
|
|||||||
BiometricButtonText = supportsFace ? AppResources.UseFaceIDToUnlock :
|
BiometricButtonText = supportsFace ? AppResources.UseFaceIDToUnlock :
|
||||||
AppResources.UseFingerprintToUnlock;
|
AppResources.UseFingerprintToUnlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task SubmitAsync()
|
public async Task SubmitAsync()
|
||||||
{
|
{
|
||||||
ShowPassword = false;
|
if (PinLock && string.IsNullOrWhiteSpace(Pin))
|
||||||
try
|
|
||||||
{
|
|
||||||
var kdfConfig = await _stateService.GetActiveUserCustomDataAsync(a => new KdfConfig(a?.Profile));
|
|
||||||
if (PinEnabled)
|
|
||||||
{
|
|
||||||
await UnlockWithPinAsync(kdfConfig);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
await UnlockWithMasterPasswordAsync(kdfConfig);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (LegacyUserException)
|
|
||||||
{
|
|
||||||
await HandleLegacyUserAsync();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task UnlockWithPinAsync(KdfConfig kdfConfig)
|
|
||||||
{
|
|
||||||
if (PinEnabled && string.IsNullOrWhiteSpace(Pin))
|
|
||||||
{
|
{
|
||||||
await Page.DisplayAlert(AppResources.AnErrorHasOccurred,
|
await Page.DisplayAlert(AppResources.AnErrorHasOccurred,
|
||||||
string.Format(AppResources.ValidationFieldRequired, AppResources.PIN),
|
string.Format(AppResources.ValidationFieldRequired, AppResources.PIN),
|
||||||
AppResources.Ok);
|
AppResources.Ok);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!PinLock && string.IsNullOrWhiteSpace(MasterPassword))
|
||||||
|
{
|
||||||
|
await Page.DisplayAlert(AppResources.AnErrorHasOccurred,
|
||||||
|
string.Format(AppResources.ValidationFieldRequired, AppResources.MasterPassword),
|
||||||
|
AppResources.Ok);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ShowPassword = false;
|
||||||
|
var kdfConfig = await _stateService.GetActiveUserCustomDataAsync(a => new KdfConfig(a?.Profile));
|
||||||
|
|
||||||
|
if (PinLock)
|
||||||
|
{
|
||||||
var failed = true;
|
var failed = true;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
EncString userKeyPin;
|
if (_isPinProtected)
|
||||||
EncString oldPinProtected;
|
|
||||||
switch (_pinStatus)
|
|
||||||
{
|
{
|
||||||
case PinLockType.Persistent:
|
var key = await _cryptoService.MakeKeyFromPinAsync(Pin, _email,
|
||||||
{
|
|
||||||
userKeyPin = await _stateService.GetPinKeyEncryptedUserKeyAsync();
|
|
||||||
var oldEncryptedKey = await _stateService.GetPinProtectedAsync();
|
|
||||||
oldPinProtected = oldEncryptedKey != null ? new EncString(oldEncryptedKey) : null;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case PinLockType.Transient:
|
|
||||||
userKeyPin = await _stateService.GetPinKeyEncryptedUserKeyEphemeralAsync();
|
|
||||||
oldPinProtected = await _stateService.GetPinProtectedKeyAsync();
|
|
||||||
break;
|
|
||||||
case PinLockType.Disabled:
|
|
||||||
default:
|
|
||||||
throw new Exception("Pin is disabled");
|
|
||||||
}
|
|
||||||
|
|
||||||
UserKey userKey;
|
|
||||||
if (oldPinProtected != null)
|
|
||||||
{
|
|
||||||
userKey = await _cryptoService.DecryptAndMigrateOldPinKeyAsync(
|
|
||||||
_pinStatus == PinLockType.Transient,
|
|
||||||
Pin,
|
|
||||||
_email,
|
|
||||||
kdfConfig,
|
kdfConfig,
|
||||||
oldPinProtected
|
await _stateService.GetPinProtectedKeyAsync());
|
||||||
);
|
var encKey = await _cryptoService.GetEncKeyAsync(key);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
userKey = await _cryptoService.DecryptUserKeyWithPinAsync(
|
|
||||||
Pin,
|
|
||||||
_email,
|
|
||||||
kdfConfig,
|
|
||||||
userKeyPin
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
var protectedPin = await _stateService.GetProtectedPinAsync();
|
var protectedPin = await _stateService.GetProtectedPinAsync();
|
||||||
var decryptedPin = await _cryptoService.DecryptToUtf8Async(new EncString(protectedPin), userKey);
|
var decPin = await _cryptoService.DecryptToUtf8Async(new EncString(protectedPin), encKey);
|
||||||
failed = decryptedPin != Pin;
|
failed = decPin != Pin;
|
||||||
if (!failed)
|
if (!failed)
|
||||||
{
|
{
|
||||||
Pin = string.Empty;
|
Pin = string.Empty;
|
||||||
await AppHelpers.ResetInvalidUnlockAttemptsAsync();
|
await AppHelpers.ResetInvalidUnlockAttemptsAsync();
|
||||||
await SetUserKeyAndContinueAsync(userKey);
|
await SetKeyAndContinueAsync(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (LegacyUserException)
|
else
|
||||||
{
|
{
|
||||||
throw;
|
var key = await _cryptoService.MakeKeyFromPinAsync(Pin, _email, kdfConfig);
|
||||||
|
failed = false;
|
||||||
|
Pin = string.Empty;
|
||||||
|
await AppHelpers.ResetInvalidUnlockAttemptsAsync();
|
||||||
|
await SetKeyAndContinueAsync(key);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
@@ -346,38 +293,21 @@ namespace Bit.App.Pages
|
|||||||
AppResources.AnErrorHasOccurred);
|
AppResources.AnErrorHasOccurred);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
private async Task UnlockWithMasterPasswordAsync(KdfConfig kdfConfig)
|
|
||||||
{
|
{
|
||||||
if (!PinEnabled && string.IsNullOrWhiteSpace(MasterPassword))
|
var key = await _cryptoService.MakeKeyAsync(MasterPassword, _email, kdfConfig);
|
||||||
{
|
var storedKeyHash = await _cryptoService.GetKeyHashAsync();
|
||||||
await Page.DisplayAlert(AppResources.AnErrorHasOccurred,
|
|
||||||
string.Format(AppResources.ValidationFieldRequired, AppResources.MasterPassword),
|
|
||||||
AppResources.Ok);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var masterKey = await _cryptoService.MakeMasterKeyAsync(MasterPassword, _email, kdfConfig);
|
|
||||||
if (await _cryptoService.IsLegacyUserAsync(masterKey))
|
|
||||||
{
|
|
||||||
throw new LegacyUserException();
|
|
||||||
}
|
|
||||||
|
|
||||||
var storedKeyHash = await _cryptoService.GetMasterKeyHashAsync();
|
|
||||||
var passwordValid = false;
|
var passwordValid = false;
|
||||||
MasterPasswordPolicyOptions enforcedMasterPasswordOptions = null;
|
MasterPasswordPolicyOptions enforcedMasterPasswordOptions = null;
|
||||||
|
|
||||||
if (storedKeyHash != null)
|
if (storedKeyHash != null)
|
||||||
{
|
{
|
||||||
// Offline unlock possible
|
passwordValid = await _cryptoService.CompareAndUpdateKeyHashAsync(MasterPassword, key);
|
||||||
passwordValid = await _cryptoService.CompareAndUpdateKeyHashAsync(MasterPassword, masterKey);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Online unlock required
|
|
||||||
await _deviceActionService.ShowLoadingAsync(AppResources.Loading);
|
await _deviceActionService.ShowLoadingAsync(AppResources.Loading);
|
||||||
var keyHash = await _cryptoService.HashMasterKeyAsync(MasterPassword, masterKey,
|
var keyHash = await _cryptoService.HashPasswordAsync(MasterPassword, key, HashPurpose.ServerAuthorization);
|
||||||
HashPurpose.ServerAuthorization);
|
|
||||||
var request = new PasswordVerificationRequest();
|
var request = new PasswordVerificationRequest();
|
||||||
request.MasterPasswordHash = keyHash;
|
request.MasterPasswordHash = keyHash;
|
||||||
|
|
||||||
@@ -386,9 +316,8 @@ namespace Bit.App.Pages
|
|||||||
var response = await _apiService.PostAccountVerifyPasswordAsync(request);
|
var response = await _apiService.PostAccountVerifyPasswordAsync(request);
|
||||||
enforcedMasterPasswordOptions = response.MasterPasswordPolicy;
|
enforcedMasterPasswordOptions = response.MasterPasswordPolicy;
|
||||||
passwordValid = true;
|
passwordValid = true;
|
||||||
var localKeyHash = await _cryptoService.HashMasterKeyAsync(MasterPassword, masterKey,
|
var localKeyHash = await _cryptoService.HashPasswordAsync(MasterPassword, key, HashPurpose.LocalAuthorization);
|
||||||
HashPurpose.LocalAuthorization);
|
await _cryptoService.SetKeyHashAsync(localKeyHash);
|
||||||
await _cryptoService.SetMasterKeyHashAsync(localKeyHash);
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@@ -396,9 +325,17 @@ namespace Bit.App.Pages
|
|||||||
}
|
}
|
||||||
await _deviceActionService.HideLoadingAsync();
|
await _deviceActionService.HideLoadingAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (passwordValid)
|
if (passwordValid)
|
||||||
{
|
{
|
||||||
|
if (_isPinProtected)
|
||||||
|
{
|
||||||
|
var protectedPin = await _stateService.GetProtectedPinAsync();
|
||||||
|
var encKey = await _cryptoService.GetEncKeyAsync(key);
|
||||||
|
var decPin = await _cryptoService.DecryptToUtf8Async(new EncString(protectedPin), encKey);
|
||||||
|
var pinKey = await _cryptoService.MakePinKeyAysnc(decPin, _email, kdfConfig);
|
||||||
|
await _stateService.SetPinProtectedKeyAsync(await _cryptoService.EncryptAsync(key.Key, pinKey));
|
||||||
|
}
|
||||||
|
|
||||||
if (await RequirePasswordChangeAsync(enforcedMasterPasswordOptions))
|
if (await RequirePasswordChangeAsync(enforcedMasterPasswordOptions))
|
||||||
{
|
{
|
||||||
// Save the ForcePasswordResetReason to force a password reset after unlock
|
// Save the ForcePasswordResetReason to force a password reset after unlock
|
||||||
@@ -408,13 +345,10 @@ namespace Bit.App.Pages
|
|||||||
|
|
||||||
MasterPassword = string.Empty;
|
MasterPassword = string.Empty;
|
||||||
await AppHelpers.ResetInvalidUnlockAttemptsAsync();
|
await AppHelpers.ResetInvalidUnlockAttemptsAsync();
|
||||||
|
await SetKeyAndContinueAsync(key);
|
||||||
var userKey = await _cryptoService.DecryptUserKeyWithMasterKeyAsync(masterKey);
|
|
||||||
await _cryptoService.SetMasterKeyAsync(masterKey);
|
|
||||||
await SetUserKeyAndContinueAsync(userKey);
|
|
||||||
|
|
||||||
// Re-enable biometrics
|
// Re-enable biometrics
|
||||||
if (BiometricEnabled & !BiometricIntegrityValid)
|
if (BiometricLock & !BiometricIntegrityValid)
|
||||||
{
|
{
|
||||||
await _biometricService.SetupBiometricAsync();
|
await _biometricService.SetupBiometricAsync();
|
||||||
}
|
}
|
||||||
@@ -431,6 +365,7 @@ namespace Bit.App.Pages
|
|||||||
AppResources.AnErrorHasOccurred);
|
AppResources.AnErrorHasOccurred);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Checks if the master password requires updating to meet the enforced policy requirements
|
/// Checks if the master password requires updating to meet the enforced policy requirements
|
||||||
@@ -490,82 +425,44 @@ namespace Bit.App.Pages
|
|||||||
public void TogglePassword()
|
public void TogglePassword()
|
||||||
{
|
{
|
||||||
ShowPassword = !ShowPassword;
|
ShowPassword = !ShowPassword;
|
||||||
var secret = PinEnabled ? Pin : MasterPassword;
|
var secret = PinLock ? Pin : MasterPassword;
|
||||||
_secretEntryFocusWeakEventManager.RaiseEvent(string.IsNullOrEmpty(secret) ? 0 : secret.Length,
|
_secretEntryFocusWeakEventManager.RaiseEvent(string.IsNullOrEmpty(secret) ? 0 : secret.Length, nameof(FocusSecretEntry));
|
||||||
nameof(FocusSecretEntry));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task PromptBiometricAsync()
|
public async Task PromptBiometricAsync()
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
BiometricIntegrityValid = await _platformUtilsService.IsBiometricIntegrityValidAsync();
|
BiometricIntegrityValid = await _platformUtilsService.IsBiometricIntegrityValidAsync();
|
||||||
BiometricButtonVisible = BiometricIntegrityValid;
|
BiometricButtonVisible = BiometricIntegrityValid;
|
||||||
if (!BiometricEnabled || !BiometricIntegrityValid)
|
if (!BiometricLock || !BiometricIntegrityValid)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var success = await _platformUtilsService.AuthenticateBiometricAsync(null,
|
var success = await _platformUtilsService.AuthenticateBiometricAsync(null,
|
||||||
PinEnabled ? AppResources.PIN : AppResources.MasterPassword,
|
PinLock ? AppResources.PIN : AppResources.MasterPassword,
|
||||||
() => _secretEntryFocusWeakEventManager.RaiseEvent((int?)null, nameof(FocusSecretEntry)),
|
() => _secretEntryFocusWeakEventManager.RaiseEvent((int?)null, nameof(FocusSecretEntry)));
|
||||||
!PinEnabled && !HasMasterPassword);
|
|
||||||
|
|
||||||
await _stateService.SetBiometricLockedAsync(!success);
|
await _stateService.SetBiometricLockedAsync(!success);
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
var userKey = await _cryptoService.GetBiometricUnlockKeyAsync();
|
await DoContinueAsync();
|
||||||
await SetUserKeyAndContinueAsync(userKey);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (LegacyUserException)
|
|
||||||
{
|
|
||||||
await HandleLegacyUserAsync();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task SetUserKeyAndContinueAsync(UserKey key)
|
private async Task SetKeyAndContinueAsync(SymmetricCryptoKey key)
|
||||||
{
|
{
|
||||||
var hasKey = await _cryptoService.HasUserKeyAsync();
|
var hasKey = await _cryptoService.HasKeyAsync();
|
||||||
if (!hasKey)
|
if (!hasKey)
|
||||||
{
|
{
|
||||||
await _cryptoService.SetUserKeyAsync(key);
|
await _cryptoService.SetKeyAsync(key);
|
||||||
}
|
}
|
||||||
await _deviceTrustCryptoService.TrustDeviceIfNeededAsync();
|
|
||||||
await DoContinueAsync();
|
await DoContinueAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task DoContinueAsync()
|
private async Task DoContinueAsync()
|
||||||
{
|
{
|
||||||
_syncService.FullSyncAsync(false).FireAndForget();
|
|
||||||
await _stateService.SetBiometricLockedAsync(false);
|
await _stateService.SetBiometricLockedAsync(false);
|
||||||
_watchDeviceService.SyncDataToWatchAsync().FireAndForget();
|
_watchDeviceService.SyncDataToWatchAsync().FireAndForget();
|
||||||
_messagingService.Send("unlocked");
|
_messagingService.Send("unlocked");
|
||||||
UnlockedAction?.Invoke();
|
UnlockedAction?.Invoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<bool> IsBiometricsEnabledAsync()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return await _vaultTimeoutService.IsBiometricLockSetAsync() &&
|
|
||||||
await _biometricService.CanUseBiometricsUnlockAsync();
|
|
||||||
}
|
|
||||||
catch (LegacyUserException)
|
|
||||||
{
|
|
||||||
await HandleLegacyUserAsync();
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task HandleLegacyUserAsync()
|
|
||||||
{
|
|
||||||
// Legacy users must migrate on web vault.
|
|
||||||
await _platformUtilsService.ShowDialogAsync(AppResources.EncryptionKeyMigrationRequiredDescriptionLong,
|
|
||||||
AppResources.AnErrorHasOccurred,
|
|
||||||
AppResources.Ok);
|
|
||||||
await _vaultTimeoutService.LogOutAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,80 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<pages:BaseContentPage
|
|
||||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
|
||||||
x:Class="Bit.App.Pages.LoginApproveDevicePage"
|
|
||||||
xmlns:pages="clr-namespace:Bit.App.Pages"
|
|
||||||
xmlns:u="clr-namespace:Bit.App.Utilities"
|
|
||||||
x:DataType="pages:LoginApproveDeviceViewModel"
|
|
||||||
x:Name="_page"
|
|
||||||
Title="{Binding PageTitle}">
|
|
||||||
|
|
||||||
<ContentPage.BindingContext>
|
|
||||||
<pages:LoginApproveDeviceViewModel />
|
|
||||||
</ContentPage.BindingContext>
|
|
||||||
|
|
||||||
<StackLayout Padding="10, 10">
|
|
||||||
<StackLayout Padding="5, 10" Orientation="Horizontal">
|
|
||||||
<StackLayout HorizontalOptions="FillAndExpand">
|
|
||||||
<Label
|
|
||||||
StyleClass="text-md"
|
|
||||||
Text="{u:I18n RememberThisDevice}" />
|
|
||||||
<Label
|
|
||||||
StyleClass="box-sub-label"
|
|
||||||
Text="{u:I18n TurnOffUsingPublicDevice}" />
|
|
||||||
</StackLayout>
|
|
||||||
<Switch
|
|
||||||
Scale="0.8"
|
|
||||||
IsToggled="{Binding RememberThisDevice}"
|
|
||||||
AutomationId="RememberThisDeviceSwitch"
|
|
||||||
VerticalOptions="Center" />
|
|
||||||
</StackLayout>
|
|
||||||
<StackLayout Margin="0, 20, 0, 0">
|
|
||||||
<Button
|
|
||||||
x:Name="_continue"
|
|
||||||
Text="{u:I18n Continue}"
|
|
||||||
StyleClass="btn-primary"
|
|
||||||
Command="{Binding ContinueCommand}"
|
|
||||||
IsVisible="{Binding IsNewUser}"
|
|
||||||
AutomationId="ContinueButton" />
|
|
||||||
<Button
|
|
||||||
x:Name="_approveWithMyOtherDevice"
|
|
||||||
Text="{u:I18n ApproveWithMyOtherDevice}"
|
|
||||||
StyleClass="btn-primary"
|
|
||||||
Command="{Binding ApproveWithMyOtherDeviceCommand}"
|
|
||||||
IsVisible="{Binding ApproveWithMyOtherDeviceEnabled}"
|
|
||||||
AutomationId="ApproveWithMyOtherDeviceButton" />
|
|
||||||
<Button
|
|
||||||
x:Name="_requestAdminApproval"
|
|
||||||
Text="{u:I18n RequestAdminApproval}"
|
|
||||||
StyleClass="box-button-row"
|
|
||||||
Command="{Binding RequestAdminApprovalCommand}"
|
|
||||||
IsVisible="{Binding RequestAdminApprovalEnabled}"
|
|
||||||
AutomationId="RequestAdminApprovalButton" />
|
|
||||||
<Button
|
|
||||||
x:Name="_approveWithMasterPassword"
|
|
||||||
Text="{u:I18n ApproveWithMasterPassword}"
|
|
||||||
StyleClass="box-button-row"
|
|
||||||
Command="{Binding ApproveWithMasterPasswordCommand}"
|
|
||||||
IsVisible="{Binding ApproveWithMasterPasswordEnabled}"
|
|
||||||
AutomationId="ApproveWithMasterPasswordButton" />
|
|
||||||
<Label
|
|
||||||
Text="{Binding LoggingInAsText}"
|
|
||||||
StyleClass="text-sm"
|
|
||||||
Margin="0,40,0,0"
|
|
||||||
AutomationId="LoggingInAsLabel" />
|
|
||||||
<Label
|
|
||||||
Text="{u:I18n NotYou}"
|
|
||||||
StyleClass="text-md"
|
|
||||||
HorizontalOptions="Start"
|
|
||||||
TextColor="{DynamicResource HyperlinkColor}"
|
|
||||||
AutomationId="NotYouLabel">
|
|
||||||
<Label.GestureRecognizers>
|
|
||||||
<TapGestureRecognizer Command="{Binding LogoutCommand}" />
|
|
||||||
</Label.GestureRecognizers>
|
|
||||||
</Label>
|
|
||||||
</StackLayout>
|
|
||||||
</StackLayout>
|
|
||||||
</pages:BaseContentPage>
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,64 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Bit.App.Models;
|
|
||||||
using Bit.App.Utilities;
|
|
||||||
using Bit.Core.Enums;
|
|
||||||
using Bit.Core.Utilities;
|
|
||||||
using Xamarin.Forms;
|
|
||||||
|
|
||||||
namespace Bit.App.Pages
|
|
||||||
{
|
|
||||||
public partial class LoginApproveDevicePage : BaseContentPage
|
|
||||||
{
|
|
||||||
|
|
||||||
private readonly LoginApproveDeviceViewModel _vm;
|
|
||||||
private readonly AppOptions _appOptions;
|
|
||||||
|
|
||||||
public LoginApproveDevicePage(AppOptions appOptions = null)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_vm = BindingContext as LoginApproveDeviceViewModel;
|
|
||||||
_vm.LogInWithMasterPasswordAction = () => StartLogInWithMasterPasswordAsync().FireAndForget();
|
|
||||||
_vm.LogInWithDeviceAction = () => StartLoginWithDeviceAsync().FireAndForget();
|
|
||||||
_vm.RequestAdminApprovalAction = () => RequestAdminApprovalAsync().FireAndForget();
|
|
||||||
_vm.ContinueToVaultAction = () => ContinueToVaultAsync().FireAndForget();
|
|
||||||
_vm.Page = this;
|
|
||||||
_appOptions = appOptions;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnAppearing()
|
|
||||||
{
|
|
||||||
_vm.InitAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task ContinueToVaultAsync()
|
|
||||||
{
|
|
||||||
if (AppHelpers.SetAlternateMainPage(_appOptions))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var previousPage = await AppHelpers.ClearPreviousPage();
|
|
||||||
Application.Current.MainPage = new TabsPage(_appOptions, previousPage);
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task StartLogInWithMasterPasswordAsync()
|
|
||||||
{
|
|
||||||
var page = new LockPage(_appOptions, checkPendingAuthRequests: false);
|
|
||||||
await Navigation.PushModalAsync(new NavigationPage(page));
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task StartLoginWithDeviceAsync()
|
|
||||||
{
|
|
||||||
var page = new LoginPasswordlessRequestPage(_vm.Email, AuthRequestType.AuthenticateAndUnlock, _appOptions, true);
|
|
||||||
await Navigation.PushModalAsync(new NavigationPage(page));
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task RequestAdminApprovalAsync()
|
|
||||||
{
|
|
||||||
var page = new LoginPasswordlessRequestPage(_vm.Email, AuthRequestType.AdminApproval, _appOptions, true);
|
|
||||||
await Navigation.PushModalAsync(new NavigationPage(page));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,150 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Security.Cryptography.X509Certificates;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Input;
|
|
||||||
using Bit.App.Abstractions;
|
|
||||||
using Bit.App.Resources;
|
|
||||||
using Bit.App.Utilities.AccountManagement;
|
|
||||||
using Bit.Core.Abstractions;
|
|
||||||
using Bit.Core.Enums;
|
|
||||||
using Bit.Core.Models.Domain;
|
|
||||||
using Bit.Core.Models.Request;
|
|
||||||
using Bit.Core.Services;
|
|
||||||
using Bit.Core.Utilities;
|
|
||||||
using Xamarin.CommunityToolkit.ObjectModel;
|
|
||||||
using Xamarin.Essentials;
|
|
||||||
using Xamarin.Forms;
|
|
||||||
|
|
||||||
namespace Bit.App.Pages
|
|
||||||
{
|
|
||||||
public class LoginApproveDeviceViewModel : BaseViewModel
|
|
||||||
{
|
|
||||||
private bool _rememberThisDevice;
|
|
||||||
private bool _approveWithMyOtherDeviceEnabled;
|
|
||||||
private bool _requestAdminApprovalEnabled;
|
|
||||||
private bool _approveWithMasterPasswordEnabled;
|
|
||||||
private string _email;
|
|
||||||
private readonly IStateService _stateService;
|
|
||||||
private readonly IApiService _apiService;
|
|
||||||
private IDeviceTrustCryptoService _deviceTrustCryptoService;
|
|
||||||
private readonly IAuthService _authService;
|
|
||||||
private readonly ISyncService _syncService;
|
|
||||||
private readonly IMessagingService _messagingService;
|
|
||||||
|
|
||||||
public ICommand ApproveWithMyOtherDeviceCommand { get; }
|
|
||||||
public ICommand RequestAdminApprovalCommand { get; }
|
|
||||||
public ICommand ApproveWithMasterPasswordCommand { get; }
|
|
||||||
public ICommand ContinueCommand { get; }
|
|
||||||
public ICommand LogoutCommand { get; }
|
|
||||||
|
|
||||||
public Action LogInWithMasterPasswordAction { get; set; }
|
|
||||||
public Action LogInWithDeviceAction { get; set; }
|
|
||||||
public Action RequestAdminApprovalAction { get; set; }
|
|
||||||
public Action ContinueToVaultAction { get; set; }
|
|
||||||
|
|
||||||
public LoginApproveDeviceViewModel()
|
|
||||||
{
|
|
||||||
_stateService = ServiceContainer.Resolve<IStateService>();
|
|
||||||
_apiService = ServiceContainer.Resolve<IApiService>();
|
|
||||||
_deviceTrustCryptoService = ServiceContainer.Resolve<IDeviceTrustCryptoService>();
|
|
||||||
_authService = ServiceContainer.Resolve<IAuthService>();
|
|
||||||
_syncService = ServiceContainer.Resolve<ISyncService>();
|
|
||||||
_messagingService = ServiceContainer.Resolve<IMessagingService>();
|
|
||||||
|
|
||||||
PageTitle = AppResources.LogInInitiated;
|
|
||||||
RememberThisDevice = true;
|
|
||||||
|
|
||||||
ApproveWithMyOtherDeviceCommand = new AsyncCommand(() => SetDeviceTrustAndInvokeAsync(LogInWithDeviceAction),
|
|
||||||
onException: ex => HandleException(ex),
|
|
||||||
allowsMultipleExecutions: false);
|
|
||||||
|
|
||||||
RequestAdminApprovalCommand = new AsyncCommand(() => SetDeviceTrustAndInvokeAsync(RequestAdminApprovalAction),
|
|
||||||
onException: ex => HandleException(ex),
|
|
||||||
allowsMultipleExecutions: false);
|
|
||||||
|
|
||||||
ApproveWithMasterPasswordCommand = new AsyncCommand(() => SetDeviceTrustAndInvokeAsync(LogInWithMasterPasswordAction),
|
|
||||||
onException: ex => HandleException(ex),
|
|
||||||
allowsMultipleExecutions: false);
|
|
||||||
|
|
||||||
ContinueCommand = new AsyncCommand(CreateNewSsoUserAsync,
|
|
||||||
onException: ex => HandleException(ex),
|
|
||||||
allowsMultipleExecutions: false);
|
|
||||||
|
|
||||||
LogoutCommand = new Command(() => _messagingService.Send(AccountsManagerMessageCommands.LOGOUT));
|
|
||||||
}
|
|
||||||
|
|
||||||
public string LoggingInAsText => string.Format(AppResources.LoggingInAsX, Email);
|
|
||||||
|
|
||||||
public bool RememberThisDevice
|
|
||||||
{
|
|
||||||
get => _rememberThisDevice;
|
|
||||||
set => SetProperty(ref _rememberThisDevice, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool ApproveWithMyOtherDeviceEnabled
|
|
||||||
{
|
|
||||||
get => _approveWithMyOtherDeviceEnabled;
|
|
||||||
set => SetProperty(ref _approveWithMyOtherDeviceEnabled, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool RequestAdminApprovalEnabled
|
|
||||||
{
|
|
||||||
get => _requestAdminApprovalEnabled;
|
|
||||||
set => SetProperty(ref _requestAdminApprovalEnabled, value,
|
|
||||||
additionalPropertyNames: new[] { nameof(IsNewUser) });
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool ApproveWithMasterPasswordEnabled
|
|
||||||
{
|
|
||||||
get => _approveWithMasterPasswordEnabled;
|
|
||||||
set => SetProperty(ref _approveWithMasterPasswordEnabled, value,
|
|
||||||
additionalPropertyNames: new[] { nameof(IsNewUser) });
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsNewUser => !RequestAdminApprovalEnabled && !ApproveWithMasterPasswordEnabled;
|
|
||||||
|
|
||||||
public string Email
|
|
||||||
{
|
|
||||||
get => _email;
|
|
||||||
set => SetProperty(ref _email, value, additionalPropertyNames:
|
|
||||||
new string[] {
|
|
||||||
nameof(LoggingInAsText)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task InitAsync()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Email = await _stateService.GetActiveUserEmailAsync();
|
|
||||||
var decryptOptions = await _stateService.GetAccountDecryptionOptions();
|
|
||||||
RequestAdminApprovalEnabled = decryptOptions?.TrustedDeviceOption?.HasAdminApproval ?? false;
|
|
||||||
ApproveWithMasterPasswordEnabled = decryptOptions?.HasMasterPassword ?? false;
|
|
||||||
ApproveWithMyOtherDeviceEnabled = decryptOptions?.TrustedDeviceOption?.HasLoginApprovingDevice ?? false;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
HandleException(ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task CreateNewSsoUserAsync()
|
|
||||||
{
|
|
||||||
await _authService.CreateNewSsoUserAsync(await _stateService.GetRememberedOrgIdentifierAsync());
|
|
||||||
if (RememberThisDevice)
|
|
||||||
{
|
|
||||||
await _deviceTrustCryptoService.TrustDeviceAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
_syncService.FullSyncAsync(true).FireAndForget();
|
|
||||||
await Device.InvokeOnMainThreadAsync(ContinueToVaultAction);
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task SetDeviceTrustAndInvokeAsync(Action action)
|
|
||||||
{
|
|
||||||
await _deviceTrustCryptoService.SetShouldTrustDeviceAsync(RememberThisDevice);
|
|
||||||
await Device.InvokeOnMainThreadAsync(action);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -4,7 +4,6 @@ using Bit.App.Models;
|
|||||||
using Bit.App.Utilities;
|
using Bit.App.Utilities;
|
||||||
using Bit.Core;
|
using Bit.Core;
|
||||||
using Bit.Core.Abstractions;
|
using Bit.Core.Abstractions;
|
||||||
using Bit.Core.Enums;
|
|
||||||
using Bit.Core.Services;
|
using Bit.Core.Services;
|
||||||
using Bit.Core.Utilities;
|
using Bit.Core.Utilities;
|
||||||
using Xamarin.CommunityToolkit.ObjectModel;
|
using Xamarin.CommunityToolkit.ObjectModel;
|
||||||
@@ -136,7 +135,7 @@ namespace Bit.App.Pages
|
|||||||
|
|
||||||
private async Task StartLoginWithDeviceAsync()
|
private async Task StartLoginWithDeviceAsync()
|
||||||
{
|
{
|
||||||
var page = new LoginPasswordlessRequestPage(_vm.Email, AuthRequestType.AuthenticateAndUnlock, _appOptions);
|
var page = new LoginPasswordlessRequestPage(_vm.Email, _appOptions);
|
||||||
await Navigation.PushModalAsync(new NavigationPage(page));
|
await Navigation.PushModalAsync(new NavigationPage(page));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ namespace Bit.App.Pages
|
|||||||
Email = await _stateService.GetRememberedEmailAsync();
|
Email = await _stateService.GetRememberedEmailAsync();
|
||||||
}
|
}
|
||||||
CanRemoveAccount = await _stateService.GetActiveUserEmailAsync() != Email;
|
CanRemoveAccount = await _stateService.GetActiveUserEmailAsync() != Email;
|
||||||
EnvironmentDomainName = _environmentService.GetCurrentDomain();
|
EnvironmentDomainName = CoreHelpers.GetDomain((await _stateService.GetPreAuthEnvironmentUrlsAsync())?.Base);
|
||||||
IsKnownDevice = await _apiService.GetKnownDeviceAsync(Email, await _appIdService.GetAppIdAsync());
|
IsKnownDevice = await _apiService.GetKnownDeviceAsync(Email, await _appIdService.GetAppIdAsync());
|
||||||
}
|
}
|
||||||
catch (ApiException apiEx) when (apiEx.Error.StatusCode == System.Net.HttpStatusCode.Unauthorized)
|
catch (ApiException apiEx) when (apiEx.Error.StatusCode == System.Net.HttpStatusCode.Unauthorized)
|
||||||
@@ -248,14 +248,6 @@ namespace Bit.App.Pages
|
|||||||
|
|
||||||
await _deviceActionService.HideLoadingAsync();
|
await _deviceActionService.HideLoadingAsync();
|
||||||
|
|
||||||
if (response.RequiresEncryptionKeyMigration)
|
|
||||||
{
|
|
||||||
// Legacy users must migrate on web vault.
|
|
||||||
await _platformUtilsService.ShowDialogAsync(AppResources.EncryptionKeyMigrationRequiredDescriptionLong, AppResources.AnErrorHasOccurred,
|
|
||||||
AppResources.Ok);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (response.TwoFactor)
|
if (response.TwoFactor)
|
||||||
{
|
{
|
||||||
StartTwoFactorAction?.Invoke();
|
StartTwoFactorAction?.Invoke();
|
||||||
|
|||||||
@@ -14,61 +14,59 @@
|
|||||||
</ContentPage.BindingContext>
|
</ContentPage.BindingContext>
|
||||||
|
|
||||||
<ContentPage.ToolbarItems>
|
<ContentPage.ToolbarItems>
|
||||||
<ToolbarItem Text="{u:I18n Close}" Command="{Binding CloseCommand}" Order="Primary" Priority="-1" x:Name="_closeItem" />
|
<ToolbarItem Text="{u:I18n Close}" Command="{Binding CloseCommand}" Order="Primary" Priority="-1" x:Name="_closeItem"/>
|
||||||
</ContentPage.ToolbarItems>
|
</ContentPage.ToolbarItems>
|
||||||
|
|
||||||
<ScrollView>
|
<ScrollView>
|
||||||
<StackLayout
|
<StackLayout
|
||||||
Padding="7, 0, 7, 20">
|
Padding="7, 0, 7, 20">
|
||||||
<Label
|
<Label
|
||||||
Text="{Binding Title}"
|
Text="{u:I18n LogInInitiated}"
|
||||||
FontSize="Title"
|
FontSize="Title"
|
||||||
FontAttributes="Bold"
|
FontAttributes="Bold"
|
||||||
Margin="0,14,0,21"
|
Margin="0,14,0,21"
|
||||||
AutomationId="LogInInitiatedLabel" />
|
AutomationId="LogInInitiatedLabel" />
|
||||||
<Label
|
<Label
|
||||||
Text="{Binding SubTitle}"
|
Text="{u:I18n ANotificationHasBeenSentToYourDevice}"
|
||||||
FontSize="Small"
|
FontSize="Small"
|
||||||
Margin="0,0,0,10"
|
Margin="0,0,0,10"/>
|
||||||
AutomationId="SubTitleLabel" />
|
|
||||||
<Label
|
<Label
|
||||||
Text="{Binding Description}"
|
Text="{u:I18n PleaseMakeSureYourVaultIsUnlockedAndTheFingerprintPhraseMatchesOnTheOtherDevice}"
|
||||||
FontSize="Small"
|
FontSize="Small"
|
||||||
Margin="0,0,0,24"
|
Margin="0,0,0,24"/>
|
||||||
AutomationId="DescriptionLabel" />
|
|
||||||
<Label
|
<Label
|
||||||
Text="{u:I18n FingerprintPhrase}"
|
Text="{u:I18n FingerprintPhrase}"
|
||||||
FontSize="Small"
|
FontSize="Small"
|
||||||
FontAttributes="Bold" />
|
FontAttributes="Bold"/>
|
||||||
<controls:MonoLabel
|
<controls:MonoLabel
|
||||||
FormattedText="{Binding FingerprintPhrase}"
|
FormattedText="{Binding FingerprintPhrase}"
|
||||||
FontSize="Small"
|
FontSize="Medium"
|
||||||
TextColor="{DynamicResource FingerprintPhrase}"
|
TextColor="{DynamicResource FingerprintPhrase}"
|
||||||
AutomationId="FingerprintPhraseValue" />
|
AutomationId="FingerprintPhraseValue" />
|
||||||
<Label
|
<Label
|
||||||
Text="{u:I18n ResendNotification}"
|
Text="{u:I18n ResendNotification}"
|
||||||
IsVisible="{Binding ResendNotificationVisible}"
|
StyleClass="text-md"
|
||||||
StyleClass="text-sm"
|
|
||||||
FontAttributes="Bold"
|
|
||||||
HorizontalOptions="Start"
|
HorizontalOptions="Start"
|
||||||
Margin="0,24,0,0"
|
Margin="0,40,0,0"
|
||||||
TextColor="{DynamicResource HyperlinkColor}"
|
TextColor="{DynamicResource HyperlinkColor}"
|
||||||
AutomationId="ResendNotificationButton">
|
AutomationId="ResendNotificationButton">
|
||||||
<Label.GestureRecognizers>
|
<Label.GestureRecognizers>
|
||||||
<TapGestureRecognizer Command="{Binding CreatePasswordlessLoginCommand}" />
|
<TapGestureRecognizer Command="{Binding CreatePasswordlessLoginCommand}" />
|
||||||
</Label.GestureRecognizers>
|
</Label.GestureRecognizers>
|
||||||
</Label>
|
</Label>
|
||||||
<BoxView
|
<StackLayout
|
||||||
HeightRequest="1"
|
Orientation="Horizontal"
|
||||||
Margin="0,24,0,24"
|
Margin="0,30,0,0">
|
||||||
Color="{DynamicResource DisabledIconColor}" />
|
|
||||||
<Label
|
<Label
|
||||||
Text="{Binding OtherOptions}"
|
Text="{u:I18n NeedAnotherOption}"
|
||||||
FontSize="Small" />
|
FontSize="Small"
|
||||||
|
VerticalTextAlignment="End"/>
|
||||||
<Label
|
<Label
|
||||||
Text="{u:I18n ViewAllLoginOptions}"
|
Text="{u:I18n ViewAllLoginOptions}"
|
||||||
StyleClass="text-sm"
|
StyleClass="text-md"
|
||||||
FontAttributes="Bold"
|
VerticalTextAlignment="End"
|
||||||
|
VerticalOptions="CenterAndExpand"
|
||||||
|
Margin="5, 0"
|
||||||
TextColor="{DynamicResource HyperlinkColor}"
|
TextColor="{DynamicResource HyperlinkColor}"
|
||||||
AutomationId="ViewAllLoginOptionsButton">
|
AutomationId="ViewAllLoginOptionsButton">
|
||||||
<Label.GestureRecognizers>
|
<Label.GestureRecognizers>
|
||||||
@@ -76,5 +74,7 @@
|
|||||||
</Label.GestureRecognizers>
|
</Label.GestureRecognizers>
|
||||||
</Label>
|
</Label>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
|
|
||||||
|
</StackLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
</pages:BaseContentPage>
|
</pages:BaseContentPage>
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ using System.Collections.Generic;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Bit.App.Models;
|
using Bit.App.Models;
|
||||||
using Bit.App.Utilities;
|
using Bit.App.Utilities;
|
||||||
using Bit.Core.Enums;
|
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
|
|
||||||
namespace Bit.App.Pages
|
namespace Bit.App.Pages
|
||||||
@@ -13,15 +12,13 @@ namespace Bit.App.Pages
|
|||||||
private LoginPasswordlessRequestViewModel _vm;
|
private LoginPasswordlessRequestViewModel _vm;
|
||||||
private readonly AppOptions _appOptions;
|
private readonly AppOptions _appOptions;
|
||||||
|
|
||||||
public LoginPasswordlessRequestPage(string email, AuthRequestType authRequestType, AppOptions appOptions = null, bool authingWithSso = false)
|
public LoginPasswordlessRequestPage(string email, AppOptions appOptions = null)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_appOptions = appOptions;
|
_appOptions = appOptions;
|
||||||
_vm = BindingContext as LoginPasswordlessRequestViewModel;
|
_vm = BindingContext as LoginPasswordlessRequestViewModel;
|
||||||
_vm.Page = this;
|
_vm.Page = this;
|
||||||
_vm.Email = email;
|
_vm.Email = email;
|
||||||
_vm.AuthRequestType = authRequestType;
|
|
||||||
_vm.AuthingWithSso = authingWithSso;
|
|
||||||
_vm.StartTwoFactorAction = () => Device.BeginInvokeOnMainThread(async () => await StartTwoFactorAsync());
|
_vm.StartTwoFactorAction = () => Device.BeginInvokeOnMainThread(async () => await StartTwoFactorAsync());
|
||||||
_vm.LogInSuccessAction = () => Device.BeginInvokeOnMainThread(async () => await LogInSuccessAsync());
|
_vm.LogInSuccessAction = () => Device.BeginInvokeOnMainThread(async () => await LogInSuccessAsync());
|
||||||
_vm.UpdateTempPasswordAction = () => Device.BeginInvokeOnMainThread(async () => await UpdateTempPasswordAsync());
|
_vm.UpdateTempPasswordAction = () => Device.BeginInvokeOnMainThread(async () => await UpdateTempPasswordAsync());
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net.Http;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -12,9 +11,7 @@ using Bit.App.Utilities;
|
|||||||
using Bit.Core;
|
using Bit.Core;
|
||||||
using Bit.Core.Abstractions;
|
using Bit.Core.Abstractions;
|
||||||
using Bit.Core.Enums;
|
using Bit.Core.Enums;
|
||||||
using Bit.Core.Exceptions;
|
|
||||||
using Bit.Core.Models.Domain;
|
using Bit.Core.Models.Domain;
|
||||||
using Bit.Core.Models.Response;
|
|
||||||
using Bit.Core.Services;
|
using Bit.Core.Services;
|
||||||
using Bit.Core.Utilities;
|
using Bit.Core.Utilities;
|
||||||
using Xamarin.CommunityToolkit.ObjectModel;
|
using Xamarin.CommunityToolkit.ObjectModel;
|
||||||
@@ -35,9 +32,6 @@ namespace Bit.App.Pages
|
|||||||
private IPlatformUtilsService _platformUtilsService;
|
private IPlatformUtilsService _platformUtilsService;
|
||||||
private IEnvironmentService _environmentService;
|
private IEnvironmentService _environmentService;
|
||||||
private ILogger _logger;
|
private ILogger _logger;
|
||||||
private IDeviceTrustCryptoService _deviceTrustCryptoService;
|
|
||||||
private readonly ICryptoFunctionService _cryptoFunctionService;
|
|
||||||
private readonly ICryptoService _cryptoService;
|
|
||||||
|
|
||||||
protected override II18nService i18nService => _i18nService;
|
protected override II18nService i18nService => _i18nService;
|
||||||
protected override IEnvironmentService environmentService => _environmentService;
|
protected override IEnvironmentService environmentService => _environmentService;
|
||||||
@@ -50,7 +44,6 @@ namespace Bit.App.Pages
|
|||||||
private string _email;
|
private string _email;
|
||||||
private string _requestId;
|
private string _requestId;
|
||||||
private string _requestAccessCode;
|
private string _requestAccessCode;
|
||||||
private AuthRequestType _authRequestType;
|
|
||||||
// Item1 publicKey, Item2 privateKey
|
// Item1 publicKey, Item2 privateKey
|
||||||
private Tuple<byte[], byte[]> _requestKeyPair;
|
private Tuple<byte[], byte[]> _requestKeyPair;
|
||||||
|
|
||||||
@@ -64,9 +57,8 @@ namespace Bit.App.Pages
|
|||||||
_i18nService = ServiceContainer.Resolve<II18nService>();
|
_i18nService = ServiceContainer.Resolve<II18nService>();
|
||||||
_stateService = ServiceContainer.Resolve<IStateService>();
|
_stateService = ServiceContainer.Resolve<IStateService>();
|
||||||
_logger = ServiceContainer.Resolve<ILogger>();
|
_logger = ServiceContainer.Resolve<ILogger>();
|
||||||
_deviceTrustCryptoService = ServiceContainer.Resolve<IDeviceTrustCryptoService>();
|
|
||||||
_cryptoFunctionService = ServiceContainer.Resolve<ICryptoFunctionService>();
|
PageTitle = AppResources.LogInWithAnotherDevice;
|
||||||
_cryptoService = ServiceContainer.Resolve<ICryptoService>();
|
|
||||||
|
|
||||||
CreatePasswordlessLoginCommand = new AsyncCommand(CreatePasswordlessLoginAsync,
|
CreatePasswordlessLoginCommand = new AsyncCommand(CreatePasswordlessLoginAsync,
|
||||||
onException: ex => HandleException(ex),
|
onException: ex => HandleException(ex),
|
||||||
@@ -81,91 +73,10 @@ namespace Bit.App.Pages
|
|||||||
public Action LogInSuccessAction { get; set; }
|
public Action LogInSuccessAction { get; set; }
|
||||||
public Action UpdateTempPasswordAction { get; set; }
|
public Action UpdateTempPasswordAction { get; set; }
|
||||||
public Action CloseAction { get; set; }
|
public Action CloseAction { get; set; }
|
||||||
public bool AuthingWithSso { get; set; }
|
|
||||||
|
|
||||||
public ICommand CreatePasswordlessLoginCommand { get; }
|
public ICommand CreatePasswordlessLoginCommand { get; }
|
||||||
public ICommand CloseCommand { get; }
|
public ICommand CloseCommand { get; }
|
||||||
|
|
||||||
public string HeaderTitle
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
switch (_authRequestType)
|
|
||||||
{
|
|
||||||
case AuthRequestType.AuthenticateAndUnlock:
|
|
||||||
return AppResources.LogInWithDevice;
|
|
||||||
case AuthRequestType.AdminApproval:
|
|
||||||
return AppResources.LogInInitiated;
|
|
||||||
default:
|
|
||||||
return string.Empty;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string Title
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
switch (_authRequestType)
|
|
||||||
{
|
|
||||||
case AuthRequestType.AuthenticateAndUnlock:
|
|
||||||
return AppResources.LogInInitiated;
|
|
||||||
case AuthRequestType.AdminApproval:
|
|
||||||
return AppResources.AdminApprovalRequested;
|
|
||||||
default:
|
|
||||||
return string.Empty;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string SubTitle
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
switch (_authRequestType)
|
|
||||||
{
|
|
||||||
case AuthRequestType.AuthenticateAndUnlock:
|
|
||||||
return AppResources.ANotificationHasBeenSentToYourDevice;
|
|
||||||
case AuthRequestType.AdminApproval:
|
|
||||||
return AppResources.YourRequestHasBeenSentToYourAdmin;
|
|
||||||
default:
|
|
||||||
return string.Empty;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string Description
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
switch (_authRequestType)
|
|
||||||
{
|
|
||||||
case AuthRequestType.AuthenticateAndUnlock:
|
|
||||||
return AppResources.PleaseMakeSureYourVaultIsUnlockedAndTheFingerprintPhraseMatchesOnTheOtherDevice;
|
|
||||||
case AuthRequestType.AdminApproval:
|
|
||||||
return AppResources.YouWillBeNotifiedOnceApproved;
|
|
||||||
default:
|
|
||||||
return string.Empty;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string OtherOptions
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
switch (_authRequestType)
|
|
||||||
{
|
|
||||||
case AuthRequestType.AuthenticateAndUnlock:
|
|
||||||
return AppResources.LogInWithDeviceMustBeSetUpInTheSettingsOfTheBitwardenAppNeedAnotherOption;
|
|
||||||
case AuthRequestType.AdminApproval:
|
|
||||||
return AppResources.TroubleLoggingIn;
|
|
||||||
default:
|
|
||||||
return string.Empty;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string FingerprintPhrase
|
public string FingerprintPhrase
|
||||||
{
|
{
|
||||||
get => _fingerprintPhrase;
|
get => _fingerprintPhrase;
|
||||||
@@ -178,25 +89,6 @@ namespace Bit.App.Pages
|
|||||||
set => SetProperty(ref _email, value);
|
set => SetProperty(ref _email, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public AuthRequestType AuthRequestType
|
|
||||||
{
|
|
||||||
get => _authRequestType;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
SetProperty(ref _authRequestType, value, additionalPropertyNames: new string[]
|
|
||||||
{
|
|
||||||
nameof(Title),
|
|
||||||
nameof(SubTitle),
|
|
||||||
nameof(Description),
|
|
||||||
nameof(OtherOptions),
|
|
||||||
nameof(ResendNotificationVisible)
|
|
||||||
});
|
|
||||||
PageTitle = HeaderTitle;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool ResendNotificationVisible => AuthRequestType == AuthRequestType.AuthenticateAndUnlock;
|
|
||||||
|
|
||||||
public void StartCheckLoginRequestStatus()
|
public void StartCheckLoginRequestStatus()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -227,39 +119,25 @@ namespace Bit.App.Pages
|
|||||||
|
|
||||||
private async Task CheckLoginRequestStatus()
|
private async Task CheckLoginRequestStatus()
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(_requestId))
|
if (string.IsNullOrEmpty(_requestId) || string.IsNullOrEmpty(_requestAccessCode))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PasswordlessLoginResponse response = null;
|
var response = await _authService.GetPasswordlessLoginResponseAsync(_requestId, _requestAccessCode);
|
||||||
if (AuthingWithSso)
|
|
||||||
{
|
|
||||||
response = await _authService.GetPasswordlessLoginRequestByIdAsync(_requestId);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
response = await _authService.GetPasswordlessLoginResquestAsync(_requestId, _requestAccessCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (response?.RequestApproved != true)
|
if (response.RequestApproved == null || !response.RequestApproved.Value)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
StopCheckLoginRequestStatus();
|
StopCheckLoginRequestStatus();
|
||||||
|
|
||||||
var authResult = await _authService.LogInPasswordlessAsync(AuthingWithSso, Email, _requestAccessCode, _requestId, _requestKeyPair.Item2, response.Key, response.MasterPasswordHash);
|
var authResult = await _authService.LogInPasswordlessAsync(Email, _requestAccessCode, _requestId, _requestKeyPair.Item2, response.Key, response.MasterPasswordHash);
|
||||||
await AppHelpers.ResetInvalidUnlockAttemptsAsync();
|
await AppHelpers.ResetInvalidUnlockAttemptsAsync();
|
||||||
|
|
||||||
if (authResult == null && await _stateService.IsAuthenticatedAsync())
|
|
||||||
{
|
|
||||||
await HandleLoginCompleteAsync();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (await HandleCaptchaAsync(authResult.CaptchaSiteKey, authResult.CaptchaNeeded, CheckLoginRequestStatus))
|
if (await HandleCaptchaAsync(authResult.CaptchaSiteKey, authResult.CaptchaNeeded, CheckLoginRequestStatus))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@@ -275,13 +153,10 @@ namespace Bit.App.Pages
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
await HandleLoginCompleteAsync();
|
_syncService.FullSyncAsync(true).FireAndForget();
|
||||||
|
LogInSuccessAction?.Invoke();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (ApiException ex) when (ex.Error?.StatusCode == System.Net.HttpStatusCode.BadRequest)
|
|
||||||
{
|
|
||||||
HandleException(ex);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
StartCheckLoginRequestStatus();
|
StartCheckLoginRequestStatus();
|
||||||
@@ -289,66 +164,31 @@ namespace Bit.App.Pages
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task HandleLoginCompleteAsync()
|
|
||||||
{
|
|
||||||
await _stateService.SetPendingAdminAuthRequestAsync(null);
|
|
||||||
_syncService.FullSyncAsync(true).FireAndForget();
|
|
||||||
LogInSuccessAction?.Invoke();
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task CreatePasswordlessLoginAsync()
|
private async Task CreatePasswordlessLoginAsync()
|
||||||
{
|
{
|
||||||
await Device.InvokeOnMainThreadAsync(() => _deviceActionService.ShowLoadingAsync(AppResources.Loading));
|
await Device.InvokeOnMainThreadAsync(() => _deviceActionService.ShowLoadingAsync(AppResources.Loading));
|
||||||
|
|
||||||
PasswordlessLoginResponse response = null;
|
var response = await _authService.PasswordlessCreateLoginRequestAsync(_email);
|
||||||
var pendingRequest = await _stateService.GetPendingAdminAuthRequestAsync();
|
if (response != null)
|
||||||
if (pendingRequest != null && _authRequestType == AuthRequestType.AdminApproval)
|
|
||||||
{
|
{
|
||||||
response = await _authService.GetPasswordlessLoginRequestByIdAsync(pendingRequest.Id);
|
|
||||||
if (response == null || (response.IsAnswered && !response.RequestApproved.Value))
|
|
||||||
{
|
|
||||||
// handle pending auth request not valid remove it from state
|
|
||||||
await _stateService.SetPendingAdminAuthRequestAsync(null);
|
|
||||||
pendingRequest = null;
|
|
||||||
response = null;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Derive pubKey from privKey in state to avoid MITM attacks
|
|
||||||
// Also generate FingerprintPhrase locally for the same reason
|
|
||||||
var derivedPublicKey = await _cryptoFunctionService.RsaExtractPublicKeyAsync(pendingRequest.PrivateKey);
|
|
||||||
response.FingerprintPhrase = string.Join("-", await _cryptoService.GetFingerprintAsync(Email, derivedPublicKey));
|
|
||||||
response.RequestKeyPair = new Tuple<byte[], byte[]>(derivedPublicKey, pendingRequest.PrivateKey);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (response == null)
|
|
||||||
{
|
|
||||||
response = await _authService.PasswordlessCreateLoginRequestAsync(_email, AuthRequestType);
|
|
||||||
}
|
|
||||||
|
|
||||||
await HandlePasswordlessLoginAsync(response, pendingRequest == null && _authRequestType == AuthRequestType.AdminApproval);
|
|
||||||
await _deviceActionService.HideLoadingAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task HandlePasswordlessLoginAsync(PasswordlessLoginResponse response, bool createPendingAdminRequest)
|
|
||||||
{
|
|
||||||
if (response == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(response));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (createPendingAdminRequest)
|
|
||||||
{
|
|
||||||
var pendingAuthRequest = new PendingAdminAuthRequest { Id = response.Id, PrivateKey = response.RequestKeyPair.Item2 };
|
|
||||||
await _stateService.SetPendingAdminAuthRequestAsync(pendingAuthRequest);
|
|
||||||
}
|
|
||||||
|
|
||||||
FingerprintPhrase = response.FingerprintPhrase;
|
FingerprintPhrase = response.FingerprintPhrase;
|
||||||
_requestId = response.Id;
|
_requestId = response.Id;
|
||||||
_requestAccessCode = response.RequestAccessCode;
|
_requestAccessCode = response.RequestAccessCode;
|
||||||
_requestKeyPair = response.RequestKeyPair;
|
_requestKeyPair = response.RequestKeyPair;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await _deviceActionService.HideLoadingAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void HandleException(Exception ex)
|
||||||
|
{
|
||||||
|
Xamarin.Essentials.MainThread.InvokeOnMainThreadAsync(async () =>
|
||||||
|
{
|
||||||
|
await _deviceActionService.HideLoadingAsync();
|
||||||
|
await _platformUtilsService.ShowDialogAsync(AppResources.GenericErrorMessage);
|
||||||
|
}).FireAndForget();
|
||||||
|
_logger.Exception(ex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<StackLayout StyleClass="box">
|
<StackLayout StyleClass="box">
|
||||||
<Label Text="{u:I18n LogInSsoSummary}"
|
<Label Text="{u:I18n LogInSsoSummary}"
|
||||||
StyleClass="text-md"
|
StyleClass="text-md"
|
||||||
HorizontalTextAlignment="Start" />
|
HorizontalTextAlignment="Start"></Label>
|
||||||
<StackLayout StyleClass="box-row">
|
<StackLayout StyleClass="box-row">
|
||||||
<Label
|
<Label
|
||||||
Text="{u:I18n OrgIdentifier}"
|
Text="{u:I18n OrgIdentifier}"
|
||||||
@@ -32,15 +32,13 @@
|
|||||||
Keyboard="Default"
|
Keyboard="Default"
|
||||||
StyleClass="box-value"
|
StyleClass="box-value"
|
||||||
ReturnType="Go"
|
ReturnType="Go"
|
||||||
ReturnCommand="{Binding LogInCommand}"
|
ReturnCommand="{Binding LogInCommand}" />
|
||||||
AutomationId="OrgIdentifierEntry" />
|
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
<StackLayout Padding="10, 0">
|
<StackLayout Padding="10, 0">
|
||||||
<Button Text="{u:I18n LogIn}"
|
<Button Text="{u:I18n LogIn}"
|
||||||
StyleClass="btn-primary"
|
StyleClass="btn-primary"
|
||||||
Clicked="LogIn_Clicked"
|
Clicked="LogIn_Clicked"></Button>
|
||||||
AutomationId="LogInButton" />
|
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|||||||
@@ -29,8 +29,6 @@ namespace Bit.App.Pages
|
|||||||
_vm.SsoAuthSuccessAction = () => Device.BeginInvokeOnMainThread(async () => await SsoAuthSuccessAsync());
|
_vm.SsoAuthSuccessAction = () => Device.BeginInvokeOnMainThread(async () => await SsoAuthSuccessAsync());
|
||||||
_vm.UpdateTempPasswordAction =
|
_vm.UpdateTempPasswordAction =
|
||||||
() => Device.BeginInvokeOnMainThread(async () => await UpdateTempPasswordAsync());
|
() => Device.BeginInvokeOnMainThread(async () => await UpdateTempPasswordAsync());
|
||||||
_vm.StartDeviceApprovalOptionsAction =
|
|
||||||
() => Device.BeginInvokeOnMainThread(async () => await StartDeviceApprovalOptionsAsync());
|
|
||||||
_vm.CloseAction = async () =>
|
_vm.CloseAction = async () =>
|
||||||
{
|
{
|
||||||
await Navigation.PopModalAsync();
|
await Navigation.PopModalAsync();
|
||||||
@@ -108,17 +106,10 @@ namespace Bit.App.Pages
|
|||||||
await Navigation.PushModalAsync(new NavigationPage(page));
|
await Navigation.PushModalAsync(new NavigationPage(page));
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task StartDeviceApprovalOptionsAsync()
|
|
||||||
{
|
|
||||||
var page = new LoginApproveDevicePage();
|
|
||||||
await Navigation.PushModalAsync(new NavigationPage(page));
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task SsoAuthSuccessAsync()
|
private async Task SsoAuthSuccessAsync()
|
||||||
{
|
{
|
||||||
RestoreAppOptionsFromCopy();
|
RestoreAppOptionsFromCopy();
|
||||||
await AppHelpers.ClearPreviousPage();
|
await AppHelpers.ClearPreviousPage();
|
||||||
|
|
||||||
if (await _vaultTimeoutService.IsLockedAsync())
|
if (await _vaultTimeoutService.IsLockedAsync())
|
||||||
{
|
{
|
||||||
Application.Current.MainPage = new NavigationPage(new LockPage(_appOptions));
|
Application.Current.MainPage = new NavigationPage(new LockPage(_appOptions));
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ using Bit.Core.Abstractions;
|
|||||||
using Bit.Core.Enums;
|
using Bit.Core.Enums;
|
||||||
using Bit.Core.Exceptions;
|
using Bit.Core.Exceptions;
|
||||||
using Bit.Core.Models.Domain;
|
using Bit.Core.Models.Domain;
|
||||||
using Bit.Core.Services;
|
|
||||||
using Bit.Core.Utilities;
|
using Bit.Core.Utilities;
|
||||||
using Xamarin.CommunityToolkit.ObjectModel;
|
using Xamarin.CommunityToolkit.ObjectModel;
|
||||||
using Xamarin.Essentials;
|
using Xamarin.Essentials;
|
||||||
@@ -30,11 +29,8 @@ namespace Bit.App.Pages
|
|||||||
private readonly IStateService _stateService;
|
private readonly IStateService _stateService;
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IOrganizationService _organizationService;
|
private readonly IOrganizationService _organizationService;
|
||||||
private readonly IDeviceTrustCryptoService _deviceTrustCryptoService;
|
|
||||||
private readonly ICryptoService _cryptoService;
|
|
||||||
|
|
||||||
private string _orgIdentifier;
|
private string _orgIdentifier;
|
||||||
private bool _useEphemeralWebBrowserSession;
|
|
||||||
|
|
||||||
public LoginSsoPageViewModel()
|
public LoginSsoPageViewModel()
|
||||||
{
|
{
|
||||||
@@ -49,8 +45,7 @@ namespace Bit.App.Pages
|
|||||||
_stateService = ServiceContainer.Resolve<IStateService>("stateService");
|
_stateService = ServiceContainer.Resolve<IStateService>("stateService");
|
||||||
_logger = ServiceContainer.Resolve<ILogger>("logger");
|
_logger = ServiceContainer.Resolve<ILogger>("logger");
|
||||||
_organizationService = ServiceContainer.Resolve<IOrganizationService>();
|
_organizationService = ServiceContainer.Resolve<IOrganizationService>();
|
||||||
_deviceTrustCryptoService = ServiceContainer.Resolve<IDeviceTrustCryptoService>();
|
|
||||||
_cryptoService = ServiceContainer.Resolve<ICryptoService>();
|
|
||||||
|
|
||||||
PageTitle = AppResources.Bitwarden;
|
PageTitle = AppResources.Bitwarden;
|
||||||
LogInCommand = new AsyncCommand(LogInAsync, allowsMultipleExecutions: false);
|
LogInCommand = new AsyncCommand(LogInAsync, allowsMultipleExecutions: false);
|
||||||
@@ -66,7 +61,6 @@ namespace Bit.App.Pages
|
|||||||
public Action StartTwoFactorAction { get; set; }
|
public Action StartTwoFactorAction { get; set; }
|
||||||
public Action StartSetPasswordAction { get; set; }
|
public Action StartSetPasswordAction { get; set; }
|
||||||
public Action SsoAuthSuccessAction { get; set; }
|
public Action SsoAuthSuccessAction { get; set; }
|
||||||
public Action StartDeviceApprovalOptionsAction { get; set; }
|
|
||||||
public Action CloseAction { get; set; }
|
public Action CloseAction { get; set; }
|
||||||
public Action UpdateTempPasswordAction { get; set; }
|
public Action UpdateTempPasswordAction { get; set; }
|
||||||
|
|
||||||
@@ -115,7 +109,7 @@ namespace Bit.App.Pages
|
|||||||
|
|
||||||
await _deviceActionService.ShowLoadingAsync(AppResources.LoggingIn);
|
await _deviceActionService.ShowLoadingAsync(AppResources.LoggingIn);
|
||||||
|
|
||||||
var response = await _apiService.PreValidateSsoAsync(OrgIdentifier);
|
var response = await _apiService.PreValidateSso(OrgIdentifier);
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(response?.Token))
|
if (string.IsNullOrWhiteSpace(response?.Token))
|
||||||
{
|
{
|
||||||
@@ -146,12 +140,10 @@ namespace Bit.App.Pages
|
|||||||
"ssoToken=" + Uri.EscapeDataString(ssoToken);
|
"ssoToken=" + Uri.EscapeDataString(ssoToken);
|
||||||
|
|
||||||
WebAuthenticatorResult authResult = null;
|
WebAuthenticatorResult authResult = null;
|
||||||
authResult = await WebAuthenticator.AuthenticateAsync(new WebAuthenticatorOptions()
|
|
||||||
{
|
authResult = await WebAuthenticator.AuthenticateAsync(new Uri(url),
|
||||||
CallbackUrl = new Uri(REDIRECT_URI),
|
new Uri(REDIRECT_URI));
|
||||||
Url = new Uri(url),
|
|
||||||
PrefersEphemeralWebBrowserSession = _useEphemeralWebBrowserSession,
|
|
||||||
});
|
|
||||||
|
|
||||||
var code = GetResultCode(authResult, state);
|
var code = GetResultCode(authResult, state);
|
||||||
if (!string.IsNullOrEmpty(code))
|
if (!string.IsNullOrEmpty(code))
|
||||||
@@ -176,8 +168,6 @@ namespace Bit.App.Pages
|
|||||||
{
|
{
|
||||||
// user canceled
|
// user canceled
|
||||||
await _deviceActionService.HideLoadingAsync();
|
await _deviceActionService.HideLoadingAsync();
|
||||||
// Workaroung for cached expired sso token PM-3551
|
|
||||||
_useEphemeralWebBrowserSession = true;
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -207,92 +197,28 @@ namespace Bit.App.Pages
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var response = await _authService.LogInSsoAsync(code, codeVerifier, REDIRECT_URI, orgId);
|
var response = await _authService.LogInSsoAsync(code, codeVerifier, REDIRECT_URI, orgId);
|
||||||
var decryptOptions = await _stateService.GetAccountDecryptionOptions();
|
|
||||||
await AppHelpers.ResetInvalidUnlockAttemptsAsync();
|
await AppHelpers.ResetInvalidUnlockAttemptsAsync();
|
||||||
await _stateService.SetRememberedOrgIdentifierAsync(OrgIdentifier);
|
await _stateService.SetRememberedOrgIdentifierAsync(OrgIdentifier);
|
||||||
await _deviceActionService.HideLoadingAsync();
|
await _deviceActionService.HideLoadingAsync();
|
||||||
if (response.TwoFactor)
|
if (response.TwoFactor)
|
||||||
{
|
{
|
||||||
StartTwoFactorAction?.Invoke();
|
StartTwoFactorAction?.Invoke();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
else if (response.ResetMasterPassword)
|
||||||
// Trusted device option is sent regardless if this is a trusted device or not
|
|
||||||
// If it is trusted, it will have the necessary keys
|
|
||||||
if (decryptOptions?.TrustedDeviceOption != null)
|
|
||||||
{
|
{
|
||||||
if (await _deviceTrustCryptoService.IsDeviceTrustedAsync())
|
StartSetPasswordAction?.Invoke();
|
||||||
{
|
|
||||||
// If we have a device key but no keys on server, we need to remove the device key
|
|
||||||
if (decryptOptions.TrustedDeviceOption.EncryptedPrivateKey == null && decryptOptions.TrustedDeviceOption.EncryptedUserKey == null)
|
|
||||||
{
|
|
||||||
await _deviceTrustCryptoService.RemoveTrustedDeviceAsync();
|
|
||||||
StartDeviceApprovalOptionsAction?.Invoke();
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
// Update temp password only if the device is trusted and therefore has a decrypted User Key set
|
else if (response.ForcePasswordReset)
|
||||||
if (response.ForcePasswordReset)
|
|
||||||
{
|
{
|
||||||
UpdateTempPasswordAction?.Invoke();
|
UpdateTempPasswordAction?.Invoke();
|
||||||
return;
|
|
||||||
}
|
|
||||||
// If user doesn't have a MP, but has reset password permission, they must set a MP
|
|
||||||
if (!decryptOptions.HasMasterPassword &&
|
|
||||||
decryptOptions.TrustedDeviceOption.HasManageResetPasswordPermission)
|
|
||||||
{
|
|
||||||
await _stateService.SetForcePasswordResetReasonAsync(ForcePasswordResetReason.TdeUserWithoutPasswordHasPasswordResetPermission);
|
|
||||||
}
|
|
||||||
// Device is trusted and has keys, so we can decrypt
|
|
||||||
_syncService.FullSyncAsync(true).FireAndForget();
|
|
||||||
SsoAuthSuccessAction?.Invoke();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check for pending Admin Auth requests before navigating to device approval options
|
|
||||||
var pendingRequest = await _stateService.GetPendingAdminAuthRequestAsync();
|
|
||||||
if (pendingRequest != null)
|
|
||||||
{
|
|
||||||
var authRequest = await _authService.GetPasswordlessLoginRequestByIdAsync(pendingRequest.Id);
|
|
||||||
if (authRequest?.RequestApproved == true)
|
|
||||||
{
|
|
||||||
var authResult = await _authService.LogInPasswordlessAsync(true, await _stateService.GetActiveUserEmailAsync(), authRequest.RequestAccessCode, pendingRequest.Id, pendingRequest.PrivateKey, authRequest.Key, authRequest.MasterPasswordHash);
|
|
||||||
if (authResult == null && await _stateService.IsAuthenticatedAsync())
|
|
||||||
{
|
|
||||||
await Xamarin.Essentials.MainThread.InvokeOnMainThreadAsync(
|
|
||||||
() => _platformUtilsService.ShowToast("info", null, AppResources.LoginApproved));
|
|
||||||
await _stateService.SetPendingAdminAuthRequestAsync(null);
|
|
||||||
_syncService.FullSyncAsync(true).FireAndForget();
|
|
||||||
SsoAuthSuccessAction?.Invoke();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
await _stateService.SetPendingAdminAuthRequestAsync(null);
|
var task = Task.Run(async () => await _syncService.FullSyncAsync(true));
|
||||||
StartDeviceApprovalOptionsAction?.Invoke();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
StartDeviceApprovalOptionsAction?.Invoke();
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// In the standard, non TDE case, a user must set password if they don't
|
|
||||||
// have one and they aren't using key connector.
|
|
||||||
// Note: TDE & Key connector are mutually exclusive org config options.
|
|
||||||
if (response.ResetMasterPassword || (decryptOptions?.RequireSetPassword == true))
|
|
||||||
{
|
|
||||||
// TODO: We need to look into how to handle this when Org removes TDE
|
|
||||||
// Will we have the User Key by now to set a new password?
|
|
||||||
StartSetPasswordAction?.Invoke();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_syncService.FullSyncAsync(true).FireAndForget();
|
|
||||||
SsoAuthSuccessAction?.Invoke();
|
SsoAuthSuccessAction?.Invoke();
|
||||||
}
|
}
|
||||||
catch (Exception)
|
}
|
||||||
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
await _deviceActionService.HideLoadingAsync();
|
await _deviceActionService.HideLoadingAsync();
|
||||||
await _platformUtilsService.ShowDialogAsync(AppResources.LoginSsoError,
|
await _platformUtilsService.ShowDialogAsync(AppResources.LoginSsoError,
|
||||||
|
|||||||
@@ -177,28 +177,25 @@ namespace Bit.App.Pages
|
|||||||
Name = string.IsNullOrWhiteSpace(Name) ? null : Name;
|
Name = string.IsNullOrWhiteSpace(Name) ? null : Name;
|
||||||
Email = Email.Trim().ToLower();
|
Email = Email.Trim().ToLower();
|
||||||
var kdfConfig = new KdfConfig(KdfType.PBKDF2_SHA256, Constants.Pbkdf2Iterations, null, null);
|
var kdfConfig = new KdfConfig(KdfType.PBKDF2_SHA256, Constants.Pbkdf2Iterations, null, null);
|
||||||
var newMasterKey = await _cryptoService.MakeMasterKeyAsync(MasterPassword, Email, kdfConfig);
|
var key = await _cryptoService.MakeKeyAsync(MasterPassword, Email, kdfConfig);
|
||||||
var (newUserKey, newProtectedUserKey) = await _cryptoService.EncryptUserKeyWithMasterKeyAsync(
|
var encKey = await _cryptoService.MakeEncKeyAsync(key);
|
||||||
newMasterKey,
|
var hashedPassword = await _cryptoService.HashPasswordAsync(MasterPassword, key);
|
||||||
await _cryptoService.MakeUserKeyAsync()
|
var keys = await _cryptoService.MakeKeyPairAsync(encKey.Item1);
|
||||||
);
|
|
||||||
var hashedPassword = await _cryptoService.HashMasterKeyAsync(MasterPassword, newMasterKey);
|
|
||||||
var (newPublicKey, newProtectedPrivateKey) = await _cryptoService.MakeKeyPairAsync(newUserKey);
|
|
||||||
var request = new RegisterRequest
|
var request = new RegisterRequest
|
||||||
{
|
{
|
||||||
Email = Email,
|
Email = Email,
|
||||||
Name = Name,
|
Name = Name,
|
||||||
MasterPasswordHash = hashedPassword,
|
MasterPasswordHash = hashedPassword,
|
||||||
MasterPasswordHint = Hint,
|
MasterPasswordHint = Hint,
|
||||||
Key = newProtectedUserKey.EncryptedString,
|
Key = encKey.Item2.EncryptedString,
|
||||||
Kdf = kdfConfig.Type,
|
Kdf = kdfConfig.Type,
|
||||||
KdfIterations = kdfConfig.Iterations,
|
KdfIterations = kdfConfig.Iterations,
|
||||||
KdfMemory = kdfConfig.Memory,
|
KdfMemory = kdfConfig.Memory,
|
||||||
KdfParallelism = kdfConfig.Parallelism,
|
KdfParallelism = kdfConfig.Parallelism,
|
||||||
Keys = new KeysRequest
|
Keys = new KeysRequest
|
||||||
{
|
{
|
||||||
PublicKey = newPublicKey,
|
PublicKey = keys.Item1,
|
||||||
EncryptedPrivateKey = newProtectedPrivateKey.EncryptedString
|
EncryptedPrivateKey = keys.Item2.EncryptedString
|
||||||
},
|
},
|
||||||
CaptchaResponse = _captchaToken,
|
CaptchaResponse = _captchaToken,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -30,14 +30,14 @@ namespace Bit.App.Pages
|
|||||||
|
|
||||||
public async Task Init()
|
public async Task Init()
|
||||||
{
|
{
|
||||||
Organization = await _keyConnectorService.GetManagingOrganizationAsync();
|
Organization = await _keyConnectorService.GetManagingOrganization();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task MigrateAccount()
|
public async Task MigrateAccount()
|
||||||
{
|
{
|
||||||
await _deviceActionService.ShowLoadingAsync(AppResources.Loading);
|
await _deviceActionService.ShowLoadingAsync(AppResources.Loading);
|
||||||
|
|
||||||
await _keyConnectorService.MigrateUserAsync();
|
await _keyConnectorService.MigrateUser();
|
||||||
await _syncService.FullSyncAsync(true);
|
await _syncService.FullSyncAsync(true);
|
||||||
|
|
||||||
await _deviceActionService.HideLoadingAsync();
|
await _deviceActionService.HideLoadingAsync();
|
||||||
@@ -47,7 +47,7 @@ namespace Bit.App.Pages
|
|||||||
{
|
{
|
||||||
await _deviceActionService.ShowLoadingAsync(AppResources.Loading);
|
await _deviceActionService.ShowLoadingAsync(AppResources.Loading);
|
||||||
|
|
||||||
await _apiService.PostLeaveOrganizationAsync(Organization.Id);
|
await _apiService.PostLeaveOrganization(Organization.Id);
|
||||||
await _syncService.FullSyncAsync(true);
|
await _syncService.FullSyncAsync(true);
|
||||||
|
|
||||||
await _deviceActionService.HideLoadingAsync();
|
await _deviceActionService.HideLoadingAsync();
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
<StackLayout Spacing="20">
|
<StackLayout Spacing="20">
|
||||||
<StackLayout StyleClass="box">
|
<StackLayout StyleClass="box">
|
||||||
<StackLayout StyleClass="box-row">
|
<StackLayout StyleClass="box-row">
|
||||||
<Label Text="{Binding SetMasterPasswordSummary}"
|
<Label Text="{u:I18n SetMasterPasswordSummary}"
|
||||||
StyleClass="text-md"
|
StyleClass="text-md"
|
||||||
HorizontalTextAlignment="Start"></Label>
|
HorizontalTextAlignment="Start"></Label>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
@@ -51,8 +51,7 @@
|
|||||||
<Label
|
<Label
|
||||||
Text="{u:I18n ResetPasswordAutoEnrollInviteWarning}"
|
Text="{u:I18n ResetPasswordAutoEnrollInviteWarning}"
|
||||||
StyleClass="text-muted, text-sm, text-bold"
|
StyleClass="text-muted, text-sm, text-bold"
|
||||||
HorizontalTextAlignment="Start"
|
HorizontalTextAlignment="Start" />
|
||||||
AutomationId="ResetPasswordAutoEnrollInviteWarningLabel" />
|
|
||||||
</Frame>
|
</Frame>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid IsVisible="{Binding IsPolicyInEffect}"
|
<Grid IsVisible="{Binding IsPolicyInEffect}"
|
||||||
@@ -74,8 +73,7 @@
|
|||||||
<Label
|
<Label
|
||||||
Text="{Binding PolicySummary}"
|
Text="{Binding PolicySummary}"
|
||||||
StyleClass="text-muted, text-sm, text-bold"
|
StyleClass="text-muted, text-sm, text-bold"
|
||||||
HorizontalTextAlignment="Start"
|
HorizontalTextAlignment="Start" />
|
||||||
AutomationId="PolicyInEffectLabel" />
|
|
||||||
</Frame>
|
</Frame>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid StyleClass="box-row">
|
<Grid StyleClass="box-row">
|
||||||
@@ -100,8 +98,7 @@
|
|||||||
IsTextPredictionEnabled="False"
|
IsTextPredictionEnabled="False"
|
||||||
IsPassword="{Binding ShowPassword, Converter={StaticResource inverseBool}}"
|
IsPassword="{Binding ShowPassword, Converter={StaticResource inverseBool}}"
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
Grid.Column="0"
|
Grid.Column="0" />
|
||||||
AutomationId="MasterPasswordField" />
|
|
||||||
<controls:IconButton
|
<controls:IconButton
|
||||||
StyleClass="box-row-button, box-row-button-platform"
|
StyleClass="box-row-button, box-row-button-platform"
|
||||||
Text="{Binding ShowPasswordIcon}"
|
Text="{Binding ShowPasswordIcon}"
|
||||||
@@ -111,8 +108,7 @@
|
|||||||
Grid.RowSpan="2"
|
Grid.RowSpan="2"
|
||||||
AutomationProperties.IsInAccessibleTree="True"
|
AutomationProperties.IsInAccessibleTree="True"
|
||||||
AutomationProperties.Name="{u:I18n ToggleVisibility}"
|
AutomationProperties.Name="{u:I18n ToggleVisibility}"
|
||||||
AutomationProperties.HelpText="{Binding PasswordVisibilityAccessibilityText}"
|
AutomationProperties.HelpText="{Binding PasswordVisibilityAccessibilityText}" />
|
||||||
AutomationId="ToggleMasterPasswordVisibilityButton" />
|
|
||||||
</Grid>
|
</Grid>
|
||||||
<Label
|
<Label
|
||||||
Text="{u:I18n MasterPasswordDescription}"
|
Text="{u:I18n MasterPasswordDescription}"
|
||||||
@@ -141,8 +137,7 @@
|
|||||||
IsTextPredictionEnabled="False"
|
IsTextPredictionEnabled="False"
|
||||||
IsPassword="{Binding ShowPassword, Converter={StaticResource inverseBool}}"
|
IsPassword="{Binding ShowPassword, Converter={StaticResource inverseBool}}"
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
Grid.Column="0"
|
Grid.Column="0" />
|
||||||
AutomationId="RetypePasswordField" />
|
|
||||||
<controls:IconButton
|
<controls:IconButton
|
||||||
StyleClass="box-row-button, box-row-button-platform"
|
StyleClass="box-row-button, box-row-button-platform"
|
||||||
Text="{Binding ShowPasswordIcon}"
|
Text="{Binding ShowPasswordIcon}"
|
||||||
@@ -152,8 +147,7 @@
|
|||||||
Grid.RowSpan="2"
|
Grid.RowSpan="2"
|
||||||
AutomationProperties.IsInAccessibleTree="True"
|
AutomationProperties.IsInAccessibleTree="True"
|
||||||
AutomationProperties.Name="{u:I18n ToggleVisibility}"
|
AutomationProperties.Name="{u:I18n ToggleVisibility}"
|
||||||
AutomationProperties.HelpText="{Binding PasswordVisibilityAccessibilityText}"
|
AutomationProperties.HelpText="{Binding PasswordVisibilityAccessibilityText}" />
|
||||||
AutomationId="ToggleRetypePasswordVisibilityButton" />
|
|
||||||
</Grid>
|
</Grid>
|
||||||
<StackLayout StyleClass="box-row">
|
<StackLayout StyleClass="box-row">
|
||||||
<Label
|
<Label
|
||||||
@@ -164,8 +158,7 @@
|
|||||||
Text="{Binding Hint}"
|
Text="{Binding Hint}"
|
||||||
StyleClass="box-value"
|
StyleClass="box-value"
|
||||||
ReturnType="Go"
|
ReturnType="Go"
|
||||||
ReturnCommand="{Binding SubmitCommand}"
|
ReturnCommand="{Binding SubmitCommand}" />
|
||||||
AutomationId="MasterPasswordHintLabel" />
|
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
<Label
|
<Label
|
||||||
Text="{u:I18n MasterPasswordHintDescription}"
|
Text="{u:I18n MasterPasswordHintDescription}"
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using System.Text.RegularExpressions;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Bit.App.Abstractions;
|
using Bit.App.Abstractions;
|
||||||
using Bit.App.Resources;
|
using Bit.App.Resources;
|
||||||
|
using Bit.App.Utilities;
|
||||||
using Bit.Core;
|
using Bit.Core;
|
||||||
using Bit.Core.Abstractions;
|
using Bit.Core.Abstractions;
|
||||||
using Bit.Core.Enums;
|
using Bit.Core.Enums;
|
||||||
@@ -27,7 +28,6 @@ namespace Bit.App.Pages
|
|||||||
private readonly IPolicyService _policyService;
|
private readonly IPolicyService _policyService;
|
||||||
private readonly IPasswordGenerationService _passwordGenerationService;
|
private readonly IPasswordGenerationService _passwordGenerationService;
|
||||||
private readonly II18nService _i18nService;
|
private readonly II18nService _i18nService;
|
||||||
private readonly ISyncService _syncService;
|
|
||||||
|
|
||||||
private bool _showPassword;
|
private bool _showPassword;
|
||||||
private bool _isPolicyInEffect;
|
private bool _isPolicyInEffect;
|
||||||
@@ -46,7 +46,6 @@ namespace Bit.App.Pages
|
|||||||
_passwordGenerationService =
|
_passwordGenerationService =
|
||||||
ServiceContainer.Resolve<IPasswordGenerationService>("passwordGenerationService");
|
ServiceContainer.Resolve<IPasswordGenerationService>("passwordGenerationService");
|
||||||
_i18nService = ServiceContainer.Resolve<II18nService>("i18nService");
|
_i18nService = ServiceContainer.Resolve<II18nService>("i18nService");
|
||||||
_syncService = ServiceContainer.Resolve<ISyncService>();
|
|
||||||
|
|
||||||
PageTitle = AppResources.SetMasterPassword;
|
PageTitle = AppResources.SetMasterPassword;
|
||||||
TogglePasswordCommand = new Command(TogglePassword);
|
TogglePasswordCommand = new Command(TogglePassword);
|
||||||
@@ -101,17 +100,11 @@ namespace Bit.App.Pages
|
|||||||
public Action CloseAction { get; set; }
|
public Action CloseAction { get; set; }
|
||||||
public string OrgIdentifier { get; set; }
|
public string OrgIdentifier { get; set; }
|
||||||
public string OrgId { get; set; }
|
public string OrgId { get; set; }
|
||||||
public ForcePasswordResetReason? ForceSetPasswordReason { get; private set; }
|
|
||||||
|
|
||||||
public string SetMasterPasswordSummary => ForceSetPasswordReason == ForcePasswordResetReason.TdeUserWithoutPasswordHasPasswordResetPermission
|
|
||||||
? AppResources.YourOrganizationPermissionsWereUpdatedRequeringYouToSetAMasterPassword
|
|
||||||
: AppResources.YourOrganizationRequiresYouToSetAMasterPassword;
|
|
||||||
|
|
||||||
public async Task InitAsync()
|
public async Task InitAsync()
|
||||||
{
|
{
|
||||||
await CheckPasswordPolicy();
|
await CheckPasswordPolicy();
|
||||||
ForceSetPasswordReason = await _stateService.GetForcePasswordResetReasonAsync();
|
|
||||||
TriggerPropertyChanged(nameof(SetMasterPasswordSummary));
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var response = await _apiService.GetOrganizationAutoEnrollStatusAsync(OrgIdentifier);
|
var response = await _apiService.GetOrganizationAutoEnrollStatusAsync(OrgIdentifier);
|
||||||
@@ -172,52 +165,58 @@ namespace Bit.App.Pages
|
|||||||
|
|
||||||
var kdfConfig = new KdfConfig(KdfType.PBKDF2_SHA256, Constants.Pbkdf2Iterations, null, null);
|
var kdfConfig = new KdfConfig(KdfType.PBKDF2_SHA256, Constants.Pbkdf2Iterations, null, null);
|
||||||
var email = await _stateService.GetEmailAsync();
|
var email = await _stateService.GetEmailAsync();
|
||||||
var newMasterKey = await _cryptoService.MakeMasterKeyAsync(MasterPassword, email, kdfConfig);
|
var key = await _cryptoService.MakeKeyAsync(MasterPassword, email, kdfConfig);
|
||||||
var masterPasswordHash = await _cryptoService.HashMasterKeyAsync(MasterPassword, newMasterKey, HashPurpose.ServerAuthorization);
|
var masterPasswordHash = await _cryptoService.HashPasswordAsync(MasterPassword, key, HashPurpose.ServerAuthorization);
|
||||||
var localMasterPasswordHash = await _cryptoService.HashMasterKeyAsync(MasterPassword, newMasterKey, HashPurpose.LocalAuthorization);
|
var localMasterPasswordHash = await _cryptoService.HashPasswordAsync(MasterPassword, key, HashPurpose.LocalAuthorization);
|
||||||
|
|
||||||
var (newUserKey, newProtectedUserKey) = await _cryptoService.EncryptUserKeyWithMasterKeyAsync(newMasterKey,
|
Tuple<SymmetricCryptoKey, EncString> encKey;
|
||||||
await _cryptoService.GetUserKeyAsync() ?? await _cryptoService.MakeUserKeyAsync());
|
var existingEncKey = await _cryptoService.GetEncKeyAsync();
|
||||||
var keysRequest = await GetKeysForSetPasswordRequestAsync(newUserKey);
|
if (existingEncKey == null)
|
||||||
|
{
|
||||||
|
encKey = await _cryptoService.MakeEncKeyAsync(key);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
encKey = await _cryptoService.RemakeEncKeyAsync(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
var keys = await _cryptoService.MakeKeyPairAsync(encKey.Item1);
|
||||||
var request = new SetPasswordRequest
|
var request = new SetPasswordRequest
|
||||||
{
|
{
|
||||||
MasterPasswordHash = masterPasswordHash,
|
MasterPasswordHash = masterPasswordHash,
|
||||||
Key = newProtectedUserKey.EncryptedString,
|
Key = encKey.Item2.EncryptedString,
|
||||||
MasterPasswordHint = Hint,
|
MasterPasswordHint = Hint,
|
||||||
Kdf = kdfConfig.Type.GetValueOrDefault(KdfType.PBKDF2_SHA256),
|
Kdf = kdfConfig.Type.GetValueOrDefault(KdfType.PBKDF2_SHA256),
|
||||||
KdfIterations = kdfConfig.Iterations.GetValueOrDefault(Constants.Pbkdf2Iterations),
|
KdfIterations = kdfConfig.Iterations.GetValueOrDefault(Constants.Pbkdf2Iterations),
|
||||||
KdfMemory = kdfConfig.Memory,
|
KdfMemory = kdfConfig.Memory,
|
||||||
KdfParallelism = kdfConfig.Parallelism,
|
KdfParallelism = kdfConfig.Parallelism,
|
||||||
OrgIdentifier = OrgIdentifier,
|
OrgIdentifier = OrgIdentifier,
|
||||||
Keys = keysRequest
|
Keys = new KeysRequest
|
||||||
|
{
|
||||||
|
PublicKey = keys.Item1,
|
||||||
|
EncryptedPrivateKey = keys.Item2.EncryptedString
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await _deviceActionService.ShowLoadingAsync(AppResources.Loading);
|
await _deviceActionService.ShowLoadingAsync(AppResources.CreatingAccount);
|
||||||
// Set Password and relevant information
|
// Set Password and relevant information
|
||||||
await _apiService.SetPasswordAsync(request);
|
await _apiService.SetPasswordAsync(request);
|
||||||
await _stateService.SetKdfConfigurationAsync(kdfConfig);
|
await _stateService.SetKdfConfigurationAsync(kdfConfig);
|
||||||
await _cryptoService.SetUserKeyAsync(newUserKey);
|
await _cryptoService.SetKeyAsync(key);
|
||||||
await _cryptoService.SetMasterKeyAsync(newMasterKey);
|
await _cryptoService.SetKeyHashAsync(localMasterPasswordHash);
|
||||||
await _cryptoService.SetMasterKeyHashAsync(localMasterPasswordHash);
|
await _cryptoService.SetEncKeyAsync(encKey.Item2.EncryptedString);
|
||||||
await _cryptoService.SetMasterKeyEncryptedUserKeyAsync(newProtectedUserKey.EncryptedString);
|
await _cryptoService.SetEncPrivateKeyAsync(keys.Item2.EncryptedString);
|
||||||
|
|
||||||
// Set private key only for new JIT provisioned users in MP encryption orgs
|
|
||||||
// Existing TDE users will have private key set on sync or on login
|
|
||||||
if (keysRequest != null)
|
|
||||||
{
|
|
||||||
await _cryptoService.SetUserPrivateKeyAsync(keysRequest.EncryptedPrivateKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ResetPasswordAutoEnroll)
|
if (ResetPasswordAutoEnroll)
|
||||||
{
|
{
|
||||||
// Grab Organization Keys
|
// Grab Organization Keys
|
||||||
var response = await _apiService.GetOrganizationKeysAsync(OrgId);
|
var response = await _apiService.GetOrganizationKeysAsync(OrgId);
|
||||||
var publicKey = CoreHelpers.Base64UrlDecode(response.PublicKey);
|
var publicKey = CoreHelpers.Base64UrlDecode(response.PublicKey);
|
||||||
// Grab User Key and encrypt with Org Public Key
|
// Grab user's Encryption Key and encrypt with Org Public Key
|
||||||
var userKey = await _cryptoService.GetUserKeyAsync();
|
var userEncKey = await _cryptoService.GetEncKeyAsync();
|
||||||
var encryptedKey = await _cryptoService.RsaEncryptAsync(userKey.Key, publicKey);
|
var encryptedKey = await _cryptoService.RsaEncryptAsync(userEncKey.Key, publicKey);
|
||||||
// Request
|
// Request
|
||||||
var resetRequest = new OrganizationUserResetPasswordEnrollmentRequest
|
var resetRequest = new OrganizationUserResetPasswordEnrollmentRequest
|
||||||
{
|
{
|
||||||
@@ -229,9 +228,6 @@ namespace Bit.App.Pages
|
|||||||
await _apiService.PutOrganizationUserResetPasswordEnrollmentAsync(OrgId, userId, resetRequest);
|
await _apiService.PutOrganizationUserResetPasswordEnrollmentAsync(OrgId, userId, resetRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
await _stateService.SetForcePasswordResetReasonAsync(null);
|
|
||||||
await _stateService.SetUserHasMasterPasswordAsync(true);
|
|
||||||
await _syncService.FullSyncAsync(true);
|
|
||||||
await _deviceActionService.HideLoadingAsync();
|
await _deviceActionService.HideLoadingAsync();
|
||||||
SetPasswordSuccessAction?.Invoke();
|
SetPasswordSuccessAction?.Invoke();
|
||||||
}
|
}
|
||||||
@@ -246,21 +242,6 @@ namespace Bit.App.Pages
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<KeysRequest> GetKeysForSetPasswordRequestAsync(UserKey newUserKey)
|
|
||||||
{
|
|
||||||
if (ForceSetPasswordReason == ForcePasswordResetReason.TdeUserWithoutPasswordHasPasswordResetPermission)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
var (newPublicKey, newProtectedPrivateKey) = await _cryptoService.MakeKeyPairAsync(newUserKey);
|
|
||||||
return new KeysRequest
|
|
||||||
{
|
|
||||||
PublicKey = newPublicKey,
|
|
||||||
EncryptedPrivateKey = newProtectedPrivateKey.EncryptedString
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public void TogglePassword()
|
public void TogglePassword()
|
||||||
{
|
{
|
||||||
ShowPassword = !ShowPassword;
|
ShowPassword = !ShowPassword;
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ using Bit.App.Controls;
|
|||||||
using Bit.App.Models;
|
using Bit.App.Models;
|
||||||
using Bit.App.Utilities;
|
using Bit.App.Utilities;
|
||||||
using Bit.Core.Abstractions;
|
using Bit.Core.Abstractions;
|
||||||
using Bit.Core.Services;
|
|
||||||
using Bit.Core.Utilities;
|
using Bit.Core.Utilities;
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
|
|
||||||
@@ -18,29 +17,26 @@ namespace Bit.App.Pages
|
|||||||
|
|
||||||
private TwoFactorPageViewModel _vm;
|
private TwoFactorPageViewModel _vm;
|
||||||
private bool _inited;
|
private bool _inited;
|
||||||
|
private bool _authingWithSso;
|
||||||
private string _orgIdentifier;
|
private string _orgIdentifier;
|
||||||
|
|
||||||
public TwoFactorPage(bool? authingWithSso = false, AppOptions appOptions = null, string orgIdentifier = null)
|
public TwoFactorPage(bool? authingWithSso = false, AppOptions appOptions = null, string orgIdentifier = null)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
SetActivityIndicator();
|
SetActivityIndicator();
|
||||||
|
_authingWithSso = authingWithSso ?? false;
|
||||||
_appOptions = appOptions;
|
_appOptions = appOptions;
|
||||||
_orgIdentifier = orgIdentifier;
|
_orgIdentifier = orgIdentifier;
|
||||||
_broadcasterService = ServiceContainer.Resolve<IBroadcasterService>("broadcasterService");
|
_broadcasterService = ServiceContainer.Resolve<IBroadcasterService>("broadcasterService");
|
||||||
_messagingService = ServiceContainer.Resolve<IMessagingService>("messagingService");
|
_messagingService = ServiceContainer.Resolve<IMessagingService>("messagingService");
|
||||||
_vm = BindingContext as TwoFactorPageViewModel;
|
_vm = BindingContext as TwoFactorPageViewModel;
|
||||||
_vm.Page = this;
|
_vm.Page = this;
|
||||||
_vm.AuthingWithSso = authingWithSso ?? false;
|
|
||||||
_vm.StartSetPasswordAction = () =>
|
_vm.StartSetPasswordAction = () =>
|
||||||
Device.BeginInvokeOnMainThread(async () => await StartSetPasswordAsync());
|
Device.BeginInvokeOnMainThread(async () => await StartSetPasswordAsync());
|
||||||
_vm.TwoFactorAuthSuccessAction = () =>
|
_vm.TwoFactorAuthSuccessAction = () =>
|
||||||
Device.BeginInvokeOnMainThread(async () => await TwoFactorAuthSuccessToMainAsync());
|
Device.BeginInvokeOnMainThread(async () => await TwoFactorAuthSuccessAsync());
|
||||||
_vm.LockAction = () =>
|
|
||||||
Device.BeginInvokeOnMainThread(TwoFactorAuthSuccessWithSSOLocked);
|
|
||||||
_vm.UpdateTempPasswordAction =
|
_vm.UpdateTempPasswordAction =
|
||||||
() => Device.BeginInvokeOnMainThread(async () => await UpdateTempPasswordAsync());
|
() => Device.BeginInvokeOnMainThread(async () => await UpdateTempPasswordAsync());
|
||||||
_vm.StartDeviceApprovalOptionsAction =
|
|
||||||
() => Device.BeginInvokeOnMainThread(async () => await StartDeviceApprovalOptionsAsync());
|
|
||||||
_vm.CloseAction = async () => await Navigation.PopModalAsync();
|
_vm.CloseAction = async () => await Navigation.PopModalAsync();
|
||||||
DuoWebView = _duoWebView;
|
DuoWebView = _duoWebView;
|
||||||
if (Device.RuntimePlatform == Device.Android)
|
if (Device.RuntimePlatform == Device.Android)
|
||||||
@@ -184,18 +180,13 @@ namespace Bit.App.Pages
|
|||||||
await Navigation.PushModalAsync(new NavigationPage(page));
|
await Navigation.PushModalAsync(new NavigationPage(page));
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task StartDeviceApprovalOptionsAsync()
|
private async Task TwoFactorAuthSuccessAsync()
|
||||||
{
|
{
|
||||||
var page = new LoginApproveDevicePage();
|
if (_authingWithSso)
|
||||||
await Navigation.PushModalAsync(new NavigationPage(page));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void TwoFactorAuthSuccessWithSSOLocked()
|
|
||||||
{
|
{
|
||||||
Application.Current.MainPage = new NavigationPage(new LockPage(_appOptions));
|
Application.Current.MainPage = new NavigationPage(new LockPage(_appOptions));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
private async Task TwoFactorAuthSuccessToMainAsync()
|
|
||||||
{
|
{
|
||||||
if (AppHelpers.SetAlternateMainPage(_appOptions))
|
if (AppHelpers.SetAlternateMainPage(_appOptions))
|
||||||
{
|
{
|
||||||
@@ -204,6 +195,7 @@ namespace Bit.App.Pages
|
|||||||
var previousPage = await AppHelpers.ClearPreviousPage();
|
var previousPage = await AppHelpers.ClearPreviousPage();
|
||||||
Application.Current.MainPage = new TabsPage(_appOptions, previousPage);
|
Application.Current.MainPage = new TabsPage(_appOptions, previousPage);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void Token_TextChanged(object sender, TextChangedEventArgs e)
|
private void Token_TextChanged(object sender, TextChangedEventArgs e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,9 +10,7 @@ using Bit.App.Utilities;
|
|||||||
using Bit.Core.Abstractions;
|
using Bit.Core.Abstractions;
|
||||||
using Bit.Core.Enums;
|
using Bit.Core.Enums;
|
||||||
using Bit.Core.Exceptions;
|
using Bit.Core.Exceptions;
|
||||||
using Bit.Core.Models.Domain;
|
|
||||||
using Bit.Core.Models.Request;
|
using Bit.Core.Models.Request;
|
||||||
using Bit.Core.Services;
|
|
||||||
using Bit.Core.Utilities;
|
using Bit.Core.Utilities;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Xamarin.CommunityToolkit.ObjectModel;
|
using Xamarin.CommunityToolkit.ObjectModel;
|
||||||
@@ -34,12 +32,12 @@ namespace Bit.App.Pages
|
|||||||
private readonly IStateService _stateService;
|
private readonly IStateService _stateService;
|
||||||
private readonly II18nService _i18nService;
|
private readonly II18nService _i18nService;
|
||||||
private readonly IAppIdService _appIdService;
|
private readonly IAppIdService _appIdService;
|
||||||
private readonly IVaultTimeoutService _vaultTimeoutService;
|
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IDeviceTrustCryptoService _deviceTrustCryptoService;
|
|
||||||
private TwoFactorProviderType? _selectedProviderType;
|
private TwoFactorProviderType? _selectedProviderType;
|
||||||
private string _totpInstruction;
|
private string _totpInstruction;
|
||||||
private string _webVaultUrl = "https://vault.bitwarden.com";
|
private string _webVaultUrl = "https://vault.bitwarden.com";
|
||||||
|
private bool _authingWithSso = false;
|
||||||
private bool _enableContinue = false;
|
private bool _enableContinue = false;
|
||||||
private bool _showContinue = true;
|
private bool _showContinue = true;
|
||||||
|
|
||||||
@@ -56,9 +54,7 @@ namespace Bit.App.Pages
|
|||||||
_stateService = ServiceContainer.Resolve<IStateService>("stateService");
|
_stateService = ServiceContainer.Resolve<IStateService>("stateService");
|
||||||
_i18nService = ServiceContainer.Resolve<II18nService>("i18nService");
|
_i18nService = ServiceContainer.Resolve<II18nService>("i18nService");
|
||||||
_appIdService = ServiceContainer.Resolve<IAppIdService>("appIdService");
|
_appIdService = ServiceContainer.Resolve<IAppIdService>("appIdService");
|
||||||
_vaultTimeoutService = ServiceContainer.Resolve<IVaultTimeoutService>();
|
|
||||||
_logger = ServiceContainer.Resolve<ILogger>();
|
_logger = ServiceContainer.Resolve<ILogger>();
|
||||||
_deviceTrustCryptoService = ServiceContainer.Resolve<IDeviceTrustCryptoService>();
|
|
||||||
|
|
||||||
PageTitle = AppResources.TwoStepLogin;
|
PageTitle = AppResources.TwoStepLogin;
|
||||||
SubmitCommand = new Command(async () => await SubmitAsync());
|
SubmitCommand = new Command(async () => await SubmitAsync());
|
||||||
@@ -73,8 +69,6 @@ namespace Bit.App.Pages
|
|||||||
|
|
||||||
public bool Remember { get; set; }
|
public bool Remember { get; set; }
|
||||||
|
|
||||||
public bool AuthingWithSso { get; set; }
|
|
||||||
|
|
||||||
public string Token { get; set; }
|
public string Token { get; set; }
|
||||||
|
|
||||||
public bool DuoMethod => SelectedProviderType == TwoFactorProviderType.Duo ||
|
public bool DuoMethod => SelectedProviderType == TwoFactorProviderType.Duo ||
|
||||||
@@ -124,8 +118,6 @@ namespace Bit.App.Pages
|
|||||||
public Command SubmitCommand { get; }
|
public Command SubmitCommand { get; }
|
||||||
public ICommand MoreCommand { get; }
|
public ICommand MoreCommand { get; }
|
||||||
public Action TwoFactorAuthSuccessAction { get; set; }
|
public Action TwoFactorAuthSuccessAction { get; set; }
|
||||||
public Action LockAction { get; set; }
|
|
||||||
public Action StartDeviceApprovalOptionsAction { get; set; }
|
|
||||||
public Action StartSetPasswordAction { get; set; }
|
public Action StartSetPasswordAction { get; set; }
|
||||||
public Action CloseAction { get; set; }
|
public Action CloseAction { get; set; }
|
||||||
public Action UpdateTempPasswordAction { get; set; }
|
public Action UpdateTempPasswordAction { get; set; }
|
||||||
@@ -144,6 +136,8 @@ namespace Bit.App.Pages
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_authingWithSso = _authService.AuthingWithSso();
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(_environmentService.BaseUrl))
|
if (!string.IsNullOrWhiteSpace(_environmentService.BaseUrl))
|
||||||
{
|
{
|
||||||
_webVaultUrl = _environmentService.BaseUrl;
|
_webVaultUrl = _environmentService.BaseUrl;
|
||||||
@@ -321,83 +315,22 @@ namespace Bit.App.Pages
|
|||||||
|
|
||||||
var task = Task.Run(() => _syncService.FullSyncAsync(true));
|
var task = Task.Run(() => _syncService.FullSyncAsync(true));
|
||||||
await _deviceActionService.HideLoadingAsync();
|
await _deviceActionService.HideLoadingAsync();
|
||||||
var decryptOptions = await _stateService.GetAccountDecryptionOptions();
|
|
||||||
_messagingService.Send("listenYubiKeyOTP", false);
|
_messagingService.Send("listenYubiKeyOTP", false);
|
||||||
_broadcasterService.Unsubscribe(nameof(TwoFactorPage));
|
_broadcasterService.Unsubscribe(nameof(TwoFactorPage));
|
||||||
|
|
||||||
if (decryptOptions?.TrustedDeviceOption != null)
|
if (_authingWithSso && result.ResetMasterPassword)
|
||||||
{
|
{
|
||||||
if (await _deviceTrustCryptoService.IsDeviceTrustedAsync())
|
StartSetPasswordAction?.Invoke();
|
||||||
{
|
|
||||||
// If we have a device key but no keys on server, we need to remove the device key
|
|
||||||
if (decryptOptions.TrustedDeviceOption.EncryptedPrivateKey == null && decryptOptions.TrustedDeviceOption.EncryptedUserKey == null)
|
|
||||||
{
|
|
||||||
await _deviceTrustCryptoService.RemoveTrustedDeviceAsync();
|
|
||||||
StartDeviceApprovalOptionsAction?.Invoke();
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
// Update temp password only if the device is trusted and therefore has a decrypted User Key set
|
else if (result.ForcePasswordReset)
|
||||||
if (result.ForcePasswordReset)
|
|
||||||
{
|
{
|
||||||
UpdateTempPasswordAction?.Invoke();
|
UpdateTempPasswordAction?.Invoke();
|
||||||
return;
|
|
||||||
}
|
|
||||||
// If user doesn't have a MP, but has reset password permission, they must set a MP
|
|
||||||
if (!decryptOptions.HasMasterPassword &&
|
|
||||||
decryptOptions.TrustedDeviceOption.HasManageResetPasswordPermission)
|
|
||||||
{
|
|
||||||
await _stateService.SetForcePasswordResetReasonAsync(ForcePasswordResetReason.TdeUserWithoutPasswordHasPasswordResetPermission);
|
|
||||||
}
|
|
||||||
// Device is trusted and has keys, so we can decrypt
|
|
||||||
_syncService.FullSyncAsync(true).FireAndForget();
|
|
||||||
await TwoFactorAuthSuccessAsync();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check for pending Admin Auth requests before navigating to device approval options
|
|
||||||
var pendingRequest = await _stateService.GetPendingAdminAuthRequestAsync();
|
|
||||||
if (pendingRequest != null)
|
|
||||||
{
|
|
||||||
var authRequest = await _authService.GetPasswordlessLoginRequestByIdAsync(pendingRequest.Id);
|
|
||||||
if (authRequest?.RequestApproved == true)
|
|
||||||
{
|
|
||||||
var authResult = await _authService.LogInPasswordlessAsync(true, await _stateService.GetActiveUserEmailAsync(), authRequest.RequestAccessCode, pendingRequest.Id, pendingRequest.PrivateKey, authRequest.Key, authRequest.MasterPasswordHash);
|
|
||||||
if (authResult == null && await _stateService.IsAuthenticatedAsync())
|
|
||||||
{
|
|
||||||
await Xamarin.Essentials.MainThread.InvokeOnMainThreadAsync(
|
|
||||||
() => _platformUtilsService.ShowToast("info", null, AppResources.LoginApproved));
|
|
||||||
await _stateService.SetPendingAdminAuthRequestAsync(null);
|
|
||||||
_syncService.FullSyncAsync(true).FireAndForget();
|
|
||||||
await TwoFactorAuthSuccessAsync();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
await _stateService.SetPendingAdminAuthRequestAsync(null);
|
TwoFactorAuthSuccessAction?.Invoke();
|
||||||
StartDeviceApprovalOptionsAction?.Invoke();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
StartDeviceApprovalOptionsAction?.Invoke();
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// In the standard, non TDE case, a user must set password if they don't
|
|
||||||
// have one and they aren't using key connector.
|
|
||||||
// Note: TDE & Key connector are mutually exclusive org config options.
|
|
||||||
if (result.ResetMasterPassword || (decryptOptions?.RequireSetPassword ?? false))
|
|
||||||
{
|
|
||||||
// TODO: We need to look into how to handle this when Org removes TDE
|
|
||||||
// Will we have the User Key by now to set a new password?
|
|
||||||
StartSetPasswordAction?.Invoke();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_syncService.FullSyncAsync(true).FireAndForget();
|
|
||||||
await TwoFactorAuthSuccessAsync();
|
|
||||||
}
|
|
||||||
catch (ApiException e)
|
catch (ApiException e)
|
||||||
{
|
{
|
||||||
_captchaToken = null;
|
_captchaToken = null;
|
||||||
@@ -465,8 +398,7 @@ namespace Bit.App.Pages
|
|||||||
{
|
{
|
||||||
Email = _authService.Email,
|
Email = _authService.Email,
|
||||||
MasterPasswordHash = _authService.MasterPasswordHash,
|
MasterPasswordHash = _authService.MasterPasswordHash,
|
||||||
DeviceIdentifier = await _appIdService.GetAppIdAsync(),
|
DeviceIdentifier = await _appIdService.GetAppIdAsync()
|
||||||
SsoEmail2FaSessionToken = _authService.SsoEmail2FaSessionToken
|
|
||||||
};
|
};
|
||||||
await _apiService.PostTwoFactorEmailAsync(request);
|
await _apiService.PostTwoFactorEmailAsync(request);
|
||||||
if (showLoading)
|
if (showLoading)
|
||||||
@@ -490,17 +422,5 @@ namespace Bit.App.Pages
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task TwoFactorAuthSuccessAsync()
|
|
||||||
{
|
|
||||||
if (AuthingWithSso && await _vaultTimeoutService.IsLockedAsync())
|
|
||||||
{
|
|
||||||
LockAction?.Invoke();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TwoFactorAuthSuccessAction?.Invoke();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<pages:BaseContentPage
|
<pages:BaseContentPage
|
||||||
xmlns="http://xamarin.com/schemas/2014/forms"
|
xmlns="http://xamarin.com/schemas/2014/forms"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
@@ -48,8 +48,7 @@
|
|||||||
<Label
|
<Label
|
||||||
Text="{Binding UpdateMasterPasswordWarningText }"
|
Text="{Binding UpdateMasterPasswordWarningText }"
|
||||||
StyleClass="text-muted, text-sm, text-bold"
|
StyleClass="text-muted, text-sm, text-bold"
|
||||||
HorizontalTextAlignment="Center"
|
HorizontalTextAlignment="Center" />
|
||||||
AutomationId="UpdatePasswordWarningLabel" />
|
|
||||||
</Frame>
|
</Frame>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid IsVisible="{Binding IsPolicyInEffect}"
|
<Grid IsVisible="{Binding IsPolicyInEffect}"
|
||||||
@@ -72,8 +71,7 @@
|
|||||||
<Label
|
<Label
|
||||||
Text="{Binding PolicySummary}"
|
Text="{Binding PolicySummary}"
|
||||||
StyleClass="text-muted, text-sm, text-bold"
|
StyleClass="text-muted, text-sm, text-bold"
|
||||||
HorizontalTextAlignment="Start"
|
HorizontalTextAlignment="Start" />
|
||||||
AutomationId="PolicySummaryLabel" />
|
|
||||||
</Frame>
|
</Frame>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid StyleClass="box-row" IsVisible="{Binding RequireCurrentPassword }">
|
<Grid StyleClass="box-row" IsVisible="{Binding RequireCurrentPassword }">
|
||||||
@@ -98,8 +96,7 @@
|
|||||||
IsTextPredictionEnabled="False"
|
IsTextPredictionEnabled="False"
|
||||||
IsPassword="{Binding ShowPassword, Converter={StaticResource inverseBool}}"
|
IsPassword="{Binding ShowPassword, Converter={StaticResource inverseBool}}"
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
Grid.Column="0"
|
Grid.Column="0" />
|
||||||
AutomationId="MasterPasswordField" />
|
|
||||||
<controls:IconButton
|
<controls:IconButton
|
||||||
StyleClass="box-row-button, box-row-button-platform"
|
StyleClass="box-row-button, box-row-button-platform"
|
||||||
Text="{Binding ShowPasswordIcon}"
|
Text="{Binding ShowPasswordIcon}"
|
||||||
@@ -109,8 +106,7 @@
|
|||||||
Grid.RowSpan="2"
|
Grid.RowSpan="2"
|
||||||
AutomationProperties.IsInAccessibleTree="True"
|
AutomationProperties.IsInAccessibleTree="True"
|
||||||
AutomationProperties.Name="{u:I18n ToggleVisibility}"
|
AutomationProperties.Name="{u:I18n ToggleVisibility}"
|
||||||
AutomationProperties.HelpText="{Binding PasswordVisibilityAccessibilityText}"
|
AutomationProperties.HelpText="{Binding PasswordVisibilityAccessibilityText}" />
|
||||||
AutomationId="ToggleMasterPasswordVisibilityButton" />
|
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid StyleClass="box-row">
|
<Grid StyleClass="box-row">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
@@ -134,8 +130,7 @@
|
|||||||
IsTextPredictionEnabled="False"
|
IsTextPredictionEnabled="False"
|
||||||
IsPassword="{Binding ShowPassword, Converter={StaticResource inverseBool}}"
|
IsPassword="{Binding ShowPassword, Converter={StaticResource inverseBool}}"
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
Grid.Column="0"
|
Grid.Column="0" />
|
||||||
AutomationId="NewPasswordField" />
|
|
||||||
<controls:IconButton
|
<controls:IconButton
|
||||||
StyleClass="box-row-button, box-row-button-platform"
|
StyleClass="box-row-button, box-row-button-platform"
|
||||||
Text="{Binding ShowPasswordIcon}"
|
Text="{Binding ShowPasswordIcon}"
|
||||||
@@ -145,8 +140,7 @@
|
|||||||
Grid.RowSpan="2"
|
Grid.RowSpan="2"
|
||||||
AutomationProperties.IsInAccessibleTree="True"
|
AutomationProperties.IsInAccessibleTree="True"
|
||||||
AutomationProperties.Name="{u:I18n ToggleVisibility}"
|
AutomationProperties.Name="{u:I18n ToggleVisibility}"
|
||||||
AutomationProperties.HelpText="{Binding PasswordVisibilityAccessibilityText}"
|
AutomationProperties.HelpText="{Binding PasswordVisibilityAccessibilityText}" />
|
||||||
AutomationId="NewPasswordVisibilityButton" />
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
<StackLayout StyleClass="box">
|
<StackLayout StyleClass="box">
|
||||||
@@ -172,8 +166,7 @@
|
|||||||
IsTextPredictionEnabled="False"
|
IsTextPredictionEnabled="False"
|
||||||
IsPassword="{Binding ShowPassword, Converter={StaticResource inverseBool}}"
|
IsPassword="{Binding ShowPassword, Converter={StaticResource inverseBool}}"
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
Grid.Column="0"
|
Grid.Column="0" />
|
||||||
AutomationId="RetypePasswordField" />
|
|
||||||
<controls:IconButton
|
<controls:IconButton
|
||||||
StyleClass="box-row-button, box-row-button-platform"
|
StyleClass="box-row-button, box-row-button-platform"
|
||||||
Text="{Binding ShowPasswordIcon}"
|
Text="{Binding ShowPasswordIcon}"
|
||||||
@@ -183,8 +176,7 @@
|
|||||||
Grid.RowSpan="2"
|
Grid.RowSpan="2"
|
||||||
AutomationProperties.IsInAccessibleTree="True"
|
AutomationProperties.IsInAccessibleTree="True"
|
||||||
AutomationProperties.Name="{u:I18n ToggleVisibility}"
|
AutomationProperties.Name="{u:I18n ToggleVisibility}"
|
||||||
AutomationProperties.HelpText="{Binding PasswordVisibilityAccessibilityText}"
|
AutomationProperties.HelpText="{Binding PasswordVisibilityAccessibilityText}" />
|
||||||
AutomationId="ToggleRetypePasswordVisibilityButton" />
|
|
||||||
</Grid>
|
</Grid>
|
||||||
<StackLayout StyleClass="box-row">
|
<StackLayout StyleClass="box-row">
|
||||||
<Label
|
<Label
|
||||||
@@ -195,8 +187,7 @@
|
|||||||
Text="{Binding Hint}"
|
Text="{Binding Hint}"
|
||||||
StyleClass="box-value"
|
StyleClass="box-value"
|
||||||
ReturnType="Go"
|
ReturnType="Go"
|
||||||
ReturnCommand="{Binding SubmitCommand}"
|
ReturnCommand="{Binding SubmitCommand}" />
|
||||||
AutomationId="MasterPasswordHintLabel" />
|
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
<Label
|
<Label
|
||||||
Text="{u:I18n MasterPasswordHintDescription}"
|
Text="{u:I18n MasterPasswordHintDescription}"
|
||||||
|
|||||||
@@ -93,12 +93,12 @@ namespace Bit.App.Pages
|
|||||||
var kdfConfig = await _stateService.GetActiveUserCustomDataAsync(a => new KdfConfig(a?.Profile));
|
var kdfConfig = await _stateService.GetActiveUserCustomDataAsync(a => new KdfConfig(a?.Profile));
|
||||||
var email = await _stateService.GetEmailAsync();
|
var email = await _stateService.GetEmailAsync();
|
||||||
|
|
||||||
// Create new master key and hash new password
|
// Create new key and hash new password
|
||||||
var masterKey = await _cryptoService.MakeMasterKeyAsync(MasterPassword, email, kdfConfig);
|
var key = await _cryptoService.MakeKeyAsync(MasterPassword, email, kdfConfig);
|
||||||
var masterPasswordHash = await _cryptoService.HashMasterKeyAsync(MasterPassword, masterKey);
|
var masterPasswordHash = await _cryptoService.HashPasswordAsync(MasterPassword, key);
|
||||||
|
|
||||||
// Encrypt user key with new master key
|
// Create new encKey for the User
|
||||||
var (userKey, newProtectedUserKey) = await _cryptoService.EncryptUserKeyWithMasterKeyAsync(masterKey);
|
var newEncKey = await _cryptoService.RemakeEncKeyAsync(key);
|
||||||
|
|
||||||
// Initiate API action
|
// Initiate API action
|
||||||
try
|
try
|
||||||
@@ -108,10 +108,10 @@ namespace Bit.App.Pages
|
|||||||
switch (_reason)
|
switch (_reason)
|
||||||
{
|
{
|
||||||
case ForcePasswordResetReason.AdminForcePasswordReset:
|
case ForcePasswordResetReason.AdminForcePasswordReset:
|
||||||
await UpdateTempPasswordAsync(masterPasswordHash, newProtectedUserKey.EncryptedString);
|
await UpdateTempPasswordAsync(masterPasswordHash, newEncKey.Item2.EncryptedString);
|
||||||
break;
|
break;
|
||||||
case ForcePasswordResetReason.WeakMasterPasswordOnLogin:
|
case ForcePasswordResetReason.WeakMasterPasswordOnLogin:
|
||||||
await UpdatePasswordAsync(masterPasswordHash, newProtectedUserKey.EncryptedString);
|
await UpdatePasswordAsync(masterPasswordHash, newEncKey.Item2.EncryptedString);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new ArgumentOutOfRangeException();
|
throw new ArgumentOutOfRangeException();
|
||||||
@@ -155,7 +155,7 @@ namespace Bit.App.Pages
|
|||||||
|
|
||||||
private async Task UpdatePasswordAsync(string newMasterPasswordHash, string newEncKey)
|
private async Task UpdatePasswordAsync(string newMasterPasswordHash, string newEncKey)
|
||||||
{
|
{
|
||||||
var currentPasswordHash = await _cryptoService.HashMasterKeyAsync(CurrentMasterPassword, null);
|
var currentPasswordHash = await _cryptoService.HashPasswordAsync(CurrentMasterPassword, null);
|
||||||
|
|
||||||
var request = new PasswordRequest
|
var request = new PasswordRequest
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -150,12 +150,6 @@ namespace Bit.App.Pages
|
|||||||
private async Task SaveActivityAsync()
|
private async Task SaveActivityAsync()
|
||||||
{
|
{
|
||||||
SetServices();
|
SetServices();
|
||||||
if (await _stateService.GetActiveUserIdAsync() == null)
|
|
||||||
{
|
|
||||||
// Fresh install and/or all users logged out won't have an active user, skip saving last active time
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
await _stateService.SetLastActiveTimeAsync(_deviceActionService.GetActiveTime());
|
await _stateService.SetLastActiveTimeAsync(_deviceActionService.GetActiveTime());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
using System;
|
|
||||||
namespace Bit.App.Pages
|
|
||||||
{
|
|
||||||
public class BaseModalContentPage : BaseContentPage
|
|
||||||
{
|
|
||||||
public BaseModalContentPage()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void PopModal_Clicked(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (DoOnce())
|
|
||||||
{
|
|
||||||
Navigation.PopModalAsync();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,14 +1,11 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Input;
|
|
||||||
using Bit.App.Abstractions;
|
using Bit.App.Abstractions;
|
||||||
using Bit.App.Controls;
|
using Bit.App.Controls;
|
||||||
using Bit.App.Resources;
|
using Bit.App.Resources;
|
||||||
using Bit.Core.Abstractions;
|
using Bit.Core.Abstractions;
|
||||||
using Bit.Core.Exceptions;
|
using Bit.Core.Exceptions;
|
||||||
|
using Bit.Core.Services;
|
||||||
using Bit.Core.Utilities;
|
using Bit.Core.Utilities;
|
||||||
using Xamarin.CommunityToolkit.ObjectModel;
|
|
||||||
using Xamarin.Essentials;
|
|
||||||
using Xamarin.Forms;
|
using Xamarin.Forms;
|
||||||
|
|
||||||
namespace Bit.App.Pages
|
namespace Bit.App.Pages
|
||||||
@@ -50,24 +47,5 @@ namespace Bit.App.Pages
|
|||||||
_logger.Value.Exception(ex);
|
_logger.Value.Exception(ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected AsyncCommand CreateDefaultAsyncCommnad(Func<Task> execute, Func<object, bool> canExecute = null)
|
|
||||||
{
|
|
||||||
return new AsyncCommand(execute,
|
|
||||||
canExecute,
|
|
||||||
ex => HandleException(ex),
|
|
||||||
allowsMultipleExecutions: false);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected async Task<bool> HasConnectivityAsync()
|
|
||||||
{
|
|
||||||
if (Connectivity.NetworkAccess == NetworkAccess.None)
|
|
||||||
{
|
|
||||||
await _platformUtilsService.Value.ShowDialogAsync(
|
|
||||||
AppResources.InternetConnectionRequiredMessage,
|
|
||||||
AppResources.InternetConnectionRequiredTitle);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -275,18 +275,9 @@
|
|||||||
Margin="0,10,0,0"/>
|
Margin="0,10,0,0"/>
|
||||||
<Entry IsVisible="{Binding ForwardedEmailServiceSelected, Converter={StaticResource enumToBool}, ConverterParameter={x:Static enums:ForwardedEmailServiceType.AnonAddy}}"
|
<Entry IsVisible="{Binding ForwardedEmailServiceSelected, Converter={StaticResource enumToBool}, ConverterParameter={x:Static enums:ForwardedEmailServiceType.AnonAddy}}"
|
||||||
x:Name="_anonAddyDomainNameEntry"
|
x:Name="_anonAddyDomainNameEntry"
|
||||||
Text="{Binding AddyIoDomainName}"
|
Text="{Binding AnonAddyDomainName}"
|
||||||
StyleClass="box-value"
|
StyleClass="box-value"
|
||||||
AutomationId="AnonAddyDomainNameEntry" />
|
AutomationId="AnonAddyDomainNameEntry" />
|
||||||
<Label IsVisible="{Binding ForwardedEmailServiceSelected, Converter={StaticResource enumToBool}, ConverterParameter={x:Static enums:ForwardedEmailServiceType.ForwardEmail}}"
|
|
||||||
Text="{u:I18n DomainNameRequiredParenthesis}"
|
|
||||||
StyleClass="box-label"
|
|
||||||
Margin="0,10,0,0"/>
|
|
||||||
<Entry IsVisible="{Binding ForwardedEmailServiceSelected, Converter={StaticResource enumToBool}, ConverterParameter={x:Static enums:ForwardedEmailServiceType.ForwardEmail}}"
|
|
||||||
x:Name="_forwardEmailDomainNameEntry"
|
|
||||||
Text="{Binding ForwardEmailDomainName}"
|
|
||||||
StyleClass="box-value"
|
|
||||||
AutomationId="ForwardEmailDomainNameEntry" />
|
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
<!--RANDOM WORD OPTIONS-->
|
<!--RANDOM WORD OPTIONS-->
|
||||||
<Grid IsVisible="{Binding UsernameTypeSelected, Converter={StaticResource enumToBool}, ConverterParameter={x:Static enums:UsernameType.RandomWord}}">
|
<Grid IsVisible="{Binding UsernameTypeSelected, Converter={StaticResource enumToBool}, ConverterParameter={x:Static enums:UsernameType.RandomWord}}">
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user