mirror of
https://github.com/bitwarden/directory-connector
synced 2025-12-05 23:53:21 +00:00
Compare commits
204 Commits
AC-1743/up
...
v2025.3.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
752132f0b0 | ||
|
|
50be1218e2 | ||
|
|
e4abb2c751 | ||
|
|
23c591f903 | ||
|
|
2ea2fd701c | ||
|
|
3b74be446e | ||
|
|
2651a53f27 | ||
|
|
09ed8326c3 | ||
|
|
c5a65a85ad | ||
|
|
3ae90cbb4c | ||
|
|
99dbb3162e | ||
|
|
f146d41b66 | ||
|
|
b35cf8e995 | ||
|
|
f7ee5dcd92 | ||
|
|
61bbff771e | ||
|
|
2047b6644e | ||
|
|
26dd9662cf | ||
|
|
70073fb570 | ||
|
|
8642b9d7aa | ||
|
|
d77b50c540 | ||
|
|
ed935d998a | ||
|
|
682da52040 | ||
|
|
531619af1d | ||
|
|
cf54858cc5 | ||
|
|
6cc022b135 | ||
|
|
a8a4390624 | ||
|
|
f9d817f0b1 | ||
|
|
112bda1137 | ||
|
|
23713d92fa | ||
|
|
6ebc9631aa | ||
|
|
e8579f11d3 | ||
|
|
6b2c7a5f00 | ||
|
|
2a1a5bf064 | ||
|
|
1464d72b27 | ||
|
|
f5cbd8f03d | ||
|
|
fdbbef68c1 | ||
|
|
efb412684d | ||
|
|
79f7a2b495 | ||
|
|
4342734412 | ||
|
|
62f14e5043 | ||
|
|
c2b22518fe | ||
|
|
37c992f16b | ||
|
|
69156677ac | ||
|
|
aaed7b13ea | ||
|
|
096d2a03ab | ||
|
|
bd5bcbebd9 | ||
|
|
bb9ece6078 | ||
|
|
40de47e6e3 | ||
|
|
094ed57e03 | ||
|
|
96a38e2d76 | ||
|
|
9e200c8705 | ||
|
|
ca945318ed | ||
|
|
04abed9251 | ||
|
|
9b08ca6db8 | ||
|
|
0cbe6e9d33 | ||
|
|
dda6dd99ed | ||
|
|
5492466276 | ||
|
|
ef571ec0c3 | ||
|
|
f2bea1b6d7 | ||
|
|
07a1ae6dea | ||
|
|
f23997dd72 | ||
|
|
18547d6eaa | ||
|
|
c3a4f25160 | ||
|
|
e57a52e483 | ||
|
|
ff1380ee67 | ||
|
|
2269b82e7e | ||
|
|
8ab3516377 | ||
|
|
91dfd7e0b7 | ||
|
|
6db28408e6 | ||
|
|
bdacf3d4e4 | ||
|
|
9c566f50a2 | ||
|
|
e3fbc4e731 | ||
|
|
3c5bafe39f | ||
|
|
d65f42684e | ||
|
|
743b4b44cb | ||
|
|
1931a7f065 | ||
|
|
7d01bf0c6c | ||
|
|
c28ce25381 | ||
|
|
74c152f142 | ||
|
|
d4e317d804 | ||
|
|
605facb464 | ||
|
|
5a6ae00a82 | ||
|
|
19344bf696 | ||
|
|
8d8b3ca13e | ||
|
|
4fee3298f8 | ||
|
|
493e819b1c | ||
|
|
df4eb139e4 | ||
|
|
6cdd07429c | ||
|
|
278ec1acf0 | ||
|
|
e3d3c856c5 | ||
|
|
37ac5fc936 | ||
|
|
15978f69b1 | ||
|
|
ee7d97b797 | ||
|
|
930d7cf224 | ||
|
|
cf106b148e | ||
|
|
cfd0722587 | ||
|
|
b462a78c18 | ||
|
|
4bb96f049c | ||
|
|
b991fea958 | ||
|
|
111b8bd646 | ||
|
|
42af888615 | ||
|
|
a28fad020b | ||
|
|
f190433348 | ||
|
|
1e211becc3 | ||
|
|
4652c6489f | ||
|
|
9dc497dd13 | ||
|
|
3d9465917d | ||
|
|
6b1b6bf1c4 | ||
|
|
f52af53dad | ||
|
|
6e6039d298 | ||
|
|
332d07eca6 | ||
|
|
c3ed541efd | ||
|
|
4ae4cba877 | ||
|
|
3ecca16f50 | ||
|
|
1f30ef165f | ||
|
|
dfd8fce231 | ||
|
|
0b7c0ec9c2 | ||
|
|
6d569e9319 | ||
|
|
3ed4e76f95 | ||
|
|
abf7e0400c | ||
|
|
5600f20760 | ||
|
|
bbc65d77e3 | ||
|
|
5d0cde9cfa | ||
|
|
eff7c848f8 | ||
|
|
46fb407c0c | ||
|
|
e2fe5ef9ad | ||
|
|
dd10538d0f | ||
|
|
6d355812e0 | ||
|
|
c973d5fea0 | ||
|
|
01a3f68480 | ||
|
|
d31f14cfe7 | ||
|
|
401daa0187 | ||
|
|
1951b9507d | ||
|
|
eae9cac931 | ||
|
|
21cecc3c0a | ||
|
|
21638f3fdc | ||
|
|
f47806ddd2 | ||
|
|
c304650a6a | ||
|
|
d01522bfc4 | ||
|
|
14314a3553 | ||
|
|
ffac82e865 | ||
|
|
decada8745 | ||
|
|
3a639bb8f2 | ||
|
|
a2b5dac108 | ||
|
|
6e76d8fcbd | ||
|
|
63b06f6950 | ||
|
|
f730aeba23 | ||
|
|
52a8a35f41 | ||
|
|
601a83ebfa | ||
|
|
0cdb12229e | ||
|
|
423a48ab2e | ||
|
|
9a2bf331bc | ||
|
|
0d211f351c | ||
|
|
d1d4f53866 | ||
|
|
dede587b78 | ||
|
|
d76a6e993d | ||
|
|
32d514ebcc | ||
|
|
1f08c7e5cc | ||
|
|
dd80dce657 | ||
|
|
ff6dff329a | ||
|
|
8c6f1aab90 | ||
|
|
9a3aae16a7 | ||
|
|
1480445d35 | ||
|
|
fc04964663 | ||
|
|
cc05bcb4a6 | ||
|
|
5ce3b01ff1 | ||
|
|
079c3ee840 | ||
|
|
f88ce25b59 | ||
|
|
599473f6e4 | ||
|
|
df389cbd08 | ||
|
|
051b6dc3cf | ||
|
|
5727dd75cc | ||
|
|
435f2d10b7 | ||
|
|
dab646675f | ||
|
|
8dc65ef371 | ||
|
|
9925fdea40 | ||
|
|
4c61498714 | ||
|
|
930f8c84d5 | ||
|
|
d20818ee49 | ||
|
|
6936c218d1 | ||
|
|
8ef5459801 | ||
|
|
cb615412aa | ||
|
|
2d69d2b791 | ||
|
|
0630b4f52e | ||
|
|
690c9cd5cb | ||
|
|
3f0454b1d8 | ||
|
|
1a84084b5d | ||
|
|
c5fb57576c | ||
|
|
165083a245 | ||
|
|
84f1f5b81f | ||
|
|
9599c66586 | ||
|
|
38b2a13df6 | ||
|
|
1fb4378046 | ||
|
|
8a661fbc5e | ||
|
|
cf56b5fb57 | ||
|
|
9c88e66a27 | ||
|
|
5b7b68f1cb | ||
|
|
a09473c632 | ||
|
|
71727dae7d | ||
|
|
3dbd34ebc3 | ||
|
|
6dd121acc6 | ||
|
|
d6ddb499f0 | ||
|
|
5b4e09be93 | ||
|
|
a48e0af042 |
7
.github/CODEOWNERS
vendored
7
.github/CODEOWNERS
vendored
@@ -6,10 +6,3 @@
|
|||||||
|
|
||||||
# Default file owners.
|
# Default file owners.
|
||||||
* @bitwarden/team-admin-console-dev
|
* @bitwarden/team-admin-console-dev
|
||||||
|
|
||||||
# DevOps for Actions and other workflow changes.
|
|
||||||
.github/workflows @bitwarden/dept-devops
|
|
||||||
.github/secrets @bitwarden/dept-devops
|
|
||||||
|
|
||||||
# Multiple Owners
|
|
||||||
**/package.json
|
|
||||||
47
.github/PULL_REQUEST_TEMPLATE.md
vendored
47
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -1,33 +1,34 @@
|
|||||||
## Type of change
|
## 🎟️ Tracking
|
||||||
|
|
||||||
- [ ] Bug fix
|
<!-- Paste the link to the Jira or GitHub issue or otherwise describe / point to where this change is coming from. -->
|
||||||
- [ ] New feature development
|
|
||||||
- [ ] Tech debt (refactoring, code cleanup, dependency upgrades, etc)
|
|
||||||
- [ ] Build/deploy pipeline (DevOps)
|
|
||||||
- [ ] Other
|
|
||||||
|
|
||||||
## Objective
|
## 📔 Objective
|
||||||
|
|
||||||
<!--Describe what the purpose of this PR is. For example: what bug you're fixing or what new feature you're adding-->
|
<!-- Describe what the purpose of this PR is, for example what bug you're fixing or new feature you're adding. -->
|
||||||
|
|
||||||
## Code changes
|
## 📸 Screenshots
|
||||||
|
|
||||||
<!--Explain the changes you've made to each file or major component. This should help the reviewer understand your changes-->
|
<!-- Required for any UI changes; delete if not applicable. Use fixed width images for better display. -->
|
||||||
<!--Also refer to any related changes or PRs in other repositories-->
|
|
||||||
|
|
||||||
- **file.ext:** Description of what was changed and why
|
## ⏰ Reminders before review
|
||||||
|
|
||||||
## Screenshots
|
- Contributor guidelines followed
|
||||||
|
- All formatters and local linters executed and passed
|
||||||
|
- Written new unit and / or integration tests where applicable
|
||||||
|
- Used internationalization (i18n) for all UI strings
|
||||||
|
- CI builds passed
|
||||||
|
- Communicated to DevOps any deployment requirements
|
||||||
|
- Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team
|
||||||
|
|
||||||
<!--Required for any UI changes. Delete if not applicable-->
|
## 🦮 Reviewer guidelines
|
||||||
|
|
||||||
## Testing requirements
|
<!-- Suggested interactions but feel free to use (or not) as you desire! -->
|
||||||
|
|
||||||
<!--What functionality requires testing by QA? This includes testing new behavior and regression testing-->
|
- 👍 (`:+1:`) or similar for great changes
|
||||||
|
- 📝 (`:memo:`) or ℹ️ (`:information_source:`) for notes or general info
|
||||||
## Before you submit
|
- ❓ (`:question:`) for questions
|
||||||
|
- 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion
|
||||||
- [ ] I have checked for **linting** errors (`npm run lint`) (required)
|
- 🎨 (`:art:`) for suggestions / improvements
|
||||||
- [ ] I have added **unit tests** where it makes sense to do so (encouraged but not required)
|
- ❌ (`:x:`) or ⚠️ (`:warning:`) for more significant problems or concerns needing attention
|
||||||
- [ ] This change requires a **documentation update** (notify the documentation team)
|
- 🌱 (`:seedling:`) or ♻️ (`:recycle:`) for future improvements or indications of technical debt
|
||||||
- [ ] This change has particular **deployment requirements** (notify the DevOps team)
|
- ⛏ (`:pick:`) for minor or nitpick changes
|
||||||
|
|||||||
27
.github/renovate.json
vendored
27
.github/renovate.json
vendored
@@ -1,31 +1,18 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
||||||
"extends": [
|
"extends": ["github>bitwarden/renovate-config"],
|
||||||
"config:base",
|
|
||||||
"github>bitwarden/renovate-config:pin-actions",
|
|
||||||
":combinePatchMinorReleases",
|
|
||||||
":dependencyDashboard",
|
|
||||||
":maintainLockFilesWeekly",
|
|
||||||
":pinAllExceptPeerDependencies",
|
|
||||||
":prConcurrentLimit10",
|
|
||||||
":rebaseStalePrs",
|
|
||||||
":separateMajorReleases",
|
|
||||||
"group:monorepos",
|
|
||||||
"schedule:weekends"
|
|
||||||
],
|
|
||||||
"enabledManagers": ["github-actions", "npm"],
|
"enabledManagers": ["github-actions", "npm"],
|
||||||
"commitMessagePrefix": "[deps]:",
|
|
||||||
"commitMessageTopic": "{{depName}}",
|
|
||||||
"packageRules": [
|
"packageRules": [
|
||||||
{
|
{
|
||||||
"groupName": "npm minor",
|
"groupName": "gh minor",
|
||||||
"matchManagers": ["npm"],
|
"matchManagers": ["github-actions"],
|
||||||
"matchUpdateTypes": ["minor", "patch"]
|
"matchUpdateTypes": ["minor", "patch"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"matchFileNames": ["package.json"],
|
"groupName": "Google Libraries",
|
||||||
"description": "Admin Console owns general dependencies",
|
"matchPackagePatterns": ["google-auth-library", "googleapis"],
|
||||||
"reviewers": ["team:team-admin-console-dev"]
|
"matchManagers": ["npm"],
|
||||||
|
"groupSlug": "google-libraries"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
.github/secrets/devid-app-cert.p12.gpg
vendored
BIN
.github/secrets/devid-app-cert.p12.gpg
vendored
Binary file not shown.
BIN
.github/secrets/devid-installer-cert.p12.gpg
vendored
BIN
.github/secrets/devid-installer-cert.p12.gpg
vendored
Binary file not shown.
BIN
.github/secrets/macdev-cert.p12.gpg
vendored
BIN
.github/secrets/macdev-cert.p12.gpg
vendored
Binary file not shown.
189
.github/workflows/build.yml
vendored
189
.github/workflows/build.yml
vendored
@@ -1,17 +1,21 @@
|
|||||||
---
|
|
||||||
name: Build
|
name: Build
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request: {}
|
pull_request: {}
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- "main"
|
||||||
|
- "rc"
|
||||||
|
- "hotfix-rc"
|
||||||
workflow_dispatch: {}
|
workflow_dispatch: {}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
cloc:
|
cloc:
|
||||||
name: CLOC
|
name: CLOC
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
|
||||||
- name: Set up CLOC
|
- name: Set up CLOC
|
||||||
run: |
|
run: |
|
||||||
@@ -24,12 +28,12 @@ jobs:
|
|||||||
|
|
||||||
setup:
|
setup:
|
||||||
name: Setup
|
name: Setup
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-24.04
|
||||||
outputs:
|
outputs:
|
||||||
package_version: ${{ steps.retrieve-version.outputs.package_version }}
|
package_version: ${{ steps.retrieve-version.outputs.package_version }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
|
||||||
- name: Get Package Version
|
- name: Get Package Version
|
||||||
id: retrieve-version
|
id: retrieve-version
|
||||||
@@ -40,22 +44,22 @@ jobs:
|
|||||||
|
|
||||||
linux-cli:
|
linux-cli:
|
||||||
name: Build Linux CLI
|
name: Build Linux CLI
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-24.04
|
||||||
needs: setup
|
needs: setup
|
||||||
env:
|
env:
|
||||||
_PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }}
|
_PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }}
|
||||||
_PKG_FETCH_NODE_VERSION: 20.11.0
|
_PKG_FETCH_NODE_VERSION: 18.5.0
|
||||||
_PKG_FETCH_VERSION: 3.4
|
_PKG_FETCH_VERSION: 3.4
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
|
||||||
- name: Set up Node
|
- name: Set up Node
|
||||||
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
|
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
|
||||||
with:
|
with:
|
||||||
cache: 'npm'
|
cache: 'npm'
|
||||||
cache-dependency-path: '**/package-lock.json'
|
cache-dependency-path: '**/package-lock.json'
|
||||||
node-version: '20.11.0'
|
node-version: '18'
|
||||||
|
|
||||||
- name: Update NPM
|
- name: Update NPM
|
||||||
run: |
|
run: |
|
||||||
@@ -119,14 +123,14 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Upload Linux Zip to GitHub
|
- name: Upload Linux Zip to GitHub
|
||||||
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
|
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
|
||||||
with:
|
with:
|
||||||
name: bwdc-linux-${{ env._PACKAGE_VERSION }}.zip
|
name: bwdc-linux-${{ env._PACKAGE_VERSION }}.zip
|
||||||
path: ./dist-cli/bwdc-linux-${{ env._PACKAGE_VERSION }}.zip
|
path: ./dist-cli/bwdc-linux-${{ env._PACKAGE_VERSION }}.zip
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
|
||||||
- name: Upload Linux checksum to GitHub
|
- name: Upload Linux checksum to GitHub
|
||||||
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
|
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
|
||||||
with:
|
with:
|
||||||
name: bwdc-linux-sha256-${{ env._PACKAGE_VERSION }}.txt
|
name: bwdc-linux-sha256-${{ env._PACKAGE_VERSION }}.txt
|
||||||
path: ./dist-cli/bwdc-linux-sha256-${{ env._PACKAGE_VERSION }}.txt
|
path: ./dist-cli/bwdc-linux-sha256-${{ env._PACKAGE_VERSION }}.txt
|
||||||
@@ -135,22 +139,22 @@ jobs:
|
|||||||
|
|
||||||
macos-cli:
|
macos-cli:
|
||||||
name: Build Mac CLI
|
name: Build Mac CLI
|
||||||
runs-on: macos-12
|
runs-on: macos-13
|
||||||
needs: setup
|
needs: setup
|
||||||
env:
|
env:
|
||||||
_PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }}
|
_PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }}
|
||||||
_PKG_FETCH_NODE_VERSION: 20.11.0
|
_PKG_FETCH_NODE_VERSION: 18.5.0
|
||||||
_PKG_FETCH_VERSION: 3.4
|
_PKG_FETCH_VERSION: 3.4
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
|
||||||
- name: Set up Node
|
- name: Set up Node
|
||||||
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
|
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
|
||||||
with:
|
with:
|
||||||
cache: 'npm'
|
cache: 'npm'
|
||||||
cache-dependency-path: '**/package-lock.json'
|
cache-dependency-path: '**/package-lock.json'
|
||||||
node-version: '20.11.0'
|
node-version: '18'
|
||||||
|
|
||||||
- name: Update NPM
|
- name: Update NPM
|
||||||
run: |
|
run: |
|
||||||
@@ -207,14 +211,14 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Upload Mac Zip to GitHub
|
- name: Upload Mac Zip to GitHub
|
||||||
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
|
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
|
||||||
with:
|
with:
|
||||||
name: bwdc-macos-${{ env._PACKAGE_VERSION }}.zip
|
name: bwdc-macos-${{ env._PACKAGE_VERSION }}.zip
|
||||||
path: ./dist-cli/bwdc-macos-${{ env._PACKAGE_VERSION }}.zip
|
path: ./dist-cli/bwdc-macos-${{ env._PACKAGE_VERSION }}.zip
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
|
||||||
- name: Upload Mac checksum to GitHub
|
- name: Upload Mac checksum to GitHub
|
||||||
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
|
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
|
||||||
with:
|
with:
|
||||||
name: bwdc-macos-sha256-${{ env._PACKAGE_VERSION }}.txt
|
name: bwdc-macos-sha256-${{ env._PACKAGE_VERSION }}.txt
|
||||||
path: ./dist-cli/bwdc-macos-sha256-${{ env._PACKAGE_VERSION }}.txt
|
path: ./dist-cli/bwdc-macos-sha256-${{ env._PACKAGE_VERSION }}.txt
|
||||||
@@ -226,11 +230,11 @@ jobs:
|
|||||||
needs: setup
|
needs: setup
|
||||||
env:
|
env:
|
||||||
_PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }}
|
_PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }}
|
||||||
_WIN_PKG_FETCH_VERSION: 20.11.0
|
_WIN_PKG_FETCH_VERSION: 18.5.0
|
||||||
_WIN_PKG_VERSION: 3.4
|
_WIN_PKG_VERSION: 3.4
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
|
||||||
- name: Setup Windows builder
|
- name: Setup Windows builder
|
||||||
run: |
|
run: |
|
||||||
@@ -238,11 +242,11 @@ jobs:
|
|||||||
choco install reshack --no-progress
|
choco install reshack --no-progress
|
||||||
|
|
||||||
- name: Set up Node
|
- name: Set up Node
|
||||||
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
|
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
|
||||||
with:
|
with:
|
||||||
cache: 'npm'
|
cache: 'npm'
|
||||||
cache-dependency-path: '**/package-lock.json'
|
cache-dependency-path: '**/package-lock.json'
|
||||||
node-version: '20.11.0'
|
node-version: '18'
|
||||||
|
|
||||||
- name: Update NPM
|
- name: Update NPM
|
||||||
run: |
|
run: |
|
||||||
@@ -351,14 +355,14 @@ jobs:
|
|||||||
-t sha256 | Out-File ./dist-cli/bwdc-windows-sha256-${env:_PACKAGE_VERSION}.txt
|
-t sha256 | Out-File ./dist-cli/bwdc-windows-sha256-${env:_PACKAGE_VERSION}.txt
|
||||||
|
|
||||||
- name: Upload Windows Zip to GitHub
|
- name: Upload Windows Zip to GitHub
|
||||||
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
|
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
|
||||||
with:
|
with:
|
||||||
name: bwdc-windows-${{ env._PACKAGE_VERSION }}.zip
|
name: bwdc-windows-${{ env._PACKAGE_VERSION }}.zip
|
||||||
path: ./dist-cli/bwdc-windows-${{ env._PACKAGE_VERSION }}.zip
|
path: ./dist-cli/bwdc-windows-${{ env._PACKAGE_VERSION }}.zip
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
|
||||||
- name: Upload Windows checksum to GitHub
|
- name: Upload Windows checksum to GitHub
|
||||||
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
|
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
|
||||||
with:
|
with:
|
||||||
name: bwdc-windows-sha256-${{ env._PACKAGE_VERSION }}.txt
|
name: bwdc-windows-sha256-${{ env._PACKAGE_VERSION }}.txt
|
||||||
path: ./dist-cli/bwdc-windows-sha256-${{ env._PACKAGE_VERSION }}.txt
|
path: ./dist-cli/bwdc-windows-sha256-${{ env._PACKAGE_VERSION }}.txt
|
||||||
@@ -375,14 +379,14 @@ jobs:
|
|||||||
HUSKY: 0
|
HUSKY: 0
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
|
||||||
- name: Set up Node
|
- name: Set up Node
|
||||||
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
|
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
|
||||||
with:
|
with:
|
||||||
cache: 'npm'
|
cache: 'npm'
|
||||||
cache-dependency-path: '**/package-lock.json'
|
cache-dependency-path: '**/package-lock.json'
|
||||||
node-version: '20.11.0'
|
node-version: '18'
|
||||||
|
|
||||||
- name: Update NPM
|
- name: Update NPM
|
||||||
run: |
|
run: |
|
||||||
@@ -411,28 +415,28 @@ jobs:
|
|||||||
SIGNING_CERT_NAME: ${{ secrets.SIGNING_CERT_NAME }}
|
SIGNING_CERT_NAME: ${{ secrets.SIGNING_CERT_NAME }}
|
||||||
|
|
||||||
- name: Upload Portable Executable to GitHub
|
- name: Upload Portable Executable to GitHub
|
||||||
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
|
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
|
||||||
with:
|
with:
|
||||||
name: Bitwarden-Connector-Portable-${{ env._PACKAGE_VERSION }}.exe
|
name: Bitwarden-Connector-Portable-${{ env._PACKAGE_VERSION }}.exe
|
||||||
path: ./dist/Bitwarden-Connector-Portable-${{ env._PACKAGE_VERSION }}.exe
|
path: ./dist/Bitwarden-Connector-Portable-${{ env._PACKAGE_VERSION }}.exe
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
|
||||||
- name: Upload Installer Executable to GitHub
|
- name: Upload Installer Executable to GitHub
|
||||||
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
|
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
|
||||||
with:
|
with:
|
||||||
name: Bitwarden-Connector-Installer-${{ env._PACKAGE_VERSION }}.exe
|
name: Bitwarden-Connector-Installer-${{ env._PACKAGE_VERSION }}.exe
|
||||||
path: ./dist/Bitwarden-Connector-Installer-${{ env._PACKAGE_VERSION }}.exe
|
path: ./dist/Bitwarden-Connector-Installer-${{ env._PACKAGE_VERSION }}.exe
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
|
||||||
- name: Upload Installer Executable Blockmap to GitHub
|
- name: Upload Installer Executable Blockmap to GitHub
|
||||||
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
|
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
|
||||||
with:
|
with:
|
||||||
name: Bitwarden-Connector-Installer-${{ env._PACKAGE_VERSION }}.exe.blockmap
|
name: Bitwarden-Connector-Installer-${{ env._PACKAGE_VERSION }}.exe.blockmap
|
||||||
path: ./dist/Bitwarden-Connector-Installer-${{ env._PACKAGE_VERSION }}.exe.blockmap
|
path: ./dist/Bitwarden-Connector-Installer-${{ env._PACKAGE_VERSION }}.exe.blockmap
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
|
||||||
- name: Upload latest auto-update artifact
|
- name: Upload latest auto-update artifact
|
||||||
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
|
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
|
||||||
with:
|
with:
|
||||||
name: latest.yml
|
name: latest.yml
|
||||||
path: ./dist/latest.yml
|
path: ./dist/latest.yml
|
||||||
@@ -441,7 +445,7 @@ jobs:
|
|||||||
|
|
||||||
linux-gui:
|
linux-gui:
|
||||||
name: Build Linux GUI
|
name: Build Linux GUI
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-24.04
|
||||||
needs: setup
|
needs: setup
|
||||||
env:
|
env:
|
||||||
NODE_OPTIONS: --max_old_space_size=4096
|
NODE_OPTIONS: --max_old_space_size=4096
|
||||||
@@ -449,14 +453,14 @@ jobs:
|
|||||||
HUSKY: 0
|
HUSKY: 0
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
|
||||||
- name: Set up Node
|
- name: Set up Node
|
||||||
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
|
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
|
||||||
with:
|
with:
|
||||||
cache: 'npm'
|
cache: 'npm'
|
||||||
cache-dependency-path: '**/package-lock.json'
|
cache-dependency-path: '**/package-lock.json'
|
||||||
node-version: '20.11.0'
|
node-version: '18'
|
||||||
|
|
||||||
- name: Update NPM
|
- name: Update NPM
|
||||||
run: |
|
run: |
|
||||||
@@ -479,14 +483,14 @@ jobs:
|
|||||||
run: npm run dist:lin
|
run: npm run dist:lin
|
||||||
|
|
||||||
- name: Upload AppImage
|
- name: Upload AppImage
|
||||||
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
|
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
|
||||||
with:
|
with:
|
||||||
name: Bitwarden-Connector-${{ env._PACKAGE_VERSION }}-x86_64.AppImage
|
name: Bitwarden-Connector-${{ env._PACKAGE_VERSION }}-x86_64.AppImage
|
||||||
path: ./dist/Bitwarden-Connector-${{ env._PACKAGE_VERSION }}-x86_64.AppImage
|
path: ./dist/Bitwarden-Connector-${{ env._PACKAGE_VERSION }}-x86_64.AppImage
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
|
||||||
- name: Upload latest auto-update artifact
|
- name: Upload latest auto-update artifact
|
||||||
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
|
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
|
||||||
with:
|
with:
|
||||||
name: latest-linux.yml
|
name: latest-linux.yml
|
||||||
path: ./dist/latest-linux.yml
|
path: ./dist/latest-linux.yml
|
||||||
@@ -495,7 +499,7 @@ jobs:
|
|||||||
|
|
||||||
macos-gui:
|
macos-gui:
|
||||||
name: Build MacOS GUI
|
name: Build MacOS GUI
|
||||||
runs-on: macos-12
|
runs-on: macos-13
|
||||||
needs: setup
|
needs: setup
|
||||||
env:
|
env:
|
||||||
NODE_OPTIONS: --max_old_space_size=4096
|
NODE_OPTIONS: --max_old_space_size=4096
|
||||||
@@ -503,14 +507,14 @@ jobs:
|
|||||||
HUSKY: 0
|
HUSKY: 0
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
|
||||||
- name: Set up Node
|
- name: Set up Node
|
||||||
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
|
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
|
||||||
with:
|
with:
|
||||||
cache: 'npm'
|
cache: 'npm'
|
||||||
cache-dependency-path: '**/package-lock.json'
|
cache-dependency-path: '**/package-lock.json'
|
||||||
node-version: '20.11.0'
|
node-version: '18'
|
||||||
|
|
||||||
- name: Update NPM
|
- name: Update NPM
|
||||||
run: |
|
run: |
|
||||||
@@ -523,44 +527,43 @@ jobs:
|
|||||||
npm --version
|
npm --version
|
||||||
echo "GitHub ref: $GITHUB_REF"
|
echo "GitHub ref: $GITHUB_REF"
|
||||||
echo "GitHub event: $GITHUB_EVENT"
|
echo "GitHub event: $GITHUB_EVENT"
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: Decrypt secrets
|
- name: Login to Azure
|
||||||
env:
|
uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0
|
||||||
DECRYPT_FILE_PASSWORD: ${{ secrets.DECRYPT_FILE_PASSWORD }}
|
with:
|
||||||
shell: bash
|
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
|
||||||
|
|
||||||
|
- name: Get certificates
|
||||||
run: |
|
run: |
|
||||||
mkdir -p $HOME/secrets
|
mkdir -p $HOME/certificates
|
||||||
|
|
||||||
gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPT_FILE_PASSWORD" \
|
az keyvault secret show --id https://bitwarden-ci.vault.azure.net/certificates/devid-app-cert |
|
||||||
--output "$HOME/secrets/devid-app-cert.p12" \
|
jq -r .value | base64 -d > $HOME/certificates/devid-app-cert.p12
|
||||||
"$GITHUB_WORKSPACE/.github/secrets/devid-app-cert.p12.gpg"
|
|
||||||
|
|
||||||
gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPT_FILE_PASSWORD" \
|
az keyvault secret show --id https://bitwarden-ci.vault.azure.net/certificates/devid-installer-cert |
|
||||||
--output "$HOME/secrets/devid-installer-cert.p12" \
|
jq -r .value | base64 -d > $HOME/certificates/devid-installer-cert.p12
|
||||||
"$GITHUB_WORKSPACE/.github/secrets/devid-installer-cert.p12.gpg"
|
|
||||||
|
|
||||||
gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPT_FILE_PASSWORD" \
|
az keyvault secret show --id https://bitwarden-ci.vault.azure.net/certificates/macdev-cert |
|
||||||
--output "$HOME/secrets/macdev-cert.p12" \
|
jq -r .value | base64 -d > $HOME/certificates/macdev-cert.p12
|
||||||
"$GITHUB_WORKSPACE/.github/secrets/macdev-cert.p12.gpg"
|
|
||||||
|
|
||||||
- name: Set up keychain
|
- name: Set up keychain
|
||||||
env:
|
env:
|
||||||
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
|
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
|
||||||
DEVID_CERT_PASSWORD: ${{ secrets.DEVID_CERT_PASSWORD }}
|
|
||||||
MACDEV_CERT_PASSWORD: ${{ secrets.MACDEV_CERT_PASSWORD }}
|
|
||||||
shell: bash
|
|
||||||
run: |
|
run: |
|
||||||
security create-keychain -p $KEYCHAIN_PASSWORD build.keychain
|
security create-keychain -p $KEYCHAIN_PASSWORD build.keychain
|
||||||
security default-keychain -s build.keychain
|
security default-keychain -s build.keychain
|
||||||
security unlock-keychain -p $KEYCHAIN_PASSWORD build.keychain
|
security unlock-keychain -p $KEYCHAIN_PASSWORD build.keychain
|
||||||
security set-keychain-settings -lut 1200 build.keychain
|
security set-keychain-settings -lut 1200 build.keychain
|
||||||
security import "$HOME/secrets/devid-app-cert.p12" -k build.keychain -P $DEVID_CERT_PASSWORD \
|
|
||||||
|
security import "$HOME/certificates/devid-app-cert.p12" -k build.keychain -P "" \
|
||||||
-T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/productbuild
|
-T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/productbuild
|
||||||
security import "$HOME/secrets/devid-installer-cert.p12" -k build.keychain -P $DEVID_CERT_PASSWORD \
|
|
||||||
|
security import "$HOME/certificates/devid-installer-cert.p12" -k build.keychain -P "" \
|
||||||
-T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/productbuild
|
-T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/productbuild
|
||||||
security import "$HOME/secrets/macdev-cert.p12" -k build.keychain -P $MACDEV_CERT_PASSWORD \
|
|
||||||
|
security import "$HOME/certificates/macdev-cert.p12" -k build.keychain -P "" \
|
||||||
-T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/productbuild
|
-T /usr/bin/codesign -T /usr/bin/security -T /usr/bin/productbuild
|
||||||
|
|
||||||
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $KEYCHAIN_PASSWORD build.keychain
|
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $KEYCHAIN_PASSWORD build.keychain
|
||||||
|
|
||||||
- name: Load package version
|
- name: Load package version
|
||||||
@@ -575,36 +578,44 @@ jobs:
|
|||||||
- name: Install Node dependencies
|
- name: Install Node dependencies
|
||||||
run: npm install
|
run: npm install
|
||||||
|
|
||||||
|
- name: Set up private auth key
|
||||||
|
run: |
|
||||||
|
mkdir ~/private_keys
|
||||||
|
cat << EOF > ~/private_keys/AuthKey_UFD296548T.p8
|
||||||
|
${{ secrets.APP_STORE_CONNECT_AUTH_KEY }}
|
||||||
|
EOF
|
||||||
|
|
||||||
- name: Build application
|
- name: Build application
|
||||||
run: npm run dist:mac
|
run: npm run dist:mac
|
||||||
env:
|
env:
|
||||||
APPLE_ID_USERNAME: ${{ secrets.APPLE_ID_USERNAME }}
|
APP_STORE_CONNECT_TEAM_ISSUER: ${{ secrets.APP_STORE_CONNECT_TEAM_ISSUER }}
|
||||||
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
|
APP_STORE_CONNECT_AUTH_KEY: UFD296548T
|
||||||
|
APP_STORE_CONNECT_AUTH_KEY_PATH: ~/private_keys/AuthKey_UFD296548T.p8
|
||||||
CSC_FOR_PULL_REQUEST: true
|
CSC_FOR_PULL_REQUEST: true
|
||||||
|
|
||||||
- name: Upload .zip artifact
|
- name: Upload .zip artifact
|
||||||
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
|
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
|
||||||
with:
|
with:
|
||||||
name: Bitwarden-Connector-${{ env._PACKAGE_VERSION }}-mac.zip
|
name: Bitwarden-Connector-${{ env._PACKAGE_VERSION }}-mac.zip
|
||||||
path: ./dist/Bitwarden-Connector-${{ env._PACKAGE_VERSION }}-mac.zip
|
path: ./dist/Bitwarden-Connector-${{ env._PACKAGE_VERSION }}-mac.zip
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
|
||||||
- name: Upload .dmg artifact
|
- name: Upload .dmg artifact
|
||||||
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
|
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
|
||||||
with:
|
with:
|
||||||
name: Bitwarden-Connector-${{ env._PACKAGE_VERSION }}.dmg
|
name: Bitwarden-Connector-${{ env._PACKAGE_VERSION }}.dmg
|
||||||
path: ./dist/Bitwarden-Connector-${{ env._PACKAGE_VERSION }}.dmg
|
path: ./dist/Bitwarden-Connector-${{ env._PACKAGE_VERSION }}.dmg
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
|
||||||
- name: Upload .dmg Blockmap artifact
|
- name: Upload .dmg Blockmap artifact
|
||||||
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
|
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
|
||||||
with:
|
with:
|
||||||
name: Bitwarden-Connector-${{ env._PACKAGE_VERSION }}.dmg.blockmap
|
name: Bitwarden-Connector-${{ env._PACKAGE_VERSION }}.dmg.blockmap
|
||||||
path: ./dist/Bitwarden-Connector-${{ env._PACKAGE_VERSION }}.dmg.blockmap
|
path: ./dist/Bitwarden-Connector-${{ env._PACKAGE_VERSION }}.dmg.blockmap
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
|
||||||
- name: Upload latest auto-update artifact
|
- name: Upload latest auto-update artifact
|
||||||
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
|
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
|
||||||
with:
|
with:
|
||||||
name: latest-mac.yml
|
name: latest-mac.yml
|
||||||
path: ./dist/latest-mac.yml
|
path: ./dist/latest-mac.yml
|
||||||
@@ -613,7 +624,7 @@ jobs:
|
|||||||
|
|
||||||
check-failures:
|
check-failures:
|
||||||
name: Check for failures
|
name: Check for failures
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-24.04
|
||||||
needs:
|
needs:
|
||||||
- cloc
|
- cloc
|
||||||
- setup
|
- setup
|
||||||
@@ -625,37 +636,15 @@ jobs:
|
|||||||
- macos-gui
|
- macos-gui
|
||||||
steps:
|
steps:
|
||||||
- name: Check if any job failed
|
- name: Check if any job failed
|
||||||
if: ${{ (github.ref == 'refs/heads/main') || (github.ref == 'refs/heads/rc') }}
|
if: |
|
||||||
env:
|
(github.ref == 'refs/heads/main'
|
||||||
CLOC_STATUS: ${{ needs.cloc.result }}
|
|| github.ref == 'refs/heads/rc'
|
||||||
SETUP_STATUS: ${{ needs.setup.result }}
|
|| github.ref == 'refs/heads/hotfix-rc')
|
||||||
LINUX_CLI_STATUS: ${{ needs.linux-cli.result }}
|
&& contains(needs.*.result, 'failure')
|
||||||
MACOS_CLI_STATUS: ${{ needs.macos-cli.result }}
|
run: exit 1
|
||||||
WINDOWS_CLI_STATUS: ${{ needs.windows-cli.result }}
|
|
||||||
WINDOWS_GUI_STATUS: ${{ needs.windows-gui.result }}
|
|
||||||
LINUX_GUI_STATUS: ${{ needs.linux-gui.result }}
|
|
||||||
MACOS_GUI_STATUS: ${{ needs.macos-gui.result }}
|
|
||||||
run: |
|
|
||||||
if [ "$CLOC_STATUS" = "failure" ]; then
|
|
||||||
exit 1
|
|
||||||
elif [ "$SETUP_STATUS" = "failure" ]; then
|
|
||||||
exit 1
|
|
||||||
elif [ "$LINUX_CLI_STATUS" = "failure" ]; then
|
|
||||||
exit 1
|
|
||||||
elif [ "$MACOS_CLI_STATUS" = "failure" ]; then
|
|
||||||
exit 1
|
|
||||||
elif [ "$WINDOWS_CLI_STATUS" = "failure" ]; then
|
|
||||||
exit 1
|
|
||||||
elif [ "$WINDOWS_GUI_STATUS" = "failure" ]; then
|
|
||||||
exit 1
|
|
||||||
elif [ "$LINUX_GUI_STATUS" = "failure" ]; then
|
|
||||||
exit 1
|
|
||||||
elif [ "$MACOS_GUI_STATUS" = "failure" ]; then
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Login to Azure - CI subscription
|
- name: Login to Azure - CI subscription
|
||||||
uses: Azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 # v1.4.7
|
uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0
|
||||||
if: failure()
|
if: failure()
|
||||||
with:
|
with:
|
||||||
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
|
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
|
||||||
@@ -669,7 +658,7 @@ jobs:
|
|||||||
secrets: "devops-alerts-slack-webhook-url"
|
secrets: "devops-alerts-slack-webhook-url"
|
||||||
|
|
||||||
- name: Notify Slack on failure
|
- name: Notify Slack on failure
|
||||||
uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f # v2.0.0
|
uses: act10ns/slack@44541246747a30eb3102d87f7a4cc5471b0ffb7d # v2.1.0
|
||||||
if: failure()
|
if: failure()
|
||||||
env:
|
env:
|
||||||
SLACK_WEBHOOK_URL: ${{ steps.retrieve-secrets.outputs.devops-alerts-slack-webhook-url }}
|
SLACK_WEBHOOK_URL: ${{ steps.retrieve-secrets.outputs.devops-alerts-slack-webhook-url }}
|
||||||
|
|||||||
3
.github/workflows/enforce-labels.yml
vendored
3
.github/workflows/enforce-labels.yml
vendored
@@ -1,4 +1,3 @@
|
|||||||
---
|
|
||||||
name: Enforce PR labels
|
name: Enforce PR labels
|
||||||
|
|
||||||
on:
|
on:
|
||||||
@@ -7,7 +6,7 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
enforce-label:
|
enforce-label:
|
||||||
name: EnforceLabel
|
name: EnforceLabel
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- name: Enforce Label
|
- name: Enforce Label
|
||||||
uses: yogevbd/enforce-label-action@a3c219da6b8fa73f6ba62b68ff09c469b3a1c024 # 2.2.2
|
uses: yogevbd/enforce-label-action@a3c219da6b8fa73f6ba62b68ff09c469b3a1c024 # 2.2.2
|
||||||
|
|||||||
78
.github/workflows/integration-test.yml
vendored
Normal file
78
.github/workflows/integration-test.yml
vendored
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
name: Integration Testing
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- "main"
|
||||||
|
paths:
|
||||||
|
- ".github/workflows/integration-test.yml" # this file
|
||||||
|
- "src/services/ldap-directory.service*" # we only have integration for LDAP testing at the moment
|
||||||
|
- "./openldap/**/*" # any change to test fixtures
|
||||||
|
- "./docker-compose.yml" # any change to Docker configuration
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- ".github/workflows/integration-test.yml" # this file
|
||||||
|
- "src/services/ldap-directory.service*" # we only have integration for LDAP testing at the moment
|
||||||
|
- "./openldap/**/*" # any change to test fixtures
|
||||||
|
- "./docker-compose.yml" # any change to Docker configuration
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
|
||||||
|
testing:
|
||||||
|
name: Run tests
|
||||||
|
if: ${{ startsWith(github.head_ref, 'version_bump_') == false }}
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
permissions:
|
||||||
|
checks: write
|
||||||
|
contents: read
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Check out repo
|
||||||
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
|
||||||
|
- name: Get Node version
|
||||||
|
id: retrieve-node-version
|
||||||
|
run: |
|
||||||
|
NODE_NVMRC=$(cat .nvmrc)
|
||||||
|
NODE_VERSION=${NODE_NVMRC/v/''}
|
||||||
|
echo "node_version=$NODE_VERSION" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Set up Node
|
||||||
|
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
|
||||||
|
with:
|
||||||
|
cache: 'npm'
|
||||||
|
cache-dependency-path: '**/package-lock.json'
|
||||||
|
node-version: ${{ steps.retrieve-node-version.outputs.node_version }}
|
||||||
|
|
||||||
|
- name: Install Node dependencies
|
||||||
|
run: npm ci
|
||||||
|
|
||||||
|
- name: Install mkcert
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get -y install mkcert
|
||||||
|
|
||||||
|
- name: Setup integration tests
|
||||||
|
run: npm run test:integration:setup
|
||||||
|
|
||||||
|
- name: Run integration tests
|
||||||
|
run: npm run test:integration --coverage
|
||||||
|
|
||||||
|
- name: Report test results
|
||||||
|
uses: dorny/test-reporter@31a54ee7ebcacc03a09ea97a7e5465a47b84aea5 # v1.9.1
|
||||||
|
if: ${{ github.event.pull_request.head.repo.full_name == github.repository && !cancelled() }}
|
||||||
|
with:
|
||||||
|
name: Test Results
|
||||||
|
path: "junit.xml"
|
||||||
|
reporter: jest-junit
|
||||||
|
fail-on-error: true
|
||||||
|
|
||||||
|
- name: Upload coverage to codecov.io
|
||||||
|
uses: codecov/codecov-action@5a605bd92782ce0810fa3b8acc235c921b497052 # v5.2.0
|
||||||
|
|
||||||
|
- name: Upload results to codecov.io
|
||||||
|
uses: codecov/test-results-action@4e79e65778be1cecd5df25e14af1eafb6df80ea9 # v1.0.2
|
||||||
|
env:
|
||||||
|
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||||
51
.github/workflows/release.yml
vendored
51
.github/workflows/release.yml
vendored
@@ -1,4 +1,3 @@
|
|||||||
---
|
|
||||||
name: Release
|
name: Release
|
||||||
|
|
||||||
on:
|
on:
|
||||||
@@ -17,15 +16,15 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
setup:
|
setup:
|
||||||
name: Setup
|
name: Setup
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-24.04
|
||||||
outputs:
|
outputs:
|
||||||
release-version: ${{ steps.version.outputs.version }}
|
release_version: ${{ steps.version.outputs.version }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
|
||||||
- name: Branch check
|
- name: Branch check
|
||||||
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
|
if: ${{ inputs.release_type != 'Dry Run' }}
|
||||||
run: |
|
run: |
|
||||||
if [[ "$GITHUB_REF" != "refs/heads/rc" ]] && [[ "$GITHUB_REF" != "refs/heads/hotfix-rc" ]]; then
|
if [[ "$GITHUB_REF" != "refs/heads/rc" ]] && [[ "$GITHUB_REF" != "refs/heads/hotfix-rc" ]]; then
|
||||||
echo "==================================="
|
echo "==================================="
|
||||||
@@ -38,35 +37,25 @@ jobs:
|
|||||||
id: version
|
id: version
|
||||||
uses: bitwarden/gh-actions/release-version-check@main
|
uses: bitwarden/gh-actions/release-version-check@main
|
||||||
with:
|
with:
|
||||||
release-type: ${{ github.event.inputs.release_type }}
|
release-type: ${{ inputs.release_type }}
|
||||||
project-type: ts
|
project-type: ts
|
||||||
file: package.json
|
file: package.json
|
||||||
|
|
||||||
release:
|
release:
|
||||||
name: Release
|
name: Release
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-24.04
|
||||||
needs: setup
|
needs: setup
|
||||||
steps:
|
steps:
|
||||||
- name: Create GitHub deployment
|
|
||||||
uses: chrnorm/deployment-action@d42cde7132fcec920de534fffc3be83794335c00 # v2.0.5
|
|
||||||
id: deployment
|
|
||||||
with:
|
|
||||||
token: '${{ secrets.GITHUB_TOKEN }}'
|
|
||||||
initial-status: 'in_progress'
|
|
||||||
environment: 'production'
|
|
||||||
description: 'Deployment ${{ needs.setup.outputs.release-version }} from branch ${{ github.ref_name }}'
|
|
||||||
task: release
|
|
||||||
|
|
||||||
- name: Download all artifacts
|
- name: Download all artifacts
|
||||||
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
|
if: ${{ inputs.release_type != 'Dry Run' }}
|
||||||
uses: bitwarden/gh-actions/download-artifacts@main
|
uses: bitwarden/gh-actions/download-artifacts@main
|
||||||
with:
|
with:
|
||||||
workflow: build.yml
|
workflow: build.yml
|
||||||
workflow_conclusion: success
|
workflow_conclusion: success
|
||||||
branch: ${{ github.ref_name }}
|
branch: ${{ github.ref_name }}
|
||||||
|
|
||||||
- name: Download all artifacts
|
- name: Dry Run - Download all artifacts
|
||||||
if: ${{ github.event.inputs.release_type == 'Dry Run' }}
|
if: ${{ inputs.release_type == 'Dry Run' }}
|
||||||
uses: bitwarden/gh-actions/download-artifacts@main
|
uses: bitwarden/gh-actions/download-artifacts@main
|
||||||
with:
|
with:
|
||||||
workflow: build.yml
|
workflow: build.yml
|
||||||
@@ -74,10 +63,10 @@ jobs:
|
|||||||
branch: main
|
branch: main
|
||||||
|
|
||||||
- name: Create release
|
- name: Create release
|
||||||
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
|
if: ${{ inputs.release_type != 'Dry Run' }}
|
||||||
uses: ncipollo/release-action@6c75be85e571768fa31b40abf38de58ba0397db5 # v1.13.0
|
uses: ncipollo/release-action@cdcc88a9acf3ca41c16c37bb7d21b9ad48560d87 # v1.15.0
|
||||||
env:
|
env:
|
||||||
PKG_VERSION: ${{ needs.setup.outputs.release-version }}
|
PKG_VERSION: ${{ needs.setup.outputs.release_version }}
|
||||||
with:
|
with:
|
||||||
artifacts: "./bwdc-windows-${{ env.PKG_VERSION }}.zip,
|
artifacts: "./bwdc-windows-${{ env.PKG_VERSION }}.zip,
|
||||||
./bwdc-macos-${{ env.PKG_VERSION }}.zip,
|
./bwdc-macos-${{ env.PKG_VERSION }}.zip,
|
||||||
@@ -101,19 +90,3 @@ jobs:
|
|||||||
body: "<insert release notes here>"
|
body: "<insert release notes here>"
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
draft: true
|
draft: true
|
||||||
|
|
||||||
- name: Update deployment status to Success
|
|
||||||
if: ${{ success() }}
|
|
||||||
uses: chrnorm/deployment-status@2afb7d27101260f4a764219439564d954d10b5b0 # v2.0.1
|
|
||||||
with:
|
|
||||||
token: '${{ secrets.GITHUB_TOKEN }}'
|
|
||||||
state: 'success'
|
|
||||||
deployment-id: ${{ steps.deployment.outputs.deployment_id }}
|
|
||||||
|
|
||||||
- name: Update deployment status to Failure
|
|
||||||
if: ${{ failure() }}
|
|
||||||
uses: chrnorm/deployment-status@2afb7d27101260f4a764219439564d954d10b5b0 # v2.0.1
|
|
||||||
with:
|
|
||||||
token: '${{ secrets.GITHUB_TOKEN }}'
|
|
||||||
state: 'failure'
|
|
||||||
deployment-id: ${{ steps.deployment.outputs.deployment_id }}
|
|
||||||
|
|||||||
80
.github/workflows/scan.yml
vendored
Normal file
80
.github/workflows/scan.yml
vendored
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
name: Scan
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- "main"
|
||||||
|
pull_request_target:
|
||||||
|
types: [opened, synchronize]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check-run:
|
||||||
|
name: Check PR run
|
||||||
|
uses: bitwarden/gh-actions/.github/workflows/check-run.yml@main
|
||||||
|
|
||||||
|
sast:
|
||||||
|
name: SAST scan
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
needs: check-run
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
pull-requests: write
|
||||||
|
security-events: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Check out repo
|
||||||
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
with:
|
||||||
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
|
|
||||||
|
- name: Scan with Checkmarx
|
||||||
|
uses: checkmarx/ast-github-action@184bf2f64f55d1c93fd6636d539edf274703e434 # 2.0.41
|
||||||
|
env:
|
||||||
|
INCREMENTAL: "${{ contains(github.event_name, 'pull_request') && '--sast-incremental' || '' }}"
|
||||||
|
with:
|
||||||
|
project_name: ${{ github.repository }}
|
||||||
|
cx_tenant: ${{ secrets.CHECKMARX_TENANT }}
|
||||||
|
base_uri: https://ast.checkmarx.net/
|
||||||
|
cx_client_id: ${{ secrets.CHECKMARX_CLIENT_ID }}
|
||||||
|
cx_client_secret: ${{ secrets.CHECKMARX_SECRET }}
|
||||||
|
additional_params: |
|
||||||
|
--report-format sarif \
|
||||||
|
--filter "state=TO_VERIFY;PROPOSED_NOT_EXPLOITABLE;CONFIRMED;URGENT" \
|
||||||
|
--output-path . ${{ env.INCREMENTAL }}
|
||||||
|
|
||||||
|
- name: Upload Checkmarx results to GitHub
|
||||||
|
uses: github/codeql-action/upload-sarif@dd196fa9ce80b6bacc74ca1c32bd5b0ba22efca7 # v3.28.3
|
||||||
|
with:
|
||||||
|
sarif_file: cx_result.sarif
|
||||||
|
sha: ${{ contains(github.event_name, 'pull_request') && github.event.pull_request.head.sha || github.sha }}
|
||||||
|
ref: ${{ contains(github.event_name, 'pull_request') && format('refs/pull/{0}/head', github.event.pull_request.number) || github.ref }}
|
||||||
|
|
||||||
|
quality:
|
||||||
|
name: Quality scan
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
needs: check-run
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Check out repo
|
||||||
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
|
|
||||||
|
- name: Scan with SonarCloud
|
||||||
|
uses: sonarsource/sonarqube-scan-action@bfd4e558cda28cda6b5defafb9232d191be8c203 # v4.2.1
|
||||||
|
env:
|
||||||
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||||
|
with:
|
||||||
|
args: >
|
||||||
|
-Dsonar.organization=${{ github.repository_owner }}
|
||||||
|
-Dsonar.projectKey=${{ github.repository_owner }}_${{ github.event.repository.name }}
|
||||||
|
-Dsonar.tests=.
|
||||||
|
-Dsonar.sources=.
|
||||||
|
-Dsonar.test.inclusions=**/*.spec.ts
|
||||||
|
-Dsonar.exclusions=**/*.spec.ts
|
||||||
|
-Dsonar.pullrequest.key=${{ github.event.pull_request.number }}
|
||||||
58
.github/workflows/test.yml
vendored
58
.github/workflows/test.yml
vendored
@@ -1,5 +1,4 @@
|
|||||||
---
|
name: Testing
|
||||||
name: Run tests
|
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
@@ -7,22 +6,25 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- "main"
|
- "main"
|
||||||
- "rc"
|
- "rc"
|
||||||
- "hotfix-rc-*"
|
- "hotfix-rc"
|
||||||
pull_request: {}
|
pull_request:
|
||||||
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
|
||||||
name: Run tests
|
|
||||||
runs-on: ubuntu-22.04
|
|
||||||
steps:
|
|
||||||
- name: Checkout repo
|
|
||||||
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
|
|
||||||
|
|
||||||
- name: Get Node Version
|
testing:
|
||||||
|
name: Run tests
|
||||||
|
if: ${{ startsWith(github.head_ref, 'version_bump_') == false }}
|
||||||
|
runs-on: ubuntu-24.04
|
||||||
|
permissions:
|
||||||
|
checks: write
|
||||||
|
contents: read
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Check out repo
|
||||||
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
|
||||||
|
- name: Get Node version
|
||||||
id: retrieve-node-version
|
id: retrieve-node-version
|
||||||
run: |
|
run: |
|
||||||
NODE_NVMRC=$(cat .nvmrc)
|
NODE_NVMRC=$(cat .nvmrc)
|
||||||
@@ -30,17 +32,12 @@ jobs:
|
|||||||
echo "node_version=$NODE_VERSION" >> $GITHUB_OUTPUT
|
echo "node_version=$NODE_VERSION" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Set up Node
|
- name: Set up Node
|
||||||
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
|
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
|
||||||
with:
|
with:
|
||||||
cache: 'npm'
|
cache: 'npm'
|
||||||
cache-dependency-path: '**/package-lock.json'
|
cache-dependency-path: '**/package-lock.json'
|
||||||
node-version: ${{ steps.retrieve-node-version.outputs.node_version }}
|
node-version: ${{ steps.retrieve-node-version.outputs.node_version }}
|
||||||
|
|
||||||
- name: Print environment
|
|
||||||
run: |
|
|
||||||
node --version
|
|
||||||
npm --version
|
|
||||||
|
|
||||||
- name: Install Node dependencies
|
- name: Install Node dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
|
|
||||||
@@ -51,4 +48,21 @@ jobs:
|
|||||||
run: npm run test:types --coverage
|
run: npm run test:types --coverage
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: npm run test
|
run: npm run test --coverage
|
||||||
|
|
||||||
|
- name: Report test results
|
||||||
|
uses: dorny/test-reporter@31a54ee7ebcacc03a09ea97a7e5465a47b84aea5 # v1.9.1
|
||||||
|
if: ${{ github.event.pull_request.head.repo.full_name == github.repository && !cancelled() }}
|
||||||
|
with:
|
||||||
|
name: Test Results
|
||||||
|
path: "junit.xml"
|
||||||
|
reporter: jest-junit
|
||||||
|
fail-on-error: true
|
||||||
|
|
||||||
|
- name: Upload coverage to codecov.io
|
||||||
|
uses: codecov/codecov-action@5a605bd92782ce0810fa3b8acc235c921b497052 # v5.2.0
|
||||||
|
|
||||||
|
- name: Upload results to codecov.io
|
||||||
|
uses: codecov/test-results-action@4e79e65778be1cecd5df25e14af1eafb6df80ea9 # v1.0.2
|
||||||
|
env:
|
||||||
|
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
|||||||
167
.github/workflows/version-bump.yml
vendored
167
.github/workflows/version-bump.yml
vendored
@@ -1,65 +1,53 @@
|
|||||||
---
|
|
||||||
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_override:
|
||||||
description: "New version (example: '2024.1.0')"
|
description: "New version override (leave blank for automatic calculation, example: '2024.1.0')"
|
||||||
required: true
|
required: false
|
||||||
type: string
|
type: string
|
||||||
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: Bump Version
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- name: Login to Azure - CI Subscription
|
- name: Validate version input
|
||||||
uses: Azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 # v1.4.7
|
if: ${{ inputs.version_number_override != '' }}
|
||||||
|
uses: bitwarden/gh-actions/version-check@main
|
||||||
with:
|
with:
|
||||||
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
|
version: ${{ inputs.version_number_override }}
|
||||||
|
|
||||||
- name: Retrieve secrets
|
- name: Generate GH App token
|
||||||
id: retrieve-secrets
|
uses: actions/create-github-app-token@c1a285145b9d317df6ced56c09f525b5c2b6f755 # v1.11.1
|
||||||
uses: bitwarden/gh-actions/get-keyvault-secrets@main
|
id: app-token
|
||||||
with:
|
with:
|
||||||
keyvault: "bitwarden-ci"
|
app-id: ${{ secrets.BW_GHAPP_ID }}
|
||||||
secrets: "github-gpg-private-key,
|
private-key: ${{ secrets.BW_GHAPP_KEY }}
|
||||||
github-gpg-private-key-passphrase,
|
|
||||||
github-pat-bitwarden-devops-bot-repo-scope"
|
|
||||||
|
|
||||||
- name: Checkout Branch
|
- name: Checkout Branch
|
||||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
with:
|
with:
|
||||||
ref: main
|
token: ${{ steps.app-token.outputs.token }}
|
||||||
repository: bitwarden/directory-connector
|
|
||||||
|
|
||||||
- name: Import GPG key
|
- name: Setup git
|
||||||
uses: crazy-max/ghaction-import-gpg@82a020f1f7f605c65dd2449b392a52c3fcfef7ef # v6.0.0
|
|
||||||
with:
|
|
||||||
gpg_private_key: ${{ steps.retrieve-secrets.outputs.github-gpg-private-key }}
|
|
||||||
passphrase: ${{ steps.retrieve-secrets.outputs.github-gpg-private-key-passphrase }}
|
|
||||||
git_user_signingkey: true
|
|
||||||
git_commit_gpgsign: true
|
|
||||||
|
|
||||||
- name: Create Version Branch
|
|
||||||
id: create-branch
|
|
||||||
run: |
|
run: |
|
||||||
NAME=version_bump_${{ github.ref_name }}_${{ inputs.version_number }}
|
git config user.name github-actions
|
||||||
git switch -c $NAME
|
git config user.email github-actions@github.com
|
||||||
echo "name=$NAME" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: Verify input version
|
- name: Get current version
|
||||||
env:
|
id: current-version
|
||||||
NEW_VERSION: ${{ inputs.version_number }}
|
|
||||||
run: |
|
run: |
|
||||||
CURRENT_VERSION=$(cat package.json | jq -r '.version')
|
CURRENT_VERSION=$(cat package.json | jq -r '.version')
|
||||||
|
echo "version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Verify input version
|
||||||
|
if: ${{ inputs.version_number_override != '' }}
|
||||||
|
env:
|
||||||
|
CURRENT_VERSION: ${{ steps.current-version.outputs.version }}
|
||||||
|
NEW_VERSION: ${{ inputs.version_number_override }}
|
||||||
|
run: |
|
||||||
# Error if version has not changed.
|
# Error if version has not changed.
|
||||||
if [[ "$NEW_VERSION" == "$CURRENT_VERSION" ]]; then
|
if [[ "$NEW_VERSION" == "$CURRENT_VERSION" ]]; then
|
||||||
echo "Version has not changed."
|
echo "Version has not changed."
|
||||||
@@ -75,16 +63,37 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Bump Version - Package
|
- name: Calculate next release version
|
||||||
|
if: ${{ inputs.version_number_override == '' }}
|
||||||
|
id: calculate-next-version
|
||||||
|
uses: bitwarden/gh-actions/version-next@main
|
||||||
|
with:
|
||||||
|
version: ${{ steps.current-version.outputs.version }}
|
||||||
|
|
||||||
|
- name: Bump Version - Package - Version Override
|
||||||
|
if: ${{ inputs.version_number_override != '' }}
|
||||||
|
id: bump-version-override
|
||||||
uses: bitwarden/gh-actions/version-bump@main
|
uses: bitwarden/gh-actions/version-bump@main
|
||||||
with:
|
with:
|
||||||
version: ${{ inputs.version_number }}
|
|
||||||
file_path: "./package.json"
|
file_path: "./package.json"
|
||||||
|
version: ${{ inputs.version_number_override }}
|
||||||
|
|
||||||
- name: Setup git
|
- name: Bump Version - Package - Automatic Calculation
|
||||||
|
if: ${{ inputs.version_number_override == '' }}
|
||||||
|
id: bump-version-automatic
|
||||||
|
uses: bitwarden/gh-actions/version-bump@main
|
||||||
|
with:
|
||||||
|
file_path: "./package.json"
|
||||||
|
version: ${{ steps.calculate-next-version.outputs.version }}
|
||||||
|
|
||||||
|
- name: Set final version output
|
||||||
|
id: set-final-version-output
|
||||||
run: |
|
run: |
|
||||||
git config --local user.email "106330231+bitwarden-devops-bot@users.noreply.github.com"
|
if [[ "${{ steps.bump-version-override.outcome }}" == "success" ]]; then
|
||||||
git config --local user.name "bitwarden-devops-bot"
|
echo "version=${{ inputs.version_number_override }}" >> $GITHUB_OUTPUT
|
||||||
|
elif [[ "${{ steps.bump-version-automatic.outcome }}" == "success" ]]; then
|
||||||
|
echo "version=${{ steps.calculate-next-version.outputs.version }}" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Check if version changed
|
- name: Check if version changed
|
||||||
id: version-changed
|
id: version-changed
|
||||||
@@ -98,72 +107,8 @@ 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 ${{ steps.set-final-version-output.outputs.version }}" -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
|
||||||
PR_BRANCH: ${{ steps.create-branch.outputs.name }}
|
|
||||||
run: git push -u origin $PR_BRANCH
|
|
||||||
|
|
||||||
- name: Create Version PR
|
|
||||||
if: ${{ steps.version-changed.outputs.changes_to_commit == 'TRUE' }}
|
|
||||||
id: create-pr
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ steps.retrieve-secrets.outputs.github-pat-bitwarden-devops-bot-repo-scope }}
|
|
||||||
PR_BRANCH: ${{ steps.create-branch.outputs.name }}
|
|
||||||
TITLE: "Bump version to ${{ inputs.version_number }}"
|
|
||||||
run: |
|
|
||||||
PR_URL=$(gh pr create --title "$TITLE" \
|
|
||||||
--base "main" \
|
|
||||||
--head "$PR_BRANCH" \
|
|
||||||
--label "version update" \
|
|
||||||
--label "automated pr" \
|
|
||||||
--body "
|
|
||||||
## Type of change
|
|
||||||
- [ ] Bug fix
|
|
||||||
- [ ] New feature development
|
|
||||||
- [ ] Tech debt (refactoring, code cleanup, dependency upgrades, etc)
|
|
||||||
- [ ] Build/deploy pipeline (DevOps)
|
|
||||||
- [X] Other
|
|
||||||
|
|
||||||
## Objective
|
|
||||||
Automated version bump to ${{ 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
|
|
||||||
|
|||||||
11
.github/workflows/workflow-linter.yml
vendored
11
.github/workflows/workflow-linter.yml
vendored
@@ -1,11 +0,0 @@
|
|||||||
---
|
|
||||||
name: Workflow Linter
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
paths:
|
|
||||||
- .github/workflows/**
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
call-workflow:
|
|
||||||
uses: bitwarden/gh-actions/.github/workflows/workflow-linter.yml@main
|
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -26,6 +26,7 @@ npm-debug.log
|
|||||||
# Build directories
|
# Build directories
|
||||||
dist
|
dist
|
||||||
build
|
build
|
||||||
|
build-cli
|
||||||
.angular/cache
|
.angular/cache
|
||||||
|
|
||||||
# Testing
|
# Testing
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
# Bitwarden Directory Connector
|
# Bitwarden Directory Connector
|
||||||
|
|
||||||
The Bitwarden Directory Connector is a a desktop application used to sync your Bitwarden enterprise organization to an existing directory of users and groups.
|
The Bitwarden Directory Connector is a desktop application used to sync your Bitwarden enterprise organization to an existing directory of users and groups.
|
||||||
|
|
||||||
Supported directories:
|
Supported directories:
|
||||||
|
|
||||||
|
|||||||
18
docker-compose.yml
Normal file
18
docker-compose.yml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
services:
|
||||||
|
open-ldap:
|
||||||
|
image: bitnami/openldap:latest
|
||||||
|
hostname: openldap
|
||||||
|
environment:
|
||||||
|
- LDAP_ADMIN_USERNAME=admin
|
||||||
|
- LDAP_ADMIN_PASSWORD=admin
|
||||||
|
- LDAP_ROOT=dc=bitwarden,dc=com
|
||||||
|
- LDAP_ENABLE_TLS=yes
|
||||||
|
- LDAP_TLS_CERT_FILE=/certs/openldap.pem
|
||||||
|
- LDAP_TLS_KEY_FILE=/certs/openldap-key.pem
|
||||||
|
- LDAP_TLS_CA_FILE=/certs/rootCA.pem
|
||||||
|
volumes:
|
||||||
|
- "./openldap/ldifs:/ldifs"
|
||||||
|
- "./openldap/certs:/certs"
|
||||||
|
ports:
|
||||||
|
- "1389:1389"
|
||||||
|
- "1636:1636"
|
||||||
@@ -11,6 +11,14 @@ module.exports = {
|
|||||||
// ...angularPreset,
|
// ...angularPreset,
|
||||||
preset: "jest-preset-angular",
|
preset: "jest-preset-angular",
|
||||||
|
|
||||||
|
reporters: ["default", "jest-junit"],
|
||||||
|
|
||||||
|
collectCoverage: true,
|
||||||
|
// Ensure we collect coverage from files without tests
|
||||||
|
collectCoverageFrom: ["src/**/*.ts"],
|
||||||
|
coverageReporters: ["html", "lcov"],
|
||||||
|
coverageDirectory: "coverage",
|
||||||
|
|
||||||
testEnvironment: "jsdom",
|
testEnvironment: "jsdom",
|
||||||
testMatch: ["**/+(*.)+(spec).+(ts)"],
|
testMatch: ["**/+(*.)+(spec).+(ts)"],
|
||||||
|
|
||||||
|
|||||||
@@ -12,10 +12,10 @@
|
|||||||
{{ enforcedPolicyMessage }}
|
{{ enforcedPolicyMessage }}
|
||||||
<ul>
|
<ul>
|
||||||
<li *ngIf="enforcedPolicyOptions?.minComplexity > 0">
|
<li *ngIf="enforcedPolicyOptions?.minComplexity > 0">
|
||||||
{{ "policyInEffectMinComplexity" | i18n : getPasswordScoreAlertDisplay() }}
|
{{ "policyInEffectMinComplexity" | i18n: getPasswordScoreAlertDisplay() }}
|
||||||
</li>
|
</li>
|
||||||
<li *ngIf="enforcedPolicyOptions?.minLength > 0">
|
<li *ngIf="enforcedPolicyOptions?.minLength > 0">
|
||||||
{{ "policyInEffectMinLength" | i18n : enforcedPolicyOptions?.minLength.toString() }}
|
{{ "policyInEffectMinLength" | i18n: enforcedPolicyOptions?.minLength.toString() }}
|
||||||
</li>
|
</li>
|
||||||
<li *ngIf="enforcedPolicyOptions?.requireUpper">
|
<li *ngIf="enforcedPolicyOptions?.requireUpper">
|
||||||
{{ "policyInEffectUppercase" | i18n }}
|
{{ "policyInEffectUppercase" | i18n }}
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
{{ "policyInEffectNumbers" | i18n }}
|
{{ "policyInEffectNumbers" | i18n }}
|
||||||
</li>
|
</li>
|
||||||
<li *ngIf="enforcedPolicyOptions?.requireSpecial">
|
<li *ngIf="enforcedPolicyOptions?.requireSpecial">
|
||||||
{{ "policyInEffectSpecial" | i18n : "!@#$%^&*" }}
|
{{ "policyInEffectSpecial" | i18n: "!@#$%^&*" }}
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ export class EnvironmentComponent {
|
|||||||
constructor(
|
constructor(
|
||||||
protected platformUtilsService: PlatformUtilsService,
|
protected platformUtilsService: PlatformUtilsService,
|
||||||
protected environmentService: EnvironmentService,
|
protected environmentService: EnvironmentService,
|
||||||
protected i18nService: I18nService
|
protected i18nService: I18nService,
|
||||||
) {
|
) {
|
||||||
const urls = this.environmentService.getUrls();
|
const urls = this.environmentService.getUrls();
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,10 @@ export class IconComponent implements OnChanges {
|
|||||||
|
|
||||||
private iconsUrl: string;
|
private iconsUrl: string;
|
||||||
|
|
||||||
constructor(environmentService: EnvironmentService, private stateService: StateService) {
|
constructor(
|
||||||
|
environmentService: EnvironmentService,
|
||||||
|
private stateService: StateService,
|
||||||
|
) {
|
||||||
this.iconsUrl = environmentService.getIconsUrl();
|
this.iconsUrl = environmentService.getIconsUrl();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ export class DynamicModalComponent implements AfterViewInit, OnDestroy {
|
|||||||
private cd: ChangeDetectorRef,
|
private cd: ChangeDetectorRef,
|
||||||
private el: ElementRef<HTMLElement>,
|
private el: ElementRef<HTMLElement>,
|
||||||
private focusTrapFactory: ConfigurableFocusTrapFactory,
|
private focusTrapFactory: ConfigurableFocusTrapFactory,
|
||||||
public modalRef: ModalRef
|
public modalRef: ModalRef,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
ngAfterViewInit() {
|
ngAfterViewInit() {
|
||||||
@@ -47,7 +47,7 @@ export class DynamicModalComponent implements AfterViewInit, OnDestroy {
|
|||||||
|
|
||||||
this.modalRef.created(this.el.nativeElement);
|
this.modalRef.created(this.el.nativeElement);
|
||||||
this.focusTrap = this.focusTrapFactory.create(
|
this.focusTrap = this.focusTrapFactory.create(
|
||||||
this.el.nativeElement.querySelector(".modal-dialog")
|
this.el.nativeElement.querySelector(".modal-dialog"),
|
||||||
);
|
);
|
||||||
if (this.el.nativeElement.querySelector("[appAutoFocus]") == null) {
|
if (this.el.nativeElement.querySelector("[appAutoFocus]") == null) {
|
||||||
this.focusTrap.focusFirstTabbableElementWhenReady();
|
this.focusTrap.focusFirstTabbableElementWhenReady();
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
import { InjectFlags, InjectOptions, Injector, ProviderToken } from "@angular/core";
|
import { InjectFlags, InjectOptions, Injector, ProviderToken } from "@angular/core";
|
||||||
|
|
||||||
export class ModalInjector implements Injector {
|
export class ModalInjector implements Injector {
|
||||||
constructor(private _parentInjector: Injector, private _additionalTokens: WeakMap<any, any>) {}
|
constructor(
|
||||||
|
private _parentInjector: Injector,
|
||||||
|
private _additionalTokens: WeakMap<any, any>,
|
||||||
|
) {}
|
||||||
|
|
||||||
get<T>(
|
get<T>(
|
||||||
token: ProviderToken<T>,
|
token: ProviderToken<T>,
|
||||||
notFoundValue: undefined,
|
notFoundValue: undefined,
|
||||||
options: InjectOptions & { optional?: false }
|
options: InjectOptions & { optional?: false },
|
||||||
): T;
|
): T;
|
||||||
get<T>(token: ProviderToken<T>, notFoundValue: null, options: InjectOptions): T;
|
get<T>(token: ProviderToken<T>, notFoundValue: null, options: InjectOptions): T;
|
||||||
get<T>(token: ProviderToken<T>, notFoundValue?: T, options?: InjectOptions | InjectFlags): T;
|
get<T>(token: ProviderToken<T>, notFoundValue?: T, options?: InjectOptions | InjectFlags): T;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ export class PasswordRepromptComponent {
|
|||||||
private modalRef: ModalRef,
|
private modalRef: ModalRef,
|
||||||
private cryptoService: CryptoService,
|
private cryptoService: CryptoService,
|
||||||
private platformUtilsService: PlatformUtilsService,
|
private platformUtilsService: PlatformUtilsService,
|
||||||
private i18nService: I18nService
|
private i18nService: I18nService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
togglePassword() {
|
togglePassword() {
|
||||||
@@ -31,7 +31,7 @@ export class PasswordRepromptComponent {
|
|||||||
this.platformUtilsService.showToast(
|
this.platformUtilsService.showToast(
|
||||||
"error",
|
"error",
|
||||||
this.i18nService.t("errorOccurred"),
|
this.i18nService.t("errorOccurred"),
|
||||||
this.i18nService.t("invalidMasterPassword")
|
this.i18nService.t("invalidMasterPassword"),
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,7 +62,10 @@ import {
|
|||||||
preserveWhitespaces: false,
|
preserveWhitespaces: false,
|
||||||
})
|
})
|
||||||
export class BitwardenToast extends BaseToast {
|
export class BitwardenToast extends BaseToast {
|
||||||
constructor(protected toastrService: ToastrService, public toastPackage: ToastPackage) {
|
constructor(
|
||||||
|
protected toastrService: ToastrService,
|
||||||
|
public toastPackage: ToastPackage,
|
||||||
|
) {
|
||||||
super(toastrService, toastPackage);
|
super(toastrService, toastPackage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,10 @@ export class A11yTitleDirective {
|
|||||||
|
|
||||||
private title: string;
|
private title: string;
|
||||||
|
|
||||||
constructor(private el: ElementRef, private renderer: Renderer2) {}
|
constructor(
|
||||||
|
private el: ElementRef,
|
||||||
|
private renderer: Renderer2,
|
||||||
|
) {}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
if (!this.el.nativeElement.hasAttribute("title")) {
|
if (!this.el.nativeElement.hasAttribute("title")) {
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ export class ApiActionDirective implements OnChanges {
|
|||||||
constructor(
|
constructor(
|
||||||
private el: ElementRef,
|
private el: ElementRef,
|
||||||
private validationService: ValidationService,
|
private validationService: ValidationService,
|
||||||
private logService: LogService
|
private logService: LogService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
ngOnChanges(changes: any) {
|
ngOnChanges(changes: any) {
|
||||||
@@ -43,7 +43,7 @@ export class ApiActionDirective implements OnChanges {
|
|||||||
}
|
}
|
||||||
this.logService?.error(`Received API exception: ${e}`);
|
this.logService?.error(`Received API exception: ${e}`);
|
||||||
this.validationService.showError(e);
|
this.validationService.showError(e);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,10 @@ export class AutofocusDirective {
|
|||||||
|
|
||||||
private autofocus: boolean;
|
private autofocus: boolean;
|
||||||
|
|
||||||
constructor(private el: ElementRef, private ngZone: NgZone) {}
|
constructor(
|
||||||
|
private el: ElementRef,
|
||||||
|
private ngZone: NgZone,
|
||||||
|
) {}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
if (!Utils.isMobileBrowser && this.autofocus) {
|
if (!Utils.isMobileBrowser && this.autofocus) {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ export class BoxRowDirective implements OnInit {
|
|||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.formEls = Array.from(
|
this.formEls = Array.from(
|
||||||
this.el.querySelectorAll('input:not([type="hidden"]), select, textarea')
|
this.el.querySelectorAll('input:not([type="hidden"]), select, textarea'),
|
||||||
);
|
);
|
||||||
this.formEls.forEach((formEl) => {
|
this.formEls.forEach((formEl) => {
|
||||||
formEl.addEventListener(
|
formEl.addEventListener(
|
||||||
@@ -21,7 +21,7 @@ export class BoxRowDirective implements OnInit {
|
|||||||
() => {
|
() => {
|
||||||
this.el.classList.add("active");
|
this.el.classList.add("active");
|
||||||
},
|
},
|
||||||
false
|
false,
|
||||||
);
|
);
|
||||||
|
|
||||||
formEl.addEventListener(
|
formEl.addEventListener(
|
||||||
@@ -29,7 +29,7 @@ export class BoxRowDirective implements OnInit {
|
|||||||
() => {
|
() => {
|
||||||
this.el.classList.remove("active");
|
this.el.classList.remove("active");
|
||||||
},
|
},
|
||||||
false
|
false,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,8 @@ $icomoon-font-path: "/jslib/angular/src/scss/bwicons/fonts/" !default;
|
|||||||
// New font sheet? Update the font-face information below
|
// New font sheet? Update the font-face information below
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: "#{$icomoon-font-family}";
|
font-family: "#{$icomoon-font-family}";
|
||||||
src: url($icomoon-font-path + "bwi-font.svg") format("svg"),
|
src:
|
||||||
|
url($icomoon-font-path + "bwi-font.svg") format("svg"),
|
||||||
url($icomoon-font-path + "bwi-font.ttf") format("truetype"),
|
url($icomoon-font-path + "bwi-font.ttf") format("truetype"),
|
||||||
url($icomoon-font-path + "bwi-font.woff") format("woff"),
|
url($icomoon-font-path + "bwi-font.woff") format("woff"),
|
||||||
url($icomoon-font-path + "bwi-font.woff2") format("woff2");
|
url($icomoon-font-path + "bwi-font.woff2") format("woff2");
|
||||||
|
|||||||
@@ -1,45 +0,0 @@
|
|||||||
import { Injectable } from "@angular/core";
|
|
||||||
import { ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot } from "@angular/router";
|
|
||||||
|
|
||||||
import { KeyConnectorService } from "@/jslib/common/src/abstractions/keyConnector.service";
|
|
||||||
import { MessagingService } from "@/jslib/common/src/abstractions/messaging.service";
|
|
||||||
import { StateService } from "@/jslib/common/src/abstractions/state.service";
|
|
||||||
import { VaultTimeoutService } from "@/jslib/common/src/abstractions/vaultTimeout.service";
|
|
||||||
|
|
||||||
@Injectable()
|
|
||||||
export class AuthGuardService implements CanActivate {
|
|
||||||
constructor(
|
|
||||||
private vaultTimeoutService: VaultTimeoutService,
|
|
||||||
private router: Router,
|
|
||||||
private messagingService: MessagingService,
|
|
||||||
private keyConnectorService: KeyConnectorService,
|
|
||||||
private stateService: StateService
|
|
||||||
) {}
|
|
||||||
|
|
||||||
async canActivate(route: ActivatedRouteSnapshot, routerState: RouterStateSnapshot) {
|
|
||||||
const isAuthed = await this.stateService.getIsAuthenticated();
|
|
||||||
if (!isAuthed) {
|
|
||||||
this.messagingService.send("authBlocked");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
const locked = await this.vaultTimeoutService.isLocked();
|
|
||||||
if (locked) {
|
|
||||||
if (routerState != null) {
|
|
||||||
this.messagingService.send("lockedUrl", { url: routerState.url });
|
|
||||||
}
|
|
||||||
this.router.navigate(["lock"], { queryParams: { promptBiometric: true } });
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
|
||||||
!routerState.url.includes("remove-password") &&
|
|
||||||
(await this.keyConnectorService.getConvertAccountRequired())
|
|
||||||
) {
|
|
||||||
this.router.navigate(["/remove-password"]);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,188 +1,70 @@
|
|||||||
import { Injector, LOCALE_ID, NgModule } from "@angular/core";
|
import { LOCALE_ID, NgModule } from "@angular/core";
|
||||||
|
|
||||||
import { ApiService as ApiServiceAbstraction } from "@/jslib/common/src/abstractions/api.service";
|
import { ApiService as ApiServiceAbstraction } from "@/jslib/common/src/abstractions/api.service";
|
||||||
import { AppIdService as AppIdServiceAbstraction } from "@/jslib/common/src/abstractions/appId.service";
|
import { AppIdService as AppIdServiceAbstraction } from "@/jslib/common/src/abstractions/appId.service";
|
||||||
import { AuditService as AuditServiceAbstraction } from "@/jslib/common/src/abstractions/audit.service";
|
|
||||||
import { AuthService as AuthServiceAbstraction } from "@/jslib/common/src/abstractions/auth.service";
|
|
||||||
import { BroadcasterService as BroadcasterServiceAbstraction } from "@/jslib/common/src/abstractions/broadcaster.service";
|
import { BroadcasterService as BroadcasterServiceAbstraction } from "@/jslib/common/src/abstractions/broadcaster.service";
|
||||||
import { CipherService as CipherServiceAbstraction } from "@/jslib/common/src/abstractions/cipher.service";
|
|
||||||
import { CollectionService as CollectionServiceAbstraction } from "@/jslib/common/src/abstractions/collection.service";
|
|
||||||
import { CryptoService as CryptoServiceAbstraction } from "@/jslib/common/src/abstractions/crypto.service";
|
import { CryptoService as CryptoServiceAbstraction } from "@/jslib/common/src/abstractions/crypto.service";
|
||||||
import { CryptoFunctionService as CryptoFunctionServiceAbstraction } from "@/jslib/common/src/abstractions/cryptoFunction.service";
|
import { CryptoFunctionService as CryptoFunctionServiceAbstraction } from "@/jslib/common/src/abstractions/cryptoFunction.service";
|
||||||
import { EnvironmentService as EnvironmentServiceAbstraction } from "@/jslib/common/src/abstractions/environment.service";
|
import { EnvironmentService as EnvironmentServiceAbstraction } from "@/jslib/common/src/abstractions/environment.service";
|
||||||
import { EventService as EventServiceAbstraction } from "@/jslib/common/src/abstractions/event.service";
|
|
||||||
import { FileUploadService as FileUploadServiceAbstraction } from "@/jslib/common/src/abstractions/fileUpload.service";
|
|
||||||
import { FolderService as FolderServiceAbstraction } from "@/jslib/common/src/abstractions/folder.service";
|
|
||||||
import { I18nService as I18nServiceAbstraction } from "@/jslib/common/src/abstractions/i18n.service";
|
import { I18nService as I18nServiceAbstraction } from "@/jslib/common/src/abstractions/i18n.service";
|
||||||
import { KeyConnectorService as KeyConnectorServiceAbstraction } from "@/jslib/common/src/abstractions/keyConnector.service";
|
|
||||||
import { LogService } from "@/jslib/common/src/abstractions/log.service";
|
import { LogService } from "@/jslib/common/src/abstractions/log.service";
|
||||||
import { MessagingService as MessagingServiceAbstraction } from "@/jslib/common/src/abstractions/messaging.service";
|
import { MessagingService as MessagingServiceAbstraction } from "@/jslib/common/src/abstractions/messaging.service";
|
||||||
import { NotificationsService as NotificationsServiceAbstraction } from "@/jslib/common/src/abstractions/notifications.service";
|
|
||||||
import { OrganizationService as OrganizationServiceAbstraction } from "@/jslib/common/src/abstractions/organization.service";
|
|
||||||
import { PasswordGenerationService as PasswordGenerationServiceAbstraction } from "@/jslib/common/src/abstractions/passwordGeneration.service";
|
|
||||||
import { PasswordRepromptService as PasswordRepromptServiceAbstraction } from "@/jslib/common/src/abstractions/passwordReprompt.service";
|
|
||||||
import { PlatformUtilsService as PlatformUtilsServiceAbstraction } from "@/jslib/common/src/abstractions/platformUtils.service";
|
import { PlatformUtilsService as PlatformUtilsServiceAbstraction } from "@/jslib/common/src/abstractions/platformUtils.service";
|
||||||
import { PolicyService as PolicyServiceAbstraction } from "@/jslib/common/src/abstractions/policy.service";
|
|
||||||
import { ProviderService as ProviderServiceAbstraction } from "@/jslib/common/src/abstractions/provider.service";
|
|
||||||
import { SearchService as SearchServiceAbstraction } from "@/jslib/common/src/abstractions/search.service";
|
|
||||||
import { SendService as SendServiceAbstraction } from "@/jslib/common/src/abstractions/send.service";
|
|
||||||
import { SettingsService as SettingsServiceAbstraction } from "@/jslib/common/src/abstractions/settings.service";
|
|
||||||
import { StateService as StateServiceAbstraction } from "@/jslib/common/src/abstractions/state.service";
|
import { StateService as StateServiceAbstraction } from "@/jslib/common/src/abstractions/state.service";
|
||||||
import { StateMigrationService as StateMigrationServiceAbstraction } from "@/jslib/common/src/abstractions/stateMigration.service";
|
import { StateMigrationService as StateMigrationServiceAbstraction } from "@/jslib/common/src/abstractions/stateMigration.service";
|
||||||
import { StorageService as StorageServiceAbstraction } from "@/jslib/common/src/abstractions/storage.service";
|
import { StorageService as StorageServiceAbstraction } from "@/jslib/common/src/abstractions/storage.service";
|
||||||
import { SyncService as SyncServiceAbstraction } from "@/jslib/common/src/abstractions/sync.service";
|
|
||||||
import { TokenService as TokenServiceAbstraction } from "@/jslib/common/src/abstractions/token.service";
|
import { TokenService as TokenServiceAbstraction } from "@/jslib/common/src/abstractions/token.service";
|
||||||
import { TotpService as TotpServiceAbstraction } from "@/jslib/common/src/abstractions/totp.service";
|
|
||||||
import { TwoFactorService as TwoFactorServiceAbstraction } from "@/jslib/common/src/abstractions/twoFactor.service";
|
|
||||||
import { UserVerificationService as UserVerificationServiceAbstraction } from "@/jslib/common/src/abstractions/userVerification.service";
|
|
||||||
import { UsernameGenerationService as UsernameGenerationServiceAbstraction } from "@/jslib/common/src/abstractions/usernameGeneration.service";
|
|
||||||
import { VaultTimeoutService as VaultTimeoutServiceAbstraction } from "@/jslib/common/src/abstractions/vaultTimeout.service";
|
|
||||||
import { StateFactory } from "@/jslib/common/src/factories/stateFactory";
|
import { StateFactory } from "@/jslib/common/src/factories/stateFactory";
|
||||||
import { Account } from "@/jslib/common/src/models/domain/account";
|
import { Account } from "@/jslib/common/src/models/domain/account";
|
||||||
import { GlobalState } from "@/jslib/common/src/models/domain/globalState";
|
import { GlobalState } from "@/jslib/common/src/models/domain/globalState";
|
||||||
import { ApiService } from "@/jslib/common/src/services/api.service";
|
import { ApiService } from "@/jslib/common/src/services/api.service";
|
||||||
import { AppIdService } from "@/jslib/common/src/services/appId.service";
|
import { AppIdService } from "@/jslib/common/src/services/appId.service";
|
||||||
import { AuditService } from "@/jslib/common/src/services/audit.service";
|
|
||||||
import { AuthService } from "@/jslib/common/src/services/auth.service";
|
|
||||||
import { CipherService } from "@/jslib/common/src/services/cipher.service";
|
|
||||||
import { CollectionService } from "@/jslib/common/src/services/collection.service";
|
|
||||||
import { ConsoleLogService } from "@/jslib/common/src/services/consoleLog.service";
|
import { ConsoleLogService } from "@/jslib/common/src/services/consoleLog.service";
|
||||||
import { CryptoService } from "@/jslib/common/src/services/crypto.service";
|
import { CryptoService } from "@/jslib/common/src/services/crypto.service";
|
||||||
import { EnvironmentService } from "@/jslib/common/src/services/environment.service";
|
import { EnvironmentService } from "@/jslib/common/src/services/environment.service";
|
||||||
import { EventService } from "@/jslib/common/src/services/event.service";
|
|
||||||
import { FileUploadService } from "@/jslib/common/src/services/fileUpload.service";
|
|
||||||
import { FolderService } from "@/jslib/common/src/services/folder.service";
|
|
||||||
import { KeyConnectorService } from "@/jslib/common/src/services/keyConnector.service";
|
|
||||||
import { NotificationsService } from "@/jslib/common/src/services/notifications.service";
|
|
||||||
import { OrganizationService } from "@/jslib/common/src/services/organization.service";
|
|
||||||
import { PasswordGenerationService } from "@/jslib/common/src/services/passwordGeneration.service";
|
|
||||||
import { PolicyService } from "@/jslib/common/src/services/policy.service";
|
|
||||||
import { ProviderService } from "@/jslib/common/src/services/provider.service";
|
|
||||||
import { SearchService } from "@/jslib/common/src/services/search.service";
|
|
||||||
import { SendService } from "@/jslib/common/src/services/send.service";
|
|
||||||
import { SettingsService } from "@/jslib/common/src/services/settings.service";
|
|
||||||
import { StateService } from "@/jslib/common/src/services/state.service";
|
import { StateService } from "@/jslib/common/src/services/state.service";
|
||||||
import { StateMigrationService } from "@/jslib/common/src/services/stateMigration.service";
|
import { StateMigrationService } from "@/jslib/common/src/services/stateMigration.service";
|
||||||
import { SyncService } from "@/jslib/common/src/services/sync.service";
|
|
||||||
import { TokenService } from "@/jslib/common/src/services/token.service";
|
import { TokenService } from "@/jslib/common/src/services/token.service";
|
||||||
import { TotpService } from "@/jslib/common/src/services/totp.service";
|
|
||||||
import { TwoFactorService } from "@/jslib/common/src/services/twoFactor.service";
|
|
||||||
import { UserVerificationService } from "@/jslib/common/src/services/userVerification.service";
|
|
||||||
import { UsernameGenerationService } from "@/jslib/common/src/services/usernameGeneration.service";
|
|
||||||
import { VaultTimeoutService } from "@/jslib/common/src/services/vaultTimeout.service";
|
|
||||||
|
|
||||||
import { AuthGuardService } from "./auth-guard.service";
|
import {
|
||||||
|
SafeInjectionToken,
|
||||||
|
SECURE_STORAGE,
|
||||||
|
WINDOW,
|
||||||
|
} from "../../../../src/app/services/injection-tokens";
|
||||||
|
import { SafeProvider, safeProvider } from "../../../../src/app/services/safe-provider";
|
||||||
|
|
||||||
import { BroadcasterService } from "./broadcaster.service";
|
import { BroadcasterService } from "./broadcaster.service";
|
||||||
import { LockGuardService } from "./lock-guard.service";
|
|
||||||
import { ModalService } from "./modal.service";
|
import { ModalService } from "./modal.service";
|
||||||
import { PasswordRepromptService } from "./passwordReprompt.service";
|
|
||||||
import { UnauthGuardService } from "./unauth-guard.service";
|
|
||||||
import { ValidationService } from "./validation.service";
|
import { ValidationService } from "./validation.service";
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [],
|
declarations: [],
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: "WINDOW", useValue: window },
|
safeProvider({ provide: WINDOW, useValue: window }),
|
||||||
{
|
safeProvider({
|
||||||
provide: LOCALE_ID,
|
provide: LOCALE_ID as SafeInjectionToken<string>,
|
||||||
useFactory: (i18nService: I18nServiceAbstraction) => i18nService.translationLocale,
|
useFactory: (i18nService: I18nServiceAbstraction) => i18nService.translationLocale,
|
||||||
deps: [I18nServiceAbstraction],
|
deps: [I18nServiceAbstraction],
|
||||||
},
|
}),
|
||||||
ValidationService,
|
safeProvider(ValidationService),
|
||||||
AuthGuardService,
|
safeProvider(ModalService),
|
||||||
UnauthGuardService,
|
safeProvider({
|
||||||
LockGuardService,
|
|
||||||
ModalService,
|
|
||||||
{
|
|
||||||
provide: AppIdServiceAbstraction,
|
provide: AppIdServiceAbstraction,
|
||||||
useClass: AppIdService,
|
useClass: AppIdService,
|
||||||
deps: [StorageServiceAbstraction],
|
deps: [StorageServiceAbstraction],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({ provide: LogService, useFactory: () => new ConsoleLogService(false), deps: [] }),
|
||||||
provide: AuditServiceAbstraction,
|
safeProvider({
|
||||||
useClass: AuditService,
|
|
||||||
deps: [CryptoFunctionServiceAbstraction, ApiServiceAbstraction],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
provide: AuthServiceAbstraction,
|
|
||||||
useClass: AuthService,
|
|
||||||
deps: [
|
|
||||||
CryptoServiceAbstraction,
|
|
||||||
ApiServiceAbstraction,
|
|
||||||
TokenServiceAbstraction,
|
|
||||||
AppIdServiceAbstraction,
|
|
||||||
PlatformUtilsServiceAbstraction,
|
|
||||||
MessagingServiceAbstraction,
|
|
||||||
LogService,
|
|
||||||
KeyConnectorServiceAbstraction,
|
|
||||||
EnvironmentServiceAbstraction,
|
|
||||||
StateServiceAbstraction,
|
|
||||||
TwoFactorServiceAbstraction,
|
|
||||||
I18nServiceAbstraction,
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
provide: CipherServiceAbstraction,
|
|
||||||
useFactory: (
|
|
||||||
cryptoService: CryptoServiceAbstraction,
|
|
||||||
settingsService: SettingsServiceAbstraction,
|
|
||||||
apiService: ApiServiceAbstraction,
|
|
||||||
fileUploadService: FileUploadServiceAbstraction,
|
|
||||||
i18nService: I18nServiceAbstraction,
|
|
||||||
injector: Injector,
|
|
||||||
logService: LogService,
|
|
||||||
stateService: StateServiceAbstraction
|
|
||||||
) =>
|
|
||||||
new CipherService(
|
|
||||||
cryptoService,
|
|
||||||
settingsService,
|
|
||||||
apiService,
|
|
||||||
fileUploadService,
|
|
||||||
i18nService,
|
|
||||||
() => injector.get(SearchServiceAbstraction),
|
|
||||||
logService,
|
|
||||||
stateService
|
|
||||||
),
|
|
||||||
deps: [
|
|
||||||
CryptoServiceAbstraction,
|
|
||||||
SettingsServiceAbstraction,
|
|
||||||
ApiServiceAbstraction,
|
|
||||||
FileUploadServiceAbstraction,
|
|
||||||
I18nServiceAbstraction,
|
|
||||||
Injector, // TODO: Get rid of this circular dependency!
|
|
||||||
LogService,
|
|
||||||
StateServiceAbstraction,
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
provide: FolderServiceAbstraction,
|
|
||||||
useClass: FolderService,
|
|
||||||
deps: [
|
|
||||||
CryptoServiceAbstraction,
|
|
||||||
ApiServiceAbstraction,
|
|
||||||
I18nServiceAbstraction,
|
|
||||||
CipherServiceAbstraction,
|
|
||||||
StateServiceAbstraction,
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{ provide: LogService, useFactory: () => new ConsoleLogService(false) },
|
|
||||||
{
|
|
||||||
provide: CollectionServiceAbstraction,
|
|
||||||
useClass: CollectionService,
|
|
||||||
deps: [CryptoServiceAbstraction, I18nServiceAbstraction, StateServiceAbstraction],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
provide: EnvironmentServiceAbstraction,
|
provide: EnvironmentServiceAbstraction,
|
||||||
useClass: EnvironmentService,
|
useClass: EnvironmentService,
|
||||||
deps: [StateServiceAbstraction],
|
deps: [StateServiceAbstraction],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: TotpServiceAbstraction,
|
provide: TokenServiceAbstraction,
|
||||||
useClass: TotpService,
|
useClass: TokenService,
|
||||||
deps: [CryptoFunctionServiceAbstraction, LogService, StateServiceAbstraction],
|
deps: [StateServiceAbstraction],
|
||||||
},
|
}),
|
||||||
{ provide: TokenServiceAbstraction, useClass: TokenService, deps: [StateServiceAbstraction] },
|
safeProvider({
|
||||||
{
|
|
||||||
provide: CryptoServiceAbstraction,
|
provide: CryptoServiceAbstraction,
|
||||||
useClass: CryptoService,
|
useClass: CryptoService,
|
||||||
deps: [
|
deps: [
|
||||||
@@ -191,32 +73,22 @@ import { ValidationService } from "./validation.service";
|
|||||||
LogService,
|
LogService,
|
||||||
StateServiceAbstraction,
|
StateServiceAbstraction,
|
||||||
],
|
],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: PasswordGenerationServiceAbstraction,
|
|
||||||
useClass: PasswordGenerationService,
|
|
||||||
deps: [CryptoServiceAbstraction, PolicyServiceAbstraction, StateServiceAbstraction],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
provide: UsernameGenerationServiceAbstraction,
|
|
||||||
useClass: UsernameGenerationService,
|
|
||||||
deps: [CryptoServiceAbstraction, StateServiceAbstraction],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
provide: ApiServiceAbstraction,
|
provide: ApiServiceAbstraction,
|
||||||
useFactory: (
|
useFactory: (
|
||||||
tokenService: TokenServiceAbstraction,
|
tokenService: TokenServiceAbstraction,
|
||||||
platformUtilsService: PlatformUtilsServiceAbstraction,
|
platformUtilsService: PlatformUtilsServiceAbstraction,
|
||||||
environmentService: EnvironmentServiceAbstraction,
|
environmentService: EnvironmentServiceAbstraction,
|
||||||
messagingService: MessagingServiceAbstraction,
|
messagingService: MessagingServiceAbstraction,
|
||||||
appIdService: AppIdServiceAbstraction
|
appIdService: AppIdServiceAbstraction,
|
||||||
) =>
|
) =>
|
||||||
new ApiService(
|
new ApiService(
|
||||||
tokenService,
|
tokenService,
|
||||||
platformUtilsService,
|
platformUtilsService,
|
||||||
environmentService,
|
environmentService,
|
||||||
appIdService,
|
appIdService,
|
||||||
async (expired: boolean) => messagingService.send("logout", { expired: expired })
|
async (expired: boolean) => messagingService.send("logout", { expired: expired }),
|
||||||
),
|
),
|
||||||
deps: [
|
deps: [
|
||||||
TokenServiceAbstraction,
|
TokenServiceAbstraction,
|
||||||
@@ -225,250 +97,47 @@ import { ValidationService } from "./validation.service";
|
|||||||
MessagingServiceAbstraction,
|
MessagingServiceAbstraction,
|
||||||
AppIdServiceAbstraction,
|
AppIdServiceAbstraction,
|
||||||
],
|
],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: FileUploadServiceAbstraction,
|
provide: BroadcasterServiceAbstraction,
|
||||||
useClass: FileUploadService,
|
useClass: BroadcasterService,
|
||||||
deps: [LogService, ApiServiceAbstraction],
|
useAngularDecorators: true,
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: SyncServiceAbstraction,
|
|
||||||
useFactory: (
|
|
||||||
apiService: ApiServiceAbstraction,
|
|
||||||
settingsService: SettingsServiceAbstraction,
|
|
||||||
folderService: FolderServiceAbstraction,
|
|
||||||
cipherService: CipherServiceAbstraction,
|
|
||||||
cryptoService: CryptoServiceAbstraction,
|
|
||||||
collectionService: CollectionServiceAbstraction,
|
|
||||||
messagingService: MessagingServiceAbstraction,
|
|
||||||
policyService: PolicyServiceAbstraction,
|
|
||||||
sendService: SendServiceAbstraction,
|
|
||||||
logService: LogService,
|
|
||||||
keyConnectorService: KeyConnectorServiceAbstraction,
|
|
||||||
stateService: StateServiceAbstraction,
|
|
||||||
organizationService: OrganizationServiceAbstraction,
|
|
||||||
providerService: ProviderServiceAbstraction
|
|
||||||
) =>
|
|
||||||
new SyncService(
|
|
||||||
apiService,
|
|
||||||
settingsService,
|
|
||||||
folderService,
|
|
||||||
cipherService,
|
|
||||||
cryptoService,
|
|
||||||
collectionService,
|
|
||||||
messagingService,
|
|
||||||
policyService,
|
|
||||||
sendService,
|
|
||||||
logService,
|
|
||||||
keyConnectorService,
|
|
||||||
stateService,
|
|
||||||
organizationService,
|
|
||||||
providerService,
|
|
||||||
async (expired: boolean) => messagingService.send("logout", { expired: expired })
|
|
||||||
),
|
|
||||||
deps: [
|
|
||||||
ApiServiceAbstraction,
|
|
||||||
SettingsServiceAbstraction,
|
|
||||||
FolderServiceAbstraction,
|
|
||||||
CipherServiceAbstraction,
|
|
||||||
CryptoServiceAbstraction,
|
|
||||||
CollectionServiceAbstraction,
|
|
||||||
MessagingServiceAbstraction,
|
|
||||||
PolicyServiceAbstraction,
|
|
||||||
SendServiceAbstraction,
|
|
||||||
LogService,
|
|
||||||
KeyConnectorServiceAbstraction,
|
|
||||||
StateServiceAbstraction,
|
|
||||||
OrganizationServiceAbstraction,
|
|
||||||
ProviderServiceAbstraction,
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{ provide: BroadcasterServiceAbstraction, useClass: BroadcasterService },
|
|
||||||
{
|
|
||||||
provide: SettingsServiceAbstraction,
|
|
||||||
useClass: SettingsService,
|
|
||||||
deps: [StateServiceAbstraction],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
provide: VaultTimeoutServiceAbstraction,
|
|
||||||
useFactory: (
|
|
||||||
cipherService: CipherServiceAbstraction,
|
|
||||||
folderService: FolderServiceAbstraction,
|
|
||||||
collectionService: CollectionServiceAbstraction,
|
|
||||||
cryptoService: CryptoServiceAbstraction,
|
|
||||||
platformUtilsService: PlatformUtilsServiceAbstraction,
|
|
||||||
messagingService: MessagingServiceAbstraction,
|
|
||||||
searchService: SearchServiceAbstraction,
|
|
||||||
tokenService: TokenServiceAbstraction,
|
|
||||||
policyService: PolicyServiceAbstraction,
|
|
||||||
keyConnectorService: KeyConnectorServiceAbstraction,
|
|
||||||
stateService: StateServiceAbstraction
|
|
||||||
) =>
|
|
||||||
new VaultTimeoutService(
|
|
||||||
cipherService,
|
|
||||||
folderService,
|
|
||||||
collectionService,
|
|
||||||
cryptoService,
|
|
||||||
platformUtilsService,
|
|
||||||
messagingService,
|
|
||||||
searchService,
|
|
||||||
tokenService,
|
|
||||||
policyService,
|
|
||||||
keyConnectorService,
|
|
||||||
stateService,
|
|
||||||
null,
|
|
||||||
async (userId?: string) =>
|
|
||||||
messagingService.send("logout", { expired: false, userId: userId })
|
|
||||||
),
|
|
||||||
deps: [
|
|
||||||
CipherServiceAbstraction,
|
|
||||||
FolderServiceAbstraction,
|
|
||||||
CollectionServiceAbstraction,
|
|
||||||
CryptoServiceAbstraction,
|
|
||||||
PlatformUtilsServiceAbstraction,
|
|
||||||
MessagingServiceAbstraction,
|
|
||||||
SearchServiceAbstraction,
|
|
||||||
TokenServiceAbstraction,
|
|
||||||
PolicyServiceAbstraction,
|
|
||||||
KeyConnectorServiceAbstraction,
|
|
||||||
StateServiceAbstraction,
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
provide: StateServiceAbstraction,
|
provide: StateServiceAbstraction,
|
||||||
useFactory: (
|
useFactory: (
|
||||||
storageService: StorageServiceAbstraction,
|
storageService: StorageServiceAbstraction,
|
||||||
secureStorageService: StorageServiceAbstraction,
|
secureStorageService: StorageServiceAbstraction,
|
||||||
logService: LogService,
|
logService: LogService,
|
||||||
stateMigrationService: StateMigrationServiceAbstraction
|
stateMigrationService: StateMigrationServiceAbstraction,
|
||||||
) =>
|
) =>
|
||||||
new StateService(
|
new StateService(
|
||||||
storageService,
|
storageService,
|
||||||
secureStorageService,
|
secureStorageService,
|
||||||
logService,
|
logService,
|
||||||
stateMigrationService,
|
stateMigrationService,
|
||||||
new StateFactory(GlobalState, Account)
|
new StateFactory(GlobalState, Account),
|
||||||
),
|
),
|
||||||
deps: [
|
deps: [
|
||||||
StorageServiceAbstraction,
|
StorageServiceAbstraction,
|
||||||
"SECURE_STORAGE",
|
SECURE_STORAGE,
|
||||||
LogService,
|
LogService,
|
||||||
StateMigrationServiceAbstraction,
|
StateMigrationServiceAbstraction,
|
||||||
],
|
],
|
||||||
},
|
}),
|
||||||
{
|
safeProvider({
|
||||||
provide: StateMigrationServiceAbstraction,
|
provide: StateMigrationServiceAbstraction,
|
||||||
useFactory: (
|
useFactory: (
|
||||||
storageService: StorageServiceAbstraction,
|
storageService: StorageServiceAbstraction,
|
||||||
secureStorageService: StorageServiceAbstraction
|
secureStorageService: StorageServiceAbstraction,
|
||||||
) =>
|
) =>
|
||||||
new StateMigrationService(
|
new StateMigrationService(
|
||||||
storageService,
|
storageService,
|
||||||
secureStorageService,
|
secureStorageService,
|
||||||
new StateFactory(GlobalState, Account)
|
new StateFactory(GlobalState, Account),
|
||||||
),
|
),
|
||||||
deps: [StorageServiceAbstraction, "SECURE_STORAGE"],
|
deps: [StorageServiceAbstraction, SECURE_STORAGE],
|
||||||
},
|
}),
|
||||||
{
|
] satisfies SafeProvider[],
|
||||||
provide: SearchServiceAbstraction,
|
|
||||||
useClass: SearchService,
|
|
||||||
deps: [CipherServiceAbstraction, LogService, I18nServiceAbstraction],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
provide: NotificationsServiceAbstraction,
|
|
||||||
useFactory: (
|
|
||||||
syncService: SyncServiceAbstraction,
|
|
||||||
appIdService: AppIdServiceAbstraction,
|
|
||||||
apiService: ApiServiceAbstraction,
|
|
||||||
vaultTimeoutService: VaultTimeoutServiceAbstraction,
|
|
||||||
environmentService: EnvironmentServiceAbstraction,
|
|
||||||
messagingService: MessagingServiceAbstraction,
|
|
||||||
logService: LogService,
|
|
||||||
stateService: StateServiceAbstraction
|
|
||||||
) =>
|
|
||||||
new NotificationsService(
|
|
||||||
syncService,
|
|
||||||
appIdService,
|
|
||||||
apiService,
|
|
||||||
vaultTimeoutService,
|
|
||||||
environmentService,
|
|
||||||
async () => messagingService.send("logout", { expired: true }),
|
|
||||||
logService,
|
|
||||||
stateService
|
|
||||||
),
|
|
||||||
deps: [
|
|
||||||
SyncServiceAbstraction,
|
|
||||||
AppIdServiceAbstraction,
|
|
||||||
ApiServiceAbstraction,
|
|
||||||
VaultTimeoutServiceAbstraction,
|
|
||||||
EnvironmentServiceAbstraction,
|
|
||||||
MessagingServiceAbstraction,
|
|
||||||
LogService,
|
|
||||||
StateServiceAbstraction,
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
provide: EventServiceAbstraction,
|
|
||||||
useClass: EventService,
|
|
||||||
deps: [
|
|
||||||
ApiServiceAbstraction,
|
|
||||||
CipherServiceAbstraction,
|
|
||||||
StateServiceAbstraction,
|
|
||||||
LogService,
|
|
||||||
OrganizationServiceAbstraction,
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
provide: PolicyServiceAbstraction,
|
|
||||||
useClass: PolicyService,
|
|
||||||
deps: [StateServiceAbstraction, OrganizationServiceAbstraction, ApiServiceAbstraction],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
provide: SendServiceAbstraction,
|
|
||||||
useClass: SendService,
|
|
||||||
deps: [
|
|
||||||
CryptoServiceAbstraction,
|
|
||||||
ApiServiceAbstraction,
|
|
||||||
FileUploadServiceAbstraction,
|
|
||||||
I18nServiceAbstraction,
|
|
||||||
CryptoFunctionServiceAbstraction,
|
|
||||||
StateServiceAbstraction,
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
provide: KeyConnectorServiceAbstraction,
|
|
||||||
useClass: KeyConnectorService,
|
|
||||||
deps: [
|
|
||||||
StateServiceAbstraction,
|
|
||||||
CryptoServiceAbstraction,
|
|
||||||
ApiServiceAbstraction,
|
|
||||||
TokenServiceAbstraction,
|
|
||||||
LogService,
|
|
||||||
OrganizationServiceAbstraction,
|
|
||||||
CryptoFunctionServiceAbstraction,
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
provide: UserVerificationServiceAbstraction,
|
|
||||||
useClass: UserVerificationService,
|
|
||||||
deps: [CryptoServiceAbstraction, I18nServiceAbstraction, ApiServiceAbstraction],
|
|
||||||
},
|
|
||||||
{ provide: PasswordRepromptServiceAbstraction, useClass: PasswordRepromptService },
|
|
||||||
{
|
|
||||||
provide: OrganizationServiceAbstraction,
|
|
||||||
useClass: OrganizationService,
|
|
||||||
deps: [StateServiceAbstraction],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
provide: ProviderServiceAbstraction,
|
|
||||||
useClass: ProviderService,
|
|
||||||
deps: [StateServiceAbstraction],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
provide: TwoFactorServiceAbstraction,
|
|
||||||
useClass: TwoFactorService,
|
|
||||||
deps: [I18nServiceAbstraction, PlatformUtilsServiceAbstraction],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
})
|
})
|
||||||
export class JslibServicesModule {}
|
export class JslibServicesModule {}
|
||||||
|
|||||||
@@ -1,29 +0,0 @@
|
|||||||
import { Injectable } from "@angular/core";
|
|
||||||
import { CanActivate, Router } from "@angular/router";
|
|
||||||
|
|
||||||
import { StateService } from "@/jslib/common/src/abstractions/state.service";
|
|
||||||
import { VaultTimeoutService } from "@/jslib/common/src/abstractions/vaultTimeout.service";
|
|
||||||
|
|
||||||
@Injectable()
|
|
||||||
export class LockGuardService implements CanActivate {
|
|
||||||
protected homepage = "vault";
|
|
||||||
protected loginpage = "login";
|
|
||||||
constructor(
|
|
||||||
private vaultTimeoutService: VaultTimeoutService,
|
|
||||||
private router: Router,
|
|
||||||
private stateService: StateService
|
|
||||||
) {}
|
|
||||||
|
|
||||||
async canActivate() {
|
|
||||||
if (await this.vaultTimeoutService.isLocked()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
const redirectUrl = (await this.stateService.getIsAuthenticated())
|
|
||||||
? [this.homepage]
|
|
||||||
: [this.loginpage];
|
|
||||||
|
|
||||||
this.router.navigate(redirectUrl);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -31,7 +31,7 @@ export class ModalService {
|
|||||||
constructor(
|
constructor(
|
||||||
private componentFactoryResolver: ComponentFactoryResolver,
|
private componentFactoryResolver: ComponentFactoryResolver,
|
||||||
private applicationRef: ApplicationRef,
|
private applicationRef: ApplicationRef,
|
||||||
private injector: Injector
|
private injector: Injector,
|
||||||
) {
|
) {
|
||||||
document.addEventListener("keyup", (event) => {
|
document.addEventListener("keyup", (event) => {
|
||||||
if (event.key === "Escape" && this.modalCount > 0) {
|
if (event.key === "Escape" && this.modalCount > 0) {
|
||||||
@@ -51,7 +51,7 @@ export class ModalService {
|
|||||||
async openViewRef<T>(
|
async openViewRef<T>(
|
||||||
componentType: Type<T>,
|
componentType: Type<T>,
|
||||||
viewContainerRef: ViewContainerRef,
|
viewContainerRef: ViewContainerRef,
|
||||||
setComponentParameters: (component: T) => void = null
|
setComponentParameters: (component: T) => void = null,
|
||||||
): Promise<[ModalRef, T]> {
|
): Promise<[ModalRef, T]> {
|
||||||
const [modalRef, modalComponentRef] = this.openInternal(componentType, null, false);
|
const [modalRef, modalComponentRef] = this.openInternal(componentType, null, false);
|
||||||
modalComponentRef.instance.setComponentParameters = setComponentParameters;
|
modalComponentRef.instance.setComponentParameters = setComponentParameters;
|
||||||
@@ -76,7 +76,7 @@ export class ModalService {
|
|||||||
|
|
||||||
registerComponentFactoryResolver<T>(
|
registerComponentFactoryResolver<T>(
|
||||||
componentType: Type<T>,
|
componentType: Type<T>,
|
||||||
componentFactoryResolver: ComponentFactoryResolver
|
componentFactoryResolver: ComponentFactoryResolver,
|
||||||
): void {
|
): void {
|
||||||
this.factoryResolvers.set(componentType, componentFactoryResolver);
|
this.factoryResolvers.set(componentType, componentFactoryResolver);
|
||||||
}
|
}
|
||||||
@@ -92,7 +92,7 @@ export class ModalService {
|
|||||||
protected openInternal(
|
protected openInternal(
|
||||||
componentType: Type<any>,
|
componentType: Type<any>,
|
||||||
config?: ModalConfig,
|
config?: ModalConfig,
|
||||||
attachToDom?: boolean
|
attachToDom?: boolean,
|
||||||
): [ModalRef, ComponentRef<DynamicModalComponent>] {
|
): [ModalRef, ComponentRef<DynamicModalComponent>] {
|
||||||
const [modalRef, componentRef] = this.createModalComponent(config);
|
const [modalRef, componentRef] = this.createModalComponent(config);
|
||||||
componentRef.instance.childComponentType = componentType;
|
componentRef.instance.childComponentType = componentType;
|
||||||
@@ -143,7 +143,7 @@ export class ModalService {
|
|||||||
dialogEl.style.zIndex = `${this.modalCount}050`;
|
dialogEl.style.zIndex = `${this.modalCount}050`;
|
||||||
|
|
||||||
const modals = Array.from(
|
const modals = Array.from(
|
||||||
el.querySelectorAll('.modal-backdrop, .modal *[data-dismiss="modal"]')
|
el.querySelectorAll('.modal-backdrop, .modal *[data-bs-dismiss="modal"]'),
|
||||||
);
|
);
|
||||||
for (const closeElement of modals) {
|
for (const closeElement of modals) {
|
||||||
closeElement.addEventListener("click", () => {
|
closeElement.addEventListener("click", () => {
|
||||||
@@ -163,7 +163,7 @@ export class ModalService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected createModalComponent(
|
protected createModalComponent(
|
||||||
config: ModalConfig
|
config: ModalConfig,
|
||||||
): [ModalRef, ComponentRef<DynamicModalComponent>] {
|
): [ModalRef, ComponentRef<DynamicModalComponent>] {
|
||||||
const modalRef = new ModalRef();
|
const modalRef = new ModalRef();
|
||||||
|
|
||||||
|
|||||||
@@ -1,45 +0,0 @@
|
|||||||
import { Injectable } from "@angular/core";
|
|
||||||
|
|
||||||
import { KeyConnectorService } from "@/jslib/common/src/abstractions/keyConnector.service";
|
|
||||||
import { PasswordRepromptService as PasswordRepromptServiceAbstraction } from "@/jslib/common/src/abstractions/passwordReprompt.service";
|
|
||||||
|
|
||||||
import { PasswordRepromptComponent } from "../components/password-reprompt.component";
|
|
||||||
|
|
||||||
import { ModalService } from "./modal.service";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used to verify the user's Master Password for the "Master Password Re-prompt" feature only.
|
|
||||||
* See UserVerificationService for any other situation where you need to verify the user's identity.
|
|
||||||
*/
|
|
||||||
@Injectable()
|
|
||||||
export class PasswordRepromptService implements PasswordRepromptServiceAbstraction {
|
|
||||||
protected component = PasswordRepromptComponent;
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
private modalService: ModalService,
|
|
||||||
private keyConnectorService: KeyConnectorService
|
|
||||||
) {}
|
|
||||||
|
|
||||||
protectedFields() {
|
|
||||||
return ["TOTP", "Password", "H_Field", "Card Number", "Security Code"];
|
|
||||||
}
|
|
||||||
|
|
||||||
async showPasswordPrompt() {
|
|
||||||
if (!(await this.enabled())) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
const ref = this.modalService.open(this.component, { allowMultipleModals: true });
|
|
||||||
|
|
||||||
if (ref == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
const result = await ref.onClosedPromise();
|
|
||||||
return result === true;
|
|
||||||
}
|
|
||||||
|
|
||||||
async enabled() {
|
|
||||||
return !(await this.keyConnectorService.getUsesKeyConnector());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
import { Injectable } from "@angular/core";
|
|
||||||
import { CanActivate, Router } from "@angular/router";
|
|
||||||
|
|
||||||
import { StateService } from "@/jslib/common/src/abstractions/state.service";
|
|
||||||
import { VaultTimeoutService } from "@/jslib/common/src/abstractions/vaultTimeout.service";
|
|
||||||
|
|
||||||
@Injectable()
|
|
||||||
export class UnauthGuardService implements CanActivate {
|
|
||||||
protected homepage = "vault";
|
|
||||||
constructor(
|
|
||||||
private vaultTimeoutService: VaultTimeoutService,
|
|
||||||
private router: Router,
|
|
||||||
private stateService: StateService
|
|
||||||
) {}
|
|
||||||
|
|
||||||
async canActivate() {
|
|
||||||
const isAuthed = await this.stateService.getIsAuthenticated();
|
|
||||||
if (isAuthed) {
|
|
||||||
const locked = await this.vaultTimeoutService.isLocked();
|
|
||||||
if (locked) {
|
|
||||||
this.router.navigate(["lock"]);
|
|
||||||
} else {
|
|
||||||
this.router.navigate([this.homepage]);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -8,7 +8,7 @@ import { ErrorResponse } from "@/jslib/common/src/models/response/errorResponse"
|
|||||||
export class ValidationService {
|
export class ValidationService {
|
||||||
constructor(
|
constructor(
|
||||||
private i18nService: I18nService,
|
private i18nService: I18nService,
|
||||||
private platformUtilsService: PlatformUtilsService
|
private platformUtilsService: PlatformUtilsService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
showError(data: any): string[] {
|
showError(data: any): string[] {
|
||||||
|
|||||||
@@ -1,114 +0,0 @@
|
|||||||
import { Arg, Substitute, SubstituteOf } from "@fluffy-spoon/substitute";
|
|
||||||
|
|
||||||
import { ApiService } from "@/jslib/common/src/abstractions/api.service";
|
|
||||||
import { AppIdService } from "@/jslib/common/src/abstractions/appId.service";
|
|
||||||
import { CryptoService } from "@/jslib/common/src/abstractions/crypto.service";
|
|
||||||
import { EnvironmentService } from "@/jslib/common/src/abstractions/environment.service";
|
|
||||||
import { KeyConnectorService } from "@/jslib/common/src/abstractions/keyConnector.service";
|
|
||||||
import { LogService } from "@/jslib/common/src/abstractions/log.service";
|
|
||||||
import { MessagingService } from "@/jslib/common/src/abstractions/messaging.service";
|
|
||||||
import { PlatformUtilsService } from "@/jslib/common/src/abstractions/platformUtils.service";
|
|
||||||
import { StateService } from "@/jslib/common/src/abstractions/state.service";
|
|
||||||
import { TokenService } from "@/jslib/common/src/abstractions/token.service";
|
|
||||||
import { TwoFactorService } from "@/jslib/common/src/abstractions/twoFactor.service";
|
|
||||||
import { ApiLogInStrategy } from "@/jslib/common/src/misc/logInStrategies/apiLogin.strategy";
|
|
||||||
import { Utils } from "@/jslib/common/src/misc/utils";
|
|
||||||
import { ApiLogInCredentials } from "@/jslib/common/src/models/domain/logInCredentials";
|
|
||||||
|
|
||||||
import { identityTokenResponseFactory } from "./logIn.strategy.spec";
|
|
||||||
|
|
||||||
describe("ApiLogInStrategy", () => {
|
|
||||||
let cryptoService: SubstituteOf<CryptoService>;
|
|
||||||
let apiService: SubstituteOf<ApiService>;
|
|
||||||
let tokenService: SubstituteOf<TokenService>;
|
|
||||||
let appIdService: SubstituteOf<AppIdService>;
|
|
||||||
let platformUtilsService: SubstituteOf<PlatformUtilsService>;
|
|
||||||
let messagingService: SubstituteOf<MessagingService>;
|
|
||||||
let logService: SubstituteOf<LogService>;
|
|
||||||
let environmentService: SubstituteOf<EnvironmentService>;
|
|
||||||
let keyConnectorService: SubstituteOf<KeyConnectorService>;
|
|
||||||
let stateService: SubstituteOf<StateService>;
|
|
||||||
let twoFactorService: SubstituteOf<TwoFactorService>;
|
|
||||||
|
|
||||||
let apiLogInStrategy: ApiLogInStrategy;
|
|
||||||
let credentials: ApiLogInCredentials;
|
|
||||||
|
|
||||||
const deviceId = Utils.newGuid();
|
|
||||||
const keyConnectorUrl = "KEY_CONNECTOR_URL";
|
|
||||||
const apiClientId = "API_CLIENT_ID";
|
|
||||||
const apiClientSecret = "API_CLIENT_SECRET";
|
|
||||||
|
|
||||||
beforeEach(async () => {
|
|
||||||
cryptoService = Substitute.for<CryptoService>();
|
|
||||||
apiService = Substitute.for<ApiService>();
|
|
||||||
tokenService = Substitute.for<TokenService>();
|
|
||||||
appIdService = Substitute.for<AppIdService>();
|
|
||||||
platformUtilsService = Substitute.for<PlatformUtilsService>();
|
|
||||||
messagingService = Substitute.for<MessagingService>();
|
|
||||||
logService = Substitute.for<LogService>();
|
|
||||||
environmentService = Substitute.for<EnvironmentService>();
|
|
||||||
stateService = Substitute.for<StateService>();
|
|
||||||
keyConnectorService = Substitute.for<KeyConnectorService>();
|
|
||||||
twoFactorService = Substitute.for<TwoFactorService>();
|
|
||||||
|
|
||||||
appIdService.getAppId().resolves(deviceId);
|
|
||||||
tokenService.getTwoFactorToken().resolves(null);
|
|
||||||
|
|
||||||
apiLogInStrategy = new ApiLogInStrategy(
|
|
||||||
cryptoService,
|
|
||||||
apiService,
|
|
||||||
tokenService,
|
|
||||||
appIdService,
|
|
||||||
platformUtilsService,
|
|
||||||
messagingService,
|
|
||||||
logService,
|
|
||||||
stateService,
|
|
||||||
twoFactorService,
|
|
||||||
environmentService,
|
|
||||||
keyConnectorService
|
|
||||||
);
|
|
||||||
|
|
||||||
credentials = new ApiLogInCredentials(apiClientId, apiClientSecret);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("sends api key credentials to the server", async () => {
|
|
||||||
apiService.postIdentityToken(Arg.any()).resolves(identityTokenResponseFactory());
|
|
||||||
await apiLogInStrategy.logIn(credentials);
|
|
||||||
|
|
||||||
apiService.received(1).postIdentityToken(
|
|
||||||
Arg.is((actual) => {
|
|
||||||
const apiTokenRequest = actual as any;
|
|
||||||
return (
|
|
||||||
apiTokenRequest.clientId === apiClientId &&
|
|
||||||
apiTokenRequest.clientSecret === apiClientSecret &&
|
|
||||||
apiTokenRequest.device.identifier === deviceId &&
|
|
||||||
apiTokenRequest.twoFactor.provider == null &&
|
|
||||||
apiTokenRequest.twoFactor.token == null &&
|
|
||||||
apiTokenRequest.captchaResponse == null
|
|
||||||
);
|
|
||||||
})
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("sets the local environment after a successful login", async () => {
|
|
||||||
apiService.postIdentityToken(Arg.any()).resolves(identityTokenResponseFactory());
|
|
||||||
|
|
||||||
await apiLogInStrategy.logIn(credentials);
|
|
||||||
|
|
||||||
stateService.received(1).setApiKeyClientId(apiClientId);
|
|
||||||
stateService.received(1).setApiKeyClientSecret(apiClientSecret);
|
|
||||||
stateService.received(1).addAccount(Arg.any());
|
|
||||||
});
|
|
||||||
|
|
||||||
it("gets and sets the Key Connector key from environmentUrl", async () => {
|
|
||||||
const tokenResponse = identityTokenResponseFactory();
|
|
||||||
tokenResponse.apiUseKeyConnector = true;
|
|
||||||
|
|
||||||
apiService.postIdentityToken(Arg.any()).resolves(tokenResponse);
|
|
||||||
environmentService.getKeyConnectorUrl().returns(keyConnectorUrl);
|
|
||||||
|
|
||||||
await apiLogInStrategy.logIn(credentials);
|
|
||||||
|
|
||||||
keyConnectorService.received(1).getAndSetKey(keyConnectorUrl);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,288 +0,0 @@
|
|||||||
import { Arg, Substitute, SubstituteOf } from "@fluffy-spoon/substitute";
|
|
||||||
|
|
||||||
import { ApiService } from "@/jslib/common/src/abstractions/api.service";
|
|
||||||
import { AppIdService } from "@/jslib/common/src/abstractions/appId.service";
|
|
||||||
import { AuthService } from "@/jslib/common/src/abstractions/auth.service";
|
|
||||||
import { CryptoService } from "@/jslib/common/src/abstractions/crypto.service";
|
|
||||||
import { LogService } from "@/jslib/common/src/abstractions/log.service";
|
|
||||||
import { MessagingService } from "@/jslib/common/src/abstractions/messaging.service";
|
|
||||||
import { PlatformUtilsService } from "@/jslib/common/src/abstractions/platformUtils.service";
|
|
||||||
import { StateService } from "@/jslib/common/src/abstractions/state.service";
|
|
||||||
import { TokenService } from "@/jslib/common/src/abstractions/token.service";
|
|
||||||
import { TwoFactorService } from "@/jslib/common/src/abstractions/twoFactor.service";
|
|
||||||
import { TwoFactorProviderType } from "@/jslib/common/src/enums/twoFactorProviderType";
|
|
||||||
import { PasswordLogInStrategy } from "@/jslib/common/src/misc/logInStrategies/passwordLogin.strategy";
|
|
||||||
import { Utils } from "@/jslib/common/src/misc/utils";
|
|
||||||
import { Account, AccountProfile, AccountTokens } from "@/jslib/common/src/models/domain/account";
|
|
||||||
import { AuthResult } from "@/jslib/common/src/models/domain/authResult";
|
|
||||||
import { EncString } from "@/jslib/common/src/models/domain/encString";
|
|
||||||
import { PasswordLogInCredentials } from "@/jslib/common/src/models/domain/logInCredentials";
|
|
||||||
import { PasswordTokenRequest } from "@/jslib/common/src/models/request/identityToken/passwordTokenRequest";
|
|
||||||
import { TokenRequestTwoFactor } from "@/jslib/common/src/models/request/identityToken/tokenRequestTwoFactor";
|
|
||||||
import { IdentityCaptchaResponse } from "@/jslib/common/src/models/response/identityCaptchaResponse";
|
|
||||||
import { IdentityTokenResponse } from "@/jslib/common/src/models/response/identityTokenResponse";
|
|
||||||
import { IdentityTwoFactorResponse } from "@/jslib/common/src/models/response/identityTwoFactorResponse";
|
|
||||||
|
|
||||||
const email = "hello@world.com";
|
|
||||||
const masterPassword = "password";
|
|
||||||
|
|
||||||
const deviceId = Utils.newGuid();
|
|
||||||
const accessToken = "ACCESS_TOKEN";
|
|
||||||
const refreshToken = "REFRESH_TOKEN";
|
|
||||||
const encKey = "ENC_KEY";
|
|
||||||
const privateKey = "PRIVATE_KEY";
|
|
||||||
const captchaSiteKey = "CAPTCHA_SITE_KEY";
|
|
||||||
const kdf = 0;
|
|
||||||
const kdfIterations = 10000;
|
|
||||||
const userId = Utils.newGuid();
|
|
||||||
const masterPasswordHash = "MASTER_PASSWORD_HASH";
|
|
||||||
|
|
||||||
const decodedToken = {
|
|
||||||
sub: userId,
|
|
||||||
email: email,
|
|
||||||
premium: false,
|
|
||||||
};
|
|
||||||
|
|
||||||
const twoFactorProviderType = TwoFactorProviderType.Authenticator;
|
|
||||||
const twoFactorToken = "TWO_FACTOR_TOKEN";
|
|
||||||
const twoFactorRemember = true;
|
|
||||||
|
|
||||||
export function identityTokenResponseFactory() {
|
|
||||||
return new IdentityTokenResponse({
|
|
||||||
ForcePasswordReset: false,
|
|
||||||
Kdf: kdf,
|
|
||||||
KdfIterations: kdfIterations,
|
|
||||||
Key: encKey,
|
|
||||||
PrivateKey: privateKey,
|
|
||||||
ResetMasterPassword: false,
|
|
||||||
access_token: accessToken,
|
|
||||||
expires_in: 3600,
|
|
||||||
refresh_token: refreshToken,
|
|
||||||
scope: "api offline_access",
|
|
||||||
token_type: "Bearer",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
describe("LogInStrategy", () => {
|
|
||||||
let cryptoService: SubstituteOf<CryptoService>;
|
|
||||||
let apiService: SubstituteOf<ApiService>;
|
|
||||||
let tokenService: SubstituteOf<TokenService>;
|
|
||||||
let appIdService: SubstituteOf<AppIdService>;
|
|
||||||
let platformUtilsService: SubstituteOf<PlatformUtilsService>;
|
|
||||||
let messagingService: SubstituteOf<MessagingService>;
|
|
||||||
let logService: SubstituteOf<LogService>;
|
|
||||||
let stateService: SubstituteOf<StateService>;
|
|
||||||
let twoFactorService: SubstituteOf<TwoFactorService>;
|
|
||||||
let authService: SubstituteOf<AuthService>;
|
|
||||||
|
|
||||||
let passwordLogInStrategy: PasswordLogInStrategy;
|
|
||||||
let credentials: PasswordLogInCredentials;
|
|
||||||
|
|
||||||
beforeEach(async () => {
|
|
||||||
cryptoService = Substitute.for<CryptoService>();
|
|
||||||
apiService = Substitute.for<ApiService>();
|
|
||||||
tokenService = Substitute.for<TokenService>();
|
|
||||||
appIdService = Substitute.for<AppIdService>();
|
|
||||||
platformUtilsService = Substitute.for<PlatformUtilsService>();
|
|
||||||
messagingService = Substitute.for<MessagingService>();
|
|
||||||
logService = Substitute.for<LogService>();
|
|
||||||
stateService = Substitute.for<StateService>();
|
|
||||||
twoFactorService = Substitute.for<TwoFactorService>();
|
|
||||||
authService = Substitute.for<AuthService>();
|
|
||||||
|
|
||||||
appIdService.getAppId().resolves(deviceId);
|
|
||||||
|
|
||||||
// The base class is abstract so we test it via PasswordLogInStrategy
|
|
||||||
passwordLogInStrategy = new PasswordLogInStrategy(
|
|
||||||
cryptoService,
|
|
||||||
apiService,
|
|
||||||
tokenService,
|
|
||||||
appIdService,
|
|
||||||
platformUtilsService,
|
|
||||||
messagingService,
|
|
||||||
logService,
|
|
||||||
stateService,
|
|
||||||
twoFactorService,
|
|
||||||
authService
|
|
||||||
);
|
|
||||||
credentials = new PasswordLogInCredentials(email, masterPassword);
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("base class", () => {
|
|
||||||
it("sets the local environment after a successful login", async () => {
|
|
||||||
apiService.postIdentityToken(Arg.any()).resolves(identityTokenResponseFactory());
|
|
||||||
tokenService.decodeToken(accessToken).resolves(decodedToken);
|
|
||||||
|
|
||||||
await passwordLogInStrategy.logIn(credentials);
|
|
||||||
|
|
||||||
stateService.received(1).addAccount(
|
|
||||||
new Account({
|
|
||||||
profile: {
|
|
||||||
...new AccountProfile(),
|
|
||||||
...{
|
|
||||||
userId: userId,
|
|
||||||
email: email,
|
|
||||||
hasPremiumPersonally: false,
|
|
||||||
kdfIterations: kdfIterations,
|
|
||||||
kdfType: kdf,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
tokens: {
|
|
||||||
...new AccountTokens(),
|
|
||||||
...{
|
|
||||||
accessToken: accessToken,
|
|
||||||
refreshToken: refreshToken,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
);
|
|
||||||
cryptoService.received(1).setEncKey(encKey);
|
|
||||||
cryptoService.received(1).setEncPrivateKey(privateKey);
|
|
||||||
|
|
||||||
stateService.received(1).setBiometricLocked(false);
|
|
||||||
messagingService.received(1).send("loggedIn");
|
|
||||||
});
|
|
||||||
|
|
||||||
it("builds AuthResult", async () => {
|
|
||||||
const tokenResponse = identityTokenResponseFactory();
|
|
||||||
tokenResponse.forcePasswordReset = true;
|
|
||||||
tokenResponse.resetMasterPassword = true;
|
|
||||||
|
|
||||||
apiService.postIdentityToken(Arg.any()).resolves(tokenResponse);
|
|
||||||
|
|
||||||
const result = await passwordLogInStrategy.logIn(credentials);
|
|
||||||
|
|
||||||
const expected = new AuthResult();
|
|
||||||
expected.forcePasswordReset = true;
|
|
||||||
expected.resetMasterPassword = true;
|
|
||||||
expected.twoFactorProviders = null;
|
|
||||||
expected.captchaSiteKey = "";
|
|
||||||
expect(result).toEqual(expected);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("rejects login if CAPTCHA is required", async () => {
|
|
||||||
// Sample CAPTCHA response
|
|
||||||
const tokenResponse = new IdentityCaptchaResponse({
|
|
||||||
error: "invalid_grant",
|
|
||||||
error_description: "Captcha required.",
|
|
||||||
HCaptcha_SiteKey: captchaSiteKey,
|
|
||||||
});
|
|
||||||
|
|
||||||
apiService.postIdentityToken(Arg.any()).resolves(tokenResponse);
|
|
||||||
|
|
||||||
const result = await passwordLogInStrategy.logIn(credentials);
|
|
||||||
|
|
||||||
stateService.didNotReceive().addAccount(Arg.any());
|
|
||||||
messagingService.didNotReceive().send(Arg.any());
|
|
||||||
|
|
||||||
const expected = new AuthResult();
|
|
||||||
expected.captchaSiteKey = captchaSiteKey;
|
|
||||||
expect(result).toEqual(expected);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("makes a new public and private key for an old account", async () => {
|
|
||||||
const tokenResponse = identityTokenResponseFactory();
|
|
||||||
tokenResponse.privateKey = null;
|
|
||||||
cryptoService.makeKeyPair(Arg.any()).resolves(["PUBLIC_KEY", new EncString("PRIVATE_KEY")]);
|
|
||||||
|
|
||||||
apiService.postIdentityToken(Arg.any()).resolves(tokenResponse);
|
|
||||||
|
|
||||||
await passwordLogInStrategy.logIn(credentials);
|
|
||||||
|
|
||||||
apiService.received(1).postAccountKeys(Arg.any());
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe("Two-factor authentication", () => {
|
|
||||||
it("rejects login if 2FA is required", async () => {
|
|
||||||
// Sample response where TOTP 2FA required
|
|
||||||
const tokenResponse = new IdentityTwoFactorResponse({
|
|
||||||
TwoFactorProviders: ["0"],
|
|
||||||
TwoFactorProviders2: { 0: null },
|
|
||||||
error: "invalid_grant",
|
|
||||||
error_description: "Two factor required.",
|
|
||||||
});
|
|
||||||
|
|
||||||
apiService.postIdentityToken(Arg.any()).resolves(tokenResponse);
|
|
||||||
|
|
||||||
const result = await passwordLogInStrategy.logIn(credentials);
|
|
||||||
|
|
||||||
stateService.didNotReceive().addAccount(Arg.any());
|
|
||||||
messagingService.didNotReceive().send(Arg.any());
|
|
||||||
|
|
||||||
const expected = new AuthResult();
|
|
||||||
expected.twoFactorProviders = new Map<TwoFactorProviderType, { [key: string]: string }>();
|
|
||||||
expected.twoFactorProviders.set(0, null);
|
|
||||||
expect(result).toEqual(expected);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("sends stored 2FA token to server", async () => {
|
|
||||||
tokenService.getTwoFactorToken().resolves(twoFactorToken);
|
|
||||||
apiService.postIdentityToken(Arg.any()).resolves(identityTokenResponseFactory());
|
|
||||||
|
|
||||||
await passwordLogInStrategy.logIn(credentials);
|
|
||||||
|
|
||||||
apiService.received(1).postIdentityToken(
|
|
||||||
Arg.is((actual) => {
|
|
||||||
const passwordTokenRequest = actual as any;
|
|
||||||
return (
|
|
||||||
passwordTokenRequest.twoFactor.provider === TwoFactorProviderType.Remember &&
|
|
||||||
passwordTokenRequest.twoFactor.token === twoFactorToken &&
|
|
||||||
passwordTokenRequest.twoFactor.remember === false
|
|
||||||
);
|
|
||||||
})
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("sends 2FA token provided by user to server (single step)", async () => {
|
|
||||||
// This occurs if the user enters the 2FA code as an argument in the CLI
|
|
||||||
apiService.postIdentityToken(Arg.any()).resolves(identityTokenResponseFactory());
|
|
||||||
credentials.twoFactor = new TokenRequestTwoFactor(
|
|
||||||
twoFactorProviderType,
|
|
||||||
twoFactorToken,
|
|
||||||
twoFactorRemember
|
|
||||||
);
|
|
||||||
|
|
||||||
await passwordLogInStrategy.logIn(credentials);
|
|
||||||
|
|
||||||
apiService.received(1).postIdentityToken(
|
|
||||||
Arg.is((actual) => {
|
|
||||||
const passwordTokenRequest = actual as any;
|
|
||||||
return (
|
|
||||||
passwordTokenRequest.twoFactor.provider === twoFactorProviderType &&
|
|
||||||
passwordTokenRequest.twoFactor.token === twoFactorToken &&
|
|
||||||
passwordTokenRequest.twoFactor.remember === twoFactorRemember
|
|
||||||
);
|
|
||||||
})
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("sends 2FA token provided by user to server (two-step)", async () => {
|
|
||||||
// Simulate a partially completed login
|
|
||||||
passwordLogInStrategy.tokenRequest = new PasswordTokenRequest(
|
|
||||||
email,
|
|
||||||
masterPasswordHash,
|
|
||||||
null,
|
|
||||||
null
|
|
||||||
);
|
|
||||||
|
|
||||||
apiService.postIdentityToken(Arg.any()).resolves(identityTokenResponseFactory());
|
|
||||||
|
|
||||||
await passwordLogInStrategy.logInTwoFactor(
|
|
||||||
new TokenRequestTwoFactor(twoFactorProviderType, twoFactorToken, twoFactorRemember),
|
|
||||||
null
|
|
||||||
);
|
|
||||||
|
|
||||||
apiService.received(1).postIdentityToken(
|
|
||||||
Arg.is((actual) => {
|
|
||||||
const passwordTokenRequest = actual as any;
|
|
||||||
return (
|
|
||||||
passwordTokenRequest.twoFactor.provider === twoFactorProviderType &&
|
|
||||||
passwordTokenRequest.twoFactor.token === twoFactorToken &&
|
|
||||||
passwordTokenRequest.twoFactor.remember === twoFactorRemember
|
|
||||||
);
|
|
||||||
})
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,110 +0,0 @@
|
|||||||
import { Arg, Substitute, SubstituteOf } from "@fluffy-spoon/substitute";
|
|
||||||
|
|
||||||
import { ApiService } from "@/jslib/common/src/abstractions/api.service";
|
|
||||||
import { AppIdService } from "@/jslib/common/src/abstractions/appId.service";
|
|
||||||
import { AuthService } from "@/jslib/common/src/abstractions/auth.service";
|
|
||||||
import { CryptoService } from "@/jslib/common/src/abstractions/crypto.service";
|
|
||||||
import { LogService } from "@/jslib/common/src/abstractions/log.service";
|
|
||||||
import { MessagingService } from "@/jslib/common/src/abstractions/messaging.service";
|
|
||||||
import { PlatformUtilsService } from "@/jslib/common/src/abstractions/platformUtils.service";
|
|
||||||
import { StateService } from "@/jslib/common/src/abstractions/state.service";
|
|
||||||
import { TokenService } from "@/jslib/common/src/abstractions/token.service";
|
|
||||||
import { TwoFactorService } from "@/jslib/common/src/abstractions/twoFactor.service";
|
|
||||||
import { HashPurpose } from "@/jslib/common/src/enums/hashPurpose";
|
|
||||||
import { PasswordLogInStrategy } from "@/jslib/common/src/misc/logInStrategies/passwordLogin.strategy";
|
|
||||||
import { Utils } from "@/jslib/common/src/misc/utils";
|
|
||||||
import { PasswordLogInCredentials } from "@/jslib/common/src/models/domain/logInCredentials";
|
|
||||||
import { SymmetricCryptoKey } from "@/jslib/common/src/models/domain/symmetricCryptoKey";
|
|
||||||
|
|
||||||
import { identityTokenResponseFactory } from "./logIn.strategy.spec";
|
|
||||||
|
|
||||||
const email = "hello@world.com";
|
|
||||||
const masterPassword = "password";
|
|
||||||
const hashedPassword = "HASHED_PASSWORD";
|
|
||||||
const localHashedPassword = "LOCAL_HASHED_PASSWORD";
|
|
||||||
const preloginKey = new SymmetricCryptoKey(
|
|
||||||
Utils.fromB64ToArray(
|
|
||||||
"N2KWjlLpfi5uHjv+YcfUKIpZ1l+W+6HRensmIqD+BFYBf6N/dvFpJfWwYnVBdgFCK2tJTAIMLhqzIQQEUmGFgg=="
|
|
||||||
)
|
|
||||||
);
|
|
||||||
const deviceId = Utils.newGuid();
|
|
||||||
|
|
||||||
describe("PasswordLogInStrategy", () => {
|
|
||||||
let cryptoService: SubstituteOf<CryptoService>;
|
|
||||||
let apiService: SubstituteOf<ApiService>;
|
|
||||||
let tokenService: SubstituteOf<TokenService>;
|
|
||||||
let appIdService: SubstituteOf<AppIdService>;
|
|
||||||
let platformUtilsService: SubstituteOf<PlatformUtilsService>;
|
|
||||||
let messagingService: SubstituteOf<MessagingService>;
|
|
||||||
let logService: SubstituteOf<LogService>;
|
|
||||||
let stateService: SubstituteOf<StateService>;
|
|
||||||
let twoFactorService: SubstituteOf<TwoFactorService>;
|
|
||||||
let authService: SubstituteOf<AuthService>;
|
|
||||||
|
|
||||||
let passwordLogInStrategy: PasswordLogInStrategy;
|
|
||||||
let credentials: PasswordLogInCredentials;
|
|
||||||
|
|
||||||
beforeEach(async () => {
|
|
||||||
cryptoService = Substitute.for<CryptoService>();
|
|
||||||
apiService = Substitute.for<ApiService>();
|
|
||||||
tokenService = Substitute.for<TokenService>();
|
|
||||||
appIdService = Substitute.for<AppIdService>();
|
|
||||||
platformUtilsService = Substitute.for<PlatformUtilsService>();
|
|
||||||
messagingService = Substitute.for<MessagingService>();
|
|
||||||
logService = Substitute.for<LogService>();
|
|
||||||
stateService = Substitute.for<StateService>();
|
|
||||||
twoFactorService = Substitute.for<TwoFactorService>();
|
|
||||||
authService = Substitute.for<AuthService>();
|
|
||||||
|
|
||||||
appIdService.getAppId().resolves(deviceId);
|
|
||||||
tokenService.getTwoFactorToken().resolves(null);
|
|
||||||
|
|
||||||
authService.makePreloginKey(Arg.any(), Arg.any()).resolves(preloginKey);
|
|
||||||
|
|
||||||
cryptoService.hashPassword(masterPassword, Arg.any()).resolves(hashedPassword);
|
|
||||||
cryptoService
|
|
||||||
.hashPassword(masterPassword, Arg.any(), HashPurpose.LocalAuthorization)
|
|
||||||
.resolves(localHashedPassword);
|
|
||||||
|
|
||||||
passwordLogInStrategy = new PasswordLogInStrategy(
|
|
||||||
cryptoService,
|
|
||||||
apiService,
|
|
||||||
tokenService,
|
|
||||||
appIdService,
|
|
||||||
platformUtilsService,
|
|
||||||
messagingService,
|
|
||||||
logService,
|
|
||||||
stateService,
|
|
||||||
twoFactorService,
|
|
||||||
authService
|
|
||||||
);
|
|
||||||
credentials = new PasswordLogInCredentials(email, masterPassword);
|
|
||||||
|
|
||||||
apiService.postIdentityToken(Arg.any()).resolves(identityTokenResponseFactory());
|
|
||||||
});
|
|
||||||
|
|
||||||
it("sends master password credentials to the server", async () => {
|
|
||||||
await passwordLogInStrategy.logIn(credentials);
|
|
||||||
|
|
||||||
apiService.received(1).postIdentityToken(
|
|
||||||
Arg.is((actual) => {
|
|
||||||
const passwordTokenRequest = actual as any; // Need to access private fields
|
|
||||||
return (
|
|
||||||
passwordTokenRequest.email === email &&
|
|
||||||
passwordTokenRequest.masterPasswordHash === hashedPassword &&
|
|
||||||
passwordTokenRequest.device.identifier === deviceId &&
|
|
||||||
passwordTokenRequest.twoFactor.provider == null &&
|
|
||||||
passwordTokenRequest.twoFactor.token == null &&
|
|
||||||
passwordTokenRequest.captchaResponse == null
|
|
||||||
);
|
|
||||||
})
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("sets the local environment after a successful login", async () => {
|
|
||||||
await passwordLogInStrategy.logIn(credentials);
|
|
||||||
|
|
||||||
cryptoService.received(1).setKey(preloginKey);
|
|
||||||
cryptoService.received(1).setKeyHash(localHashedPassword);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,127 +0,0 @@
|
|||||||
import { Arg, Substitute, SubstituteOf } from "@fluffy-spoon/substitute";
|
|
||||||
|
|
||||||
import { ApiService } from "@/jslib/common/src/abstractions/api.service";
|
|
||||||
import { AppIdService } from "@/jslib/common/src/abstractions/appId.service";
|
|
||||||
import { CryptoService } from "@/jslib/common/src/abstractions/crypto.service";
|
|
||||||
import { KeyConnectorService } from "@/jslib/common/src/abstractions/keyConnector.service";
|
|
||||||
import { LogService } from "@/jslib/common/src/abstractions/log.service";
|
|
||||||
import { MessagingService } from "@/jslib/common/src/abstractions/messaging.service";
|
|
||||||
import { PlatformUtilsService } from "@/jslib/common/src/abstractions/platformUtils.service";
|
|
||||||
import { StateService } from "@/jslib/common/src/abstractions/state.service";
|
|
||||||
import { TokenService } from "@/jslib/common/src/abstractions/token.service";
|
|
||||||
import { TwoFactorService } from "@/jslib/common/src/abstractions/twoFactor.service";
|
|
||||||
import { SsoLogInStrategy } from "@/jslib/common/src/misc/logInStrategies/ssoLogin.strategy";
|
|
||||||
import { Utils } from "@/jslib/common/src/misc/utils";
|
|
||||||
import { SsoLogInCredentials } from "@/jslib/common/src/models/domain/logInCredentials";
|
|
||||||
|
|
||||||
import { identityTokenResponseFactory } from "./logIn.strategy.spec";
|
|
||||||
|
|
||||||
describe("SsoLogInStrategy", () => {
|
|
||||||
let cryptoService: SubstituteOf<CryptoService>;
|
|
||||||
let apiService: SubstituteOf<ApiService>;
|
|
||||||
let tokenService: SubstituteOf<TokenService>;
|
|
||||||
let appIdService: SubstituteOf<AppIdService>;
|
|
||||||
let platformUtilsService: SubstituteOf<PlatformUtilsService>;
|
|
||||||
let messagingService: SubstituteOf<MessagingService>;
|
|
||||||
let logService: SubstituteOf<LogService>;
|
|
||||||
let keyConnectorService: SubstituteOf<KeyConnectorService>;
|
|
||||||
let stateService: SubstituteOf<StateService>;
|
|
||||||
let twoFactorService: SubstituteOf<TwoFactorService>;
|
|
||||||
|
|
||||||
let ssoLogInStrategy: SsoLogInStrategy;
|
|
||||||
let credentials: SsoLogInCredentials;
|
|
||||||
|
|
||||||
const deviceId = Utils.newGuid();
|
|
||||||
const encKey = "ENC_KEY";
|
|
||||||
const privateKey = "PRIVATE_KEY";
|
|
||||||
const keyConnectorUrl = "KEY_CONNECTOR_URL";
|
|
||||||
|
|
||||||
const ssoCode = "SSO_CODE";
|
|
||||||
const ssoCodeVerifier = "SSO_CODE_VERIFIER";
|
|
||||||
const ssoRedirectUrl = "SSO_REDIRECT_URL";
|
|
||||||
const ssoOrgId = "SSO_ORG_ID";
|
|
||||||
|
|
||||||
beforeEach(async () => {
|
|
||||||
cryptoService = Substitute.for<CryptoService>();
|
|
||||||
apiService = Substitute.for<ApiService>();
|
|
||||||
tokenService = Substitute.for<TokenService>();
|
|
||||||
appIdService = Substitute.for<AppIdService>();
|
|
||||||
platformUtilsService = Substitute.for<PlatformUtilsService>();
|
|
||||||
messagingService = Substitute.for<MessagingService>();
|
|
||||||
logService = Substitute.for<LogService>();
|
|
||||||
stateService = Substitute.for<StateService>();
|
|
||||||
keyConnectorService = Substitute.for<KeyConnectorService>();
|
|
||||||
twoFactorService = Substitute.for<TwoFactorService>();
|
|
||||||
|
|
||||||
tokenService.getTwoFactorToken().resolves(null);
|
|
||||||
appIdService.getAppId().resolves(deviceId);
|
|
||||||
|
|
||||||
ssoLogInStrategy = new SsoLogInStrategy(
|
|
||||||
cryptoService,
|
|
||||||
apiService,
|
|
||||||
tokenService,
|
|
||||||
appIdService,
|
|
||||||
platformUtilsService,
|
|
||||||
messagingService,
|
|
||||||
logService,
|
|
||||||
stateService,
|
|
||||||
twoFactorService,
|
|
||||||
keyConnectorService
|
|
||||||
);
|
|
||||||
credentials = new SsoLogInCredentials(ssoCode, ssoCodeVerifier, ssoRedirectUrl, ssoOrgId);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("sends SSO information to server", async () => {
|
|
||||||
apiService.postIdentityToken(Arg.any()).resolves(identityTokenResponseFactory());
|
|
||||||
|
|
||||||
await ssoLogInStrategy.logIn(credentials);
|
|
||||||
|
|
||||||
apiService.received(1).postIdentityToken(
|
|
||||||
Arg.is((actual) => {
|
|
||||||
const ssoTokenRequest = actual as any;
|
|
||||||
return (
|
|
||||||
ssoTokenRequest.code === ssoCode &&
|
|
||||||
ssoTokenRequest.codeVerifier === ssoCodeVerifier &&
|
|
||||||
ssoTokenRequest.redirectUri === ssoRedirectUrl &&
|
|
||||||
ssoTokenRequest.device.identifier === deviceId &&
|
|
||||||
ssoTokenRequest.twoFactor.provider == null &&
|
|
||||||
ssoTokenRequest.twoFactor.token == null
|
|
||||||
);
|
|
||||||
})
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("does not set keys for new SSO user flow", async () => {
|
|
||||||
const tokenResponse = identityTokenResponseFactory();
|
|
||||||
tokenResponse.key = null;
|
|
||||||
apiService.postIdentityToken(Arg.any()).resolves(tokenResponse);
|
|
||||||
|
|
||||||
await ssoLogInStrategy.logIn(credentials);
|
|
||||||
|
|
||||||
cryptoService.didNotReceive().setEncPrivateKey(privateKey);
|
|
||||||
cryptoService.didNotReceive().setEncKey(encKey);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("gets and sets KeyConnector key for enrolled user", async () => {
|
|
||||||
const tokenResponse = identityTokenResponseFactory();
|
|
||||||
tokenResponse.keyConnectorUrl = keyConnectorUrl;
|
|
||||||
|
|
||||||
apiService.postIdentityToken(Arg.any()).resolves(tokenResponse);
|
|
||||||
|
|
||||||
await ssoLogInStrategy.logIn(credentials);
|
|
||||||
|
|
||||||
keyConnectorService.received(1).getAndSetKey(keyConnectorUrl);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("converts new SSO user to Key Connector on first login", async () => {
|
|
||||||
const tokenResponse = identityTokenResponseFactory();
|
|
||||||
tokenResponse.keyConnectorUrl = keyConnectorUrl;
|
|
||||||
tokenResponse.key = null;
|
|
||||||
|
|
||||||
apiService.postIdentityToken(Arg.any()).resolves(tokenResponse);
|
|
||||||
|
|
||||||
await ssoLogInStrategy.logIn(credentials);
|
|
||||||
|
|
||||||
keyConnectorService.received(1).convertNewSsoUserToKeyConnector(tokenResponse, ssoOrgId);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,69 +0,0 @@
|
|||||||
import { Arg, Substitute, SubstituteOf } from "@fluffy-spoon/substitute";
|
|
||||||
|
|
||||||
import { ApiService } from "@/jslib/common/src/abstractions/api.service";
|
|
||||||
import { CryptoService } from "@/jslib/common/src/abstractions/crypto.service";
|
|
||||||
import { FileUploadService } from "@/jslib/common/src/abstractions/fileUpload.service";
|
|
||||||
import { I18nService } from "@/jslib/common/src/abstractions/i18n.service";
|
|
||||||
import { LogService } from "@/jslib/common/src/abstractions/log.service";
|
|
||||||
import { SearchService } from "@/jslib/common/src/abstractions/search.service";
|
|
||||||
import { SettingsService } from "@/jslib/common/src/abstractions/settings.service";
|
|
||||||
import { StateService } from "@/jslib/common/src/abstractions/state.service";
|
|
||||||
import { Utils } from "@/jslib/common/src/misc/utils";
|
|
||||||
import { Cipher } from "@/jslib/common/src/models/domain/cipher";
|
|
||||||
import { EncArrayBuffer } from "@/jslib/common/src/models/domain/encArrayBuffer";
|
|
||||||
import { EncString } from "@/jslib/common/src/models/domain/encString";
|
|
||||||
import { SymmetricCryptoKey } from "@/jslib/common/src/models/domain/symmetricCryptoKey";
|
|
||||||
import { CipherService } from "@/jslib/common/src/services/cipher.service";
|
|
||||||
|
|
||||||
const ENCRYPTED_TEXT = "This data has been encrypted";
|
|
||||||
const ENCRYPTED_BYTES = new EncArrayBuffer(Utils.fromUtf8ToArray(ENCRYPTED_TEXT).buffer);
|
|
||||||
|
|
||||||
describe("Cipher Service", () => {
|
|
||||||
let cryptoService: SubstituteOf<CryptoService>;
|
|
||||||
let stateService: SubstituteOf<StateService>;
|
|
||||||
let settingsService: SubstituteOf<SettingsService>;
|
|
||||||
let apiService: SubstituteOf<ApiService>;
|
|
||||||
let fileUploadService: SubstituteOf<FileUploadService>;
|
|
||||||
let i18nService: SubstituteOf<I18nService>;
|
|
||||||
let searchService: SubstituteOf<SearchService>;
|
|
||||||
let logService: SubstituteOf<LogService>;
|
|
||||||
|
|
||||||
let cipherService: CipherService;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
cryptoService = Substitute.for<CryptoService>();
|
|
||||||
stateService = Substitute.for<StateService>();
|
|
||||||
settingsService = Substitute.for<SettingsService>();
|
|
||||||
apiService = Substitute.for<ApiService>();
|
|
||||||
fileUploadService = Substitute.for<FileUploadService>();
|
|
||||||
i18nService = Substitute.for<I18nService>();
|
|
||||||
searchService = Substitute.for<SearchService>();
|
|
||||||
logService = Substitute.for<LogService>();
|
|
||||||
|
|
||||||
cryptoService.encryptToBytes(Arg.any(), Arg.any()).resolves(ENCRYPTED_BYTES);
|
|
||||||
cryptoService.encrypt(Arg.any(), Arg.any()).resolves(new EncString(ENCRYPTED_TEXT));
|
|
||||||
|
|
||||||
cipherService = new CipherService(
|
|
||||||
cryptoService,
|
|
||||||
settingsService,
|
|
||||||
apiService,
|
|
||||||
fileUploadService,
|
|
||||||
i18nService,
|
|
||||||
() => searchService,
|
|
||||||
logService,
|
|
||||||
stateService
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("attachments upload encrypted file contents", async () => {
|
|
||||||
const fileName = "filename";
|
|
||||||
const fileData = new Uint8Array(10).buffer;
|
|
||||||
cryptoService.getOrgKey(Arg.any()).resolves(new SymmetricCryptoKey(new Uint8Array(32).buffer));
|
|
||||||
|
|
||||||
await cipherService.saveAttachmentRawWithServer(new Cipher(), fileName, fileData);
|
|
||||||
|
|
||||||
fileUploadService
|
|
||||||
.received(1)
|
|
||||||
.uploadCipherAttachment(Arg.any(), Arg.any(), new EncString(ENCRYPTED_TEXT), ENCRYPTED_BYTES);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -24,7 +24,7 @@ describe("State Migration Service", () => {
|
|||||||
stateMigrationService = new StateMigrationService(
|
stateMigrationService = new StateMigrationService(
|
||||||
storageService,
|
storageService,
|
||||||
secureStorageService,
|
secureStorageService,
|
||||||
stateFactory
|
stateFactory,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@ describe("State Migration Service", () => {
|
|||||||
storageService.received(1).save(
|
storageService.received(1).save(
|
||||||
"global",
|
"global",
|
||||||
Arg.is((globals: GlobalState) => globals.stateVersion === StateVersion.Four),
|
Arg.is((globals: GlobalState) => globals.stateVersion === StateVersion.Four),
|
||||||
Arg.any()
|
Arg.any(),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ export function GetUniqueString(prefix = "") {
|
|||||||
|
|
||||||
export function BuildTestObject<T, K extends keyof T = keyof T>(
|
export function BuildTestObject<T, K extends keyof T = keyof T>(
|
||||||
def: Partial<Pick<T, K>> | T,
|
def: Partial<Pick<T, K>> | T,
|
||||||
constructor?: new () => T
|
constructor?: new () => T,
|
||||||
): T {
|
): T {
|
||||||
return Object.assign(constructor === null ? {} : new constructor(), def) as T;
|
return Object.assign(constructor === null ? {} : new constructor(), def) as T;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,679 +1,14 @@
|
|||||||
import { PolicyType } from "../enums/policyType";
|
|
||||||
import { SetKeyConnectorKeyRequest } from "../models/request/account/setKeyConnectorKeyRequest";
|
|
||||||
import { VerifyOTPRequest } from "../models/request/account/verifyOTPRequest";
|
|
||||||
import { AttachmentRequest } from "../models/request/attachmentRequest";
|
|
||||||
import { BitPayInvoiceRequest } from "../models/request/bitPayInvoiceRequest";
|
|
||||||
import { CipherBulkDeleteRequest } from "../models/request/cipherBulkDeleteRequest";
|
|
||||||
import { CipherBulkMoveRequest } from "../models/request/cipherBulkMoveRequest";
|
|
||||||
import { CipherBulkRestoreRequest } from "../models/request/cipherBulkRestoreRequest";
|
|
||||||
import { CipherBulkShareRequest } from "../models/request/cipherBulkShareRequest";
|
|
||||||
import { CipherCollectionsRequest } from "../models/request/cipherCollectionsRequest";
|
|
||||||
import { CipherCreateRequest } from "../models/request/cipherCreateRequest";
|
|
||||||
import { CipherRequest } from "../models/request/cipherRequest";
|
|
||||||
import { CipherShareRequest } from "../models/request/cipherShareRequest";
|
|
||||||
import { CollectionRequest } from "../models/request/collectionRequest";
|
|
||||||
import { DeleteRecoverRequest } from "../models/request/deleteRecoverRequest";
|
|
||||||
import { EmailRequest } from "../models/request/emailRequest";
|
|
||||||
import { EmailTokenRequest } from "../models/request/emailTokenRequest";
|
|
||||||
import { EmergencyAccessAcceptRequest } from "../models/request/emergencyAccessAcceptRequest";
|
|
||||||
import { EmergencyAccessConfirmRequest } from "../models/request/emergencyAccessConfirmRequest";
|
|
||||||
import { EmergencyAccessInviteRequest } from "../models/request/emergencyAccessInviteRequest";
|
|
||||||
import { EmergencyAccessPasswordRequest } from "../models/request/emergencyAccessPasswordRequest";
|
|
||||||
import { EmergencyAccessUpdateRequest } from "../models/request/emergencyAccessUpdateRequest";
|
|
||||||
import { EventRequest } from "../models/request/eventRequest";
|
|
||||||
import { FolderRequest } from "../models/request/folderRequest";
|
|
||||||
import { GroupRequest } from "../models/request/groupRequest";
|
|
||||||
import { IapCheckRequest } from "../models/request/iapCheckRequest";
|
|
||||||
import { ApiTokenRequest } from "../models/request/identityToken/apiTokenRequest";
|
import { ApiTokenRequest } from "../models/request/identityToken/apiTokenRequest";
|
||||||
import { PasswordTokenRequest } from "../models/request/identityToken/passwordTokenRequest";
|
import { PasswordTokenRequest } from "../models/request/identityToken/passwordTokenRequest";
|
||||||
import { SsoTokenRequest } from "../models/request/identityToken/ssoTokenRequest";
|
import { SsoTokenRequest } from "../models/request/identityToken/ssoTokenRequest";
|
||||||
import { ImportCiphersRequest } from "../models/request/importCiphersRequest";
|
|
||||||
import { ImportDirectoryRequest } from "../models/request/importDirectoryRequest";
|
|
||||||
import { ImportOrganizationCiphersRequest } from "../models/request/importOrganizationCiphersRequest";
|
|
||||||
import { KdfRequest } from "../models/request/kdfRequest";
|
|
||||||
import { KeyConnectorUserKeyRequest } from "../models/request/keyConnectorUserKeyRequest";
|
|
||||||
import { KeysRequest } from "../models/request/keysRequest";
|
|
||||||
import { OrganizationSponsorshipCreateRequest } from "../models/request/organization/organizationSponsorshipCreateRequest";
|
|
||||||
import { OrganizationSponsorshipRedeemRequest } from "../models/request/organization/organizationSponsorshipRedeemRequest";
|
|
||||||
import { OrganizationSsoRequest } from "../models/request/organization/organizationSsoRequest";
|
|
||||||
import { OrganizationCreateRequest } from "../models/request/organizationCreateRequest";
|
|
||||||
import { OrganizationImportRequest } from "../models/request/organizationImportRequest";
|
import { OrganizationImportRequest } from "../models/request/organizationImportRequest";
|
||||||
import { OrganizationKeysRequest } from "../models/request/organizationKeysRequest";
|
|
||||||
import { OrganizationSubscriptionUpdateRequest } from "../models/request/organizationSubscriptionUpdateRequest";
|
|
||||||
import { OrganizationTaxInfoUpdateRequest } from "../models/request/organizationTaxInfoUpdateRequest";
|
|
||||||
import { OrganizationUpdateRequest } from "../models/request/organizationUpdateRequest";
|
|
||||||
import { OrganizationUpgradeRequest } from "../models/request/organizationUpgradeRequest";
|
|
||||||
import { OrganizationUserAcceptRequest } from "../models/request/organizationUserAcceptRequest";
|
|
||||||
import { OrganizationUserBulkConfirmRequest } from "../models/request/organizationUserBulkConfirmRequest";
|
|
||||||
import { OrganizationUserBulkRequest } from "../models/request/organizationUserBulkRequest";
|
|
||||||
import { OrganizationUserConfirmRequest } from "../models/request/organizationUserConfirmRequest";
|
|
||||||
import { OrganizationUserInviteRequest } from "../models/request/organizationUserInviteRequest";
|
|
||||||
import { OrganizationUserResetPasswordEnrollmentRequest } from "../models/request/organizationUserResetPasswordEnrollmentRequest";
|
|
||||||
import { OrganizationUserResetPasswordRequest } from "../models/request/organizationUserResetPasswordRequest";
|
|
||||||
import { OrganizationUserUpdateGroupsRequest } from "../models/request/organizationUserUpdateGroupsRequest";
|
|
||||||
import { OrganizationUserUpdateRequest } from "../models/request/organizationUserUpdateRequest";
|
|
||||||
import { PasswordHintRequest } from "../models/request/passwordHintRequest";
|
|
||||||
import { PasswordRequest } from "../models/request/passwordRequest";
|
|
||||||
import { PaymentRequest } from "../models/request/paymentRequest";
|
|
||||||
import { PolicyRequest } from "../models/request/policyRequest";
|
|
||||||
import { PreloginRequest } from "../models/request/preloginRequest";
|
|
||||||
import { ProviderAddOrganizationRequest } from "../models/request/provider/providerAddOrganizationRequest";
|
|
||||||
import { ProviderOrganizationCreateRequest } from "../models/request/provider/providerOrganizationCreateRequest";
|
|
||||||
import { ProviderSetupRequest } from "../models/request/provider/providerSetupRequest";
|
|
||||||
import { ProviderUpdateRequest } from "../models/request/provider/providerUpdateRequest";
|
|
||||||
import { ProviderUserAcceptRequest } from "../models/request/provider/providerUserAcceptRequest";
|
|
||||||
import { ProviderUserBulkConfirmRequest } from "../models/request/provider/providerUserBulkConfirmRequest";
|
|
||||||
import { ProviderUserBulkRequest } from "../models/request/provider/providerUserBulkRequest";
|
|
||||||
import { ProviderUserConfirmRequest } from "../models/request/provider/providerUserConfirmRequest";
|
|
||||||
import { ProviderUserInviteRequest } from "../models/request/provider/providerUserInviteRequest";
|
|
||||||
import { ProviderUserUpdateRequest } from "../models/request/provider/providerUserUpdateRequest";
|
|
||||||
import { RegisterRequest } from "../models/request/registerRequest";
|
|
||||||
import { SeatRequest } from "../models/request/seatRequest";
|
|
||||||
import { SecretVerificationRequest } from "../models/request/secretVerificationRequest";
|
|
||||||
import { SelectionReadOnlyRequest } from "../models/request/selectionReadOnlyRequest";
|
|
||||||
import { SendAccessRequest } from "../models/request/sendAccessRequest";
|
|
||||||
import { SendRequest } from "../models/request/sendRequest";
|
|
||||||
import { SetPasswordRequest } from "../models/request/setPasswordRequest";
|
|
||||||
import { StorageRequest } from "../models/request/storageRequest";
|
|
||||||
import { TaxInfoUpdateRequest } from "../models/request/taxInfoUpdateRequest";
|
|
||||||
import { TwoFactorEmailRequest } from "../models/request/twoFactorEmailRequest";
|
|
||||||
import { TwoFactorProviderRequest } from "../models/request/twoFactorProviderRequest";
|
|
||||||
import { TwoFactorRecoveryRequest } from "../models/request/twoFactorRecoveryRequest";
|
|
||||||
import { UpdateDomainsRequest } from "../models/request/updateDomainsRequest";
|
|
||||||
import { UpdateKeyRequest } from "../models/request/updateKeyRequest";
|
|
||||||
import { UpdateProfileRequest } from "../models/request/updateProfileRequest";
|
|
||||||
import { UpdateTempPasswordRequest } from "../models/request/updateTempPasswordRequest";
|
|
||||||
import { UpdateTwoFactorAuthenticatorRequest } from "../models/request/updateTwoFactorAuthenticatorRequest";
|
|
||||||
import { UpdateTwoFactorDuoRequest } from "../models/request/updateTwoFactorDuoRequest";
|
|
||||||
import { UpdateTwoFactorEmailRequest } from "../models/request/updateTwoFactorEmailRequest";
|
|
||||||
import { UpdateTwoFactorWebAuthnDeleteRequest } from "../models/request/updateTwoFactorWebAuthnDeleteRequest";
|
|
||||||
import { UpdateTwoFactorWebAuthnRequest } from "../models/request/updateTwoFactorWebAuthnRequest";
|
|
||||||
import { UpdateTwoFactorYubioOtpRequest } from "../models/request/updateTwoFactorYubioOtpRequest";
|
|
||||||
import { VerifyBankRequest } from "../models/request/verifyBankRequest";
|
|
||||||
import { VerifyDeleteRecoverRequest } from "../models/request/verifyDeleteRecoverRequest";
|
|
||||||
import { VerifyEmailRequest } from "../models/request/verifyEmailRequest";
|
|
||||||
import { ApiKeyResponse } from "../models/response/apiKeyResponse";
|
|
||||||
import { AttachmentResponse } from "../models/response/attachmentResponse";
|
|
||||||
import { AttachmentUploadDataResponse } from "../models/response/attachmentUploadDataResponse";
|
|
||||||
import { BillingResponse } from "../models/response/billingResponse";
|
|
||||||
import { BreachAccountResponse } from "../models/response/breachAccountResponse";
|
|
||||||
import { CipherResponse } from "../models/response/cipherResponse";
|
|
||||||
import {
|
|
||||||
CollectionGroupDetailsResponse,
|
|
||||||
CollectionResponse,
|
|
||||||
} from "../models/response/collectionResponse";
|
|
||||||
import { DomainsResponse } from "../models/response/domainsResponse";
|
|
||||||
import {
|
|
||||||
EmergencyAccessGranteeDetailsResponse,
|
|
||||||
EmergencyAccessGrantorDetailsResponse,
|
|
||||||
EmergencyAccessTakeoverResponse,
|
|
||||||
EmergencyAccessViewResponse,
|
|
||||||
} from "../models/response/emergencyAccessResponse";
|
|
||||||
import { EventResponse } from "../models/response/eventResponse";
|
|
||||||
import { FolderResponse } from "../models/response/folderResponse";
|
|
||||||
import { GroupDetailsResponse, GroupResponse } from "../models/response/groupResponse";
|
|
||||||
import { IdentityCaptchaResponse } from "../models/response/identityCaptchaResponse";
|
import { IdentityCaptchaResponse } from "../models/response/identityCaptchaResponse";
|
||||||
import { IdentityTokenResponse } from "../models/response/identityTokenResponse";
|
import { IdentityTokenResponse } from "../models/response/identityTokenResponse";
|
||||||
import { IdentityTwoFactorResponse } from "../models/response/identityTwoFactorResponse";
|
import { IdentityTwoFactorResponse } from "../models/response/identityTwoFactorResponse";
|
||||||
import { KeyConnectorUserKeyResponse } from "../models/response/keyConnectorUserKeyResponse";
|
|
||||||
import { ListResponse } from "../models/response/listResponse";
|
|
||||||
import { OrganizationSsoResponse } from "../models/response/organization/organizationSsoResponse";
|
|
||||||
import { OrganizationAutoEnrollStatusResponse } from "../models/response/organizationAutoEnrollStatusResponse";
|
|
||||||
import { OrganizationKeysResponse } from "../models/response/organizationKeysResponse";
|
|
||||||
import { OrganizationResponse } from "../models/response/organizationResponse";
|
|
||||||
import { OrganizationSubscriptionResponse } from "../models/response/organizationSubscriptionResponse";
|
|
||||||
import { OrganizationUserBulkPublicKeyResponse } from "../models/response/organizationUserBulkPublicKeyResponse";
|
|
||||||
import { OrganizationUserBulkResponse } from "../models/response/organizationUserBulkResponse";
|
|
||||||
import {
|
|
||||||
OrganizationUserDetailsResponse,
|
|
||||||
OrganizationUserResetPasswordDetailsReponse,
|
|
||||||
OrganizationUserUserDetailsResponse,
|
|
||||||
} from "../models/response/organizationUserResponse";
|
|
||||||
import { PaymentResponse } from "../models/response/paymentResponse";
|
|
||||||
import { PlanResponse } from "../models/response/planResponse";
|
|
||||||
import { PolicyResponse } from "../models/response/policyResponse";
|
|
||||||
import { PreloginResponse } from "../models/response/preloginResponse";
|
|
||||||
import { ProfileResponse } from "../models/response/profileResponse";
|
|
||||||
import {
|
|
||||||
ProviderOrganizationOrganizationDetailsResponse,
|
|
||||||
ProviderOrganizationResponse,
|
|
||||||
} from "../models/response/provider/providerOrganizationResponse";
|
|
||||||
import { ProviderResponse } from "../models/response/provider/providerResponse";
|
|
||||||
import { ProviderUserBulkPublicKeyResponse } from "../models/response/provider/providerUserBulkPublicKeyResponse";
|
|
||||||
import { ProviderUserBulkResponse } from "../models/response/provider/providerUserBulkResponse";
|
|
||||||
import {
|
|
||||||
ProviderUserResponse,
|
|
||||||
ProviderUserUserDetailsResponse,
|
|
||||||
} from "../models/response/provider/providerUserResponse";
|
|
||||||
import { SelectionReadOnlyResponse } from "../models/response/selectionReadOnlyResponse";
|
|
||||||
import { SendAccessResponse } from "../models/response/sendAccessResponse";
|
|
||||||
import { SendFileDownloadDataResponse } from "../models/response/sendFileDownloadDataResponse";
|
|
||||||
import { SendFileUploadDataResponse } from "../models/response/sendFileUploadDataResponse";
|
|
||||||
import { SendResponse } from "../models/response/sendResponse";
|
|
||||||
import { SubscriptionResponse } from "../models/response/subscriptionResponse";
|
|
||||||
import { SyncResponse } from "../models/response/syncResponse";
|
|
||||||
import { TaxInfoResponse } from "../models/response/taxInfoResponse";
|
|
||||||
import { TaxRateResponse } from "../models/response/taxRateResponse";
|
|
||||||
import { TwoFactorAuthenticatorResponse } from "../models/response/twoFactorAuthenticatorResponse";
|
|
||||||
import { TwoFactorDuoResponse } from "../models/response/twoFactorDuoResponse";
|
|
||||||
import { TwoFactorEmailResponse } from "../models/response/twoFactorEmailResponse";
|
|
||||||
import { TwoFactorProviderResponse } from "../models/response/twoFactorProviderResponse";
|
|
||||||
import { TwoFactorRecoverResponse } from "../models/response/twoFactorRescoverResponse";
|
|
||||||
import {
|
|
||||||
ChallengeResponse,
|
|
||||||
TwoFactorWebAuthnResponse,
|
|
||||||
} from "../models/response/twoFactorWebAuthnResponse";
|
|
||||||
import { TwoFactorYubiKeyResponse } from "../models/response/twoFactorYubiKeyResponse";
|
|
||||||
import { UserKeyResponse } from "../models/response/userKeyResponse";
|
|
||||||
import { SendAccessView } from "../models/view/sendAccessView";
|
|
||||||
|
|
||||||
export abstract class ApiService {
|
export abstract class ApiService {
|
||||||
postIdentityToken: (
|
postIdentityToken: (
|
||||||
request: PasswordTokenRequest | SsoTokenRequest | ApiTokenRequest
|
request: PasswordTokenRequest | SsoTokenRequest | ApiTokenRequest,
|
||||||
) => Promise<IdentityTokenResponse | IdentityTwoFactorResponse | IdentityCaptchaResponse>;
|
) => Promise<IdentityTokenResponse | IdentityTwoFactorResponse | IdentityCaptchaResponse>;
|
||||||
refreshIdentityToken: () => Promise<any>;
|
|
||||||
|
|
||||||
getProfile: () => Promise<ProfileResponse>;
|
|
||||||
getUserBilling: () => Promise<BillingResponse>;
|
|
||||||
getUserSubscription: () => Promise<SubscriptionResponse>;
|
|
||||||
getTaxInfo: () => Promise<TaxInfoResponse>;
|
|
||||||
putProfile: (request: UpdateProfileRequest) => Promise<ProfileResponse>;
|
|
||||||
putTaxInfo: (request: TaxInfoUpdateRequest) => Promise<any>;
|
|
||||||
postPrelogin: (request: PreloginRequest) => Promise<PreloginResponse>;
|
|
||||||
postEmailToken: (request: EmailTokenRequest) => Promise<any>;
|
|
||||||
postEmail: (request: EmailRequest) => Promise<any>;
|
|
||||||
postPassword: (request: PasswordRequest) => Promise<any>;
|
|
||||||
setPassword: (request: SetPasswordRequest) => Promise<any>;
|
|
||||||
postSetKeyConnectorKey: (request: SetKeyConnectorKeyRequest) => Promise<any>;
|
|
||||||
postSecurityStamp: (request: SecretVerificationRequest) => Promise<any>;
|
|
||||||
deleteAccount: (request: SecretVerificationRequest) => Promise<any>;
|
|
||||||
getAccountRevisionDate: () => Promise<number>;
|
|
||||||
postPasswordHint: (request: PasswordHintRequest) => Promise<any>;
|
|
||||||
postRegister: (request: RegisterRequest) => Promise<any>;
|
|
||||||
postPremium: (data: FormData) => Promise<PaymentResponse>;
|
|
||||||
postIapCheck: (request: IapCheckRequest) => Promise<any>;
|
|
||||||
postReinstatePremium: () => Promise<any>;
|
|
||||||
postCancelPremium: () => Promise<any>;
|
|
||||||
postAccountStorage: (request: StorageRequest) => Promise<PaymentResponse>;
|
|
||||||
postAccountPayment: (request: PaymentRequest) => Promise<any>;
|
|
||||||
postAccountLicense: (data: FormData) => Promise<any>;
|
|
||||||
postAccountKey: (request: UpdateKeyRequest) => Promise<any>;
|
|
||||||
postAccountKeys: (request: KeysRequest) => Promise<any>;
|
|
||||||
postAccountVerifyEmail: () => Promise<any>;
|
|
||||||
postAccountVerifyEmailToken: (request: VerifyEmailRequest) => Promise<any>;
|
|
||||||
postAccountVerifyPassword: (request: SecretVerificationRequest) => Promise<any>;
|
|
||||||
postAccountRecoverDelete: (request: DeleteRecoverRequest) => Promise<any>;
|
|
||||||
postAccountRecoverDeleteToken: (request: VerifyDeleteRecoverRequest) => Promise<any>;
|
|
||||||
postAccountKdf: (request: KdfRequest) => Promise<any>;
|
|
||||||
postUserApiKey: (id: string, request: SecretVerificationRequest) => Promise<ApiKeyResponse>;
|
|
||||||
postUserRotateApiKey: (id: string, request: SecretVerificationRequest) => Promise<ApiKeyResponse>;
|
|
||||||
putUpdateTempPassword: (request: UpdateTempPasswordRequest) => Promise<any>;
|
|
||||||
postAccountRequestOTP: () => Promise<void>;
|
|
||||||
postAccountVerifyOTP: (request: VerifyOTPRequest) => Promise<void>;
|
|
||||||
postConvertToKeyConnector: () => Promise<void>;
|
|
||||||
|
|
||||||
getFolder: (id: string) => Promise<FolderResponse>;
|
|
||||||
postFolder: (request: FolderRequest) => Promise<FolderResponse>;
|
|
||||||
putFolder: (id: string, request: FolderRequest) => Promise<FolderResponse>;
|
|
||||||
deleteFolder: (id: string) => Promise<any>;
|
|
||||||
|
|
||||||
getSend: (id: string) => Promise<SendResponse>;
|
|
||||||
postSendAccess: (
|
|
||||||
id: string,
|
|
||||||
request: SendAccessRequest,
|
|
||||||
apiUrl?: string
|
|
||||||
) => Promise<SendAccessResponse>;
|
|
||||||
getSends: () => Promise<ListResponse<SendResponse>>;
|
|
||||||
postSend: (request: SendRequest) => Promise<SendResponse>;
|
|
||||||
postFileTypeSend: (request: SendRequest) => Promise<SendFileUploadDataResponse>;
|
|
||||||
postSendFile: (sendId: string, fileId: string, data: FormData) => Promise<any>;
|
|
||||||
/**
|
|
||||||
* @deprecated Mar 25 2021: This method has been deprecated in favor of direct uploads.
|
|
||||||
* This method still exists for backward compatibility with old server versions.
|
|
||||||
*/
|
|
||||||
postSendFileLegacy: (data: FormData) => Promise<SendResponse>;
|
|
||||||
putSend: (id: string, request: SendRequest) => Promise<SendResponse>;
|
|
||||||
putSendRemovePassword: (id: string) => Promise<SendResponse>;
|
|
||||||
deleteSend: (id: string) => Promise<any>;
|
|
||||||
getSendFileDownloadData: (
|
|
||||||
send: SendAccessView,
|
|
||||||
request: SendAccessRequest,
|
|
||||||
apiUrl?: string
|
|
||||||
) => Promise<SendFileDownloadDataResponse>;
|
|
||||||
renewSendFileUploadUrl: (sendId: string, fileId: string) => Promise<SendFileUploadDataResponse>;
|
|
||||||
|
|
||||||
getCipher: (id: string) => Promise<CipherResponse>;
|
|
||||||
getCipherAdmin: (id: string) => Promise<CipherResponse>;
|
|
||||||
getAttachmentData: (
|
|
||||||
cipherId: string,
|
|
||||||
attachmentId: string,
|
|
||||||
emergencyAccessId?: string
|
|
||||||
) => Promise<AttachmentResponse>;
|
|
||||||
getCiphersOrganization: (organizationId: string) => Promise<ListResponse<CipherResponse>>;
|
|
||||||
postCipher: (request: CipherRequest) => Promise<CipherResponse>;
|
|
||||||
postCipherCreate: (request: CipherCreateRequest) => Promise<CipherResponse>;
|
|
||||||
postCipherAdmin: (request: CipherCreateRequest) => Promise<CipherResponse>;
|
|
||||||
putCipher: (id: string, request: CipherRequest) => Promise<CipherResponse>;
|
|
||||||
putCipherAdmin: (id: string, request: CipherRequest) => Promise<CipherResponse>;
|
|
||||||
deleteCipher: (id: string) => Promise<any>;
|
|
||||||
deleteCipherAdmin: (id: string) => Promise<any>;
|
|
||||||
deleteManyCiphers: (request: CipherBulkDeleteRequest) => Promise<any>;
|
|
||||||
deleteManyCiphersAdmin: (request: CipherBulkDeleteRequest) => Promise<any>;
|
|
||||||
putMoveCiphers: (request: CipherBulkMoveRequest) => Promise<any>;
|
|
||||||
putShareCipher: (id: string, request: CipherShareRequest) => Promise<CipherResponse>;
|
|
||||||
putShareCiphers: (request: CipherBulkShareRequest) => Promise<any>;
|
|
||||||
putCipherCollections: (id: string, request: CipherCollectionsRequest) => Promise<any>;
|
|
||||||
putCipherCollectionsAdmin: (id: string, request: CipherCollectionsRequest) => Promise<any>;
|
|
||||||
postPurgeCiphers: (request: SecretVerificationRequest, organizationId?: string) => Promise<any>;
|
|
||||||
postImportCiphers: (request: ImportCiphersRequest) => Promise<any>;
|
|
||||||
postImportOrganizationCiphers: (
|
|
||||||
organizationId: string,
|
|
||||||
request: ImportOrganizationCiphersRequest
|
|
||||||
) => Promise<any>;
|
|
||||||
putDeleteCipher: (id: string) => Promise<any>;
|
|
||||||
putDeleteCipherAdmin: (id: string) => Promise<any>;
|
|
||||||
putDeleteManyCiphers: (request: CipherBulkDeleteRequest) => Promise<any>;
|
|
||||||
putDeleteManyCiphersAdmin: (request: CipherBulkDeleteRequest) => Promise<any>;
|
|
||||||
putRestoreCipher: (id: string) => Promise<CipherResponse>;
|
|
||||||
putRestoreCipherAdmin: (id: string) => Promise<CipherResponse>;
|
|
||||||
putRestoreManyCiphers: (
|
|
||||||
request: CipherBulkRestoreRequest
|
|
||||||
) => Promise<ListResponse<CipherResponse>>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Mar 25 2021: This method has been deprecated in favor of direct uploads.
|
|
||||||
* This method still exists for backward compatibility with old server versions.
|
|
||||||
*/
|
|
||||||
postCipherAttachmentLegacy: (id: string, data: FormData) => Promise<CipherResponse>;
|
|
||||||
/**
|
|
||||||
* @deprecated Mar 25 2021: This method has been deprecated in favor of direct uploads.
|
|
||||||
* This method still exists for backward compatibility with old server versions.
|
|
||||||
*/
|
|
||||||
postCipherAttachmentAdminLegacy: (id: string, data: FormData) => Promise<CipherResponse>;
|
|
||||||
postCipherAttachment: (
|
|
||||||
id: string,
|
|
||||||
request: AttachmentRequest
|
|
||||||
) => Promise<AttachmentUploadDataResponse>;
|
|
||||||
deleteCipherAttachment: (id: string, attachmentId: string) => Promise<any>;
|
|
||||||
deleteCipherAttachmentAdmin: (id: string, attachmentId: string) => Promise<any>;
|
|
||||||
postShareCipherAttachment: (
|
|
||||||
id: string,
|
|
||||||
attachmentId: string,
|
|
||||||
data: FormData,
|
|
||||||
organizationId: string
|
|
||||||
) => Promise<any>;
|
|
||||||
renewAttachmentUploadUrl: (
|
|
||||||
id: string,
|
|
||||||
attachmentId: string
|
|
||||||
) => Promise<AttachmentUploadDataResponse>;
|
|
||||||
postAttachmentFile: (id: string, attachmentId: string, data: FormData) => Promise<any>;
|
|
||||||
|
|
||||||
getCollectionDetails: (
|
|
||||||
organizationId: string,
|
|
||||||
id: string
|
|
||||||
) => Promise<CollectionGroupDetailsResponse>;
|
|
||||||
getUserCollections: () => Promise<ListResponse<CollectionResponse>>;
|
|
||||||
getCollections: (organizationId: string) => Promise<ListResponse<CollectionResponse>>;
|
|
||||||
getCollectionUsers: (organizationId: string, id: string) => Promise<SelectionReadOnlyResponse[]>;
|
|
||||||
postCollection: (
|
|
||||||
organizationId: string,
|
|
||||||
request: CollectionRequest
|
|
||||||
) => Promise<CollectionResponse>;
|
|
||||||
putCollectionUsers: (
|
|
||||||
organizationId: string,
|
|
||||||
id: string,
|
|
||||||
request: SelectionReadOnlyRequest[]
|
|
||||||
) => Promise<any>;
|
|
||||||
putCollection: (
|
|
||||||
organizationId: string,
|
|
||||||
id: string,
|
|
||||||
request: CollectionRequest
|
|
||||||
) => Promise<CollectionResponse>;
|
|
||||||
deleteCollection: (organizationId: string, id: string) => Promise<any>;
|
|
||||||
deleteCollectionUser: (
|
|
||||||
organizationId: string,
|
|
||||||
id: string,
|
|
||||||
organizationUserId: string
|
|
||||||
) => Promise<any>;
|
|
||||||
|
|
||||||
getGroupDetails: (organizationId: string, id: string) => Promise<GroupDetailsResponse>;
|
|
||||||
getGroups: (organizationId: string) => Promise<ListResponse<GroupResponse>>;
|
|
||||||
getGroupUsers: (organizationId: string, id: string) => Promise<string[]>;
|
|
||||||
postGroup: (organizationId: string, request: GroupRequest) => Promise<GroupResponse>;
|
|
||||||
putGroup: (organizationId: string, id: string, request: GroupRequest) => Promise<GroupResponse>;
|
|
||||||
putGroupUsers: (organizationId: string, id: string, request: string[]) => Promise<any>;
|
|
||||||
deleteGroup: (organizationId: string, id: string) => Promise<any>;
|
|
||||||
deleteGroupUser: (organizationId: string, id: string, organizationUserId: string) => Promise<any>;
|
|
||||||
|
|
||||||
getPolicy: (organizationId: string, type: PolicyType) => Promise<PolicyResponse>;
|
|
||||||
getPolicies: (organizationId: string) => Promise<ListResponse<PolicyResponse>>;
|
|
||||||
getPoliciesByToken: (
|
|
||||||
organizationId: string,
|
|
||||||
token: string,
|
|
||||||
email: string,
|
|
||||||
organizationUserId: string
|
|
||||||
) => Promise<ListResponse<PolicyResponse>>;
|
|
||||||
getPoliciesByInvitedUser: (
|
|
||||||
organizationId: string,
|
|
||||||
userId: string
|
|
||||||
) => Promise<ListResponse<PolicyResponse>>;
|
|
||||||
putPolicy: (
|
|
||||||
organizationId: string,
|
|
||||||
type: PolicyType,
|
|
||||||
request: PolicyRequest
|
|
||||||
) => Promise<PolicyResponse>;
|
|
||||||
|
|
||||||
getOrganizationUser: (
|
|
||||||
organizationId: string,
|
|
||||||
id: string
|
|
||||||
) => Promise<OrganizationUserDetailsResponse>;
|
|
||||||
getOrganizationUserGroups: (organizationId: string, id: string) => Promise<string[]>;
|
|
||||||
getOrganizationUsers: (
|
|
||||||
organizationId: string
|
|
||||||
) => Promise<ListResponse<OrganizationUserUserDetailsResponse>>;
|
|
||||||
getOrganizationUserResetPasswordDetails: (
|
|
||||||
organizationId: string,
|
|
||||||
id: string
|
|
||||||
) => Promise<OrganizationUserResetPasswordDetailsReponse>;
|
|
||||||
postOrganizationUserInvite: (
|
|
||||||
organizationId: string,
|
|
||||||
request: OrganizationUserInviteRequest
|
|
||||||
) => Promise<any>;
|
|
||||||
postOrganizationUserReinvite: (organizationId: string, id: string) => Promise<any>;
|
|
||||||
postManyOrganizationUserReinvite: (
|
|
||||||
organizationId: string,
|
|
||||||
request: OrganizationUserBulkRequest
|
|
||||||
) => Promise<ListResponse<OrganizationUserBulkResponse>>;
|
|
||||||
postOrganizationUserAccept: (
|
|
||||||
organizationId: string,
|
|
||||||
id: string,
|
|
||||||
request: OrganizationUserAcceptRequest
|
|
||||||
) => Promise<any>;
|
|
||||||
postOrganizationUserConfirm: (
|
|
||||||
organizationId: string,
|
|
||||||
id: string,
|
|
||||||
request: OrganizationUserConfirmRequest
|
|
||||||
) => Promise<any>;
|
|
||||||
postOrganizationUsersPublicKey: (
|
|
||||||
organizationId: string,
|
|
||||||
request: OrganizationUserBulkRequest
|
|
||||||
) => Promise<ListResponse<OrganizationUserBulkPublicKeyResponse>>;
|
|
||||||
postOrganizationUserBulkConfirm: (
|
|
||||||
organizationId: string,
|
|
||||||
request: OrganizationUserBulkConfirmRequest
|
|
||||||
) => Promise<ListResponse<OrganizationUserBulkResponse>>;
|
|
||||||
|
|
||||||
putOrganizationUser: (
|
|
||||||
organizationId: string,
|
|
||||||
id: string,
|
|
||||||
request: OrganizationUserUpdateRequest
|
|
||||||
) => Promise<any>;
|
|
||||||
putOrganizationUserGroups: (
|
|
||||||
organizationId: string,
|
|
||||||
id: string,
|
|
||||||
request: OrganizationUserUpdateGroupsRequest
|
|
||||||
) => Promise<any>;
|
|
||||||
putOrganizationUserResetPasswordEnrollment: (
|
|
||||||
organizationId: string,
|
|
||||||
userId: string,
|
|
||||||
request: OrganizationUserResetPasswordEnrollmentRequest
|
|
||||||
) => Promise<any>;
|
|
||||||
putOrganizationUserResetPassword: (
|
|
||||||
organizationId: string,
|
|
||||||
id: string,
|
|
||||||
request: OrganizationUserResetPasswordRequest
|
|
||||||
) => Promise<any>;
|
|
||||||
deleteOrganizationUser: (organizationId: string, id: string) => Promise<any>;
|
|
||||||
deleteManyOrganizationUsers: (
|
|
||||||
organizationId: string,
|
|
||||||
request: OrganizationUserBulkRequest
|
|
||||||
) => Promise<ListResponse<OrganizationUserBulkResponse>>;
|
|
||||||
|
|
||||||
getSync: () => Promise<SyncResponse>;
|
|
||||||
postImportDirectory: (organizationId: string, request: ImportDirectoryRequest) => Promise<any>;
|
|
||||||
postPublicImportDirectory: (request: OrganizationImportRequest) => Promise<any>;
|
postPublicImportDirectory: (request: OrganizationImportRequest) => Promise<any>;
|
||||||
|
|
||||||
getSettingsDomains: () => Promise<DomainsResponse>;
|
|
||||||
putSettingsDomains: (request: UpdateDomainsRequest) => Promise<DomainsResponse>;
|
|
||||||
|
|
||||||
getTwoFactorProviders: () => Promise<ListResponse<TwoFactorProviderResponse>>;
|
|
||||||
getTwoFactorOrganizationProviders: (
|
|
||||||
organizationId: string
|
|
||||||
) => Promise<ListResponse<TwoFactorProviderResponse>>;
|
|
||||||
getTwoFactorAuthenticator: (
|
|
||||||
request: SecretVerificationRequest
|
|
||||||
) => Promise<TwoFactorAuthenticatorResponse>;
|
|
||||||
getTwoFactorEmail: (request: SecretVerificationRequest) => Promise<TwoFactorEmailResponse>;
|
|
||||||
getTwoFactorDuo: (request: SecretVerificationRequest) => Promise<TwoFactorDuoResponse>;
|
|
||||||
getTwoFactorOrganizationDuo: (
|
|
||||||
organizationId: string,
|
|
||||||
request: SecretVerificationRequest
|
|
||||||
) => Promise<TwoFactorDuoResponse>;
|
|
||||||
getTwoFactorYubiKey: (request: SecretVerificationRequest) => Promise<TwoFactorYubiKeyResponse>;
|
|
||||||
getTwoFactorWebAuthn: (request: SecretVerificationRequest) => Promise<TwoFactorWebAuthnResponse>;
|
|
||||||
getTwoFactorWebAuthnChallenge: (request: SecretVerificationRequest) => Promise<ChallengeResponse>;
|
|
||||||
getTwoFactorRecover: (request: SecretVerificationRequest) => Promise<TwoFactorRecoverResponse>;
|
|
||||||
putTwoFactorAuthenticator: (
|
|
||||||
request: UpdateTwoFactorAuthenticatorRequest
|
|
||||||
) => Promise<TwoFactorAuthenticatorResponse>;
|
|
||||||
putTwoFactorEmail: (request: UpdateTwoFactorEmailRequest) => Promise<TwoFactorEmailResponse>;
|
|
||||||
putTwoFactorDuo: (request: UpdateTwoFactorDuoRequest) => Promise<TwoFactorDuoResponse>;
|
|
||||||
putTwoFactorOrganizationDuo: (
|
|
||||||
organizationId: string,
|
|
||||||
request: UpdateTwoFactorDuoRequest
|
|
||||||
) => Promise<TwoFactorDuoResponse>;
|
|
||||||
putTwoFactorYubiKey: (
|
|
||||||
request: UpdateTwoFactorYubioOtpRequest
|
|
||||||
) => Promise<TwoFactorYubiKeyResponse>;
|
|
||||||
putTwoFactorWebAuthn: (
|
|
||||||
request: UpdateTwoFactorWebAuthnRequest
|
|
||||||
) => Promise<TwoFactorWebAuthnResponse>;
|
|
||||||
deleteTwoFactorWebAuthn: (
|
|
||||||
request: UpdateTwoFactorWebAuthnDeleteRequest
|
|
||||||
) => Promise<TwoFactorWebAuthnResponse>;
|
|
||||||
putTwoFactorDisable: (request: TwoFactorProviderRequest) => Promise<TwoFactorProviderResponse>;
|
|
||||||
putTwoFactorOrganizationDisable: (
|
|
||||||
organizationId: string,
|
|
||||||
request: TwoFactorProviderRequest
|
|
||||||
) => Promise<TwoFactorProviderResponse>;
|
|
||||||
postTwoFactorRecover: (request: TwoFactorRecoveryRequest) => Promise<any>;
|
|
||||||
postTwoFactorEmailSetup: (request: TwoFactorEmailRequest) => Promise<any>;
|
|
||||||
postTwoFactorEmail: (request: TwoFactorEmailRequest) => Promise<any>;
|
|
||||||
|
|
||||||
getEmergencyAccessTrusted: () => Promise<ListResponse<EmergencyAccessGranteeDetailsResponse>>;
|
|
||||||
getEmergencyAccessGranted: () => Promise<ListResponse<EmergencyAccessGrantorDetailsResponse>>;
|
|
||||||
getEmergencyAccess: (id: string) => Promise<EmergencyAccessGranteeDetailsResponse>;
|
|
||||||
getEmergencyGrantorPolicies: (id: string) => Promise<ListResponse<PolicyResponse>>;
|
|
||||||
putEmergencyAccess: (id: string, request: EmergencyAccessUpdateRequest) => Promise<any>;
|
|
||||||
deleteEmergencyAccess: (id: string) => Promise<any>;
|
|
||||||
postEmergencyAccessInvite: (request: EmergencyAccessInviteRequest) => Promise<any>;
|
|
||||||
postEmergencyAccessReinvite: (id: string) => Promise<any>;
|
|
||||||
postEmergencyAccessAccept: (id: string, request: EmergencyAccessAcceptRequest) => Promise<any>;
|
|
||||||
postEmergencyAccessConfirm: (id: string, request: EmergencyAccessConfirmRequest) => Promise<any>;
|
|
||||||
postEmergencyAccessInitiate: (id: string) => Promise<any>;
|
|
||||||
postEmergencyAccessApprove: (id: string) => Promise<any>;
|
|
||||||
postEmergencyAccessReject: (id: string) => Promise<any>;
|
|
||||||
postEmergencyAccessTakeover: (id: string) => Promise<EmergencyAccessTakeoverResponse>;
|
|
||||||
postEmergencyAccessPassword: (
|
|
||||||
id: string,
|
|
||||||
request: EmergencyAccessPasswordRequest
|
|
||||||
) => Promise<any>;
|
|
||||||
postEmergencyAccessView: (id: string) => Promise<EmergencyAccessViewResponse>;
|
|
||||||
|
|
||||||
getOrganization: (id: string) => Promise<OrganizationResponse>;
|
|
||||||
getOrganizationBilling: (id: string) => Promise<BillingResponse>;
|
|
||||||
getOrganizationSubscription: (id: string) => Promise<OrganizationSubscriptionResponse>;
|
|
||||||
getOrganizationLicense: (id: string, installationId: string) => Promise<any>;
|
|
||||||
getOrganizationTaxInfo: (id: string) => Promise<TaxInfoResponse>;
|
|
||||||
getOrganizationAutoEnrollStatus: (
|
|
||||||
identifier: string
|
|
||||||
) => Promise<OrganizationAutoEnrollStatusResponse>;
|
|
||||||
getOrganizationSso: (id: string) => Promise<OrganizationSsoResponse>;
|
|
||||||
postOrganization: (request: OrganizationCreateRequest) => Promise<OrganizationResponse>;
|
|
||||||
putOrganization: (
|
|
||||||
id: string,
|
|
||||||
request: OrganizationUpdateRequest
|
|
||||||
) => Promise<OrganizationResponse>;
|
|
||||||
putOrganizationTaxInfo: (id: string, request: OrganizationTaxInfoUpdateRequest) => Promise<any>;
|
|
||||||
postLeaveOrganization: (id: string) => Promise<any>;
|
|
||||||
postOrganizationLicense: (data: FormData) => Promise<OrganizationResponse>;
|
|
||||||
postOrganizationLicenseUpdate: (id: string, data: FormData) => Promise<any>;
|
|
||||||
postOrganizationApiKey: (
|
|
||||||
id: string,
|
|
||||||
request: SecretVerificationRequest
|
|
||||||
) => Promise<ApiKeyResponse>;
|
|
||||||
postOrganizationRotateApiKey: (
|
|
||||||
id: string,
|
|
||||||
request: SecretVerificationRequest
|
|
||||||
) => Promise<ApiKeyResponse>;
|
|
||||||
postOrganizationSso: (
|
|
||||||
id: string,
|
|
||||||
request: OrganizationSsoRequest
|
|
||||||
) => Promise<OrganizationSsoResponse>;
|
|
||||||
postOrganizationUpgrade: (
|
|
||||||
id: string,
|
|
||||||
request: OrganizationUpgradeRequest
|
|
||||||
) => Promise<PaymentResponse>;
|
|
||||||
postOrganizationUpdateSubscription: (
|
|
||||||
id: string,
|
|
||||||
request: OrganizationSubscriptionUpdateRequest
|
|
||||||
) => Promise<void>;
|
|
||||||
postOrganizationSeat: (id: string, request: SeatRequest) => Promise<PaymentResponse>;
|
|
||||||
postOrganizationStorage: (id: string, request: StorageRequest) => Promise<any>;
|
|
||||||
postOrganizationPayment: (id: string, request: PaymentRequest) => Promise<any>;
|
|
||||||
postOrganizationVerifyBank: (id: string, request: VerifyBankRequest) => Promise<any>;
|
|
||||||
postOrganizationCancel: (id: string) => Promise<any>;
|
|
||||||
postOrganizationReinstate: (id: string) => Promise<any>;
|
|
||||||
deleteOrganization: (id: string, request: SecretVerificationRequest) => Promise<any>;
|
|
||||||
getPlans: () => Promise<ListResponse<PlanResponse>>;
|
|
||||||
getTaxRates: () => Promise<ListResponse<TaxRateResponse>>;
|
|
||||||
getOrganizationKeys: (id: string) => Promise<OrganizationKeysResponse>;
|
|
||||||
postOrganizationKeys: (
|
|
||||||
id: string,
|
|
||||||
request: OrganizationKeysRequest
|
|
||||||
) => Promise<OrganizationKeysResponse>;
|
|
||||||
|
|
||||||
postProviderSetup: (id: string, request: ProviderSetupRequest) => Promise<ProviderResponse>;
|
|
||||||
getProvider: (id: string) => Promise<ProviderResponse>;
|
|
||||||
putProvider: (id: string, request: ProviderUpdateRequest) => Promise<ProviderResponse>;
|
|
||||||
|
|
||||||
getProviderUsers: (providerId: string) => Promise<ListResponse<ProviderUserUserDetailsResponse>>;
|
|
||||||
getProviderUser: (providerId: string, id: string) => Promise<ProviderUserResponse>;
|
|
||||||
postProviderUserInvite: (providerId: string, request: ProviderUserInviteRequest) => Promise<any>;
|
|
||||||
postProviderUserReinvite: (providerId: string, id: string) => Promise<any>;
|
|
||||||
postManyProviderUserReinvite: (
|
|
||||||
providerId: string,
|
|
||||||
request: ProviderUserBulkRequest
|
|
||||||
) => Promise<ListResponse<ProviderUserBulkResponse>>;
|
|
||||||
postProviderUserAccept: (
|
|
||||||
providerId: string,
|
|
||||||
id: string,
|
|
||||||
request: ProviderUserAcceptRequest
|
|
||||||
) => Promise<any>;
|
|
||||||
postProviderUserConfirm: (
|
|
||||||
providerId: string,
|
|
||||||
id: string,
|
|
||||||
request: ProviderUserConfirmRequest
|
|
||||||
) => Promise<any>;
|
|
||||||
postProviderUsersPublicKey: (
|
|
||||||
providerId: string,
|
|
||||||
request: ProviderUserBulkRequest
|
|
||||||
) => Promise<ListResponse<ProviderUserBulkPublicKeyResponse>>;
|
|
||||||
postProviderUserBulkConfirm: (
|
|
||||||
providerId: string,
|
|
||||||
request: ProviderUserBulkConfirmRequest
|
|
||||||
) => Promise<ListResponse<ProviderUserBulkResponse>>;
|
|
||||||
putProviderUser: (
|
|
||||||
providerId: string,
|
|
||||||
id: string,
|
|
||||||
request: ProviderUserUpdateRequest
|
|
||||||
) => Promise<any>;
|
|
||||||
deleteProviderUser: (organizationId: string, id: string) => Promise<any>;
|
|
||||||
deleteManyProviderUsers: (
|
|
||||||
providerId: string,
|
|
||||||
request: ProviderUserBulkRequest
|
|
||||||
) => Promise<ListResponse<ProviderUserBulkResponse>>;
|
|
||||||
getProviderClients: (
|
|
||||||
providerId: string
|
|
||||||
) => Promise<ListResponse<ProviderOrganizationOrganizationDetailsResponse>>;
|
|
||||||
postProviderAddOrganization: (
|
|
||||||
providerId: string,
|
|
||||||
request: ProviderAddOrganizationRequest
|
|
||||||
) => Promise<any>;
|
|
||||||
postProviderCreateOrganization: (
|
|
||||||
providerId: string,
|
|
||||||
request: ProviderOrganizationCreateRequest
|
|
||||||
) => Promise<ProviderOrganizationResponse>;
|
|
||||||
deleteProviderOrganization: (providerId: string, organizationId: string) => Promise<any>;
|
|
||||||
|
|
||||||
getEvents: (start: string, end: string, token: string) => Promise<ListResponse<EventResponse>>;
|
|
||||||
getEventsCipher: (
|
|
||||||
id: string,
|
|
||||||
start: string,
|
|
||||||
end: string,
|
|
||||||
token: string
|
|
||||||
) => Promise<ListResponse<EventResponse>>;
|
|
||||||
getEventsOrganization: (
|
|
||||||
id: string,
|
|
||||||
start: string,
|
|
||||||
end: string,
|
|
||||||
token: string
|
|
||||||
) => Promise<ListResponse<EventResponse>>;
|
|
||||||
getEventsOrganizationUser: (
|
|
||||||
organizationId: string,
|
|
||||||
id: string,
|
|
||||||
start: string,
|
|
||||||
end: string,
|
|
||||||
token: string
|
|
||||||
) => Promise<ListResponse<EventResponse>>;
|
|
||||||
getEventsProvider: (
|
|
||||||
id: string,
|
|
||||||
start: string,
|
|
||||||
end: string,
|
|
||||||
token: string
|
|
||||||
) => Promise<ListResponse<EventResponse>>;
|
|
||||||
getEventsProviderUser: (
|
|
||||||
providerId: string,
|
|
||||||
id: string,
|
|
||||||
start: string,
|
|
||||||
end: string,
|
|
||||||
token: string
|
|
||||||
) => Promise<ListResponse<EventResponse>>;
|
|
||||||
postEventsCollect: (request: EventRequest[]) => Promise<any>;
|
|
||||||
|
|
||||||
deleteSsoUser: (organizationId: string) => Promise<any>;
|
|
||||||
getSsoUserIdentifier: () => Promise<string>;
|
|
||||||
|
|
||||||
getUserPublicKey: (id: string) => Promise<UserKeyResponse>;
|
|
||||||
|
|
||||||
getHibpBreach: (username: string) => Promise<BreachAccountResponse[]>;
|
|
||||||
|
|
||||||
postBitPayInvoice: (request: BitPayInvoiceRequest) => Promise<string>;
|
|
||||||
postSetupPayment: () => Promise<string>;
|
|
||||||
|
|
||||||
getActiveBearerToken: () => Promise<string>;
|
|
||||||
fetch: (request: Request) => Promise<Response>;
|
|
||||||
nativeFetch: (request: Request) => Promise<Response>;
|
|
||||||
|
|
||||||
preValidateSso: (identifier: string) => Promise<boolean>;
|
|
||||||
|
|
||||||
postCreateSponsorship: (
|
|
||||||
sponsorshipOrgId: string,
|
|
||||||
request: OrganizationSponsorshipCreateRequest
|
|
||||||
) => Promise<void>;
|
|
||||||
deleteRevokeSponsorship: (sponsoringOrganizationId: string) => Promise<void>;
|
|
||||||
deleteRemoveSponsorship: (sponsoringOrgId: string) => Promise<void>;
|
|
||||||
postPreValidateSponsorshipToken: (sponsorshipToken: string) => Promise<boolean>;
|
|
||||||
postRedeemSponsorship: (
|
|
||||||
sponsorshipToken: string,
|
|
||||||
request: OrganizationSponsorshipRedeemRequest
|
|
||||||
) => Promise<void>;
|
|
||||||
postResendSponsorshipOffer: (sponsoringOrgId: string) => Promise<void>;
|
|
||||||
|
|
||||||
getUserKeyFromKeyConnector: (keyConnectorUrl: string) => Promise<KeyConnectorUserKeyResponse>;
|
|
||||||
postUserKeyToKeyConnector: (
|
|
||||||
keyConnectorUrl: string,
|
|
||||||
request: KeyConnectorUserKeyRequest
|
|
||||||
) => Promise<void>;
|
|
||||||
getKeyConnectorAlive: (keyConnectorUrl: string) => Promise<void>;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
import { BreachAccountResponse } from "../models/response/breachAccountResponse";
|
|
||||||
|
|
||||||
export abstract class AuditService {
|
|
||||||
passwordLeaked: (password: string) => Promise<number>;
|
|
||||||
breachedAccounts: (username: string) => Promise<BreachAccountResponse[]>;
|
|
||||||
}
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
import { AuthResult } from "../models/domain/authResult";
|
|
||||||
import {
|
|
||||||
ApiLogInCredentials,
|
|
||||||
PasswordLogInCredentials,
|
|
||||||
SsoLogInCredentials,
|
|
||||||
} from "../models/domain/logInCredentials";
|
|
||||||
import { SymmetricCryptoKey } from "../models/domain/symmetricCryptoKey";
|
|
||||||
import { TokenRequestTwoFactor } from "../models/request/identityToken/tokenRequestTwoFactor";
|
|
||||||
|
|
||||||
export abstract class AuthService {
|
|
||||||
masterPasswordHash: string;
|
|
||||||
email: string;
|
|
||||||
logIn: (
|
|
||||||
credentials: ApiLogInCredentials | PasswordLogInCredentials | SsoLogInCredentials
|
|
||||||
) => Promise<AuthResult>;
|
|
||||||
logInTwoFactor: (
|
|
||||||
twoFactor: TokenRequestTwoFactor,
|
|
||||||
captchaResponse: string
|
|
||||||
) => Promise<AuthResult>;
|
|
||||||
logOut: (callback: () => void) => void;
|
|
||||||
makePreloginKey: (masterPassword: string, email: string) => Promise<SymmetricCryptoKey>;
|
|
||||||
authingWithApiKey: () => boolean;
|
|
||||||
authingWithSso: () => boolean;
|
|
||||||
authingWithPassword: () => boolean;
|
|
||||||
}
|
|
||||||
@@ -1,79 +0,0 @@
|
|||||||
import { CipherType } from "../enums/cipherType";
|
|
||||||
import { UriMatchType } from "../enums/uriMatchType";
|
|
||||||
import { CipherData } from "../models/data/cipherData";
|
|
||||||
import { Cipher } from "../models/domain/cipher";
|
|
||||||
import { Field } from "../models/domain/field";
|
|
||||||
import { SymmetricCryptoKey } from "../models/domain/symmetricCryptoKey";
|
|
||||||
import { CipherView } from "../models/view/cipherView";
|
|
||||||
import { FieldView } from "../models/view/fieldView";
|
|
||||||
|
|
||||||
export abstract class CipherService {
|
|
||||||
clearCache: (userId?: string) => Promise<void>;
|
|
||||||
encrypt: (
|
|
||||||
model: CipherView,
|
|
||||||
key?: SymmetricCryptoKey,
|
|
||||||
originalCipher?: Cipher
|
|
||||||
) => Promise<Cipher>;
|
|
||||||
encryptFields: (fieldsModel: FieldView[], key: SymmetricCryptoKey) => Promise<Field[]>;
|
|
||||||
encryptField: (fieldModel: FieldView, key: SymmetricCryptoKey) => Promise<Field>;
|
|
||||||
get: (id: string) => Promise<Cipher>;
|
|
||||||
getAll: () => Promise<Cipher[]>;
|
|
||||||
getAllDecrypted: () => Promise<CipherView[]>;
|
|
||||||
getAllDecryptedForGrouping: (groupingId: string, folder?: boolean) => Promise<CipherView[]>;
|
|
||||||
getAllDecryptedForUrl: (
|
|
||||||
url: string,
|
|
||||||
includeOtherTypes?: CipherType[],
|
|
||||||
defaultMatch?: UriMatchType
|
|
||||||
) => Promise<CipherView[]>;
|
|
||||||
getAllFromApiForOrganization: (organizationId: string) => Promise<CipherView[]>;
|
|
||||||
getLastUsedForUrl: (url: string, autofillOnPageLoad: boolean) => Promise<CipherView>;
|
|
||||||
getLastLaunchedForUrl: (url: string, autofillOnPageLoad: boolean) => Promise<CipherView>;
|
|
||||||
getNextCipherForUrl: (url: string) => Promise<CipherView>;
|
|
||||||
updateLastUsedIndexForUrl: (url: string) => void;
|
|
||||||
updateLastUsedDate: (id: string) => Promise<void>;
|
|
||||||
updateLastLaunchedDate: (id: string) => Promise<void>;
|
|
||||||
saveNeverDomain: (domain: string) => Promise<void>;
|
|
||||||
saveWithServer: (cipher: Cipher) => Promise<any>;
|
|
||||||
shareWithServer: (
|
|
||||||
cipher: CipherView,
|
|
||||||
organizationId: string,
|
|
||||||
collectionIds: string[]
|
|
||||||
) => Promise<any>;
|
|
||||||
shareManyWithServer: (
|
|
||||||
ciphers: CipherView[],
|
|
||||||
organizationId: string,
|
|
||||||
collectionIds: string[]
|
|
||||||
) => Promise<any>;
|
|
||||||
saveAttachmentWithServer: (
|
|
||||||
cipher: Cipher,
|
|
||||||
unencryptedFile: any,
|
|
||||||
admin?: boolean
|
|
||||||
) => Promise<Cipher>;
|
|
||||||
saveAttachmentRawWithServer: (
|
|
||||||
cipher: Cipher,
|
|
||||||
filename: string,
|
|
||||||
data: ArrayBuffer,
|
|
||||||
admin?: boolean
|
|
||||||
) => Promise<Cipher>;
|
|
||||||
saveCollectionsWithServer: (cipher: Cipher) => Promise<any>;
|
|
||||||
upsert: (cipher: CipherData | CipherData[]) => Promise<any>;
|
|
||||||
replace: (ciphers: { [id: string]: CipherData }) => Promise<any>;
|
|
||||||
clear: (userId: string) => Promise<any>;
|
|
||||||
moveManyWithServer: (ids: string[], folderId: string) => Promise<any>;
|
|
||||||
delete: (id: string | string[]) => Promise<any>;
|
|
||||||
deleteWithServer: (id: string) => Promise<any>;
|
|
||||||
deleteManyWithServer: (ids: string[]) => Promise<any>;
|
|
||||||
deleteAttachment: (id: string, attachmentId: string) => Promise<void>;
|
|
||||||
deleteAttachmentWithServer: (id: string, attachmentId: string) => Promise<void>;
|
|
||||||
sortCiphersByLastUsed: (a: any, b: any) => number;
|
|
||||||
sortCiphersByLastUsedThenName: (a: any, b: any) => number;
|
|
||||||
getLocaleSortingFunction: () => (a: CipherView, b: CipherView) => number;
|
|
||||||
softDelete: (id: string | string[]) => Promise<any>;
|
|
||||||
softDeleteWithServer: (id: string) => Promise<any>;
|
|
||||||
softDeleteManyWithServer: (ids: string[]) => Promise<any>;
|
|
||||||
restore: (
|
|
||||||
cipher: { id: string; revisionDate: string } | { id: string; revisionDate: string }[]
|
|
||||||
) => Promise<any>;
|
|
||||||
restoreWithServer: (id: string) => Promise<any>;
|
|
||||||
restoreManyWithServer: (ids: string[]) => Promise<any>;
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
import { CollectionData } from "../models/data/collectionData";
|
|
||||||
import { Collection } from "../models/domain/collection";
|
|
||||||
import { TreeNode } from "../models/domain/treeNode";
|
|
||||||
import { CollectionView } from "../models/view/collectionView";
|
|
||||||
|
|
||||||
export abstract class CollectionService {
|
|
||||||
clearCache: (userId?: string) => Promise<void>;
|
|
||||||
encrypt: (model: CollectionView) => Promise<Collection>;
|
|
||||||
decryptMany: (collections: Collection[]) => Promise<CollectionView[]>;
|
|
||||||
get: (id: string) => Promise<Collection>;
|
|
||||||
getAll: () => Promise<Collection[]>;
|
|
||||||
getAllDecrypted: () => Promise<CollectionView[]>;
|
|
||||||
getAllNested: (collections?: CollectionView[]) => Promise<TreeNode<CollectionView>[]>;
|
|
||||||
getNested: (id: string) => Promise<TreeNode<CollectionView>>;
|
|
||||||
upsert: (collection: CollectionData | CollectionData[]) => Promise<any>;
|
|
||||||
replace: (collections: { [id: string]: CollectionData }) => Promise<any>;
|
|
||||||
clear: (userId: string) => Promise<any>;
|
|
||||||
delete: (id: string | string[]) => Promise<any>;
|
|
||||||
}
|
|
||||||
@@ -15,7 +15,7 @@ export abstract class CryptoService {
|
|||||||
setEncPrivateKey: (encPrivateKey: string) => Promise<void>;
|
setEncPrivateKey: (encPrivateKey: string) => Promise<void>;
|
||||||
setOrgKeys: (
|
setOrgKeys: (
|
||||||
orgs: ProfileOrganizationResponse[],
|
orgs: ProfileOrganizationResponse[],
|
||||||
providerOrgs: ProfileProviderOrganizationResponse[]
|
providerOrgs: ProfileProviderOrganizationResponse[],
|
||||||
) => Promise<void>;
|
) => Promise<void>;
|
||||||
setProviderKeys: (orgs: ProfileProviderResponse[]) => Promise<void>;
|
setProviderKeys: (orgs: ProfileProviderResponse[]) => Promise<void>;
|
||||||
getKey: (keySuffix?: KeySuffixOptions, userId?: string) => Promise<SymmetricCryptoKey>;
|
getKey: (keySuffix?: KeySuffixOptions, userId?: string) => Promise<SymmetricCryptoKey>;
|
||||||
@@ -46,14 +46,14 @@ export abstract class CryptoService {
|
|||||||
password: string,
|
password: string,
|
||||||
salt: string,
|
salt: string,
|
||||||
kdf: KdfType,
|
kdf: KdfType,
|
||||||
kdfIterations: number
|
kdfIterations: number,
|
||||||
) => Promise<SymmetricCryptoKey>;
|
) => Promise<SymmetricCryptoKey>;
|
||||||
makeKeyFromPin: (
|
makeKeyFromPin: (
|
||||||
pin: string,
|
pin: string,
|
||||||
salt: string,
|
salt: string,
|
||||||
kdf: KdfType,
|
kdf: KdfType,
|
||||||
kdfIterations: number,
|
kdfIterations: number,
|
||||||
protectedKeyCs?: EncString
|
protectedKeyCs?: EncString,
|
||||||
) => Promise<SymmetricCryptoKey>;
|
) => Promise<SymmetricCryptoKey>;
|
||||||
makeShareKey: () => Promise<[EncString, SymmetricCryptoKey]>;
|
makeShareKey: () => Promise<[EncString, SymmetricCryptoKey]>;
|
||||||
makeKeyPair: (key?: SymmetricCryptoKey) => Promise<[string, EncString]>;
|
makeKeyPair: (key?: SymmetricCryptoKey) => Promise<[string, EncString]>;
|
||||||
@@ -61,18 +61,18 @@ export abstract class CryptoService {
|
|||||||
pin: string,
|
pin: string,
|
||||||
salt: string,
|
salt: string,
|
||||||
kdf: KdfType,
|
kdf: KdfType,
|
||||||
kdfIterations: number
|
kdfIterations: number,
|
||||||
) => Promise<SymmetricCryptoKey>;
|
) => Promise<SymmetricCryptoKey>;
|
||||||
makeSendKey: (keyMaterial: ArrayBuffer) => Promise<SymmetricCryptoKey>;
|
makeSendKey: (keyMaterial: ArrayBuffer) => Promise<SymmetricCryptoKey>;
|
||||||
hashPassword: (
|
hashPassword: (
|
||||||
password: string,
|
password: string,
|
||||||
key: SymmetricCryptoKey,
|
key: SymmetricCryptoKey,
|
||||||
hashPurpose?: HashPurpose
|
hashPurpose?: HashPurpose,
|
||||||
) => Promise<string>;
|
) => Promise<string>;
|
||||||
makeEncKey: (key: SymmetricCryptoKey) => Promise<[SymmetricCryptoKey, EncString]>;
|
makeEncKey: (key: SymmetricCryptoKey) => Promise<[SymmetricCryptoKey, EncString]>;
|
||||||
remakeEncKey: (
|
remakeEncKey: (
|
||||||
key: SymmetricCryptoKey,
|
key: SymmetricCryptoKey,
|
||||||
encKey?: SymmetricCryptoKey
|
encKey?: SymmetricCryptoKey,
|
||||||
) => Promise<[SymmetricCryptoKey, EncString]>;
|
) => Promise<[SymmetricCryptoKey, EncString]>;
|
||||||
encrypt: (plainValue: string | ArrayBuffer, key?: SymmetricCryptoKey) => Promise<EncString>;
|
encrypt: (plainValue: string | ArrayBuffer, key?: SymmetricCryptoKey) => Promise<EncString>;
|
||||||
encryptToBytes: (plainValue: ArrayBuffer, key?: SymmetricCryptoKey) => Promise<EncArrayBuffer>;
|
encryptToBytes: (plainValue: ArrayBuffer, key?: SymmetricCryptoKey) => Promise<EncArrayBuffer>;
|
||||||
|
|||||||
@@ -6,35 +6,35 @@ export abstract class CryptoFunctionService {
|
|||||||
password: string | ArrayBuffer,
|
password: string | ArrayBuffer,
|
||||||
salt: string | ArrayBuffer,
|
salt: string | ArrayBuffer,
|
||||||
algorithm: "sha256" | "sha512",
|
algorithm: "sha256" | "sha512",
|
||||||
iterations: number
|
iterations: number,
|
||||||
) => Promise<ArrayBuffer>;
|
) => Promise<ArrayBuffer>;
|
||||||
hkdf: (
|
hkdf: (
|
||||||
ikm: ArrayBuffer,
|
ikm: ArrayBuffer,
|
||||||
salt: string | ArrayBuffer,
|
salt: string | ArrayBuffer,
|
||||||
info: string | ArrayBuffer,
|
info: string | ArrayBuffer,
|
||||||
outputByteSize: number,
|
outputByteSize: number,
|
||||||
algorithm: "sha256" | "sha512"
|
algorithm: "sha256" | "sha512",
|
||||||
) => Promise<ArrayBuffer>;
|
) => Promise<ArrayBuffer>;
|
||||||
hkdfExpand: (
|
hkdfExpand: (
|
||||||
prk: ArrayBuffer,
|
prk: ArrayBuffer,
|
||||||
info: string | ArrayBuffer,
|
info: string | ArrayBuffer,
|
||||||
outputByteSize: number,
|
outputByteSize: number,
|
||||||
algorithm: "sha256" | "sha512"
|
algorithm: "sha256" | "sha512",
|
||||||
) => Promise<ArrayBuffer>;
|
) => Promise<ArrayBuffer>;
|
||||||
hash: (
|
hash: (
|
||||||
value: string | ArrayBuffer,
|
value: string | ArrayBuffer,
|
||||||
algorithm: "sha1" | "sha256" | "sha512" | "md5"
|
algorithm: "sha1" | "sha256" | "sha512" | "md5",
|
||||||
) => Promise<ArrayBuffer>;
|
) => Promise<ArrayBuffer>;
|
||||||
hmac: (
|
hmac: (
|
||||||
value: ArrayBuffer,
|
value: ArrayBuffer,
|
||||||
key: ArrayBuffer,
|
key: ArrayBuffer,
|
||||||
algorithm: "sha1" | "sha256" | "sha512"
|
algorithm: "sha1" | "sha256" | "sha512",
|
||||||
) => Promise<ArrayBuffer>;
|
) => Promise<ArrayBuffer>;
|
||||||
compare: (a: ArrayBuffer, b: ArrayBuffer) => Promise<boolean>;
|
compare: (a: ArrayBuffer, b: ArrayBuffer) => Promise<boolean>;
|
||||||
hmacFast: (
|
hmacFast: (
|
||||||
value: ArrayBuffer | string,
|
value: ArrayBuffer | string,
|
||||||
key: ArrayBuffer | string,
|
key: ArrayBuffer | string,
|
||||||
algorithm: "sha1" | "sha256" | "sha512"
|
algorithm: "sha1" | "sha256" | "sha512",
|
||||||
) => Promise<ArrayBuffer | string>;
|
) => Promise<ArrayBuffer | string>;
|
||||||
compareFast: (a: ArrayBuffer | string, b: ArrayBuffer | string) => Promise<boolean>;
|
compareFast: (a: ArrayBuffer | string, b: ArrayBuffer | string) => Promise<boolean>;
|
||||||
aesEncrypt: (data: ArrayBuffer, iv: ArrayBuffer, key: ArrayBuffer) => Promise<ArrayBuffer>;
|
aesEncrypt: (data: ArrayBuffer, iv: ArrayBuffer, key: ArrayBuffer) => Promise<ArrayBuffer>;
|
||||||
@@ -42,19 +42,19 @@ export abstract class CryptoFunctionService {
|
|||||||
data: string,
|
data: string,
|
||||||
iv: string,
|
iv: string,
|
||||||
mac: string,
|
mac: string,
|
||||||
key: SymmetricCryptoKey
|
key: SymmetricCryptoKey,
|
||||||
) => DecryptParameters<ArrayBuffer | string>;
|
) => DecryptParameters<ArrayBuffer | string>;
|
||||||
aesDecryptFast: (parameters: DecryptParameters<ArrayBuffer | string>) => Promise<string>;
|
aesDecryptFast: (parameters: DecryptParameters<ArrayBuffer | string>) => Promise<string>;
|
||||||
aesDecrypt: (data: ArrayBuffer, iv: ArrayBuffer, key: ArrayBuffer) => Promise<ArrayBuffer>;
|
aesDecrypt: (data: ArrayBuffer, iv: ArrayBuffer, key: ArrayBuffer) => Promise<ArrayBuffer>;
|
||||||
rsaEncrypt: (
|
rsaEncrypt: (
|
||||||
data: ArrayBuffer,
|
data: ArrayBuffer,
|
||||||
publicKey: ArrayBuffer,
|
publicKey: ArrayBuffer,
|
||||||
algorithm: "sha1" | "sha256"
|
algorithm: "sha1" | "sha256",
|
||||||
) => Promise<ArrayBuffer>;
|
) => Promise<ArrayBuffer>;
|
||||||
rsaDecrypt: (
|
rsaDecrypt: (
|
||||||
data: ArrayBuffer,
|
data: ArrayBuffer,
|
||||||
privateKey: ArrayBuffer,
|
privateKey: ArrayBuffer,
|
||||||
algorithm: "sha1" | "sha256"
|
algorithm: "sha1" | "sha256",
|
||||||
) => Promise<ArrayBuffer>;
|
) => Promise<ArrayBuffer>;
|
||||||
rsaExtractPublicKey: (privateKey: ArrayBuffer) => Promise<ArrayBuffer>;
|
rsaExtractPublicKey: (privateKey: ArrayBuffer) => Promise<ArrayBuffer>;
|
||||||
rsaGenerateKeyPair: (length: 1024 | 2048 | 4096) => Promise<[ArrayBuffer, ArrayBuffer]>;
|
rsaGenerateKeyPair: (length: 1024 | 2048 | 4096) => Promise<[ArrayBuffer, ArrayBuffer]>;
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
import { EventType } from "../enums/eventType";
|
|
||||||
|
|
||||||
export abstract class EventService {
|
|
||||||
collect: (eventType: EventType, cipherId?: string, uploadImmediately?: boolean) => Promise<any>;
|
|
||||||
uploadEvents: (userId?: string) => Promise<any>;
|
|
||||||
clearEvents: (userId?: string) => Promise<any>;
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
import { EncArrayBuffer } from "../models/domain/encArrayBuffer";
|
|
||||||
import { EncString } from "../models/domain/encString";
|
|
||||||
import { AttachmentUploadDataResponse } from "../models/response/attachmentUploadDataResponse";
|
|
||||||
import { SendFileUploadDataResponse } from "../models/response/sendFileUploadDataResponse";
|
|
||||||
|
|
||||||
export abstract class FileUploadService {
|
|
||||||
uploadSendFile: (
|
|
||||||
uploadData: SendFileUploadDataResponse,
|
|
||||||
fileName: EncString,
|
|
||||||
encryptedFileData: EncArrayBuffer
|
|
||||||
) => Promise<any>;
|
|
||||||
uploadCipherAttachment: (
|
|
||||||
admin: boolean,
|
|
||||||
uploadData: AttachmentUploadDataResponse,
|
|
||||||
fileName: EncString,
|
|
||||||
encryptedFileData: EncArrayBuffer
|
|
||||||
) => Promise<any>;
|
|
||||||
}
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
import { FolderData } from "../models/data/folderData";
|
|
||||||
import { Folder } from "../models/domain/folder";
|
|
||||||
import { SymmetricCryptoKey } from "../models/domain/symmetricCryptoKey";
|
|
||||||
import { TreeNode } from "../models/domain/treeNode";
|
|
||||||
import { FolderView } from "../models/view/folderView";
|
|
||||||
|
|
||||||
export abstract class FolderService {
|
|
||||||
clearCache: (userId?: string) => Promise<void>;
|
|
||||||
encrypt: (model: FolderView, key?: SymmetricCryptoKey) => Promise<Folder>;
|
|
||||||
get: (id: string) => Promise<Folder>;
|
|
||||||
getAll: () => Promise<Folder[]>;
|
|
||||||
getAllDecrypted: () => Promise<FolderView[]>;
|
|
||||||
getAllNested: () => Promise<TreeNode<FolderView>[]>;
|
|
||||||
getNested: (id: string) => Promise<TreeNode<FolderView>>;
|
|
||||||
saveWithServer: (folder: Folder) => Promise<any>;
|
|
||||||
upsert: (folder: FolderData | FolderData[]) => Promise<any>;
|
|
||||||
replace: (folders: { [id: string]: FolderData }) => Promise<any>;
|
|
||||||
clear: (userId: string) => Promise<any>;
|
|
||||||
delete: (id: string | string[]) => Promise<any>;
|
|
||||||
deleteWithServer: (id: string) => Promise<any>;
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
import { Organization } from "../models/domain/organization";
|
|
||||||
import { IdentityTokenResponse } from "../models/response/identityTokenResponse";
|
|
||||||
|
|
||||||
export abstract class KeyConnectorService {
|
|
||||||
getAndSetKey: (url?: string) => Promise<void>;
|
|
||||||
getManagingOrganization: () => Promise<Organization>;
|
|
||||||
getUsesKeyConnector: () => Promise<boolean>;
|
|
||||||
migrateUser: () => Promise<void>;
|
|
||||||
userNeedsMigration: () => Promise<boolean>;
|
|
||||||
convertNewSsoUserToKeyConnector: (
|
|
||||||
tokenResponse: IdentityTokenResponse,
|
|
||||||
orgId: string
|
|
||||||
) => Promise<void>;
|
|
||||||
setUsesKeyConnector: (enabled: boolean) => Promise<void>;
|
|
||||||
setConvertAccountRequired: (status: boolean) => Promise<void>;
|
|
||||||
getConvertAccountRequired: () => Promise<boolean>;
|
|
||||||
removeConvertAccountRequired: () => Promise<void>;
|
|
||||||
clear: () => Promise<void>;
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
export abstract class NotificationsService {
|
|
||||||
init: () => Promise<void>;
|
|
||||||
updateConnection: (sync?: boolean) => Promise<void>;
|
|
||||||
reconnectFromActivity: () => Promise<void>;
|
|
||||||
disconnectFromInactivity: () => Promise<void>;
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
import { OrganizationData } from "../models/data/organizationData";
|
|
||||||
import { Organization } from "../models/domain/organization";
|
|
||||||
|
|
||||||
export abstract class OrganizationService {
|
|
||||||
get: (id: string) => Promise<Organization>;
|
|
||||||
getByIdentifier: (identifier: string) => Promise<Organization>;
|
|
||||||
getAll: (userId?: string) => Promise<Organization[]>;
|
|
||||||
save: (orgs: { [id: string]: OrganizationData }) => Promise<any>;
|
|
||||||
canManageSponsorships: () => Promise<boolean>;
|
|
||||||
hasOrganizations: (userId?: string) => Promise<boolean>;
|
|
||||||
}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
import * as zxcvbn from "zxcvbn";
|
|
||||||
|
|
||||||
import { GeneratedPasswordHistory } from "../models/domain/generatedPasswordHistory";
|
|
||||||
import { PasswordGeneratorPolicyOptions } from "../models/domain/passwordGeneratorPolicyOptions";
|
|
||||||
|
|
||||||
export abstract class PasswordGenerationService {
|
|
||||||
generatePassword: (options: any) => Promise<string>;
|
|
||||||
generatePassphrase: (options: any) => Promise<string>;
|
|
||||||
getOptions: () => Promise<[any, PasswordGeneratorPolicyOptions]>;
|
|
||||||
enforcePasswordGeneratorPoliciesOnOptions: (
|
|
||||||
options: any
|
|
||||||
) => Promise<[any, PasswordGeneratorPolicyOptions]>;
|
|
||||||
getPasswordGeneratorPolicyOptions: () => Promise<PasswordGeneratorPolicyOptions>;
|
|
||||||
saveOptions: (options: any) => Promise<any>;
|
|
||||||
getHistory: () => Promise<GeneratedPasswordHistory[]>;
|
|
||||||
addHistory: (password: string) => Promise<any>;
|
|
||||||
clear: (userId?: string) => Promise<any>;
|
|
||||||
passwordStrength: (password: string, userInputs?: string[]) => zxcvbn.ZXCVBNResult;
|
|
||||||
normalizeOptions: (options: any, enforcedPolicyOptions: PasswordGeneratorPolicyOptions) => void;
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
export abstract class PasswordRepromptService {
|
|
||||||
protectedFields: () => string[];
|
|
||||||
showPasswordPrompt: () => Promise<boolean>;
|
|
||||||
enabled: () => Promise<boolean>;
|
|
||||||
}
|
|
||||||
@@ -27,7 +27,7 @@ export abstract class PlatformUtilsService {
|
|||||||
type: "error" | "success" | "warning" | "info",
|
type: "error" | "success" | "warning" | "info",
|
||||||
title: string,
|
title: string,
|
||||||
text: string | string[],
|
text: string | string[],
|
||||||
options?: ToastOptions
|
options?: ToastOptions,
|
||||||
) => void;
|
) => void;
|
||||||
showDialog: (
|
showDialog: (
|
||||||
body: string,
|
body: string,
|
||||||
@@ -35,7 +35,7 @@ export abstract class PlatformUtilsService {
|
|||||||
confirmText?: string,
|
confirmText?: string,
|
||||||
cancelText?: string,
|
cancelText?: string,
|
||||||
type?: string,
|
type?: string,
|
||||||
bodyIsHtml?: boolean
|
bodyIsHtml?: boolean,
|
||||||
) => Promise<boolean>;
|
) => Promise<boolean>;
|
||||||
isDev: () => boolean;
|
isDev: () => boolean;
|
||||||
isSelfHost: () => boolean;
|
isSelfHost: () => boolean;
|
||||||
@@ -45,7 +45,7 @@ export abstract class PlatformUtilsService {
|
|||||||
authenticateBiometric: () => Promise<boolean>;
|
authenticateBiometric: () => Promise<boolean>;
|
||||||
getDefaultSystemTheme: () => Promise<ThemeType.Light | ThemeType.Dark>;
|
getDefaultSystemTheme: () => Promise<ThemeType.Light | ThemeType.Dark>;
|
||||||
onDefaultSystemThemeChange: (
|
onDefaultSystemThemeChange: (
|
||||||
callback: (theme: ThemeType.Light | ThemeType.Dark) => unknown
|
callback: (theme: ThemeType.Light | ThemeType.Dark) => unknown,
|
||||||
) => unknown;
|
) => unknown;
|
||||||
getEffectiveTheme: () => Promise<ThemeType>;
|
getEffectiveTheme: () => Promise<ThemeType>;
|
||||||
supportsSecureStorage: () => boolean;
|
supportsSecureStorage: () => boolean;
|
||||||
|
|||||||
@@ -1,32 +0,0 @@
|
|||||||
import { PolicyType } from "../enums/policyType";
|
|
||||||
import { PolicyData } from "../models/data/policyData";
|
|
||||||
import { MasterPasswordPolicyOptions } from "../models/domain/masterPasswordPolicyOptions";
|
|
||||||
import { Policy } from "../models/domain/policy";
|
|
||||||
import { ResetPasswordPolicyOptions } from "../models/domain/resetPasswordPolicyOptions";
|
|
||||||
import { ListResponse } from "../models/response/listResponse";
|
|
||||||
import { PolicyResponse } from "../models/response/policyResponse";
|
|
||||||
|
|
||||||
export abstract class PolicyService {
|
|
||||||
clearCache: () => void;
|
|
||||||
getAll: (type?: PolicyType, userId?: string) => Promise<Policy[]>;
|
|
||||||
getPolicyForOrganization: (policyType: PolicyType, organizationId: string) => Promise<Policy>;
|
|
||||||
replace: (policies: { [id: string]: PolicyData }) => Promise<any>;
|
|
||||||
clear: (userId?: string) => Promise<any>;
|
|
||||||
getMasterPasswordPoliciesForInvitedUsers: (orgId: string) => Promise<MasterPasswordPolicyOptions>;
|
|
||||||
getMasterPasswordPolicyOptions: (policies?: Policy[]) => Promise<MasterPasswordPolicyOptions>;
|
|
||||||
evaluateMasterPassword: (
|
|
||||||
passwordStrength: number,
|
|
||||||
newPassword: string,
|
|
||||||
enforcedPolicyOptions?: MasterPasswordPolicyOptions
|
|
||||||
) => boolean;
|
|
||||||
getResetPasswordPolicyOptions: (
|
|
||||||
policies: Policy[],
|
|
||||||
orgId: string
|
|
||||||
) => [ResetPasswordPolicyOptions, boolean];
|
|
||||||
mapPoliciesFromToken: (policiesResponse: ListResponse<PolicyResponse>) => Policy[];
|
|
||||||
policyAppliesToUser: (
|
|
||||||
policyType: PolicyType,
|
|
||||||
policyFilter?: (policy: Policy) => boolean,
|
|
||||||
userId?: string
|
|
||||||
) => Promise<boolean>;
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
import { ProviderData } from "../models/data/providerData";
|
|
||||||
import { Provider } from "../models/domain/provider";
|
|
||||||
|
|
||||||
export abstract class ProviderService {
|
|
||||||
get: (id: string) => Promise<Provider>;
|
|
||||||
getAll: () => Promise<Provider[]>;
|
|
||||||
save: (providers: { [id: string]: ProviderData }) => Promise<any>;
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
import { CipherView } from "../models/view/cipherView";
|
|
||||||
import { SendView } from "../models/view/sendView";
|
|
||||||
|
|
||||||
export abstract class SearchService {
|
|
||||||
indexedEntityId?: string = null;
|
|
||||||
clearIndex: () => void;
|
|
||||||
isSearchable: (query: string) => boolean;
|
|
||||||
indexCiphers: (indexedEntityGuid?: string, ciphersToIndex?: CipherView[]) => Promise<void>;
|
|
||||||
searchCiphers: (
|
|
||||||
query: string,
|
|
||||||
filter?: ((cipher: CipherView) => boolean) | ((cipher: CipherView) => boolean)[],
|
|
||||||
ciphers?: CipherView[]
|
|
||||||
) => Promise<CipherView[]>;
|
|
||||||
searchCiphersBasic: (ciphers: CipherView[], query: string, deleted?: boolean) => CipherView[];
|
|
||||||
searchSends: (sends: SendView[], query: string) => SendView[];
|
|
||||||
}
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
import { SendData } from "../models/data/sendData";
|
|
||||||
import { EncArrayBuffer } from "../models/domain/encArrayBuffer";
|
|
||||||
import { Send } from "../models/domain/send";
|
|
||||||
import { SymmetricCryptoKey } from "../models/domain/symmetricCryptoKey";
|
|
||||||
import { SendView } from "../models/view/sendView";
|
|
||||||
|
|
||||||
export abstract class SendService {
|
|
||||||
clearCache: () => Promise<void>;
|
|
||||||
encrypt: (
|
|
||||||
model: SendView,
|
|
||||||
file: File | ArrayBuffer,
|
|
||||||
password: string,
|
|
||||||
key?: SymmetricCryptoKey
|
|
||||||
) => Promise<[Send, EncArrayBuffer]>;
|
|
||||||
get: (id: string) => Promise<Send>;
|
|
||||||
getAll: () => Promise<Send[]>;
|
|
||||||
getAllDecrypted: () => Promise<SendView[]>;
|
|
||||||
saveWithServer: (sendData: [Send, EncArrayBuffer]) => Promise<any>;
|
|
||||||
upsert: (send: SendData | SendData[]) => Promise<any>;
|
|
||||||
replace: (sends: { [id: string]: SendData }) => Promise<any>;
|
|
||||||
clear: (userId: string) => Promise<any>;
|
|
||||||
delete: (id: string | string[]) => Promise<any>;
|
|
||||||
deleteWithServer: (id: string) => Promise<any>;
|
|
||||||
removePasswordWithServer: (id: string) => Promise<any>;
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
export abstract class SettingsService {
|
|
||||||
clearCache: () => Promise<void>;
|
|
||||||
getEquivalentDomains: () => Promise<any>;
|
|
||||||
setEquivalentDomains: (equivalentDomains: string[][]) => Promise<any>;
|
|
||||||
clear: (userId?: string) => Promise<void>;
|
|
||||||
}
|
|
||||||
@@ -82,23 +82,23 @@ export abstract class StateService<T extends Account = Account> {
|
|||||||
getDecryptedCryptoSymmetricKey: (options?: StorageOptions) => Promise<SymmetricCryptoKey>;
|
getDecryptedCryptoSymmetricKey: (options?: StorageOptions) => Promise<SymmetricCryptoKey>;
|
||||||
setDecryptedCryptoSymmetricKey: (
|
setDecryptedCryptoSymmetricKey: (
|
||||||
value: SymmetricCryptoKey,
|
value: SymmetricCryptoKey,
|
||||||
options?: StorageOptions
|
options?: StorageOptions,
|
||||||
) => Promise<void>;
|
) => Promise<void>;
|
||||||
getDecryptedFolders: (options?: StorageOptions) => Promise<FolderView[]>;
|
getDecryptedFolders: (options?: StorageOptions) => Promise<FolderView[]>;
|
||||||
setDecryptedFolders: (value: FolderView[], options?: StorageOptions) => Promise<void>;
|
setDecryptedFolders: (value: FolderView[], options?: StorageOptions) => Promise<void>;
|
||||||
getDecryptedOrganizationKeys: (
|
getDecryptedOrganizationKeys: (
|
||||||
options?: StorageOptions
|
options?: StorageOptions,
|
||||||
) => Promise<Map<string, SymmetricCryptoKey>>;
|
) => Promise<Map<string, SymmetricCryptoKey>>;
|
||||||
setDecryptedOrganizationKeys: (
|
setDecryptedOrganizationKeys: (
|
||||||
value: Map<string, SymmetricCryptoKey>,
|
value: Map<string, SymmetricCryptoKey>,
|
||||||
options?: StorageOptions
|
options?: StorageOptions,
|
||||||
) => Promise<void>;
|
) => Promise<void>;
|
||||||
getDecryptedPasswordGenerationHistory: (
|
getDecryptedPasswordGenerationHistory: (
|
||||||
options?: StorageOptions
|
options?: StorageOptions,
|
||||||
) => Promise<GeneratedPasswordHistory[]>;
|
) => Promise<GeneratedPasswordHistory[]>;
|
||||||
setDecryptedPasswordGenerationHistory: (
|
setDecryptedPasswordGenerationHistory: (
|
||||||
value: GeneratedPasswordHistory[],
|
value: GeneratedPasswordHistory[],
|
||||||
options?: StorageOptions
|
options?: StorageOptions,
|
||||||
) => Promise<void>;
|
) => Promise<void>;
|
||||||
getDecryptedPinProtected: (options?: StorageOptions) => Promise<EncString>;
|
getDecryptedPinProtected: (options?: StorageOptions) => Promise<EncString>;
|
||||||
setDecryptedPinProtected: (value: EncString, options?: StorageOptions) => Promise<void>;
|
setDecryptedPinProtected: (value: EncString, options?: StorageOptions) => Promise<void>;
|
||||||
@@ -109,7 +109,7 @@ export abstract class StateService<T extends Account = Account> {
|
|||||||
getDecryptedProviderKeys: (options?: StorageOptions) => Promise<Map<string, SymmetricCryptoKey>>;
|
getDecryptedProviderKeys: (options?: StorageOptions) => Promise<Map<string, SymmetricCryptoKey>>;
|
||||||
setDecryptedProviderKeys: (
|
setDecryptedProviderKeys: (
|
||||||
value: Map<string, SymmetricCryptoKey>,
|
value: Map<string, SymmetricCryptoKey>,
|
||||||
options?: StorageOptions
|
options?: StorageOptions,
|
||||||
) => Promise<void>;
|
) => Promise<void>;
|
||||||
getDecryptedSends: (options?: StorageOptions) => Promise<SendView[]>;
|
getDecryptedSends: (options?: StorageOptions) => Promise<SendView[]>;
|
||||||
setDecryptedSends: (value: SendView[], options?: StorageOptions) => Promise<void>;
|
setDecryptedSends: (value: SendView[], options?: StorageOptions) => Promise<void>;
|
||||||
@@ -126,7 +126,7 @@ export abstract class StateService<T extends Account = Account> {
|
|||||||
getDisableChangedPasswordNotification: (options?: StorageOptions) => Promise<boolean>;
|
getDisableChangedPasswordNotification: (options?: StorageOptions) => Promise<boolean>;
|
||||||
setDisableChangedPasswordNotification: (
|
setDisableChangedPasswordNotification: (
|
||||||
value: boolean,
|
value: boolean,
|
||||||
options?: StorageOptions
|
options?: StorageOptions,
|
||||||
) => Promise<void>;
|
) => Promise<void>;
|
||||||
getDisableContextMenuItem: (options?: StorageOptions) => Promise<boolean>;
|
getDisableContextMenuItem: (options?: StorageOptions) => Promise<boolean>;
|
||||||
setDisableContextMenuItem: (value: boolean, options?: StorageOptions) => Promise<void>;
|
setDisableContextMenuItem: (value: boolean, options?: StorageOptions) => Promise<void>;
|
||||||
@@ -153,7 +153,7 @@ export abstract class StateService<T extends Account = Account> {
|
|||||||
getEnableBrowserIntegrationFingerprint: (options?: StorageOptions) => Promise<boolean>;
|
getEnableBrowserIntegrationFingerprint: (options?: StorageOptions) => Promise<boolean>;
|
||||||
setEnableBrowserIntegrationFingerprint: (
|
setEnableBrowserIntegrationFingerprint: (
|
||||||
value: boolean,
|
value: boolean,
|
||||||
options?: StorageOptions
|
options?: StorageOptions,
|
||||||
) => Promise<void>;
|
) => Promise<void>;
|
||||||
getEnableCloseToTray: (options?: StorageOptions) => Promise<boolean>;
|
getEnableCloseToTray: (options?: StorageOptions) => Promise<boolean>;
|
||||||
setEnableCloseToTray: (value: boolean, options?: StorageOptions) => Promise<void>;
|
setEnableCloseToTray: (value: boolean, options?: StorageOptions) => Promise<void>;
|
||||||
@@ -170,38 +170,38 @@ export abstract class StateService<T extends Account = Account> {
|
|||||||
getEncryptedCiphers: (options?: StorageOptions) => Promise<{ [id: string]: CipherData }>;
|
getEncryptedCiphers: (options?: StorageOptions) => Promise<{ [id: string]: CipherData }>;
|
||||||
setEncryptedCiphers: (
|
setEncryptedCiphers: (
|
||||||
value: { [id: string]: CipherData },
|
value: { [id: string]: CipherData },
|
||||||
options?: StorageOptions
|
options?: StorageOptions,
|
||||||
) => Promise<void>;
|
) => Promise<void>;
|
||||||
getEncryptedCollections: (options?: StorageOptions) => Promise<{ [id: string]: CollectionData }>;
|
getEncryptedCollections: (options?: StorageOptions) => Promise<{ [id: string]: CollectionData }>;
|
||||||
setEncryptedCollections: (
|
setEncryptedCollections: (
|
||||||
value: { [id: string]: CollectionData },
|
value: { [id: string]: CollectionData },
|
||||||
options?: StorageOptions
|
options?: StorageOptions,
|
||||||
) => Promise<void>;
|
) => Promise<void>;
|
||||||
getEncryptedCryptoSymmetricKey: (options?: StorageOptions) => Promise<string>;
|
getEncryptedCryptoSymmetricKey: (options?: StorageOptions) => Promise<string>;
|
||||||
setEncryptedCryptoSymmetricKey: (value: string, options?: StorageOptions) => Promise<void>;
|
setEncryptedCryptoSymmetricKey: (value: string, options?: StorageOptions) => Promise<void>;
|
||||||
getEncryptedFolders: (options?: StorageOptions) => Promise<{ [id: string]: FolderData }>;
|
getEncryptedFolders: (options?: StorageOptions) => Promise<{ [id: string]: FolderData }>;
|
||||||
setEncryptedFolders: (
|
setEncryptedFolders: (
|
||||||
value: { [id: string]: FolderData },
|
value: { [id: string]: FolderData },
|
||||||
options?: StorageOptions
|
options?: StorageOptions,
|
||||||
) => Promise<void>;
|
) => Promise<void>;
|
||||||
getEncryptedOrganizationKeys: (options?: StorageOptions) => Promise<any>;
|
getEncryptedOrganizationKeys: (options?: StorageOptions) => Promise<any>;
|
||||||
setEncryptedOrganizationKeys: (
|
setEncryptedOrganizationKeys: (
|
||||||
value: Map<string, SymmetricCryptoKey>,
|
value: Map<string, SymmetricCryptoKey>,
|
||||||
options?: StorageOptions
|
options?: StorageOptions,
|
||||||
) => Promise<void>;
|
) => Promise<void>;
|
||||||
getEncryptedPasswordGenerationHistory: (
|
getEncryptedPasswordGenerationHistory: (
|
||||||
options?: StorageOptions
|
options?: StorageOptions,
|
||||||
) => Promise<GeneratedPasswordHistory[]>;
|
) => Promise<GeneratedPasswordHistory[]>;
|
||||||
setEncryptedPasswordGenerationHistory: (
|
setEncryptedPasswordGenerationHistory: (
|
||||||
value: GeneratedPasswordHistory[],
|
value: GeneratedPasswordHistory[],
|
||||||
options?: StorageOptions
|
options?: StorageOptions,
|
||||||
) => Promise<void>;
|
) => Promise<void>;
|
||||||
getEncryptedPinProtected: (options?: StorageOptions) => Promise<string>;
|
getEncryptedPinProtected: (options?: StorageOptions) => Promise<string>;
|
||||||
setEncryptedPinProtected: (value: string, options?: StorageOptions) => Promise<void>;
|
setEncryptedPinProtected: (value: string, options?: StorageOptions) => Promise<void>;
|
||||||
getEncryptedPolicies: (options?: StorageOptions) => Promise<{ [id: string]: PolicyData }>;
|
getEncryptedPolicies: (options?: StorageOptions) => Promise<{ [id: string]: PolicyData }>;
|
||||||
setEncryptedPolicies: (
|
setEncryptedPolicies: (
|
||||||
value: { [id: string]: PolicyData },
|
value: { [id: string]: PolicyData },
|
||||||
options?: StorageOptions
|
options?: StorageOptions,
|
||||||
) => Promise<void>;
|
) => Promise<void>;
|
||||||
getEncryptedPrivateKey: (options?: StorageOptions) => Promise<string>;
|
getEncryptedPrivateKey: (options?: StorageOptions) => Promise<string>;
|
||||||
setEncryptedPrivateKey: (value: string, options?: StorageOptions) => Promise<void>;
|
setEncryptedPrivateKey: (value: string, options?: StorageOptions) => Promise<void>;
|
||||||
@@ -210,9 +210,6 @@ export abstract class StateService<T extends Account = Account> {
|
|||||||
getEncryptedSends: (options?: StorageOptions) => Promise<{ [id: string]: SendData }>;
|
getEncryptedSends: (options?: StorageOptions) => Promise<{ [id: string]: SendData }>;
|
||||||
setEncryptedSends: (value: { [id: string]: SendData }, options?: StorageOptions) => Promise<void>;
|
setEncryptedSends: (value: { [id: string]: SendData }, options?: StorageOptions) => Promise<void>;
|
||||||
getEntityId: (options?: StorageOptions) => Promise<string>;
|
getEntityId: (options?: StorageOptions) => Promise<string>;
|
||||||
setEntityId: (value: string, options?: StorageOptions) => Promise<void>;
|
|
||||||
getEntityType: (options?: StorageOptions) => Promise<any>;
|
|
||||||
setEntityType: (value: string, options?: StorageOptions) => Promise<void>;
|
|
||||||
getEnvironmentUrls: (options?: StorageOptions) => Promise<EnvironmentUrls>;
|
getEnvironmentUrls: (options?: StorageOptions) => Promise<EnvironmentUrls>;
|
||||||
setEnvironmentUrls: (value: EnvironmentUrls, options?: StorageOptions) => Promise<void>;
|
setEnvironmentUrls: (value: EnvironmentUrls, options?: StorageOptions) => Promise<void>;
|
||||||
getEquivalentDomains: (options?: StorageOptions) => Promise<any>;
|
getEquivalentDomains: (options?: StorageOptions) => Promise<any>;
|
||||||
@@ -261,7 +258,7 @@ export abstract class StateService<T extends Account = Account> {
|
|||||||
getOrganizations: (options?: StorageOptions) => Promise<{ [id: string]: OrganizationData }>;
|
getOrganizations: (options?: StorageOptions) => Promise<{ [id: string]: OrganizationData }>;
|
||||||
setOrganizations: (
|
setOrganizations: (
|
||||||
value: { [id: string]: OrganizationData },
|
value: { [id: string]: OrganizationData },
|
||||||
options?: StorageOptions
|
options?: StorageOptions,
|
||||||
) => Promise<void>;
|
) => Promise<void>;
|
||||||
getPasswordGenerationOptions: (options?: StorageOptions) => Promise<any>;
|
getPasswordGenerationOptions: (options?: StorageOptions) => Promise<any>;
|
||||||
setPasswordGenerationOptions: (value: any, options?: StorageOptions) => Promise<void>;
|
setPasswordGenerationOptions: (value: any, options?: StorageOptions) => Promise<void>;
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
import {
|
|
||||||
SyncCipherNotification,
|
|
||||||
SyncFolderNotification,
|
|
||||||
SyncSendNotification,
|
|
||||||
} from "../models/response/notificationResponse";
|
|
||||||
|
|
||||||
export abstract class SyncService {
|
|
||||||
syncInProgress: boolean;
|
|
||||||
|
|
||||||
getLastSync: () => Promise<Date>;
|
|
||||||
setLastSync: (date: Date, userId?: string) => Promise<any>;
|
|
||||||
fullSync: (forceSync: boolean, allowThrowOnError?: boolean) => Promise<boolean>;
|
|
||||||
syncUpsertFolder: (notification: SyncFolderNotification, isEdit: boolean) => Promise<boolean>;
|
|
||||||
syncDeleteFolder: (notification: SyncFolderNotification) => Promise<boolean>;
|
|
||||||
syncUpsertCipher: (notification: SyncCipherNotification, isEdit: boolean) => Promise<boolean>;
|
|
||||||
syncDeleteCipher: (notification: SyncFolderNotification) => Promise<boolean>;
|
|
||||||
syncUpsertSend: (notification: SyncSendNotification, isEdit: boolean) => Promise<boolean>;
|
|
||||||
syncDeleteSend: (notification: SyncSendNotification) => Promise<boolean>;
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
export abstract class SystemService {
|
|
||||||
startProcessReload: () => Promise<void>;
|
|
||||||
cancelProcessReload: () => void;
|
|
||||||
clearClipboard: (clipboardValue: string, timeoutMs?: number) => Promise<void>;
|
|
||||||
clearPendingClipboard: () => Promise<any>;
|
|
||||||
}
|
|
||||||
@@ -4,7 +4,7 @@ export abstract class TokenService {
|
|||||||
setTokens: (
|
setTokens: (
|
||||||
accessToken: string,
|
accessToken: string,
|
||||||
refreshToken: string,
|
refreshToken: string,
|
||||||
clientIdClientSecret: [string, string]
|
clientIdClientSecret: [string, string],
|
||||||
) => Promise<any>;
|
) => Promise<any>;
|
||||||
setToken: (token: string) => Promise<any>;
|
setToken: (token: string) => Promise<any>;
|
||||||
getToken: () => Promise<string>;
|
getToken: () => Promise<string>;
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
export abstract class TotpService {
|
|
||||||
getCode: (key: string) => Promise<string>;
|
|
||||||
getTimeInterval: (key: string) => number;
|
|
||||||
isAutoCopyEnabled: () => Promise<boolean>;
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
import { TwoFactorProviderType } from "../enums/twoFactorProviderType";
|
|
||||||
import { IdentityTwoFactorResponse } from "../models/response/identityTwoFactorResponse";
|
|
||||||
|
|
||||||
export interface TwoFactorProviderDetails {
|
|
||||||
type: TwoFactorProviderType;
|
|
||||||
name: string;
|
|
||||||
description: string;
|
|
||||||
priority: number;
|
|
||||||
sort: number;
|
|
||||||
premium: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export abstract class TwoFactorService {
|
|
||||||
init: () => void;
|
|
||||||
getSupportedProviders: (win: Window) => TwoFactorProviderDetails[];
|
|
||||||
getDefaultProvider: (webAuthnSupported: boolean) => TwoFactorProviderType;
|
|
||||||
setSelectedProvider: (type: TwoFactorProviderType) => void;
|
|
||||||
clearSelectedProvider: () => void;
|
|
||||||
|
|
||||||
setProviders: (response: IdentityTwoFactorResponse) => void;
|
|
||||||
clearProviders: () => void;
|
|
||||||
getProviders: () => Map<TwoFactorProviderType, { [key: string]: string }>;
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
import { SecretVerificationRequest } from "../models/request/secretVerificationRequest";
|
|
||||||
import { Verification } from "../types/verification";
|
|
||||||
|
|
||||||
export abstract class UserVerificationService {
|
|
||||||
buildRequest: <T extends SecretVerificationRequest>(
|
|
||||||
verification: Verification,
|
|
||||||
requestClass?: new () => T,
|
|
||||||
alreadyHashed?: boolean
|
|
||||||
) => Promise<T>;
|
|
||||||
verifyUser: (verification: Verification) => Promise<boolean>;
|
|
||||||
requestOTP: () => Promise<void>;
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
export abstract class UsernameGenerationService {
|
|
||||||
generateUsername: (options: any) => Promise<string>;
|
|
||||||
generateWord: (options: any) => Promise<string>;
|
|
||||||
generateSubaddress: (options: any) => Promise<string>;
|
|
||||||
generateCatchall: (options: any) => Promise<string>;
|
|
||||||
getOptions: () => Promise<any>;
|
|
||||||
saveOptions: (options: any) => Promise<void>;
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
export abstract class VaultTimeoutService {
|
|
||||||
isLocked: (userId?: string) => Promise<boolean>;
|
|
||||||
checkVaultTimeout: () => Promise<void>;
|
|
||||||
lock: (allowSoftLock?: boolean, userId?: string) => Promise<void>;
|
|
||||||
logOut: (userId?: string) => Promise<void>;
|
|
||||||
setVaultTimeoutOptions: (vaultTimeout: number, vaultTimeoutAction: string) => Promise<void>;
|
|
||||||
getVaultTimeout: () => Promise<number>;
|
|
||||||
isPinLockSet: () => Promise<[boolean, boolean]>;
|
|
||||||
isBiometricLockSet: () => Promise<boolean>;
|
|
||||||
clear: (userId?: string) => Promise<any>;
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
export enum AuthenticationType {
|
|
||||||
Password = 0,
|
|
||||||
Sso = 1,
|
|
||||||
Api = 2,
|
|
||||||
}
|
|
||||||
@@ -6,14 +6,14 @@ import { GlobalStateFactory } from "./globalStateFactory";
|
|||||||
|
|
||||||
export class StateFactory<
|
export class StateFactory<
|
||||||
TGlobal extends GlobalState = GlobalState,
|
TGlobal extends GlobalState = GlobalState,
|
||||||
TAccount extends Account = Account
|
TAccount extends Account = Account,
|
||||||
> {
|
> {
|
||||||
private globalStateFactory: GlobalStateFactory<TGlobal>;
|
private globalStateFactory: GlobalStateFactory<TGlobal>;
|
||||||
private accountFactory: AccountFactory<TAccount>;
|
private accountFactory: AccountFactory<TAccount>;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
globalStateConstructor: new (init: Partial<TGlobal>) => TGlobal,
|
globalStateConstructor: new (init: Partial<TGlobal>) => TGlobal,
|
||||||
accountConstructor: new (init: Partial<TAccount>) => TAccount
|
accountConstructor: new (init: Partial<TAccount>) => TAccount,
|
||||||
) {
|
) {
|
||||||
this.globalStateFactory = new GlobalStateFactory(globalStateConstructor);
|
this.globalStateFactory = new GlobalStateFactory(globalStateConstructor);
|
||||||
this.accountFactory = new AccountFactory(accountConstructor);
|
this.accountFactory = new AccountFactory(accountConstructor);
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ export class CaptchaIFrame extends IFrameComponent {
|
|||||||
private i18nService: I18nService,
|
private i18nService: I18nService,
|
||||||
successCallback: (message: string) => any,
|
successCallback: (message: string) => any,
|
||||||
errorCallback: (message: string) => any,
|
errorCallback: (message: string) => any,
|
||||||
infoCallback: (message: string) => any
|
infoCallback: (message: string) => any,
|
||||||
) {
|
) {
|
||||||
super(
|
super(
|
||||||
win,
|
win,
|
||||||
@@ -26,13 +26,13 @@ export class CaptchaIFrame extends IFrameComponent {
|
|||||||
} else {
|
} else {
|
||||||
infoCallback(parsedMessage);
|
infoCallback(parsedMessage);
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
init(siteKey: string): void {
|
init(siteKey: string): void {
|
||||||
super.initComponent(
|
super.initComponent(
|
||||||
this.createParams({ siteKey: siteKey, locale: this.i18nService.translationLocale }, 1)
|
this.createParams({ siteKey: siteKey, locale: this.i18nService.translationLocale }, 1),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ export abstract class IFrameComponent {
|
|||||||
private iframeId: string,
|
private iframeId: string,
|
||||||
public successCallback?: (message: string) => any,
|
public successCallback?: (message: string) => any,
|
||||||
public errorCallback?: (message: string) => any,
|
public errorCallback?: (message: string) => any,
|
||||||
public infoCallback?: (message: string) => any
|
public infoCallback?: (message: string) => any,
|
||||||
) {
|
) {
|
||||||
this.connectorLink = win.document.createElement("a");
|
this.connectorLink = win.document.createElement("a");
|
||||||
}
|
}
|
||||||
@@ -35,7 +35,7 @@ export abstract class IFrameComponent {
|
|||||||
return btoa(
|
return btoa(
|
||||||
encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, (match, p1) => {
|
encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, (match, p1) => {
|
||||||
return String.fromCharCode(("0x" + p1) as any);
|
return String.fromCharCode(("0x" + p1) as any);
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,10 @@ import { LinkedIdType } from "../enums/linkedIdType";
|
|||||||
import { ItemView } from "../models/view/itemView";
|
import { ItemView } from "../models/view/itemView";
|
||||||
|
|
||||||
export class LinkedMetadata {
|
export class LinkedMetadata {
|
||||||
constructor(readonly propertyKey: string, private readonly _i18nKey?: string) {}
|
constructor(
|
||||||
|
readonly propertyKey: string,
|
||||||
|
private readonly _i18nKey?: string,
|
||||||
|
) {}
|
||||||
|
|
||||||
get i18nKey() {
|
get i18nKey() {
|
||||||
return this._i18nKey ?? this.propertyKey;
|
return this._i18nKey ?? this.propertyKey;
|
||||||
|
|||||||
@@ -1,70 +0,0 @@
|
|||||||
import { ApiService } from "../../abstractions/api.service";
|
|
||||||
import { AppIdService } from "../../abstractions/appId.service";
|
|
||||||
import { CryptoService } from "../../abstractions/crypto.service";
|
|
||||||
import { EnvironmentService } from "../../abstractions/environment.service";
|
|
||||||
import { KeyConnectorService } from "../../abstractions/keyConnector.service";
|
|
||||||
import { LogService } from "../../abstractions/log.service";
|
|
||||||
import { MessagingService } from "../../abstractions/messaging.service";
|
|
||||||
import { PlatformUtilsService } from "../../abstractions/platformUtils.service";
|
|
||||||
import { StateService } from "../../abstractions/state.service";
|
|
||||||
import { TokenService } from "../../abstractions/token.service";
|
|
||||||
import { TwoFactorService } from "../../abstractions/twoFactor.service";
|
|
||||||
import { ApiLogInCredentials } from "../../models/domain/logInCredentials";
|
|
||||||
import { ApiTokenRequest } from "../../models/request/identityToken/apiTokenRequest";
|
|
||||||
import { IdentityTokenResponse } from "../../models/response/identityTokenResponse";
|
|
||||||
|
|
||||||
import { LogInStrategy } from "./logIn.strategy";
|
|
||||||
|
|
||||||
export class ApiLogInStrategy extends LogInStrategy {
|
|
||||||
tokenRequest: ApiTokenRequest;
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
cryptoService: CryptoService,
|
|
||||||
apiService: ApiService,
|
|
||||||
tokenService: TokenService,
|
|
||||||
appIdService: AppIdService,
|
|
||||||
platformUtilsService: PlatformUtilsService,
|
|
||||||
messagingService: MessagingService,
|
|
||||||
logService: LogService,
|
|
||||||
stateService: StateService,
|
|
||||||
twoFactorService: TwoFactorService,
|
|
||||||
private environmentService: EnvironmentService,
|
|
||||||
private keyConnectorService: KeyConnectorService
|
|
||||||
) {
|
|
||||||
super(
|
|
||||||
cryptoService,
|
|
||||||
apiService,
|
|
||||||
tokenService,
|
|
||||||
appIdService,
|
|
||||||
platformUtilsService,
|
|
||||||
messagingService,
|
|
||||||
logService,
|
|
||||||
stateService,
|
|
||||||
twoFactorService
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
async onSuccessfulLogin(tokenResponse: IdentityTokenResponse) {
|
|
||||||
if (tokenResponse.apiUseKeyConnector) {
|
|
||||||
const keyConnectorUrl = this.environmentService.getKeyConnectorUrl();
|
|
||||||
await this.keyConnectorService.getAndSetKey(keyConnectorUrl);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async logIn(credentials: ApiLogInCredentials) {
|
|
||||||
this.tokenRequest = new ApiTokenRequest(
|
|
||||||
credentials.clientId,
|
|
||||||
credentials.clientSecret,
|
|
||||||
await this.buildTwoFactor(),
|
|
||||||
await this.buildDeviceRequest()
|
|
||||||
);
|
|
||||||
|
|
||||||
return this.startLogIn();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected async saveAccountInformation(tokenResponse: IdentityTokenResponse) {
|
|
||||||
await super.saveAccountInformation(tokenResponse);
|
|
||||||
await this.stateService.setApiKeyClientId(this.tokenRequest.clientId);
|
|
||||||
await this.stateService.setApiKeyClientSecret(this.tokenRequest.clientSecret);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,170 +0,0 @@
|
|||||||
import { ApiService } from "../../abstractions/api.service";
|
|
||||||
import { AppIdService } from "../../abstractions/appId.service";
|
|
||||||
import { CryptoService } from "../../abstractions/crypto.service";
|
|
||||||
import { LogService } from "../../abstractions/log.service";
|
|
||||||
import { MessagingService } from "../../abstractions/messaging.service";
|
|
||||||
import { PlatformUtilsService } from "../../abstractions/platformUtils.service";
|
|
||||||
import { StateService } from "../../abstractions/state.service";
|
|
||||||
import { TokenService } from "../../abstractions/token.service";
|
|
||||||
import { TwoFactorService } from "../../abstractions/twoFactor.service";
|
|
||||||
import { TwoFactorProviderType } from "../../enums/twoFactorProviderType";
|
|
||||||
import { Account, AccountProfile, AccountTokens } from "../../models/domain/account";
|
|
||||||
import { AuthResult } from "../../models/domain/authResult";
|
|
||||||
import {
|
|
||||||
ApiLogInCredentials,
|
|
||||||
PasswordLogInCredentials,
|
|
||||||
SsoLogInCredentials,
|
|
||||||
} from "../../models/domain/logInCredentials";
|
|
||||||
import { DeviceRequest } from "../../models/request/deviceRequest";
|
|
||||||
import { ApiTokenRequest } from "../../models/request/identityToken/apiTokenRequest";
|
|
||||||
import { PasswordTokenRequest } from "../../models/request/identityToken/passwordTokenRequest";
|
|
||||||
import { SsoTokenRequest } from "../../models/request/identityToken/ssoTokenRequest";
|
|
||||||
import { TokenRequestTwoFactor } from "../../models/request/identityToken/tokenRequestTwoFactor";
|
|
||||||
import { KeysRequest } from "../../models/request/keysRequest";
|
|
||||||
import { IdentityCaptchaResponse } from "../../models/response/identityCaptchaResponse";
|
|
||||||
import { IdentityTokenResponse } from "../../models/response/identityTokenResponse";
|
|
||||||
import { IdentityTwoFactorResponse } from "../../models/response/identityTwoFactorResponse";
|
|
||||||
|
|
||||||
export abstract class LogInStrategy {
|
|
||||||
protected abstract tokenRequest: ApiTokenRequest | PasswordTokenRequest | SsoTokenRequest;
|
|
||||||
protected captchaBypassToken: string = null;
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
protected cryptoService: CryptoService,
|
|
||||||
protected apiService: ApiService,
|
|
||||||
protected tokenService: TokenService,
|
|
||||||
protected appIdService: AppIdService,
|
|
||||||
protected platformUtilsService: PlatformUtilsService,
|
|
||||||
protected messagingService: MessagingService,
|
|
||||||
protected logService: LogService,
|
|
||||||
protected stateService: StateService,
|
|
||||||
protected twoFactorService: TwoFactorService
|
|
||||||
) {}
|
|
||||||
|
|
||||||
abstract logIn(
|
|
||||||
credentials: ApiLogInCredentials | PasswordLogInCredentials | SsoLogInCredentials
|
|
||||||
): Promise<AuthResult>;
|
|
||||||
|
|
||||||
async logInTwoFactor(
|
|
||||||
twoFactor: TokenRequestTwoFactor,
|
|
||||||
captchaResponse: string = null
|
|
||||||
): Promise<AuthResult> {
|
|
||||||
this.tokenRequest.setTwoFactor(twoFactor);
|
|
||||||
return this.startLogIn();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected async startLogIn(): Promise<AuthResult> {
|
|
||||||
this.twoFactorService.clearSelectedProvider();
|
|
||||||
|
|
||||||
const response = await this.apiService.postIdentityToken(this.tokenRequest);
|
|
||||||
|
|
||||||
if (response instanceof IdentityTwoFactorResponse) {
|
|
||||||
return this.processTwoFactorResponse(response);
|
|
||||||
} else if (response instanceof IdentityCaptchaResponse) {
|
|
||||||
return this.processCaptchaResponse(response);
|
|
||||||
} else if (response instanceof IdentityTokenResponse) {
|
|
||||||
return this.processTokenResponse(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new Error("Invalid response object.");
|
|
||||||
}
|
|
||||||
|
|
||||||
protected onSuccessfulLogin(response: IdentityTokenResponse): Promise<void> {
|
|
||||||
// Implemented in subclass if required
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected async buildDeviceRequest() {
|
|
||||||
const appId = await this.appIdService.getAppId();
|
|
||||||
return new DeviceRequest(appId, this.platformUtilsService);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected async buildTwoFactor(userProvidedTwoFactor?: TokenRequestTwoFactor) {
|
|
||||||
if (userProvidedTwoFactor != null) {
|
|
||||||
return userProvidedTwoFactor;
|
|
||||||
}
|
|
||||||
|
|
||||||
const storedTwoFactorToken = await this.tokenService.getTwoFactorToken();
|
|
||||||
if (storedTwoFactorToken != null) {
|
|
||||||
return new TokenRequestTwoFactor(TwoFactorProviderType.Remember, storedTwoFactorToken, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
return new TokenRequestTwoFactor();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected async saveAccountInformation(tokenResponse: IdentityTokenResponse) {
|
|
||||||
const accountInformation = await this.tokenService.decodeToken(tokenResponse.accessToken);
|
|
||||||
await this.stateService.addAccount(
|
|
||||||
new Account({
|
|
||||||
profile: {
|
|
||||||
...new AccountProfile(),
|
|
||||||
...{
|
|
||||||
userId: accountInformation.sub,
|
|
||||||
email: accountInformation.email,
|
|
||||||
hasPremiumPersonally: accountInformation.premium,
|
|
||||||
kdfIterations: tokenResponse.kdfIterations,
|
|
||||||
kdfType: tokenResponse.kdf,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
tokens: {
|
|
||||||
...new AccountTokens(),
|
|
||||||
...{
|
|
||||||
accessToken: tokenResponse.accessToken,
|
|
||||||
refreshToken: tokenResponse.refreshToken,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected async processTokenResponse(response: IdentityTokenResponse): Promise<AuthResult> {
|
|
||||||
const result = new AuthResult();
|
|
||||||
result.resetMasterPassword = response.resetMasterPassword;
|
|
||||||
result.forcePasswordReset = response.forcePasswordReset;
|
|
||||||
|
|
||||||
await this.saveAccountInformation(response);
|
|
||||||
|
|
||||||
if (response.twoFactorToken != null) {
|
|
||||||
await this.tokenService.setTwoFactorToken(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
const newSsoUser = response.key == null;
|
|
||||||
if (!newSsoUser) {
|
|
||||||
await this.cryptoService.setEncKey(response.key);
|
|
||||||
await this.cryptoService.setEncPrivateKey(
|
|
||||||
response.privateKey ?? (await this.createKeyPairForOldAccount())
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
await this.onSuccessfulLogin(response);
|
|
||||||
|
|
||||||
await this.stateService.setBiometricLocked(false);
|
|
||||||
this.messagingService.send("loggedIn");
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private async processTwoFactorResponse(response: IdentityTwoFactorResponse): Promise<AuthResult> {
|
|
||||||
const result = new AuthResult();
|
|
||||||
result.twoFactorProviders = response.twoFactorProviders2;
|
|
||||||
this.twoFactorService.setProviders(response);
|
|
||||||
this.captchaBypassToken = response.captchaToken ?? null;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private async processCaptchaResponse(response: IdentityCaptchaResponse): Promise<AuthResult> {
|
|
||||||
const result = new AuthResult();
|
|
||||||
result.captchaSiteKey = response.siteKey;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private async createKeyPairForOldAccount() {
|
|
||||||
try {
|
|
||||||
const [publicKey, privateKey] = await this.cryptoService.makeKeyPair();
|
|
||||||
await this.apiService.postAccountKeys(new KeysRequest(publicKey, privateKey.encryptedString));
|
|
||||||
return privateKey.encryptedString;
|
|
||||||
} catch (e) {
|
|
||||||
this.logService.error(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,95 +0,0 @@
|
|||||||
import { ApiService } from "../../abstractions/api.service";
|
|
||||||
import { AppIdService } from "../../abstractions/appId.service";
|
|
||||||
import { AuthService } from "../../abstractions/auth.service";
|
|
||||||
import { CryptoService } from "../../abstractions/crypto.service";
|
|
||||||
import { LogService } from "../../abstractions/log.service";
|
|
||||||
import { MessagingService } from "../../abstractions/messaging.service";
|
|
||||||
import { PlatformUtilsService } from "../../abstractions/platformUtils.service";
|
|
||||||
import { StateService } from "../../abstractions/state.service";
|
|
||||||
import { TokenService } from "../../abstractions/token.service";
|
|
||||||
import { TwoFactorService } from "../../abstractions/twoFactor.service";
|
|
||||||
import { HashPurpose } from "../../enums/hashPurpose";
|
|
||||||
import { AuthResult } from "../../models/domain/authResult";
|
|
||||||
import { PasswordLogInCredentials } from "../../models/domain/logInCredentials";
|
|
||||||
import { SymmetricCryptoKey } from "../../models/domain/symmetricCryptoKey";
|
|
||||||
import { PasswordTokenRequest } from "../../models/request/identityToken/passwordTokenRequest";
|
|
||||||
import { TokenRequestTwoFactor } from "../../models/request/identityToken/tokenRequestTwoFactor";
|
|
||||||
|
|
||||||
import { LogInStrategy } from "./logIn.strategy";
|
|
||||||
|
|
||||||
export class PasswordLogInStrategy extends LogInStrategy {
|
|
||||||
get email() {
|
|
||||||
return this.tokenRequest.email;
|
|
||||||
}
|
|
||||||
|
|
||||||
get masterPasswordHash() {
|
|
||||||
return this.tokenRequest.masterPasswordHash;
|
|
||||||
}
|
|
||||||
|
|
||||||
tokenRequest: PasswordTokenRequest;
|
|
||||||
|
|
||||||
private localHashedPassword: string;
|
|
||||||
private key: SymmetricCryptoKey;
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
cryptoService: CryptoService,
|
|
||||||
apiService: ApiService,
|
|
||||||
tokenService: TokenService,
|
|
||||||
appIdService: AppIdService,
|
|
||||||
platformUtilsService: PlatformUtilsService,
|
|
||||||
messagingService: MessagingService,
|
|
||||||
logService: LogService,
|
|
||||||
stateService: StateService,
|
|
||||||
twoFactorService: TwoFactorService,
|
|
||||||
private authService: AuthService
|
|
||||||
) {
|
|
||||||
super(
|
|
||||||
cryptoService,
|
|
||||||
apiService,
|
|
||||||
tokenService,
|
|
||||||
appIdService,
|
|
||||||
platformUtilsService,
|
|
||||||
messagingService,
|
|
||||||
logService,
|
|
||||||
stateService,
|
|
||||||
twoFactorService
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
async onSuccessfulLogin() {
|
|
||||||
await this.cryptoService.setKey(this.key);
|
|
||||||
await this.cryptoService.setKeyHash(this.localHashedPassword);
|
|
||||||
}
|
|
||||||
|
|
||||||
async logInTwoFactor(
|
|
||||||
twoFactor: TokenRequestTwoFactor,
|
|
||||||
captchaResponse: string
|
|
||||||
): Promise<AuthResult> {
|
|
||||||
this.tokenRequest.captchaResponse = captchaResponse ?? this.captchaBypassToken;
|
|
||||||
return super.logInTwoFactor(twoFactor);
|
|
||||||
}
|
|
||||||
|
|
||||||
async logIn(credentials: PasswordLogInCredentials) {
|
|
||||||
const { email, masterPassword, captchaToken, twoFactor } = credentials;
|
|
||||||
|
|
||||||
this.key = await this.authService.makePreloginKey(masterPassword, email);
|
|
||||||
|
|
||||||
// Hash the password early (before authentication) so we don't persist it in memory in plaintext
|
|
||||||
this.localHashedPassword = await this.cryptoService.hashPassword(
|
|
||||||
masterPassword,
|
|
||||||
this.key,
|
|
||||||
HashPurpose.LocalAuthorization
|
|
||||||
);
|
|
||||||
const hashedPassword = await this.cryptoService.hashPassword(masterPassword, this.key);
|
|
||||||
|
|
||||||
this.tokenRequest = new PasswordTokenRequest(
|
|
||||||
email,
|
|
||||||
hashedPassword,
|
|
||||||
captchaToken,
|
|
||||||
await this.buildTwoFactor(twoFactor),
|
|
||||||
await this.buildDeviceRequest()
|
|
||||||
);
|
|
||||||
|
|
||||||
return this.startLogIn();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,70 +0,0 @@
|
|||||||
import { ApiService } from "../../abstractions/api.service";
|
|
||||||
import { AppIdService } from "../../abstractions/appId.service";
|
|
||||||
import { CryptoService } from "../../abstractions/crypto.service";
|
|
||||||
import { KeyConnectorService } from "../../abstractions/keyConnector.service";
|
|
||||||
import { LogService } from "../../abstractions/log.service";
|
|
||||||
import { MessagingService } from "../../abstractions/messaging.service";
|
|
||||||
import { PlatformUtilsService } from "../../abstractions/platformUtils.service";
|
|
||||||
import { StateService } from "../../abstractions/state.service";
|
|
||||||
import { TokenService } from "../../abstractions/token.service";
|
|
||||||
import { TwoFactorService } from "../../abstractions/twoFactor.service";
|
|
||||||
import { SsoLogInCredentials } from "../../models/domain/logInCredentials";
|
|
||||||
import { SsoTokenRequest } from "../../models/request/identityToken/ssoTokenRequest";
|
|
||||||
import { IdentityTokenResponse } from "../../models/response/identityTokenResponse";
|
|
||||||
|
|
||||||
import { LogInStrategy } from "./logIn.strategy";
|
|
||||||
|
|
||||||
export class SsoLogInStrategy extends LogInStrategy {
|
|
||||||
tokenRequest: SsoTokenRequest;
|
|
||||||
orgId: string;
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
cryptoService: CryptoService,
|
|
||||||
apiService: ApiService,
|
|
||||||
tokenService: TokenService,
|
|
||||||
appIdService: AppIdService,
|
|
||||||
platformUtilsService: PlatformUtilsService,
|
|
||||||
messagingService: MessagingService,
|
|
||||||
logService: LogService,
|
|
||||||
stateService: StateService,
|
|
||||||
twoFactorService: TwoFactorService,
|
|
||||||
private keyConnectorService: KeyConnectorService
|
|
||||||
) {
|
|
||||||
super(
|
|
||||||
cryptoService,
|
|
||||||
apiService,
|
|
||||||
tokenService,
|
|
||||||
appIdService,
|
|
||||||
platformUtilsService,
|
|
||||||
messagingService,
|
|
||||||
logService,
|
|
||||||
stateService,
|
|
||||||
twoFactorService
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
async onSuccessfulLogin(tokenResponse: IdentityTokenResponse) {
|
|
||||||
const newSsoUser = tokenResponse.key == null;
|
|
||||||
|
|
||||||
if (tokenResponse.keyConnectorUrl != null) {
|
|
||||||
if (!newSsoUser) {
|
|
||||||
await this.keyConnectorService.getAndSetKey(tokenResponse.keyConnectorUrl);
|
|
||||||
} else {
|
|
||||||
await this.keyConnectorService.convertNewSsoUserToKeyConnector(tokenResponse, this.orgId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async logIn(credentials: SsoLogInCredentials) {
|
|
||||||
this.orgId = credentials.orgId;
|
|
||||||
this.tokenRequest = new SsoTokenRequest(
|
|
||||||
credentials.code,
|
|
||||||
credentials.codeVerifier,
|
|
||||||
credentials.redirectUrl,
|
|
||||||
await this.buildTwoFactor(credentials.twoFactor),
|
|
||||||
await this.buildDeviceRequest()
|
|
||||||
);
|
|
||||||
|
|
||||||
return this.startLogIn();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -7,7 +7,7 @@ export class ServiceUtils {
|
|||||||
parts: string[],
|
parts: string[],
|
||||||
obj: ITreeNodeObject,
|
obj: ITreeNodeObject,
|
||||||
parent: ITreeNodeObject,
|
parent: ITreeNodeObject,
|
||||||
delimiter: string
|
delimiter: string,
|
||||||
) {
|
) {
|
||||||
if (parts.length <= partIndex) {
|
if (parts.length <= partIndex) {
|
||||||
return;
|
return;
|
||||||
@@ -31,7 +31,7 @@ export class ServiceUtils {
|
|||||||
parts,
|
parts,
|
||||||
obj,
|
obj,
|
||||||
nodeTree[i].node,
|
nodeTree[i].node,
|
||||||
delimiter
|
delimiter,
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -48,14 +48,14 @@ export class ServiceUtils {
|
|||||||
[newPartName, ...parts.slice(partIndex + 2)],
|
[newPartName, ...parts.slice(partIndex + 2)],
|
||||||
obj,
|
obj,
|
||||||
parent,
|
parent,
|
||||||
delimiter
|
delimiter,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static getTreeNodeObject(
|
static getTreeNodeObject(
|
||||||
nodeTree: TreeNode<ITreeNodeObject>[],
|
nodeTree: TreeNode<ITreeNodeObject>[],
|
||||||
id: string
|
id: string,
|
||||||
): TreeNode<ITreeNodeObject> {
|
): TreeNode<ITreeNodeObject> {
|
||||||
for (let i = 0; i < nodeTree.length; i++) {
|
for (let i = 0; i < nodeTree.length; i++) {
|
||||||
if (nodeTree[i].node.id === id) {
|
if (nodeTree[i].node.id === id) {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ export function throttle(limit: number, throttleKey: (args: any[]) => string) {
|
|||||||
return <T>(
|
return <T>(
|
||||||
target: any,
|
target: any,
|
||||||
propertyKey: string | symbol,
|
propertyKey: string | symbol,
|
||||||
descriptor: TypedPropertyDescriptor<(...args: any[]) => Promise<T>>
|
descriptor: TypedPropertyDescriptor<(...args: any[]) => Promise<T>>,
|
||||||
) => {
|
) => {
|
||||||
const originalMethod: () => Promise<T> = descriptor.value;
|
const originalMethod: () => Promise<T> = descriptor.value;
|
||||||
const allThrottles = new Map<any, Map<string, (() => void)[]>>();
|
const allThrottles = new Map<any, Map<string, (() => void)[]>>();
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
/* eslint-disable no-useless-escape */
|
/* eslint-disable no-useless-escape */
|
||||||
import * as tldjs from "tldjs";
|
|
||||||
|
|
||||||
import { I18nService } from "../abstractions/i18n.service";
|
import { I18nService } from "../abstractions/i18n.service";
|
||||||
|
|
||||||
|
import * as tldjs from "tldjs";
|
||||||
|
|
||||||
const nodeURL = typeof window === "undefined" ? require("url") : null;
|
const nodeURL = typeof window === "undefined" ? require("url") : null;
|
||||||
|
|
||||||
export class Utils {
|
export class Utils {
|
||||||
@@ -185,7 +185,7 @@ export class Utils {
|
|||||||
static isGuid(id: string) {
|
static isGuid(id: string) {
|
||||||
return RegExp(
|
return RegExp(
|
||||||
/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/,
|
/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/,
|
||||||
"i"
|
"i",
|
||||||
).test(id);
|
).test(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -279,7 +279,7 @@ export class Utils {
|
|||||||
}
|
}
|
||||||
map.set(
|
map.set(
|
||||||
decodeURIComponent(parts[0]).toLowerCase(),
|
decodeURIComponent(parts[0]).toLowerCase(),
|
||||||
parts[1] == null ? "" : decodeURIComponent(parts[1])
|
parts[1] == null ? "" : decodeURIComponent(parts[1]),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
return map;
|
return map;
|
||||||
@@ -359,10 +359,10 @@ export class Utils {
|
|||||||
((a) => {
|
((a) => {
|
||||||
if (
|
if (
|
||||||
/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(
|
/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(
|
||||||
a
|
a,
|
||||||
) ||
|
) ||
|
||||||
/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(
|
/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(
|
||||||
a.substr(0, 4)
|
a.substr(0, 4),
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
mobile = true;
|
mobile = true;
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ export class WebAuthnIFrame {
|
|||||||
private i18nService: I18nService,
|
private i18nService: I18nService,
|
||||||
private successCallback: Function, // eslint-disable-line
|
private successCallback: Function, // eslint-disable-line
|
||||||
private errorCallback: Function, // eslint-disable-line
|
private errorCallback: Function, // eslint-disable-line
|
||||||
private infoCallback: Function // eslint-disable-line
|
private infoCallback: Function, // eslint-disable-line
|
||||||
) {
|
) {
|
||||||
this.connectorLink = win.document.createElement("a");
|
this.connectorLink = win.document.createElement("a");
|
||||||
}
|
}
|
||||||
@@ -31,7 +31,7 @@ export class WebAuthnIFrame {
|
|||||||
// Firefox fallback which opens the webauthn page in a new tab
|
// Firefox fallback which opens the webauthn page in a new tab
|
||||||
params.append("locale", this.i18nService.translationLocale);
|
params.append("locale", this.i18nService.translationLocale);
|
||||||
this.platformUtilsService.launchUri(
|
this.platformUtilsService.launchUri(
|
||||||
`${this.webVaultUrl}/webauthn-fallback-connector.html?${params}`
|
`${this.webVaultUrl}/webauthn-fallback-connector.html?${params}`,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
this.connectorLink.href = `${this.webVaultUrl}/webauthn-connector.html?${params}`;
|
this.connectorLink.href = `${this.webVaultUrl}/webauthn-connector.html?${params}`;
|
||||||
@@ -63,7 +63,7 @@ export class WebAuthnIFrame {
|
|||||||
return btoa(
|
return btoa(
|
||||||
encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, (match, p1) => {
|
encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, (match, p1) => {
|
||||||
return String.fromCharCode(("0x" + p1) as any);
|
return String.fromCharCode(("0x" + p1) as any);
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -126,10 +126,10 @@ export class SsoConfigApi extends BaseResponse {
|
|||||||
this.idpX509PublicCert = this.getResponseProperty("IdpX509PublicCert");
|
this.idpX509PublicCert = this.getResponseProperty("IdpX509PublicCert");
|
||||||
this.idpOutboundSigningAlgorithm = this.getResponseProperty("IdpOutboundSigningAlgorithm");
|
this.idpOutboundSigningAlgorithm = this.getResponseProperty("IdpOutboundSigningAlgorithm");
|
||||||
this.idpAllowUnsolicitedAuthnResponse = this.getResponseProperty(
|
this.idpAllowUnsolicitedAuthnResponse = this.getResponseProperty(
|
||||||
"IdpAllowUnsolicitedAuthnResponse"
|
"IdpAllowUnsolicitedAuthnResponse",
|
||||||
);
|
);
|
||||||
this.idpDisableOutboundLogoutRequests = this.getResponseProperty(
|
this.idpDisableOutboundLogoutRequests = this.getResponseProperty(
|
||||||
"IdpDisableOutboundLogoutRequests"
|
"IdpDisableOutboundLogoutRequests",
|
||||||
);
|
);
|
||||||
this.idpWantAuthnRequestsSigned = this.getResponseProperty("IdpWantAuthnRequestsSigned");
|
this.idpWantAuthnRequestsSigned = this.getResponseProperty("IdpWantAuthnRequestsSigned");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ export class Attachment extends Domain {
|
|||||||
fileName: null,
|
fileName: null,
|
||||||
key: null,
|
key: null,
|
||||||
},
|
},
|
||||||
["id", "url", "sizeName"]
|
["id", "url", "sizeName"],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ export class Attachment extends Domain {
|
|||||||
fileName: null,
|
fileName: null,
|
||||||
},
|
},
|
||||||
orgId,
|
orgId,
|
||||||
encKey
|
encKey,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (this.key != null) {
|
if (this.key != null) {
|
||||||
@@ -80,7 +80,7 @@ export class Attachment extends Domain {
|
|||||||
fileName: null,
|
fileName: null,
|
||||||
key: null,
|
key: null,
|
||||||
},
|
},
|
||||||
["id", "url", "sizeName"]
|
["id", "url", "sizeName"],
|
||||||
);
|
);
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
import { TwoFactorProviderType } from "../../enums/twoFactorProviderType";
|
|
||||||
import { Utils } from "../../misc/utils";
|
|
||||||
|
|
||||||
export class AuthResult {
|
|
||||||
captchaSiteKey = "";
|
|
||||||
resetMasterPassword = false;
|
|
||||||
forcePasswordReset = false;
|
|
||||||
twoFactorProviders: Map<TwoFactorProviderType, { [key: string]: string }> = null;
|
|
||||||
|
|
||||||
get requiresCaptcha() {
|
|
||||||
return !Utils.isNullOrWhitespace(this.captchaSiteKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
get requiresTwoFactor() {
|
|
||||||
return this.twoFactorProviders != null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -30,7 +30,7 @@ export class Card extends Domain {
|
|||||||
expYear: null,
|
expYear: null,
|
||||||
code: null,
|
code: null,
|
||||||
},
|
},
|
||||||
[]
|
[],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ export class Card extends Domain {
|
|||||||
code: null,
|
code: null,
|
||||||
},
|
},
|
||||||
orgId,
|
orgId,
|
||||||
encKey
|
encKey,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ export class Cipher extends Domain {
|
|||||||
name: null,
|
name: null,
|
||||||
notes: null,
|
notes: null,
|
||||||
},
|
},
|
||||||
["id", "userId", "organizationId", "folderId"]
|
["id", "userId", "organizationId", "folderId"],
|
||||||
);
|
);
|
||||||
|
|
||||||
this.type = obj.type;
|
this.type = obj.type;
|
||||||
@@ -119,7 +119,7 @@ export class Cipher extends Domain {
|
|||||||
notes: null,
|
notes: null,
|
||||||
},
|
},
|
||||||
this.organizationId,
|
this.organizationId,
|
||||||
encKey
|
encKey,
|
||||||
);
|
);
|
||||||
|
|
||||||
switch (this.type) {
|
switch (this.type) {
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ export class Collection extends Domain {
|
|||||||
readOnly: null,
|
readOnly: null,
|
||||||
hidePasswords: null,
|
hidePasswords: null,
|
||||||
},
|
},
|
||||||
["id", "organizationId", "externalId", "readOnly", "hidePasswords"]
|
["id", "organizationId", "externalId", "readOnly", "hidePasswords"],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ export class Collection extends Domain {
|
|||||||
{
|
{
|
||||||
name: null,
|
name: null,
|
||||||
},
|
},
|
||||||
this.organizationId
|
this.organizationId,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ export default class Domain {
|
|||||||
domain: D,
|
domain: D,
|
||||||
dataObj: any,
|
dataObj: any,
|
||||||
map: any,
|
map: any,
|
||||||
notEncList: any[] = []
|
notEncList: any[] = [],
|
||||||
) {
|
) {
|
||||||
for (const prop in map) {
|
for (const prop in map) {
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
@@ -28,7 +28,7 @@ export default class Domain {
|
|||||||
domain: D,
|
domain: D,
|
||||||
dataObj: any,
|
dataObj: any,
|
||||||
map: any,
|
map: any,
|
||||||
notEncStringList: any[] = []
|
notEncStringList: any[] = [],
|
||||||
) {
|
) {
|
||||||
for (const prop in map) {
|
for (const prop in map) {
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
@@ -49,7 +49,7 @@ export default class Domain {
|
|||||||
viewModel: T,
|
viewModel: T,
|
||||||
map: any,
|
map: any,
|
||||||
orgId: string,
|
orgId: string,
|
||||||
key: SymmetricCryptoKey = null
|
key: SymmetricCryptoKey = null,
|
||||||
): Promise<T> {
|
): Promise<T> {
|
||||||
const promises = [];
|
const promises = [];
|
||||||
const self: any = this;
|
const self: any = this;
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ export class EncString {
|
|||||||
encryptedStringOrType: string | EncryptionType,
|
encryptedStringOrType: string | EncryptionType,
|
||||||
data?: string,
|
data?: string,
|
||||||
iv?: string,
|
iv?: string,
|
||||||
mac?: string
|
mac?: string,
|
||||||
) {
|
) {
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
// data and header
|
// data and header
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ export class Field extends Domain {
|
|||||||
name: null,
|
name: null,
|
||||||
value: null,
|
value: null,
|
||||||
},
|
},
|
||||||
[]
|
[],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ export class Field extends Domain {
|
|||||||
value: null,
|
value: null,
|
||||||
},
|
},
|
||||||
orgId,
|
orgId,
|
||||||
encKey
|
encKey,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ export class Field extends Domain {
|
|||||||
type: null,
|
type: null,
|
||||||
linkedId: null,
|
linkedId: null,
|
||||||
},
|
},
|
||||||
["type", "linkedId"]
|
["type", "linkedId"],
|
||||||
);
|
);
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ export class Folder extends Domain {
|
|||||||
id: null,
|
id: null,
|
||||||
name: null,
|
name: null,
|
||||||
},
|
},
|
||||||
["id"]
|
["id"],
|
||||||
);
|
);
|
||||||
|
|
||||||
this.revisionDate = obj.revisionDate != null ? new Date(obj.revisionDate) : null;
|
this.revisionDate = obj.revisionDate != null ? new Date(obj.revisionDate) : null;
|
||||||
@@ -34,7 +34,7 @@ export class Folder extends Domain {
|
|||||||
{
|
{
|
||||||
name: null,
|
name: null,
|
||||||
},
|
},
|
||||||
null
|
null,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ export class Identity extends Domain {
|
|||||||
passportNumber: null,
|
passportNumber: null,
|
||||||
licenseNumber: null,
|
licenseNumber: null,
|
||||||
},
|
},
|
||||||
[]
|
[],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,7 +82,7 @@ export class Identity extends Domain {
|
|||||||
licenseNumber: null,
|
licenseNumber: null,
|
||||||
},
|
},
|
||||||
orgId,
|
orgId,
|
||||||
encKey
|
encKey,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,31 +0,0 @@
|
|||||||
import { AuthenticationType } from "../../enums/authenticationType";
|
|
||||||
import { TokenRequestTwoFactor } from "../request/identityToken/tokenRequestTwoFactor";
|
|
||||||
|
|
||||||
export class PasswordLogInCredentials {
|
|
||||||
readonly type = AuthenticationType.Password;
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
public email: string,
|
|
||||||
public masterPassword: string,
|
|
||||||
public captchaToken?: string,
|
|
||||||
public twoFactor?: TokenRequestTwoFactor
|
|
||||||
) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class SsoLogInCredentials {
|
|
||||||
readonly type = AuthenticationType.Sso;
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
public code: string,
|
|
||||||
public codeVerifier: string,
|
|
||||||
public redirectUrl: string,
|
|
||||||
public orgId: string,
|
|
||||||
public twoFactor?: TokenRequestTwoFactor
|
|
||||||
) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class ApiLogInCredentials {
|
|
||||||
readonly type = AuthenticationType.Api;
|
|
||||||
|
|
||||||
constructor(public clientId: string, public clientSecret: string) {}
|
|
||||||
}
|
|
||||||
@@ -31,7 +31,7 @@ export class Login extends Domain {
|
|||||||
password: null,
|
password: null,
|
||||||
totp: null,
|
totp: null,
|
||||||
},
|
},
|
||||||
[]
|
[],
|
||||||
);
|
);
|
||||||
|
|
||||||
if (obj.uris) {
|
if (obj.uris) {
|
||||||
@@ -51,7 +51,7 @@ export class Login extends Domain {
|
|||||||
totp: null,
|
totp: null,
|
||||||
},
|
},
|
||||||
orgId,
|
orgId,
|
||||||
encKey
|
encKey,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (this.uris != null) {
|
if (this.uris != null) {
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user