mirror of
https://github.com/standardnotes/app
synced 2026-09-13 09:46:02 -04:00
Compare commits
55
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b567d63b09 | ||
|
|
74458ab762 | ||
|
|
6b59810c70 | ||
|
|
1b48fec3dc | ||
|
|
ce96cd2998 | ||
|
|
f82974633b | ||
|
|
cd1b488769 | ||
|
|
6bd8a9c4e0 | ||
|
|
5617e37cd4 | ||
|
|
b10eb5f2e8 | ||
|
|
11110547f8 | ||
|
|
1da4b5e8ce | ||
|
|
2484c2147a | ||
|
|
c5324c0dd2 | ||
|
|
99b155cbf1 | ||
|
|
4ca0e89fcd | ||
|
|
b731c73cb2 | ||
|
|
3b531ce8bb | ||
|
|
a9edf671b1 | ||
|
|
9f50ad28b0 | ||
|
|
bff2fb624d | ||
|
|
0f1c8ef030 | ||
|
|
653af36363 | ||
|
|
5b88deeddb | ||
|
|
022be7d792 | ||
|
|
695d37beaa | ||
|
|
b08cff4dc2 | ||
|
|
1585d6b8ca | ||
|
|
0a51034b80 | ||
|
|
e253da6333 | ||
|
|
8a029950ec | ||
|
|
f0b3d939c5 | ||
|
|
a87d3c71f3 | ||
|
|
e4258a3e12 | ||
|
|
e2215f9a1f | ||
|
|
ee473fe34d | ||
|
|
cedd8e1006 | ||
|
|
4b278c4193 | ||
|
|
52ef2a8a70 | ||
|
|
8655bdb5dd | ||
|
|
d59e1befff | ||
|
|
a295b4f2f7 | ||
|
|
e61e1ff86d | ||
|
|
5473829c7e | ||
|
|
d2f8a36f19 | ||
|
|
1d60af0243 | ||
|
|
8f3ed30c44 | ||
|
|
3ae2b78116 | ||
|
|
4b24b58f21 | ||
|
|
07c23d24f0 | ||
|
|
eb4a446274 | ||
|
|
d8d4052a52 | ||
|
|
b07da5b663 | ||
|
|
ec309d6fb5 | ||
|
|
83b83cd96d |
@@ -3,6 +3,30 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.26.46](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-08)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/api
|
||||
|
||||
## [1.26.45](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-07)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/api
|
||||
|
||||
## [1.26.44](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-06)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/api
|
||||
|
||||
## [1.26.43](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-06)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/api
|
||||
|
||||
## [1.26.42](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-06)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/api
|
||||
|
||||
## [1.26.41](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-05)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/api
|
||||
|
||||
## [1.26.40](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-03)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/api
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@standardnotes/api",
|
||||
"version": "1.26.40",
|
||||
"version": "1.26.46",
|
||||
"engines": {
|
||||
"node": ">=16.0.0 <17.0.0"
|
||||
},
|
||||
|
||||
@@ -3,6 +3,70 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.1.156](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-08)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/clipper
|
||||
|
||||
## [1.1.155](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-08)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/clipper
|
||||
|
||||
## [1.1.154](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-08)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/clipper
|
||||
|
||||
## [1.1.153](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-07)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/clipper
|
||||
|
||||
## [1.1.152](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-07)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/clipper
|
||||
|
||||
## [1.1.151](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-07)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/clipper
|
||||
|
||||
## [1.1.150](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-07)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/clipper
|
||||
|
||||
## [1.1.149](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-07)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/clipper
|
||||
|
||||
## [1.1.148](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-07)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/clipper
|
||||
|
||||
## [1.1.147](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-07)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/clipper
|
||||
|
||||
## [1.1.146](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-06)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/clipper
|
||||
|
||||
## [1.1.145](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-06)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/clipper
|
||||
|
||||
## [1.1.144](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-06)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/clipper
|
||||
|
||||
## [1.1.143](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-06)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/clipper
|
||||
|
||||
## [1.1.142](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-06)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/clipper
|
||||
|
||||
## [1.1.141](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-05)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/clipper
|
||||
|
||||
## [1.1.140](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-04)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/clipper
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@standardnotes/clipper",
|
||||
"description": "Web clipper browser extension for Standard Notes",
|
||||
"version": "1.1.140",
|
||||
"version": "1.1.156",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build-mv2": "yarn clean && webpack --config ./webpack.config.prod.js",
|
||||
|
||||
@@ -3,6 +3,74 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [3.108.88](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-08)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/desktop
|
||||
|
||||
## [3.108.87](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-08)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/desktop
|
||||
|
||||
## [3.108.86](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-08)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/desktop
|
||||
|
||||
## [3.108.85](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-07)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/desktop
|
||||
|
||||
## [3.108.84](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-07)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/desktop
|
||||
|
||||
## [3.108.83](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-07)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/desktop
|
||||
|
||||
## [3.108.82](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-07)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/desktop
|
||||
|
||||
## [3.108.81](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-07)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/desktop
|
||||
|
||||
## [3.108.80](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-07)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/desktop
|
||||
|
||||
## [3.108.79](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-07)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/desktop
|
||||
|
||||
## [3.108.78](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-07)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/desktop
|
||||
|
||||
## [3.108.77](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-06)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/desktop
|
||||
|
||||
## [3.108.76](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-06)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/desktop
|
||||
|
||||
## [3.108.75](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-06)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/desktop
|
||||
|
||||
## [3.108.74](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-06)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/desktop
|
||||
|
||||
## [3.108.73](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-06)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/desktop
|
||||
|
||||
## [3.108.72](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-05)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/desktop
|
||||
|
||||
## [3.108.71](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-04)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/desktop
|
||||
|
||||
@@ -6,7 +6,9 @@ export function initializeZoomManager(window: BrowserWindow, store: Store): void
|
||||
window.webContents.on('dom-ready', () => {
|
||||
const zoomFactor = store.get(StoreKeys.ZoomFactor)
|
||||
if (zoomFactor) {
|
||||
window.webContents.zoomFactor = zoomFactor
|
||||
window.once('ready-to-show', () => {
|
||||
window.webContents.zoomFactor = zoomFactor
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@standardnotes/desktop",
|
||||
"main": "./app/dist/index.js",
|
||||
"version": "3.108.71",
|
||||
"version": "3.108.88",
|
||||
"license": "CC BY-NC-SA 4.0",
|
||||
"author": "Standard Notes.",
|
||||
"private": true,
|
||||
|
||||
@@ -3,6 +3,30 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.21.68](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-08)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/encryption
|
||||
|
||||
## [1.21.67](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-07)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/encryption
|
||||
|
||||
## [1.21.66](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-06)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/encryption
|
||||
|
||||
## [1.21.65](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-06)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/encryption
|
||||
|
||||
## [1.21.64](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-06)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/encryption
|
||||
|
||||
## [1.21.63](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-05)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/encryption
|
||||
|
||||
## [1.21.62](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-03)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/encryption
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@standardnotes/encryption",
|
||||
"version": "1.21.62",
|
||||
"version": "1.21.68",
|
||||
"engines": {
|
||||
"node": ">=16.0.0 <17.0.0"
|
||||
},
|
||||
|
||||
@@ -3,6 +3,30 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.28.78](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-08)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/filepicker
|
||||
|
||||
## [1.28.77](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-07)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/filepicker
|
||||
|
||||
## [1.28.76](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-06)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/filepicker
|
||||
|
||||
## [1.28.75](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-06)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/filepicker
|
||||
|
||||
## [1.28.74](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-06)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/filepicker
|
||||
|
||||
## [1.28.73](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-05)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/filepicker
|
||||
|
||||
## [1.28.72](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-03)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/filepicker
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@standardnotes/filepicker",
|
||||
"version": "1.28.72",
|
||||
"version": "1.28.78",
|
||||
"engines": {
|
||||
"node": ">=16.0.0 <17.0.0"
|
||||
},
|
||||
|
||||
@@ -3,6 +3,30 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.16.24](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-08)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/files
|
||||
|
||||
## [1.16.23](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-07)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/files
|
||||
|
||||
## [1.16.22](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-06)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/files
|
||||
|
||||
## [1.16.21](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-06)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/files
|
||||
|
||||
## [1.16.20](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-06)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/files
|
||||
|
||||
## [1.16.19](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-05)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/files
|
||||
|
||||
## [1.16.18](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-03)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/files
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@standardnotes/files",
|
||||
"version": "1.16.18",
|
||||
"version": "1.16.24",
|
||||
"engines": {
|
||||
"node": ">=16.0.0 <17.0.0"
|
||||
},
|
||||
|
||||
@@ -3,6 +3,70 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [3.56.67](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-08)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/mobile
|
||||
|
||||
## [3.56.66](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-08)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/mobile
|
||||
|
||||
## [3.56.65](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-08)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/mobile
|
||||
|
||||
## [3.56.64](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-07)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/mobile
|
||||
|
||||
## [3.56.63](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-07)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/mobile
|
||||
|
||||
## [3.56.62](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-07)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/mobile
|
||||
|
||||
## [3.56.61](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-07)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/mobile
|
||||
|
||||
## [3.56.60](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-07)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/mobile
|
||||
|
||||
## [3.56.59](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-07)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/mobile
|
||||
|
||||
## [3.56.58](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-07)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/mobile
|
||||
|
||||
## [3.56.57](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-06)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/mobile
|
||||
|
||||
## [3.56.56](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-06)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/mobile
|
||||
|
||||
## [3.56.55](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-06)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/mobile
|
||||
|
||||
## [3.56.54](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-06)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/mobile
|
||||
|
||||
## [3.56.53](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-06)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/mobile
|
||||
|
||||
## [3.56.52](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-05)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/mobile
|
||||
|
||||
## [3.56.51](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-04)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/mobile
|
||||
|
||||
@@ -723,7 +723,7 @@ EXTERNAL SOURCES:
|
||||
:path: "../node_modules/react-native/ReactCommon/yoga"
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
boost: 57d2868c099736d80fcd648bf211b4431e51a558
|
||||
boost: a7c83b31436843459a1961bfd74b96033dc77234
|
||||
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
|
||||
DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54
|
||||
FBLazyVector: 4cce221dd782d3ff7c4172167bba09d58af67ccb
|
||||
@@ -743,7 +743,7 @@ SPEC CHECKSUMS:
|
||||
MMKV: 9c4663aa7ca255d478ff10f2f5cb7d17c1651ccd
|
||||
MMKVCore: 89f5c8a66bba2dcd551779dea4d412eeec8ff5bb
|
||||
OpenSSL-Universal: ebc357f1e6bc71fa463ccb2fe676756aff50e88c
|
||||
RCT-Folly: 424b8c9a7a0b9ab2886ffe9c3b041ef628fd4fb1
|
||||
RCT-Folly: 0080d0a6ebf2577475bda044aa59e2ca1f909cda
|
||||
RCTRequired: a2faf4bad4e438ca37b2040cb8f7799baa065c18
|
||||
RCTTypeSafety: cb09f3e4747b6d18331a15eb05271de7441ca0b3
|
||||
React: 13109005b5353095c052f26af37413340ccf7a5d
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@standardnotes/mobile",
|
||||
"version": "3.56.51",
|
||||
"version": "3.56.67",
|
||||
"author": "Standard Notes.",
|
||||
"private": true,
|
||||
"license": "CC BY-NC-SA 4.0",
|
||||
|
||||
@@ -3,6 +3,32 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.47.5](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-08)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/models
|
||||
|
||||
## [1.47.4](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-07)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/models
|
||||
|
||||
## [1.47.3](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-06)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/models
|
||||
|
||||
## [1.47.2](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-06)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/models
|
||||
|
||||
## [1.47.1](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-06)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/models
|
||||
|
||||
# [1.47.0](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-05)
|
||||
|
||||
### Features
|
||||
|
||||
* Added translucency effect to menus, dialogs and alerts. Can be turned off from Preferences > Appeareance ([#2387](https://github.com/standardnotes/app/issues/2387)) [skip e2e] ([ec309d6](https://github.com/standardnotes/app/commit/ec309d6fb54c6cbb28414d1fe9d6119db5943d9c))
|
||||
|
||||
## [1.46.21](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-03)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/models
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@standardnotes/models",
|
||||
"version": "1.46.21",
|
||||
"version": "1.47.5",
|
||||
"engines": {
|
||||
"node": ">=16.0.0 <17.0.0"
|
||||
},
|
||||
|
||||
@@ -28,6 +28,7 @@ export enum PayloadEmitSource {
|
||||
|
||||
RemoteRetrieved,
|
||||
RemoteSaved,
|
||||
DesktopComponentSync,
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
@@ -1,5 +1,6 @@
|
||||
import { KeySystemRootKeyContentSpecialized } from '../../../Syncable/KeySystemRootKey/KeySystemRootKeyContent'
|
||||
import { ContactPublicKeySetJsonInterface } from '../../../Syncable/TrustedContact/PublicKeySet/ContactPublicKeySetJsonInterface'
|
||||
import { EmojiString, IconType } from '../../../Utilities/Icon/IconType'
|
||||
import { AsymmetricMessageDataCommon } from '../AsymmetricMessageDataCommon'
|
||||
import { AsymmetricMessagePayloadType } from '../AsymmetricMessagePayloadType'
|
||||
|
||||
@@ -17,6 +18,7 @@ export type AsymmetricMessageSharedVaultInvite = {
|
||||
metadata: {
|
||||
name: string
|
||||
description?: string
|
||||
iconString: IconType | EmojiString
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,10 +12,10 @@ import {
|
||||
isThemeFeatureDescription,
|
||||
} from '@standardnotes/features'
|
||||
import { ComponentInterface } from '../../Syncable/Component/ComponentInterface'
|
||||
import { isTheme } from '../../Syncable/Theme'
|
||||
import { isItemBasedFeature, isNativeFeature } from './TypeGuards'
|
||||
import { UIFeatureInterface } from './UIFeatureInterface'
|
||||
import { Uuid } from '@standardnotes/domain-core'
|
||||
import { ThemePackageInfo, isTheme } from '../../Syncable/Component'
|
||||
|
||||
export class UIFeature<F extends UIFeatureDescriptionTypes> implements UIFeatureInterface<F> {
|
||||
constructor(public readonly item: ComponentInterface | F) {}
|
||||
@@ -40,6 +40,14 @@ export class UIFeature<F extends UIFeatureDescriptionTypes> implements UIFeature
|
||||
throw new Error('Cannot cast item to component')
|
||||
}
|
||||
|
||||
get asTheme(): ComponentInterface<ThemePackageInfo> {
|
||||
if (isItemBasedFeature(this.item)) {
|
||||
return this.item
|
||||
}
|
||||
|
||||
throw new Error('Cannot cast item to component')
|
||||
}
|
||||
|
||||
get asFeatureDescription(): F {
|
||||
if (isNativeFeature(this.item)) {
|
||||
return this.item
|
||||
@@ -145,7 +153,7 @@ export class UIFeature<F extends UIFeatureDescriptionTypes> implements UIFeature
|
||||
|
||||
get layerable(): boolean {
|
||||
if (isItemBasedFeature(this.item) && isTheme(this.item)) {
|
||||
return this.item.layerable
|
||||
return this.item.layerableTheme
|
||||
} else if (isThemeFeatureDescription(this.asFeatureDescription)) {
|
||||
return this.asFeatureDescription.layerable ?? false
|
||||
}
|
||||
@@ -155,7 +163,7 @@ export class UIFeature<F extends UIFeatureDescriptionTypes> implements UIFeature
|
||||
|
||||
get dockIcon(): ThemeDockIcon | undefined {
|
||||
if (isItemBasedFeature(this.item) && isTheme(this.item)) {
|
||||
return this.item.package_info.dock_icon
|
||||
return this.asTheme.package_info.dock_icon
|
||||
} else if (isThemeFeatureDescription(this.asFeatureDescription)) {
|
||||
return this.asFeatureDescription.dock_icon
|
||||
}
|
||||
|
||||
@@ -2,14 +2,14 @@ import { PayloadSource } from './../../Abstract/Payload/Types/PayloadSource'
|
||||
import { DecryptedPayload } from './../../Abstract/Payload/Implementations/DecryptedPayload'
|
||||
import { ContentType } from '@standardnotes/domain-core'
|
||||
import { FillItemContent } from '../../Abstract/Content/ItemContent'
|
||||
import { SNComponent } from './Component'
|
||||
import { ComponentItem } from './Component'
|
||||
import { ComponentContent } from './ComponentContent'
|
||||
import { PayloadTimestampDefaults } from '../../Abstract/Payload'
|
||||
import { NoteType } from '@standardnotes/features'
|
||||
|
||||
describe('component model', () => {
|
||||
it('valid hosted url should ignore url', () => {
|
||||
const component = new SNComponent(
|
||||
const component = new ComponentItem(
|
||||
new DecryptedPayload(
|
||||
{
|
||||
uuid: String(Math.random()),
|
||||
@@ -29,7 +29,7 @@ describe('component model', () => {
|
||||
})
|
||||
|
||||
it('invalid hosted url should fallback to url', () => {
|
||||
const component = new SNComponent(
|
||||
const component = new ComponentItem(
|
||||
new DecryptedPayload(
|
||||
{
|
||||
uuid: String(Math.random()),
|
||||
@@ -49,7 +49,7 @@ describe('component model', () => {
|
||||
})
|
||||
|
||||
it('should return noteType as specified in package_info', () => {
|
||||
const component = new SNComponent(
|
||||
const component = new ComponentItem(
|
||||
new DecryptedPayload(
|
||||
{
|
||||
uuid: String(Math.random()),
|
||||
@@ -69,7 +69,7 @@ describe('component model', () => {
|
||||
})
|
||||
|
||||
it('should return unknown as noteType if no note type defined in package_info', () => {
|
||||
const component = new SNComponent(
|
||||
const component = new ComponentItem(
|
||||
new DecryptedPayload(
|
||||
{
|
||||
uuid: String(Math.random()),
|
||||
|
||||
@@ -17,34 +17,16 @@ import { DecryptedPayloadInterface } from '../../Abstract/Payload/Interfaces/Dec
|
||||
import { HistoryEntryInterface } from '../../Runtime/History'
|
||||
import { ItemContent } from '../../Abstract/Content/ItemContent'
|
||||
import { Predicate } from '../../Runtime/Predicate/Predicate'
|
||||
import { ItemInterface } from '../../Abstract/Item/Interfaces/ItemInterface'
|
||||
import { DecryptedItemInterface } from './../../Abstract/Item/Interfaces/DecryptedItem'
|
||||
import { ComponentPackageInfo } from './PackageInfo'
|
||||
import { isDecryptedItem } from '../../Abstract/Item'
|
||||
import { ComponentPackageInfo, ThemePackageInfo } from './PackageInfo'
|
||||
import { ContentType } from '@standardnotes/domain-core'
|
||||
|
||||
export function isComponent(x: ItemInterface): x is ComponentInterface {
|
||||
if (!isDecryptedItem(x as DecryptedItemInterface)) {
|
||||
return false
|
||||
}
|
||||
|
||||
return x.content_type === ContentType.TYPES.Component
|
||||
}
|
||||
|
||||
export function isComponentOrTheme(x: ItemInterface): x is ComponentInterface {
|
||||
if (!isDecryptedItem(x as DecryptedItemInterface)) {
|
||||
return false
|
||||
}
|
||||
|
||||
return x.content_type === ContentType.TYPES.Component || x.content_type === ContentType.TYPES.Theme
|
||||
}
|
||||
|
||||
/**
|
||||
* Components are mostly iframe based extensions that communicate with the SN parent
|
||||
* via the postMessage API. However, a theme can also be a component, which is activated
|
||||
* only by its url.
|
||||
*/
|
||||
export class SNComponent extends DecryptedItem<ComponentContent> implements ComponentInterface {
|
||||
export class ComponentItem extends DecryptedItem<ComponentContent> implements ComponentInterface {
|
||||
public readonly legacyComponentData: Record<string, unknown>
|
||||
/** Items that have requested a component to be disabled in its context */
|
||||
public readonly disassociatedItemIds: string[]
|
||||
@@ -61,7 +43,6 @@ export class SNComponent extends DecryptedItem<ComponentContent> implements Comp
|
||||
public readonly valid_until: Date
|
||||
public readonly legacyActive: boolean
|
||||
public readonly legacy_url?: string
|
||||
public readonly isMobileDefault: boolean
|
||||
|
||||
constructor(payload: DecryptedPayloadInterface<ComponentContent>) {
|
||||
super(payload)
|
||||
@@ -78,13 +59,18 @@ export class SNComponent extends DecryptedItem<ComponentContent> implements Comp
|
||||
this.valid_until = new Date(payload.content.valid_until || 0)
|
||||
this.offlineOnly = payload.content.offlineOnly ?? false
|
||||
this.name = payload.content.name
|
||||
this.area = payload.content.area
|
||||
|
||||
if (this.content_type === ContentType.TYPES.Theme) {
|
||||
this.area = ComponentArea.Themes
|
||||
} else {
|
||||
this.area = payload.content.area
|
||||
}
|
||||
|
||||
this.package_info = payload.content.package_info || {}
|
||||
this.permissions = payload.content.permissions || []
|
||||
this.autoupdateDisabled = payload.content.autoupdateDisabled ?? false
|
||||
this.disassociatedItemIds = payload.content.disassociatedItemIds || []
|
||||
this.associatedItemIds = payload.content.associatedItemIds || []
|
||||
this.isMobileDefault = payload.content.isMobileDefault ?? false
|
||||
|
||||
/**
|
||||
* @legacy
|
||||
@@ -116,15 +102,11 @@ export class SNComponent extends DecryptedItem<ComponentContent> implements Comp
|
||||
return FindNativeFeature(this.identifier)?.name || this.name
|
||||
}
|
||||
|
||||
public override singletonPredicate(): Predicate<SNComponent> {
|
||||
const uniqueIdentifierPredicate = new Predicate<SNComponent>('identifier', '=', this.identifier)
|
||||
public override singletonPredicate(): Predicate<ComponentItem> {
|
||||
const uniqueIdentifierPredicate = new Predicate<ComponentItem>('identifier', '=', this.identifier)
|
||||
return uniqueIdentifierPredicate
|
||||
}
|
||||
|
||||
public isEditor(): boolean {
|
||||
return this.area === ComponentArea.Editor
|
||||
}
|
||||
|
||||
public isTheme(): boolean {
|
||||
return this.content_type === ContentType.TYPES.Theme || this.area === ComponentArea.Themes
|
||||
}
|
||||
@@ -134,10 +116,6 @@ export class SNComponent extends DecryptedItem<ComponentContent> implements Comp
|
||||
return this.getAppDomainValue(AppDataField.DefaultEditor) === true
|
||||
}
|
||||
|
||||
public getLastSize(): unknown {
|
||||
return this.getAppDomainValue(AppDataField.LastSize)
|
||||
}
|
||||
|
||||
public hasValidHostedUrl(): boolean {
|
||||
return (this.hosted_url || this.legacy_url) != undefined
|
||||
}
|
||||
@@ -149,19 +127,6 @@ export class SNComponent extends DecryptedItem<ComponentContent> implements Comp
|
||||
return [...componentKeys, ...superKeys] as (keyof ItemContent)[]
|
||||
}
|
||||
|
||||
/**
|
||||
* An associative component depends on being explicitly activated for a
|
||||
* given item, compared to a dissaciative component, which is enabled by
|
||||
* default in areas unrelated to a certain item.
|
||||
*/
|
||||
public static associativeAreas(): ComponentArea[] {
|
||||
return [ComponentArea.Editor]
|
||||
}
|
||||
|
||||
public isAssociative(): boolean {
|
||||
return SNComponent.associativeAreas().includes(this.area)
|
||||
}
|
||||
|
||||
public isExplicitlyEnabledForItem(uuid: string): boolean {
|
||||
return this.associatedItemIds.indexOf(uuid) !== -1
|
||||
}
|
||||
@@ -199,4 +164,13 @@ export class SNComponent extends DecryptedItem<ComponentContent> implements Comp
|
||||
public get deprecationMessage(): string | undefined {
|
||||
return this.package_info.deprecation_message
|
||||
}
|
||||
|
||||
get layerableTheme(): boolean {
|
||||
if (!this.isTheme()) {
|
||||
return false
|
||||
}
|
||||
|
||||
const themePackageInfo = this.package_info as ThemePackageInfo
|
||||
return themePackageInfo?.layerable ?? false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ export type ComponentContentSpecialized = {
|
||||
valid_until: Date | number
|
||||
|
||||
legacy_url?: string
|
||||
isMobileDefault?: boolean
|
||||
isDeprecated?: boolean
|
||||
|
||||
/** @deprecated */
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { ComponentArea, ComponentPermission, NoteType, ThirdPartyFeatureDescription } from '@standardnotes/features'
|
||||
import { ComponentPackageInfo } from './PackageInfo'
|
||||
import { ComponentPackageInfo, ThemePackageInfo } from './PackageInfo'
|
||||
import { DecryptedItemInterface } from '../../Abstract/Item'
|
||||
import { ComponentContent } from './ComponentContent'
|
||||
|
||||
export interface ComponentInterface extends DecryptedItemInterface<ComponentContent> {
|
||||
export interface ComponentInterface<P extends ComponentPackageInfo | ThemePackageInfo = ComponentPackageInfo>
|
||||
extends DecryptedItemInterface<ComponentContent> {
|
||||
/** Items that have requested a component to be disabled in its context */
|
||||
disassociatedItemIds: string[]
|
||||
|
||||
@@ -16,16 +17,18 @@ export interface ComponentInterface extends DecryptedItemInterface<ComponentCont
|
||||
offlineOnly: boolean
|
||||
name: string
|
||||
autoupdateDisabled: boolean
|
||||
package_info: ComponentPackageInfo
|
||||
package_info: P
|
||||
area: ComponentArea
|
||||
permissions: ComponentPermission[]
|
||||
valid_until: Date
|
||||
isMobileDefault: boolean
|
||||
isDeprecated: boolean
|
||||
|
||||
isExplicitlyEnabledForItem(uuid: string): boolean
|
||||
hasValidHostedUrl(): boolean
|
||||
|
||||
isTheme(): boolean
|
||||
get layerableTheme(): boolean
|
||||
|
||||
isExplicitlyDisabledForItem(uuid: string): boolean
|
||||
legacyIsDefaultEditor(): boolean
|
||||
|
||||
|
||||
@@ -1,14 +1,9 @@
|
||||
import { addIfUnique, removeFromArray } from '@standardnotes/utils'
|
||||
import { ComponentFeatureDescription, ComponentPermission } from '@standardnotes/features'
|
||||
import { AppDataField } from '../../Abstract/Item/Types/AppDataField'
|
||||
import { ComponentContent } from './ComponentContent'
|
||||
import { DecryptedItemMutator } from '../../Abstract/Item/Mutator/DecryptedItemMutator'
|
||||
|
||||
export class ComponentMutator extends DecryptedItemMutator<ComponentContent> {
|
||||
set isMobileDefault(isMobileDefault: boolean) {
|
||||
this.mutableContent.isMobileDefault = isMobileDefault
|
||||
}
|
||||
|
||||
set package_info(package_info: ComponentFeatureDescription) {
|
||||
this.mutableContent.package_info = package_info
|
||||
}
|
||||
@@ -56,8 +51,4 @@ export class ComponentMutator extends DecryptedItemMutator<ComponentContent> {
|
||||
public removeDisassociatedItemId(uuid: string): void {
|
||||
removeFromArray(this.mutableContent.disassociatedItemIds || [], uuid)
|
||||
}
|
||||
|
||||
public setLastSize(size: string): void {
|
||||
this.setAppDataItem(AppDataField.LastSize, size)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
import { ComponentInterface } from './ComponentInterface'
|
||||
import { ItemInterface } from '../../Abstract/Item/Interfaces/ItemInterface'
|
||||
import { DecryptedItemInterface } from '../../Abstract/Item/Interfaces/DecryptedItem'
|
||||
import { isDecryptedItem } from '../../Abstract/Item'
|
||||
import { ContentType } from '@standardnotes/domain-core'
|
||||
|
||||
export function isComponent(x: ItemInterface): x is ComponentInterface {
|
||||
if (!isDecryptedItem(x as DecryptedItemInterface)) {
|
||||
return false
|
||||
}
|
||||
|
||||
return x.content_type === ContentType.TYPES.Component
|
||||
}
|
||||
|
||||
export function isTheme(x: ItemInterface): x is ComponentInterface {
|
||||
if (!isDecryptedItem(x as DecryptedItemInterface)) {
|
||||
return false
|
||||
}
|
||||
|
||||
return x.content_type === ContentType.TYPES.Theme
|
||||
}
|
||||
|
||||
export function isComponentOrTheme(x: ItemInterface): x is ComponentInterface {
|
||||
if (!isDecryptedItem(x as DecryptedItemInterface)) {
|
||||
return false
|
||||
}
|
||||
|
||||
return x.content_type === ContentType.TYPES.Component || x.content_type === ContentType.TYPES.Theme
|
||||
}
|
||||
@@ -2,5 +2,5 @@ export * from './Component'
|
||||
export * from './ComponentMutator'
|
||||
export * from './ComponentContent'
|
||||
export * from './ComponentInterface'
|
||||
export * from '../../Runtime/Feature/UIFeature'
|
||||
export * from './PackageInfo'
|
||||
export * from './TypeGuards'
|
||||
|
||||
@@ -14,7 +14,7 @@ interface EditorContent extends ItemContent {
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* Editor objects are depracated in favor of SNComponent objects
|
||||
* Editor objects are depracated in favor of ComponentItem objects
|
||||
*/
|
||||
export class SNEditor extends DecryptedItem<EditorContent> {
|
||||
public readonly notes: SNNote[] = []
|
||||
|
||||
@@ -52,4 +52,8 @@ export class KeySystemRootKey extends DecryptedItem<KeySystemRootKeyContent> imp
|
||||
override get shared_vault_uuid(): undefined {
|
||||
return undefined
|
||||
}
|
||||
|
||||
isEqual(other: KeySystemRootKeyInterface): boolean {
|
||||
return this.itemsKey === other.itemsKey && this.token === other.token
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,4 +35,6 @@ export interface KeySystemRootKeyInterface extends DecryptedItemInterface<KeySys
|
||||
*/
|
||||
get key_system_identifier(): undefined
|
||||
get shared_vault_uuid(): undefined
|
||||
|
||||
isEqual(other: KeySystemRootKeyInterface): boolean
|
||||
}
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
import { ComponentArea } from '@standardnotes/features'
|
||||
import { SNComponent } from '../Component/Component'
|
||||
import { ItemInterface } from '../../Abstract/Item'
|
||||
import { ContentType } from '@standardnotes/domain-core'
|
||||
import { useBoolean } from '@standardnotes/utils'
|
||||
import { ThemePackageInfo } from '../Component/PackageInfo'
|
||||
import { ThemeInterface } from './ThemeInterface'
|
||||
|
||||
export const isTheme = (x: ItemInterface): x is ThemeInterface => x.content_type === ContentType.TYPES.Theme
|
||||
|
||||
export class SNTheme extends SNComponent implements ThemeInterface {
|
||||
public override area: ComponentArea = ComponentArea.Themes
|
||||
public declare readonly package_info: ThemePackageInfo
|
||||
|
||||
get layerable(): boolean {
|
||||
return useBoolean(this.package_info && this.package_info.layerable, false)
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
import { ComponentInterface } from '../Component'
|
||||
import { ThemePackageInfo } from '../Component/PackageInfo'
|
||||
|
||||
export interface ThemeInterface extends ComponentInterface {
|
||||
get layerable(): boolean
|
||||
readonly package_info: ThemePackageInfo
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
import { ComponentContent } from '../Component/ComponentContent'
|
||||
import { DecryptedItemMutator } from '../../Abstract/Item/Mutator/DecryptedItemMutator'
|
||||
|
||||
export class ThemeMutator extends DecryptedItemMutator<ComponentContent> {}
|
||||
@@ -1,3 +0,0 @@
|
||||
export * from './Theme'
|
||||
export * from './ThemeMutator'
|
||||
export * from './ThemeInterface'
|
||||
@@ -28,6 +28,7 @@ export const PrefDefaults = {
|
||||
[PrefKey.NotesHideTags]: false,
|
||||
[PrefKey.NotesHideEditorIcon]: false,
|
||||
[PrefKey.UseSystemColorScheme]: false,
|
||||
[PrefKey.UseTranslucentUI]: true,
|
||||
[PrefKey.AutoLightThemeIdentifier]: 'Default',
|
||||
[PrefKey.AutoDarkThemeIdentifier]: NativeFeatureIdentifier.TYPES.DarkTheme,
|
||||
[PrefKey.NoteAddToParentFolders]: true,
|
||||
|
||||
@@ -29,6 +29,7 @@ export enum PrefKey {
|
||||
NotesHideTags = 'hideTags',
|
||||
NotesHideEditorIcon = 'hideEditorIcon',
|
||||
UseSystemColorScheme = 'useSystemColorScheme',
|
||||
UseTranslucentUI = 'useTranslucentUI',
|
||||
AutoLightThemeIdentifier = 'autoLightThemeIdentifier',
|
||||
AutoDarkThemeIdentifier = 'autoDarkThemeIdentifier',
|
||||
NoteAddToParentFolders = 'noteAddToParentFolders',
|
||||
@@ -66,6 +67,7 @@ export type PrefValue = {
|
||||
[PrefKey.NotesHideTags]: boolean
|
||||
[PrefKey.NotesHideEditorIcon]: boolean
|
||||
[PrefKey.UseSystemColorScheme]: boolean
|
||||
[PrefKey.UseTranslucentUI]: boolean
|
||||
[PrefKey.AutoLightThemeIdentifier]: string
|
||||
[PrefKey.AutoDarkThemeIdentifier]: string
|
||||
[PrefKey.NoteAddToParentFolders]: boolean
|
||||
|
||||
@@ -8,6 +8,9 @@ import { VaultListingContent } from './VaultListingContent'
|
||||
import { KeySystemRootKeyStorageMode } from '../KeySystemRootKey/KeySystemRootKeyStorageMode'
|
||||
import { VaultListingSharingInfo } from './VaultListingSharingInfo'
|
||||
import { KeySystemIdentifier } from '../KeySystemRootKey/KeySystemIdentifier'
|
||||
import { EmojiString, IconType } from '../../Utilities/Icon/IconType'
|
||||
|
||||
export const DefaultVaultIconName: IconType = 'safe-square'
|
||||
|
||||
export class VaultListing extends DecryptedItem<VaultListingContent> implements VaultListingInterface {
|
||||
systemIdentifier: KeySystemIdentifier
|
||||
@@ -17,6 +20,7 @@ export class VaultListing extends DecryptedItem<VaultListingContent> implements
|
||||
|
||||
name: string
|
||||
description?: string
|
||||
iconString: IconType | EmojiString
|
||||
|
||||
sharing?: VaultListingSharingInfo
|
||||
|
||||
@@ -30,6 +34,7 @@ export class VaultListing extends DecryptedItem<VaultListingContent> implements
|
||||
|
||||
this.name = payload.content.name
|
||||
this.description = payload.content.description
|
||||
this.iconString = payload.content.iconString || DefaultVaultIconName
|
||||
|
||||
this.sharing = payload.content.sharing
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ import { KeySystemIdentifier } from '../KeySystemRootKey/KeySystemIdentifier'
|
||||
import { KeySystemRootKeyParamsInterface } from '../../Local/KeyParams/KeySystemRootKeyParamsInterface'
|
||||
import { KeySystemRootKeyStorageMode } from '../KeySystemRootKey/KeySystemRootKeyStorageMode'
|
||||
import { VaultListingSharingInfo } from './VaultListingSharingInfo'
|
||||
import { EmojiString, IconType } from '../../Utilities/Icon/IconType'
|
||||
|
||||
export interface VaultListingContentSpecialized extends SpecializedContent {
|
||||
systemIdentifier: KeySystemIdentifier
|
||||
@@ -12,6 +13,7 @@ export interface VaultListingContentSpecialized extends SpecializedContent {
|
||||
|
||||
name: string
|
||||
description?: string
|
||||
iconString: IconType | EmojiString
|
||||
|
||||
sharing?: VaultListingSharingInfo
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import { KeySystemRootKeyStorageMode } from '../KeySystemRootKey/KeySystemRootKe
|
||||
import { VaultListingSharingInfo } from './VaultListingSharingInfo'
|
||||
import { VaultListingContent } from './VaultListingContent'
|
||||
import { DecryptedItemInterface } from '../../Abstract/Item'
|
||||
import { EmojiString, IconType } from '../../Utilities/Icon/IconType'
|
||||
|
||||
export interface VaultListingInterface extends DecryptedItemInterface<VaultListingContent> {
|
||||
systemIdentifier: KeySystemIdentifier
|
||||
@@ -14,6 +15,7 @@ export interface VaultListingInterface extends DecryptedItemInterface<VaultListi
|
||||
|
||||
name: string
|
||||
description?: string
|
||||
iconString: IconType | EmojiString
|
||||
|
||||
sharing?: VaultListingSharingInfo
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { DecryptedItemMutator } from '../../Abstract/Item'
|
||||
import { KeySystemRootKeyParamsInterface } from '../../Local/KeyParams/KeySystemRootKeyParamsInterface'
|
||||
import { EmojiString, IconType } from '../../Utilities/Icon/IconType'
|
||||
import { KeySystemRootKeyStorageMode } from '../KeySystemRootKey/KeySystemRootKeyStorageMode'
|
||||
import { VaultListingContent } from './VaultListingContent'
|
||||
import { VaultListingSharingInfo } from './VaultListingSharingInfo'
|
||||
@@ -13,6 +14,10 @@ export class VaultListingMutator extends DecryptedItemMutator<VaultListingConten
|
||||
this.mutableContent.description = description
|
||||
}
|
||||
|
||||
set iconString(iconString: IconType | EmojiString) {
|
||||
this.mutableContent.iconString = iconString
|
||||
}
|
||||
|
||||
set sharing(sharing: VaultListingSharingInfo | undefined) {
|
||||
this.mutableContent.sharing = sharing
|
||||
}
|
||||
|
||||
@@ -3,17 +3,15 @@ import { DecryptedPayloadInterface } from '../../Abstract/Payload/Interfaces/Dec
|
||||
import { FileItem } from '../../Syncable/File/File'
|
||||
import { SNFeatureRepo } from '../../Syncable/FeatureRepo/FeatureRepo'
|
||||
import { SNActionsExtension } from '../../Syncable/ActionsExtension/ActionsExtension'
|
||||
import { SNComponent } from '../../Syncable/Component/Component'
|
||||
import { ComponentItem } from '../../Syncable/Component/Component'
|
||||
import { SNEditor } from '../../Syncable/Editor/Editor'
|
||||
import { DecryptedItem } from '../../Abstract/Item/Implementations/DecryptedItem'
|
||||
import { SNNote } from '../../Syncable/Note/Note'
|
||||
import { SmartView } from '../../Syncable/SmartView/SmartView'
|
||||
import { SNTag } from '../../Syncable/Tag/Tag'
|
||||
import { SNTheme } from '../../Syncable/Theme/Theme'
|
||||
import { SNUserPrefs } from '../../Syncable/UserPrefs/UserPrefs'
|
||||
import { FileMutator } from '../../Syncable/File/FileMutator'
|
||||
import { MutationType } from '../../Abstract/Item/Types/MutationType'
|
||||
import { ThemeMutator } from '../../Syncable/Theme/ThemeMutator'
|
||||
import { UserPrefsMutator } from '../../Syncable/UserPrefs/UserPrefsMutator'
|
||||
import { ActionsExtensionMutator } from '../../Syncable/ActionsExtension/ActionsExtensionMutator'
|
||||
import { ComponentMutator } from '../../Syncable/Component/ComponentMutator'
|
||||
@@ -58,7 +56,7 @@ const ContentTypeClassMapping: Partial<Record<string, MappingEntry>> = {
|
||||
itemClass: SNActionsExtension,
|
||||
mutatorClass: ActionsExtensionMutator,
|
||||
},
|
||||
[ContentType.TYPES.Component]: { itemClass: SNComponent, mutatorClass: ComponentMutator },
|
||||
[ContentType.TYPES.Component]: { itemClass: ComponentItem, mutatorClass: ComponentMutator },
|
||||
[ContentType.TYPES.KeySystemRootKey]: { itemClass: KeySystemRootKey, mutatorClass: KeySystemRootKeyMutator },
|
||||
[ContentType.TYPES.TrustedContact]: { itemClass: TrustedContact, mutatorClass: TrustedContactMutator },
|
||||
[ContentType.TYPES.VaultListing]: { itemClass: VaultListing, mutatorClass: VaultListingMutator },
|
||||
@@ -68,7 +66,7 @@ const ContentTypeClassMapping: Partial<Record<string, MappingEntry>> = {
|
||||
[ContentType.TYPES.Note]: { itemClass: SNNote, mutatorClass: NoteMutator },
|
||||
[ContentType.TYPES.SmartView]: { itemClass: SmartView, mutatorClass: SmartViewMutator },
|
||||
[ContentType.TYPES.Tag]: { itemClass: SNTag, mutatorClass: TagMutator },
|
||||
[ContentType.TYPES.Theme]: { itemClass: SNTheme, mutatorClass: ThemeMutator },
|
||||
[ContentType.TYPES.Theme]: { itemClass: ComponentItem, mutatorClass: ComponentMutator },
|
||||
[ContentType.TYPES.UserPrefs]: { itemClass: SNUserPrefs, mutatorClass: UserPrefsMutator },
|
||||
} as unknown as Partial<Record<string, MappingEntry>>
|
||||
|
||||
|
||||
@@ -93,7 +93,6 @@ export * from './Syncable/ItemsKey/ItemsKeyMutatorInterface'
|
||||
export * from './Syncable/Note'
|
||||
export * from './Syncable/SmartView'
|
||||
export * from './Syncable/Tag'
|
||||
export * from './Syncable/Theme'
|
||||
export * from './Syncable/UserPrefs'
|
||||
|
||||
export * from './Syncable/TrustedContact/TrustedContact'
|
||||
|
||||
@@ -3,6 +3,74 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.4.440](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-08)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/releases
|
||||
|
||||
## [1.4.439](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-08)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/releases
|
||||
|
||||
## [1.4.438](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-08)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/releases
|
||||
|
||||
## [1.4.437](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-07)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/releases
|
||||
|
||||
## [1.4.436](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-07)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/releases
|
||||
|
||||
## [1.4.435](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-07)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/releases
|
||||
|
||||
## [1.4.434](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-07)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/releases
|
||||
|
||||
## [1.4.433](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-07)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/releases
|
||||
|
||||
## [1.4.432](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-07)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/releases
|
||||
|
||||
## [1.4.431](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-07)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/releases
|
||||
|
||||
## [1.4.430](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-07)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/releases
|
||||
|
||||
## [1.4.429](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-06)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/releases
|
||||
|
||||
## [1.4.428](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-06)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/releases
|
||||
|
||||
## [1.4.427](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-06)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/releases
|
||||
|
||||
## [1.4.426](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-06)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/releases
|
||||
|
||||
## [1.4.425](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-06)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/releases
|
||||
|
||||
## [1.4.424](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-05)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/releases
|
||||
|
||||
## [1.4.423](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-04)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/releases
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@standardnotes/releases",
|
||||
"version": "1.4.423",
|
||||
"version": "1.4.440",
|
||||
"license": "CC BY-NC-SA 4.0",
|
||||
"main": "dist/releases.json",
|
||||
"types": "dist/index.d.ts",
|
||||
|
||||
@@ -3,6 +3,38 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.63.31](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-08)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/services
|
||||
|
||||
## [1.63.30](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-08)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/services
|
||||
|
||||
## [1.63.29](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-07)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/services
|
||||
|
||||
## [1.63.28](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-07)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/services
|
||||
|
||||
## [1.63.27](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-06)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/services
|
||||
|
||||
## [1.63.26](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-06)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/services
|
||||
|
||||
## [1.63.25](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-06)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/services
|
||||
|
||||
## [1.63.24](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-05)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/services
|
||||
|
||||
## [1.63.23](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-04)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/services
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@standardnotes/services",
|
||||
"version": "1.63.23",
|
||||
"version": "1.63.31",
|
||||
"engines": {
|
||||
"node": ">=16.0.0 <17.0.0"
|
||||
},
|
||||
|
||||
@@ -10,6 +10,8 @@ export interface LegacyApiServiceInterface
|
||||
extends AbstractService<ApiServiceEvent, ApiServiceEventData>,
|
||||
FilesApiInterface {
|
||||
isThirdPartyHostUsed(): boolean
|
||||
setHost(host: string): Promise<void>
|
||||
getHost(): string
|
||||
|
||||
downloadOfflineFeaturesFromRepo(
|
||||
repo: SNFeatureRepo,
|
||||
@@ -24,4 +26,6 @@ export interface LegacyApiServiceInterface
|
||||
limit: number,
|
||||
sharedVaultUuids?: string[],
|
||||
): HttpRequest
|
||||
|
||||
getNewSubscriptionToken(): Promise<string | undefined>
|
||||
}
|
||||
|
||||
@@ -1,24 +1,28 @@
|
||||
import { VaultUserServiceInterface, VaultInviteServiceInterface } from '@standardnotes/services'
|
||||
import {
|
||||
VaultUserServiceInterface,
|
||||
VaultInviteServiceInterface,
|
||||
StorageServiceInterface,
|
||||
SyncServiceInterface,
|
||||
FullyResolvedApplicationOptions,
|
||||
ProtectionsClientInterface,
|
||||
ChangeAndSaveItem,
|
||||
GetHost,
|
||||
SetHost,
|
||||
LegacyApiServiceInterface,
|
||||
StatusServiceInterface,
|
||||
MfaServiceInterface,
|
||||
GenerateUuid,
|
||||
} from '@standardnotes/services'
|
||||
import { VaultLockServiceInterface } from './../VaultLock/VaultLockServiceInterface'
|
||||
import { HistoryServiceInterface } from './../History/HistoryServiceInterface'
|
||||
import { InternalEventBusInterface } from './../Internal/InternalEventBusInterface'
|
||||
import { PreferenceServiceInterface } from './../Preferences/PreferenceServiceInterface'
|
||||
import { AsymmetricMessageServiceInterface } from './../AsymmetricMessage/AsymmetricMessageServiceInterface'
|
||||
import { SyncOptions } from './../Sync/SyncOptions'
|
||||
import { ImportDataReturnType } from './../Mutator/ImportDataUseCase'
|
||||
import { ChallengeServiceInterface } from './../Challenge/ChallengeServiceInterface'
|
||||
import { VaultServiceInterface } from '../Vault/VaultServiceInterface'
|
||||
import { ApplicationIdentifier } from '@standardnotes/common'
|
||||
import {
|
||||
BackupFile,
|
||||
DecryptedItemInterface,
|
||||
DecryptedItemMutator,
|
||||
ItemStream,
|
||||
PayloadEmitSource,
|
||||
Platform,
|
||||
PrefKey,
|
||||
PrefValue,
|
||||
} from '@standardnotes/models'
|
||||
import { BackupFile, Environment, Platform, PrefKey, PrefValue } from '@standardnotes/models'
|
||||
import { BackupServiceInterface, FilesClientInterface } from '@standardnotes/files'
|
||||
|
||||
import { AlertService } from '../Alert/AlertService'
|
||||
@@ -37,7 +41,6 @@ import { DeinitSource } from './DeinitSource'
|
||||
import { UserServiceInterface } from '../User/UserServiceInterface'
|
||||
import { SessionsClientInterface } from '../Session/SessionsClientInterface'
|
||||
import { HomeServerServiceInterface } from '../HomeServer/HomeServerServiceInterface'
|
||||
import { User } from '@standardnotes/responses'
|
||||
import { EncryptionProviderInterface } from '../Encryption/EncryptionProviderInterface'
|
||||
|
||||
export interface ApplicationInterface {
|
||||
@@ -53,49 +56,24 @@ export interface ApplicationInterface {
|
||||
createDecryptedBackupFile(): Promise<BackupFile | undefined>
|
||||
hasPasscode(): boolean
|
||||
lock(): Promise<void>
|
||||
softLockBiometrics(): void
|
||||
setValue(key: string, value: unknown, mode?: StorageValueModes): void
|
||||
getValue<T>(key: string, mode?: StorageValueModes): T
|
||||
removeValue(key: string, mode?: StorageValueModes): Promise<void>
|
||||
isLocked(): Promise<boolean>
|
||||
getPreference<K extends PrefKey>(key: K): PrefValue[K] | undefined
|
||||
getPreference<K extends PrefKey>(key: K, defaultValue: PrefValue[K]): PrefValue[K]
|
||||
getPreference<K extends PrefKey>(key: K, defaultValue?: PrefValue[K]): PrefValue[K] | undefined
|
||||
setPreference<K extends PrefKey>(key: K, value: PrefValue[K]): Promise<void>
|
||||
streamItems<I extends DecryptedItemInterface = DecryptedItemInterface>(
|
||||
contentType: string | string[],
|
||||
stream: ItemStream<I>,
|
||||
): () => void
|
||||
|
||||
getUser(): User | undefined
|
||||
hasAccount(): boolean
|
||||
setCustomHost(host: string): Promise<void>
|
||||
isThirdPartyHostUsed(): boolean
|
||||
isUsingHomeServer(): Promise<boolean>
|
||||
getNewSubscriptionToken(): Promise<string | undefined>
|
||||
|
||||
importData(data: BackupFile, awaitSync?: boolean): Promise<ImportDataReturnType>
|
||||
/**
|
||||
* Mutates a pre-existing item, marks it as dirty, and syncs it
|
||||
*/
|
||||
changeAndSaveItem<M extends DecryptedItemMutator = DecryptedItemMutator>(
|
||||
itemToLookupUuidFor: DecryptedItemInterface,
|
||||
mutate: (mutator: M) => void,
|
||||
updateTimestamps?: boolean,
|
||||
emitSource?: PayloadEmitSource,
|
||||
syncOptions?: SyncOptions,
|
||||
): Promise<DecryptedItemInterface | undefined>
|
||||
|
||||
/**
|
||||
* Mutates pre-existing items, marks them as dirty, and syncs
|
||||
*/
|
||||
changeAndSaveItems<M extends DecryptedItemMutator = DecryptedItemMutator>(
|
||||
itemsToLookupUuidsFor: DecryptedItemInterface[],
|
||||
mutate: (mutator: M) => void,
|
||||
updateTimestamps?: boolean,
|
||||
emitSource?: PayloadEmitSource,
|
||||
syncOptions?: SyncOptions,
|
||||
): Promise<void>
|
||||
get changeAndSaveItem(): ChangeAndSaveItem
|
||||
get getHost(): GetHost
|
||||
get setHost(): SetHost
|
||||
|
||||
get alerts(): AlertService
|
||||
get asymmetric(): AsymmetricMessageServiceInterface
|
||||
@@ -108,17 +86,26 @@ export interface ApplicationInterface {
|
||||
get files(): FilesClientInterface
|
||||
get history(): HistoryServiceInterface
|
||||
get homeServer(): HomeServerServiceInterface | undefined
|
||||
get generateUuid(): GenerateUuid
|
||||
get items(): ItemManagerInterface
|
||||
get legacyApi(): LegacyApiServiceInterface
|
||||
get mfa(): MfaServiceInterface
|
||||
get mutator(): MutatorClientInterface
|
||||
get preferences(): PreferenceServiceInterface
|
||||
get protections(): ProtectionsClientInterface
|
||||
get sessions(): SessionsClientInterface
|
||||
get status(): StatusServiceInterface
|
||||
get storage(): StorageServiceInterface
|
||||
get subscriptions(): SubscriptionManagerInterface
|
||||
get sync(): SyncServiceInterface
|
||||
get user(): UserServiceInterface
|
||||
get vaults(): VaultServiceInterface
|
||||
get vaultLocks(): VaultLockServiceInterface
|
||||
get vaultUsers(): VaultUserServiceInterface
|
||||
get vaultInvites(): VaultInviteServiceInterface
|
||||
get vaultLocks(): VaultLockServiceInterface
|
||||
get vaults(): VaultServiceInterface
|
||||
get vaultUsers(): VaultUserServiceInterface
|
||||
|
||||
readonly options: FullyResolvedApplicationOptions
|
||||
readonly environment: Environment
|
||||
readonly identifier: ApplicationIdentifier
|
||||
readonly platform: Platform
|
||||
device: DeviceInterface
|
||||
|
||||
+1
@@ -37,6 +37,7 @@ describe('ProcessAcceptedVaultInvite', () => {
|
||||
} as jest.Mocked<KeySystemRootKeyContent>,
|
||||
metadata: {
|
||||
name: 'test-name',
|
||||
iconString: 'safe-square',
|
||||
},
|
||||
trustedContacts: [],
|
||||
},
|
||||
|
||||
@@ -32,6 +32,7 @@ export class ProcessAcceptedVaultInvite {
|
||||
keyStorageMode: KeySystemRootKeyStorageMode.Synced,
|
||||
name: metadata.name,
|
||||
description: metadata.description,
|
||||
iconString: metadata.iconString,
|
||||
sharing: {
|
||||
sharedVaultUuid: sharedVaultUuid,
|
||||
ownerUserUuid: ownerUuid,
|
||||
|
||||
@@ -14,8 +14,6 @@ export interface ChallengeServiceInterface extends AbstractService {
|
||||
submitValuesForChallenge(challenge: ChallengeInterface, values: ChallengeValue[]): Promise<void>
|
||||
cancelChallenge(challenge: ChallengeInterface): void
|
||||
|
||||
isPasscodeLocked(): Promise<boolean>
|
||||
|
||||
/**
|
||||
* Resolves when the challenge has been completed.
|
||||
* For non-validated challenges, will resolve when the first value is submitted.
|
||||
|
||||
@@ -192,7 +192,7 @@ export class ContactService extends AbstractService<ContactServiceEvent> impleme
|
||||
}
|
||||
|
||||
findContactForInvite(invite: SharedVaultInviteServerHash): TrustedContactInterface | undefined {
|
||||
return this.findContact(invite.sender_uuid)
|
||||
return this.findContact(invite.user_uuid)
|
||||
}
|
||||
|
||||
getCollaborationIDForTrustedContact(contact: TrustedContactInterface): string {
|
||||
|
||||
@@ -4,4 +4,7 @@ export interface DesktopManagerInterface {
|
||||
syncComponentsInstallation(components: ComponentInterface[]): void
|
||||
registerUpdateObserver(callback: (component: ComponentInterface) => void): () => void
|
||||
getExtServerHost(): string
|
||||
saveDesktopBackup(): Promise<void>
|
||||
searchText(text?: string): void
|
||||
redoSearch(): void
|
||||
}
|
||||
|
||||
@@ -24,6 +24,8 @@ import {
|
||||
export interface EncryptionProviderInterface {
|
||||
initialize(): Promise<void>
|
||||
|
||||
isPasscodeLocked(): Promise<boolean>
|
||||
|
||||
encryptSplitSingle(split: KeyedEncryptionSplit): Promise<EncryptedPayloadInterface>
|
||||
encryptSplit(split: KeyedEncryptionSplit): Promise<EncryptedPayloadInterface[]>
|
||||
decryptSplitSingle<
|
||||
|
||||
@@ -191,6 +191,7 @@ export class EncryptionService
|
||||
return ProtocolVersionLatest
|
||||
}
|
||||
|
||||
/** Unlike SessionManager.isSignedIn, hasAccount can be read before the application is unlocked and is based on the key state */
|
||||
public hasAccount() {
|
||||
return this.rootKeyManager.hasAccount()
|
||||
}
|
||||
@@ -625,7 +626,7 @@ export class EncryptionService
|
||||
/**
|
||||
* @returns True if the root key has not yet been unwrapped (passcode locked).
|
||||
*/
|
||||
public async isPasscodeLocked() {
|
||||
public async isPasscodeLocked(): Promise<boolean> {
|
||||
return (await this.rootKeyManager.hasRootKeyWrapper()) && this.rootKeyManager.getRootKey() == undefined
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,5 @@ export enum ApplicationEvent {
|
||||
UnprotectedSessionExpired = 'Application:UnprotectedSessionExpired',
|
||||
/** Called when the app first launches and after first sync request made after sign in */
|
||||
CompletedInitialSync = 'Application:CompletedInitialSync',
|
||||
BiometricsSoftLockEngaged = 'Application:BiometricsSoftLockEngaged',
|
||||
BiometricsSoftLockDisengaged = 'Application:BiometricsSoftLockDisengaged',
|
||||
DidPurchaseSubscription = 'Application:DidPurchaseSubscription',
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ import {
|
||||
SNTag,
|
||||
ItemInterface,
|
||||
AnyItemInterface,
|
||||
KeySystemIdentifier,
|
||||
ItemCollection,
|
||||
SNNote,
|
||||
SmartView,
|
||||
@@ -20,8 +19,8 @@ import {
|
||||
FileItem,
|
||||
VaultDisplayOptions,
|
||||
NotesAndFilesDisplayControllerOptions,
|
||||
ThemeInterface,
|
||||
ComponentInterface,
|
||||
ItemStream,
|
||||
} from '@standardnotes/models'
|
||||
import { AbstractService } from '../Service/AbstractService'
|
||||
|
||||
@@ -57,6 +56,11 @@ export interface ItemManagerInterface extends AbstractService {
|
||||
callback: ItemManagerChangeObserverCallback<I>,
|
||||
): () => void
|
||||
|
||||
streamItems<I extends DecryptedItemInterface = DecryptedItemInterface>(
|
||||
contentType: string | string[],
|
||||
stream: ItemStream<I>,
|
||||
): () => void
|
||||
|
||||
get items(): DecryptedItemInterface[]
|
||||
|
||||
getItems<T extends DecryptedItemInterface>(contentType: string | string[]): T[]
|
||||
@@ -102,7 +106,6 @@ export interface ItemManagerInterface extends AbstractService {
|
||||
findItemsIncludingBlanks<T extends DecryptedItemInterface>(uuids: string[]): (T | undefined)[]
|
||||
|
||||
get trashedItems(): SNNote[]
|
||||
itemsBelongingToKeySystem(systemIdentifier: KeySystemIdentifier): DecryptedItemInterface[]
|
||||
hasTagsNeedingFoldersMigration(): boolean
|
||||
get invalidNonVaultedItems(): EncryptedItemInterface[]
|
||||
isTemplateItem(item: DecryptedItemInterface): boolean
|
||||
@@ -117,7 +120,7 @@ export interface ItemManagerInterface extends AbstractService {
|
||||
getTagParent(itemToLookupUuidFor: SNTag): SNTag | undefined
|
||||
isValidTagParent(parentTagToLookUpUuidFor: SNTag, childToLookUpUuidFor: SNTag): boolean
|
||||
isSmartViewTitle(title: string): boolean
|
||||
getDisplayableComponents(): (ComponentInterface | ThemeInterface)[]
|
||||
getDisplayableComponents(): ComponentInterface[]
|
||||
createItemFromPayload<T extends DecryptedItemInterface>(payload: DecryptedPayloadInterface): T
|
||||
createPayloadFromObject(object: DecryptedTransferPayload): DecryptedPayloadInterface
|
||||
getDisplayableFiles(): FileItem[]
|
||||
|
||||
@@ -0,0 +1,222 @@
|
||||
import { ItemsEncryptionService } from './ItemsEncryption'
|
||||
import { ItemManagerInterface } from '../Item/ItemManagerInterface'
|
||||
import { PayloadManagerInterface } from '../Payloads/PayloadManagerInterface'
|
||||
import { StorageServiceInterface } from '../Storage/StorageServiceInterface'
|
||||
import {
|
||||
DecryptedParameters,
|
||||
EncryptionOperatorsInterface,
|
||||
KeySystemItemsKey,
|
||||
StandardException,
|
||||
} from '@standardnotes/encryption'
|
||||
import { KeySystemKeyManagerInterface } from '../KeySystem/KeySystemKeyManagerInterface'
|
||||
import { FindDefaultItemsKey } from './../Encryption/UseCase/ItemsKey/FindDefaultItemsKey'
|
||||
import { InternalEventBusInterface } from '../Internal/InternalEventBusInterface'
|
||||
import { EncryptedOutputParameters } from '@standardnotes/encryption'
|
||||
import { PkcKeyPair } from '@standardnotes/sncrypto-common'
|
||||
import {
|
||||
DecryptedPayloadInterface,
|
||||
EncryptedPayloadInterface,
|
||||
ItemsKeyInterface,
|
||||
KeySystemItemsKeyInterface,
|
||||
} from '@standardnotes/models'
|
||||
|
||||
describe('ItemsEncryptionService', () => {
|
||||
let itemsEncryptionService: ItemsEncryptionService
|
||||
let mockItems: jest.Mocked<ItemManagerInterface>
|
||||
let mockPayloads: jest.Mocked<PayloadManagerInterface>
|
||||
let mockStorage: jest.Mocked<StorageServiceInterface>
|
||||
let mockOperators: jest.Mocked<EncryptionOperatorsInterface>
|
||||
let mockKeys: jest.Mocked<KeySystemKeyManagerInterface>
|
||||
let mockFindDefaultItemsKey: jest.Mocked<FindDefaultItemsKey>
|
||||
let mockInternalEventBus: jest.Mocked<InternalEventBusInterface>
|
||||
|
||||
beforeEach(() => {
|
||||
mockItems = {
|
||||
addObserver: jest.fn(),
|
||||
} as unknown as jest.Mocked<ItemManagerInterface>
|
||||
mockPayloads = {} as jest.Mocked<PayloadManagerInterface>
|
||||
mockStorage = {} as jest.Mocked<StorageServiceInterface>
|
||||
mockOperators = {} as jest.Mocked<EncryptionOperatorsInterface>
|
||||
mockKeys = {} as jest.Mocked<KeySystemKeyManagerInterface>
|
||||
mockFindDefaultItemsKey = {} as jest.Mocked<FindDefaultItemsKey>
|
||||
mockInternalEventBus = {} as jest.Mocked<InternalEventBusInterface>
|
||||
|
||||
itemsEncryptionService = new ItemsEncryptionService(
|
||||
mockItems,
|
||||
mockPayloads,
|
||||
mockStorage,
|
||||
mockOperators,
|
||||
mockKeys,
|
||||
mockFindDefaultItemsKey,
|
||||
mockInternalEventBus,
|
||||
)
|
||||
})
|
||||
|
||||
describe('decryptPayloadWithKeyLookup', () => {
|
||||
it('returns decrypted parameters when a key is found', async () => {
|
||||
const mockPayload = {
|
||||
uuid: 'payload-uuid',
|
||||
} as EncryptedPayloadInterface
|
||||
|
||||
const mockKey = {
|
||||
uuid: 'key-uuid',
|
||||
} as KeySystemItemsKey
|
||||
|
||||
const mockDecryptedParameters = {
|
||||
uuid: 'decrypted-uuid',
|
||||
content: {},
|
||||
} as DecryptedParameters
|
||||
|
||||
itemsEncryptionService.keyToUseForDecryptionOfPayload = jest.fn().mockReturnValue(mockKey)
|
||||
|
||||
itemsEncryptionService.decryptPayload = jest.fn().mockResolvedValue(mockDecryptedParameters)
|
||||
|
||||
const result = await itemsEncryptionService.decryptPayloadWithKeyLookup(mockPayload)
|
||||
|
||||
expect(itemsEncryptionService.keyToUseForDecryptionOfPayload).toHaveBeenCalledWith(mockPayload)
|
||||
expect(itemsEncryptionService.decryptPayload).toHaveBeenCalledWith(mockPayload, mockKey)
|
||||
expect(result).toEqual(mockDecryptedParameters)
|
||||
})
|
||||
|
||||
it('returns error parameters when no key is found', async () => {
|
||||
const mockPayload = {
|
||||
uuid: 'payload-uuid',
|
||||
} as EncryptedPayloadInterface
|
||||
|
||||
itemsEncryptionService.keyToUseForDecryptionOfPayload = jest.fn().mockReturnValue(undefined)
|
||||
|
||||
const result = await itemsEncryptionService.decryptPayloadWithKeyLookup(mockPayload)
|
||||
|
||||
expect(itemsEncryptionService.keyToUseForDecryptionOfPayload).toHaveBeenCalledWith(mockPayload)
|
||||
expect(result).toEqual({
|
||||
uuid: mockPayload.uuid,
|
||||
errorDecrypting: true,
|
||||
waitingForKey: true,
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('keyToUseForDecryptionOfPayload', () => {
|
||||
it('returns itemsKey when payload has items_key_id', () => {
|
||||
const mockPayload: EncryptedPayloadInterface = {
|
||||
items_key_id: 'test-key-id',
|
||||
} as EncryptedPayloadInterface
|
||||
|
||||
const mockItemsKey: ItemsKeyInterface = {} as ItemsKeyInterface
|
||||
itemsEncryptionService.itemsKeyForEncryptedPayload = jest.fn().mockReturnValue(mockItemsKey)
|
||||
|
||||
const result = itemsEncryptionService.keyToUseForDecryptionOfPayload(mockPayload)
|
||||
|
||||
expect(itemsEncryptionService.itemsKeyForEncryptedPayload).toHaveBeenCalledWith(mockPayload)
|
||||
expect(result).toBe(mockItemsKey)
|
||||
})
|
||||
|
||||
it('returns defaultKey when payload does not have items_key_id', () => {
|
||||
const mockPayload: EncryptedPayloadInterface = {} as EncryptedPayloadInterface
|
||||
const mockDefaultKey: KeySystemItemsKeyInterface = {} as KeySystemItemsKeyInterface
|
||||
|
||||
itemsEncryptionService.defaultItemsKeyForItemVersion = jest.fn().mockReturnValue(mockDefaultKey)
|
||||
|
||||
const result = itemsEncryptionService.keyToUseForDecryptionOfPayload(mockPayload)
|
||||
|
||||
expect(itemsEncryptionService.defaultItemsKeyForItemVersion).toHaveBeenCalledWith(mockPayload.version)
|
||||
expect(result).toBe(mockDefaultKey)
|
||||
})
|
||||
})
|
||||
|
||||
describe('encryptPayloadWithKeyLookup', () => {
|
||||
it('throws an error when keyToUseForItemEncryption returns an instance of StandardException', async () => {
|
||||
const mockPayload: DecryptedPayloadInterface = {} as DecryptedPayloadInterface
|
||||
const mockError: StandardException = new StandardException('test-error')
|
||||
|
||||
itemsEncryptionService.keyToUseForItemEncryption = jest.fn().mockReturnValue(mockError)
|
||||
|
||||
await expect(() => itemsEncryptionService.encryptPayloadWithKeyLookup(mockPayload)).rejects.toThrow('test-error')
|
||||
})
|
||||
|
||||
it('encrypts the payload using the provided key', async () => {
|
||||
const mockPayload: DecryptedPayloadInterface = {} as DecryptedPayloadInterface
|
||||
const mockKey: ItemsKeyInterface = {} as ItemsKeyInterface
|
||||
const encryptedOutputParameters: EncryptedOutputParameters = {
|
||||
content: 'encrypted-content',
|
||||
} as EncryptedOutputParameters
|
||||
|
||||
itemsEncryptionService.keyToUseForItemEncryption = jest.fn().mockReturnValue(mockKey)
|
||||
itemsEncryptionService.encryptPayload = jest.fn().mockResolvedValue(encryptedOutputParameters)
|
||||
|
||||
const result = await itemsEncryptionService.encryptPayloadWithKeyLookup(mockPayload)
|
||||
|
||||
expect(itemsEncryptionService.encryptPayload).toHaveBeenCalledWith(mockPayload, mockKey, undefined)
|
||||
expect(result).toBe(encryptedOutputParameters)
|
||||
})
|
||||
})
|
||||
|
||||
describe('encryptPayload', () => {
|
||||
it('throws an error when the payload has no content', async () => {
|
||||
const mockPayload: DecryptedPayloadInterface = { content: null } as unknown as DecryptedPayloadInterface
|
||||
const mockKey: ItemsKeyInterface = {} as ItemsKeyInterface
|
||||
|
||||
await expect(() => itemsEncryptionService.encryptPayload(mockPayload, mockKey)).rejects.toThrow(
|
||||
'Attempting to encrypt payload with no content.',
|
||||
)
|
||||
})
|
||||
|
||||
it('throws an error when the payload has no UUID', async () => {
|
||||
const mockPayload: DecryptedPayloadInterface = { uuid: null, content: {} } as unknown as DecryptedPayloadInterface
|
||||
const mockKey: ItemsKeyInterface = {} as ItemsKeyInterface
|
||||
|
||||
await expect(() => itemsEncryptionService.encryptPayload(mockPayload, mockKey)).rejects.toThrow(
|
||||
'Attempting to encrypt payload with no UuidGenerator.',
|
||||
)
|
||||
})
|
||||
|
||||
it('returns encrypted output parameters', async () => {
|
||||
const mockPayload: DecryptedPayloadInterface = {
|
||||
uuid: 'test-uuid',
|
||||
content: 'test-content',
|
||||
} as unknown as DecryptedPayloadInterface
|
||||
const mockKey: ItemsKeyInterface = {} as ItemsKeyInterface
|
||||
const encryptedOutputParameters: EncryptedOutputParameters = {
|
||||
content: 'encrypted-content',
|
||||
} as EncryptedOutputParameters
|
||||
|
||||
jest.spyOn(itemsEncryptionService, 'encryptPayload').mockResolvedValue(encryptedOutputParameters)
|
||||
|
||||
const result = await itemsEncryptionService.encryptPayload(mockPayload, mockKey)
|
||||
|
||||
expect(result).toBe(encryptedOutputParameters)
|
||||
})
|
||||
})
|
||||
|
||||
it('repersistAllItems', async () => {
|
||||
Object.defineProperty(mockItems, 'items', {
|
||||
get: jest.fn().mockReturnValue([{ payload: { uuid: '123' } }]),
|
||||
})
|
||||
|
||||
mockStorage.savePayloads = jest.fn().mockResolvedValue(undefined)
|
||||
|
||||
await itemsEncryptionService.repersistAllItems()
|
||||
|
||||
expect(mockStorage.savePayloads).toHaveBeenCalledWith([{ uuid: '123' }])
|
||||
})
|
||||
|
||||
it('encryptPayloadWithKeyLookup', async () => {
|
||||
const mockPayload: DecryptedPayloadInterface = {
|
||||
key_system_identifier: 'test-identifier',
|
||||
} as DecryptedPayloadInterface
|
||||
|
||||
const mockKeyPair: PkcKeyPair = { publicKey: 'publicKey', privateKey: 'privateKey' }
|
||||
const mockKey = { uuid: 'key-id', keyVersion: '004' } as KeySystemItemsKey
|
||||
|
||||
mockKeys.getPrimaryKeySystemItemsKey = jest.fn().mockReturnValue(mockKey)
|
||||
itemsEncryptionService.encryptPayload = jest
|
||||
.fn()
|
||||
.mockResolvedValue({ content: '004:...' } as EncryptedOutputParameters)
|
||||
|
||||
const result = await itemsEncryptionService.encryptPayloadWithKeyLookup(mockPayload, mockKeyPair)
|
||||
|
||||
expect(mockKeys.getPrimaryKeySystemItemsKey).toHaveBeenCalledWith(mockPayload.key_system_identifier)
|
||||
expect(itemsEncryptionService.encryptPayload).toHaveBeenCalledWith(mockPayload, mockKey, mockKeyPair)
|
||||
expect(result).toEqual({ content: '004:...' })
|
||||
})
|
||||
})
|
||||
@@ -97,7 +97,7 @@ export class ItemsEncryptionService extends AbstractService {
|
||||
return this._findDefaultItemsKey.execute(this.getItemsKeys()).getValue()
|
||||
}
|
||||
|
||||
private keyToUseForItemEncryption(
|
||||
keyToUseForItemEncryption(
|
||||
payload: DecryptedPayloadInterface,
|
||||
): ItemsKeyInterface | KeySystemItemsKeyInterface | KeySystemRootKeyInterface | StandardException {
|
||||
if (payload.key_system_identifier) {
|
||||
@@ -132,7 +132,7 @@ export class ItemsEncryptionService extends AbstractService {
|
||||
return result
|
||||
}
|
||||
|
||||
private keyToUseForDecryptionOfPayload(
|
||||
keyToUseForDecryptionOfPayload(
|
||||
payload: EncryptedPayloadInterface,
|
||||
): ItemsKeyInterface | KeySystemItemsKeyInterface | undefined {
|
||||
if (payload.items_key_id) {
|
||||
|
||||
+1
-5
@@ -1,11 +1,7 @@
|
||||
export interface MfaProvider {
|
||||
export interface MfaServiceInterface {
|
||||
isMfaActivated(): Promise<boolean>
|
||||
|
||||
generateMfaSecret(): Promise<string>
|
||||
|
||||
getOtpToken(secret: string): Promise<string>
|
||||
|
||||
enableMfa(secret: string, otpToken: string): Promise<void>
|
||||
|
||||
disableMfa(): Promise<void>
|
||||
}
|
||||
@@ -6,9 +6,9 @@ export enum PreferencesServiceEvent {
|
||||
}
|
||||
|
||||
export interface PreferenceServiceInterface extends AbstractService<PreferencesServiceEvent> {
|
||||
getValue<K extends PrefKey>(key: K, defaultValue: PrefValue[K] | undefined): PrefValue[K] | undefined
|
||||
getValue<K extends PrefKey>(key: K, defaultValue: PrefValue[K]): PrefValue[K]
|
||||
getValue<K extends PrefKey>(key: K, defaultValue?: PrefValue[K]): PrefValue[K] | undefined
|
||||
getValue<K extends PrefKey>(key: K, defaultValue: PrefValue[K] | undefined): PrefValue[K] | undefined
|
||||
|
||||
setValue<K extends PrefKey>(key: K, value: PrefValue[K]): Promise<void>
|
||||
/** Set value without triggering sync or event notifications */
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
import { ApplicationServiceInterface } from './../Service/ApplicationServiceInterface'
|
||||
import { DecryptedItem, DecryptedItemInterface, FileItem, SNNote } from '@standardnotes/models'
|
||||
import { ChallengeInterface, ChallengeReason } from '../Challenge'
|
||||
import { MobileUnlockTiming } from './MobileUnlockTiming'
|
||||
import { TimingDisplayOption } from './TimingDisplayOption'
|
||||
import { ProtectionEvent } from './ProtectionEvent'
|
||||
|
||||
export interface ProtectionsClientInterface extends ApplicationServiceInterface<ProtectionEvent, unknown> {
|
||||
isLocked(): Promise<boolean>
|
||||
softLockBiometrics(): void
|
||||
|
||||
export interface ProtectionsClientInterface {
|
||||
createLaunchChallenge(): ChallengeInterface | undefined
|
||||
authorizeProtectedActionForItems<T extends DecryptedItem>(files: T[], challengeReason: ChallengeReason): Promise<T[]>
|
||||
authorizeItemAccess(item: DecryptedItem): Promise<boolean>
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
export enum ProtectionEvent {
|
||||
UnprotectedSessionBegan = 'Protection:UnprotectedSessionBegan',
|
||||
UnprotectedSessionExpired = 'Protection:UnprotectedSessionExpired',
|
||||
BiometricsSoftLockEngaged = 'Protection:BiometricsSoftLockEngaged',
|
||||
BiometricsSoftLockDisengaged = 'Protection:BiometricsSoftLockDisengaged',
|
||||
}
|
||||
@@ -20,6 +20,7 @@ export interface SessionsClientInterface {
|
||||
|
||||
getUser(): User | undefined
|
||||
isSignedIn(): boolean
|
||||
isSignedOut(): boolean
|
||||
get userUuid(): string
|
||||
getSureUser(): User
|
||||
isSignedIntoFirstPartyServer(): boolean
|
||||
|
||||
@@ -8,6 +8,8 @@ import {
|
||||
SharedVaultListingInterface,
|
||||
VaultListingInterface,
|
||||
KeySystemRootKeyStorageMode,
|
||||
EmojiString,
|
||||
IconType,
|
||||
} from '@standardnotes/models'
|
||||
import { SharedVaultServiceInterface } from './SharedVaultServiceInterface'
|
||||
import { SharedVaultServiceEvent, SharedVaultServiceEventPayload } from './SharedVaultServiceEvent'
|
||||
@@ -118,12 +120,14 @@ export class SharedVaultService
|
||||
async createSharedVault(dto: {
|
||||
name: string
|
||||
description?: string
|
||||
iconString: IconType | EmojiString
|
||||
userInputtedPassword: string | undefined
|
||||
storagePreference?: KeySystemRootKeyStorageMode
|
||||
}): Promise<VaultListingInterface | ClientDisplayableError> {
|
||||
return this._createSharedVault.execute({
|
||||
vaultName: dto.name,
|
||||
vaultDescription: dto.description,
|
||||
vaultIcon: dto.iconString,
|
||||
userInputtedPassword: dto.userInputtedPassword,
|
||||
storagePreference: dto.storagePreference ?? KeySystemRootKeyStorageMode.Synced,
|
||||
})
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
import { GetVaultItems } from './../../Vault/UseCase/GetVaultItems'
|
||||
import { SharedVaultListingInterface, VaultListingInterface, VaultListingMutator } from '@standardnotes/models'
|
||||
import { ClientDisplayableError, isErrorResponse } from '@standardnotes/responses'
|
||||
import { SharedVaultServerInterface } from '@standardnotes/api'
|
||||
import { ItemManagerInterface } from '../../Item/ItemManagerInterface'
|
||||
import { MoveItemsToVault } from '../../Vault/UseCase/MoveItemsToVault'
|
||||
import { MutatorClientInterface } from '../../Mutator/MutatorClientInterface'
|
||||
|
||||
export class ConvertToSharedVault {
|
||||
constructor(
|
||||
private items: ItemManagerInterface,
|
||||
private mutator: MutatorClientInterface,
|
||||
private sharedVaultServer: SharedVaultServerInterface,
|
||||
private moveItemsToVault: MoveItemsToVault,
|
||||
private _moveItemsToVault: MoveItemsToVault,
|
||||
private _getVaultItems: GetVaultItems,
|
||||
) {}
|
||||
|
||||
async execute(dto: { vault: VaultListingInterface }): Promise<SharedVaultListingInterface | ClientDisplayableError> {
|
||||
@@ -35,9 +35,9 @@ export class ConvertToSharedVault {
|
||||
},
|
||||
)
|
||||
|
||||
const vaultItems = this.items.itemsBelongingToKeySystem(sharedVaultListing.systemIdentifier)
|
||||
const vaultItems = this._getVaultItems.execute(sharedVaultListing).getValue()
|
||||
|
||||
await this.moveItemsToVault.execute({ vault: sharedVaultListing, items: vaultItems })
|
||||
await this._moveItemsToVault.execute({ vault: sharedVaultListing, items: vaultItems })
|
||||
|
||||
return sharedVaultListing as SharedVaultListingInterface
|
||||
}
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
import { GetVaultItems } from './../../Vault/UseCase/GetVaultItems'
|
||||
import {
|
||||
EmojiString,
|
||||
IconType,
|
||||
KeySystemRootKeyStorageMode,
|
||||
SharedVaultListingInterface,
|
||||
VaultListingInterface,
|
||||
@@ -6,36 +9,37 @@ import {
|
||||
} from '@standardnotes/models'
|
||||
import { ClientDisplayableError, isErrorResponse } from '@standardnotes/responses'
|
||||
import { SharedVaultServerInterface } from '@standardnotes/api'
|
||||
import { ItemManagerInterface } from '../../Item/ItemManagerInterface'
|
||||
import { CreateVault } from '../../Vault/UseCase/CreateVault'
|
||||
import { MoveItemsToVault } from '../../Vault/UseCase/MoveItemsToVault'
|
||||
import { MutatorClientInterface } from '../../Mutator/MutatorClientInterface'
|
||||
|
||||
export class CreateSharedVault {
|
||||
constructor(
|
||||
private items: ItemManagerInterface,
|
||||
private mutator: MutatorClientInterface,
|
||||
private sharedVaultServer: SharedVaultServerInterface,
|
||||
private createVault: CreateVault,
|
||||
private moveItemsToVault: MoveItemsToVault,
|
||||
private _createVault: CreateVault,
|
||||
private _moveItemsToVault: MoveItemsToVault,
|
||||
private _getVaultItems: GetVaultItems,
|
||||
) {}
|
||||
|
||||
async execute(dto: {
|
||||
vaultName: string
|
||||
vaultDescription?: string
|
||||
vaultIcon: IconType | EmojiString
|
||||
userInputtedPassword: string | undefined
|
||||
storagePreference: KeySystemRootKeyStorageMode
|
||||
}): Promise<SharedVaultListingInterface | ClientDisplayableError> {
|
||||
const privateVault = await this.createVault.execute({
|
||||
const privateVault = await this._createVault.execute({
|
||||
vaultName: dto.vaultName,
|
||||
vaultDescription: dto.vaultDescription,
|
||||
vaultIcon: dto.vaultIcon,
|
||||
userInputtedPassword: dto.userInputtedPassword,
|
||||
storagePreference: dto.storagePreference,
|
||||
})
|
||||
|
||||
const serverResult = await this.sharedVaultServer.createSharedVault()
|
||||
if (isErrorResponse(serverResult)) {
|
||||
return ClientDisplayableError.FromString(`Failed to create shared vault ${JSON.stringify(serverResult)}`)
|
||||
return ClientDisplayableError.FromString(`Failed to create shared vault: ${serverResult.data.error?.message}`)
|
||||
}
|
||||
|
||||
const serverVaultHash = serverResult.data.sharedVault
|
||||
@@ -50,9 +54,9 @@ export class CreateSharedVault {
|
||||
},
|
||||
)
|
||||
|
||||
const vaultItems = this.items.itemsBelongingToKeySystem(sharedVaultListing.systemIdentifier)
|
||||
const vaultItems = this._getVaultItems.execute(sharedVaultListing).getValue()
|
||||
|
||||
await this.moveItemsToVault.execute({ vault: sharedVaultListing, items: vaultItems })
|
||||
await this._moveItemsToVault.execute({ vault: sharedVaultListing, items: vaultItems })
|
||||
|
||||
return sharedVaultListing as SharedVaultListingInterface
|
||||
}
|
||||
|
||||
@@ -13,11 +13,7 @@ export class GetOwnedSharedVaults implements SyncUseCaseInterface<SharedVaultLis
|
||||
const sharedVaults = this._getSharedVaults.execute().getValue()
|
||||
|
||||
const ownedVaults = sharedVaults.filter((vault) => {
|
||||
return this._isVaultOwnwer
|
||||
.execute({
|
||||
sharedVault: vault,
|
||||
})
|
||||
.getValue()
|
||||
return this._isVaultOwnwer.execute(vault).getValue()
|
||||
})
|
||||
|
||||
return Result.ok(ownedVaults)
|
||||
|
||||
@@ -28,7 +28,7 @@ export class SendVaultDataChangedMessage implements UseCaseInterface<void> {
|
||||
) {}
|
||||
|
||||
async execute(params: { vault: SharedVaultListingInterface }): Promise<Result<void>> {
|
||||
const isOwner = this._isVaultOwner.execute({ sharedVault: params.vault }).getValue()
|
||||
const isOwner = this._isVaultOwner.execute(params.vault).getValue()
|
||||
if (!isOwner) {
|
||||
return Result.ok()
|
||||
}
|
||||
|
||||
@@ -37,10 +37,6 @@ export class SubscriptionManager
|
||||
protected override internalEventBus: InternalEventBusInterface,
|
||||
) {
|
||||
super(internalEventBus)
|
||||
|
||||
internalEventBus.addEventHandler(this, ApplicationEvent.UserRolesChanged)
|
||||
internalEventBus.addEventHandler(this, ApplicationEvent.Launched)
|
||||
internalEventBus.addEventHandler(this, ApplicationEvent.SignedIn)
|
||||
}
|
||||
|
||||
async handleEvent(event: InternalEventInterface): Promise<void> {
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
import { SyncOptions } from './../Sync/SyncOptions'
|
||||
import { MutatorClientInterface } from './../Mutator/MutatorClientInterface'
|
||||
import { SyncServiceInterface } from './../Sync/SyncServiceInterface'
|
||||
import { ItemManagerInterface } from '../Item/ItemManagerInterface'
|
||||
import { DecryptedItemInterface, DecryptedItemMutator, MutationType, PayloadEmitSource } from '@standardnotes/models'
|
||||
import { Result, UseCaseInterface } from '@standardnotes/domain-core'
|
||||
|
||||
export class ChangeAndSaveItem implements UseCaseInterface<DecryptedItemInterface | undefined> {
|
||||
constructor(
|
||||
private readonly items: ItemManagerInterface,
|
||||
private mutator: MutatorClientInterface,
|
||||
private sync: SyncServiceInterface,
|
||||
) {}
|
||||
|
||||
async execute<M extends DecryptedItemMutator = DecryptedItemMutator>(
|
||||
itemToLookupUuidFor: DecryptedItemInterface,
|
||||
mutate: (mutator: M) => void,
|
||||
updateTimestamps = true,
|
||||
emitSource?: PayloadEmitSource,
|
||||
syncOptions?: SyncOptions,
|
||||
): Promise<Result<DecryptedItemInterface | undefined>> {
|
||||
await this.mutator.changeItems(
|
||||
[itemToLookupUuidFor],
|
||||
mutate,
|
||||
updateTimestamps ? MutationType.UpdateUserTimestamps : MutationType.NoUpdateUserTimestamps,
|
||||
emitSource,
|
||||
)
|
||||
|
||||
await this.sync.sync(syncOptions)
|
||||
|
||||
return Result.ok(this.items.findItem(itemToLookupUuidFor.uuid))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { Result, SyncUseCaseInterface } from '@standardnotes/domain-core'
|
||||
import { PureCryptoInterface } from '@standardnotes/sncrypto-common'
|
||||
|
||||
export class GenerateUuid implements SyncUseCaseInterface<string> {
|
||||
constructor(private crypto: PureCryptoInterface) {}
|
||||
|
||||
execute(): Result<string> {
|
||||
const uuid = this.crypto.generateUUID()
|
||||
|
||||
return Result.ok(uuid)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
import { LegacyApiServiceInterface } from './../Api/LegacyApiServiceInterface'
|
||||
import { Result, SyncUseCaseInterface } from '@standardnotes/domain-core'
|
||||
|
||||
export class GetHost implements SyncUseCaseInterface<string> {
|
||||
constructor(private legacyApi: LegacyApiServiceInterface) {}
|
||||
|
||||
execute(): Result<string> {
|
||||
return Result.ok(this.legacyApi.getHost())
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import { HttpServiceInterface } from '@standardnotes/api'
|
||||
import { LegacyApiServiceInterface } from '../Api/LegacyApiServiceInterface'
|
||||
import { Result, UseCaseInterface } from '@standardnotes/domain-core'
|
||||
|
||||
export class SetHost implements UseCaseInterface<void> {
|
||||
constructor(
|
||||
private http: HttpServiceInterface,
|
||||
private legacyApi: LegacyApiServiceInterface,
|
||||
) {}
|
||||
|
||||
async execute(host: string): Promise<Result<string>> {
|
||||
this.http.setHost(host)
|
||||
|
||||
await this.legacyApi.setHost(host)
|
||||
|
||||
return Result.ok()
|
||||
}
|
||||
}
|
||||
@@ -15,8 +15,6 @@ export class NotificationService
|
||||
|
||||
constructor(internalEventBus: InternalEventBusInterface) {
|
||||
super(internalEventBus)
|
||||
|
||||
internalEventBus.addEventHandler(this, SyncEvent.ReceivedNotifications)
|
||||
}
|
||||
|
||||
async handleEvent(event: InternalEventInterface): Promise<void> {
|
||||
|
||||
@@ -8,6 +8,8 @@ import {
|
||||
KeySystemRootKeyStorageMode,
|
||||
FillItemContentSpecialized,
|
||||
KeySystemRootKeyInterface,
|
||||
EmojiString,
|
||||
IconType,
|
||||
} from '@standardnotes/models'
|
||||
import { MutatorClientInterface } from '../../Mutator/MutatorClientInterface'
|
||||
import { ContentType } from '@standardnotes/domain-core'
|
||||
@@ -25,6 +27,7 @@ export class CreateVault {
|
||||
async execute(dto: {
|
||||
vaultName: string
|
||||
vaultDescription?: string
|
||||
vaultIcon: IconType | EmojiString
|
||||
userInputtedPassword: string | undefined
|
||||
storagePreference: KeySystemRootKeyStorageMode
|
||||
}): Promise<VaultListingInterface> {
|
||||
@@ -44,6 +47,7 @@ export class CreateVault {
|
||||
keySystemIdentifier,
|
||||
vaultName: dto.vaultName,
|
||||
vaultDescription: dto.vaultDescription,
|
||||
vaultIcon: dto.vaultIcon,
|
||||
passwordType: dto.userInputtedPassword ? KeySystemPasswordType.UserInputted : KeySystemPasswordType.Randomized,
|
||||
rootKeyParams: rootKey.keyParams,
|
||||
storage: dto.storagePreference,
|
||||
@@ -58,6 +62,7 @@ export class CreateVault {
|
||||
keySystemIdentifier: string
|
||||
vaultName: string
|
||||
vaultDescription?: string
|
||||
vaultIcon: IconType | EmojiString
|
||||
passwordType: KeySystemPasswordType
|
||||
rootKeyParams: KeySystemRootKeyParamsInterface
|
||||
storage: KeySystemRootKeyStorageMode
|
||||
@@ -68,6 +73,7 @@ export class CreateVault {
|
||||
keyStorageMode: dto.storage,
|
||||
name: dto.vaultName,
|
||||
description: dto.vaultDescription,
|
||||
iconString: dto.vaultIcon,
|
||||
}
|
||||
|
||||
return this.mutator.createItem(ContentType.TYPES.VaultListing, FillItemContentSpecialized(content), true)
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { ClientDisplayableError } from '@standardnotes/responses'
|
||||
import { ItemManagerInterface } from '../../Item/ItemManagerInterface'
|
||||
import { VaultListingInterface } from '@standardnotes/models'
|
||||
import { MutatorClientInterface } from '../../Mutator/MutatorClientInterface'
|
||||
import { KeySystemKeyManagerInterface } from '../../KeySystem/KeySystemKeyManagerInterface'
|
||||
import { GetVaultItems } from './GetVaultItems'
|
||||
|
||||
export class DeleteVault {
|
||||
constructor(
|
||||
private items: ItemManagerInterface,
|
||||
private mutator: MutatorClientInterface,
|
||||
private keys: KeySystemKeyManagerInterface,
|
||||
private _getVaultItems: GetVaultItems,
|
||||
) {}
|
||||
|
||||
async execute(vault: VaultListingInterface): Promise<ClientDisplayableError | void> {
|
||||
@@ -24,7 +24,7 @@ export class DeleteVault {
|
||||
const itemsKeys = this.keys.getKeySystemItemsKeys(vault.systemIdentifier)
|
||||
await this.mutator.setItemsToBeDeleted(itemsKeys)
|
||||
|
||||
const vaultItems = this.items.itemsBelongingToKeySystem(vault.systemIdentifier)
|
||||
const vaultItems = this._getVaultItems.execute(vault).getValue()
|
||||
await this.mutator.setItemsToBeDeleted(vaultItems)
|
||||
|
||||
await this.mutator.setItemToBeDeleted(vault)
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
import { Result, SyncUseCaseInterface } from '@standardnotes/domain-core'
|
||||
import { DecryptedItemInterface, ItemContent, VaultListingInterface } from '@standardnotes/models'
|
||||
import { ItemManagerInterface } from '../../Item/ItemManagerInterface'
|
||||
|
||||
export class GetVaultItems implements SyncUseCaseInterface<DecryptedItemInterface[]> {
|
||||
constructor(private items: ItemManagerInterface) {}
|
||||
|
||||
execute(vault: VaultListingInterface): Result<DecryptedItemInterface<ItemContent>[]> {
|
||||
return Result.ok(this.items.items.filter((item) => item.key_system_identifier === vault.systemIdentifier))
|
||||
}
|
||||
}
|
||||
@@ -114,7 +114,7 @@ export class RotateVaultKey implements UseCaseInterface<VaultListingInterface> {
|
||||
return Result.ok()
|
||||
}
|
||||
|
||||
const isOwner = this._isVaultOwner.execute({ sharedVault: params.vault }).getValue()
|
||||
const isOwner = this._isVaultOwner.execute(params.vault).getValue()
|
||||
|
||||
if (!isOwner) {
|
||||
return Result.ok()
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
import { ValidateVaultPassword } from './../VaultLock/UseCase/ValidateVaultPassword'
|
||||
import { IsVaultOwner } from './../VaultUser/UseCase/IsVaultOwner'
|
||||
import { SendVaultDataChangedMessage } from './../SharedVaults/UseCase/SendVaultDataChangedMessage'
|
||||
import { isClientDisplayableError } from '@standardnotes/responses'
|
||||
import {
|
||||
DecryptedItemInterface,
|
||||
EmojiString,
|
||||
FileItem,
|
||||
IconType,
|
||||
KeySystemIdentifier,
|
||||
KeySystemRootKeyStorageMode,
|
||||
SharedVaultListingInterface,
|
||||
VaultListingInterface,
|
||||
VaultListingMutator,
|
||||
isNote,
|
||||
@@ -48,6 +53,8 @@ export class VaultService
|
||||
private _deleteVault: DeleteVault,
|
||||
private _rotateVaultKey: RotateVaultKey,
|
||||
private _sendVaultDataChangeMessage: SendVaultDataChangedMessage,
|
||||
private _isVaultOwner: IsVaultOwner,
|
||||
private _validateVaultPassword: ValidateVaultPassword,
|
||||
eventBus: InternalEventBusInterface,
|
||||
) {
|
||||
super(eventBus)
|
||||
@@ -92,10 +99,15 @@ export class VaultService
|
||||
return vault
|
||||
}
|
||||
|
||||
async createRandomizedVault(dto: { name: string; description?: string }): Promise<VaultListingInterface> {
|
||||
async createRandomizedVault(dto: {
|
||||
name: string
|
||||
description?: string
|
||||
iconString: IconType | EmojiString
|
||||
}): Promise<VaultListingInterface> {
|
||||
return this.createVaultWithParameters({
|
||||
name: dto.name,
|
||||
description: dto.description,
|
||||
iconString: dto.iconString,
|
||||
userInputtedPassword: undefined,
|
||||
storagePreference: KeySystemRootKeyStorageMode.Synced,
|
||||
})
|
||||
@@ -104,6 +116,7 @@ export class VaultService
|
||||
async createUserInputtedPasswordVault(dto: {
|
||||
name: string
|
||||
description?: string
|
||||
iconString: IconType | EmojiString
|
||||
userInputtedPassword: string
|
||||
storagePreference: KeySystemRootKeyStorageMode
|
||||
}): Promise<VaultListingInterface> {
|
||||
@@ -113,12 +126,14 @@ export class VaultService
|
||||
private async createVaultWithParameters(dto: {
|
||||
name: string
|
||||
description?: string
|
||||
iconString: IconType | EmojiString
|
||||
userInputtedPassword: string | undefined
|
||||
storagePreference: KeySystemRootKeyStorageMode
|
||||
}): Promise<VaultListingInterface> {
|
||||
const result = await this._createVault.execute({
|
||||
vaultName: dto.name,
|
||||
vaultDescription: dto.description,
|
||||
vaultIcon: dto.iconString,
|
||||
userInputtedPassword: dto.userInputtedPassword,
|
||||
storagePreference: dto.storagePreference,
|
||||
})
|
||||
@@ -183,13 +198,14 @@ export class VaultService
|
||||
return true
|
||||
}
|
||||
|
||||
async changeVaultNameAndDescription(
|
||||
async changeVaultMetadata(
|
||||
vault: VaultListingInterface,
|
||||
params: { name: string; description?: string },
|
||||
params: { name: string; description?: string; iconString: IconType | EmojiString },
|
||||
): Promise<VaultListingInterface> {
|
||||
const updatedVault = await this.mutator.changeItem<VaultListingMutator, VaultListingInterface>(vault, (mutator) => {
|
||||
mutator.name = params.name
|
||||
mutator.description = params.description
|
||||
mutator.iconString = params.iconString
|
||||
})
|
||||
|
||||
await this.sync.sync()
|
||||
@@ -238,8 +254,39 @@ export class VaultService
|
||||
throw new Error('Attempting to change vault options on a locked vault')
|
||||
}
|
||||
|
||||
if (!this._isVaultOwner.execute(dto.vault).getValue()) {
|
||||
throw new Error('Third party vault options should be changed via changeThirdPartyVaultStorageOptions')
|
||||
}
|
||||
|
||||
const result = await this._changeVaultKeyOptions.execute(dto)
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
async changeThirdPartyVaultStorageOptions(dto: {
|
||||
vault: SharedVaultListingInterface
|
||||
newStorageMode: KeySystemRootKeyStorageMode | undefined
|
||||
vaultPassword: string
|
||||
}): Promise<Result<void>> {
|
||||
if (this.vaultLocks.isVaultLocked(dto.vault)) {
|
||||
throw new Error('Attempting to change vault options on a locked vault')
|
||||
}
|
||||
|
||||
if (this._isVaultOwner.execute(dto.vault).getValue()) {
|
||||
throw new Error('First party vault options should be changed via changeVaultKeyOptions')
|
||||
}
|
||||
|
||||
const validPassword = this._validateVaultPassword.execute(dto.vault, dto.vaultPassword).getValue()
|
||||
if (!validPassword) {
|
||||
return Result.fail('Invalid vault password')
|
||||
}
|
||||
|
||||
const result = await this._changeVaultKeyOptions.execute({
|
||||
vault: dto.vault,
|
||||
newStorageMode: dto.newStorageMode,
|
||||
newPasswordOptions: undefined,
|
||||
})
|
||||
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import {
|
||||
DecryptedItemInterface,
|
||||
EmojiString,
|
||||
IconType,
|
||||
KeySystemIdentifier,
|
||||
KeySystemRootKeyStorageMode,
|
||||
SharedVaultListingInterface,
|
||||
VaultListingInterface,
|
||||
} from '@standardnotes/models'
|
||||
import { AbstractService } from '../Service/AbstractService'
|
||||
@@ -11,10 +14,15 @@ import { Result } from '@standardnotes/domain-core'
|
||||
|
||||
export interface VaultServiceInterface
|
||||
extends AbstractService<VaultServiceEvent, VaultServiceEventPayload[VaultServiceEvent]> {
|
||||
createRandomizedVault(dto: { name: string; description?: string }): Promise<VaultListingInterface>
|
||||
createRandomizedVault(dto: {
|
||||
name: string
|
||||
description?: string
|
||||
iconString: IconType | EmojiString
|
||||
}): Promise<VaultListingInterface>
|
||||
createUserInputtedPasswordVault(dto: {
|
||||
name: string
|
||||
description?: string
|
||||
iconString: IconType | EmojiString
|
||||
userInputtedPassword: string
|
||||
storagePreference: KeySystemRootKeyStorageMode
|
||||
}): Promise<VaultListingInterface>
|
||||
@@ -31,10 +39,16 @@ export interface VaultServiceInterface
|
||||
isItemInVault(item: DecryptedItemInterface): boolean
|
||||
getItemVault(item: DecryptedItemInterface): VaultListingInterface | undefined
|
||||
|
||||
changeVaultNameAndDescription(
|
||||
changeVaultMetadata(
|
||||
vault: VaultListingInterface,
|
||||
params: { name: string; description: string },
|
||||
params: { name: string; description: string; iconString: IconType | EmojiString },
|
||||
): Promise<VaultListingInterface>
|
||||
rotateVaultRootKey(vault: VaultListingInterface, vaultPassword?: string): Promise<void>
|
||||
|
||||
changeVaultKeyOptions(dto: ChangeVaultKeyOptionsDTO): Promise<Result<void>>
|
||||
changeThirdPartyVaultStorageOptions(dto: {
|
||||
vault: SharedVaultListingInterface
|
||||
newStorageMode: KeySystemRootKeyStorageMode | undefined
|
||||
vaultPassword: string
|
||||
}): Promise<Result<void>>
|
||||
}
|
||||
|
||||
@@ -122,6 +122,7 @@ export class InviteToVault implements UseCaseInterface<SharedVaultInviteServerHa
|
||||
metadata: {
|
||||
name: params.sharedVault.name,
|
||||
description: params.sharedVault.description,
|
||||
iconString: params.sharedVault.iconString,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -189,6 +189,9 @@ export class VaultInviteService
|
||||
sharedVaultContacts: contacts,
|
||||
permission,
|
||||
})
|
||||
if (result.isFailed()) {
|
||||
return Result.fail(result.getError())
|
||||
}
|
||||
|
||||
void this.notifyEvent(VaultInviteServiceEvent.InviteSent)
|
||||
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
import { EncryptionProviderInterface } from './../../Encryption/EncryptionProviderInterface'
|
||||
import { Result, SyncUseCaseInterface } from '@standardnotes/domain-core'
|
||||
import { KeySystemPasswordType, VaultListingInterface } from '@standardnotes/models'
|
||||
import { KeySystemKeyManagerInterface } from '../../KeySystem/KeySystemKeyManagerInterface'
|
||||
|
||||
export class ValidateVaultPassword implements SyncUseCaseInterface<boolean> {
|
||||
constructor(
|
||||
private encryption: EncryptionProviderInterface,
|
||||
private keys: KeySystemKeyManagerInterface,
|
||||
) {}
|
||||
|
||||
execute(vault: VaultListingInterface, password: string): Result<boolean> {
|
||||
if (vault.keyPasswordType !== KeySystemPasswordType.UserInputted) {
|
||||
throw new Error('Vault uses randomized password and cannot be validated with password')
|
||||
}
|
||||
|
||||
const rootKey = this.keys.getPrimaryKeySystemRootKey(vault.systemIdentifier)
|
||||
|
||||
if (!rootKey) {
|
||||
return Result.ok(false)
|
||||
}
|
||||
|
||||
const derivedRootKey = this.encryption.deriveUserInputtedKeySystemRootKey({
|
||||
keyParams: vault.rootKeyParams,
|
||||
userInputtedPassword: password,
|
||||
})
|
||||
|
||||
return Result.ok(rootKey.isEqual(derivedRootKey))
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
import { GetVaultItems } from './../Vault/UseCase/GetVaultItems'
|
||||
import { RemoveItemsFromMemory } from './../Storage/UseCase/RemoveItemsFromMemory'
|
||||
import { GetVaults } from '../Vault/UseCase/GetVaults'
|
||||
import { KeySystemPasswordType, KeySystemRootKeyStorageMode, VaultListingInterface } from '@standardnotes/models'
|
||||
import { VaultLockServiceInterface } from './VaultLockServiceInterface'
|
||||
@@ -22,6 +24,8 @@ export class VaultLockService
|
||||
private keys: KeySystemKeyManagerInterface,
|
||||
private _getVaults: GetVaults,
|
||||
private _decryptErroredPayloads: DecryptErroredPayloads,
|
||||
private _removeItemsFromMemory: RemoveItemsFromMemory,
|
||||
private _getVaultItems: GetVaultItems,
|
||||
eventBus: InternalEventBusInterface,
|
||||
) {
|
||||
super(eventBus)
|
||||
@@ -40,6 +44,8 @@ export class VaultLockService
|
||||
;(this.keys as unknown) = undefined
|
||||
;(this._getVaults as unknown) = undefined
|
||||
;(this._decryptErroredPayloads as unknown) = undefined
|
||||
;(this._removeItemsFromMemory as unknown) = undefined
|
||||
;(this._getVaultItems as unknown) = undefined
|
||||
|
||||
this.lockMap.clear()
|
||||
}
|
||||
@@ -68,6 +74,9 @@ export class VaultLockService
|
||||
|
||||
await this.keys.wipeVaultKeysFromMemory(vault)
|
||||
|
||||
const vaultItems = this._getVaultItems.execute(vault).getValue()
|
||||
await this._removeItemsFromMemory.execute(vaultItems)
|
||||
|
||||
this.lockMap.set(vault.uuid, true)
|
||||
|
||||
void this.notifyEventSync(VaultLockServiceEvent.VaultLocked, { vault })
|
||||
|
||||
@@ -1,17 +1,21 @@
|
||||
import { UserServiceInterface } from './../../User/UserServiceInterface'
|
||||
import { Result, SyncUseCaseInterface } from '@standardnotes/domain-core'
|
||||
import { SharedVaultListingInterface } from '@standardnotes/models'
|
||||
import { VaultListingInterface } from '@standardnotes/models'
|
||||
|
||||
export class IsVaultOwner implements SyncUseCaseInterface<boolean> {
|
||||
constructor(private users: UserServiceInterface) {}
|
||||
|
||||
execute(dto: { sharedVault: SharedVaultListingInterface }): Result<boolean> {
|
||||
if (!dto.sharedVault.sharing.ownerUserUuid) {
|
||||
throw new Error(`Shared vault ${dto.sharedVault.sharing.sharedVaultUuid} does not have an owner user uuid`)
|
||||
execute(vault: VaultListingInterface): Result<boolean> {
|
||||
if (!vault.sharing) {
|
||||
return Result.ok(true)
|
||||
}
|
||||
|
||||
if (!vault.sharing.ownerUserUuid) {
|
||||
throw new Error(`Shared vault ${vault.sharing.sharedVaultUuid} does not have an owner user uuid`)
|
||||
}
|
||||
|
||||
const user = this.users.sureUser
|
||||
|
||||
return Result.ok(dto.sharedVault.sharing.ownerUserUuid === user.uuid)
|
||||
return Result.ok(vault.sharing.ownerUserUuid === user.uuid)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,11 +52,7 @@ export class VaultUserService extends AbstractService<VaultUserServiceEvent> imp
|
||||
}
|
||||
|
||||
public isCurrentUserSharedVaultAdmin(sharedVault: SharedVaultListingInterface): boolean {
|
||||
return this._isVaultOwner
|
||||
.execute({
|
||||
sharedVault,
|
||||
})
|
||||
.getValue()
|
||||
return this._isVaultOwner.execute(sharedVault).getValue()
|
||||
}
|
||||
|
||||
async removeUserFromSharedVault(sharedVault: SharedVaultListingInterface, userUuid: string): Promise<Result<void>> {
|
||||
|
||||
@@ -10,6 +10,10 @@ export * from './Application/ApplicationStage'
|
||||
export * from './Application/DeinitCallback'
|
||||
export * from './Application/DeinitMode'
|
||||
export * from './Application/DeinitSource'
|
||||
export * from './Application/Options/ApplicationOptions'
|
||||
export * from './Application/Options/Defaults'
|
||||
export * from './Application/Options/OptionalOptions'
|
||||
export * from './Application/Options/RequiredOptions'
|
||||
export * from './AsymmetricMessage/AsymmetricMessageService'
|
||||
export * from './AsymmetricMessage/AsymmetricMessageServiceInterface'
|
||||
export * from './AsymmetricMessage/UseCase/GetInboundMessages'
|
||||
@@ -117,12 +121,14 @@ export * from './Item/StaticItemCounter'
|
||||
export * from './ItemsEncryption/ItemsEncryption'
|
||||
export * from './ItemsEncryption/ItemsEncryption'
|
||||
export * from './KeySystem/KeySystemKeyManager'
|
||||
export * from './Mfa/MfaServiceInterface'
|
||||
export * from './Mutator/ImportDataUseCase'
|
||||
export * from './Mutator/MutatorClientInterface'
|
||||
export * from './Payloads/PayloadManagerInterface'
|
||||
export * from './Preferences/PreferenceServiceInterface'
|
||||
export * from './Protection/MobileUnlockTiming'
|
||||
export * from './Protection/ProtectionClientInterface'
|
||||
export * from './Protection/ProtectionEvent'
|
||||
export * from './Protection/TimingDisplayOption'
|
||||
export * from './Revision/RevisionClientInterface'
|
||||
export * from './Revision/RevisionManager'
|
||||
@@ -170,23 +176,28 @@ export * from './Sync/SyncOptions'
|
||||
export * from './Sync/SyncQueueStrategy'
|
||||
export * from './Sync/SyncServiceInterface'
|
||||
export * from './Sync/SyncSource'
|
||||
export * from './UseCase/ChangeAndSaveItem'
|
||||
export * from './UseCase/DiscardItemsLocally'
|
||||
export * from './UseCase/GenerateUuid'
|
||||
export * from './UseCase/GetHost'
|
||||
export * from './UseCase/SetHost'
|
||||
export * from './User/AccountEvent'
|
||||
export * from './User/AccountEventData'
|
||||
export * from './User/CredentialsChangeFunctionResponse'
|
||||
export * from './User/SignedInOrRegisteredEventPayload'
|
||||
export * from './User/SignedOutEventPayload'
|
||||
export * from './User/UserServiceInterface'
|
||||
export * from './User/UserServiceInterface'
|
||||
export * from './User/UserService'
|
||||
export * from './User/UserServiceInterface'
|
||||
export * from './User/UserServiceInterface'
|
||||
export * from './UserEvent/NotificationService'
|
||||
export * from './UserEvent/NotificationServiceEvent'
|
||||
export * from './Vault/UseCase/ChangeVaultStorageMode'
|
||||
export * from './Vault/UseCase/ChangeVaultKeyOptions'
|
||||
export * from './Vault/UseCase/ChangeVaultKeyOptionsDTO'
|
||||
export * from './Vault/UseCase/ChangeVaultStorageMode'
|
||||
export * from './Vault/UseCase/CreateVault'
|
||||
export * from './Vault/UseCase/DeleteVault'
|
||||
export * from './Vault/UseCase/GetVault'
|
||||
export * from './Vault/UseCase/GetVaultItems'
|
||||
export * from './Vault/UseCase/GetVaults'
|
||||
export * from './Vault/UseCase/MoveItemsToVault'
|
||||
export * from './Vault/UseCase/RemoveItemFromVault'
|
||||
@@ -204,6 +215,7 @@ export * from './VaultInvite/UseCase/SendVaultInvite'
|
||||
export * from './VaultInvite/VaultInviteService'
|
||||
export * from './VaultInvite/VaultInviteServiceEvent'
|
||||
export * from './VaultInvite/VaultInviteServiceInterface'
|
||||
export * from './VaultLock/UseCase/ValidateVaultPassword'
|
||||
export * from './VaultLock/VaultLockService'
|
||||
export * from './VaultLock/VaultLockServiceEvent'
|
||||
export * from './VaultLock/VaultLockServiceInterface'
|
||||
|
||||
@@ -3,6 +3,10 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.14.8](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-06)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/sncrypto-web
|
||||
|
||||
## [1.14.7](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-01)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/sncrypto-web
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@standardnotes/sncrypto-web",
|
||||
"version": "1.14.7",
|
||||
"version": "1.14.8",
|
||||
"engines": {
|
||||
"node": ">=16.0.0 <17.0.0"
|
||||
},
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
/* eslint-disable no-unused-expressions */
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
import './vendor/chai-as-promised-built.js'
|
||||
import './vendor/[email protected]'
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
/* eslint-disable no-unused-expressions */
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
import './vendor/chai-as-promised-built.js'
|
||||
|
||||
chai.use(chaiAsPromised)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
/* eslint-disable no-unused-expressions */
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
import './vendor/chai-as-promised-built.js'
|
||||
|
||||
chai.use(chaiAsPromised)
|
||||
|
||||
@@ -3,6 +3,50 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [2.202.41](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-08)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/snjs
|
||||
|
||||
## [2.202.40](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-08)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/snjs
|
||||
|
||||
## [2.202.39](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-07)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/snjs
|
||||
|
||||
## [2.202.38](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-07)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/snjs
|
||||
|
||||
## [2.202.37](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-07)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/snjs
|
||||
|
||||
## [2.202.36](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-07)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/snjs
|
||||
|
||||
## [2.202.35](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-06)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/snjs
|
||||
|
||||
## [2.202.34](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-06)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/snjs
|
||||
|
||||
## [2.202.33](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-06)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/snjs
|
||||
|
||||
## [2.202.32](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-06)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/snjs
|
||||
|
||||
## [2.202.31](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-05)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/snjs
|
||||
|
||||
## [2.202.30](https://github.com/standardnotes/app/compare/@standardnotes/[email protected]...@standardnotes/[email protected]) (2023-08-04)
|
||||
|
||||
**Note:** Version bump only for package @standardnotes/snjs
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { SNMfaService } from './../Services/Mfa/MfaService'
|
||||
import { MfaService } from './../Services/Mfa/MfaService'
|
||||
import { KeyRecoveryService } from './../Services/KeyRecovery/KeyRecoveryService'
|
||||
import { WebSocketsService } from './../Services/Api/WebsocketsService'
|
||||
import { MigrationService } from './../Services/Migration/MigrationService'
|
||||
@@ -20,13 +20,10 @@ import {
|
||||
ApplicationStageChangedEventPayload,
|
||||
StorageValueModes,
|
||||
ChallengeObserver,
|
||||
SyncOptions,
|
||||
ImportDataReturnType,
|
||||
ImportDataUseCase,
|
||||
StoragePersistencePolicies,
|
||||
HomeServerServiceInterface,
|
||||
ApiServiceEvent,
|
||||
IntegrityEvent,
|
||||
DeviceInterface,
|
||||
SubscriptionManagerInterface,
|
||||
FeaturesClientInterface,
|
||||
@@ -57,7 +54,6 @@ import {
|
||||
ApplicationInterface,
|
||||
EncryptionService,
|
||||
EncryptionServiceEvent,
|
||||
ChallengePrompt,
|
||||
Challenge,
|
||||
ErrorAlertStrings,
|
||||
SessionsClientInterface,
|
||||
@@ -73,34 +69,35 @@ import {
|
||||
EncryptionProviderInterface,
|
||||
VaultUserServiceInterface,
|
||||
VaultInviteServiceInterface,
|
||||
NotificationServiceEvent,
|
||||
VaultLockServiceInterface,
|
||||
ApplicationConstructorOptions,
|
||||
FullyResolvedApplicationOptions,
|
||||
ApplicationOptionsDefaults,
|
||||
ChangeAndSaveItem,
|
||||
ProtectionEvent,
|
||||
GetHost,
|
||||
SetHost,
|
||||
MfaServiceInterface,
|
||||
GenerateUuid,
|
||||
} from '@standardnotes/services'
|
||||
import {
|
||||
PayloadEmitSource,
|
||||
SNNote,
|
||||
PrefKey,
|
||||
PrefValue,
|
||||
DecryptedItemMutator,
|
||||
BackupFile,
|
||||
DecryptedItemInterface,
|
||||
EncryptedItemInterface,
|
||||
Environment,
|
||||
ItemStream,
|
||||
Platform,
|
||||
MutationType,
|
||||
} from '@standardnotes/models'
|
||||
import {
|
||||
HttpResponse,
|
||||
SessionListResponse,
|
||||
User,
|
||||
SignInResponse,
|
||||
ClientDisplayableError,
|
||||
SessionListEntry,
|
||||
} from '@standardnotes/responses'
|
||||
import {
|
||||
SyncService,
|
||||
ProtectionEvent,
|
||||
SettingsService,
|
||||
ActionsService,
|
||||
ChallengeResponse,
|
||||
@@ -113,17 +110,15 @@ import {
|
||||
removeFromArray,
|
||||
isNullOrUndefined,
|
||||
sleep,
|
||||
UuidGenerator,
|
||||
useBoolean,
|
||||
LoggerInterface,
|
||||
canBlockDeinit,
|
||||
} from '@standardnotes/utils'
|
||||
import { UuidString, ApplicationEventPayload } from '../Types'
|
||||
import { applicationEventForSyncEvent } from '@Lib/Application/Event'
|
||||
import { BackupServiceInterface, FilesClientInterface } from '@standardnotes/files'
|
||||
import { ComputePrivateUsername } from '@standardnotes/encryption'
|
||||
import { SNLog } from '../Log'
|
||||
import { ApplicationConstructorOptions, FullyResolvedApplicationOptions } from './Options/ApplicationOptions'
|
||||
import { ApplicationOptionsDefaults } from './Options/Defaults'
|
||||
import { SignInWithRecoveryCodes } from '@Lib/Domain/UseCase/SignInWithRecoveryCodes/SignInWithRecoveryCodes'
|
||||
import { UseCaseContainerInterface } from '@Lib/Domain/UseCase/UseCaseContainerInterface'
|
||||
import { GetRecoveryCodes } from '@Lib/Domain/UseCase/GetRecoveryCodes/GetRecoveryCodes'
|
||||
@@ -137,7 +132,7 @@ import { GetAuthenticatorAuthenticationResponse } from '@Lib/Domain/UseCase/GetA
|
||||
import { GetAuthenticatorAuthenticationOptions } from '@Lib/Domain/UseCase/GetAuthenticatorAuthenticationOptions/GetAuthenticatorAuthenticationOptions'
|
||||
import { Dependencies } from './Dependencies/Dependencies'
|
||||
import { TYPES } from './Dependencies/Types'
|
||||
import { canBlockDeinit } from './Dependencies/isDeinitable'
|
||||
import { RegisterApplicationServicesEvents } from './Dependencies/DependencyEvents'
|
||||
|
||||
/** How often to automatically sync, in milliseconds */
|
||||
const DEFAULT_AUTO_SYNC_INTERVAL = 30_000
|
||||
@@ -165,7 +160,6 @@ export class SNApplication implements ApplicationInterface, AppGroupManagedAppli
|
||||
|
||||
private eventHandlers: ApplicationObserver[] = []
|
||||
|
||||
private streamRemovers: ObserverRemover[] = []
|
||||
private serviceObservers: ObserverRemover[] = []
|
||||
private managedSubscribers: ObserverRemover[] = []
|
||||
private autoSyncInterval!: ReturnType<typeof setInterval>
|
||||
@@ -178,7 +172,7 @@ export class SNApplication implements ApplicationInterface, AppGroupManagedAppli
|
||||
private launched = false
|
||||
/** Whether the application has been destroyed via .deinit() */
|
||||
public dealloced = false
|
||||
private isBiometricsSoftLockEngaged = false
|
||||
|
||||
private revokingSession = false
|
||||
private handledFullSyncStage = false
|
||||
|
||||
@@ -229,8 +223,8 @@ export class SNApplication implements ApplicationInterface, AppGroupManagedAppli
|
||||
this.dependencies = new Dependencies(this.options)
|
||||
|
||||
this.registerServiceObservers()
|
||||
this.defineInternalEventHandlers()
|
||||
this.createBackgroundDependencies()
|
||||
|
||||
RegisterApplicationServicesEvents(this.dependencies, this.events)
|
||||
}
|
||||
|
||||
private registerServiceObservers() {
|
||||
@@ -561,13 +555,6 @@ export class SNApplication implements ApplicationInterface, AppGroupManagedAppli
|
||||
void this.migrations.handleApplicationEvent(event)
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the local database has completed loading local items.
|
||||
*/
|
||||
public isDatabaseLoaded(): boolean {
|
||||
return this.sync.isDatabaseLoaded()
|
||||
}
|
||||
|
||||
public getSessions(): Promise<HttpResponse<SessionListEntry[]>> {
|
||||
return this.sessions.getSessionsList()
|
||||
}
|
||||
@@ -594,65 +581,12 @@ export class SNApplication implements ApplicationInterface, AppGroupManagedAppli
|
||||
return compareVersions(userVersion, ProtocolVersion.V004) >= 0
|
||||
}
|
||||
|
||||
/**
|
||||
* Begin streaming items to display in the UI. The stream callback will be called
|
||||
* immediately with the present items that match the constraint, and over time whenever
|
||||
* items matching the constraint are added, changed, or deleted.
|
||||
*/
|
||||
public streamItems<I extends DecryptedItemInterface = DecryptedItemInterface>(
|
||||
contentType: string | string[],
|
||||
stream: ItemStream<I>,
|
||||
): () => void {
|
||||
const removeItemManagerObserver = this.items.addObserver<I>(
|
||||
contentType,
|
||||
({ changed, inserted, removed, source }) => {
|
||||
stream({ changed, inserted, removed, source })
|
||||
},
|
||||
)
|
||||
|
||||
const matches = this.items.getItems<I>(contentType)
|
||||
stream({
|
||||
inserted: matches,
|
||||
changed: [],
|
||||
removed: [],
|
||||
source: PayloadEmitSource.InitialObserverRegistrationPush,
|
||||
})
|
||||
|
||||
this.streamRemovers.push(removeItemManagerObserver)
|
||||
|
||||
return () => {
|
||||
removeItemManagerObserver()
|
||||
|
||||
removeFromArray(this.streamRemovers, removeItemManagerObserver)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the server's URL
|
||||
*/
|
||||
public async setHost(host: string): Promise<void> {
|
||||
this.http.setHost(host)
|
||||
|
||||
await this.legacyApi.setHost(host)
|
||||
}
|
||||
|
||||
public getHost(): string {
|
||||
return this.legacyApi.getHost()
|
||||
}
|
||||
|
||||
public async setCustomHost(host: string): Promise<void> {
|
||||
await this.setHost(host)
|
||||
await this.setHost.execute(host)
|
||||
|
||||
this.sockets.setWebSocketUrl(undefined)
|
||||
}
|
||||
|
||||
public getUser(): User | undefined {
|
||||
if (!this.launched) {
|
||||
throw Error('Attempting to access user before application unlocked')
|
||||
}
|
||||
return this.sessions.getUser()
|
||||
}
|
||||
|
||||
public getUserPasswordCreationDate(): Date | undefined {
|
||||
return this.encryption.getPasswordCreatedDate()
|
||||
}
|
||||
@@ -699,10 +633,6 @@ export class SNApplication implements ApplicationInterface, AppGroupManagedAppli
|
||||
return result
|
||||
}
|
||||
|
||||
public noAccount(): boolean {
|
||||
return !this.hasAccount()
|
||||
}
|
||||
|
||||
public hasAccount(): boolean {
|
||||
return this.encryption.hasAccount()
|
||||
}
|
||||
@@ -715,10 +645,6 @@ export class SNApplication implements ApplicationInterface, AppGroupManagedAppli
|
||||
return this.protections.hasProtectionSources()
|
||||
}
|
||||
|
||||
public hasUnprotectedAccessSession(): boolean {
|
||||
return this.protections.hasUnprotectedAccessSession()
|
||||
}
|
||||
|
||||
/**
|
||||
* When a user specifies a non-zero remember duration on a protection
|
||||
* challenge, a session will be started during which protections are disabled.
|
||||
@@ -746,10 +672,6 @@ export class SNApplication implements ApplicationInterface, AppGroupManagedAppli
|
||||
return this.protections.authorizeAutolockIntervalChange()
|
||||
}
|
||||
|
||||
public authorizeSearchingProtectedNotesText(): Promise<boolean> {
|
||||
return this.protections.authorizeSearchingProtectedNotesText()
|
||||
}
|
||||
|
||||
public async createEncryptedBackupFileForAutomatedDesktopBackups(): Promise<BackupFile | undefined> {
|
||||
return this.encryption.createEncryptedBackupFile()
|
||||
}
|
||||
@@ -852,7 +774,6 @@ export class SNApplication implements ApplicationInterface, AppGroupManagedAppli
|
||||
|
||||
this.serviceObservers.length = 0
|
||||
this.managedSubscribers.length = 0
|
||||
this.streamRemovers.length = 0
|
||||
|
||||
this.started = false
|
||||
|
||||
@@ -921,39 +842,6 @@ export class SNApplication implements ApplicationInterface, AppGroupManagedAppli
|
||||
})
|
||||
}
|
||||
|
||||
public async changeAndSaveItem<M extends DecryptedItemMutator = DecryptedItemMutator>(
|
||||
itemToLookupUuidFor: DecryptedItemInterface,
|
||||
mutate: (mutator: M) => void,
|
||||
updateTimestamps = true,
|
||||
emitSource?: PayloadEmitSource,
|
||||
syncOptions?: SyncOptions,
|
||||
): Promise<DecryptedItemInterface | undefined> {
|
||||
await this.mutator.changeItems(
|
||||
[itemToLookupUuidFor],
|
||||
mutate,
|
||||
updateTimestamps ? MutationType.UpdateUserTimestamps : MutationType.NoUpdateUserTimestamps,
|
||||
emitSource,
|
||||
)
|
||||
await this.sync.sync(syncOptions)
|
||||
return this.items.findItem(itemToLookupUuidFor.uuid)
|
||||
}
|
||||
|
||||
public async changeAndSaveItems<M extends DecryptedItemMutator = DecryptedItemMutator>(
|
||||
itemsToLookupUuidsFor: DecryptedItemInterface[],
|
||||
mutate: (mutator: M) => void,
|
||||
updateTimestamps = true,
|
||||
emitSource?: PayloadEmitSource,
|
||||
syncOptions?: SyncOptions,
|
||||
): Promise<void> {
|
||||
await this.mutator.changeItems(
|
||||
itemsToLookupUuidsFor,
|
||||
mutate,
|
||||
updateTimestamps ? MutationType.UpdateUserTimestamps : MutationType.NoUpdateUserTimestamps,
|
||||
emitSource,
|
||||
)
|
||||
await this.sync.sync(syncOptions)
|
||||
}
|
||||
|
||||
public async importData(data: BackupFile, awaitSync = false): Promise<ImportDataReturnType> {
|
||||
const usecase = this.dependencies.get<ImportDataUseCase>(TYPES.ImportDataUseCase)
|
||||
return usecase.execute(data, awaitSync)
|
||||
@@ -991,42 +879,18 @@ export class SNApplication implements ApplicationInterface, AppGroupManagedAppli
|
||||
return this.encryption.hasPasscode()
|
||||
}
|
||||
|
||||
async isLocked(): Promise<boolean> {
|
||||
if (!this.started) {
|
||||
return Promise.resolve(true)
|
||||
}
|
||||
const isPasscodeLocked = await this.challenges.isPasscodeLocked()
|
||||
return isPasscodeLocked || this.isBiometricsSoftLockEngaged
|
||||
}
|
||||
|
||||
public async lock(): Promise<void> {
|
||||
/** Because locking is a critical operation, we want to try to do it safely,
|
||||
* but only up to a certain limit. */
|
||||
/**
|
||||
* Because locking is a critical operation, we want to try to do it safely,
|
||||
* but only up to a certain limit.
|
||||
*/
|
||||
const MaximumWaitTime = 500
|
||||
|
||||
await this.prepareForDeinit(MaximumWaitTime)
|
||||
|
||||
return this.deinit(this.getDeinitMode(), DeinitSource.Lock)
|
||||
}
|
||||
|
||||
public softLockBiometrics(): void {
|
||||
const challenge = new Challenge(
|
||||
[new ChallengePrompt(ChallengeValidation.Biometric)],
|
||||
ChallengeReason.ApplicationUnlock,
|
||||
false,
|
||||
)
|
||||
|
||||
void this.challenges.promptForChallengeResponse(challenge)
|
||||
|
||||
this.isBiometricsSoftLockEngaged = true
|
||||
void this.notifyEvent(ApplicationEvent.BiometricsSoftLockEngaged)
|
||||
|
||||
this.addChallengeObserver(challenge, {
|
||||
onComplete: () => {
|
||||
this.isBiometricsSoftLockEngaged = false
|
||||
void this.notifyEvent(ApplicationEvent.BiometricsSoftLockDisengaged)
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
isNativeMobileWeb() {
|
||||
return this.environment === Environment.Mobile
|
||||
}
|
||||
@@ -1066,10 +930,6 @@ export class SNApplication implements ApplicationInterface, AppGroupManagedAppli
|
||||
return this.migrations.hasPendingMigrations()
|
||||
}
|
||||
|
||||
public generateUuid(): string {
|
||||
return UuidGenerator.GenerateUuid()
|
||||
}
|
||||
|
||||
public presentKeyRecoveryWizard(): void {
|
||||
const service = this.dependencies.get<KeyRecoveryService>(TYPES.KeyRecoveryService)
|
||||
return service.presentKeyRecoveryWizard()
|
||||
@@ -1102,10 +962,6 @@ export class SNApplication implements ApplicationInterface, AppGroupManagedAppli
|
||||
}
|
||||
}
|
||||
|
||||
public getNewSubscriptionToken(): Promise<string | undefined> {
|
||||
return this.legacyApi.getNewSubscriptionToken()
|
||||
}
|
||||
|
||||
public isThirdPartyHostUsed(): boolean {
|
||||
return this.legacyApi.isThirdPartyHostUsed()
|
||||
}
|
||||
@@ -1117,80 +973,7 @@ export class SNApplication implements ApplicationInterface, AppGroupManagedAppli
|
||||
return false
|
||||
}
|
||||
|
||||
return this.getHost() === (await homeServerService.getHomeServerUrl())
|
||||
}
|
||||
|
||||
private createBackgroundDependencies() {
|
||||
this.dependencies.get(TYPES.NotificationService)
|
||||
this.dependencies.get(TYPES.KeyRecoveryService)
|
||||
}
|
||||
|
||||
private defineInternalEventHandlers(): void {
|
||||
this.events.addEventHandler(this.dependencies.get(TYPES.FeaturesService), ApiServiceEvent.MetaReceived)
|
||||
this.events.addEventHandler(this.dependencies.get(TYPES.IntegrityService), SyncEvent.SyncRequestsIntegrityCheck)
|
||||
this.events.addEventHandler(this.dependencies.get(TYPES.SyncService), IntegrityEvent.IntegrityCheckCompleted)
|
||||
this.events.addEventHandler(this.dependencies.get(TYPES.UserService), AccountEvent.SignedInOrRegistered)
|
||||
this.events.addEventHandler(this.dependencies.get(TYPES.SessionManager), ApiServiceEvent.SessionRefreshed)
|
||||
this.events.addEventHandler(this.dependencies.get(TYPES.SubscriptionManager), SessionEvent.Restored)
|
||||
|
||||
this.events.addEventHandler(this.dependencies.get(TYPES.VaultInviteService), SyncEvent.ReceivedSharedVaultInvites)
|
||||
|
||||
this.events.addEventHandler(this.dependencies.get(TYPES.SharedVaultService), SessionEvent.UserKeyPairChanged)
|
||||
this.events.addEventHandler(
|
||||
this.dependencies.get(TYPES.SharedVaultService),
|
||||
NotificationServiceEvent.NotificationReceived,
|
||||
)
|
||||
this.events.addEventHandler(this.dependencies.get(TYPES.SharedVaultService), SyncEvent.ReceivedRemoteSharedVaults)
|
||||
|
||||
this.events.addEventHandler(
|
||||
this.dependencies.get(TYPES.AsymmetricMessageService),
|
||||
SyncEvent.ReceivedAsymmetricMessages,
|
||||
)
|
||||
|
||||
if (this.dependencies.get(TYPES.FilesBackupService)) {
|
||||
this.events.addEventHandler(
|
||||
this.dependencies.get(TYPES.FilesBackupService),
|
||||
ApplicationEvent.ApplicationStageChanged,
|
||||
)
|
||||
}
|
||||
if (this.dependencies.get(TYPES.HomeServerService)) {
|
||||
this.events.addEventHandler(
|
||||
this.dependencies.get(TYPES.HomeServerService),
|
||||
ApplicationEvent.ApplicationStageChanged,
|
||||
)
|
||||
}
|
||||
|
||||
this.events.addEventHandler(this.dependencies.get(TYPES.SessionManager), ApplicationEvent.ApplicationStageChanged)
|
||||
this.events.addEventHandler(
|
||||
this.dependencies.get(TYPES.SelfContactManager),
|
||||
ApplicationEvent.ApplicationStageChanged,
|
||||
)
|
||||
this.events.addEventHandler(
|
||||
this.dependencies.get(TYPES.KeySystemKeyManager),
|
||||
ApplicationEvent.ApplicationStageChanged,
|
||||
)
|
||||
this.events.addEventHandler(
|
||||
this.dependencies.get(TYPES.SubscriptionManager),
|
||||
ApplicationEvent.ApplicationStageChanged,
|
||||
)
|
||||
this.events.addEventHandler(this.dependencies.get(TYPES.FeaturesService), ApplicationEvent.ApplicationStageChanged)
|
||||
this.events.addEventHandler(
|
||||
this.dependencies.get(TYPES.KeyRecoveryService),
|
||||
ApplicationEvent.ApplicationStageChanged,
|
||||
)
|
||||
this.events.addEventHandler(this.dependencies.get(TYPES.MigrationService), ApplicationEvent.ApplicationStageChanged)
|
||||
this.events.addEventHandler(
|
||||
this.dependencies.get(TYPES.PreferencesService),
|
||||
ApplicationEvent.ApplicationStageChanged,
|
||||
)
|
||||
this.events.addEventHandler(
|
||||
this.dependencies.get(TYPES.ProtectionService),
|
||||
ApplicationEvent.ApplicationStageChanged,
|
||||
)
|
||||
this.events.addEventHandler(
|
||||
this.dependencies.get(TYPES.DiskStorageService),
|
||||
ApplicationEvent.ApplicationStageChanged,
|
||||
)
|
||||
return this.getHost.execute().getValue() === (await homeServerService.getHomeServerUrl())
|
||||
}
|
||||
|
||||
get device(): DeviceInterface {
|
||||
@@ -1361,14 +1144,34 @@ export class SNApplication implements ApplicationInterface, AppGroupManagedAppli
|
||||
return this.dependencies.get<SharedVaultServiceInterface>(TYPES.SharedVaultService)
|
||||
}
|
||||
|
||||
private get migrations(): MigrationService {
|
||||
return this.dependencies.get<MigrationService>(TYPES.MigrationService)
|
||||
public get changeAndSaveItem(): ChangeAndSaveItem {
|
||||
return this.dependencies.get<ChangeAndSaveItem>(TYPES.ChangeAndSaveItem)
|
||||
}
|
||||
|
||||
private get legacyApi(): LegacyApiService {
|
||||
public get getHost(): GetHost {
|
||||
return this.dependencies.get<GetHost>(TYPES.GetHost)
|
||||
}
|
||||
|
||||
public get setHost(): SetHost {
|
||||
return this.dependencies.get<SetHost>(TYPES.SetHost)
|
||||
}
|
||||
|
||||
public get legacyApi(): LegacyApiService {
|
||||
return this.dependencies.get<LegacyApiService>(TYPES.LegacyApiService)
|
||||
}
|
||||
|
||||
public get mfa(): MfaServiceInterface {
|
||||
return this.dependencies.get<MfaService>(TYPES.MfaService)
|
||||
}
|
||||
|
||||
public get generateUuid(): GenerateUuid {
|
||||
return this.dependencies.get<GenerateUuid>(TYPES.GenerateUuid)
|
||||
}
|
||||
|
||||
private get migrations(): MigrationService {
|
||||
return this.dependencies.get<MigrationService>(TYPES.MigrationService)
|
||||
}
|
||||
|
||||
private get http(): HttpServiceInterface {
|
||||
return this.dependencies.get<HttpServiceInterface>(TYPES.HttpService)
|
||||
}
|
||||
@@ -1376,8 +1179,4 @@ export class SNApplication implements ApplicationInterface, AppGroupManagedAppli
|
||||
private get sockets(): WebSocketsService {
|
||||
return this.dependencies.get<WebSocketsService>(TYPES.WebSocketsService)
|
||||
}
|
||||
|
||||
private get mfa(): SNMfaService {
|
||||
return this.dependencies.get<SNMfaService>(TYPES.MfaService)
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user