Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f9d721f179 | ||
|
|
7bb859f7df | ||
|
|
87df40db11 | ||
|
|
c0026b0b5f | ||
|
|
8c3e89368c | ||
|
|
36e08df09e | ||
|
|
d930387758 | ||
|
|
42bfe570e1 | ||
|
|
e877f8d27d | ||
|
|
6d1a5ca1a5 | ||
|
|
5d92e65a92 | ||
|
|
befbecb131 | ||
|
|
3d27747a91 | ||
|
|
b4d6a374d3 | ||
|
|
42eb428c4c | ||
|
|
7a1ab6a48c | ||
|
|
044024b549 | ||
|
|
7b9de10d80 | ||
|
|
e527f83dd4 | ||
|
|
1cffcde52d | ||
|
|
06cd3a53ac | ||
|
|
45817b10e3 | ||
|
|
8220b3619d |
No files matched your search
@@ -197,11 +197,52 @@ jobs:
|
||||
echo "EM_CONFIG=$HOME/emsdk/.emscripten" >> "$GITHUB_ENV"
|
||||
echo "$HOME/emsdk/upstream/emscripten" >> "$GITHUB_PATH"
|
||||
- run: make site
|
||||
- run: cd build/site && zip -qr ../pass-web.zip .
|
||||
- name: Package web site and HTML5 app
|
||||
run: |
|
||||
set -euo pipefail
|
||||
cd build/site
|
||||
zip -qr ../pass-web.zip .
|
||||
|
||||
mkdir -p ../pass-html5
|
||||
cp app/index.html ../pass-html5/
|
||||
cp app/app.js ../pass-html5/
|
||||
cp app/index.js ../pass-html5/
|
||||
cp app/index.wasm ../pass-html5/
|
||||
cp app/sw.js ../pass-html5/
|
||||
cp manifest.webmanifest ../pass-html5/
|
||||
cp -R icons ../pass-html5/icons
|
||||
sed -i \
|
||||
-e 's#href="/manifest.webmanifest"#href="manifest.webmanifest"#g' \
|
||||
-e 's#href="/icons/#href="icons/#g' \
|
||||
-e 's#src="/icons/#src="icons/#g' \
|
||||
../pass-html5/index.html
|
||||
python3 - <<'PY'
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
root = Path("../pass-html5")
|
||||
manifest = json.loads((root / "manifest.webmanifest").read_text())
|
||||
manifest["start_url"] = "."
|
||||
manifest["scope"] = "."
|
||||
for icon in manifest.get("icons", []):
|
||||
icon["src"] = icon.get("src", "").lstrip("/")
|
||||
(root / "manifest.webmanifest").write_text(json.dumps(manifest, indent=2) + "\n")
|
||||
|
||||
sw = (root / "sw.js").read_text()
|
||||
sw = sw.replace(
|
||||
"const appFiles = ['/app/', '/app/app.js', '/app/index.js', '/app/index.wasm', '/manifest.webmanifest', '/icons/icon-192.png', '/icons/icon-512.png'];",
|
||||
"const appFiles = ['.', 'app.js', 'index.js', 'index.wasm', 'manifest.webmanifest', 'icons/icon-192.png', 'icons/icon-512.png'];",
|
||||
)
|
||||
(root / "sw.js").write_text(sw)
|
||||
PY
|
||||
cd ../pass-html5
|
||||
zip -qr ../pass-html5.zip .
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: web
|
||||
path: build/pass-web.zip
|
||||
path: |
|
||||
build/pass-web.zip
|
||||
build/pass-html5.zip
|
||||
if-no-files-found: error
|
||||
|
||||
publish:
|
||||
@@ -289,3 +330,89 @@ jobs:
|
||||
tag_name: ${{ steps.version.outputs.tag }}
|
||||
generate_release_notes: true
|
||||
files: build/artifacts/*
|
||||
|
||||
publish-itch:
|
||||
name: Publish itch.io
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 45
|
||||
continue-on-error: true
|
||||
needs:
|
||||
- web
|
||||
- android
|
||||
- gui
|
||||
- publish
|
||||
if: needs.publish.outputs.released == 'true'
|
||||
env:
|
||||
BUTLER_API_KEY: ${{ secrets.ITCH_API_KEY }}
|
||||
|
||||
steps:
|
||||
- name: Check itch.io Secret
|
||||
run: |
|
||||
set -euo pipefail
|
||||
if [ -z "${BUTLER_API_KEY:-}" ]; then
|
||||
echo "ITCH_API_KEY secret is required to publish itch.io"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Download Release Artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: build/artifacts
|
||||
merge-multiple: true
|
||||
|
||||
- name: Install Butler
|
||||
timeout-minutes: 15
|
||||
run: |
|
||||
set -euo pipefail
|
||||
curl -fsSL \
|
||||
https://broth.itch.zone/butler/linux-amd64/LATEST/archive/default \
|
||||
-o "$RUNNER_TEMP/butler.zip"
|
||||
mkdir -p "$RUNNER_TEMP/butler"
|
||||
unzip -q "$RUNNER_TEMP/butler.zip" -d "$RUNNER_TEMP/butler"
|
||||
chmod +x "$RUNNER_TEMP/butler/butler"
|
||||
echo "$RUNNER_TEMP/butler" >> "$GITHUB_PATH"
|
||||
|
||||
- name: Publish Release Builds to itch.io
|
||||
run: |
|
||||
set -euo pipefail
|
||||
VERSION="$(sed -n '1p' VERSION)"
|
||||
|
||||
html5_zip="build/artifacts/pass-html5.zip"
|
||||
android_apk="build/artifacts/pass-android.apk"
|
||||
linux_appimage="build/artifacts/pass-$VERSION-x86_64.AppImage"
|
||||
|
||||
test -f "$html5_zip"
|
||||
test -f "$android_apk"
|
||||
test -f "$linux_appimage"
|
||||
|
||||
butler_push() {
|
||||
target="$1"
|
||||
channel="$2"
|
||||
attempt=1
|
||||
log_file="$(mktemp)"
|
||||
|
||||
while [ "$attempt" -le 6 ]; do
|
||||
if butler push "$target" "waozi/pass:$channel" --userversion "$VERSION" 2>&1 | tee "$log_file"; then
|
||||
rm -f "$log_file"
|
||||
return 0
|
||||
fi
|
||||
if ! grep -q "latest build is still processing" "$log_file"; then
|
||||
rm -f "$log_file"
|
||||
return 1
|
||||
fi
|
||||
echo "itch.io channel $channel is still processing; retrying in 60s ($attempt/6)"
|
||||
sleep 60
|
||||
attempt=$((attempt + 1))
|
||||
done
|
||||
|
||||
rm -f "$log_file"
|
||||
echo "itch.io channel $channel was still processing after retries"
|
||||
return 1
|
||||
}
|
||||
|
||||
butler_push "$html5_zip" html5
|
||||
butler_push "$android_apk" android
|
||||
butler_push "$linux_appimage" linux
|
||||
@@ -1,4 +1,4 @@
|
||||
name: Netlify
|
||||
name: Cloudflare Pages
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -10,7 +10,7 @@ permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: netlify-${{ github.ref }}
|
||||
group: pages-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
@@ -62,23 +62,12 @@ jobs:
|
||||
with:
|
||||
name: pass-site
|
||||
path: build/site
|
||||
- name: Install Netlify CLI
|
||||
run: npm install --global netlify-cli
|
||||
- name: Deploy Preview To Netlify
|
||||
run: |
|
||||
set -euo pipefail
|
||||
auth_token="$(printf '%s' "$NETLIFY_AUTH_TOKEN" | tr -d '\r\n')"
|
||||
site_id="$(printf '%s' "$NETLIFY_SITE_ID" | tr -d '\r\n')"
|
||||
netlify deploy \
|
||||
--dir build/site \
|
||||
--no-build \
|
||||
--alias "pr-${{ github.event.pull_request.number }}" \
|
||||
--message "Preview ${{ github.event.pull_request.number }}" \
|
||||
--auth "$auth_token" \
|
||||
--site "$site_id"
|
||||
env:
|
||||
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
||||
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
|
||||
- name: Deploy Preview To Cloudflare Pages
|
||||
uses: cloudflare/wrangler-action@v3
|
||||
with:
|
||||
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
||||
command: pages deploy build/site --project-name=pass --branch=${{ github.head_ref || github.ref_name }}
|
||||
|
||||
deploy-production:
|
||||
name: Deploy Production
|
||||
@@ -90,29 +79,9 @@ jobs:
|
||||
with:
|
||||
name: pass-site
|
||||
path: build/site
|
||||
- name: Package Site
|
||||
run: |
|
||||
set -euo pipefail
|
||||
test -s build/site/index.html
|
||||
cd build/site
|
||||
zip -qr ../pass-site.zip .
|
||||
test -s ../pass-site.zip
|
||||
- name: Deploy Production To Netlify
|
||||
run: |
|
||||
set -euo pipefail
|
||||
auth_token="$(printf '%s' "$NETLIFY_AUTH_TOKEN" | tr -d '\r\n')"
|
||||
site_id="$(printf '%s' "$NETLIFY_SITE_ID" | tr -d '\r\n')"
|
||||
test -n "$auth_token" || { echo "::error::NETLIFY_AUTH_TOKEN is empty or missing"; exit 1; }
|
||||
test -n "$site_id" || { echo "::error::NETLIFY_SITE_ID is empty or missing"; exit 1; }
|
||||
|
||||
response="$(curl --fail-with-body --silent --show-error \
|
||||
-X POST \
|
||||
-H "Authorization: Bearer $auth_token" \
|
||||
-H "Content-Type: application/zip" \
|
||||
--data-binary "@build/pass-site.zip" \
|
||||
"https://api.netlify.com/api/v1/sites/$site_id/deploys")"
|
||||
|
||||
python3 -c 'import json, sys; deploy = json.loads(sys.argv[1]); state = deploy.get("state", ""); url = deploy.get("ssl_url") or deploy.get("url") or deploy.get("deploy_ssl_url") or deploy.get("deploy_url") or deploy.get("id"); print(f"Netlify deploy {state}: {url}"); raise SystemExit(1 if state in ("error", "failed") else 0)' "$response"
|
||||
env:
|
||||
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
||||
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
|
||||
- name: Deploy Production To Cloudflare Pages
|
||||
uses: cloudflare/wrangler-action@v3
|
||||
with:
|
||||
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
||||
command: pages deploy build/site --project-name=pass --branch=master
|
||||
@@ -1,5 +1,12 @@
|
||||
# Changelog
|
||||
|
||||
## [0.2.9] - 2026-09-05
|
||||
|
||||
- Keep bottom navigation, password controls, and dialog icons readable with
|
||||
dark tints in light mode and light tints in dark mode.
|
||||
- Prevent taps in Theme Settings from reaching fields underneath or opening
|
||||
the keyboard when saving the theme.
|
||||
|
||||
## [0.2.8] - 2026-08-26
|
||||
|
||||
- Match LessPass clients for the same site, login, master password, counter,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.PHONY: all cli kry-c gui native run test native-test cli-test lesspass-compat-test check-submodule-urls kry-smoke web web-canvas site web-smoke android-debug android-smoke android-input-test e2e install install-cli uninstall-cli install-gui uninstall-gui package-deb package-appimage
|
||||
.PHONY: all cli kry-c kry-c-plan9 gui native run test coverage native-test cli-test runtime-test lesspass-compat-test check-submodule-urls kry-smoke web web-canvas site web-smoke android-debug android-smoke android-input-test e2e install install-cli uninstall-cli install-gui uninstall-gui package-deb package-appimage
|
||||
|
||||
BIN_DIR ?= $(HOME)/bin
|
||||
DATA_DIR ?= $(if $(XDG_DATA_HOME),$(XDG_DATA_HOME),$(HOME)/.local/share)
|
||||
@@ -25,8 +25,8 @@ WEB_APP_EMBEDDED_ASSETS_C := build/web/pass_embedded_assets.c
|
||||
WEB_APP_ASSETS := vendor/kryon/fonts/noto/NotoSans-Regular.ttf assets/fonts/emoji.ttf
|
||||
KRYON_ICON_ASSETS_C := vendor/kryon/src/ui/ui_icon_assets.c
|
||||
KRYON_WEB_SRCS_ALL := $(filter-out $(KRYON_ICON_ASSETS_C),$(shell find vendor/kryon/src -type f -name '*.c' | LC_ALL=C sort)) $(KRYON_ICON_ASSETS_C)
|
||||
KRYON_WEB_SRCS := $(filter-out vendor/kryon/src/backend/libdraw_% vendor/kryon/src/backend/termi_% vendor/kryon/src/file_dialog/file_dialog.c vendor/kryon/src/ksync/% vendor/kryon/src/runtime_assets/% vendor/kryon/src/notification/% vendor/kryon/src/platform/plan9/% vendor/kryon/src/scene/physics_world.c vendor/kryon/src/scene/node_body2d.c vendor/kryon/src/scene/node_area2d.c vendor/kryon/src/scene/node_collision_shape2d.c,$(KRYON_WEB_SRCS_ALL))
|
||||
PASS_WEB_SRCS := droid/app/src/main/cpp/main.c droid/app/src/main/cpp/android_bridge.c native/pass_core.c native/pass_runtime.c $(KRY_C_APP_SRCS) $(WEB_APP_EMBEDDED_ASSETS_C)
|
||||
KRYON_WEB_SRCS := $(filter-out vendor/kryon/src/backend/dom_% vendor/kryon/src/backend/libdraw_% vendor/kryon/src/backend/termi_% vendor/kryon/src/file_dialog/file_dialog.c vendor/kryon/src/ksync/% vendor/kryon/src/runtime_assets/% vendor/kryon/src/notification/% vendor/kryon/src/platform/plan9/% vendor/kryon/src/scene/physics_world.c vendor/kryon/src/scene/node_body2d.c vendor/kryon/src/scene/node_area2d.c vendor/kryon/src/scene/node_collision_shape2d.c,$(KRYON_WEB_SRCS_ALL))
|
||||
PASS_WEB_SRCS := droid/app/src/main/cpp/main.c native/pass_core.c native/pass_runtime.c $(KRY_C_APP_SRCS) $(WEB_APP_EMBEDDED_ASSETS_C)
|
||||
WEB_CFLAGS := -Wall -Wextra -std=gnu99 -Os -DPLATFORM_WEB -DGRAPHICS_API_OPENGL_ES2 -D_DEFAULT_SOURCE -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DUI_EMBEDDED_ONLY=1 -DKRYON_WITH_PHYSICS=0 -Ivendor/kryon/include -Ivendor/kryon/src -I$(KRY_C_GENERATED_DIR) -Inative -Idroid/app/src/main/cpp
|
||||
WEB_LDFLAGS := -sASYNCIFY -sASYNCIFY_STACK_SIZE=1048576 -sFORCE_FILESYSTEM=1 -sFETCH=1 -sALLOW_MEMORY_GROWTH=1 -sINITIAL_MEMORY=134217728 -sSTACK_SIZE=16777216 -lidbfs.js -lm
|
||||
GUI_CFLAGS := -Wall -Wextra -std=gnu99 -O2 -D_DEFAULT_SOURCE -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -DUI_EMBEDDED_ONLY=1 -DKRYON_WITH_PHYSICS=0 -Ivendor/kryon/include -Ivendor/kryon/src -I$(KRY_C_GENERATED_DIR) -Inative -Idroid/app/src/main/cpp $(shell pkg-config --cflags sdl2 gtk+-3.0 2>/dev/null)
|
||||
@@ -58,12 +58,28 @@ $(KRY_C_STAMP): $(K2C) $(KRY_APP_SRCS) | build
|
||||
$(K2C) --no-main --root . -o $(KRY_C_GENERATED_DIR) $(KRY_APP_SRCS)
|
||||
touch $@
|
||||
|
||||
PLAN9_DIR := build/plan9
|
||||
PLAN9_GENERATED := $(PLAN9_DIR)/generated
|
||||
PLAN9_FILE_LIST := $(PLAN9_DIR)/generated-c-files.txt
|
||||
PLAN9_EMBEDDED_ASSETS_C := $(PLAN9_DIR)/pass_embedded_assets.c
|
||||
PLAN9_ASSETS := vendor/kryon/fonts/noto/NotoSans-Regular.ttf assets/fonts/emoji.ttf
|
||||
|
||||
# Native Plan 9 build inputs: k2c emits 8c-safe C directly, the embedded
|
||||
# table carries the two fonts, and the file list feeds the mkfile.
|
||||
kry-c-plan9: kry-c
|
||||
rm -rf $(PLAN9_GENERATED)
|
||||
$(K2C) --no-main --plan9 --root . \
|
||||
--include-dir vendor/kryon/include --include-dir native \
|
||||
--include-dir droid/app/src/main/cpp \
|
||||
-o $(PLAN9_GENERATED) $(KRY_APP_SRCS)
|
||||
find $(PLAN9_GENERATED) -type f -name '*.c' | LC_ALL=C sort > $(PLAN9_FILE_LIST)
|
||||
sh vendor/kryon/scripts/embed-assets.sh $(PLAN9_EMBEDDED_ASSETS_C) $(PLAN9_ASSETS)
|
||||
|
||||
gui: build/pass-gui
|
||||
|
||||
build/pass-gui: $(KRYON_BUILD_DIR)/libkryon.a $(KRY_C_STAMP) droid/app/src/main/cpp/main.c droid/app/src/main/cpp/android_bridge.c native/pass_core.c native/pass_runtime.c native/pass_runtime.h | build
|
||||
build/pass-gui: $(KRYON_BUILD_DIR)/libkryon.a $(KRY_C_STAMP) droid/app/src/main/cpp/main.c native/pass_core.c native/pass_runtime.c native/pass_runtime.h | build
|
||||
$(CC) $(GUI_CFLAGS) -o $@ \
|
||||
droid/app/src/main/cpp/main.c \
|
||||
droid/app/src/main/cpp/android_bridge.c \
|
||||
native/pass_core.c \
|
||||
native/pass_runtime.c \
|
||||
$(KRY_C_APP_SRCS) \
|
||||
@@ -95,7 +111,26 @@ uninstall-gui:
|
||||
rm -f $(BIN_DIR)/pass-gui $(DATA_DIR)/applications/xyz.waozi.pass.desktop $(DATA_DIR)/icons/hicolor/512x512/apps/pass.png
|
||||
|
||||
test:
|
||||
$(MAKE) native-test cli-test lesspass-compat-test kry-smoke
|
||||
$(MAKE) native-test cli-test runtime-test lesspass-compat-test kry-smoke
|
||||
|
||||
coverage:
|
||||
mkdir -p build/coverage
|
||||
rm -f build/coverage/*.gcda build/coverage/*.gcno build/coverage/*.gcov *.gcov
|
||||
$(CC) --coverage -O0 -g -Wall -Wextra -std=gnu99 -Inative -c native/pass_core.c -o build/coverage/pass_core.o
|
||||
$(CC) --coverage -O0 -g -Wall -Wextra -std=gnu99 -Inative -c native/pass_core_test.c -o build/coverage/pass_core_test.o
|
||||
$(CC) --coverage build/coverage/pass_core.o build/coverage/pass_core_test.o -o build/coverage/pass_core_test
|
||||
./build/coverage/pass_core_test
|
||||
$(CC) --coverage -O0 -g -Wall -Wextra -std=gnu99 -Inative -DPASS_VERSION=\"$(PASS_VERSION)\" -c native/pass_cli.c -o build/coverage/pass_cli.o
|
||||
$(CC) --coverage build/coverage/pass_cli.o build/coverage/pass_core.o -o build/coverage/pass_cli
|
||||
sh scripts/cli_test.sh build/coverage/pass_cli
|
||||
$(CC) --coverage -O0 -g -Wall -Wextra -std=gnu99 -Inative -Idroid/app/src/main/cpp -Ivendor/kryon/include -c native/pass_runtime.c -o build/coverage/pass_runtime.o
|
||||
$(CC) --coverage -O0 -g -Wall -Wextra -std=gnu99 -Ivendor/kryon/include -c vendor/kryon/src/core/app_storage.c -o build/coverage/app_storage.o
|
||||
$(CC) --coverage -O0 -g -Wall -Wextra -std=gnu99 -Ivendor/kryon/include -c vendor/kryon/src/kry_std/kry_filesystem.c -o build/coverage/kry_filesystem.o
|
||||
$(CC) --coverage -O0 -g -Wall -Wextra -std=gnu99 -Inative -Idroid/app/src/main/cpp -Ivendor/kryon/include -c native/pass_runtime_test.c -o build/coverage/pass_runtime_test.o
|
||||
$(CC) --coverage build/coverage/pass_runtime.o build/coverage/pass_runtime_test.o build/coverage/pass_core.o build/coverage/app_storage.o build/coverage/kry_filesystem.o -o build/coverage/pass_runtime_test
|
||||
./build/coverage/pass_runtime_test
|
||||
for data in build/coverage/*.gcda; do gcov -b -c "$$data"; done
|
||||
mv *.gcov build/coverage/
|
||||
|
||||
# Checks the C generator used by the CLI and every Kry app target.
|
||||
native-test:
|
||||
@@ -106,6 +141,12 @@ native-test:
|
||||
cli-test: cli
|
||||
test "$$(./pass lesspass.com [email protected] password)" = '\g-A1-.OHEwrXjT#'
|
||||
test "$$(./pass --length 20 --counter 2 service.test [email protected] master)" = 'j:x_Lo5b1XL_j0we%z`e'
|
||||
sh scripts/cli_test.sh ./pass
|
||||
|
||||
runtime-test:
|
||||
mkdir -p build
|
||||
$(CC) -Wall -Wextra -O2 -std=gnu99 -Inative -Idroid/app/src/main/cpp -Ivendor/kryon/include native/pass_runtime.c native/pass_core.c vendor/kryon/src/core/app_storage.c vendor/kryon/src/kry_std/kry_filesystem.c native/pass_runtime_test.c -o build/pass_runtime_test
|
||||
./build/pass_runtime_test
|
||||
|
||||
lesspass-compat-test: cli
|
||||
python3 scripts/lesspass_compat_test.py --cli ./pass
|
||||
|
||||
@@ -1,8 +1,18 @@
|
||||
# pass
|
||||
<p align="center">
|
||||
<img src="assets/app/readme-banner.png" alt="Pass" width="100%">
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://f-droid.org/packages/xyz.waozi.pass/">
|
||||
<img src="assets/app/badge-f-droid.png" alt="Get it on F-Droid" height="56">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
# Pass
|
||||
|
||||
Website and browser app: [pass.waozi.xyz](https://pass.waozi.xyz/)
|
||||
|
||||
`pass` is a stateless password generator: the same site, login, master
|
||||
Pass is a stateless password generator: the same site, login, master
|
||||
password, and settings produce the same result without a password database.
|
||||
It is a new, independently written implementation of the LessPass generation
|
||||
algorithm. Compatibility does not imply endorsement by or affiliation with the
|
||||
|
||||
@@ -41,16 +41,17 @@ nav_draw :: (x: int, y: int, width: int, height: int, view: int*) {
|
||||
}
|
||||
|
||||
result := BottomNav((BottomNavProps){
|
||||
.view_width = GetScreenWidth(),
|
||||
.view_height = GetScreenHeight(),
|
||||
.view_width = GetFrameWidth(),
|
||||
.view_height = GetFrameHeight(),
|
||||
.count = 3,
|
||||
.items = items,
|
||||
.height = height,
|
||||
.icon_size = ScaleUIPx(22),
|
||||
.icon_padding = ScaleUIPx(8),
|
||||
.side_margin = x,
|
||||
.bottom_margin = GetScreenHeight() - y - height,
|
||||
.max_button_width = width / 3
|
||||
.bottom_margin = GetFrameHeight() - y - height,
|
||||
.max_button_width = width / 3,
|
||||
.icon_color = GetThemeText()
|
||||
})
|
||||
|
||||
if result.clicked_route >= 0 {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#import "kryon.h"
|
||||
#import "android_host.h"
|
||||
#import "app/nav"
|
||||
#import "app/profiles"
|
||||
#import "app/settings"
|
||||
@@ -9,14 +10,16 @@ pass_status :: () -> char* #extern "pass_status"
|
||||
pass_copy :: () -> int #extern "pass_copy"
|
||||
pass_master_emoji :: (master: const char*) -> char* #extern "pass_master_emoji"
|
||||
pass_save_profile :: (name: const char*, site: const char*, login: const char*, length: int, counter: int, lower: int, upper: int, digits: int, symbols: int, exclude: const char*) -> int #extern "pass_save_profile"
|
||||
pass_safe_left :: () -> int #extern "pass_safe_left"
|
||||
pass_safe_top :: () -> int #extern "pass_safe_top"
|
||||
pass_safe_right :: () -> int #extern "pass_safe_right"
|
||||
pass_safe_bottom :: () -> int #extern "pass_safe_bottom"
|
||||
pass_can_unlock_master :: () -> int #extern "pass_can_unlock_master"
|
||||
pass_take_unlocked_master :: (out: char*) -> int #extern "pass_take_unlocked_master"
|
||||
pass_unlock_master :: () -> int #extern "pass_unlock_master"
|
||||
pass_load_settings :: (auto_copy: int*, clear_seconds: int*, show_fingerprint: int*, length: int*, counter: int*, lower: int*, upper: int*, digits: int*, symbols: int*, exclude: char*, exclude_size: int, theme_source: int*, theme_mode: int*, theme_id: int*, theme_style: int*) -> int #extern "pass_load_settings"
|
||||
AndroidHostLeftReserved :: () -> int #extern "AndroidHostLeftReserved"
|
||||
AndroidHostTopReserved :: () -> int #extern "AndroidHostTopReserved"
|
||||
AndroidHostRightReserved :: () -> int #extern "AndroidHostRightReserved"
|
||||
AndroidHostBottomReserved :: () -> int #extern "AndroidHostBottomReserved"
|
||||
AndroidSecureStoreBiometricAvailable :: () -> int #extern "AndroidSecureStoreBiometricAvailable"
|
||||
AndroidSecureStoreHasSecret :: (key: const char*) -> int #extern "AndroidSecureStoreHasSecret"
|
||||
AndroidSecureStoreSecretUsesBiometric :: (key: const char*) -> int #extern "AndroidSecureStoreSecretUsesBiometric"
|
||||
|
||||
ViewMode :: enum {
|
||||
VIEW_GENERATE = 0,
|
||||
@@ -115,6 +118,12 @@ pass_apply_theme :: () #private {
|
||||
SetCurrentTheme(theme_id, dark)
|
||||
}
|
||||
|
||||
pass_can_unlock_master :: () -> int #private {
|
||||
return AndroidSecureStoreHasSecret("default") &&
|
||||
AndroidSecureStoreSecretUsesBiometric("default") &&
|
||||
AndroidSecureStoreBiometricAvailable()
|
||||
}
|
||||
|
||||
pass_load_icons :: () #private {
|
||||
if pass_icons_loaded == 1 {
|
||||
return
|
||||
@@ -232,7 +241,7 @@ pass_draw_generate :: (pad: int, y: int, content_w: int) -> int #private {
|
||||
}
|
||||
pass_request_focused_input_visible(103, (Rectangle){pad, y, content_w, ScaleUIPx(62)})
|
||||
if show_unlock == 1 {
|
||||
if IconButton((IconButtonProps){.bounds = {unlock_x, y + ScaleUIPx(22), action_size, ScaleUIPx(38)}, .icon = pass_fingerprint_icon, .icon_size = ScaleUIPx(22), .icon_padding = ScaleUIPx(8), .focus_id = 14, .background = GetThemeButton(), .hover_background = GetThemeButtonHover(), .icon_color = WHITE, .border = Fade(GetThemeIcon(), 0.35f), .radius = 0.10f}) {
|
||||
if IconButton((IconButtonProps){.bounds = {unlock_x, y + ScaleUIPx(22), action_size, ScaleUIPx(38)}, .icon = pass_fingerprint_icon, .icon_size = ScaleUIPx(22), .icon_padding = ScaleUIPx(8), .focus_id = 14, .background = GetThemeButton(), .hover_background = GetThemeButtonHover(), .icon_color = GetThemeText(), .border = Fade(GetThemeIcon(), 0.35f), .radius = 0.10f}) {
|
||||
ClearUIFocus()
|
||||
SetUIFocusTextInputActive(0)
|
||||
pass_unlock_master()
|
||||
@@ -242,7 +251,7 @@ pass_draw_generate :: (pad: int, y: int, content_w: int) -> int #private {
|
||||
if reveal_master == 1 {
|
||||
reveal_icon = pass_eye_off_icon
|
||||
}
|
||||
if IconButton((IconButtonProps){.bounds = {reveal_x, y + ScaleUIPx(22), action_size, ScaleUIPx(38)}, .icon = reveal_icon, .icon_size = ScaleUIPx(22), .icon_padding = ScaleUIPx(8), .focus_id = 13, .background = GetThemeButton(), .hover_background = GetThemeButtonHover(), .icon_color = WHITE, .border = Fade(GetThemeIcon(), 0.35f), .radius = 0.10f}) {
|
||||
if IconButton((IconButtonProps){.bounds = {reveal_x, y + ScaleUIPx(22), action_size, ScaleUIPx(38)}, .icon = reveal_icon, .icon_size = ScaleUIPx(22), .icon_padding = ScaleUIPx(8), .focus_id = 13, .background = GetThemeButton(), .hover_background = GetThemeButtonHover(), .icon_color = GetThemeText(), .border = Fade(GetThemeIcon(), 0.35f), .radius = 0.10f}) {
|
||||
reveal_master = 1 - reveal_master
|
||||
}
|
||||
y += ScaleUIPx(64)
|
||||
@@ -315,21 +324,31 @@ pass_frame :: () #ui {
|
||||
pass_load_icons()
|
||||
Background(GetThemeBackground())
|
||||
|
||||
screen_w: int = GetScreenWidth()
|
||||
screen_h: int = GetScreenHeight()
|
||||
screen_w: int = GetFrameWidth()
|
||||
screen_h: int = GetFrameHeight()
|
||||
pad: int = ScaleUIPx(18)
|
||||
top: int = ScaleUIPx(16) + ScaleUIPx(pass_safe_top())
|
||||
left: int = pad + ScaleUIPx(pass_safe_left())
|
||||
right: int = pad + ScaleUIPx(pass_safe_right())
|
||||
bottom: int = ScaleUIPx(pass_safe_bottom())
|
||||
top: int = ScaleUIPx(16) + ScaleUIPx(AndroidHostTopReserved())
|
||||
left: int = pad + ScaleUIPx(AndroidHostLeftReserved())
|
||||
right: int = pad + ScaleUIPx(AndroidHostRightReserved())
|
||||
bottom: int = ScaleUIPx(AndroidHostBottomReserved())
|
||||
content_w: int = screen_w - left - right
|
||||
if content_w < ScaleUIPx(280) {
|
||||
content_w = ScaleUIPx(280)
|
||||
if content_w < ScaleUIPx(160) {
|
||||
content_w = screen_w - left - right
|
||||
}
|
||||
if content_w < ScaleUIPx(96) {
|
||||
left = ScaleUIPx(8) + ScaleUIPx(AndroidHostLeftReserved())
|
||||
right = ScaleUIPx(8) + ScaleUIPx(AndroidHostRightReserved())
|
||||
content_w = screen_w - left - right
|
||||
}
|
||||
if content_w < 1 {
|
||||
content_w = 1
|
||||
}
|
||||
|
||||
settings_capture_theme_input()
|
||||
|
||||
nav_h: int = ScaleUIPx(66)
|
||||
nav_y: int = screen_h - bottom - nav_h
|
||||
scrollbar_x: int = screen_w - ScaleUIPx(pass_safe_right()) - ScaleUIPx(8)
|
||||
scrollbar_x: int = screen_w - ScaleUIPx(AndroidHostRightReserved()) - ScaleUIPx(8)
|
||||
y: int = top
|
||||
view_h: int = nav_y - y
|
||||
if view_h < ScaleUIPx(180) {
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
#import "kryon.h"
|
||||
#import "android_host.h"
|
||||
|
||||
pass_save_settings :: (auto_copy: int, clear_seconds: int, show_fingerprint: int, length: int, counter: int, lower: int, upper: int, digits: int, symbols: int, exclude: const char*, theme_source: int, theme_mode: int, theme_id: int, theme_style: int) -> int #extern "pass_save_settings"
|
||||
pass_save_master :: (master: const char*, require_biometric: int) -> int #extern "pass_save_master"
|
||||
pass_clear_master :: () -> int #extern "pass_clear_master"
|
||||
pass_biometric_available :: () -> int #extern "pass_biometric_available"
|
||||
pass_master_saved :: () -> int #extern "pass_master_saved"
|
||||
pass_fingerprint_status :: () -> char* #extern "pass_fingerprint_status"
|
||||
pass_master_emoji :: (master: const char*) -> char* #extern "pass_master_emoji"
|
||||
AndroidSecureStoreBiometricAvailable :: () -> int #extern "AndroidSecureStoreBiometricAvailable"
|
||||
AndroidSecureStoreHasSecret :: (key: const char*) -> int #extern "AndroidSecureStoreHasSecret"
|
||||
|
||||
state {
|
||||
settings_theme_modal_open: int = 0
|
||||
@@ -114,7 +115,7 @@ settings_draw :: (
|
||||
if *reveal_master == 1 {
|
||||
reveal_icon = settings_eye_off_icon
|
||||
}
|
||||
if IconButton((IconButtonProps){.bounds = {x + width - action_size, y + ScaleUIPx(22), action_size, ScaleUIPx(38)}, .icon = reveal_icon, .icon_size = ScaleUIPx(22), .icon_padding = ScaleUIPx(8), .focus_id = 531, .background = GetThemeButton(), .hover_background = GetThemeButtonHover(), .icon_color = WHITE, .border = Fade(GetThemeIcon(), 0.35f), .radius = 0.10f}) {
|
||||
if IconButton((IconButtonProps){.bounds = {x + width - action_size, y + ScaleUIPx(22), action_size, ScaleUIPx(38)}, .icon = reveal_icon, .icon_size = ScaleUIPx(22), .icon_padding = ScaleUIPx(8), .focus_id = 531, .background = GetThemeButton(), .hover_background = GetThemeButtonHover(), .icon_color = GetThemeText(), .border = Fade(GetThemeIcon(), 0.35f), .radius = 0.10f}) {
|
||||
*reveal_master = 1 - *reveal_master
|
||||
}
|
||||
y += ScaleUIPx(64)
|
||||
@@ -124,15 +125,18 @@ settings_draw :: (
|
||||
Text(pass_fingerprint_status(), x, y, Text12, GetThemeIcon())
|
||||
y += ScaleUIPx(30)
|
||||
|
||||
if Button((ButtonProps){.bounds = {x, y, width / 2 - ScaleUIPx(6), ScaleUIPx(42)}, .label = "Save", .style = ButtonStylePrimary, .font = Text16, .id = 520, .disabled = pass_biometric_available() == 0}) {
|
||||
if Button((ButtonProps){.bounds = {x, y, width / 2 - ScaleUIPx(6), ScaleUIPx(42)}, .label = "Save", .style = ButtonStylePrimary, .font = Text16, .id = 520, .disabled = AndroidSecureStoreBiometricAvailable() == 0}) {
|
||||
pass_save_master(master, 1)
|
||||
}
|
||||
if Button((ButtonProps){.bounds = {x + width / 2 + ScaleUIPx(6), y, width / 2 - ScaleUIPx(6), ScaleUIPx(42)}, .label = "Forget", .style = ButtonStyleSecondary, .font = Text16, .id = 522, .disabled = pass_master_saved() == 0}) {
|
||||
if Button((ButtonProps){.bounds = {x + width / 2 + ScaleUIPx(6), y, width / 2 - ScaleUIPx(6), ScaleUIPx(42)}, .label = "Forget", .style = ButtonStyleSecondary, .font = Text16, .id = 522, .disabled = AndroidSecureStoreHasSecret("default") == 0}) {
|
||||
pass_clear_master()
|
||||
}
|
||||
y += ScaleUIPx(60)
|
||||
|
||||
if Button((ButtonProps){.bounds = {x, y, width, ScaleUIPx(42)}, .label = "Theme Settings", .style = ButtonStyleSecondary, .font = Text16, .id = 500}) {
|
||||
ClearUIFocus()
|
||||
SetUIFocusTextInputActive(0)
|
||||
UIConsumeRelease()
|
||||
settings_theme_modal_open = 1
|
||||
}
|
||||
|
||||
@@ -196,6 +200,9 @@ settings_draw_theme_modal :: (
|
||||
modal_h: int = ScaleUIPx(380)
|
||||
frame := ModalFrame(modal_w, modal_h, "Theme Settings", empty_icon, settings_close_icon)
|
||||
if frame.right_clicked == 1 {
|
||||
ClearUIFocus()
|
||||
SetUIFocusTextInputActive(0)
|
||||
UIConsumeRelease()
|
||||
settings_theme_modal_open = 0
|
||||
}
|
||||
|
||||
@@ -220,6 +227,16 @@ settings_draw_theme_modal :: (
|
||||
save_y: int = frame.content_y + frame.content_h - ScaleUIPx(44)
|
||||
if Button((ButtonProps){.bounds = {frame.content_x, save_y, frame.content_w, ScaleUIPx(40)}, .label = "Save Theme", .style = ButtonStylePrimary, .font = Text16, .id = 511}) {
|
||||
pass_save_settings(*auto_copy, *clear_seconds, *show_fingerprint, *length, *counter, *lower, *upper, *digits, *symbols, exclude, *theme_source, *theme_mode, *theme_id, *theme_style)
|
||||
ClearUIFocus()
|
||||
SetUIFocusTextInputActive(0)
|
||||
UIConsumeRelease()
|
||||
settings_theme_modal_open = 0
|
||||
}
|
||||
}
|
||||
|
||||
// Block the underlying form before drawing the modal's interactive controls.
|
||||
settings_capture_theme_input :: () {
|
||||
if settings_theme_modal_open == 1 {
|
||||
PushUIInputCapture((Rectangle){0, 0, GetFrameWidth(), GetFrameHeight()}, 0)
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 485 KiB |
|
After Width: | Height: | Size: 283 KiB |
@@ -51,8 +51,8 @@ android {
|
||||
applicationId 'xyz.waozi.pass'
|
||||
minSdk 21
|
||||
targetSdk 36
|
||||
versionCode 9
|
||||
versionName "0.2.8"
|
||||
versionCode 10
|
||||
versionName "0.2.9"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
// Default to the two realistic phone targets; override with
|
||||
// -Pabi=x86_64 etc. for emulator builds.
|
||||
|
||||
@@ -6,6 +6,8 @@ import android.view.ViewGroup;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputConnection;
|
||||
|
||||
import com.kryonlabs.kryon.TextInputBridge;
|
||||
|
||||
public final class TextInputBridgeHarnessActivity extends Activity {
|
||||
private TextInputBridge bridge;
|
||||
private StringBuilder committedText = new StringBuilder();
|
||||
@@ -21,6 +23,11 @@ public final class TextInputBridgeHarnessActivity extends Activity {
|
||||
committedText.appendCodePoint(codepoint);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void composition(int phase, String text, int cursor,
|
||||
int selectionLength) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void backspace() {
|
||||
backspaceCount++;
|
||||
|
||||
@@ -9,15 +9,25 @@
|
||||
android:label="@string/app_name"
|
||||
android:allowBackup="false">
|
||||
<activity
|
||||
android:name="xyz.waozi.pass.MainActivity"
|
||||
android:name="xyz.waozi.pass.PassActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize|smallestScreenSize|uiMode"
|
||||
android:exported="true"
|
||||
android:launchMode="singleTask"
|
||||
android:theme="@android:style/Theme.DeviceDefault.NoActionBar"
|
||||
android:windowSoftInputMode="adjustNothing"
|
||||
android:windowLayoutInDisplayCutoutMode="never">
|
||||
<meta-data
|
||||
android:name="android.app.lib_name"
|
||||
android:value="main" />
|
||||
<meta-data
|
||||
android:name="com.kryonlabs.kryon.SECURE_PREFERENCES"
|
||||
android:value="pass_secure" />
|
||||
<meta-data
|
||||
android:name="com.kryonlabs.kryon.SECURE_DEFAULT_KEY_PREFIX"
|
||||
android:value="pass_master_key" />
|
||||
<meta-data
|
||||
android:name="com.kryonlabs.kryon.APP_PREFERENCES"
|
||||
android:value="pass_preferences" />
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
|
||||
@@ -5,6 +5,11 @@ set(REPO_ROOT "${CMAKE_CURRENT_LIST_DIR}/../../../../..")
|
||||
set(KRYON_DIR "${REPO_ROOT}/vendor/kryon")
|
||||
set(KRY_GENERATED_DIR "${CMAKE_BINARY_DIR}/krygen/c")
|
||||
set(RAYLIB_DIR "${KRYON_DIR}/vendor/raylib/src")
|
||||
set(KRYON_RAYLIB_GENERATED_DIR "${CMAKE_BINARY_DIR}/kryon/raylib_generated")
|
||||
set(KRYON_COMPAT_GENERATED_HEADER "${KRYON_RAYLIB_GENERATED_DIR}/kryon_compat.generated.h")
|
||||
set(KRYON_RAYLIB_BACKEND_RENAME_HEADER "${KRYON_RAYLIB_GENERATED_DIR}/raylib_backend_rename.h")
|
||||
set(KRYON_RAYLIB_WRAPPERS_C "${KRYON_RAYLIB_GENERATED_DIR}/kryon_raylib_wrappers.c")
|
||||
set(KRYON_NULL_BACKEND_C "${KRYON_RAYLIB_GENERATED_DIR}/kryon_null_backend.c")
|
||||
set(PASS_NATIVE_DIR "${REPO_ROOT}/native")
|
||||
set(NATIVE_APP_GLUE_DIR "${ANDROID_NDK}/sources/android/native_app_glue")
|
||||
include("${KRYON_DIR}/cmake/KryonKrySources.cmake")
|
||||
@@ -14,6 +19,15 @@ file(GLOB_RECURSE KRYON_SOURCES CONFIGURE_DEPENDS "${KRYON_DIR}/src/*.c")
|
||||
# no-raylib hosts; Android links real raylib, so compiling both is a
|
||||
# duplicate-symbol link error.
|
||||
list(FILTER KRYON_SOURCES EXCLUDE REGEX "${KRYON_DIR}/src/backend/.*")
|
||||
list(APPEND KRYON_SOURCES
|
||||
"${KRYON_DIR}/src/backend/kry_event_wait.c"
|
||||
"${KRYON_DIR}/src/backend/kry_image.c"
|
||||
"${KRYON_DIR}/src/backend/kry_image_decode.c"
|
||||
"${KRYON_DIR}/src/backend/kry_input.c"
|
||||
"${KRYON_DIR}/src/backend/kry_instance.c"
|
||||
"${KRYON_DIR}/src/backend/kry_screenshot.c"
|
||||
"${KRYON_DIR}/src/backend/kry_sw_png.c"
|
||||
"${KRYON_DIR}/src/backend/kry_surface_math.c")
|
||||
# pass uses no 2D physics; mirror the desktop Makefile's physics filter.
|
||||
list(REMOVE_ITEM KRYON_SOURCES
|
||||
"${KRYON_DIR}/src/scene/physics_world.c"
|
||||
@@ -44,6 +58,30 @@ kryon_generate_kry_sources(PASS_KRY_GENERATED_SOURCES PASS_KRY_INCLUDE_DIR
|
||||
SOURCES ${PASS_KRY_SOURCES}
|
||||
)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT
|
||||
"${KRYON_COMPAT_GENERATED_HEADER}"
|
||||
"${KRYON_RAYLIB_BACKEND_RENAME_HEADER}"
|
||||
"${KRYON_RAYLIB_WRAPPERS_C}"
|
||||
"${KRYON_NULL_BACKEND_C}"
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${KRYON_RAYLIB_GENERATED_DIR}"
|
||||
COMMAND ${CMAKE_COMMAND} -E env KRYON_COMPAT_AUDIO=0
|
||||
sh "${KRYON_DIR}/tools/generate-kryon-compat.sh"
|
||||
"${RAYLIB_DIR}/raylib.h"
|
||||
"${KRYON_COMPAT_GENERATED_HEADER}"
|
||||
"${KRYON_RAYLIB_BACKEND_RENAME_HEADER}"
|
||||
"${KRYON_RAYLIB_WRAPPERS_C}"
|
||||
"${KRYON_NULL_BACKEND_C}"
|
||||
DEPENDS "${KRYON_DIR}/tools/generate-kryon-compat.sh" "${RAYLIB_DIR}/raylib.h"
|
||||
VERBATIM
|
||||
)
|
||||
add_custom_target(kryon_raylib_generated DEPENDS
|
||||
"${KRYON_COMPAT_GENERATED_HEADER}"
|
||||
"${KRYON_RAYLIB_BACKEND_RENAME_HEADER}"
|
||||
"${KRYON_RAYLIB_WRAPPERS_C}"
|
||||
"${KRYON_NULL_BACKEND_C}"
|
||||
)
|
||||
|
||||
set(PASS_FONT_ASSET "vendor/kryon/fonts/noto/NotoSans-Regular.ttf")
|
||||
set(PASS_EMOJI_FONT_ASSET "assets/fonts/emoji.ttf")
|
||||
set(PASS_EMBEDDED_ASSETS_C "${CMAKE_BINARY_DIR}/pass_embedded_assets.c")
|
||||
@@ -62,6 +100,7 @@ add_library(raylib STATIC
|
||||
"${RAYLIB_DIR}/rtext.c"
|
||||
"${RAYLIB_DIR}/raudio.c"
|
||||
)
|
||||
add_dependencies(raylib kryon_raylib_generated)
|
||||
|
||||
target_compile_definitions(raylib PRIVATE
|
||||
PLATFORM_ANDROID
|
||||
@@ -82,6 +121,7 @@ target_compile_definitions(raylib PRIVATE
|
||||
)
|
||||
|
||||
target_compile_options(raylib PRIVATE
|
||||
-include "${KRYON_RAYLIB_BACKEND_RENAME_HEADER}"
|
||||
-Os
|
||||
-ffunction-sections
|
||||
-fdata-sections
|
||||
@@ -94,16 +134,15 @@ target_include_directories(raylib PUBLIC
|
||||
|
||||
add_library(main SHARED
|
||||
main.c
|
||||
android_bridge.c
|
||||
"${PASS_NATIVE_DIR}/pass_core.c"
|
||||
"${PASS_NATIVE_DIR}/pass_runtime.c"
|
||||
${PASS_KRY_GENERATED_SOURCES}
|
||||
"${PASS_EMBEDDED_ASSETS_C}"
|
||||
"${KRYON_DIR}/src/backend/kry_sw_png.c"
|
||||
${KRYON_SOURCES}
|
||||
"${KRYON_RAYLIB_WRAPPERS_C}"
|
||||
"${NATIVE_APP_GLUE_DIR}/android_native_app_glue.c"
|
||||
)
|
||||
add_dependencies(main pass_kry_generated)
|
||||
add_dependencies(main pass_kry_generated kryon_raylib_generated)
|
||||
|
||||
target_include_directories(main PRIVATE
|
||||
"${KRYON_DIR}/include"
|
||||
|
||||
@@ -1,558 +0,0 @@
|
||||
/* Minimal JNI bridge for the pass Android app: safe-area insets, display
|
||||
* density, soft-keyboard visibility, and soft-keyboard text input. Modeled
|
||||
* on inbe's android_device.c / android_insets.c. */
|
||||
|
||||
#include "android_bridge.h"
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#if ANDROID_BUILD
|
||||
|
||||
#include "kryon.h"
|
||||
#include "theme.h"
|
||||
#include "ui_dpi.h"
|
||||
|
||||
#include <android/log.h>
|
||||
#include <android_native_app_glue.h>
|
||||
#include <jni.h>
|
||||
#include <pthread.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
extern struct android_app *GetAndroidApp(void);
|
||||
|
||||
#ifndef JNI_VERSION_1_6
|
||||
#define JNI_VERSION_1_6 0x10060000
|
||||
#endif
|
||||
|
||||
#define LOG_TAG "PASS_JNI"
|
||||
|
||||
static pthread_mutex_t bridge_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
static int insets_system_left = 0;
|
||||
static int insets_system_top = 0;
|
||||
static int insets_system_right = 0;
|
||||
static int insets_system_bottom = 0;
|
||||
static int insets_ime_bottom = 0;
|
||||
static int insets_cutout_left = 0;
|
||||
static int insets_cutout_top = 0;
|
||||
static int insets_cutout_right = 0;
|
||||
static int insets_cutout_bottom = 0;
|
||||
static int insets_ready = 0;
|
||||
static float device_density = 0.0f;
|
||||
|
||||
static int
|
||||
scaled_inset(int java_px, float density)
|
||||
{
|
||||
if(density <= 0.0f)
|
||||
density = 1.0f;
|
||||
return (int)(java_px / density + 0.5f);
|
||||
}
|
||||
|
||||
static int
|
||||
activity_env(JNIEnv **env_out, JavaVM **jvm_out, jobject *activity_out)
|
||||
{
|
||||
struct android_app *app = GetAndroidApp();
|
||||
JavaVM *jvm;
|
||||
JNIEnv *env = NULL;
|
||||
int attached = 0;
|
||||
|
||||
if(env_out == NULL || jvm_out == NULL || activity_out == NULL ||
|
||||
app == NULL || app->activity == NULL || app->activity->vm == NULL ||
|
||||
app->activity->clazz == NULL)
|
||||
return -1;
|
||||
|
||||
jvm = app->activity->vm;
|
||||
if((*jvm)->GetEnv(jvm, (void **)&env, JNI_VERSION_1_6) != JNI_OK) {
|
||||
if((*jvm)->AttachCurrentThread(jvm, &env, NULL) != JNI_OK || env == NULL)
|
||||
return -1;
|
||||
attached = 1;
|
||||
}
|
||||
*env_out = env;
|
||||
*jvm_out = jvm;
|
||||
*activity_out = app->activity->clazz;
|
||||
return attached;
|
||||
}
|
||||
|
||||
static void
|
||||
activity_env_done(JNIEnv *env, JavaVM *jvm, int attached)
|
||||
{
|
||||
if(env != NULL && (*env)->ExceptionCheck(env)) {
|
||||
(*env)->ExceptionDescribe(env);
|
||||
(*env)->ExceptionClear(env);
|
||||
}
|
||||
if(attached && jvm != NULL)
|
||||
(*jvm)->DetachCurrentThread(jvm);
|
||||
}
|
||||
|
||||
void
|
||||
android_bridge_init(void)
|
||||
{
|
||||
pthread_mutex_lock(&bridge_mutex);
|
||||
insets_system_left = 0;
|
||||
insets_system_top = 0;
|
||||
insets_system_right = 0;
|
||||
insets_system_bottom = 0;
|
||||
insets_ime_bottom = 0;
|
||||
insets_cutout_left = 0;
|
||||
insets_cutout_top = 0;
|
||||
insets_cutout_right = 0;
|
||||
insets_cutout_bottom = 0;
|
||||
insets_ready = 0;
|
||||
device_density = 0.0f;
|
||||
pthread_mutex_unlock(&bridge_mutex);
|
||||
}
|
||||
|
||||
static Color
|
||||
color_from_argb(jint argb)
|
||||
{
|
||||
Color color;
|
||||
|
||||
color.a = (unsigned char)((argb >> 24) & 0xff);
|
||||
color.r = (unsigned char)((argb >> 16) & 0xff);
|
||||
color.g = (unsigned char)((argb >> 8) & 0xff);
|
||||
color.b = (unsigned char)(argb & 0xff);
|
||||
if(color.a == 0)
|
||||
color.a = 0xff;
|
||||
return color;
|
||||
}
|
||||
|
||||
void
|
||||
android_bridge_apply_system_theme(void)
|
||||
{
|
||||
JavaVM *jvm;
|
||||
JNIEnv *env = NULL;
|
||||
jobject activity;
|
||||
jclass activity_class;
|
||||
jmethodID method;
|
||||
jintArray array;
|
||||
jint values[9];
|
||||
jsize len;
|
||||
int attached;
|
||||
|
||||
attached = activity_env(&env, &jvm, &activity);
|
||||
if(attached < 0)
|
||||
return;
|
||||
|
||||
memset(values, 0, sizeof(values));
|
||||
activity_class = (*env)->GetObjectClass(env, activity);
|
||||
if(activity_class == NULL)
|
||||
goto done;
|
||||
method = (*env)->GetMethodID(env, activity_class, "systemThemeColors", "()[I");
|
||||
if(method == NULL) {
|
||||
__android_log_write(ANDROID_LOG_ERROR, LOG_TAG, "systemThemeColors not found");
|
||||
goto done;
|
||||
}
|
||||
array = (jintArray)(*env)->CallObjectMethod(env, activity, method);
|
||||
if(array == NULL)
|
||||
goto done;
|
||||
len = (*env)->GetArrayLength(env, array);
|
||||
if(len < 9)
|
||||
goto done;
|
||||
(*env)->GetIntArrayRegion(env, array, 0, 9, values);
|
||||
SetSystemThemePalette("Android",
|
||||
color_from_argb(values[1]),
|
||||
color_from_argb(values[2]),
|
||||
color_from_argb(values[3]),
|
||||
color_from_argb(values[4]),
|
||||
color_from_argb(values[5]),
|
||||
color_from_argb(values[6]),
|
||||
color_from_argb(values[7]),
|
||||
color_from_argb(values[8]),
|
||||
values[0] != 0,
|
||||
1);
|
||||
|
||||
done:
|
||||
activity_env_done(env, jvm, attached);
|
||||
}
|
||||
|
||||
int
|
||||
android_bridge_left_reserved(void)
|
||||
{
|
||||
int system, cutout, ready;
|
||||
float density;
|
||||
|
||||
pthread_mutex_lock(&bridge_mutex);
|
||||
system = insets_system_left;
|
||||
cutout = insets_cutout_left;
|
||||
density = device_density;
|
||||
ready = insets_ready;
|
||||
pthread_mutex_unlock(&bridge_mutex);
|
||||
|
||||
if(!ready)
|
||||
return 0;
|
||||
return scaled_inset(system > cutout ? system : cutout, density);
|
||||
}
|
||||
|
||||
int
|
||||
android_bridge_top_reserved(void)
|
||||
{
|
||||
int system, cutout, top, ready;
|
||||
float density;
|
||||
|
||||
pthread_mutex_lock(&bridge_mutex);
|
||||
system = insets_system_top;
|
||||
cutout = insets_cutout_top;
|
||||
density = device_density;
|
||||
ready = insets_ready;
|
||||
pthread_mutex_unlock(&bridge_mutex);
|
||||
|
||||
if(!ready)
|
||||
return 28; /* conservative status-bar guess until Java reports */
|
||||
top = system > cutout ? system : cutout;
|
||||
return scaled_inset(top, density);
|
||||
}
|
||||
|
||||
int
|
||||
android_bridge_right_reserved(void)
|
||||
{
|
||||
int system, cutout, ready;
|
||||
float density;
|
||||
|
||||
pthread_mutex_lock(&bridge_mutex);
|
||||
system = insets_system_right;
|
||||
cutout = insets_cutout_right;
|
||||
density = device_density;
|
||||
ready = insets_ready;
|
||||
pthread_mutex_unlock(&bridge_mutex);
|
||||
|
||||
if(!ready)
|
||||
return 0;
|
||||
return scaled_inset(system > cutout ? system : cutout, density);
|
||||
}
|
||||
|
||||
int
|
||||
android_bridge_bottom_reserved(void)
|
||||
{
|
||||
int system, ime, cutout, bottom, ready;
|
||||
float density;
|
||||
|
||||
pthread_mutex_lock(&bridge_mutex);
|
||||
system = insets_system_bottom;
|
||||
ime = insets_ime_bottom;
|
||||
cutout = insets_cutout_bottom;
|
||||
density = device_density;
|
||||
ready = insets_ready;
|
||||
pthread_mutex_unlock(&bridge_mutex);
|
||||
|
||||
if(!ready)
|
||||
return 48; /* conservative nav-bar guess until Java reports */
|
||||
bottom = system > cutout ? system : cutout;
|
||||
if(ime > bottom)
|
||||
bottom = ime;
|
||||
return scaled_inset(bottom, density);
|
||||
}
|
||||
|
||||
void
|
||||
android_bridge_set_soft_keyboard(int visible)
|
||||
{
|
||||
JavaVM *jvm;
|
||||
JNIEnv *env = NULL;
|
||||
jobject activity;
|
||||
jclass activity_class;
|
||||
jmethodID method;
|
||||
int attached;
|
||||
|
||||
attached = activity_env(&env, &jvm, &activity);
|
||||
if(attached < 0) {
|
||||
__android_log_print(ANDROID_LOG_ERROR, LOG_TAG,
|
||||
"soft keyboard %d: no activity env", visible);
|
||||
return;
|
||||
}
|
||||
|
||||
activity_class = (*env)->GetObjectClass(env, activity);
|
||||
if(activity_class == NULL) {
|
||||
__android_log_print(ANDROID_LOG_ERROR, LOG_TAG,
|
||||
"soft keyboard %d: no activity class", visible);
|
||||
goto done;
|
||||
}
|
||||
|
||||
method = (*env)->GetMethodID(env, activity_class, "setSoftKeyboardVisible", "(Z)V");
|
||||
if(method == NULL) {
|
||||
__android_log_write(ANDROID_LOG_ERROR, LOG_TAG, "setSoftKeyboardVisible not found");
|
||||
goto done;
|
||||
}
|
||||
|
||||
(*env)->CallVoidMethod(env, activity, method, visible ? JNI_TRUE : JNI_FALSE);
|
||||
|
||||
done:
|
||||
activity_env_done(env, jvm, attached);
|
||||
}
|
||||
|
||||
static int
|
||||
call_boolean_method(const char *name)
|
||||
{
|
||||
JavaVM *jvm;
|
||||
JNIEnv *env = NULL;
|
||||
jobject activity;
|
||||
jclass activity_class;
|
||||
jmethodID method;
|
||||
int attached;
|
||||
int result = 0;
|
||||
|
||||
attached = activity_env(&env, &jvm, &activity);
|
||||
if(attached < 0)
|
||||
return 0;
|
||||
activity_class = (*env)->GetObjectClass(env, activity);
|
||||
if(activity_class == NULL)
|
||||
goto done;
|
||||
method = (*env)->GetMethodID(env, activity_class, name, "()Z");
|
||||
if(method == NULL)
|
||||
goto done;
|
||||
result = (*env)->CallBooleanMethod(env, activity, method) ? 1 : 0;
|
||||
|
||||
done:
|
||||
activity_env_done(env, jvm, attached);
|
||||
return result;
|
||||
}
|
||||
|
||||
int
|
||||
android_bridge_biometric_available(void)
|
||||
{
|
||||
return call_boolean_method("isBiometricAvailable");
|
||||
}
|
||||
|
||||
int
|
||||
android_bridge_biometric_setup_required(void)
|
||||
{
|
||||
return call_boolean_method("isBiometricSetupRequired");
|
||||
}
|
||||
|
||||
int
|
||||
android_bridge_master_saved(void)
|
||||
{
|
||||
return call_boolean_method("hasStoredMasterPassword");
|
||||
}
|
||||
|
||||
int
|
||||
android_bridge_master_biometric(void)
|
||||
{
|
||||
return call_boolean_method("isStoredMasterBiometric");
|
||||
}
|
||||
|
||||
void
|
||||
android_bridge_save_master(const char *master, int require_biometric)
|
||||
{
|
||||
JavaVM *jvm;
|
||||
JNIEnv *env = NULL;
|
||||
jobject activity;
|
||||
jclass activity_class;
|
||||
jmethodID method;
|
||||
jstring jmaster;
|
||||
int attached;
|
||||
|
||||
attached = activity_env(&env, &jvm, &activity);
|
||||
if(attached < 0)
|
||||
return;
|
||||
activity_class = (*env)->GetObjectClass(env, activity);
|
||||
if(activity_class == NULL)
|
||||
goto done;
|
||||
method = (*env)->GetMethodID(env, activity_class, "saveMasterPassword", "(Ljava/lang/String;Z)V");
|
||||
if(method == NULL)
|
||||
goto done;
|
||||
jmaster = (*env)->NewStringUTF(env, master != NULL ? master : "");
|
||||
if(jmaster == NULL)
|
||||
goto done;
|
||||
(*env)->CallVoidMethod(env, activity, method, jmaster, require_biometric ? JNI_TRUE : JNI_FALSE);
|
||||
(*env)->DeleteLocalRef(env, jmaster);
|
||||
|
||||
done:
|
||||
activity_env_done(env, jvm, attached);
|
||||
}
|
||||
|
||||
static void
|
||||
call_void_method(const char *name)
|
||||
{
|
||||
JavaVM *jvm;
|
||||
JNIEnv *env = NULL;
|
||||
jobject activity;
|
||||
jclass activity_class;
|
||||
jmethodID method;
|
||||
int attached;
|
||||
|
||||
attached = activity_env(&env, &jvm, &activity);
|
||||
if(attached < 0)
|
||||
return;
|
||||
activity_class = (*env)->GetObjectClass(env, activity);
|
||||
if(activity_class == NULL)
|
||||
goto done;
|
||||
method = (*env)->GetMethodID(env, activity_class, name, "()V");
|
||||
if(method == NULL)
|
||||
goto done;
|
||||
(*env)->CallVoidMethod(env, activity, method);
|
||||
|
||||
done:
|
||||
activity_env_done(env, jvm, attached);
|
||||
}
|
||||
|
||||
void
|
||||
android_bridge_unlock_master(void)
|
||||
{
|
||||
call_void_method("unlockMasterPassword");
|
||||
}
|
||||
|
||||
void
|
||||
android_bridge_clear_master(void)
|
||||
{
|
||||
call_void_method("clearMasterPassword");
|
||||
}
|
||||
|
||||
int
|
||||
android_bridge_secure_status(void)
|
||||
{
|
||||
JavaVM *jvm;
|
||||
JNIEnv *env = NULL;
|
||||
jobject activity;
|
||||
jclass activity_class;
|
||||
jmethodID method;
|
||||
int attached;
|
||||
int result = 0;
|
||||
|
||||
attached = activity_env(&env, &jvm, &activity);
|
||||
if(attached < 0)
|
||||
return 0;
|
||||
activity_class = (*env)->GetObjectClass(env, activity);
|
||||
if(activity_class == NULL)
|
||||
goto done;
|
||||
method = (*env)->GetMethodID(env, activity_class, "secureMasterStatus", "()I");
|
||||
if(method == NULL)
|
||||
goto done;
|
||||
result = (int)(*env)->CallIntMethod(env, activity, method);
|
||||
|
||||
done:
|
||||
activity_env_done(env, jvm, attached);
|
||||
return result;
|
||||
}
|
||||
|
||||
int
|
||||
android_bridge_take_secure_result(char *out, int out_size)
|
||||
{
|
||||
JavaVM *jvm;
|
||||
JNIEnv *env = NULL;
|
||||
jobject activity;
|
||||
jclass activity_class;
|
||||
jmethodID method;
|
||||
jstring result;
|
||||
const char *chars;
|
||||
int attached;
|
||||
int status = 0;
|
||||
|
||||
if(out != NULL && out_size > 0)
|
||||
out[0] = '\0';
|
||||
attached = activity_env(&env, &jvm, &activity);
|
||||
if(attached < 0)
|
||||
return 0;
|
||||
activity_class = (*env)->GetObjectClass(env, activity);
|
||||
if(activity_class == NULL)
|
||||
goto done;
|
||||
method = (*env)->GetMethodID(env, activity_class, "secureMasterStatus", "()I");
|
||||
if(method == NULL)
|
||||
goto done;
|
||||
status = (int)(*env)->CallIntMethod(env, activity, method);
|
||||
if(status != 2 && status != 3)
|
||||
goto done;
|
||||
method = (*env)->GetMethodID(env, activity_class, "takeSecureMasterResult", "()Ljava/lang/String;");
|
||||
if(method == NULL)
|
||||
goto done;
|
||||
result = (jstring)(*env)->CallObjectMethod(env, activity, method);
|
||||
if(result == NULL)
|
||||
goto done;
|
||||
chars = (*env)->GetStringUTFChars(env, result, NULL);
|
||||
if(chars != NULL) {
|
||||
if(out != NULL && out_size > 0)
|
||||
snprintf(out, (size_t)out_size, "%s", chars);
|
||||
(*env)->ReleaseStringUTFChars(env, result, chars);
|
||||
}
|
||||
(*env)->DeleteLocalRef(env, result);
|
||||
|
||||
done:
|
||||
activity_env_done(env, jvm, attached);
|
||||
return status;
|
||||
}
|
||||
|
||||
/* ---- Java -> C natives (exported JNI symbols; RegisterNatives from
|
||||
* JNI_OnLoad resolves through the boot loader here and does not bind to the
|
||||
* activity's class, so we rely on standard dlsym resolution instead) ---- */
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_xyz_waozi_pass_MainActivity_nativeSetInsets(JNIEnv *env, jobject thiz,
|
||||
jint system_left, jint system_top,
|
||||
jint system_right, jint system_bottom,
|
||||
jint ime_bottom,
|
||||
jint cutout_left, jint cutout_top,
|
||||
jint cutout_right, jint cutout_bottom)
|
||||
{
|
||||
(void)env;
|
||||
(void)thiz;
|
||||
|
||||
pthread_mutex_lock(&bridge_mutex);
|
||||
insets_system_left = system_left;
|
||||
insets_system_top = system_top;
|
||||
insets_system_right = system_right;
|
||||
insets_system_bottom = system_bottom;
|
||||
insets_ime_bottom = ime_bottom;
|
||||
insets_cutout_left = cutout_left;
|
||||
insets_cutout_top = cutout_top;
|
||||
insets_cutout_right = cutout_right;
|
||||
insets_cutout_bottom = cutout_bottom;
|
||||
insets_ready = 1;
|
||||
pthread_mutex_unlock(&bridge_mutex);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_xyz_waozi_pass_MainActivity_nativeSetDeviceDensity(JNIEnv *env, jobject thiz, jfloat density)
|
||||
{
|
||||
(void)env;
|
||||
(void)thiz;
|
||||
|
||||
if(density <= 0.0f)
|
||||
return;
|
||||
pthread_mutex_lock(&bridge_mutex);
|
||||
device_density = density;
|
||||
pthread_mutex_unlock(&bridge_mutex);
|
||||
SetUIDeviceDensity(density);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_xyz_waozi_pass_MainActivity_nativeTextInputCommit(JNIEnv *env, jobject thiz, jint codepoint)
|
||||
{
|
||||
(void)env;
|
||||
(void)thiz;
|
||||
QueueTextInputCodepoint((int)codepoint);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_xyz_waozi_pass_MainActivity_nativeTextInputBackspace(JNIEnv *env, jobject thiz)
|
||||
{
|
||||
(void)env;
|
||||
(void)thiz;
|
||||
QueueTextInputBackspace();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_xyz_waozi_pass_MainActivity_nativeTextInputEnter(JNIEnv *env, jobject thiz)
|
||||
{
|
||||
(void)env;
|
||||
(void)thiz;
|
||||
QueueTextInputEnter();
|
||||
}
|
||||
|
||||
#else /* !ANDROID_BUILD */
|
||||
|
||||
void android_bridge_init(void) {}
|
||||
void android_bridge_apply_system_theme(void) {}
|
||||
int android_bridge_left_reserved(void) { return 0; }
|
||||
int android_bridge_top_reserved(void) { return 0; }
|
||||
int android_bridge_right_reserved(void) { return 0; }
|
||||
int android_bridge_bottom_reserved(void) { return 0; }
|
||||
void android_bridge_set_soft_keyboard(int visible) { (void)visible; }
|
||||
int android_bridge_biometric_available(void) { return 0; }
|
||||
int android_bridge_biometric_setup_required(void) { return 0; }
|
||||
int android_bridge_master_saved(void) { return 0; }
|
||||
int android_bridge_master_biometric(void) { return 0; }
|
||||
void android_bridge_save_master(const char *master, int require_biometric) { (void)master; (void)require_biometric; }
|
||||
void android_bridge_unlock_master(void) {}
|
||||
void android_bridge_clear_master(void) {}
|
||||
int android_bridge_secure_status(void) { return 0; }
|
||||
int android_bridge_take_secure_result(char *out, int out_size) { if(out != NULL && out_size > 0) out[0] = '\0'; return 0; }
|
||||
|
||||
#endif
|
||||
@@ -1,35 +0,0 @@
|
||||
#ifndef PASS_ANDROID_BRIDGE_H
|
||||
#define PASS_ANDROID_BRIDGE_H
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Call once before InitWindow. */
|
||||
void android_bridge_init(void);
|
||||
void android_bridge_apply_system_theme(void);
|
||||
|
||||
/* Safe-area insets converted to UI units (java px / density). */
|
||||
int android_bridge_left_reserved(void);
|
||||
int android_bridge_top_reserved(void);
|
||||
int android_bridge_right_reserved(void);
|
||||
int android_bridge_bottom_reserved(void);
|
||||
|
||||
/* Shows or hides the soft keyboard through the activity. */
|
||||
void android_bridge_set_soft_keyboard(int visible);
|
||||
|
||||
int android_bridge_biometric_available(void);
|
||||
int android_bridge_biometric_setup_required(void);
|
||||
int android_bridge_master_saved(void);
|
||||
int android_bridge_master_biometric(void);
|
||||
void android_bridge_save_master(const char *master, int require_biometric);
|
||||
void android_bridge_unlock_master(void);
|
||||
void android_bridge_clear_master(void);
|
||||
int android_bridge_secure_status(void);
|
||||
int android_bridge_take_secure_result(char *out, int out_size);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "ui_scaling.h"
|
||||
#include "ui_text.h"
|
||||
|
||||
#include "android_bridge.h"
|
||||
#include "android_host.h"
|
||||
#include "app/pass.h"
|
||||
#include "pass_runtime.h"
|
||||
|
||||
@@ -90,7 +90,8 @@ main(int argc, char **argv)
|
||||
|
||||
#if ANDROID_BUILD
|
||||
__android_log_write(ANDROID_LOG_INFO, "PASS_MAIN", "main start");
|
||||
android_bridge_init();
|
||||
AndroidHostInit();
|
||||
SetAndroidViewportPolicy(AndroidViewportPolicyFull());
|
||||
if(chdir("/data/user/0/xyz.waozi.pass/files") != 0)
|
||||
TraceLog(LOG_WARNING, "PASS: failed to switch to files directory");
|
||||
window_width = 0;
|
||||
@@ -108,42 +109,25 @@ main(int argc, char **argv)
|
||||
InitUIDPI();
|
||||
SetThemeStyle(THEME_STYLE_MATERIAL);
|
||||
SetCurrentTheme(GetDefaultThemeForThemeStyle(THEME_STYLE_MATERIAL), 0);
|
||||
android_bridge_apply_system_theme();
|
||||
AndroidHostApplySystemTheme();
|
||||
SetThemeMode(THEME_MODE_SYSTEM);
|
||||
SetThemeSource(THEME_SOURCE_SYSTEM);
|
||||
ApplyCurrentUITheme();
|
||||
setup_ui_font();
|
||||
setup_emoji_font();
|
||||
setup_shapes_texture();
|
||||
SetTextInputPlatformCallback(android_bridge_set_soft_keyboard);
|
||||
SetTextInputPlatformCallback(AndroidHostSetSoftKeyboardVisible);
|
||||
SetTargetFPS(60);
|
||||
|
||||
pass_runtime_init();
|
||||
TraceLog(LOG_INFO, "PASS: app ready");
|
||||
while(!WindowShouldClose()) {
|
||||
int width = GetScreenWidth();
|
||||
int height = GetScreenHeight();
|
||||
Vector2 scale = GetWindowScaleDPI();
|
||||
float dpi = scale.x > 0.0f ? scale.x : 1.0f;
|
||||
|
||||
#if ANDROID_BUILD
|
||||
SyncAndroidSurfaceSize(&width, &height);
|
||||
#endif
|
||||
#if defined(PLATFORM_WEB)
|
||||
SyncWebWindowSize();
|
||||
width = GetScreenWidth();
|
||||
height = GetScreenHeight();
|
||||
#endif
|
||||
|
||||
BeginDrawing();
|
||||
#if ANDROID_BUILD
|
||||
SyncAndroidSurfaceSize(&width, &height);
|
||||
#endif
|
||||
BeginUIFrame(width, height, dpi);
|
||||
BeginFrame();
|
||||
BeginUIFrame(GetFrameWidth(), GetFrameHeight(), GetFrameScale());
|
||||
pass_runtime_tick();
|
||||
pass_frame();
|
||||
EndUIFrame();
|
||||
EndDrawing();
|
||||
EndFrame();
|
||||
}
|
||||
|
||||
pass_runtime_shutdown();
|
||||
|
||||
@@ -1,317 +0,0 @@
|
||||
package xyz.waozi.pass;
|
||||
|
||||
import android.app.NativeActivity;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Insets;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.DisplayCutout;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.view.WindowInsets;
|
||||
|
||||
import com.kryonlabs.kryon.SecureStore;
|
||||
|
||||
/**
|
||||
* NativeActivity glue for the kryon UI: routes soft-keyboard input and
|
||||
* window insets to the native side. Modeled on inbe's MainActivity.
|
||||
*/
|
||||
public class MainActivity extends NativeActivity {
|
||||
private static final String SECURE_PREFS = "pass_secure";
|
||||
|
||||
static {
|
||||
// Associate libmain with this class's loader so ART can resolve the
|
||||
// native methods below (NativeActivity loads it via the boot loader).
|
||||
System.loadLibrary("main");
|
||||
}
|
||||
|
||||
private final Object secureLock = new Object();
|
||||
private int secureStatus = SecureStore.STATUS_IDLE;
|
||||
private String secureResult = "";
|
||||
private SecureStore secureStore;
|
||||
private TextInputBridge textInputBridge;
|
||||
|
||||
private native void nativeSetInsets(int left, int top, int right, int bottom,
|
||||
int ime, int cutoutLeft, int cutoutTop, int cutoutRight, int cutoutBottom);
|
||||
private native void nativeSetDeviceDensity(float density);
|
||||
private native void nativeTextInputCommit(int codepoint);
|
||||
private native void nativeTextInputBackspace();
|
||||
private native void nativeTextInputEnter();
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
applySystemBars();
|
||||
setupInsetsListener();
|
||||
setupTextInputBridge();
|
||||
secureStore = new SecureStore(this, SECURE_PREFS, "pass_master_key");
|
||||
}
|
||||
|
||||
public int[] systemThemeColors() {
|
||||
boolean dark = (getResources().getConfiguration().uiMode
|
||||
& Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES;
|
||||
int background = dark ? 0xFF141218 : 0xFFFFFBFE;
|
||||
int surface = dark ? 0xFF211F26 : 0xFFF7F2FA;
|
||||
int text = dark ? 0xFFE6E0E9 : 0xFF1D1B20;
|
||||
int accent = dark ? 0xFFD0BCFF : 0xFF6750A4;
|
||||
int control = dark ? 0xFFE6E0E9 : 0xFF1D1B20;
|
||||
int button = blend(accent, background, dark ? 65 : 80);
|
||||
int buttonHover = blend(accent, background, dark ? 45 : 60);
|
||||
|
||||
return new int[] {
|
||||
dark ? 1 : 0,
|
||||
background,
|
||||
surface,
|
||||
text,
|
||||
accent,
|
||||
button,
|
||||
buttonHover,
|
||||
control,
|
||||
accent
|
||||
};
|
||||
}
|
||||
|
||||
private void applySystemBars() {
|
||||
int[] colors = systemThemeColors();
|
||||
boolean dark = colors[0] != 0;
|
||||
getWindow().setStatusBarColor(colors[1]);
|
||||
getWindow().setNavigationBarColor(colors[1]);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
int flags = getWindow().getDecorView().getSystemUiVisibility();
|
||||
if (!dark) {
|
||||
flags |= View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
flags |= View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
|
||||
}
|
||||
} else {
|
||||
flags &= ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
flags &= ~View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
|
||||
}
|
||||
}
|
||||
getWindow().getDecorView().setSystemUiVisibility(flags);
|
||||
}
|
||||
}
|
||||
|
||||
private static int blend(int from, int to, int percentTo) {
|
||||
int p = Math.max(0, Math.min(100, percentTo));
|
||||
int a = (((from >>> 24) & 0xff) * (100 - p) + ((to >>> 24) & 0xff) * p) / 100;
|
||||
int r = (((from >>> 16) & 0xff) * (100 - p) + ((to >>> 16) & 0xff) * p) / 100;
|
||||
int g = (((from >>> 8) & 0xff) * (100 - p) + ((to >>> 8) & 0xff) * p) / 100;
|
||||
int b = ((from & 0xff) * (100 - p) + (to & 0xff) * p) / 100;
|
||||
return (a << 24) | (r << 16) | (g << 8) | b;
|
||||
}
|
||||
|
||||
public boolean hasStoredMasterPassword() {
|
||||
return secureStore != null && secureStore.hasStoredSecret();
|
||||
}
|
||||
|
||||
public boolean isStoredMasterBiometric() {
|
||||
return hasStoredMasterPassword();
|
||||
}
|
||||
|
||||
public boolean isBiometricAvailable() {
|
||||
return secureStore != null && secureStore.isBiometricAvailable();
|
||||
}
|
||||
|
||||
public boolean isBiometricSetupRequired() {
|
||||
return secureStore != null && secureStore.isBiometricSetupRequired();
|
||||
}
|
||||
|
||||
private String biometricUnavailableMessage() {
|
||||
if (isBiometricSetupRequired()) {
|
||||
return "Set up Android screen lock and fingerprint first";
|
||||
}
|
||||
return "Biometric unlock is not available on this device";
|
||||
}
|
||||
|
||||
public int secureMasterStatus() {
|
||||
if (secureStore != null)
|
||||
return secureStore.status();
|
||||
synchronized (secureLock) {
|
||||
return secureStatus;
|
||||
}
|
||||
}
|
||||
|
||||
public String takeSecureMasterResult() {
|
||||
if (secureStore != null)
|
||||
return secureStore.takeResult();
|
||||
synchronized (secureLock) {
|
||||
String value = secureResult == null ? "" : secureResult;
|
||||
secureResult = "";
|
||||
secureStatus = SecureStore.STATUS_IDLE;
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
public void saveMasterPassword(final String master, final boolean requireBiometric) {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (master == null || master.length() == 0) {
|
||||
setSecureError("Enter a master password first");
|
||||
return;
|
||||
}
|
||||
if (!isBiometricAvailable()) {
|
||||
setSecureError(biometricUnavailableMessage());
|
||||
return;
|
||||
}
|
||||
if (secureStore != null)
|
||||
secureStore.saveSecret(master, "master password");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void unlockMasterPassword() {
|
||||
if (secureStore == null || !hasStoredMasterPassword()) {
|
||||
setSecureError("No saved master password");
|
||||
return;
|
||||
}
|
||||
secureStore.unlockSecret("master password");
|
||||
}
|
||||
|
||||
public void clearMasterPassword() {
|
||||
if (secureStore != null) {
|
||||
secureStore.clearSecret();
|
||||
} else {
|
||||
setSecureOk("Saved master password removed");
|
||||
}
|
||||
}
|
||||
|
||||
private void setSecureOk(String value) {
|
||||
synchronized (secureLock) {
|
||||
secureStatus = SecureStore.STATUS_OK;
|
||||
secureResult = value == null ? "" : value;
|
||||
}
|
||||
}
|
||||
|
||||
private void setSecureError(String value) {
|
||||
synchronized (secureLock) {
|
||||
secureStatus = SecureStore.STATUS_ERROR;
|
||||
secureResult = value == null ? "Secure storage failed" : value;
|
||||
}
|
||||
}
|
||||
|
||||
private void setupTextInputBridge() {
|
||||
textInputBridge = new TextInputBridge(this, new TextInputBridge.Callbacks() {
|
||||
@Override
|
||||
public void commitText(int codepoint) {
|
||||
nativeTextInputCommit(codepoint);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void backspace() {
|
||||
nativeTextInputBackspace();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enter() {
|
||||
nativeTextInputEnter();
|
||||
}
|
||||
});
|
||||
addContentView(textInputBridge.getView(), new ViewGroup.LayoutParams(1, 1));
|
||||
}
|
||||
|
||||
public void setSoftKeyboardVisible(final boolean visible) {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (textInputBridge != null) {
|
||||
textInputBridge.setVisible(visible);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setupInsetsListener() {
|
||||
final View decorView = getWindow().getDecorView();
|
||||
|
||||
nativeSetDeviceDensity(getResources().getDisplayMetrics().density);
|
||||
|
||||
decorView.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() {
|
||||
@Override
|
||||
public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) {
|
||||
updateInsets(insets);
|
||||
return insets;
|
||||
}
|
||||
});
|
||||
|
||||
// Keep the native UI updated when the soft keyboard changes the
|
||||
// visible frame on API levels where IME insets are not reported.
|
||||
decorView.getViewTreeObserver().addOnGlobalLayoutListener(
|
||||
new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||
@Override
|
||||
public void onGlobalLayout() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
WindowInsets insets = decorView.getRootWindowInsets();
|
||||
if (insets != null) {
|
||||
updateInsets(insets);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
decorView.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
decorView.requestApplyInsets();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void updateInsets(WindowInsets insets) {
|
||||
if (insets == null) return;
|
||||
|
||||
nativeSetDeviceDensity(getResources().getDisplayMetrics().density);
|
||||
|
||||
int systemLeft = 0;
|
||||
int systemTop = 0;
|
||||
int systemRight = 0;
|
||||
int systemBottom = 0;
|
||||
int imeBottom = 0;
|
||||
int cLeft = 0, cTop = 0, cRight = 0, cBottom = 0;
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
Insets systemBars = insets.getInsetsIgnoringVisibility(
|
||||
WindowInsets.Type.systemBars());
|
||||
Insets ime = insets.getInsets(WindowInsets.Type.ime());
|
||||
systemLeft = systemBars.left;
|
||||
systemTop = systemBars.top;
|
||||
systemRight = systemBars.right;
|
||||
systemBottom = systemBars.bottom;
|
||||
imeBottom = ime.bottom;
|
||||
} else {
|
||||
systemLeft = insets.getSystemWindowInsetLeft();
|
||||
systemTop = insets.getSystemWindowInsetTop();
|
||||
systemRight = insets.getSystemWindowInsetRight();
|
||||
systemBottom = insets.getSystemWindowInsetBottom();
|
||||
imeBottom = inferImeBottom(systemBottom);
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
DisplayCutout cutout = insets.getDisplayCutout();
|
||||
if (cutout != null) {
|
||||
cLeft = cutout.getSafeInsetLeft();
|
||||
cTop = cutout.getSafeInsetTop();
|
||||
cRight = cutout.getSafeInsetRight();
|
||||
cBottom = cutout.getSafeInsetBottom();
|
||||
}
|
||||
}
|
||||
|
||||
nativeSetInsets(systemLeft, systemTop, systemRight, systemBottom,
|
||||
imeBottom, cLeft, cTop, cRight, cBottom);
|
||||
}
|
||||
|
||||
private int inferImeBottom(int navBar) {
|
||||
View decorView = getWindow().getDecorView();
|
||||
Rect visible = new Rect();
|
||||
decorView.getWindowVisibleDisplayFrame(visible);
|
||||
int rootHeight = decorView.getRootView().getHeight();
|
||||
int hiddenBottom = rootHeight - visible.bottom;
|
||||
|
||||
if (hiddenBottom <= navBar) return 0;
|
||||
return hiddenBottom;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package xyz.waozi.pass;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import com.kryonlabs.kryon.KryonActivity;
|
||||
|
||||
public final class PassActivity extends KryonActivity {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
getWindow().setSoftInputMode(
|
||||
WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING);
|
||||
}
|
||||
}
|
||||
@@ -1,214 +0,0 @@
|
||||
package xyz.waozi.pass;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.InputType;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.inputmethod.BaseInputConnection;
|
||||
import android.view.inputmethod.EditorInfo;
|
||||
import android.view.inputmethod.InputConnection;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
|
||||
final class TextInputBridge {
|
||||
interface Callbacks {
|
||||
void commitText(int codepoint);
|
||||
void backspace();
|
||||
void enter();
|
||||
}
|
||||
|
||||
private final BridgeView view;
|
||||
private final InputMethodManager inputMethodManager;
|
||||
private final Callbacks callbacks;
|
||||
|
||||
private boolean active = false;
|
||||
private int showRequests = 0;
|
||||
private int hideRequests = 0;
|
||||
private int pendingShowAttempts = 0;
|
||||
private final Runnable showKeyboardRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
showKeyboardNow();
|
||||
}
|
||||
};
|
||||
|
||||
TextInputBridge(Context context, Callbacks callbacks) {
|
||||
this.callbacks = callbacks;
|
||||
this.view = new BridgeView(context);
|
||||
this.view.setAlpha(0.0f);
|
||||
this.view.setBackgroundColor(0x00000000);
|
||||
this.inputMethodManager =
|
||||
(InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
}
|
||||
|
||||
View getView() {
|
||||
return view;
|
||||
}
|
||||
|
||||
void setVisible(boolean visible) {
|
||||
if (inputMethodManager == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (visible) {
|
||||
active = true;
|
||||
showRequests++;
|
||||
pendingShowAttempts = 3;
|
||||
showKeyboardNow();
|
||||
} else {
|
||||
active = false;
|
||||
hideRequests++;
|
||||
pendingShowAttempts = 0;
|
||||
view.removeCallbacks(showKeyboardRunnable);
|
||||
view.clearFocus();
|
||||
inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
int showRequestsForTest() {
|
||||
return showRequests;
|
||||
}
|
||||
|
||||
int hideRequestsForTest() {
|
||||
return hideRequests;
|
||||
}
|
||||
|
||||
boolean hasFocusForTest() {
|
||||
return view.hasFocus();
|
||||
}
|
||||
|
||||
InputConnection createInputConnectionForTest(EditorInfo info) {
|
||||
return view.onCreateInputConnection(info);
|
||||
}
|
||||
|
||||
private void showKeyboardNow() {
|
||||
if (!active) {
|
||||
return;
|
||||
}
|
||||
if (!view.isAttachedToWindow()) {
|
||||
view.post(showKeyboardRunnable);
|
||||
return;
|
||||
}
|
||||
|
||||
view.requestFocus();
|
||||
inputMethodManager.restartInput(view);
|
||||
boolean shown = inputMethodManager.showSoftInput(
|
||||
view, InputMethodManager.SHOW_IMPLICIT);
|
||||
if (!shown) {
|
||||
shown = inputMethodManager.showSoftInput(
|
||||
view, InputMethodManager.SHOW_FORCED);
|
||||
}
|
||||
pendingShowAttempts--;
|
||||
if (!shown && pendingShowAttempts > 0) {
|
||||
view.postDelayed(showKeyboardRunnable, 80);
|
||||
}
|
||||
}
|
||||
|
||||
private void commitText(CharSequence text) {
|
||||
if (!active || text == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < text.length();) {
|
||||
int codepoint = Character.codePointAt(text, i);
|
||||
if (codepoint >= 32) {
|
||||
callbacks.commitText(codepoint);
|
||||
}
|
||||
i += Character.charCount(codepoint);
|
||||
}
|
||||
}
|
||||
|
||||
private void commitBackspace() {
|
||||
if (active) {
|
||||
callbacks.backspace();
|
||||
}
|
||||
}
|
||||
|
||||
private void commitEnter() {
|
||||
if (active) {
|
||||
callbacks.enter();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean handleKeyEvent(KeyEvent event) {
|
||||
if (event == null || event.getAction() != KeyEvent.ACTION_DOWN) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int keyCode = event.getKeyCode();
|
||||
if (keyCode == KeyEvent.KEYCODE_DEL) {
|
||||
commitBackspace();
|
||||
return true;
|
||||
}
|
||||
if (keyCode == KeyEvent.KEYCODE_ENTER ||
|
||||
keyCode == KeyEvent.KEYCODE_NUMPAD_ENTER) {
|
||||
commitEnter();
|
||||
return true;
|
||||
}
|
||||
|
||||
int unicode = event.getUnicodeChar();
|
||||
if (unicode >= 32) {
|
||||
commitText(new String(Character.toChars(unicode)));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private final class BridgeView extends View {
|
||||
BridgeView(Context context) {
|
||||
super(context);
|
||||
setLayoutParams(new ViewGroup.LayoutParams(1, 1));
|
||||
setFocusable(true);
|
||||
setFocusableInTouchMode(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCheckIsTextEditor() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
|
||||
outAttrs.inputType = InputType.TYPE_CLASS_TEXT |
|
||||
InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD |
|
||||
InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS;
|
||||
outAttrs.imeOptions = EditorInfo.IME_ACTION_DONE |
|
||||
EditorInfo.IME_FLAG_NO_EXTRACT_UI;
|
||||
|
||||
return new BaseInputConnection(this, false) {
|
||||
@Override
|
||||
public boolean commitText(CharSequence text, int newCursorPosition) {
|
||||
TextInputBridge.this.commitText(text);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteSurroundingText(int beforeLength, int afterLength) {
|
||||
if (beforeLength > 0) {
|
||||
commitBackspace();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sendKeyEvent(KeyEvent event) {
|
||||
return handleKeyEvent(event) || super.sendKeyEvent(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean performEditorAction(int editorAction) {
|
||||
if (editorAction == EditorInfo.IME_ACTION_DONE) {
|
||||
commitEnter();
|
||||
return true;
|
||||
}
|
||||
return super.performEditorAction(editorAction);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
return handleKeyEvent(event) || super.onKeyDown(keyCode, event);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">pass</string>
|
||||
<string name="app_name">Pass</string>
|
||||
</resources>
|
||||
@@ -0,0 +1,2 @@
|
||||
- Keep bottom navigation, password controls, and dialog icons readable with dark tints in light mode and light tints in dark mode.
|
||||
- Prevent taps in Theme Settings from reaching fields underneath or opening the keyboard when saving the theme.
|
||||
@@ -1,4 +1,4 @@
|
||||
pass derives strong, repeatable passwords on your device. The same site, login, master password, and settings always produce the same result, so there is no password database to back up, sync, or lose.
|
||||
Pass derives strong, repeatable passwords on your device. The same site, login, master password, and settings always produce the same result, so there is no password database to back up, sync, or lose.
|
||||
|
||||
Everything is computed locally. The app makes no network requests, keeps no accounts, and tracks nothing.
|
||||
|
||||
@@ -9,7 +9,7 @@ Features:
|
||||
• Optional fingerprint unlock with the master password held in secure storage
|
||||
• No analytics, no tracking, no network access
|
||||
|
||||
pass is an independent implementation of the LessPass algorithm. Compatibility does not imply endorsement by or affiliation with the LessPass project.
|
||||
Pass is an independent implementation of the LessPass algorithm. Compatibility does not imply endorsement by or affiliation with the LessPass project.
|
||||
|
||||
Source code: https://github.com/waozixyz/pass
|
||||
Website: https://pass.waozi.xyz
|
||||
|
||||
@@ -1 +1 @@
|
||||
pass
|
||||
Pass
|
||||
@@ -0,0 +1,15 @@
|
||||
< /$objtype/mkfile
|
||||
|
||||
# Native Plan 9 build of Pass (Kryon libdraw backend). build/plan9 is
|
||||
# prepared on the host by: make kry-c-plan9
|
||||
|
||||
TARG=pass
|
||||
ROOT=/sys/src/pass
|
||||
|
||||
gensrc=`{cat $ROOT/build/plan9/generated-c-files.txt}
|
||||
appsrc=native/pass_core.c native/pass_runtime.c native/pass_plan9_main.c
|
||||
hostsrc=build/plan9/pass_embedded_assets.c
|
||||
APPCPPFLAGS=-I$ROOT/build/plan9/generated -I$ROOT/native
|
||||
LDLIBS=
|
||||
|
||||
< /sys/src/kryon/mk/plan9-app.mk
|
||||
@@ -66,25 +66,63 @@ check_derive(int index, const char *password, const char *salt, const char *want
|
||||
}
|
||||
|
||||
static void
|
||||
check_sha256(void)
|
||||
check_derive_bytes(int index, const char *password, size_t password_len,
|
||||
const char *salt, size_t salt_len, const char *want_hex)
|
||||
{
|
||||
uint8_t out[32];
|
||||
char hex[65];
|
||||
int i;
|
||||
|
||||
pass_core_sha256("correct horse battery staple", strlen("correct horse battery staple"), out);
|
||||
pass_core_derive_key(password, password_len, salt, salt_len, out);
|
||||
for(i = 0; i < 32; i++)
|
||||
sprintf(hex + i * 2, "%02x", out[i]);
|
||||
hex[64] = '\0';
|
||||
|
||||
if(strcmp(hex, "c4bbcb1fbec99d65bf59d85c8cb62ee2db963f0fe106f483d9afa73bd4e39a8a") != 0) {
|
||||
printf("FAIL sha256: got %s\n", hex);
|
||||
if(strcmp(hex, want_hex) != 0) {
|
||||
printf("FAIL derive %d: got %s, want %s\n", index, hex, want_hex);
|
||||
failures++;
|
||||
} else {
|
||||
printf("ok sha256: %s\n", hex);
|
||||
printf("ok derive %d: %s\n", index, hex);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
check_sha256_hex(int index, const void *data, size_t len, const char *want_hex)
|
||||
{
|
||||
uint8_t out[32];
|
||||
char hex[65];
|
||||
int i;
|
||||
|
||||
pass_core_sha256(data, len, out);
|
||||
for(i = 0; i < 32; i++)
|
||||
sprintf(hex + i * 2, "%02x", out[i]);
|
||||
hex[64] = '\0';
|
||||
|
||||
if(strcmp(hex, want_hex) != 0) {
|
||||
printf("FAIL sha256 %d: got %s, want %s\n", index, hex, want_hex);
|
||||
failures++;
|
||||
} else {
|
||||
printf("ok sha256 %d: %s\n", index, hex);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
check_sha256(void)
|
||||
{
|
||||
char sixty[60];
|
||||
|
||||
memset(sixty, 'a', sizeof(sixty));
|
||||
check_sha256_hex(1, "", 0,
|
||||
"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855");
|
||||
check_sha256_hex(2, "abc", 3,
|
||||
"ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad");
|
||||
check_sha256_hex(3, "correct horse battery staple",
|
||||
strlen("correct horse battery staple"),
|
||||
"c4bbcb1fbec99d65bf59d85c8cb62ee2db963f0fe106f483d9afa73bd4e39a8a");
|
||||
check_sha256_hex(4, sixty, sizeof(sixty),
|
||||
"11ee391211c6256460b6ed375957fadd8061cafbb31daf967db875aebd5aaad4");
|
||||
}
|
||||
|
||||
static int
|
||||
utf8_codepoint_count(const char *text)
|
||||
{
|
||||
@@ -118,6 +156,9 @@ check_master_emoji(void)
|
||||
|
||||
pass_core_master_emoji("correct horse battery staple", first, sizeof(first));
|
||||
pass_core_master_emoji("correct horse battery staple", again, sizeof(again));
|
||||
pass_core_master_emoji(NULL, empty, sizeof(empty));
|
||||
pass_core_master_emoji("ignored", NULL, sizeof(empty));
|
||||
pass_core_master_emoji("ignored", empty, 0);
|
||||
if(strcmp(first, again) != 0 ||
|
||||
utf8_codepoint_count(first) != PASS_MASTER_EMOJI_COUNT) {
|
||||
printf("FAIL master emoji: deterministic=%d count=%d value=%s\n",
|
||||
@@ -134,6 +175,18 @@ check_master_emoji(void)
|
||||
failures++;
|
||||
return;
|
||||
}
|
||||
{
|
||||
char tiny[2];
|
||||
|
||||
tiny[0] = 'x';
|
||||
tiny[1] = '\0';
|
||||
pass_core_master_emoji("correct horse battery staple", tiny, sizeof(tiny));
|
||||
if(tiny[0] != '\0') {
|
||||
printf("FAIL master emoji: tiny buffer value=%s\n", tiny);
|
||||
failures++;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
pass_core_master_emoji("test", values[0], sizeof(values[0]));
|
||||
pass_core_master_emoji("test2", values[1], sizeof(values[1]));
|
||||
@@ -225,6 +278,18 @@ main(void)
|
||||
"caa46554f5a676b76c15b368c655b0b24eaaad8595ef919999785c68e60fd5f5");
|
||||
check_derive(3, "test", "sitelogina",
|
||||
"91b368e6337bd9c7007041922ade15c2907bd53c450f73e0ba1a001e10bff7eb");
|
||||
{
|
||||
char long_password[80];
|
||||
char long_salt[700];
|
||||
|
||||
memset(long_password, 'a', sizeof(long_password));
|
||||
memset(long_salt, 'b', sizeof(long_salt));
|
||||
check_derive_bytes(4, long_password, sizeof(long_password), "salt", 4,
|
||||
"2ff041c8085dbce46f9dc5a4e8b9e5eb1d1727318c540f6697b5b0a368e158ad");
|
||||
check_derive_bytes(5, "password", strlen("password"),
|
||||
long_salt, sizeof(long_salt),
|
||||
"3a4d1af4f539070e6fb4b2a0709071d03e01c7fb6c2659f6a84811eae850150b");
|
||||
}
|
||||
check_sha256();
|
||||
check_master_emoji();
|
||||
|
||||
@@ -345,6 +410,34 @@ main(void)
|
||||
check_generate(13, "site", "login", "master", o, "", 1);
|
||||
}
|
||||
|
||||
{
|
||||
PassOptions o = defaults;
|
||||
char out[4];
|
||||
char err[128];
|
||||
|
||||
memset(out, 0, sizeof(out));
|
||||
memset(err, 0, sizeof(err));
|
||||
if(pass_core_generate("site", "login", "master", &o,
|
||||
out, sizeof(out), err, sizeof(err)) == 0 ||
|
||||
strcmp(err, "password length exceeds the output buffer") != 0) {
|
||||
printf("FAIL small output buffer: %s\n", err);
|
||||
failures++;
|
||||
} else {
|
||||
printf("ok small output buffer: %s\n", err);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
PassOptions o = defaults;
|
||||
char long_text[700];
|
||||
|
||||
memset(long_text, 'x', sizeof(long_text) - 1);
|
||||
long_text[sizeof(long_text) - 1] = '\0';
|
||||
check_generate(14, long_text, "login", "master", o, "", 1);
|
||||
check_generate(15, "site", long_text, "master", o, "", 1);
|
||||
check_generate(16, NULL, NULL, NULL, o, "bb8^CBroRNj%4sP_", 0);
|
||||
}
|
||||
|
||||
check_shape();
|
||||
|
||||
if(failures != 0) {
|
||||
|
||||
@@ -0,0 +1,146 @@
|
||||
/* Native Plan 9 entry point for Pass (Kryon libdraw backend).
|
||||
*
|
||||
* Mirrors droid/app/src/main/cpp/main.c: owns the window, theme, fonts,
|
||||
* and the frame loop. Switches to the user's home directory first so the
|
||||
* profiles file and kryon app-storage settings land in $home instead of
|
||||
* the source tree. */
|
||||
|
||||
#include "kryon.h"
|
||||
#include "embedded_assets.h"
|
||||
#include "app_runtime.h"
|
||||
#include "app/pass.h"
|
||||
#include "pass_runtime.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static const char *const FONT_ASSET_PATH = "vendor/kryon/fonts/noto/NotoSans-Regular.ttf";
|
||||
static const char *const EMOJI_FONT_ASSET_PATH = "assets/fonts/emoji.ttf";
|
||||
|
||||
/* The generated project host references the app lifecycle hooks weakly,
|
||||
* and the native Plan 9 linker has no weak symbols; this entry point
|
||||
* drives the loop itself, so the hooks stay inert. */
|
||||
void *CreateApp(const char *project_path)
|
||||
{
|
||||
(void)project_path;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void DestroyApp(void *app)
|
||||
{
|
||||
(void)app;
|
||||
}
|
||||
|
||||
void ApplyRoute(void *app, const AppRouteInfo *route)
|
||||
{
|
||||
(void)app;
|
||||
(void)route;
|
||||
}
|
||||
|
||||
void BeginScreenDraw(void *app, Rectangle viewport)
|
||||
{
|
||||
(void)app;
|
||||
(void)viewport;
|
||||
}
|
||||
|
||||
static void
|
||||
setup_shapes_texture(void)
|
||||
{
|
||||
Image white = GenImageColor(1, 1, WHITE);
|
||||
Texture2D texture = LoadTextureFromImage(white);
|
||||
|
||||
UnloadImage(white);
|
||||
if(texture.id == 0)
|
||||
return;
|
||||
SetTextureFilter(texture, TEXTURE_FILTER_POINT);
|
||||
SetShapesTexture(texture, (Rectangle){0.0f, 0.0f, 1.0f, 1.0f});
|
||||
}
|
||||
|
||||
static int
|
||||
setup_ui_font(void)
|
||||
{
|
||||
const EmbeddedAsset *asset = GetEmbeddedAsset(FONT_ASSET_PATH);
|
||||
|
||||
if(asset == NULL || asset->data == NULL || asset->size == 0) {
|
||||
TraceLog(LOG_WARNING, "PASS: missing embedded font asset");
|
||||
return 0;
|
||||
}
|
||||
if(!RegisterUIFontSource("ui", GetEmbeddedAssetExtension(FONT_ASSET_PATH),
|
||||
asset->data, asset->size, NULL, 0)) {
|
||||
TraceLog(LOG_WARNING, "PASS: RegisterUIFontSource failed");
|
||||
return 0;
|
||||
}
|
||||
if(!UseUIFont("ui")) {
|
||||
TraceLog(LOG_WARNING, "PASS: UseUIFont failed");
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
setup_emoji_font(void)
|
||||
{
|
||||
const EmbeddedAsset *asset = GetEmbeddedAsset(EMOJI_FONT_ASSET_PATH);
|
||||
int codepoint_count = 0;
|
||||
const int *codepoints = pass_runtime_master_emoji_codepoints(&codepoint_count);
|
||||
|
||||
if(asset == NULL || asset->data == NULL || asset->size == 0) {
|
||||
TraceLog(LOG_WARNING, "PASS: missing embedded emoji font asset");
|
||||
return 0;
|
||||
}
|
||||
if(!RegisterUIFixedFontSource("pass-emoji",
|
||||
GetEmbeddedAssetExtension(EMOJI_FONT_ASSET_PATH),
|
||||
asset->data, asset->size, codepoints, codepoint_count)) {
|
||||
TraceLog(LOG_WARNING, "PASS: RegisterUIFixedFontSource failed for emoji");
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
const char *home;
|
||||
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
home = getenv("home");
|
||||
if(home == NULL)
|
||||
home = getenv("HOME");
|
||||
if(home != NULL && home[0] != '\0') {
|
||||
if(chdir(home) != 0)
|
||||
TraceLog(LOG_WARNING, "PASS: failed to switch to home directory");
|
||||
}
|
||||
|
||||
InitWindow(540, 700, "Pass");
|
||||
if(!IsWindowReady()) {
|
||||
TraceLog(LOG_ERROR, "PASS: InitWindow failed");
|
||||
return 1;
|
||||
}
|
||||
InitUIDPI();
|
||||
SetThemeStyle(THEME_STYLE_MATERIAL);
|
||||
SetCurrentTheme(GetDefaultThemeForThemeStyle(THEME_STYLE_MATERIAL), 0);
|
||||
ApplyCurrentUITheme();
|
||||
setup_ui_font();
|
||||
setup_emoji_font();
|
||||
setup_shapes_texture();
|
||||
SetTargetFPS(60);
|
||||
|
||||
pass_runtime_init();
|
||||
TraceLog(LOG_INFO, "PASS: app ready");
|
||||
while(!WindowShouldClose()) {
|
||||
BeginFrame();
|
||||
BeginUIFrame(GetFrameWidth(), GetFrameHeight(), GetFrameScale());
|
||||
pass_runtime_tick();
|
||||
pass_frame();
|
||||
EndUIFrame();
|
||||
EndFrame();
|
||||
}
|
||||
|
||||
pass_runtime_shutdown();
|
||||
CloseWindow();
|
||||
return 0;
|
||||
}
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
#include "pass_core.h"
|
||||
|
||||
#include "android_bridge.h"
|
||||
#include "android_host.h"
|
||||
#include "app_storage.h"
|
||||
#include "kryon.h"
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -16,6 +17,7 @@
|
||||
#define PASS_EXCLUDE_SIZE 128
|
||||
#define PASS_PASSWORD_SIZE 256
|
||||
#define PASS_STATUS_SIZE 256
|
||||
#define PASS_SETTINGS_SCOPE "pass"
|
||||
|
||||
typedef struct {
|
||||
char name[PASS_NAME_SIZE];
|
||||
@@ -69,6 +71,7 @@ enum {
|
||||
};
|
||||
|
||||
static PassRuntime runtime;
|
||||
static const char *const PASS_SECURE_MASTER_KEY = "default";
|
||||
|
||||
static void
|
||||
copy_text(char *dst, size_t dst_size, const char *src)
|
||||
@@ -133,7 +136,7 @@ trim_newline(char *s)
|
||||
}
|
||||
|
||||
static void
|
||||
load_settings(void)
|
||||
load_legacy_settings(void)
|
||||
{
|
||||
FILE *f = fopen("settings.cfg", "r");
|
||||
char line[256];
|
||||
@@ -180,6 +183,56 @@ load_settings(void)
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
static void
|
||||
load_settings(void)
|
||||
{
|
||||
load_legacy_settings();
|
||||
KryAppStorageGetInt(PASS_SETTINGS_SCOPE, "auto_copy",
|
||||
runtime.settings.auto_copy,
|
||||
&runtime.settings.auto_copy);
|
||||
KryAppStorageGetInt(PASS_SETTINGS_SCOPE, "clear_after_seconds",
|
||||
runtime.settings.clear_seconds,
|
||||
&runtime.settings.clear_seconds);
|
||||
KryAppStorageGetInt(PASS_SETTINGS_SCOPE, "show_fingerprint",
|
||||
runtime.settings.show_fingerprint,
|
||||
&runtime.settings.show_fingerprint);
|
||||
KryAppStorageGetInt(PASS_SETTINGS_SCOPE, "length",
|
||||
runtime.settings.length,
|
||||
&runtime.settings.length);
|
||||
runtime.settings.length = clamp_length(runtime.settings.length);
|
||||
KryAppStorageGetInt(PASS_SETTINGS_SCOPE, "counter",
|
||||
runtime.settings.counter,
|
||||
&runtime.settings.counter);
|
||||
KryAppStorageGetInt(PASS_SETTINGS_SCOPE, "lower",
|
||||
runtime.settings.lower,
|
||||
&runtime.settings.lower);
|
||||
KryAppStorageGetInt(PASS_SETTINGS_SCOPE, "upper",
|
||||
runtime.settings.upper,
|
||||
&runtime.settings.upper);
|
||||
KryAppStorageGetInt(PASS_SETTINGS_SCOPE, "digits",
|
||||
runtime.settings.digits,
|
||||
&runtime.settings.digits);
|
||||
KryAppStorageGetInt(PASS_SETTINGS_SCOPE, "symbols",
|
||||
runtime.settings.symbols,
|
||||
&runtime.settings.symbols);
|
||||
KryAppStorageGetString(PASS_SETTINGS_SCOPE, "exclude",
|
||||
runtime.settings.exclude,
|
||||
runtime.settings.exclude,
|
||||
sizeof(runtime.settings.exclude));
|
||||
KryAppStorageGetInt(PASS_SETTINGS_SCOPE, "theme_source",
|
||||
runtime.settings.theme_source,
|
||||
&runtime.settings.theme_source);
|
||||
KryAppStorageGetInt(PASS_SETTINGS_SCOPE, "theme_mode",
|
||||
runtime.settings.theme_mode,
|
||||
&runtime.settings.theme_mode);
|
||||
KryAppStorageGetInt(PASS_SETTINGS_SCOPE, "theme_id",
|
||||
runtime.settings.theme_id,
|
||||
&runtime.settings.theme_id);
|
||||
KryAppStorageGetInt(PASS_SETTINGS_SCOPE, "theme_style",
|
||||
runtime.settings.theme_style,
|
||||
&runtime.settings.theme_style);
|
||||
}
|
||||
|
||||
static void
|
||||
migrate_default_theme_settings(void)
|
||||
{
|
||||
@@ -203,27 +256,40 @@ migrate_default_theme_settings(void)
|
||||
static int
|
||||
write_settings(void)
|
||||
{
|
||||
FILE *f = fopen("settings.cfg", "w");
|
||||
int ok = 1;
|
||||
|
||||
if(f == NULL) {
|
||||
ok &= KryAppStorageSetInt(PASS_SETTINGS_SCOPE, "auto_copy",
|
||||
runtime.settings.auto_copy ? 1 : 0);
|
||||
ok &= KryAppStorageSetInt(PASS_SETTINGS_SCOPE, "clear_after_seconds",
|
||||
runtime.settings.clear_seconds);
|
||||
ok &= KryAppStorageSetInt(PASS_SETTINGS_SCOPE, "show_fingerprint",
|
||||
runtime.settings.show_fingerprint ? 1 : 0);
|
||||
ok &= KryAppStorageSetInt(PASS_SETTINGS_SCOPE, "length",
|
||||
runtime.settings.length);
|
||||
ok &= KryAppStorageSetInt(PASS_SETTINGS_SCOPE, "counter",
|
||||
runtime.settings.counter);
|
||||
ok &= KryAppStorageSetInt(PASS_SETTINGS_SCOPE, "lower",
|
||||
runtime.settings.lower ? 1 : 0);
|
||||
ok &= KryAppStorageSetInt(PASS_SETTINGS_SCOPE, "upper",
|
||||
runtime.settings.upper ? 1 : 0);
|
||||
ok &= KryAppStorageSetInt(PASS_SETTINGS_SCOPE, "digits",
|
||||
runtime.settings.digits ? 1 : 0);
|
||||
ok &= KryAppStorageSetInt(PASS_SETTINGS_SCOPE, "symbols",
|
||||
runtime.settings.symbols ? 1 : 0);
|
||||
ok &= KryAppStorageSetString(PASS_SETTINGS_SCOPE, "exclude",
|
||||
runtime.settings.exclude);
|
||||
ok &= KryAppStorageSetInt(PASS_SETTINGS_SCOPE, "theme_source",
|
||||
runtime.settings.theme_source);
|
||||
ok &= KryAppStorageSetInt(PASS_SETTINGS_SCOPE, "theme_mode",
|
||||
runtime.settings.theme_mode);
|
||||
ok &= KryAppStorageSetInt(PASS_SETTINGS_SCOPE, "theme_id",
|
||||
runtime.settings.theme_id);
|
||||
ok &= KryAppStorageSetInt(PASS_SETTINGS_SCOPE, "theme_style",
|
||||
runtime.settings.theme_style);
|
||||
if(!ok) {
|
||||
copy_text(runtime.status, sizeof(runtime.status), "Could not save settings");
|
||||
return 1;
|
||||
}
|
||||
fprintf(f, "auto_copy=%d\n", runtime.settings.auto_copy ? 1 : 0);
|
||||
fprintf(f, "clear_after_seconds=%d\n", runtime.settings.clear_seconds);
|
||||
fprintf(f, "show_fingerprint=%d\n", runtime.settings.show_fingerprint ? 1 : 0);
|
||||
fprintf(f, "length=%d\n", runtime.settings.length);
|
||||
fprintf(f, "counter=%d\n", runtime.settings.counter);
|
||||
fprintf(f, "lower=%d\n", runtime.settings.lower ? 1 : 0);
|
||||
fprintf(f, "upper=%d\n", runtime.settings.upper ? 1 : 0);
|
||||
fprintf(f, "digits=%d\n", runtime.settings.digits ? 1 : 0);
|
||||
fprintf(f, "symbols=%d\n", runtime.settings.symbols ? 1 : 0);
|
||||
fprintf(f, "exclude=%s\n", runtime.settings.exclude);
|
||||
fprintf(f, "theme_source=%d\n", runtime.settings.theme_source);
|
||||
fprintf(f, "theme_mode=%d\n", runtime.settings.theme_mode);
|
||||
fprintf(f, "theme_id=%d\n", runtime.settings.theme_id);
|
||||
fprintf(f, "theme_style=%d\n", runtime.settings.theme_style);
|
||||
fclose(f);
|
||||
copy_text(runtime.status, sizeof(runtime.status), "Settings saved");
|
||||
return 0;
|
||||
}
|
||||
@@ -340,7 +406,8 @@ void
|
||||
pass_runtime_tick(void)
|
||||
{
|
||||
char result[1024];
|
||||
int status = android_bridge_take_secure_result(result, sizeof(result));
|
||||
int status = AndroidSecureStoreTakeResult(PASS_SECURE_MASTER_KEY,
|
||||
result, sizeof(result));
|
||||
|
||||
if(status == 2) {
|
||||
if(runtime.secure_action == PASS_SECURE_ACTION_UNLOCK) {
|
||||
@@ -378,11 +445,6 @@ pass_runtime_master_emoji_codepoints(int *count)
|
||||
return pass_core_master_emoji_codepoints(count);
|
||||
}
|
||||
|
||||
int pass_safe_left(void) { return android_bridge_left_reserved(); }
|
||||
int pass_safe_top(void) { return android_bridge_top_reserved(); }
|
||||
int pass_safe_right(void) { return android_bridge_right_reserved(); }
|
||||
int pass_safe_bottom(void) { return android_bridge_bottom_reserved(); }
|
||||
|
||||
int
|
||||
pass_generate(const char *site, const char *login, const char *master,
|
||||
int length, int counter,
|
||||
@@ -624,16 +686,17 @@ pass_save_master(const char *master, int require_biometric)
|
||||
copy_text(runtime.status, sizeof(runtime.status), "Enter master password first");
|
||||
return 1;
|
||||
}
|
||||
if(require_biometric && !android_bridge_biometric_available()) {
|
||||
if(require_biometric && !AndroidSecureStoreBiometricAvailable()) {
|
||||
runtime.secure_action = PASS_SECURE_ACTION_NONE;
|
||||
copy_text(runtime.status, sizeof(runtime.status),
|
||||
android_bridge_biometric_setup_required()
|
||||
AndroidSecureStoreBiometricSetupRequired()
|
||||
? "Set up Android fingerprint first"
|
||||
: "Fingerprint unlock unavailable");
|
||||
return 1;
|
||||
}
|
||||
runtime.secure_action = PASS_SECURE_ACTION_SAVE;
|
||||
android_bridge_save_master(master, require_biometric);
|
||||
AndroidSecureStoreSaveSecret(PASS_SECURE_MASTER_KEY, master,
|
||||
require_biometric, "master password");
|
||||
copy_text(runtime.status, sizeof(runtime.status), "Saving master");
|
||||
return 0;
|
||||
}
|
||||
@@ -641,13 +704,13 @@ pass_save_master(const char *master, int require_biometric)
|
||||
int
|
||||
pass_unlock_master(void)
|
||||
{
|
||||
if(!android_bridge_master_saved()) {
|
||||
if(!AndroidSecureStoreHasSecret(PASS_SECURE_MASTER_KEY)) {
|
||||
runtime.secure_action = PASS_SECURE_ACTION_NONE;
|
||||
copy_text(runtime.status, sizeof(runtime.status), "No saved master password");
|
||||
return 1;
|
||||
}
|
||||
runtime.secure_action = PASS_SECURE_ACTION_UNLOCK;
|
||||
android_bridge_unlock_master();
|
||||
AndroidSecureStoreUnlockSecret(PASS_SECURE_MASTER_KEY, "master password");
|
||||
copy_text(runtime.status, sizeof(runtime.status), "Unlock requested");
|
||||
return 0;
|
||||
}
|
||||
@@ -655,7 +718,7 @@ pass_unlock_master(void)
|
||||
int
|
||||
pass_clear_master(void)
|
||||
{
|
||||
android_bridge_clear_master();
|
||||
AndroidSecureStoreClearSecret(PASS_SECURE_MASTER_KEY);
|
||||
memset(runtime.unlocked_master, 0, sizeof(runtime.unlocked_master));
|
||||
runtime.has_unlocked_master = 0;
|
||||
runtime.secure_action = PASS_SECURE_ACTION_NONE;
|
||||
@@ -663,37 +726,17 @@ pass_clear_master(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
pass_can_unlock_master(void)
|
||||
{
|
||||
return android_bridge_master_saved() &&
|
||||
android_bridge_master_biometric() &&
|
||||
android_bridge_biometric_available();
|
||||
}
|
||||
|
||||
int
|
||||
pass_biometric_available(void)
|
||||
{
|
||||
return android_bridge_biometric_available();
|
||||
}
|
||||
|
||||
int
|
||||
pass_master_saved(void)
|
||||
{
|
||||
return android_bridge_master_saved();
|
||||
}
|
||||
|
||||
char *
|
||||
pass_fingerprint_status(void)
|
||||
{
|
||||
if(!android_bridge_biometric_available()) {
|
||||
if(!AndroidSecureStoreBiometricAvailable()) {
|
||||
copy_text(runtime.fingerprint_status, sizeof(runtime.fingerprint_status),
|
||||
android_bridge_biometric_setup_required()
|
||||
AndroidSecureStoreBiometricSetupRequired()
|
||||
? "Android fingerprint setup required"
|
||||
: "Fingerprint unlock is not available");
|
||||
} else if(android_bridge_master_saved()) {
|
||||
} else if(AndroidSecureStoreHasSecret(PASS_SECURE_MASTER_KEY)) {
|
||||
copy_text(runtime.fingerprint_status, sizeof(runtime.fingerprint_status),
|
||||
android_bridge_master_biometric()
|
||||
AndroidSecureStoreSecretUsesBiometric(PASS_SECURE_MASTER_KEY)
|
||||
? "Saved master uses fingerprint unlock"
|
||||
: "Saved master unlocks without fingerprint");
|
||||
} else {
|
||||
|
||||
@@ -14,11 +14,6 @@ void pass_runtime_shutdown(void);
|
||||
const int *pass_runtime_master_emoji_codepoints(int *count);
|
||||
char *pass_master_emoji(const char *master);
|
||||
|
||||
int pass_safe_left(void);
|
||||
int pass_safe_top(void);
|
||||
int pass_safe_right(void);
|
||||
int pass_safe_bottom(void);
|
||||
|
||||
int pass_generate(const char *site, const char *login, const char *master,
|
||||
int length, int counter,
|
||||
int lower, int upper, int digits, int symbols,
|
||||
@@ -51,9 +46,6 @@ int pass_load_settings(int *auto_copy, int *clear_seconds, int *show_fingerprint
|
||||
int pass_save_master(const char *master, int require_biometric);
|
||||
int pass_unlock_master(void);
|
||||
int pass_clear_master(void);
|
||||
int pass_can_unlock_master(void);
|
||||
int pass_biometric_available(void);
|
||||
int pass_master_saved(void);
|
||||
char *pass_fingerprint_status(void);
|
||||
int pass_take_unlocked_master(char *out);
|
||||
|
||||
|
||||
@@ -0,0 +1,400 @@
|
||||
#include "pass_runtime.h"
|
||||
|
||||
#include "android_host.h"
|
||||
#include "pass_core.h"
|
||||
#include "kryon.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static int failures = 0;
|
||||
static double fake_time = 0.0;
|
||||
static char fake_clipboard[256];
|
||||
static int fake_biometric_available = 0;
|
||||
static int fake_biometric_setup_required = 0;
|
||||
static int fake_master_saved = 0;
|
||||
static int fake_master_biometric = 0;
|
||||
static int fake_secure_status = 0;
|
||||
static char fake_secure_result[1024];
|
||||
static char fake_saved_master[1024];
|
||||
static int fake_saved_require_biometric = 0;
|
||||
|
||||
void AndroidHostInit(void) {}
|
||||
void AndroidHostApplySystemTheme(void) {}
|
||||
int AndroidHostLeftReserved(void) { return 0; }
|
||||
int AndroidHostTopReserved(void) { return 0; }
|
||||
int AndroidHostRightReserved(void) { return 0; }
|
||||
int AndroidHostBottomReserved(void) { return 0; }
|
||||
void AndroidHostSetSoftKeyboardVisible(int visible) { (void)visible; }
|
||||
int AndroidSecureStoreBiometricAvailable(void) { return fake_biometric_available; }
|
||||
int AndroidSecureStoreBiometricSetupRequired(void) { return fake_biometric_setup_required; }
|
||||
int AndroidSecureStoreHasSecret(const char *key) { (void)key; return fake_master_saved; }
|
||||
int AndroidSecureStoreSecretUsesBiometric(const char *key) { (void)key; return fake_master_biometric; }
|
||||
int AndroidSecureStoreStatus(const char *key) { (void)key; return fake_secure_status; }
|
||||
|
||||
void
|
||||
AndroidSecureStoreSaveSecret(const char *key, const char *master,
|
||||
int require_biometric, const char *label)
|
||||
{
|
||||
(void)key;
|
||||
(void)label;
|
||||
snprintf(fake_saved_master, sizeof(fake_saved_master), "%s", master != NULL ? master : "");
|
||||
fake_saved_require_biometric = require_biometric != 0;
|
||||
fake_master_saved = 1;
|
||||
fake_master_biometric = require_biometric != 0;
|
||||
}
|
||||
|
||||
void
|
||||
AndroidSecureStoreUnlockSecret(const char *key, const char *label)
|
||||
{
|
||||
(void)key;
|
||||
(void)label;
|
||||
}
|
||||
|
||||
void
|
||||
AndroidSecureStoreClearSecret(const char *key)
|
||||
{
|
||||
(void)key;
|
||||
fake_master_saved = 0;
|
||||
fake_master_biometric = 0;
|
||||
fake_saved_master[0] = '\0';
|
||||
}
|
||||
|
||||
int
|
||||
AndroidSecureStoreTakeResult(const char *key, char *out, int out_size)
|
||||
{
|
||||
int status = fake_secure_status;
|
||||
|
||||
(void)key;
|
||||
if(out != NULL && out_size > 0)
|
||||
snprintf(out, (size_t)out_size, "%s", fake_secure_result);
|
||||
fake_secure_status = 0;
|
||||
fake_secure_result[0] = '\0';
|
||||
return status;
|
||||
}
|
||||
|
||||
double GetTime(void) { return fake_time; }
|
||||
|
||||
void
|
||||
SetClipboardText(const char *text)
|
||||
{
|
||||
snprintf(fake_clipboard, sizeof(fake_clipboard), "%s", text != NULL ? text : "");
|
||||
}
|
||||
|
||||
static void
|
||||
check_int(const char *name, int got, int want)
|
||||
{
|
||||
if(got != want) {
|
||||
printf("FAIL runtime %s: got %d, want %d\n", name, got, want);
|
||||
failures++;
|
||||
} else {
|
||||
printf("ok runtime %s: %d\n", name, got);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
check_str(const char *name, const char *got, const char *want)
|
||||
{
|
||||
if(strcmp(got != NULL ? got : "", want) != 0) {
|
||||
printf("FAIL runtime %s: got \"%s\", want \"%s\"\n",
|
||||
name, got != NULL ? got : "", want);
|
||||
failures++;
|
||||
} else {
|
||||
printf("ok runtime %s: \"%s\"\n", name, got != NULL ? got : "");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
write_initial_files(void)
|
||||
{
|
||||
FILE *f = fopen("settings.cfg", "w");
|
||||
|
||||
if(f == NULL) {
|
||||
perror("settings.cfg");
|
||||
exit(1);
|
||||
}
|
||||
fputs("ignored line\n", f);
|
||||
fputs("auto_copy=1\n", f);
|
||||
fputs("clear_after_seconds=3\n", f);
|
||||
fputs("show_fingerprint=0\n", f);
|
||||
fputs("length=99\n", f);
|
||||
fputs("counter=7\n", f);
|
||||
fputs("lower=1\n", f);
|
||||
fputs("upper=0\n", f);
|
||||
fputs("digits=1\n", f);
|
||||
fputs("symbols=0\n", f);
|
||||
fputs("exclude=01\n", f);
|
||||
fputs("theme_source=1\n", f);
|
||||
fputs("theme_mode=0\n", f);
|
||||
fputs("theme_id=10\n", f);
|
||||
fputs("theme_style=0\n", f);
|
||||
fclose(f);
|
||||
|
||||
f = fopen("profiles.tsv", "w");
|
||||
if(f == NULL) {
|
||||
perror("profiles.tsv");
|
||||
exit(1);
|
||||
}
|
||||
fputs("broken\n", f);
|
||||
fputs("Loaded\tloaded.example\talice\t99\t2\t1\t0\t1\t0\t0\n", f);
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
static void
|
||||
remove_storage_files(void)
|
||||
{
|
||||
remove(".kryon_pass_auto_copy.txt");
|
||||
remove(".kryon_pass_clear_after_seconds.txt");
|
||||
remove(".kryon_pass_show_fingerprint.txt");
|
||||
remove(".kryon_pass_length.txt");
|
||||
remove(".kryon_pass_counter.txt");
|
||||
remove(".kryon_pass_lower.txt");
|
||||
remove(".kryon_pass_upper.txt");
|
||||
remove(".kryon_pass_digits.txt");
|
||||
remove(".kryon_pass_symbols.txt");
|
||||
remove(".kryon_pass_exclude.txt");
|
||||
remove(".kryon_pass_theme_source.txt");
|
||||
remove(".kryon_pass_theme_mode.txt");
|
||||
remove(".kryon_pass_theme_id.txt");
|
||||
remove(".kryon_pass_theme_style.txt");
|
||||
}
|
||||
|
||||
static void
|
||||
check_loaded_settings(void)
|
||||
{
|
||||
int auto_copy = -1;
|
||||
int clear_seconds = -1;
|
||||
int show_fingerprint = -1;
|
||||
int length = -1;
|
||||
int counter = -1;
|
||||
int lower = -1;
|
||||
int upper = -1;
|
||||
int digits = -1;
|
||||
int symbols = -1;
|
||||
int theme_source = -1;
|
||||
int theme_mode = -1;
|
||||
int theme_id = -1;
|
||||
int theme_style = -1;
|
||||
char exclude[16];
|
||||
|
||||
memset(exclude, 0, sizeof(exclude));
|
||||
pass_load_settings(&auto_copy, &clear_seconds, &show_fingerprint,
|
||||
&length, &counter, &lower, &upper, &digits,
|
||||
&symbols, exclude, sizeof(exclude),
|
||||
&theme_source, &theme_mode, &theme_id, &theme_style);
|
||||
check_int("loaded auto_copy", auto_copy, 1);
|
||||
check_int("loaded clear_seconds", clear_seconds, 3);
|
||||
check_int("loaded show_fingerprint", show_fingerprint, 0);
|
||||
check_int("loaded length clamp", length, PASS_MAX_LENGTH);
|
||||
check_int("loaded counter", counter, 7);
|
||||
check_int("loaded lower", lower, 1);
|
||||
check_int("loaded upper", upper, 0);
|
||||
check_int("loaded digits", digits, 1);
|
||||
check_int("loaded symbols", symbols, 0);
|
||||
check_str("loaded exclude", exclude, "01");
|
||||
check_int("migrated theme_source", theme_source, THEME_SOURCE_APP);
|
||||
check_int("migrated theme_mode", theme_mode, THEME_MODE_SYSTEM);
|
||||
check_int("migrated theme_id", theme_id, THEME_SWEET);
|
||||
check_int("migrated theme_style", theme_style, THEME_STYLE_MATERIAL);
|
||||
|
||||
pass_load_settings(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL, NULL, 0, NULL, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
check_generation_and_clipboard(void)
|
||||
{
|
||||
check_str("initial status", pass_status(), "Ready");
|
||||
check_str("empty emoji", pass_master_emoji(""), "");
|
||||
check_int("nonempty emoji", (int)strlen(pass_master_emoji("master")) > 0, 1);
|
||||
|
||||
check_int("generate", pass_generate("lesspass.com", "[email protected]",
|
||||
"password", 16, 1, 1, 1, 1, 1, ""), 0);
|
||||
check_str("generated", pass_generated(), "\\g-A1-.OHEwrXjT#");
|
||||
check_str("auto clipboard", fake_clipboard, "\\g-A1-.OHEwrXjT#");
|
||||
check_str("copy status", pass_status(), "Copied for 3 seconds");
|
||||
|
||||
fake_time = 4.0;
|
||||
pass_runtime_tick();
|
||||
check_str("clipboard cleared", fake_clipboard, "");
|
||||
check_str("clipboard clear status", pass_status(), "Clipboard cleared");
|
||||
|
||||
check_int("save settings", pass_save_settings(0, -2, 1, 1, 0, 1, 1, 1, 1,
|
||||
NULL, 9, 8, 7, 6), 0);
|
||||
check_int("generate invalid", pass_generate("site", "login", "master",
|
||||
8, 1, 0, 0, 0, 0, ""), 1);
|
||||
check_str("invalid clears generated", pass_generated(), "");
|
||||
check_int("copy empty", pass_copy(), 1);
|
||||
|
||||
check_int("generate no autocopy", pass_generate("site", "login", "master",
|
||||
16, -4, 1, 1, 1, 1, ""), 0);
|
||||
check_str("manual generate status", pass_status(), "Password generated locally");
|
||||
check_int("copy no timeout", pass_copy(), 0);
|
||||
check_str("copy no timeout status", pass_status(), "Copied");
|
||||
}
|
||||
|
||||
static void
|
||||
check_profiles(void)
|
||||
{
|
||||
check_int("loaded profile count", pass_profile_count(), 1);
|
||||
check_str("loaded profile label", pass_profile_label(0),
|
||||
"Loaded loaded.example / alice");
|
||||
check_str("missing profile label", pass_profile_label(-1), "");
|
||||
check_int("generate loaded profile", pass_generate_profile(0, "secret"), 0);
|
||||
check_int("missing profile generate", pass_generate_profile(100, "secret"), 1);
|
||||
check_int("empty profile name", pass_save_profile("", "site", "login", 16, 1,
|
||||
1, 1, 1, 1, ""), 1);
|
||||
check_int("save profile", pass_save_profile("Work", "work.example", "me", 16, 1,
|
||||
1, 1, 1, 1, ""), 0);
|
||||
check_int("overwrite profile", pass_save_profile("Work", "work.example", "you", 18, 2,
|
||||
1, 0, 1, 0, "01"), 0);
|
||||
check_str("saved profile label", pass_profile_label(1),
|
||||
"Work work.example / you");
|
||||
check_int("delete missing profile", pass_delete_profile(99), 1);
|
||||
check_int("save second profile", pass_save_profile("Home", "home.example", "me", 16, 1,
|
||||
1, 1, 1, 1, ""), 0);
|
||||
check_int("delete first profile", pass_delete_profile(0), 0);
|
||||
check_str("shifted profile label", pass_profile_label(0),
|
||||
"Work work.example / you");
|
||||
check_int("delete profile", pass_delete_profile(0), 0);
|
||||
|
||||
for(int i = pass_profile_count(); i < 64; i++) {
|
||||
char name[32];
|
||||
|
||||
snprintf(name, sizeof(name), "Fill%d", i);
|
||||
if(pass_save_profile(name, "fill.example", "me", 16, 1,
|
||||
1, 1, 1, 1, "") != 0) {
|
||||
printf("FAIL runtime fill profile %d: %s\n", i, pass_status());
|
||||
failures++;
|
||||
return;
|
||||
}
|
||||
}
|
||||
check_int("profile limit", pass_save_profile("Overflow", "fill.example", "me", 16, 1,
|
||||
1, 1, 1, 1, ""), 1);
|
||||
}
|
||||
|
||||
static void
|
||||
check_secure_master(void)
|
||||
{
|
||||
char unlocked[1024];
|
||||
int count = 0;
|
||||
|
||||
check_int("emoji count", pass_runtime_master_emoji_codepoints(&count) != NULL, 1);
|
||||
check_int("emoji count value", count, 64);
|
||||
check_int("save empty master", pass_save_master("", 1), 1);
|
||||
check_str("save empty status", pass_status(), "Enter master password first");
|
||||
|
||||
fake_biometric_available = 0;
|
||||
fake_biometric_setup_required = 0;
|
||||
check_int("save unavailable master", pass_save_master("secret", 1), 1);
|
||||
check_str("save unavailable status", pass_status(), "Fingerprint unlock unavailable");
|
||||
|
||||
fake_biometric_setup_required = 1;
|
||||
check_int("save setup master", pass_save_master("secret", 1), 1);
|
||||
check_str("save setup status", pass_status(), "Set up Android fingerprint first");
|
||||
|
||||
fake_biometric_available = 1;
|
||||
fake_biometric_setup_required = 0;
|
||||
check_int("save master", pass_save_master("secret", 1), 0);
|
||||
check_str("saving status", pass_status(), "Saving master");
|
||||
check_str("saved master stub", fake_saved_master, "secret");
|
||||
check_int("saved master biometric flag", fake_saved_require_biometric, 1);
|
||||
snprintf(fake_secure_result, sizeof(fake_secure_result), "%s", "");
|
||||
fake_secure_status = 2;
|
||||
pass_runtime_tick();
|
||||
check_str("saved status result", pass_status(), "Master password saved");
|
||||
|
||||
check_int("can unlock", AndroidSecureStoreHasSecret("default") &&
|
||||
AndroidSecureStoreSecretUsesBiometric("default") &&
|
||||
AndroidSecureStoreBiometricAvailable(), 1);
|
||||
check_int("master saved", AndroidSecureStoreHasSecret("default"), 1);
|
||||
check_int("biometric available", AndroidSecureStoreBiometricAvailable(), 1);
|
||||
check_str("fingerprint saved", pass_fingerprint_status(),
|
||||
"Saved master uses fingerprint unlock");
|
||||
fake_master_biometric = 0;
|
||||
check_str("fingerprint saved no biometric", pass_fingerprint_status(),
|
||||
"Saved master unlocks without fingerprint");
|
||||
fake_master_biometric = 1;
|
||||
|
||||
check_int("unlock master", pass_unlock_master(), 0);
|
||||
check_str("unlock requested", pass_status(), "Unlock requested");
|
||||
snprintf(fake_secure_result, sizeof(fake_secure_result), "%s", "secret");
|
||||
fake_secure_status = 2;
|
||||
pass_runtime_tick();
|
||||
check_str("unlocked status", pass_status(), "Master unlocked");
|
||||
memset(unlocked, 0, sizeof(unlocked));
|
||||
check_int("take unlocked", pass_take_unlocked_master(unlocked), 1);
|
||||
check_str("unlocked value", unlocked, "secret");
|
||||
check_int("take unlocked empty", pass_take_unlocked_master(unlocked), 0);
|
||||
check_int("take unlocked null", pass_take_unlocked_master(NULL), 0);
|
||||
|
||||
check_int("clear master", pass_clear_master(), 0);
|
||||
check_int("unlock missing master", pass_unlock_master(), 1);
|
||||
fake_biometric_available = 0;
|
||||
fake_biometric_setup_required = 1;
|
||||
check_str("fingerprint setup required", pass_fingerprint_status(),
|
||||
"Android fingerprint setup required");
|
||||
fake_biometric_setup_required = 0;
|
||||
check_str("fingerprint unavailable", pass_fingerprint_status(),
|
||||
"Fingerprint unlock is not available");
|
||||
fake_biometric_available = 1;
|
||||
check_str("fingerprint none saved", pass_fingerprint_status(),
|
||||
"No saved master password");
|
||||
|
||||
check_int("save master no biometric", pass_save_master("plain", 0), 0);
|
||||
snprintf(fake_secure_result, sizeof(fake_secure_result), "%s", "denied");
|
||||
fake_secure_status = 3;
|
||||
pass_runtime_tick();
|
||||
check_str("secure failure", pass_status(), "denied");
|
||||
}
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
char original_cwd[1024];
|
||||
|
||||
if(getcwd(original_cwd, sizeof(original_cwd)) == NULL) {
|
||||
perror("getcwd");
|
||||
return 1;
|
||||
}
|
||||
mkdir("build", 0777);
|
||||
mkdir("build/coverage", 0777);
|
||||
mkdir("build/coverage/runtime-work", 0777);
|
||||
if(chdir("build/coverage/runtime-work") != 0) {
|
||||
perror("chdir");
|
||||
return 1;
|
||||
}
|
||||
unlink("settings.cfg");
|
||||
unlink("profiles.tsv");
|
||||
remove_storage_files();
|
||||
write_initial_files();
|
||||
|
||||
pass_runtime_init();
|
||||
check_loaded_settings();
|
||||
check_generation_and_clipboard();
|
||||
check_profiles();
|
||||
check_secure_master();
|
||||
pass_runtime_shutdown();
|
||||
check_str("shutdown generated", pass_generated(), "");
|
||||
unlink("settings.cfg");
|
||||
unlink("profiles.tsv");
|
||||
remove_storage_files();
|
||||
pass_runtime_init();
|
||||
check_int("default profile count", pass_profile_count(), 0);
|
||||
check_str("default status", pass_status(), "Ready");
|
||||
remove_storage_files();
|
||||
|
||||
if(chdir(original_cwd) != 0) {
|
||||
perror("restore cwd");
|
||||
return 1;
|
||||
}
|
||||
if(failures != 0) {
|
||||
printf("%d runtime failure(s)\n", failures);
|
||||
return 1;
|
||||
}
|
||||
printf("all runtime tests pass\n");
|
||||
return 0;
|
||||
}
|
||||
@@ -1,15 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<component type="desktop-application">
|
||||
<id>xyz.waozi.pass</id>
|
||||
<name>pass</name>
|
||||
<name>Pass</name>
|
||||
<summary>Generate deterministic passwords locally</summary>
|
||||
<metadata_license>CC0-1.0</metadata_license>
|
||||
<project_license>BSD-3-Clause</project_license>
|
||||
<description>
|
||||
<p>pass derives repeatable passwords from a site, login, master password, and generation settings without storing a password database.</p>
|
||||
<p>Pass derives repeatable passwords from a site, login, master password, and generation settings without storing a password database.</p>
|
||||
</description>
|
||||
<launchable type="desktop-id">xyz.waozi.pass.desktop</launchable>
|
||||
<url type="homepage">https://github.com/waozixyz/pass</url>
|
||||
<provides><binary>pass-gui</binary></provides>
|
||||
<releases><release version="0.2.8" date="2026-08-26"/><release version="0.2.7" date="2026-08-24"/><release version="0.2.6" date="2026-08-24"/><release version="0.2.5" date="2026-08-24"/><release version="0.2.4" date="2026-08-22"/><release version="0.2.3" date="2026-08-21"/><release version="0.2.2" date="2026-08-20"/><release version="0.2.1" date="2026-08-19"/><release version="0.2.0" date="2026-08-18"/><release version="0.1.3" date="2026-08-17"/><release version="0.1.2" date="2026-08-17"/><release version="0.1.1" date="2026-08-17"/><release version="0.1.0" date="2026-08-17"/></releases>
|
||||
<releases><release version="0.2.9" date="2026-09-05"/><release version="0.2.8" date="2026-08-26"/><release version="0.2.7" date="2026-08-24"/><release version="0.2.6" date="2026-08-24"/><release version="0.2.5" date="2026-08-24"/><release version="0.2.4" date="2026-08-22"/><release version="0.2.3" date="2026-08-21"/><release version="0.2.2" date="2026-08-20"/><release version="0.2.1" date="2026-08-19"/><release version="0.2.0" date="2026-08-18"/><release version="0.1.3" date="2026-08-17"/><release version="0.1.2" date="2026-08-17"/><release version="0.1.1" date="2026-08-17"/><release version="0.1.0" date="2026-08-17"/></releases>
|
||||
</component>
|
||||
@@ -1,6 +1,6 @@
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=pass
|
||||
Name=Pass
|
||||
Comment=Generate deterministic passwords locally
|
||||
Exec=pass-gui
|
||||
Icon=pass
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
cli=${1:-./pass}
|
||||
tmp=${TMPDIR:-/tmp}/pass-cli-test.$$
|
||||
|
||||
cleanup()
|
||||
{
|
||||
rm -rf "$tmp"
|
||||
}
|
||||
trap cleanup EXIT INT TERM
|
||||
|
||||
mkdir -p "$tmp"
|
||||
|
||||
fail()
|
||||
{
|
||||
echo "FAIL cli: $*" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
expect_out()
|
||||
{
|
||||
name=$1
|
||||
want=$2
|
||||
shift 2
|
||||
got=$("$@")
|
||||
test "$got" = "$want" || fail "$name: got '$got', want '$want'"
|
||||
echo "ok cli: $name"
|
||||
}
|
||||
|
||||
expect_fail()
|
||||
{
|
||||
name=$1
|
||||
status=$2
|
||||
needle=$3
|
||||
shift 3
|
||||
set +e
|
||||
"$@" >"$tmp/out" 2>"$tmp/err"
|
||||
got_status=$?
|
||||
set -e
|
||||
test "$got_status" -eq "$status" || fail "$name: status $got_status, want $status"
|
||||
grep -F -- "$needle" "$tmp/err" >/dev/null || fail "$name: missing '$needle'"
|
||||
echo "ok cli: $name"
|
||||
}
|
||||
|
||||
"$cli" --version >"$tmp/version"
|
||||
grep -F -- "pass " "$tmp/version" >/dev/null || fail "version text missing prefix"
|
||||
echo "ok cli: version"
|
||||
expect_out "argument master" "\\g-A1-.OHEwrXjT#" "$cli" lesspass.com [email protected] password
|
||||
expect_out "explicit classes" "\\g-A1-.OHEwrXjT#" "$cli" -l -u -d -s lesspass.com [email protected] password
|
||||
expect_out "environment master" "\\g-A1-.OHEwrXjT#" env LESSPASS_MASTER_PASSWORD=password "$cli" lesspass.com [email protected]
|
||||
expect_out "stdin master" "\\g-A1-.OHEwrXjT#" sh -c "printf 'password\r\n' | \"\$1\" --prompt lesspass.com [email protected]" sh "$cli"
|
||||
expect_out "copy disabled" "\\g-A1-.OHEwrXjT#" "$cli" --copy --no-copy lesspass.com [email protected] password
|
||||
|
||||
counter_zero=$("$cli" --counter 0 site login master)
|
||||
counter_negative=$("$cli" --counter -3 site login master)
|
||||
test "$counter_negative" = "$counter_zero" || fail "negative counter did not clamp to zero"
|
||||
echo "ok cli: negative counter clamp"
|
||||
|
||||
"$cli" --help >"$tmp/help"
|
||||
grep -F -- "Usage: pass" "$tmp/help" >/dev/null || fail "help text missing usage"
|
||||
echo "ok cli: help"
|
||||
|
||||
expect_fail "unknown option" 2 "unknown option" "$cli" --bogus
|
||||
expect_fail "missing option value" 2 "requires a value" "$cli" --length
|
||||
expect_fail "missing exclude value" 2 "requires a value" "$cli" --exclude
|
||||
expect_fail "invalid option value" 2 "Usage: pass" "$cli" --length nope site login master
|
||||
expect_fail "missing positional args" 2 "Usage: pass" "$cli" site
|
||||
expect_fail "too many positional args" 2 "too many positional arguments" "$cli" a b c d
|
||||
expect_fail "copy unavailable" 2 "--copy is not available" "$cli" --copy site login master
|
||||
expect_fail "missing stdin master" 2 "missing master password" sh -c "\"\$1\" site login </dev/null" sh "$cli"
|
||||
expect_fail "core validation" 1 "at least one character class" "$cli" --no-lowercase --no-uppercase --no-digits --no-symbols site login master
|
||||
|
||||
echo "all cli tests pass"
|
||||
@@ -15,7 +15,6 @@ if [ -z "$version" ]; then
|
||||
fi
|
||||
sed "s/\${version}/$version/g" "$root_dir/web/site/index.html" > "$out_dir/index.html"
|
||||
cp "$root_dir/web/site/styles.css" "$out_dir/styles.css"
|
||||
cp "$root_dir/web/site/home.js" "$out_dir/home.js"
|
||||
cp "$root_dir/web/site/app/index.html" "$out_dir/app/index.html"
|
||||
cp "$root_dir/web/site/app/app.js" "$out_dir/app/app.js"
|
||||
cp "$root_dir/web/site/CNAME" "$out_dir/CNAME"
|
||||
@@ -33,5 +32,4 @@ cp "$root_dir/build/web-app/index.js" "$out_dir/app/index.js"
|
||||
cp "$root_dir/build/web-app/index.wasm" "$out_dir/app/index.wasm"
|
||||
|
||||
test -s "$out_dir/app/index.wasm"
|
||||
test -s "$out_dir/home.js"
|
||||
printf 'built site at %s\n' "$out_dir"
|
||||
@@ -1,8 +1,13 @@
|
||||
var currentScript = document.currentScript;
|
||||
var appBase = currentScript && currentScript.dataset && currentScript.dataset.appBase
|
||||
? currentScript.dataset.appBase
|
||||
: '';
|
||||
if (appBase && appBase.charAt(appBase.length - 1) !== '/') appBase += '/';
|
||||
var statusElement = document.getElementById('status');
|
||||
var loadingScreen = document.getElementById('loading-screen');
|
||||
|
||||
if ('serviceWorker' in navigator) {
|
||||
navigator.serviceWorker.register('sw.js').catch(function() {});
|
||||
navigator.serviceWorker.register(appBase + 'sw.js').catch(function() {});
|
||||
}
|
||||
|
||||
function setStatus(text) {
|
||||
@@ -82,7 +87,7 @@ window.addEventListener('error', function(event) {
|
||||
|
||||
var script = document.createElement('script');
|
||||
script.async = true;
|
||||
script.src = 'index.js';
|
||||
script.src = appBase + 'index.js';
|
||||
script.onload = function() { setStatus('Starting app...'); hideWhenCanvasPaints(); };
|
||||
script.onerror = function() { setStatus('App failed to load'); };
|
||||
document.body.appendChild(script);
|
||||
@@ -5,7 +5,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
|
||||
<title>Pass</title>
|
||||
<meta name="theme-color" content="#f3f1ea">
|
||||
<meta name="theme-color" content="#f7ede2">
|
||||
<link rel="manifest" href="/manifest.webmanifest">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="/icons/favicon-32.png">
|
||||
<link rel="apple-touch-icon" href="/icons/apple-touch-icon.png">
|
||||
@@ -15,8 +15,8 @@
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
overflow: hidden;
|
||||
background: #f3f1ea;
|
||||
color: #2a3b40;
|
||||
background: #f7ede2;
|
||||
color: #4a4038;
|
||||
font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
|
||||
}
|
||||
.canvas-stage, .canvas-frame {
|
||||
@@ -26,7 +26,7 @@
|
||||
height: 100vh;
|
||||
height: 100dvh;
|
||||
overflow: hidden;
|
||||
background: #f3f1ea;
|
||||
background: #f7ede2;
|
||||
}
|
||||
canvas.emscripten {
|
||||
position: absolute;
|
||||
@@ -35,7 +35,7 @@
|
||||
height: 100% !important;
|
||||
border: 0;
|
||||
outline: 0;
|
||||
background: #f3f1ea;
|
||||
background: #f7ede2;
|
||||
}
|
||||
.loading-screen {
|
||||
position: fixed;
|
||||
@@ -45,7 +45,7 @@
|
||||
place-items: center;
|
||||
padding: 24px;
|
||||
box-sizing: border-box;
|
||||
background: #f3f1ea;
|
||||
background: #f7ede2;
|
||||
transition: opacity 180ms ease, visibility 180ms ease;
|
||||
}
|
||||
.loading-screen.is-hidden {
|
||||
@@ -67,7 +67,7 @@
|
||||
}
|
||||
#status {
|
||||
min-height: 20px;
|
||||
color: #5d6f74;
|
||||
color: #9b8b7c;
|
||||
font-size: 13px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
(() => {
|
||||
const byId = id => document.getElementById(id);
|
||||
const card = byId('generator');
|
||||
const generate = byId('generate'), copy = byId('copy'), result = byId('result'), message = byId('message');
|
||||
let copied = '', clearTimer = 0;
|
||||
|
||||
generate.disabled = false;
|
||||
message.textContent = 'Open the full Kry app for generation.';
|
||||
|
||||
byId('reveal').addEventListener('click', () => { const master = byId('master'); master.type = master.type === 'password' ? 'text' : 'password'; byId('reveal').textContent = master.type === 'password' ? 'Reveal' : 'Hide'; });
|
||||
generate.addEventListener('click', () => { window.location.href = '/app/'; });
|
||||
copy.addEventListener('click', async () => { await navigator.clipboard.writeText(result.textContent); copied = result.textContent; message.textContent = 'Copied; clipboard clears in 20 seconds'; clearTimeout(clearTimer); clearTimer = setTimeout(async () => { try { const current = await navigator.clipboard.readText(); if (current === copied) await navigator.clipboard.writeText(''); } catch (_) {} copied = ''; }, 20000); });
|
||||
byId('clear').addEventListener('click', () => { ['site','login','master','exclude'].forEach(id => byId(id).value = ''); result.textContent = 'Your generated password appears here'; message.textContent = 'Cleared'; copy.disabled = true; byId('site').focus(); });
|
||||
})();
|
||||
|
After Width: | Height: | Size: 153 B |
|
After Width: | Height: | Size: 216 B |
|
After Width: | Height: | Size: 344 B |
|
After Width: | Height: | Size: 182 B |
@@ -6,35 +6,119 @@
|
||||
<title>Pass — deterministic passwords</title>
|
||||
<meta name="description" content="Generate deterministic passwords locally with the BSD-licensed Pass CLI, desktop app, or browser app.">
|
||||
<link rel="canonical" href="https://pass.waozi.xyz/">
|
||||
<meta name="theme-color" content="#f3f1ea">
|
||||
<meta name="theme-color" content="#f7ede2">
|
||||
<link rel="manifest" href="/manifest.webmanifest">
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="/icons/favicon-32.png">
|
||||
<link rel="apple-touch-icon" href="/icons/apple-touch-icon.png">
|
||||
<link rel="stylesheet" href="/styles.css">
|
||||
</head>
|
||||
<body>
|
||||
<header class="site-header"><div class="site-header-inner"><a class="brand" href="/"><img src="/icons/icon-192.png" alt="">Pass</a><nav class="header-nav"><a href="#downloads">Downloads</a><a href="#privacy">Privacy</a><a href="https://waozi.xyz">Waozi ↗</a><a class="button small" href="/app/">Run Web</a></nav></div></header>
|
||||
<main>
|
||||
<section class="hero">
|
||||
<div><p class="eyebrow">Stateless · local · open source</p><img class="hero-icon" src="/icons/icon-192.png" alt="Pass"><h1>One master password.<br><span>Every site covered.</span></h1><p class="lede">Pass derives strong, repeatable passwords on your device. Nothing is stored, uploaded, or tracked.</p><div class="actions"><a class="button primary" href="/app/">Run Web</a><a class="button" href="#downloads">Download apps</a></div></div>
|
||||
<div class="preview" id="generator"><div class="preview-head"><i></i><i></i><i></i><span>generated locally</span></div><div class="preview-body"><div class="form-grid">
|
||||
<label>Site<input id="site" autocomplete="off" placeholder="example.org"></label><label>Login<input id="login" autocomplete="username" placeholder="[email protected]"></label>
|
||||
<label class="wide">Master password<span class="password-wrap"><input id="master" type="password" autocomplete="current-password"><button id="reveal" type="button" class="inline">Reveal</button></span></label>
|
||||
<label>Length<input id="length" type="number" min="5" max="35" value="16"></label><label>Counter<input id="counter" type="number" min="1" value="1"></label><label class="wide">Excluded characters<input id="exclude" autocomplete="off"></label>
|
||||
<fieldset class="wide"><legend>Character classes</legend><label><input id="lower" type="checkbox" checked> Lowercase</label><label><input id="upper" type="checkbox" checked> Uppercase</label><label><input id="digits" type="checkbox" checked> Digits</label><label><input id="symbols" type="checkbox" checked> Symbols</label></fieldset>
|
||||
<div class="wide actions"><button id="generate" class="button" disabled>Generate</button><button id="copy" class="button secondary" disabled>Copy</button><button id="clear" class="button ghost">Clear</button></div>
|
||||
<output id="result" class="wide" aria-live="polite">Your generated password appears here</output><p id="message" class="wide status"></p>
|
||||
</div><div class="privacy-line">No network requests. No password database.</div></div></div>
|
||||
<header class="site-header">
|
||||
<div class="site-header-inner">
|
||||
<a class="site-return" href="https://waozi.xyz" aria-label="Return to waozi.xyz">← waozi</a>
|
||||
<a class="brand" href="/">
|
||||
<img src="/icons/icon-192.png" alt="">
|
||||
<span>PASS</span>
|
||||
</a>
|
||||
<nav class="header-nav" aria-label="Primary">
|
||||
<a href="#downloads">Download</a>
|
||||
<a href="#features">Features</a>
|
||||
<a href="#privacy">Privacy</a>
|
||||
</nav>
|
||||
</div>
|
||||
</header>
|
||||
<main id="main-content">
|
||||
<section class="hero" aria-label="Pass introduction">
|
||||
<div class="hero-copy">
|
||||
<span class="eyebrow"><span class="dot"></span>Stateless · local · open source</span>
|
||||
<img class="hero-icon" src="/icons/icon-192.png" alt="Pass">
|
||||
<h1>Pass</h1>
|
||||
<p class="lede">Deterministic passwords generated locally from one master password, with no vault, account, tracking, or backend service.</p>
|
||||
<p class="version">${version}</p>
|
||||
<div class="actions">
|
||||
<a class="button primary" href="#downloads">Download</a>
|
||||
<a class="button" href="/app/">Open web app</a>
|
||||
<a class="button" href="https://waozi.itch.io/pass" target="_blank" rel="noopener">itch.io</a>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section class="downloads-section" id="downloads" aria-labelledby="downloads-title">
|
||||
<div class="section-heading">
|
||||
<p class="section-eyebrow"><span class="dot"></span>Download</p>
|
||||
<h2 id="downloads-title">Choose your Pass build.</h2>
|
||||
<p>Version ${version}. Every package is covered by the release <a href="https://github.com/waozixyz/pass/releases/latest/download/SHA256SUMS">SHA256SUMS</a> checksums.</p>
|
||||
</div>
|
||||
<div class="downloads-board">
|
||||
<article class="download-platform">
|
||||
<div class="download-platform-icon"><img src="/icons/droid.png" alt=""></div>
|
||||
<div class="download-platform-body">
|
||||
<h3>Android</h3>
|
||||
<p>Native app with biometric-protected master password storage. Android 5.0 and newer; no Internet permission.</p>
|
||||
<nav class="download-pills" aria-label="Android downloads">
|
||||
<a class="is-primary" href="/downloads/pass-android.apk">Direct APK</a>
|
||||
<a href="https://f-droid.org/packages/xyz.waozi.pass/">F-Droid</a>
|
||||
</nav>
|
||||
</div>
|
||||
</article>
|
||||
<article class="download-platform">
|
||||
<div class="download-platform-icon"><img src="/icons/display.png" alt=""></div>
|
||||
<div class="download-platform-body">
|
||||
<h3>Desktop GUI</h3>
|
||||
<p>Visual controls, secure masked input, built-in self-updates, and clipboard clearing.</p>
|
||||
<nav class="download-pills" aria-label="Desktop downloads">
|
||||
<a class="is-primary" href="https://github.com/waozixyz/pass/releases/latest/download/pass-${version}-x86_64.AppImage">AppImage x86_64</a>
|
||||
<a href="https://github.com/waozixyz/pass/releases/latest/download/pass-${version}-aarch64.AppImage">AppImage ARM64</a>
|
||||
<a href="https://github.com/waozixyz/pass/releases/latest/download/pass_${version}_amd64.deb">.deb amd64</a>
|
||||
<a href="https://github.com/waozixyz/pass/releases/latest/download/pass_${version}_arm64.deb">.deb arm64</a>
|
||||
<a href="/downloads/pass-gui-linux-amd64.tar.gz">Tarball x86_64</a>
|
||||
<a href="/downloads/pass-gui-linux-arm64.tar.gz">Tarball ARM64</a>
|
||||
</nav>
|
||||
</div>
|
||||
</article>
|
||||
<article class="download-platform">
|
||||
<div class="download-platform-icon"><img src="/icons/cli.png" alt=""></div>
|
||||
<div class="download-platform-body">
|
||||
<h3>CLI</h3>
|
||||
<p>Small scriptable binaries for terminals, servers, and workstations.</p>
|
||||
<nav class="download-pills" aria-label="CLI downloads">
|
||||
<a class="is-primary" href="/downloads/pass-cli-linux-amd64.tar.gz">Linux x86_64</a>
|
||||
<a href="/downloads/pass-cli-linux-arm64.tar.gz">Linux ARM64</a>
|
||||
<a href="/downloads/pass-cli-darwin-amd64.tar.gz">macOS Intel</a>
|
||||
<a href="/downloads/pass-cli-darwin-arm64.tar.gz">macOS ARM</a>
|
||||
<a href="/downloads/pass-cli-windows-amd64.zip">Windows x86_64</a>
|
||||
<a href="/downloads/pass-cli-freebsd-amd64.tar.gz">FreeBSD</a>
|
||||
</nav>
|
||||
</div>
|
||||
</article>
|
||||
<article class="download-platform">
|
||||
<div class="download-platform-icon"><img src="/icons/wasm.png" alt=""></div>
|
||||
<div class="download-platform-body">
|
||||
<h3>Web app</h3>
|
||||
<p>The Pass app compiled to WebAssembly with Kryon's canvas backend. Runs entirely in your tab.</p>
|
||||
<nav class="download-pills" aria-label="Web app links">
|
||||
<a class="is-primary" href="/app/">Open web app</a>
|
||||
<a href="https://waozi.itch.io/pass" target="_blank" rel="noopener">itch.io</a>
|
||||
</nav>
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
</section>
|
||||
<section class="features-section" id="features">
|
||||
<p class="section-eyebrow"><span class="dot"></span>Features</p>
|
||||
<h2>Small by design.</h2>
|
||||
<div class="features-grid">
|
||||
<div class="feature-item"><h3>Deterministic</h3><p>Generate the same password from the same site, login, master password, and settings.</p></div>
|
||||
<div class="feature-item"><h3>Local-first</h3><p>No password database, no sync account, no analytics, and no network service required for generation.</p></div>
|
||||
<div class="feature-item"><h3>Portable</h3><p>Use the same generator across Android, desktop, terminal, and web builds.</p></div>
|
||||
<div class="feature-item"><h3>Open source</h3><p>Source and releases remain available under BSD-3-Clause.</p></div>
|
||||
</div>
|
||||
</section>
|
||||
<section class="privacy-section" id="privacy">
|
||||
<p class="section-eyebrow"><span class="dot"></span>Privacy</p>
|
||||
<h2>Your master password stays yours.</h2>
|
||||
<p>The desktop and browser apps derive passwords locally. The website has no analytics, accounts, cookies, or backend API.</p>
|
||||
</section>
|
||||
<section id="downloads"><p class="eyebrow">DOWNLOADS</p><h2>Choose your interface</h2><div class="cards">
|
||||
<article><span class="tag">ANDROID</span><h3>Android</h3><p>Native app with the same generator and biometric-protected master password storage. Android 5.0 and newer; no Internet permission.</p><div class="links"><a class="channel" href="/downloads/pass-android.apk"><img src="/icons/droid.png" alt="" width="16" height="16">Direct APK</a><a class="channel" href="https://f-droid.org/packages/xyz.waozi.pass/"><img src="/icons/fdroid.png" alt="" width="16" height="16">F-Droid</a></div></article>
|
||||
<article><span class="tag">DESKTOP</span><h3>Desktop GUI</h3><p>Visual controls, secure masked input, built-in self-updates, and clipboard clearing.</p><div class="links"><a href="https://github.com/waozixyz/pass/releases/latest/download/pass-${version}-x86_64.AppImage">AppImage x86_64</a><a href="https://github.com/waozixyz/pass/releases/latest/download/pass-${version}-aarch64.AppImage">AppImage ARM64</a><a href="https://github.com/waozixyz/pass/releases/latest/download/pass_${version}_amd64.deb">.deb amd64</a><a href="https://github.com/waozixyz/pass/releases/latest/download/pass_${version}_arm64.deb">.deb arm64</a><a href="/downloads/pass-gui-linux-amd64.tar.gz">Tarball x86_64</a><a href="/downloads/pass-gui-linux-arm64.tar.gz">Tarball ARM64</a></div></article>
|
||||
<article><span class="tag">TERMINAL</span><h3>CLI</h3><p>Small, scriptable binaries for servers and workstations.</p><div class="links"><a href="/downloads/pass-cli-linux-amd64.tar.gz">Linux x86_64</a><a href="/downloads/pass-cli-linux-arm64.tar.gz">Linux ARM64</a><a href="/downloads/pass-cli-darwin-amd64.tar.gz">macOS Intel</a><a href="/downloads/pass-cli-darwin-arm64.tar.gz">macOS ARM</a><a href="/downloads/pass-cli-windows-amd64.zip">Windows x86_64</a><a href="/downloads/pass-cli-freebsd-amd64.tar.gz">FreeBSD</a></div></article>
|
||||
<article><span class="tag">BROWSER</span><h3>Web app</h3><p>The real Pass app compiled to WebAssembly with Kryon's canvas backend. Runs entirely in your tab.</p><div class="links"><a href="/app/">Open web app</a></div></article>
|
||||
</div><p class="downloads-note">Every download is covered by the release <a href="https://github.com/waozixyz/pass/releases/latest/download/SHA256SUMS">SHA256SUMS</a> checksums.</p></section>
|
||||
<section class="privacy" id="privacy"><p class="eyebrow">PRIVACY</p><h2>Your master password stays yours.</h2><p>The desktop and browser apps derive passwords locally. The website has no analytics, accounts, cookies, or backend API. Source and releases remain available under BSD-3-Clause.</p></section>
|
||||
</main>
|
||||
<footer><span>© 2026 <a href="https://waozi.xyz">Waozi</a></span></footer>
|
||||
<script src="home.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,6 +1,129 @@
|
||||
:root{--bg:#f3f1ea;--surface:#fdfcf8;--control:#eae6da;--control-hi:#fff;--ink:#2a3b40;--muted:#5d6f74;--line:rgba(42,59,64,.20);--line-strong:rgba(42,59,64,.30);--accent:#65558f;--accent-deep:#433668;--accent-soft:rgba(101,85,143,.10);--card:#f7f4ec;--radius:10px;--radius-sm:6px;--maxw:1080px;--font:ui-monospace,"SFMono-Regular",Menlo,Consolas,monospace;--bevel:0 1px 0 var(--control-hi),inset 1px 1px 0 var(--control-hi),0 2px 10px rgba(0,0,0,.04)}
|
||||
*{box-sizing:border-box}html{scroll-behavior:smooth;scroll-padding-top:72px}body{margin:0;min-height:100vh;background:var(--bg);color:var(--ink);font:15px/1.6 var(--font);-webkit-font-smoothing:antialiased}body:before{content:"";position:fixed;inset:0;z-index:-1;background-image:linear-gradient(45deg,rgba(42,59,64,.028) 25%,transparent 25%),linear-gradient(-45deg,rgba(42,59,64,.028) 25%,transparent 25%),linear-gradient(45deg,transparent 75%,rgba(42,59,64,.028) 75%),linear-gradient(-45deg,transparent 75%,rgba(42,59,64,.028) 75%);background-position:0 0,0 16px,16px -16px,-16px 0;background-size:32px 32px;opacity:.18}a{color:var(--accent);font-weight:700;text-decoration:none}a:hover{color:var(--accent-deep)}a:active,.button:active{position:relative;top:1px;left:1px}.site-header{position:sticky;top:0;z-index:50;background:rgba(243,241,234,.92);backdrop-filter:blur(8px);border-bottom:1px solid var(--line)}.site-header-inner{max-width:var(--maxw);margin:auto;padding:10px 20px;display:flex;align-items:center;gap:16px}.brand{display:flex;align-items:center;gap:8px;color:var(--ink);font-size:15px;letter-spacing:.04em}.brand img{width:22px;height:22px;border-radius:5px;image-rendering:pixelated}.header-nav{display:flex;align-items:center;gap:18px;margin-left:auto}.header-nav>a,.header-nav span{color:var(--muted);font-size:13px}.header-nav .button{color:#fffdf8}.button,button.button{display:inline-flex;align-items:center;justify-content:center;gap:6px;padding:8px 14px;border:1px solid var(--line);border-radius:var(--radius-sm);background:var(--control);box-shadow:var(--bevel);color:var(--ink);font:700 13px var(--font);cursor:pointer}.button:hover{background:var(--surface);color:var(--accent)}.button.primary,.header-nav .button{background:var(--accent);border-color:var(--accent-deep);color:#fff}.button.secondary{background:var(--control)}.button.ghost{background:transparent}.button.small{padding:7px 12px}button:disabled{opacity:.45;cursor:not-allowed}
|
||||
.hero{max-width:var(--maxw);min-height:calc(100vh - 64px);margin:auto;padding:48px 20px 40px;display:grid;grid-template-columns:minmax(0,.9fr) minmax(360px,.8fr);gap:44px;align-items:center}.hero-icon{width:96px;height:96px;margin:4px 0 0;border:1px solid var(--line-strong);border-radius:8px;box-shadow:var(--bevel);image-rendering:pixelated}.eyebrow{display:flex;align-items:center;gap:8px;margin:0 0 12px;color:var(--accent);font-size:13px;font-weight:700;letter-spacing:.04em;text-transform:uppercase}.eyebrow:before{content:"";width:8px;height:8px;background:var(--accent);border:1px solid var(--accent-deep);border-radius:2px;box-shadow:1px 1px 0 rgba(0,0,0,.12)}h1,h2,h3{margin:0;color:var(--ink);line-height:1.15}h1{margin:14px 0 16px;font-size:clamp(42px,7vw,74px);line-height:.98}h1 span{color:var(--accent)}h2{margin-bottom:16px;font-size:clamp(26px,4vw,40px)}h3{font-size:16px}.lede{max-width:700px;color:var(--muted);font-size:17px}.actions{display:flex;flex-wrap:wrap;gap:12px;margin-top:24px}.preview,.generator-card{overflow:hidden;background:var(--surface);border:1px solid var(--line-strong);border-radius:var(--radius);box-shadow:0 1px 0 var(--control-hi),inset 1px 1px 0 var(--control-hi),0 18px 46px rgba(0,0,0,.10)}.preview-head{display:flex;align-items:center;gap:8px;padding:10px 12px;background:var(--control);border-bottom:1px solid var(--line)}.preview-head i{width:10px;height:10px;background:var(--accent);border:1px solid var(--accent-deep);border-radius:3px}.preview-head span{margin-left:6px;color:var(--muted);font-size:12px}.preview-body{padding:16px}.generator-card>label{display:block;margin:12px 0 6px;color:var(--muted);font-size:13px}output{padding:12px;background:var(--card);border:1px solid var(--line);border-radius:var(--radius-sm);box-shadow:var(--bevel)}.privacy-line{margin-top:16px;color:var(--muted);font-size:12px}
|
||||
main>section:not(.hero){max-width:var(--maxw);margin:0 auto;padding:56px 20px}.cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(230px,1fr));gap:14px}.cards article,.privacy{padding:16px;background:var(--card);border:1px solid var(--line);border-radius:var(--radius-sm);box-shadow:var(--bevel)}.cards h3{margin:8px 0}.cards p,.privacy p{color:var(--muted);font-size:14px}.tag{color:var(--accent);font-size:12px;font-weight:700}.links{display:flex;flex-wrap:wrap;gap:12px;margin-top:18px}.channel{display:inline-flex;align-items:center;gap:7px}.channel img{width:16px;height:16px;image-rendering:pixelated}.downloads-note{margin:18px 2px 0;color:var(--muted);font-size:13px}footer{max-width:var(--maxw);margin:auto;padding:16px 20px 28px;text-align:center;color:var(--muted);font-size:13px}.generator-shell{max-width:820px;margin:48px auto;padding:0 20px}.generator-card{padding:24px}.generator-card h1{font-size:clamp(34px,6vw,52px)}.form-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:18px}.form-grid label,fieldset legend{color:var(--muted);font-size:13px}.form-grid input:not([type=checkbox]){display:block;width:100%;margin-top:7px;padding:11px 12px;background:var(--card);border:1px solid var(--line);border-radius:var(--radius-sm);color:var(--ink);font:inherit;outline:none}.form-grid input:focus{border-color:var(--accent)}.wide{grid-column:1/-1}.password-wrap{display:flex;gap:8px}.password-wrap input{flex:1}.inline{margin-top:7px;border:1px solid var(--line);background:var(--control);border-radius:var(--radius-sm);color:var(--ink);font:inherit;padding:0 12px}fieldset{display:flex;gap:20px;border:0;padding:0}fieldset legend{margin-bottom:10px}fieldset label{color:var(--ink)!important}output{display:block;min-height:68px;font-size:17px;overflow-wrap:anywhere}.status{min-height:20px;margin:0;color:var(--muted)}#runtime-status{font-size:12px}
|
||||
.preview .form-grid{grid-template-columns:1fr 1fr;gap:14px}.preview fieldset{display:grid;grid-template-columns:1fr 1fr;gap:8px 16px}.preview fieldset legend{grid-column:1/-1;margin-bottom:2px}.preview .actions{margin-top:0;gap:10px}.preview .actions .button{flex:1}.preview output{min-height:52px;font-size:15px}
|
||||
@media(max-width:760px){.header-nav>a:not(.button){display:none}.hero{grid-template-columns:1fr;min-height:0;gap:36px}.cards{grid-template-columns:1fr}.form-grid{grid-template-columns:1fr 1fr}}@media(max-width:520px){.site-header-inner{padding:10px 14px}.hero,.generator-shell{padding-left:14px;padding-right:14px}.form-grid,.preview .form-grid{grid-template-columns:1fr}.wide{grid-column:1}fieldset{display:grid;grid-template-columns:1fr 1fr}.actions .button{flex:1}.generator-card{padding:18px}}
|
||||
@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@300;400;500&family=Manrope:wght@400;500;600;700&display=swap');
|
||||
|
||||
:root {
|
||||
--night: #06171b;
|
||||
--night-soft: #0b2529;
|
||||
--panel: #103136;
|
||||
--panel-hi: #173e42;
|
||||
--teal: #75d8cf;
|
||||
--teal-deep: #258f88;
|
||||
--cream: #fff4d0;
|
||||
--amber: #f3b83f;
|
||||
--coral: #ff7770;
|
||||
--text: #f4f4e8;
|
||||
--muted: #9db7b5;
|
||||
--line: rgba(117,216,207,.19);
|
||||
--maxw: 1160px;
|
||||
--sans: Manrope, ui-sans-serif, system-ui, sans-serif;
|
||||
--mono: "DM Mono", ui-monospace, monospace;
|
||||
}
|
||||
|
||||
* { box-sizing: border-box; }
|
||||
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
|
||||
body { min-height: 100vh; margin: 0; color: var(--text); background: radial-gradient(circle at 88% 10%, rgba(117,216,207,.12), transparent 27rem), radial-gradient(circle at 8% 76%, rgba(243,184,63,.075), transparent 26rem), var(--night); font: 400 15px/1.68 var(--sans); -webkit-font-smoothing: antialiased; }
|
||||
body::before { content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .32; background-image: linear-gradient(rgba(117,216,207,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(117,216,207,.04) 1px, transparent 1px); background-size: 42px 42px; mask-image: linear-gradient(to bottom, #000, transparent 82%); }
|
||||
main, .site-header, footer { position: relative; z-index: 1; }
|
||||
a { color: var(--teal); text-decoration: none; }
|
||||
a:hover { color: var(--cream); }
|
||||
img { display: block; max-width: 100%; height: auto; }
|
||||
h1, h2, h3, p { margin: 0; }
|
||||
h1, h2, h3 { color: var(--cream); }
|
||||
h1, h2 { letter-spacing: -.055em; line-height: .96; }
|
||||
|
||||
.site-header { position: sticky; top: 0; z-index: 50; border-bottom: 1px solid var(--line); background: rgba(6,23,27,.82); backdrop-filter: blur(18px) saturate(125%); }
|
||||
.site-header::after { content: ""; position: absolute; inset: auto 0 -1px; height: 1px; background: linear-gradient(90deg, transparent, var(--teal), var(--amber), transparent); opacity: .55; }
|
||||
.site-header-inner { max-width: var(--maxw); min-height: 72px; margin: 0 auto; padding: 0 22px; display: flex; align-items: center; gap: 22px; }
|
||||
.site-return { color: var(--muted); font: 500 10px var(--mono); }
|
||||
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--cream); font: 500 11px var(--mono); letter-spacing: .14em; }
|
||||
.brand img { width: 31px; height: 31px; border-radius: 7px; box-shadow: 0 0 0 1px rgba(117,216,207,.22), 0 8px 22px rgba(0,0,0,.24); image-rendering: pixelated; }
|
||||
.header-nav { display: flex; align-items: center; gap: 26px; margin-left: auto; }
|
||||
.header-nav a { color: var(--muted); font: 500 10px var(--mono); }
|
||||
.header-nav a:hover { color: var(--teal); }
|
||||
|
||||
section, footer { width: min(var(--maxw), calc(100% - 44px)); margin: 0 auto; }
|
||||
.hero { position: relative; min-height: 700px; display: grid; place-items: center; overflow: hidden; padding: 100px 22px; text-align: center; }
|
||||
.hero::before, .hero::after { content: ""; position: absolute; left: 50%; top: 50%; border: 1px solid rgba(117,216,207,.12); border-radius: 26px; transform: translate(-50%,-50%) rotate(45deg); pointer-events: none; }
|
||||
.hero::before { width: 470px; height: 470px; }
|
||||
.hero::after { width: 600px; height: 600px; border-color: rgba(243,184,63,.08); }
|
||||
.hero-copy { position: relative; z-index: 1; max-width: 780px; }
|
||||
.eyebrow, .section-eyebrow { display: inline-flex; align-items: center; gap: 9px; margin-bottom: 22px; color: var(--teal); font: 500 10px var(--mono); letter-spacing: .11em; text-transform: uppercase; }
|
||||
.dot { width: 7px; height: 7px; border-radius: 2px; background: var(--amber); box-shadow: 0 0 0 4px rgba(243,184,63,.1); }
|
||||
.hero-icon { width: 112px; height: 112px; margin: 0 auto 26px; border: 1px solid rgba(117,216,207,.32); border-radius: 22px; box-shadow: 0 26px 70px rgba(0,0,0,.3), 9px 9px 0 rgba(243,184,63,.12); image-rendering: pixelated; }
|
||||
h1 { margin-bottom: 22px; font-size: clamp(76px, 13vw, 148px); font-weight: 600; }
|
||||
.lede { max-width: 690px; margin: 0 auto; color: var(--muted); font-size: 18px; }
|
||||
.version { display: inline-flex; margin-top: 17px; padding: 4px 10px; color: var(--amber); border: 1px solid rgba(243,184,63,.25); border-radius: 999px; background: rgba(243,184,63,.06); font: 400 10px var(--mono); }
|
||||
.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 11px; margin-top: 31px; }
|
||||
.button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 0 17px; color: var(--cream); border: 1px solid var(--line); border-radius: 9px; background: rgba(16,49,54,.72); font: 500 10px var(--mono); transition: transform .18s ease, background .18s ease, border-color .18s ease; }
|
||||
.button:hover { color: var(--cream); border-color: rgba(117,216,207,.52); background: var(--panel-hi); transform: translateY(-2px); }
|
||||
.button.primary { color: #122523; border-color: var(--teal); background: linear-gradient(135deg, var(--cream), var(--teal)); box-shadow: 0 16px 38px rgba(68,181,171,.18); }
|
||||
.button.primary:hover { color: #122523; background: var(--cream); }
|
||||
|
||||
.downloads-section { padding: 105px 0; border-top: 1px solid var(--line); }
|
||||
.section-heading { max-width: 790px; margin-bottom: 52px; }
|
||||
.section-heading > p:last-child { color: var(--muted); }
|
||||
h2 { margin-bottom: 20px; font-size: clamp(42px, 6vw, 72px); font-weight: 600; }
|
||||
.downloads-board { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
|
||||
.download-platform { --card-accent: var(--teal); position: relative; min-height: 255px; display: grid; grid-template-columns: 78px minmax(0,1fr); gap: 20px; overflow: hidden; padding: 28px; border: 1px solid rgba(117,216,207,.17); border-top: 3px solid var(--card-accent); border-radius: 15px; background: radial-gradient(circle at 100% 0, color-mix(in srgb, var(--card-accent) 13%, transparent), transparent 34%), linear-gradient(145deg, rgba(17,52,57,.9), rgba(8,31,35,.94)); box-shadow: 0 20px 55px rgba(0,0,0,.17); }
|
||||
.download-platform:nth-child(2) { --card-accent: var(--amber); }
|
||||
.download-platform:nth-child(3) { --card-accent: var(--coral); }
|
||||
.download-platform:nth-child(4) { --card-accent: #9e91ee; }
|
||||
.download-platform-icon { width: 68px; height: 68px; display: grid; place-items: center; border: 1px solid color-mix(in srgb, var(--card-accent) 32%, transparent); border-radius: 16px; background: color-mix(in srgb, var(--card-accent) 8%, var(--night-soft)); }
|
||||
.download-platform-icon img { width: 38px; height: 38px; object-fit: contain; image-rendering: auto; }
|
||||
.download-platform h3 { margin-bottom: 8px; color: var(--card-accent); font-size: 22px; }
|
||||
.download-platform p, .feature-item p, .privacy-section > p:last-child { color: var(--muted); font-size: 13px; }
|
||||
.download-platform p { margin-bottom: 18px; }
|
||||
.download-pills { display: flex; flex-wrap: wrap; gap: 7px; }
|
||||
.download-pills a { min-height: 32px; display: inline-flex; align-items: center; padding: 0 10px; color: #cbdad8; border: 1px solid rgba(117,216,207,.17); border-radius: 7px; background: rgba(5,21,24,.45); font: 400 9px var(--mono); }
|
||||
.download-pills a:hover, .download-pills a.is-primary:hover { color: #122523; border-color: var(--card-accent); background: var(--card-accent); }
|
||||
.download-pills a.is-primary { color: var(--card-accent); border-color: color-mix(in srgb, var(--card-accent) 40%, transparent); background: color-mix(in srgb, var(--card-accent) 7%, transparent); }
|
||||
|
||||
.features-section { padding: 105px 0; border-top: 1px solid var(--line); }
|
||||
.features-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin-top: 48px; border: 1px solid var(--line); background: var(--line); }
|
||||
.feature-item { min-height: 245px; padding: 28px; background: rgba(9,34,38,.94); }
|
||||
.feature-item:nth-child(1) { border-top: 2px solid var(--teal); }
|
||||
.feature-item:nth-child(2) { border-top: 2px solid var(--amber); }
|
||||
.feature-item:nth-child(3) { border-top: 2px solid var(--coral); }
|
||||
.feature-item:nth-child(4) { border-top: 2px solid #9e91ee; }
|
||||
.feature-item h3 { margin: 65px 0 10px; font-size: 17px; }
|
||||
|
||||
.privacy-section { margin-top: 25px; margin-bottom: 105px; padding: 70px; border: 1px solid rgba(243,184,63,.22); border-radius: 20px; background: radial-gradient(circle at 8% 50%, rgba(243,184,63,.12), transparent 33%), radial-gradient(circle at 92% 25%, rgba(117,216,207,.09), transparent 30%), #0b2529; }
|
||||
.privacy-section .section-eyebrow { color: var(--amber); }
|
||||
.privacy-section > p:last-child { max-width: 720px; font-size: 16px; }
|
||||
footer { padding: 26px 0 40px; color: var(--muted); border-top: 1px solid var(--line); font: 400 10px var(--mono); }
|
||||
|
||||
/* Shared app shell remains visually compatible with the product theme. */
|
||||
.home-app, .home-app .canvas-stage, .home-app .canvas-frame, .home-app canvas.emscripten, .home-app .loading-screen { background: var(--night); }
|
||||
.home-app { position: relative; min-height: 580px; height: min(690px, calc(100vh - 168px)); overflow: hidden; }
|
||||
.home-app .canvas-stage, .home-app .canvas-frame, .home-app canvas.emscripten, .home-app .loading-screen { position: absolute; inset: 0; width: 100%; height: 100%; overflow: hidden; }
|
||||
.home-app canvas.emscripten { border: 0; outline: 0; }
|
||||
.home-app .loading-screen { z-index: 4; display: grid; place-items: center; padding: 24px; transition: opacity 180ms ease, visibility 180ms ease; }
|
||||
.home-app .loading-screen.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
|
||||
.loading-panel { display: grid; justify-items: center; gap: 12px; text-align: center; }
|
||||
.loading-panel img { width: 76px; height: 76px; border-radius: 16px; }
|
||||
#status { min-height: 20px; color: var(--muted); font: 400 10px var(--mono); }
|
||||
.nl-wrap, .nl-badge, .nl-card { display: none !important; visibility: hidden !important; pointer-events: none !important; }
|
||||
|
||||
@media (max-width: 900px) {
|
||||
.hero { min-height: 620px; }
|
||||
.downloads-board { grid-template-columns: 1fr; }
|
||||
.features-grid { grid-template-columns: repeat(2,1fr); }
|
||||
}
|
||||
@media (max-width: 620px) {
|
||||
.site-header-inner { padding: 0 14px; }
|
||||
.header-nav { display: none; }
|
||||
section, footer { width: calc(100% - 28px); }
|
||||
.hero { min-height: 590px; padding: 70px 0; }
|
||||
.hero::before { width: 340px; height: 340px; }
|
||||
.hero::after { width: 430px; height: 430px; }
|
||||
h1 { font-size: 78px; }
|
||||
.download-platform { grid-template-columns: 1fr; padding: 23px; }
|
||||
.features-grid { grid-template-columns: 1fr; }
|
||||
.feature-item { min-height: 180px; }
|
||||
.feature-item h3 { margin-top: 30px; }
|
||||
.privacy-section { padding: 34px 24px; }
|
||||
.actions .button { flex: 1; }
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.button, .button:hover { transition: none; transform: none; }
|
||||
}
|
||||