on master help sign in
Got things working on device
cc304beiko
appname.desktop+2−2
@@ -1,7 +1,7 @@
1[Desktop Entry]
1[Desktop Entry]
2Name=App Title
2Name=App Title
3−Exec=webapp-container --app-id="appname.iko" $@ index.html
3+Exec=webapp-container --inspector=9223 --app-id="appname.iko" $@ index.html
4−Icon=assets/logo.svg
4+Icon=logo.svg
5Terminal=false
5Terminal=false
6Type=Application
6Type=Application
7X-Ubuntu-Touch=true
7X-Ubuntu-Touch=true
build.sh+5−11
@@ -1,15 +1,9 @@
1−#!/bin/sh
1+#!/bin/bash
2
2
3−cp -r "$SRC_DIR"/{appname.apparmor,appname.desktop,vanilla,index.html,style.css} "$INSTALL_DIR"
3+set -e
4
4
5−BUILDDIR=$(mktemp -d)
5+cp -r "$SRC_DIR"/{appname.apparmor,appname.desktop,vanilla,index.html,style.css,manifest.json,logo.svg} "$INSTALL_DIR"
6
6
7−cp -r $SRC_DIR/* $BUILDDIR
7+elm make --debug "$SRC_DIR/frontend/Main.elm" --output="$INSTALL_DIR/elm.js"
8
8
9−ls $BUILDDIR
10−
11−elm make --debug "$BUILDDIR/frontend/Main.elm" --output="$INSTALL_DIR/elm.js"
12−
13−(cd "$BUILDDIR" && ./dev/build-bw.sh)
14−
15−(cd "$BUILDDIR" && spago bundle-app --to "$INSTALL_DIR/backend.js")
9+(cd "$SRC_DIR" && spago bundle-app --to "$INSTALL_DIR/backend.js")
bw/src/BW.js+14−10
@@ -17,7 +17,6 @@ import { StateService as BaseStateService } from "../../deps/bw/libs/shared/dist
17import { PasswordTokenRequest } from "../../deps/bw/libs/shared/dist/src/models/request/identityToken/passwordTokenRequest";
17import { PasswordTokenRequest } from "../../deps/bw/libs/shared/dist/src/models/request/identityToken/passwordTokenRequest";
18import { TokenRequestTwoFactor } from "../../deps/bw/libs/common/src/models/request/identityToken/tokenRequestTwoFactor.ts";
18import { TokenRequestTwoFactor } from "../../deps/bw/libs/common/src/models/request/identityToken/tokenRequestTwoFactor.ts";
19
19
20−
21function sanitize(obj) {
20function sanitize(obj) {
22 return JSON.parse(JSON.stringify(obj));
21 return JSON.parse(JSON.stringify(obj));
23}
22}
@@ -201,7 +200,12 @@ class BrowserCryptoService extends CryptoService {
201 async retrieveKeyFromStorage(keySuffix) {
200 async retrieveKeyFromStorage(keySuffix) {
202 if (keySuffix === "biometric") {
201 if (keySuffix === "biometric") {
203 await this.platformUtilService.authenticateBiometric();
202 await this.platformUtilService.authenticateBiometric();
204− return (await this.getKey())?.keyB64;
203+ const k = await this.getKey()
204+ if (k == null) {
205+ return null
206+ } else {
207+ return k.keyB64
208+ }
205 }
209 }
206
210
207 return await super.retrieveKeyFromStorage(keySuffix);
211 return await super.retrieveKeyFromStorage(keySuffix);
@@ -502,8 +506,8 @@ class StateService extends BaseStateService {
502 }
506 }
503
507
504 async getBrowserGroupingComponentState(options) {
508 async getBrowserGroupingComponentState(options) {
505− return (await this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions)))
509+ const x = await this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions))
506− ?.groupings;
510+ return x == null ? null : x.groupings;
507 }
511 }
508
512
509 async setBrowserGroupingComponentState(value, options) {
513 async setBrowserGroupingComponentState(value, options) {
@@ -515,8 +519,8 @@ class StateService extends BaseStateService {
515 }
519 }
516
520
517 async getBrowserCipherComponentState(options) {
521 async getBrowserCipherComponentState(options) {
518− return (await this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions)))
522+ const x = await this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions))
519− ?.ciphers;
523+ return x == null ? null : x.ciphers;
520 }
524 }
521
525
522 async setBrowserCipherComponentState(value, options) {
526 async setBrowserCipherComponentState(value, options) {
@@ -528,8 +532,8 @@ class StateService extends BaseStateService {
528 }
532 }
529
533
530 async getBrowserSendComponentState(options) {
534 async getBrowserSendComponentState(options) {
531− return (await this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions)))
535+ const x = await this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions))
532− ?.send;
536+ return x == null ? null : x.send;
533 }
537 }
534
538
535 async setBrowserSendComponentState(value, options) {
539 async setBrowserSendComponentState(value, options) {
@@ -540,8 +544,8 @@ class StateService extends BaseStateService {
540 await this.saveAccount(account, this.reconcileOptions(options, this.defaultInMemoryOptions));
544 await this.saveAccount(account, this.reconcileOptions(options, this.defaultInMemoryOptions));
541 }
545 }
542 async getBrowserSendTypeComponentState(options) {
546 async getBrowserSendTypeComponentState(options) {
543− return (await this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions)))
547+ const x = await this.getAccount(this.reconcileOptions(options, this.defaultInMemoryOptions))
544− ?.sendType;
548+ return x == null ? null : x.sendType;
545 }
549 }
546
550
547 async setBrowserSendTypeComponentState(value, options) {
551 async setBrowserSendTypeComponentState(value, options) {
bw/src/BW.purs+6−2
@@ -4,13 +4,17 @@ import BW.Types
4import Prelude
4import Prelude
5
5
6import Control.Promise (Promise)
6import Control.Promise (Promise)
7+import Data.ArrayBuffer.Types (ArrayBuffer)
8+import Data.EncString (EncString)
7−import Data.Function.Uncurried (Fn3, Fn4)
9+import Data.Function.Uncurried (Fn2, Fn3, Fn4)
8import Data.Nullable (Nullable)
10import Data.Nullable (Nullable)
9import Effect (Effect)
11import Effect (Effect)
10
12
11type CryptoService = {
13type CryptoService = {
12 makeKey :: Fn4 Password String KDF Int (Promise SymmetricCryptoKey),
14 makeKey :: Fn4 Password String KDF Int (Promise SymmetricCryptoKey),
13− hashPassword :: Fn3 Password SymmetricCryptoKey (Nullable HashPurpose) (Promise Hash)
15+ hashPassword :: Fn3 Password SymmetricCryptoKey (Nullable HashPurpose) (Promise Hash),
16+ decryptToUtf8 :: Fn2 EncString SymmetricCryptoKey (Promise String),
17+ decryptToBytes :: Fn2 EncString SymmetricCryptoKey (Promise ArrayBuffer)
14}
18}
15
19
16type ApiService = {
20type ApiService = {
bw/src/Data/EncString.jsnew file+5
@@ -0,0 +1,5 @@
1+import { EncString } from "../../../deps/bw/libs/shared/dist/src/models/domain/encString"
2+
3+export function fromString(str) {
4+ return new EncString(str)
5+}
bw/src/Data/EncString.pursnew file+7
@@ -0,0 +1,7 @@
1+module Data.EncString where
2+
3+import Prelude
4+
5+foreign import data EncString :: Type
6+
7+foreign import fromString :: String -> EncString
clickable.yaml+1
@@ -12,5 +12,6 @@ image_setup:
12
12
13 - (cd /tmp && curl -L -o elm.gz https://github.com/elm/compiler/releases/download/0.19.1/binary-for-linux-64-bit.gz && gunzip elm.gz && chmod +x elm && mv elm /usr/local/bin/)
13 - (cd /tmp && curl -L -o elm.gz https://github.com/elm/compiler/releases/download/0.19.1/binary-for-linux-64-bit.gz && gunzip elm.gz && chmod +x elm && mv elm /usr/local/bin/)
14 - npm install -g spago esbuild purescript --unsafe-perm=true
14 - npm install -g spago esbuild purescript --unsafe-perm=true
15+ - (cd / && curl https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.37.1.tar.xz >git.tar.gz && tar -xvf git.tar.gz && cd git-2.37.1 && ./configure --without-curl && make)
15
16
16restrict_arch: all
17restrict_arch: all
dev/build-bw.sh+1−1
@@ -2,4 +2,4 @@
2
2
3(cd deps/bw && npm install)
3(cd deps/bw && npm install)
4
4
5−(cd deps/bw/libs/common/ && npm run clean && npm exec -c "tsc -m es2020")
5+(cd deps/bw/libs/common/ && npm run clean && npm exec -c "tsc -m es2020 -t es2018")
index.html−1
@@ -13,7 +13,6 @@
13
13
14<body>
14<body>
15 <div id="elm"></div>
15 <div id="elm"></div>
16− <div id="elm-2"></div>
17 <script src="backend.js"></script>
16 <script src="backend.js"></script>
18</body>
17</body>
19
18
assets/logo.svg → logo.svgrenamed

The content is the same.