* feat: move mobile-specific security items to Web when rendered in WebView * feat: better UI for biometrics section * feat: move Multitasking Privacy section to WebView (mostly UI) * feat: move Multitasking Privacy section to WebView (going to understand why in WebView multitasking privacy value is auto-changed after reopening the WebView) * feat: store MultitaskingPrivacy value as "NonWrapped" so that it's the same both on mobile and WebView * feat: open WebView correctly when "Storage Encryption" is disabled on mobile * fix: remove unnecessary changes and comments * chore: revert ios-related unneeded changes * fix: let Android to correctly recognize the NativeMobileWeb environment when opening WebView on Android * fix: correct styles for the selected state of Biometrics/Passcode options * chore: code cleanup * fix: store Multitasking/Screenshot Privacy in the `Default` storage value mode * chore: remove comment * fix: use application's method instead of directly updating Screenshot Privacy preference * fix: remove unused variable * fix: use methods from Application and MobileDeviceInterface in all places, remove duplicate code * fix: hide Multitasking Privacy and Biometrics Lock in WebView Co-authored-by: Aman Harwara
SNJS
SNJS is a client-side JavaScript library for Standard Notes that contains shared logic for all Standard Notes clients.
Introduction
SNJS is a shared library for use in all Standard Notes clients (desktop, web, and mobile). Its role is to extract any business or data logic from client code, so that clients are mostly responsible for UI-level code, and don’t have to think about encryption and key management, or even authentication or storage specifics. Extracting the code into a shared library also prevents us from having to write the same critical code on multiple platforms.
The entry point of SNJS is the SNApplication class. The application class is a complete unit of application functionality. Theoretically, many instances of an application can be created, each with its own storage namespace and memory state. This can allow clients to support multiple user accounts.
An application must be supplied a custom subclass of DeviceInterface. This allows the library to generalize all behavior a client will need to perform throughout normal client operation, such as saving data to a local database store, saving key/values, and accessing the keychain.
On Web platforms SNJS interacts with sncrypto to perform operations as mentioned in the specification document. This includes operations like key generation and data encryption.
SNJS also interacts with a Standard Notes syncing server, which is a zero-knowledge data and sync store that deals with encrypted data, and never learns of client secrets or sensitive information.
Installation
yarn add snjs
Integrating in module environment
import { SNApplication } from 'snjs';
Integrating in non-module web environment
<script src="snjs.js"></script>
Object.assign(window, SNLibrary);
Building
yarn install --pure-lockfileyarn startto start Webpack in development mode (watches changes), oryarn buildto create dist files.
Tests
E2E Tests
To run a stable server environment for E2E tests that is up to date with production, clone the e2e repository, then run:
yarn install --immutable
yarn test:stable-server
Once the server infrastructure is ready, and you've built all packages, you can run the test suite in the browser via:
yarn start:server:e2e
Unit Tests
From the root of the repository, run:
yarn run test