Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5047ce86b0 | ||
|
|
45f3f8dbc0 | ||
|
|
a52a4b6462 | ||
|
|
b8bed150d0 | ||
|
|
56be19e3a9 | ||
|
|
b256e9b9fd | ||
|
|
b4be99002d | ||
|
|
9447c3a75c | ||
|
|
3deda78d54 | ||
|
|
c76f76ffb7 | ||
|
|
c57006672a | ||
|
|
881a7336ec | ||
|
|
11d0908325 | ||
|
|
b4d09eb632 | ||
|
|
d60269ca3d | ||
|
|
7a40ebcce4 | ||
|
|
9eeba9fe82 | ||
|
|
7f06063bf5 | ||
|
|
664d981cb5 | ||
|
|
03345a6304 | ||
|
|
a237ff9a15 | ||
|
|
57e229c13f | ||
|
|
fb1188ac37 | ||
|
|
9f3ea43414 |
No files matched your search
@@ -15,8 +15,30 @@ concurrency:
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
guard-submodule-urls:
|
||||
name: Submodule URLs are public HTTPS
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
# Plain checkout on purpose: the guard must not depend on fetching
|
||||
# the submodules it validates (an SSH URL would break that fetch).
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Reject non-HTTPS submodule URLs
|
||||
run: |
|
||||
set -eu
|
||||
if [ ! -f .gitmodules ]; then echo "no submodules - ok"; exit 0; fi
|
||||
bad=$(grep -nE '^[[:space:]]*url[[:space:]]*=' .gitmodules \
|
||||
| grep -vE '^[0-9]+:[[:space:]]*url[[:space:]]*=[[:space:]]*https://' || true)
|
||||
if [ -n "$bad" ]; then
|
||||
echo "::error::Non-HTTPS submodule URL(s) break fresh clones and CI:$bad"
|
||||
exit 1
|
||||
fi
|
||||
echo "all submodule URLs HTTPS - ok"
|
||||
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
needs: guard-submodule-urls
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
@@ -33,9 +55,31 @@ jobs:
|
||||
run: |
|
||||
test -s build/site/index.html
|
||||
test -s build/site/app/index.html
|
||||
test -s build/site/app/gopass.wasm
|
||||
test -s build/site/app/pass.wasm
|
||||
- name: Check formatting
|
||||
run: test -z "$(find . -path ./vendor -prune -o -name '*.go' -type f -print | xargs gofmt -l)"
|
||||
- name: Check fastlane metadata
|
||||
run: |
|
||||
set -eu
|
||||
meta=fastlane/metadata/android/en-US
|
||||
limit() {
|
||||
n=$(wc -m < "$1")
|
||||
if [ "$n" -gt "$2" ]; then
|
||||
echo "::error::$1 is $n characters (max $2)"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
limit "$meta/title.txt" 30
|
||||
limit "$meta/short_description.txt" 80
|
||||
limit "$meta/full_description.txt" 4000
|
||||
for f in "$meta"/changelogs/*.txt; do
|
||||
limit "$f" 500
|
||||
done
|
||||
code=$(sed -n 's/^[[:space:]]*versionCode \([0-9][0-9]*\)$/\1/p' droid/app/build.gradle | head -n 1)
|
||||
test -n "$code"
|
||||
test -s "$meta/changelogs/$code.txt"
|
||||
test -s "$meta/images/icon.png"
|
||||
echo "fastlane metadata ok (versionCode $code)"
|
||||
|
||||
build-gui:
|
||||
name: GUI (${{ matrix.arch }})
|
||||
@@ -68,6 +112,52 @@ jobs:
|
||||
run: make package-deb
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: gopass-gui-linux-${{ matrix.arch }}
|
||||
path: build/gopass-gui
|
||||
name: pass-gui-linux-${{ matrix.arch }}
|
||||
path: build/pass-gui
|
||||
if-no-files-found: error
|
||||
|
||||
build-android:
|
||||
name: Android debug build
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 60
|
||||
needs: guard-submodule-urls
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
- uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: '21'
|
||||
- uses: gradle/actions/setup-gradle@v3
|
||||
- name: Cache Android SDK packages
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
${{ env.ANDROID_HOME }}/platforms/android-36
|
||||
${{ env.ANDROID_HOME }}/build-tools/34.0.0
|
||||
${{ env.ANDROID_HOME }}/ndk/28.2.13676358
|
||||
${{ env.ANDROID_HOME }}/cmake/3.22.1
|
||||
key: android-sdk-${{ runner.os }}-${{ runner.arch }}-api36-bt34-ndk28-cmake322
|
||||
restore-keys: |
|
||||
android-sdk-${{ runner.os }}-${{ runner.arch }}-
|
||||
- name: Cache Android native build
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
droid/app/.cxx
|
||||
droid/app/build/intermediates/cxx
|
||||
key: android-native-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('droid/app/src/main/cpp/CMakeLists.txt', 'droid/app/build.gradle', 'native/*.c', 'droid/app/src/main/cpp/*.c', 'vendor/kryon/src/**/*.c', 'vendor/kryon/include/**/*.h', 'vendor/kryon/vendor/raylib/src/**') }}
|
||||
restore-keys: |
|
||||
android-native-${{ runner.os }}-${{ runner.arch }}-
|
||||
- name: Install Android SDK components
|
||||
run: |
|
||||
set -euo pipefail
|
||||
SDKMANAGER="$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager"
|
||||
yes | "$SDKMANAGER" --licenses >/dev/null || true
|
||||
"$SDKMANAGER" "platforms;android-36" "build-tools;34.0.0" "ndk;28.2.13676358" "cmake;3.22.1"
|
||||
- name: Build debug APK
|
||||
run: |
|
||||
set -euo pipefail
|
||||
chmod +x droid/gradlew
|
||||
make android-debug
|
||||
@@ -32,11 +32,11 @@ jobs:
|
||||
TARGET_ARCH: ${{ matrix.arch }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
name="gopass-cli-${TARGET_OS}-${TARGET_ARCH}"
|
||||
name="pass-cli-${TARGET_OS}-${TARGET_ARCH}"
|
||||
mkdir -p "build/release/$name"
|
||||
suffix=""
|
||||
[ "$TARGET_OS" = windows ] && suffix=".exe"
|
||||
CGO_ENABLED=0 GOOS="$TARGET_OS" GOARCH="$TARGET_ARCH" go build -trimpath -ldflags='-s -w' -o "build/release/$name/gopass$suffix" ./cmd/gopass
|
||||
CGO_ENABLED=0 GOOS="$TARGET_OS" GOARCH="$TARGET_ARCH" go build -trimpath -ldflags='-s -w' -o "build/release/$name/pass$suffix" ./cmd/pass
|
||||
cp LICENSE README.md "build/release/$name/"
|
||||
if [ "$TARGET_OS" = windows ]; then
|
||||
(cd build/release && zip -qr "$name.zip" "$name")
|
||||
@@ -46,7 +46,7 @@ jobs:
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: cli-${{ matrix.os }}-${{ matrix.arch }}
|
||||
path: build/release/gopass-cli-${{ matrix.os }}-${{ matrix.arch }}.*
|
||||
path: build/release/pass-cli-${{ matrix.os }}-${{ matrix.arch }}.*
|
||||
if-no-files-found: error
|
||||
|
||||
gui:
|
||||
@@ -75,9 +75,9 @@ jobs:
|
||||
- run: make gui
|
||||
- name: Package GUI tarball and Debian package
|
||||
run: |
|
||||
name="gopass-gui-linux-${{ matrix.arch }}"
|
||||
name="pass-gui-linux-${{ matrix.arch }}"
|
||||
mkdir -p "build/release/$name"
|
||||
cp build/gopass-gui LICENSE README.md "build/release/$name/"
|
||||
cp build/pass-gui LICENSE README.md "build/release/$name/"
|
||||
tar -C build/release -czf "build/release/$name.tar.gz" "$name"
|
||||
make package-deb
|
||||
- name: Package AppImage
|
||||
@@ -94,11 +94,81 @@ jobs:
|
||||
with:
|
||||
name: gui-linux-${{ matrix.arch }}
|
||||
path: |
|
||||
build/release/gopass-gui-linux-${{ matrix.arch }}.tar.gz
|
||||
build/release/pass-gui-linux-${{ matrix.arch }}.tar.gz
|
||||
build/release/*.deb
|
||||
build/release/*.AppImage
|
||||
if-no-files-found: error
|
||||
|
||||
android:
|
||||
name: Android
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 60
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
- uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: '21'
|
||||
- uses: gradle/actions/setup-gradle@v3
|
||||
- name: Cache Android SDK packages
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
${{ env.ANDROID_HOME }}/platforms/android-36
|
||||
${{ env.ANDROID_HOME }}/build-tools/34.0.0
|
||||
${{ env.ANDROID_HOME }}/ndk/28.2.13676358
|
||||
${{ env.ANDROID_HOME }}/cmake/3.22.1
|
||||
key: android-sdk-${{ runner.os }}-${{ runner.arch }}-api36-bt34-ndk28-cmake322
|
||||
restore-keys: |
|
||||
android-sdk-${{ runner.os }}-${{ runner.arch }}-
|
||||
- name: Cache Android native build
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
droid/app/.cxx
|
||||
droid/app/build/intermediates/cxx
|
||||
key: android-native-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('droid/app/src/main/cpp/CMakeLists.txt', 'droid/app/build.gradle', 'native/*.c', 'droid/app/src/main/cpp/*.c', 'vendor/kryon/src/**/*.c', 'vendor/kryon/include/**/*.h', 'vendor/kryon/vendor/raylib/src/**') }}
|
||||
restore-keys: |
|
||||
android-native-${{ runner.os }}-${{ runner.arch }}-
|
||||
- name: Install Android SDK components
|
||||
run: |
|
||||
set -euo pipefail
|
||||
SDKMANAGER="$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager"
|
||||
yes | "$SDKMANAGER" --licenses >/dev/null || true
|
||||
"$SDKMANAGER" "platforms;android-36" "build-tools;34.0.0" "ndk;28.2.13676358" "cmake;3.22.1"
|
||||
- name: Prepare Android signing key
|
||||
env:
|
||||
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
test -n "$KEYSTORE_BASE64" || { echo "::error::KEYSTORE_BASE64 secret is empty or missing"; exit 1; }
|
||||
mkdir -p "$HOME/.android"
|
||||
printf '%s' "$KEYSTORE_BASE64" | base64 -d > "$HOME/.android/pass-release.keystore"
|
||||
- name: Build release APK
|
||||
env:
|
||||
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
|
||||
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
test -n "$KEYSTORE_PASSWORD" || { echo "::error::KEYSTORE_PASSWORD secret is empty or missing"; exit 1; }
|
||||
test -n "$KEY_ALIAS" || { echo "::error::KEY_ALIAS secret is empty or missing"; exit 1; }
|
||||
chmod +x droid/gradlew
|
||||
./droid/gradlew -p droid assembleRelease \
|
||||
-Pkeystore.path="$HOME/.android/pass-release.keystore" \
|
||||
-Pkeystore.alias="$KEY_ALIAS" \
|
||||
-Pkeystore.password="$KEYSTORE_PASSWORD" \
|
||||
--stacktrace
|
||||
mkdir -p build/release
|
||||
cp droid/app/build/outputs/apk/release/app-release.apk build/release/pass-android.apk
|
||||
test -s build/release/pass-android.apk
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: android
|
||||
path: build/release/pass-android.apk
|
||||
if-no-files-found: error
|
||||
|
||||
web:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
@@ -108,15 +178,15 @@ jobs:
|
||||
go-version: 1.24.x
|
||||
cache: false
|
||||
- run: make site
|
||||
- run: cd build/site && zip -qr ../gopass-web.zip .
|
||||
- run: cd build/site && zip -qr ../pass-web.zip .
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: web
|
||||
path: build/gopass-web.zip
|
||||
path: build/pass-web.zip
|
||||
if-no-files-found: error
|
||||
|
||||
publish:
|
||||
needs: [cli, gui, web]
|
||||
needs: [cli, gui, web, android]
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
released: ${{ steps.version.outputs.released }}
|
||||
@@ -124,6 +194,7 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: build/artifacts
|
||||
@@ -141,6 +212,50 @@ jobs:
|
||||
else
|
||||
echo "released=true" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
- name: Generate Update Appcast
|
||||
if: steps.version.outputs.released == 'true'
|
||||
run: |
|
||||
set -euo pipefail
|
||||
VERSION=$(sed -n 's/^const Version = "\([^"]*\)"/\1/p' version.go)
|
||||
TAG="v$VERSION"
|
||||
BASE="https://github.com/waozixyz/pass/releases/download/$TAG"
|
||||
# appcast channel names use dpkg arch naming (amd64/arm64);
|
||||
# the artifacts use uname -m naming (x86_64/aarch64)
|
||||
arch_name() {
|
||||
case "$1" in
|
||||
x86_64) echo amd64 ;;
|
||||
aarch64|arm64) echo arm64 ;;
|
||||
*) echo "$1" ;;
|
||||
esac
|
||||
}
|
||||
channels=()
|
||||
for img in build/artifacts/*.AppImage; do
|
||||
[ -e "$img" ] || continue
|
||||
arch=$(basename "$img" | sed -n 's/^pass-.*-\([^-]*\)\.AppImage$/\1/p')
|
||||
channels+=("--channel" "appimage-$(arch_name "$arch")=$img")
|
||||
done
|
||||
DEB="$(find build/artifacts -maxdepth 1 -name '*.deb' -print -quit || true)"
|
||||
TAR="$(find build/artifacts -maxdepth 1 -name 'pass-gui-linux-*.tar.gz' -print -quit || true)"
|
||||
[ -n "$DEB" ] && channels+=("--channel" "deb=$DEB")
|
||||
[ -n "$TAR" ] && channels+=("--channel" "tarball=$TAR")
|
||||
if [ ${#channels[@]} -eq 0 ]; then
|
||||
echo "no release artifacts found for the appcast"
|
||||
exit 1
|
||||
fi
|
||||
python3 vendor/kryon/scripts/make_appcast.py \
|
||||
--version "$VERSION" \
|
||||
--base-url "$BASE" \
|
||||
--notes-url "https://github.com/waozixyz/pass/releases/tag/$TAG" \
|
||||
--changelog CHANGELOG.md \
|
||||
--out build/artifacts/appcast.json \
|
||||
"${channels[@]}"
|
||||
- name: Publish checksums
|
||||
if: steps.version.outputs.released == 'true'
|
||||
run: |
|
||||
set -euo pipefail
|
||||
cd build/artifacts
|
||||
# The glob expands before the redirect creates SHA256SUMS itself.
|
||||
sha256sum -- * > SHA256SUMS
|
||||
- name: Create release tag
|
||||
if: steps.version.outputs.released == 'true'
|
||||
run: |
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
name: Security
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
privacy:
|
||||
name: Privacy scan
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
# Prove the scanner works using only a synthetic term — the guard
|
||||
# itself must never contain, or reveal, real private values.
|
||||
- name: Self-test the scanner with a synthetic canary
|
||||
run: |
|
||||
canary=zzq-canary-7f3a
|
||||
printf '%s\n' "$canary" > /tmp/canary-terms
|
||||
mkdir /tmp/canary-dir
|
||||
printf 'const token = "%s";\n' "$canary" > /tmp/canary-dir/leak.js
|
||||
if scripts/privacy_scan.sh /tmp/canary-terms /tmp/canary-dir; then
|
||||
echo "scanner failed to detect the canary" >&2
|
||||
exit 1
|
||||
fi
|
||||
if ! scripts/privacy_scan.sh /tmp/canary-terms scripts; then
|
||||
echo "scanner reported a false positive on its own source" >&2
|
||||
exit 1
|
||||
fi
|
||||
rm -rf /tmp/canary-dir /tmp/canary-terms
|
||||
|
||||
# The deny-list comes from the encrypted PRIVATE_TERMS repository
|
||||
# secret (one fixed-string term per line) so the private values are
|
||||
# never part of this repository. Fork pull requests cannot read
|
||||
# secrets; those runs skip with a warning and the scan re-runs on
|
||||
# the push that lands the merge.
|
||||
- name: Scan the repository for private terms
|
||||
env:
|
||||
PRIVATE_TERMS: ${{ secrets.PRIVATE_TERMS }}
|
||||
run: |
|
||||
if [ -z "$PRIVATE_TERMS" ]; then
|
||||
echo "::warning::PRIVATE_TERMS secret is not set; privacy scan skipped"
|
||||
exit 0
|
||||
fi
|
||||
printf '%s\n' "$PRIVATE_TERMS" > /tmp/terms
|
||||
chmod 600 /tmp/terms
|
||||
status=0
|
||||
scripts/privacy_scan.sh /tmp/terms HEAD || status=1
|
||||
if [ "$GITHUB_EVENT_NAME" = push ]; then
|
||||
before="${{ github.event.before }}"
|
||||
if [ "$before" != "0000000000000000000000000000000000000000" ]; then
|
||||
for commit in $(git rev-list "$before..$GITHUB_SHA"); do
|
||||
scripts/privacy_scan.sh /tmp/terms "$commit" || status=1
|
||||
done
|
||||
fi
|
||||
fi
|
||||
exit $status
|
||||
@@ -28,10 +28,10 @@ jobs:
|
||||
make site
|
||||
test -s build/site/index.html
|
||||
test -s build/site/app/index.html
|
||||
test -s build/site/app/gopass.wasm
|
||||
test -s build/site/app/pass.wasm
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: gopass-site
|
||||
name: pass-site
|
||||
path: build/site
|
||||
if-no-files-found: error
|
||||
|
||||
@@ -43,7 +43,7 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: gopass-site
|
||||
name: pass-site
|
||||
path: build/site
|
||||
- name: Install Netlify CLI
|
||||
run: npm install --global netlify-cli
|
||||
@@ -71,15 +71,15 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: gopass-site
|
||||
name: pass-site
|
||||
path: build/site
|
||||
- name: Package Site
|
||||
run: |
|
||||
set -euo pipefail
|
||||
test -s build/site/index.html
|
||||
cd build/site
|
||||
zip -qr ../gopass-site.zip .
|
||||
test -s ../gopass-site.zip
|
||||
zip -qr ../pass-site.zip .
|
||||
test -s ../pass-site.zip
|
||||
- name: Deploy Production To Netlify
|
||||
run: |
|
||||
set -euo pipefail
|
||||
@@ -92,7 +92,7 @@ jobs:
|
||||
-X POST \
|
||||
-H "Authorization: Bearer $auth_token" \
|
||||
-H "Content-Type: application/zip" \
|
||||
--data-binary "@build/gopass-site.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"
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
/build/
|
||||
/gopass
|
||||
/gui/gopass-gui
|
||||
/pass
|
||||
/gui/pass-gui
|
||||
+21
-1
@@ -1,5 +1,25 @@
|
||||
# Changelog
|
||||
|
||||
## [0.2.3] - 2026-08-21
|
||||
|
||||
- Verify every download: releases now ship a SHA256SUMS file covering the
|
||||
command-line, desktop, Android, and browser downloads.
|
||||
- The Android app now builds entirely from source with no developer signing
|
||||
key, clearing the way for F-Droid distribution.
|
||||
|
||||
## [0.2.2] - 2026-08-20
|
||||
|
||||
- Install pass on Android: a signed APK is now downloadable from
|
||||
pass.waozi.xyz alongside the desktop, terminal, and browser downloads.
|
||||
- Fix the Android master-password fingerprint and secure storage so the
|
||||
stored master password unlocks reliably across launches.
|
||||
|
||||
## [0.2.1] - 2026-08-19
|
||||
|
||||
- The desktop GUI now checks for new releases and can update itself: AppImage
|
||||
builds download the checksum-verified update and restart straight into it,
|
||||
while tarball and Debian package installs get a link to the release page.
|
||||
|
||||
## [0.2.0] - 2026-08-18
|
||||
|
||||
- Copy passwords through a built-in pure-Go X11 clipboard on Linux, with no
|
||||
@@ -28,7 +48,7 @@
|
||||
|
||||
- Make keyboard navigation reliable: click a field, then use Tab and Shift+Tab
|
||||
to move through the form.
|
||||
- Keep one gopass window open by default; launching it again replaces the
|
||||
- Keep one pass window open by default; launching it again replaces the
|
||||
existing window.
|
||||
- Keep long editing sessions responsive and stable.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.PHONY: all cli gui native run test native-test web site install-gui uninstall-gui package-deb package-appimage android-debug
|
||||
.PHONY: all cli gui native run test native-test web site install install-cli uninstall-cli install-gui uninstall-gui package-deb package-appimage android-debug
|
||||
|
||||
BIN_DIR ?= $(HOME)/bin
|
||||
DATA_DIR ?= $(if $(XDG_DATA_HOME),$(XDG_DATA_HOME),$(HOME)/.local/share)
|
||||
@@ -10,27 +10,36 @@ KRYON_RUNTIME_SOURCES := $(shell find vendor/kryon/src vendor/kryon/include -typ
|
||||
all: cli gui
|
||||
|
||||
cli:
|
||||
go build -o gopass ./cmd/gopass
|
||||
go build -o pass ./cmd/pass
|
||||
|
||||
$(KRYON_BUILD_DIR)/libkryon.a: $(KRYON_RUNTIME_SOURCES) vendor/kryon/Makefile
|
||||
$(MAKE) -C vendor/kryon -f Makefile all
|
||||
|
||||
gui: $(KRYON_BUILD_DIR)/libkryon.a
|
||||
cd gui && go build -o ../build/gopass-gui .
|
||||
cd gui && go build -o ../build/pass-gui .
|
||||
|
||||
native: all
|
||||
|
||||
run: gui
|
||||
./build/gopass-gui
|
||||
./build/pass-gui
|
||||
|
||||
install: install-cli install-gui
|
||||
|
||||
install-cli: cli
|
||||
mkdir -p $(BIN_DIR)
|
||||
install -m 0755 pass $(BIN_DIR)/pass
|
||||
|
||||
uninstall-cli:
|
||||
rm -f $(BIN_DIR)/pass
|
||||
|
||||
install-gui: gui
|
||||
mkdir -p $(BIN_DIR) $(DATA_DIR)/applications $(DATA_DIR)/icons/hicolor/512x512/apps
|
||||
cp build/gopass-gui $(BIN_DIR)/gopass-gui
|
||||
install -m 0755 build/pass-gui $(BIN_DIR)/pass-gui
|
||||
cp packaging/linux/xyz.waozi.pass.desktop $(DATA_DIR)/applications/xyz.waozi.pass.desktop
|
||||
cp assets/app/icon.png $(DATA_DIR)/icons/hicolor/512x512/apps/gopass.png
|
||||
cp assets/app/icon.png $(DATA_DIR)/icons/hicolor/512x512/apps/pass.png
|
||||
|
||||
uninstall-gui:
|
||||
rm -f $(BIN_DIR)/gopass-gui $(DATA_DIR)/applications/xyz.waozi.pass.desktop $(DATA_DIR)/icons/hicolor/512x512/apps/gopass.png
|
||||
rm -f $(BIN_DIR)/pass-gui $(DATA_DIR)/applications/xyz.waozi.pass.desktop $(DATA_DIR)/icons/hicolor/512x512/apps/pass.png
|
||||
|
||||
test:
|
||||
go test ./...
|
||||
@@ -39,8 +48,8 @@ test:
|
||||
# Checks the C generator (used by the Android app) against the same fixed
|
||||
# vectors as the Go tests.
|
||||
native-test:
|
||||
cc -Wall -Wextra -O2 -Inative native/gopass_core.c native/gopass_core_test.c -o build/gopass_core_test
|
||||
./build/gopass_core_test
|
||||
cc -Wall -Wextra -O2 -Inative native/pass_core.c native/pass_core_test.c -o build/pass_core_test
|
||||
./build/pass_core_test
|
||||
|
||||
ANDROID_DIR := droid
|
||||
ANDROID_ABIS ?= armeabi-v7a,arm64-v8a
|
||||
@@ -48,14 +57,14 @@ ANDROID_ABIS ?= armeabi-v7a,arm64-v8a
|
||||
android-debug:
|
||||
cd $(ANDROID_DIR) && ./gradlew assembleDebug -Pabi=$(ANDROID_ABIS)
|
||||
mkdir -p build
|
||||
cp $(ANDROID_DIR)/app/build/outputs/apk/debug/app-debug.apk build/gopass-android-debug.apk
|
||||
cp $(ANDROID_DIR)/app/build/outputs/apk/debug/app-debug.apk build/pass-android-debug.apk
|
||||
|
||||
web:
|
||||
./web/build.sh
|
||||
|
||||
site: web
|
||||
test -f build/site/index.html
|
||||
test -f build/site/app/gopass.wasm
|
||||
test -f build/site/app/pass.wasm
|
||||
|
||||
package-deb: gui
|
||||
./scripts/package-deb.sh
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# gopass
|
||||
# pass
|
||||
|
||||
Website and browser app: [pass.waozi.xyz](https://pass.waozi.xyz/)
|
||||
|
||||
`gopass` 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
|
||||
@@ -16,39 +16,39 @@ Prebuilt CLI and desktop downloads are available from
|
||||
With Go 1.24 or newer:
|
||||
|
||||
```sh
|
||||
go install github.com/waozixyz/gopass/cmd/gopass@latest
|
||||
go install github.com/waozixyz/pass/cmd/pass@latest
|
||||
```
|
||||
|
||||
Or build the command from a checkout:
|
||||
|
||||
```sh
|
||||
go build ./cmd/gopass
|
||||
go build ./cmd/pass
|
||||
```
|
||||
|
||||
## Use
|
||||
|
||||
```text
|
||||
gopass [OPTIONS] SITE LOGIN [MASTER_PASSWORD]
|
||||
pass [OPTIONS] SITE LOGIN [MASTER_PASSWORD]
|
||||
```
|
||||
|
||||
The default password has 16 characters and includes lowercase letters,
|
||||
uppercase letters, digits, and symbols. The default counter is 1.
|
||||
|
||||
Passing a master password as an argument can expose it to process inspection
|
||||
and shell history. Omitting it is safer: `gopass` first checks
|
||||
and shell history. Omitting it is safer: `pass` first checks
|
||||
`LESSPASS_MASTER_PASSWORD`, then reads from the controlling terminal or console
|
||||
with echo disabled. Use `--prompt` to bypass the environment and always ask. For
|
||||
example:
|
||||
|
||||
```sh
|
||||
gopass --prompt example.com alice
|
||||
gopass --length 24 --counter 2 example.com alice
|
||||
gopass --no-symbols --exclude '0O1Il' example.com alice
|
||||
pass --prompt example.com alice
|
||||
pass --length 24 --counter 2 example.com alice
|
||||
pass --no-symbols --exclude '0O1Il' example.com alice
|
||||
```
|
||||
|
||||
`--copy` sends the result to the clipboard without printing it. On Linux a
|
||||
built-in pure-Go X11 clipboard is used when an X server (X.Org, Xlibre, or
|
||||
XWayland) is reachable, so no external tool is needed; otherwise `gopass`
|
||||
XWayland) is reachable, so no external tool is needed; otherwise `pass`
|
||||
falls back to `wl-copy`, `xclip`, `xsel`, `pbcopy`, or `clip.exe` and reports
|
||||
an error if none can be used. The copied password is served by a small
|
||||
detached process and disappears when another application takes the clipboard;
|
||||
@@ -57,17 +57,17 @@ clipboard only), and `--read-clipboard` prints the current contents.
|
||||
|
||||
## Profiles
|
||||
|
||||
An optional configuration file at `$XDG_CONFIG_HOME/gopass/profiles.json`
|
||||
(usually `~/.config/gopass/profiles.json`) can store named profiles — a login
|
||||
An optional configuration file at `$XDG_CONFIG_HOME/pass/profiles.json`
|
||||
(usually `~/.config/pass/profiles.json`) can store named profiles — a login
|
||||
plus default settings — so daily invocations shrink to one flag:
|
||||
|
||||
```sh
|
||||
gopass --profile work example.com
|
||||
pass --profile work example.com
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"vault": "~/.secret_vault",
|
||||
"vault": "~/.vault",
|
||||
"copy": true,
|
||||
"clear_after": "90s",
|
||||
"profiles": {
|
||||
@@ -77,7 +77,7 @@ gopass --profile work example.com
|
||||
```
|
||||
|
||||
Profiles hold no secrets. Command-line flags always win over profile values,
|
||||
and without a configuration file gopass behaves exactly as before.
|
||||
and without a configuration file pass behaves exactly as before.
|
||||
|
||||
## Master password from a vault
|
||||
|
||||
@@ -85,8 +85,8 @@ and without a configuration file gopass behaves exactly as before.
|
||||
|
||||
```sh
|
||||
printf 'master password' | openssl enc -aes-256-cbc -md sha512 -a \
|
||||
-pbkdf2 -iter 100000 -salt -pass pass:... > ~/.secret_vault
|
||||
gopass --vault ~/.secret_vault example.com alice
|
||||
-pbkdf2 -iter 100000 -salt -pass pass:... > ~/.vault
|
||||
pass --vault ~/.vault example.com alice
|
||||
```
|
||||
|
||||
The vault passphrase is requested on the terminal with echo disabled, or read
|
||||
@@ -94,21 +94,7 @@ from piped standard input, and the decrypted contents are used as the master
|
||||
password — the master itself never appears in argv or the environment. The
|
||||
vault path can also be set once in the profiles file.
|
||||
|
||||
## The `pass` shorthand
|
||||
|
||||
Copying or symlinking the binary as `pass` enables a compact personal mode
|
||||
built on profiles:
|
||||
|
||||
```sh
|
||||
ln -s gopass ~/bin/pass
|
||||
pass work example.com
|
||||
```
|
||||
|
||||
`pass PROFILE SITE` copies the password without printing it and clears the
|
||||
clipboard after 90 seconds (`-timeout 30s` to change, `-timeout 0` to keep it
|
||||
until another application takes over).
|
||||
|
||||
Run `gopass --help` for all flags.
|
||||
Run `pass --help` for all flags.
|
||||
|
||||
## Desktop app
|
||||
|
||||
@@ -120,14 +106,23 @@ unless the clipboard has since been replaced.
|
||||
```sh
|
||||
git submodule update --init --recursive
|
||||
make gui
|
||||
./build/gopass-gui
|
||||
./build/pass-gui
|
||||
```
|
||||
|
||||
## Android
|
||||
|
||||
The Android app runs on Android 5.0 (API 21) and newer. Install the signed
|
||||
APK (`pass-android.apk`) from [pass.waozi.xyz](https://pass.waozi.xyz/#downloads)
|
||||
or the [releases page](https://github.com/waozixyz/pass/releases/latest). It
|
||||
uses the same generation algorithm as the desktop app, computes everything
|
||||
locally, and declares no Internet permission at all — the only permissions it
|
||||
requests are for the optional fingerprint unlock.
|
||||
|
||||
## Library
|
||||
|
||||
```go
|
||||
settings := gopass.DefaultOptions()
|
||||
result, err := gopass.Generate("example.com", "alice", master, settings)
|
||||
settings := pass.DefaultOptions()
|
||||
result, err := pass.Generate("example.com", "alice", master, settings)
|
||||
```
|
||||
|
||||
All inputs are interpreted as UTF-8 strings. Excluded characters are removed
|
||||
|
||||
@@ -1,82 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"strconv"
|
||||
"time"
|
||||
)
|
||||
|
||||
const passUsage = `pass - generate a LessPass password and copy it to the clipboard
|
||||
|
||||
Usage:
|
||||
pass [flags] <profile> <site>
|
||||
|
||||
The profile name selects a login and settings from the gopass profiles file.
|
||||
You will be prompted (hidden input) for the passphrase of your OpenSSL
|
||||
secret vault when one is configured. The password is copied to the
|
||||
CLIPBOARD selection; it is never displayed.
|
||||
|
||||
Flags:
|
||||
`
|
||||
|
||||
// translatePassArguments rewrites the legacy two-argument `pass PROFILE SITE`
|
||||
// command line into the equivalent gopass arguments, so a copy or symlink of
|
||||
// the gopass binary named "pass" keeps working as the personal shorthand.
|
||||
// It reports false (after printing usage) on a malformed legacy invocation.
|
||||
func translatePassArguments(arguments []string) ([]string, bool) {
|
||||
flags := flag.NewFlagSet("pass", flag.ContinueOnError)
|
||||
flags.SetOutput(io.Discard) // report errors through reportPassUsage instead
|
||||
|
||||
vaultPath := flags.String("vault", "", "path to an OpenSSL-encrypted vault holding the master password")
|
||||
counter := flags.Int64("counter", -1, "LessPass counter")
|
||||
length := flags.Int("length", 0, "password length")
|
||||
symbols := flags.Bool("symbols", false, "include symbols in the generated password")
|
||||
timeout := flags.Duration("timeout", 90*time.Second, "clipboard auto-clear timeout; 0 keeps it until overwritten")
|
||||
read := flags.Bool("read", false, "print the current clipboard contents")
|
||||
|
||||
if err := flags.Parse(arguments); err != nil {
|
||||
if errors.Is(err, flag.ErrHelp) {
|
||||
reportPassUsage(os.Stdout, flags)
|
||||
os.Exit(0)
|
||||
}
|
||||
reportPassUsage(os.Stderr, flags)
|
||||
fmt.Fprintf(os.Stderr, "\nerror: %v\n", err)
|
||||
return nil, false
|
||||
}
|
||||
|
||||
translated := []string{"--copy", "--clear-after=" + timeout.String()}
|
||||
if *vaultPath != "" {
|
||||
translated = append(translated, "--vault", *vaultPath)
|
||||
}
|
||||
if *counter >= 0 {
|
||||
translated = append(translated, "-C", strconv.FormatInt(*counter, 10))
|
||||
}
|
||||
if *length > 0 {
|
||||
translated = append(translated, "-L", strconv.Itoa(*length))
|
||||
}
|
||||
if *symbols {
|
||||
translated = append(translated, "-s")
|
||||
}
|
||||
if *read {
|
||||
return append(translated, "--read-clipboard"), true
|
||||
}
|
||||
|
||||
rest := flags.Args()
|
||||
if len(rest) != 2 {
|
||||
reportPassUsage(os.Stderr, flags)
|
||||
return nil, false
|
||||
}
|
||||
return append(translated, "--profile", rest[0], rest[1]), true
|
||||
}
|
||||
|
||||
// reportPassUsage prints the legacy usage block, the way the original pass
|
||||
// tool reported a bad command line.
|
||||
func reportPassUsage(output io.Writer, flags *flag.FlagSet) {
|
||||
fmt.Fprint(output, passUsage)
|
||||
flags.SetOutput(output)
|
||||
flags.PrintDefaults()
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestTranslatePassArguments(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
in []string
|
||||
want []string
|
||||
}{
|
||||
{
|
||||
name: "plain",
|
||||
in: []string{"w", "example.org"},
|
||||
want: []string{"--copy", "--clear-after=1m30s", "--profile", "w", "example.org"},
|
||||
},
|
||||
{
|
||||
name: "all flags",
|
||||
in: []string{"-vault", "/v", "-counter", "5", "-length", "20", "-symbols", "n", "s.org"},
|
||||
want: []string{"--copy", "--clear-after=1m30s", "--vault", "/v", "-C", "5", "-L", "20", "-s", "--profile", "n", "s.org"},
|
||||
},
|
||||
{
|
||||
name: "zero timeout keeps the clipboard",
|
||||
in: []string{"-timeout", "0", "w", "example.org"},
|
||||
want: []string{"--copy", "--clear-after=0s", "--profile", "w", "example.org"},
|
||||
},
|
||||
{
|
||||
name: "read mode",
|
||||
in: []string{"-read"},
|
||||
want: []string{"--copy", "--clear-after=1m30s", "--read-clipboard"},
|
||||
},
|
||||
}
|
||||
for _, test := range tests {
|
||||
got, ok := translatePassArguments(test.in)
|
||||
if !ok {
|
||||
t.Errorf("%s: translatePassArguments(%v) rejected the arguments", test.name, test.in)
|
||||
continue
|
||||
}
|
||||
if !reflect.DeepEqual(got, test.want) {
|
||||
t.Errorf("%s: got %v, want %v", test.name, got, test.want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestTranslatePassArgumentsRejectsBadUsage(t *testing.T) {
|
||||
for _, arguments := range [][]string{
|
||||
{},
|
||||
{"w"},
|
||||
{"w", "example.org", "extra"},
|
||||
{"-length", "notanumber", "w", "example.org"},
|
||||
} {
|
||||
if got, ok := translatePassArguments(arguments); ok {
|
||||
t.Errorf("translatePassArguments(%v) = %v, want rejection", arguments, got)
|
||||
}
|
||||
}
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
@@ -29,7 +29,7 @@ const (
|
||||
atomPlainUTF8 = "text/plain;charset=utf-8"
|
||||
atomTargets = "TARGETS"
|
||||
atomMultiple = "MULTIPLE"
|
||||
propName = "GOPASS_SELECTION"
|
||||
propName = "PASS_SELECTION"
|
||||
)
|
||||
|
||||
type xAtoms map[string]xproto.Atom
|
||||
File renamed without changes.
@@ -7,18 +7,17 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
password "github.com/waozixyz/gopass"
|
||||
"github.com/waozixyz/gopass/vault"
|
||||
password "github.com/waozixyz/pass"
|
||||
"github.com/waozixyz/pass/vault"
|
||||
)
|
||||
|
||||
const environmentVariable = "LESSPASS_MASTER_PASSWORD"
|
||||
|
||||
// promptVaultPassphrase asks for the vault passphrase on the terminal, or
|
||||
// reads it from standard input when stdin is piped ("echo pw | gopass ...").
|
||||
// reads it from standard input when stdin is piped ("echo pw | pass ...").
|
||||
func promptVaultPassphrase() (string, error) {
|
||||
if info, err := os.Stdin.Stat(); err == nil && info.Mode()&os.ModeCharDevice == 0 {
|
||||
line, err := bufio.NewReader(os.Stdin).ReadString('\n')
|
||||
@@ -34,16 +33,8 @@ func promptVaultPassphrase() (string, error) {
|
||||
var readVaultPassphrase = promptVaultPassphrase
|
||||
|
||||
func main() {
|
||||
arguments := os.Args[1:]
|
||||
if filepath.Base(os.Args[0]) == "pass" {
|
||||
translated, ok := translatePassArguments(arguments)
|
||||
if !ok {
|
||||
os.Exit(2)
|
||||
}
|
||||
arguments = translated
|
||||
}
|
||||
if err := run(arguments, os.Stdout, os.Stderr); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "gopass: %v\n", err)
|
||||
if err := run(os.Args[1:], os.Stdout, os.Stderr); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "pass: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
@@ -55,7 +46,7 @@ func run(arguments []string, stdout, stderr io.Writer) error {
|
||||
}
|
||||
|
||||
options := password.DefaultOptions()
|
||||
flags := flag.NewFlagSet("gopass", flag.ContinueOnError)
|
||||
flags := flag.NewFlagSet("pass", flag.ContinueOnError)
|
||||
flags.SetOutput(stderr)
|
||||
flags.Usage = func() { printHelp(stderr) }
|
||||
|
||||
@@ -117,7 +108,7 @@ func run(arguments []string, stdout, stderr io.Writer) error {
|
||||
options.Symbols = false
|
||||
}
|
||||
if showVersion {
|
||||
fmt.Fprintf(stdout, "gopass %s\n", password.Version)
|
||||
fmt.Fprintf(stdout, "pass %s\n", password.Version)
|
||||
return nil
|
||||
}
|
||||
if serveClipboard {
|
||||
@@ -132,6 +123,14 @@ func run(arguments []string, stdout, stderr io.Writer) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
positional := flags.Args()
|
||||
if profileName == "" && len(positional) == 2 && config != nil {
|
||||
if _, ok := config.Profiles[positional[0]]; ok {
|
||||
profileName = positional[0]
|
||||
positional = positional[1:]
|
||||
}
|
||||
}
|
||||
|
||||
var profile Profile
|
||||
if profileName != "" {
|
||||
if config == nil {
|
||||
@@ -148,7 +147,6 @@ func run(arguments []string, stdout, stderr io.Writer) error {
|
||||
profile.apply(&options, explicit)
|
||||
}
|
||||
|
||||
positional := flags.Args()
|
||||
if profileName != "" {
|
||||
if len(positional) != 1 {
|
||||
printHelp(stderr)
|
||||
@@ -169,13 +167,12 @@ func run(arguments []string, stdout, stderr io.Writer) error {
|
||||
login = positional[1]
|
||||
}
|
||||
|
||||
// A vault from the configuration is the least authoritative master
|
||||
// password source: anything the user spells out for this invocation
|
||||
// (--vault, the environment, --prompt, a positional password) wins.
|
||||
// Explicit command-line password sources win. A configured vault beats
|
||||
// LESSPASS_MASTER_PASSWORD because profiles are meant to be complete
|
||||
// saved identities, including the master source.
|
||||
vaultPath := vaultFlag
|
||||
if vaultPath == "" {
|
||||
_, envSet := os.LookupEnv(environmentVariable)
|
||||
if !envSet && !forcePrompt && len(positional) < 3 {
|
||||
if !forcePrompt && len(positional) < 3 {
|
||||
switch {
|
||||
case profile.Vault != "":
|
||||
vaultPath = expandHome(profile.Vault)
|
||||
@@ -291,14 +288,15 @@ func masterPassword(positional []string, forcePrompt bool, vaultPath string) (st
|
||||
}
|
||||
|
||||
func printHelp(output io.Writer) {
|
||||
fmt.Fprintln(output, `Usage: gopass [OPTIONS] SITE LOGIN [MASTER_PASSWORD]
|
||||
fmt.Fprintln(output, `Usage: pass [OPTIONS] SITE LOGIN [MASTER_PASSWORD]
|
||||
pass [OPTIONS] PROFILE SITE
|
||||
|
||||
Derive a site-specific password. If MASTER_PASSWORD is omitted, gopass reads
|
||||
Derive a site-specific password. If MASTER_PASSWORD is omitted, pass reads
|
||||
LESSPASS_MASTER_PASSWORD or asks for it on the controlling terminal. With
|
||||
--vault it instead decrypts an OpenSSL-encrypted vault and uses its contents
|
||||
as the master password. With --profile, a named profile from the
|
||||
configuration file supplies the login and default settings and only SITE is
|
||||
passed on the command line.
|
||||
as the master password. A named profile from the configuration file can be
|
||||
used either as "pass PROFILE SITE" or with --profile; it supplies the login
|
||||
and default settings.
|
||||
|
||||
Options:
|
||||
-L, --length N password length (default 16)
|
||||
@@ -2,12 +2,24 @@ package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
password "github.com/waozixyz/gopass"
|
||||
password "github.com/waozixyz/pass"
|
||||
)
|
||||
|
||||
// TestMain isolates every test in this package from the developer's real
|
||||
// profiles file: without this, a machine with ~/.config/pass/profiles.json
|
||||
// would feed private configuration into the tests.
|
||||
func TestMain(m *testing.M) {
|
||||
configPath = func() string {
|
||||
return filepath.Join(os.TempDir(), "pass-tests-absent-profiles.json")
|
||||
}
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
|
||||
func TestRunWithArgument(t *testing.T) {
|
||||
var output, diagnostics bytes.Buffer
|
||||
err := run([]string{"example.com", "alice", "correct horse battery staple"}, &output, &diagnostics)
|
||||
@@ -52,8 +64,8 @@ func TestRunInformationOptions(t *testing.T) {
|
||||
argument string
|
||||
want string
|
||||
}{
|
||||
{"--version", "gopass " + password.Version},
|
||||
{"--help", "Usage: gopass"},
|
||||
{"--version", "pass " + password.Version},
|
||||
{"--help", "Usage: pass"},
|
||||
} {
|
||||
var output, diagnostics bytes.Buffer
|
||||
if err := run([]string{test.argument}, &output, &diagnostics); err != nil {
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
password "github.com/waozixyz/gopass"
|
||||
password "github.com/waozixyz/pass"
|
||||
)
|
||||
|
||||
// Profile holds the saved settings for one named identity: a login plus the
|
||||
@@ -30,7 +30,7 @@ type Profile struct {
|
||||
}
|
||||
|
||||
// Config is the optional profiles file. Every field is a default that flags
|
||||
// and profile entries override; a missing file leaves gopass fully stateless.
|
||||
// and profile entries override; a missing file leaves pass fully stateless.
|
||||
type Config struct {
|
||||
Vault string `json:"vault,omitempty"`
|
||||
Copy *bool `json:"copy,omitempty"`
|
||||
@@ -43,17 +43,17 @@ var configPath = defaultConfigPath
|
||||
|
||||
func defaultConfigPath() string {
|
||||
if dir := os.Getenv("XDG_CONFIG_HOME"); dir != "" {
|
||||
return filepath.Join(dir, "gopass", "profiles.json")
|
||||
return filepath.Join(dir, "pass", "profiles.json")
|
||||
}
|
||||
home, err := os.UserHomeDir()
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
return filepath.Join(home, ".config", "gopass", "profiles.json")
|
||||
return filepath.Join(home, ".config", "pass", "profiles.json")
|
||||
}
|
||||
|
||||
// loadConfig reads the profiles file. A missing file is not an error: the
|
||||
// feature is simply off and gopass behaves as a plain stateless generator.
|
||||
// feature is simply off and pass behaves as a plain stateless generator.
|
||||
func loadConfig() (*Config, error) {
|
||||
path := configPath()
|
||||
if path == "" {
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
password "github.com/waozixyz/gopass"
|
||||
password "github.com/waozixyz/pass"
|
||||
)
|
||||
|
||||
// withConfig points the config loader at a temporary file for one test.
|
||||
@@ -32,7 +32,6 @@ func withVaultPassphrase(t *testing.T, passphrase string) {
|
||||
|
||||
func TestRunWithProfileSettings(t *testing.T) {
|
||||
withConfig(t, `{
|
||||
"vault": "/nonexistent/vault",
|
||||
"copy": true,
|
||||
"clear_after": "90s",
|
||||
"profiles": {
|
||||
@@ -56,6 +55,29 @@ func TestRunWithProfileSettings(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestRunWithProfileShorthand(t *testing.T) {
|
||||
withConfig(t, `{
|
||||
"profiles": {
|
||||
"w": {"login": "alice", "counter": 9, "length": 23, "symbols": false}
|
||||
}
|
||||
}`)
|
||||
t.Setenv(environmentVariable, "correct horse battery staple")
|
||||
var output, diagnostics bytes.Buffer
|
||||
err := run([]string{"w", "example.com", "--no-copy"}, &output, &diagnostics)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
want, err := password.Generate("example.com", "alice", "correct horse battery staple", password.Options{
|
||||
Length: 23, Counter: 9, Lowercase: true, Uppercase: true, Digits: true, Symbols: false,
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if got := strings.TrimSpace(output.String()); got != want {
|
||||
t.Fatalf("output = %q, want %q", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestProfileSettingsDoNotOverrideExplicitFlags(t *testing.T) {
|
||||
withConfig(t, `{"profiles": {"w": {"login": "alice", "length": 23, "symbols": false}}}`)
|
||||
t.Setenv(environmentVariable, "correct horse battery staple")
|
||||
@@ -114,7 +136,7 @@ func TestVaultMasterPasswordBeatsEnvironmentAndPositional(t *testing.T) {
|
||||
if _, err := exec.LookPath("openssl"); err != nil {
|
||||
t.Skip("openssl not available")
|
||||
}
|
||||
vaultFile := filepath.Join(t.TempDir(), ".secret_vault")
|
||||
vaultFile := filepath.Join(t.TempDir(), ".vault")
|
||||
encrypt := `printf 'my-top-secret' | openssl enc -aes-256-cbc -md sha512 -a -pbkdf2 -iter 100000 -salt -pass pass:masterpw > ` + vaultFile
|
||||
if out, err := exec.Command("sh", "-c", encrypt).CombinedOutput(); err != nil {
|
||||
t.Fatalf("openssl encrypt failed: %v: %s", err, out)
|
||||
@@ -150,7 +172,7 @@ func TestConfigVaultIsUsedForProfile(t *testing.T) {
|
||||
if _, err := exec.LookPath("openssl"); err != nil {
|
||||
t.Skip("openssl not available")
|
||||
}
|
||||
vaultFile := filepath.Join(t.TempDir(), ".secret_vault")
|
||||
vaultFile := filepath.Join(t.TempDir(), ".vault")
|
||||
encrypt := `printf 'cfg-secret' | openssl enc -aes-256-cbc -md sha512 -a -pbkdf2 -iter 100000 -salt -pass pass:masterpw > ` + vaultFile
|
||||
if out, err := exec.Command("sh", "-c", encrypt).CombinedOutput(); err != nil {
|
||||
t.Fatalf("openssl encrypt failed: %v: %s", err, out)
|
||||
@@ -158,9 +180,10 @@ func TestConfigVaultIsUsedForProfile(t *testing.T) {
|
||||
|
||||
withConfig(t, `{"vault": "`+vaultFile+`", "profiles": {"w": {"login": "alice"}}}`)
|
||||
withVaultPassphrase(t, "masterpw")
|
||||
t.Setenv(environmentVariable, "environment-must-be-ignored")
|
||||
|
||||
var output, diagnostics bytes.Buffer
|
||||
if err := run([]string{"-P", "w", "--no-copy", "example.com"}, &output, &diagnostics); err != nil {
|
||||
if err := run([]string{"w", "example.com", "--no-copy"}, &output, &diagnostics); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
want, err := password.Generate("example.com", "alice", "cfg-secret", password.DefaultOptions())
|
||||
@@ -179,7 +202,7 @@ func TestExpandHome(t *testing.T) {
|
||||
}
|
||||
for _, test := range []struct{ in, want string }{
|
||||
{"~", home},
|
||||
{"~/bin/.secret_vault", filepath.Join(home, "bin", ".secret_vault")},
|
||||
{"~/bin/.vault", filepath.Join(home, "bin", ".vault")},
|
||||
{"/abs/path", "/abs/path"},
|
||||
{"relative", "relative"},
|
||||
} {
|
||||
@@ -193,7 +216,7 @@ func TestVaultPassphraseFromPipedStdin(t *testing.T) {
|
||||
if _, err := exec.LookPath("openssl"); err != nil {
|
||||
t.Skip("openssl not available")
|
||||
}
|
||||
vaultFile := filepath.Join(t.TempDir(), ".secret_vault")
|
||||
vaultFile := filepath.Join(t.TempDir(), ".vault")
|
||||
encrypt := `printf 'piped-secret' | openssl enc -aes-256-cbc -md sha512 -a -pbkdf2 -iter 100000 -salt -pass pass:masterpw > ` + vaultFile
|
||||
if out, err := exec.Command("sh", "-c", encrypt).CombinedOutput(); err != nil {
|
||||
t.Fatalf("openssl encrypt failed: %v: %s", err, out)
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+34
-2
@@ -12,12 +12,43 @@ android {
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
def keystorePropsFile = rootProject.file("local.properties")
|
||||
def keystoreProps = new Properties()
|
||||
if (keystorePropsFile.exists()) {
|
||||
keystoreProps.load(new FileInputStream(keystorePropsFile))
|
||||
}
|
||||
|
||||
def getKeystorePath = { -> project.findProperty('keystore.path') ?: keystoreProps['keystore.path'] ?: System.getenv("HOME") + "/.android/pass-release.keystore" }
|
||||
def getKeystoreAlias = { -> project.findProperty('keystore.alias') ?: keystoreProps['keystore.alias'] ?: "pass-key" }
|
||||
|
||||
def releasePassword = project.findProperty('keystore.password') ?: ""
|
||||
|
||||
def releaseKeystorePath = getKeystorePath()
|
||||
def releaseKeystore = releaseKeystorePath ? file(releaseKeystorePath) : null
|
||||
// Sign release builds only when a keystore is actually available: CI and
|
||||
// local release builds pass -Pkeystore.* properties, while clean checkouts
|
||||
// (for example an F-Droid builder) produce an unsigned APK instead.
|
||||
def signRelease = !project.hasProperty('fDroidBuild') \
|
||||
&& releaseKeystore != null && releaseKeystore.exists() \
|
||||
&& releasePassword != ""
|
||||
|
||||
signingConfigs {
|
||||
release {
|
||||
if (signRelease) {
|
||||
storeFile releaseKeystore
|
||||
storePassword releasePassword
|
||||
keyAlias getKeystoreAlias()
|
||||
keyPassword releasePassword
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
applicationId 'xyz.waozi.pass'
|
||||
minSdk 21
|
||||
targetSdk 36
|
||||
versionCode 2
|
||||
versionName "0.2.0"
|
||||
versionCode 4
|
||||
versionName "0.2.3"
|
||||
// Default to the two realistic phone targets; override with
|
||||
// -Pabi=x86_64 etc. for emulator builds.
|
||||
def abis = project.findProperty('abi') ?: 'armeabi-v7a,arm64-v8a'
|
||||
@@ -28,6 +59,7 @@ android {
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
signingConfig signRelease ? signingConfigs.release : null
|
||||
minifyEnabled false
|
||||
}
|
||||
debug {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- gopass generates passwords entirely offline; no permissions needed. -->
|
||||
<uses-permission android:name="android.permission.USE_BIOMETRIC" />
|
||||
<uses-permission android:name="android.permission.USE_FINGERPRINT" />
|
||||
|
||||
<application
|
||||
android:hasCode="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
cmake_minimum_required(VERSION 3.22)
|
||||
project(Gopass C)
|
||||
project(Pass C)
|
||||
|
||||
set(REPO_ROOT "${CMAKE_CURRENT_LIST_DIR}/../../../../..")
|
||||
set(KRYON_DIR "${REPO_ROOT}/vendor/kryon")
|
||||
set(RAYLIB_DIR "${KRYON_DIR}/vendor/raylib/src")
|
||||
set(GOPASS_NATIVE_DIR "${REPO_ROOT}/native")
|
||||
set(PASS_NATIVE_DIR "${REPO_ROOT}/native")
|
||||
set(NATIVE_APP_GLUE_DIR "${ANDROID_NDK}/sources/android/native_app_glue")
|
||||
|
||||
file(GLOB_RECURSE KRYON_SOURCES CONFIGURE_DEPENDS "${KRYON_DIR}/src/*.c")
|
||||
@@ -12,24 +12,26 @@ 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/.*")
|
||||
# gopass uses no 2D physics; mirror the desktop Makefile's physics filter.
|
||||
# pass uses no 2D physics; mirror the desktop Makefile's physics filter.
|
||||
list(REMOVE_ITEM KRYON_SOURCES
|
||||
"${KRYON_DIR}/src/scene/physics_world.c"
|
||||
"${KRYON_DIR}/src/scene/node_body2d.c"
|
||||
"${KRYON_DIR}/src/scene/node_area2d.c"
|
||||
"${KRYON_DIR}/src/scene/node_collision_shape2d.c")
|
||||
# Ksync account crypto requires liboqs and gopass never syncs; runtime asset
|
||||
# downloads need an Android download backend gopass does not provide.
|
||||
# Ksync account crypto requires liboqs and pass never syncs; runtime asset
|
||||
# downloads need an Android download backend pass does not provide.
|
||||
list(FILTER KRYON_SOURCES EXCLUDE REGEX "${KRYON_DIR}/src/ksync/.*")
|
||||
list(FILTER KRYON_SOURCES EXCLUDE REGEX "${KRYON_DIR}/src/runtime_assets/.*")
|
||||
list(FILTER KRYON_SOURCES EXCLUDE REGEX "${KRYON_DIR}/src/notification/.*")
|
||||
list(REMOVE_ITEM KRYON_SOURCES "${KRYON_DIR}/src/file_dialog/file_dialog.c")
|
||||
|
||||
set(GOPASS_FONT_ASSET "vendor/kryon/fonts/noto/NotoSans-Regular.ttf")
|
||||
set(GOPASS_EMBEDDED_ASSETS_C "${CMAKE_BINARY_DIR}/gopass_embedded_assets.c")
|
||||
set(PASS_FONT_ASSET "vendor/kryon/fonts/noto/NotoSans-Regular.ttf")
|
||||
set(PASS_EMOJI_FONT_ASSET "gui/assets/emoji.ttf")
|
||||
set(PASS_EMBEDDED_ASSETS_C "${CMAKE_BINARY_DIR}/pass_embedded_assets.c")
|
||||
add_custom_command(
|
||||
OUTPUT "${GOPASS_EMBEDDED_ASSETS_C}"
|
||||
COMMAND sh "${KRYON_DIR}/scripts/embed-assets.sh" "${GOPASS_EMBEDDED_ASSETS_C}" "${GOPASS_FONT_ASSET}"
|
||||
DEPENDS "${KRYON_DIR}/scripts/embed-assets.sh" "${KRYON_DIR}/fonts/noto/NotoSans-Regular.ttf"
|
||||
OUTPUT "${PASS_EMBEDDED_ASSETS_C}"
|
||||
COMMAND sh "${KRYON_DIR}/scripts/embed-assets.sh" "${PASS_EMBEDDED_ASSETS_C}" "${PASS_FONT_ASSET}" "${PASS_EMOJI_FONT_ASSET}"
|
||||
DEPENDS "${KRYON_DIR}/scripts/embed-assets.sh" "${KRYON_DIR}/fonts/noto/NotoSans-Regular.ttf" "${REPO_ROOT}/${PASS_EMOJI_FONT_ASSET}"
|
||||
WORKING_DIRECTORY "${REPO_ROOT}"
|
||||
VERBATIM
|
||||
)
|
||||
@@ -73,10 +75,10 @@ target_include_directories(raylib PUBLIC
|
||||
|
||||
add_library(main SHARED
|
||||
main.c
|
||||
gopass_app.c
|
||||
pass_app.c
|
||||
android_bridge.c
|
||||
"${GOPASS_NATIVE_DIR}/gopass_core.c"
|
||||
"${GOPASS_EMBEDDED_ASSETS_C}"
|
||||
"${PASS_NATIVE_DIR}/pass_core.c"
|
||||
"${PASS_EMBEDDED_ASSETS_C}"
|
||||
${KRYON_SOURCES}
|
||||
"${NATIVE_APP_GLUE_DIR}/android_native_app_glue.c"
|
||||
)
|
||||
@@ -84,7 +86,7 @@ add_library(main SHARED
|
||||
target_include_directories(main PRIVATE
|
||||
"${KRYON_DIR}/include"
|
||||
"${KRYON_DIR}/src"
|
||||
"${GOPASS_NATIVE_DIR}"
|
||||
"${PASS_NATIVE_DIR}"
|
||||
"${NATIVE_APP_GLUE_DIR}"
|
||||
)
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Minimal JNI bridge for the gopass Android app: safe-area insets, display
|
||||
/* 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. */
|
||||
|
||||
@@ -7,12 +7,15 @@
|
||||
#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);
|
||||
|
||||
@@ -20,7 +23,7 @@ extern struct android_app *GetAndroidApp(void);
|
||||
#define JNI_VERSION_1_6 0x10060000
|
||||
#endif
|
||||
|
||||
#define LOG_TAG "GOPASS_JNI"
|
||||
#define LOG_TAG "PASS_JNI"
|
||||
|
||||
static pthread_mutex_t bridge_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
static int insets_status_bar = 0;
|
||||
@@ -38,6 +41,42 @@ scaled_inset(int java_px, float density)
|
||||
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)
|
||||
{
|
||||
@@ -51,6 +90,69 @@ android_bridge_init(void)
|
||||
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_top_reserved(void)
|
||||
{
|
||||
@@ -92,26 +194,17 @@ android_bridge_bottom_reserved(void)
|
||||
void
|
||||
android_bridge_set_soft_keyboard(int visible)
|
||||
{
|
||||
struct android_app *app = GetAndroidApp();
|
||||
JavaVM *jvm;
|
||||
JNIEnv *env = NULL;
|
||||
jobject activity;
|
||||
jclass activity_class;
|
||||
jmethodID method;
|
||||
int attached = 0;
|
||||
int attached;
|
||||
|
||||
if(app == NULL || app->activity == NULL || app->activity->vm == NULL ||
|
||||
app->activity->clazz == NULL)
|
||||
attached = activity_env(&env, &jvm, &activity);
|
||||
if(attached < 0)
|
||||
return;
|
||||
|
||||
jvm = app->activity->vm;
|
||||
activity = app->activity->clazz;
|
||||
if((*jvm)->GetEnv(jvm, (void **)&env, JNI_VERSION_1_6) != JNI_OK) {
|
||||
if((*jvm)->AttachCurrentThread(jvm, &env, NULL) != JNI_OK || env == NULL)
|
||||
return;
|
||||
attached = 1;
|
||||
}
|
||||
|
||||
activity_class = (*env)->GetObjectClass(env, activity);
|
||||
if(activity_class == NULL)
|
||||
goto done;
|
||||
@@ -125,12 +218,196 @@ android_bridge_set_soft_keyboard(int visible)
|
||||
(*env)->CallVoidMethod(env, activity, method, visible ? JNI_TRUE : JNI_FALSE);
|
||||
|
||||
done:
|
||||
if((*env)->ExceptionCheck(env)) {
|
||||
(*env)->ExceptionDescribe(env);
|
||||
(*env)->ExceptionClear(env);
|
||||
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);
|
||||
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);
|
||||
}
|
||||
if(attached)
|
||||
(*jvm)->DetachCurrentThread(jvm);
|
||||
(*env)->DeleteLocalRef(env, result);
|
||||
|
||||
done:
|
||||
activity_env_done(env, jvm, attached);
|
||||
return status;
|
||||
}
|
||||
|
||||
/* ---- Java -> C natives (exported JNI symbols; RegisterNatives from
|
||||
@@ -198,8 +475,18 @@ Java_xyz_waozi_pass_MainActivity_nativeTextInputEnter(JNIEnv *env, jobject thiz)
|
||||
#else /* !ANDROID_BUILD */
|
||||
|
||||
void android_bridge_init(void) {}
|
||||
void android_bridge_apply_system_theme(void) {}
|
||||
int android_bridge_top_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,5 +1,5 @@
|
||||
#ifndef GOPASS_ANDROID_BRIDGE_H
|
||||
#define GOPASS_ANDROID_BRIDGE_H
|
||||
#ifndef PASS_ANDROID_BRIDGE_H
|
||||
#define PASS_ANDROID_BRIDGE_H
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
@@ -7,6 +7,7 @@ extern "C" {
|
||||
|
||||
/* 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). Returns 0
|
||||
* until Java has reported real values; callers should treat 0 as "unknown"
|
||||
@@ -17,6 +18,16 @@ 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
|
||||
|
||||
@@ -1,521 +0,0 @@
|
||||
/* C port of the gopass desktop GUI (gui/main.go) for the Android build.
|
||||
* The desktop branch keeps the Go layout; this port adds a narrow-screen
|
||||
* layout for phones: single column, two-abreast rules, scrollable card. */
|
||||
|
||||
#include "gopass_app.h"
|
||||
#include "gopass_core.h"
|
||||
|
||||
#include "kryon.h"
|
||||
#include "embedded_assets.h"
|
||||
#include "ui_scroll.h"
|
||||
#include "ui_scaling.h"
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
#define CLIPBOARD_LIFETIME_MS 20000
|
||||
|
||||
typedef struct {
|
||||
char buffer[1024];
|
||||
int cursor;
|
||||
int focused;
|
||||
int commit;
|
||||
int focus_id;
|
||||
int max_codepoints;
|
||||
int secure;
|
||||
} Field;
|
||||
|
||||
static void
|
||||
field_init(Field *f, int focus_id, int capacity_codepoints)
|
||||
{
|
||||
memset(f, 0, sizeof(*f));
|
||||
f->focus_id = focus_id;
|
||||
f->max_codepoints = capacity_codepoints;
|
||||
}
|
||||
|
||||
static const char *
|
||||
field_text(const Field *f)
|
||||
{
|
||||
return f->buffer;
|
||||
}
|
||||
|
||||
static void
|
||||
field_clear(Field *f)
|
||||
{
|
||||
memset(f->buffer, 0, sizeof(f->buffer));
|
||||
f->cursor = 0;
|
||||
}
|
||||
|
||||
struct GopassApp {
|
||||
Field site, login, master, exclude;
|
||||
int length, counter;
|
||||
int lower, upper, digits, symbols;
|
||||
int reveal;
|
||||
char generated[136];
|
||||
char message[160];
|
||||
/* clipboard lease */
|
||||
char clip_value[136];
|
||||
int64_t clip_expires_ms;
|
||||
int clip_has_value;
|
||||
int scroll_offset;
|
||||
};
|
||||
|
||||
static int64_t
|
||||
now_ms(void)
|
||||
{
|
||||
struct timespec ts;
|
||||
|
||||
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||
return (int64_t)ts.tv_sec * 1000 + ts.tv_nsec / 1000000;
|
||||
}
|
||||
|
||||
static void
|
||||
clipboard_copy(GopassApp *a, const char *value)
|
||||
{
|
||||
SetClipboardText(value);
|
||||
snprintf(a->clip_value, sizeof(a->clip_value), "%s", value);
|
||||
a->clip_expires_ms = now_ms() + CLIPBOARD_LIFETIME_MS;
|
||||
a->clip_has_value = 1;
|
||||
}
|
||||
|
||||
static void
|
||||
clipboard_tick(GopassApp *a)
|
||||
{
|
||||
const char *current;
|
||||
|
||||
if(!a->clip_has_value || now_ms() < a->clip_expires_ms)
|
||||
return;
|
||||
current = GetClipboardText();
|
||||
if(current != NULL && strcmp(current, a->clip_value) == 0)
|
||||
SetClipboardText("");
|
||||
a->clip_has_value = 0;
|
||||
a->clip_value[0] = '\0';
|
||||
}
|
||||
|
||||
static void
|
||||
clipboard_clear(GopassApp *a)
|
||||
{
|
||||
const char *current;
|
||||
|
||||
if(a->clip_has_value) {
|
||||
current = GetClipboardText();
|
||||
if(current != NULL && strcmp(current, a->clip_value) == 0)
|
||||
SetClipboardText("");
|
||||
}
|
||||
a->clip_has_value = 0;
|
||||
a->clip_value[0] = '\0';
|
||||
}
|
||||
|
||||
static void
|
||||
generate(GopassApp *a)
|
||||
{
|
||||
GopassOptions options;
|
||||
char err[160];
|
||||
|
||||
memset(&options, 0, sizeof(options));
|
||||
options.length = a->length;
|
||||
options.counter = (uint64_t)a->counter;
|
||||
options.lowercase = a->lower;
|
||||
options.uppercase = a->upper;
|
||||
options.digits = a->digits;
|
||||
options.symbols = a->symbols;
|
||||
options.exclude = a->exclude.buffer;
|
||||
|
||||
if(gopass_generate(field_text(&a->site), field_text(&a->login),
|
||||
field_text(&a->master), &options,
|
||||
a->generated, sizeof(a->generated),
|
||||
err, sizeof(err)) != 0) {
|
||||
a->generated[0] = '\0';
|
||||
snprintf(a->message, sizeof(a->message), "%s", err);
|
||||
return;
|
||||
}
|
||||
snprintf(a->message, sizeof(a->message), "%s", "Password generated locally");
|
||||
}
|
||||
|
||||
static UITextInputStyle
|
||||
input_style(void)
|
||||
{
|
||||
UIMaterialScheme s = GetUIMaterialScheme();
|
||||
UITextInputStyle style;
|
||||
|
||||
memset(&style, 0, sizeof(style));
|
||||
style.background = s.surface_container;
|
||||
style.border = s.outline;
|
||||
style.focus_border = s.primary;
|
||||
style.text = s.on_surface;
|
||||
style.cursor = s.primary;
|
||||
style.radius = 6.0f;
|
||||
style.padding_x = 10;
|
||||
style.padding_y = 8;
|
||||
return style;
|
||||
}
|
||||
|
||||
static int
|
||||
draw_field(Field *f, Rectangle bounds, int font, UITextInputStyle style)
|
||||
{
|
||||
TextFieldProps props;
|
||||
|
||||
memset(&props, 0, sizeof(props));
|
||||
props.bounds = bounds;
|
||||
props.text = f->buffer;
|
||||
props.text_size = sizeof(f->buffer);
|
||||
props.cursor_position = &f->cursor;
|
||||
props.focused = &f->focused;
|
||||
props.max_codepoints = f->max_codepoints;
|
||||
props.font = font;
|
||||
props.focus_id = f->focus_id;
|
||||
props.style = style;
|
||||
props.commit_pressed = &f->commit;
|
||||
props.secure = f->secure;
|
||||
return DrawUITextField(props);
|
||||
}
|
||||
|
||||
static int
|
||||
button(int x, int y, int w, int h, const char *label, UIButtonStyle style, int disabled)
|
||||
{
|
||||
int hover = 0;
|
||||
|
||||
return DrawUIGenericButton(x, y, w, h, label, style, disabled, &hover);
|
||||
}
|
||||
|
||||
static void
|
||||
checkbox(int x, int y, const char *label, int *value)
|
||||
{
|
||||
DrawUICheckboxToggle(x, y, label, value);
|
||||
}
|
||||
|
||||
static Rectangle
|
||||
scaled_rect(float x, float y, float w, float h)
|
||||
{
|
||||
Rectangle r;
|
||||
|
||||
r.x = (float)ScaleUIPx((int)x);
|
||||
r.y = (float)ScaleUIPx((int)y);
|
||||
r.width = (float)ScaleUIPx((int)w);
|
||||
r.height = (float)ScaleUIPx((int)h);
|
||||
return r;
|
||||
}
|
||||
|
||||
static void
|
||||
label_text(const char *text, int x, int y, int font, Color color)
|
||||
{
|
||||
Text(text, ScaleUIPx(x), ScaleUIPx(y), font, color);
|
||||
}
|
||||
|
||||
GopassApp *
|
||||
gopass_app(void)
|
||||
{
|
||||
static GopassApp app;
|
||||
static int initialized;
|
||||
|
||||
if(!initialized) {
|
||||
initialized = 1;
|
||||
field_init(&app.site, 101, 256);
|
||||
field_init(&app.login, 102, 256);
|
||||
field_init(&app.master, 103, 1024);
|
||||
field_init(&app.exclude, 104, 128);
|
||||
app.length = 16;
|
||||
app.counter = 1;
|
||||
app.lower = app.upper = app.digits = app.symbols = 1;
|
||||
}
|
||||
return &app;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* Wide layout: mirrors gui/main.go */
|
||||
/* ------------------------------------------------------------------ */
|
||||
|
||||
static void
|
||||
draw_wide(GopassApp *a, int width, int height, int top_reserved)
|
||||
{
|
||||
UIMaterialScheme scheme = GetUIMaterialScheme();
|
||||
Color text = GetThemeText();
|
||||
UITextInputStyle style = input_style();
|
||||
int content_w = width - 64;
|
||||
int x, y;
|
||||
|
||||
if(content_w > 720)
|
||||
content_w = 720;
|
||||
x = (width - content_w) / 2;
|
||||
y = 22 + top_reserved;
|
||||
|
||||
DrawRectangleRounded(scaled_rect((float)x, (float)y, 48, 48), 0.22f, 10, scheme.primary);
|
||||
label_text("g", x + 15, y + 7, 32, scheme.on_primary);
|
||||
label_text("gopass", x + 64, y + 2, 32, text);
|
||||
label_text("Private by design - generated on this device",
|
||||
x + 64, y + 38, 14, scheme.on_surface_variant);
|
||||
y += 70;
|
||||
DrawRectangleRounded(scaled_rect((float)x, (float)y, (float)content_w, 550), 0.035f, 10, scheme.surface);
|
||||
DrawRectangleLinesEx(scaled_rect((float)x, (float)y, (float)content_w, 550), 1.0f, scheme.outline);
|
||||
label_text("PASSWORD DETAILS", x + 24, y + 24, 12, scheme.primary);
|
||||
|
||||
y += 54;
|
||||
label_text("Site", x + 24, y, 14, text);
|
||||
draw_field(&a->site, scaled_rect((float)x + 24, (float)y + 24, (float)content_w - 48, 38), 16, style);
|
||||
y += 76;
|
||||
label_text("Login", x + 24, y, 14, text);
|
||||
draw_field(&a->login, scaled_rect((float)x + 24, (float)y + 24, (float)content_w - 48, 38), 16, style);
|
||||
y += 76;
|
||||
label_text("Master password", x + 24, y, 14, text);
|
||||
a->master.secure = !a->reveal;
|
||||
draw_field(&a->master, scaled_rect((float)x + 24, (float)y + 24, (float)content_w - 150, 38), 16, style);
|
||||
if(button(ScaleUIPx(x + content_w - 112), ScaleUIPx(y + 24), ScaleUIPx(88), ScaleUIPx(38),
|
||||
a->reveal ? "Hide" : "Reveal", UI_BUTTON_STYLE_SECONDARY, 0))
|
||||
a->reveal = !a->reveal;
|
||||
y += 76;
|
||||
|
||||
label_text("PASSWORD RULES", x + 24, y - 10, 12, scheme.primary);
|
||||
y += 14;
|
||||
label_text("Length", x + 24, y, 14, text);
|
||||
{
|
||||
SpinboxProps props;
|
||||
|
||||
memset(&props, 0, sizeof(props));
|
||||
props.bounds = scaled_rect((float)x + 24, (float)y + 24, 130, 38);
|
||||
props.id = 301;
|
||||
props.min = 1;
|
||||
props.max = 128;
|
||||
props.step = 1;
|
||||
props.value = &a->length;
|
||||
Spinbox(props);
|
||||
}
|
||||
label_text("Counter", x + 182, y, 14, text);
|
||||
{
|
||||
SpinboxProps props;
|
||||
|
||||
memset(&props, 0, sizeof(props));
|
||||
props.bounds = scaled_rect((float)x + 182, (float)y + 24, 130, 38);
|
||||
props.id = 302;
|
||||
props.min = 1;
|
||||
props.max = 999999;
|
||||
props.step = 1;
|
||||
props.value = &a->counter;
|
||||
Spinbox(props);
|
||||
}
|
||||
draw_field(&a->exclude, scaled_rect((float)x + 340, (float)y + 24, (float)content_w - 364, 38), 16, style);
|
||||
label_text("Excluded characters", x + 340, y, 14, text);
|
||||
y += 76;
|
||||
|
||||
checkbox(ScaleUIPx(x + 24), ScaleUIPx(y), "Lowercase", &a->lower);
|
||||
checkbox(ScaleUIPx(x + 174), ScaleUIPx(y), "Uppercase", &a->upper);
|
||||
checkbox(ScaleUIPx(x + 324), ScaleUIPx(y), "Digits", &a->digits);
|
||||
checkbox(ScaleUIPx(x + 444), ScaleUIPx(y), "Symbols", &a->symbols);
|
||||
y += 48;
|
||||
|
||||
if(button(ScaleUIPx(x + 24), ScaleUIPx(y), ScaleUIPx(150), ScaleUIPx(42),
|
||||
"Generate", UI_BUTTON_STYLE_PRIMARY, 0))
|
||||
generate(a);
|
||||
if(button(ScaleUIPx(x + 190), ScaleUIPx(y), ScaleUIPx(150), ScaleUIPx(42),
|
||||
"Copy for 20s", UI_BUTTON_STYLE_SECONDARY, a->generated[0] == '\0')) {
|
||||
clipboard_copy(a, a->generated);
|
||||
snprintf(a->message, sizeof(a->message), "%s", "Copied; clipboard clears in 20 seconds");
|
||||
}
|
||||
if(button(ScaleUIPx(x + 356), ScaleUIPx(y), ScaleUIPx(120), ScaleUIPx(42),
|
||||
"Clear", UI_BUTTON_STYLE_SECONDARY, 0)) {
|
||||
field_clear(&a->master);
|
||||
a->generated[0] = '\0';
|
||||
snprintf(a->message, sizeof(a->message), "%s", "Cleared");
|
||||
}
|
||||
y += 56;
|
||||
|
||||
DrawRectangleRounded(scaled_rect((float)x + 24, (float)y, (float)content_w - 48, 72), 0.08f, 10, scheme.surface_container);
|
||||
if(a->generated[0] != '\0')
|
||||
label_text(a->generated, x + 42, y + 15, 20, text);
|
||||
else
|
||||
label_text("Your generated password appears here", x + 42, y + 17, 16, scheme.on_surface_variant);
|
||||
if(a->message[0] != '\0')
|
||||
label_text(a->message, x + 42, y + 45, 12, scheme.on_surface_variant);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* Narrow phone layout: single column inside a scrollable card */
|
||||
/* ------------------------------------------------------------------ */
|
||||
|
||||
static void
|
||||
draw_narrow(GopassApp *a, int width, int height, int top_reserved, int bottom_reserved)
|
||||
{
|
||||
UIMaterialScheme scheme = GetUIMaterialScheme();
|
||||
Color text = GetThemeText();
|
||||
UITextInputStyle style = input_style();
|
||||
UIScrollArea area;
|
||||
UIScrollView view;
|
||||
int margin = 12;
|
||||
int card_x = margin;
|
||||
int card_y = top_reserved + 62;
|
||||
int card_w = width - margin * 2;
|
||||
int card_h = height - bottom_reserved - margin - card_y;
|
||||
int pad = 18;
|
||||
int inner_x = card_x + pad;
|
||||
int inner_w = card_w - pad * 2;
|
||||
int half_w = (inner_w - 12) / 2;
|
||||
int content_h;
|
||||
int x, y, cx, cy;
|
||||
Rectangle card;
|
||||
|
||||
if(card_h < 200)
|
||||
card_h = 200;
|
||||
|
||||
/* compact header */
|
||||
DrawRectangleRounded(scaled_rect((float)margin, (float)top_reserved + 8, 40, 40), 0.22f, 10, scheme.primary);
|
||||
label_text("g", margin + 13, top_reserved + 15, 24, scheme.on_primary);
|
||||
label_text("gopass", margin + 52, top_reserved + 6, 24, text);
|
||||
label_text("Private by design \xc2\xb7 generated on this device",
|
||||
margin + 52, top_reserved + 36, 12, scheme.on_surface_variant);
|
||||
|
||||
/* content height (UI units): sections and rows below */
|
||||
content_h = 20 /* section label */
|
||||
+ 3 * 66 /* site, login, master rows */
|
||||
+ 20 + 62 /* rules label + spinbox row */
|
||||
+ 66 /* excluded characters */
|
||||
+ 2 * 36 /* checkbox rows */
|
||||
+ 50 /* generate */
|
||||
+ 50 /* copy/clear row */
|
||||
+ 78 /* result box */
|
||||
+ pad;
|
||||
|
||||
card = scaled_rect((float)card_x, (float)card_y, (float)card_w, (float)card_h);
|
||||
DrawRectangleRounded(card, 0.035f, 10, scheme.surface);
|
||||
DrawRectangleLinesEx(card, 1.0f, scheme.outline);
|
||||
|
||||
memset(&area, 0, sizeof(area));
|
||||
area.bounds = card;
|
||||
area.content_height = ScaleUIPx(content_h);
|
||||
area.content_x = ScaleUIPx(inner_x);
|
||||
area.content_width = ScaleUIPx(inner_w);
|
||||
area.scroll_offset = &a->scroll_offset;
|
||||
view = BeginUIScrollContainer(area);
|
||||
cx = view.content_x;
|
||||
cy = view.content_y;
|
||||
/* positions in UI units relative to content origin */
|
||||
x = 0;
|
||||
y = 0;
|
||||
|
||||
label_text("PASSWORD DETAILS", cx + ScaleUIPx(x), cy + ScaleUIPx(y), 12, scheme.primary);
|
||||
y += 20;
|
||||
|
||||
label_text("Site", cx + ScaleUIPx(x), cy + ScaleUIPx(y), 14, text);
|
||||
draw_field(&a->site, (Rectangle){(float)(cx + ScaleUIPx(x)), (float)(cy + ScaleUIPx(y + 22)),
|
||||
(float)ScaleUIPx(inner_w), (float)ScaleUIPx(38)}, 16, style);
|
||||
y += 66;
|
||||
|
||||
label_text("Login", cx + ScaleUIPx(x), cy + ScaleUIPx(y), 14, text);
|
||||
draw_field(&a->login, (Rectangle){(float)(cx + ScaleUIPx(x)), (float)(cy + ScaleUIPx(y + 22)),
|
||||
(float)ScaleUIPx(inner_w), (float)ScaleUIPx(38)}, 16, style);
|
||||
y += 66;
|
||||
|
||||
label_text("Master password", cx + ScaleUIPx(x), cy + ScaleUIPx(y), 14, text);
|
||||
a->master.secure = !a->reveal;
|
||||
{
|
||||
int field_w = inner_w - 80;
|
||||
|
||||
draw_field(&a->master, (Rectangle){(float)(cx + ScaleUIPx(x)), (float)(cy + ScaleUIPx(y + 22)),
|
||||
(float)ScaleUIPx(field_w), (float)ScaleUIPx(38)}, 16, style);
|
||||
if(button(cx + ScaleUIPx(x + field_w + 8), cy + ScaleUIPx(y + 22), ScaleUIPx(72), ScaleUIPx(38),
|
||||
a->reveal ? "Hide" : "Reveal", UI_BUTTON_STYLE_SECONDARY, 0))
|
||||
a->reveal = !a->reveal;
|
||||
}
|
||||
y += 66;
|
||||
|
||||
label_text("PASSWORD RULES", cx + ScaleUIPx(x), cy + ScaleUIPx(y), 12, scheme.primary);
|
||||
y += 18;
|
||||
label_text("Length", cx + ScaleUIPx(x), cy + ScaleUIPx(y), 14, text);
|
||||
{
|
||||
SpinboxProps props;
|
||||
|
||||
memset(&props, 0, sizeof(props));
|
||||
props.bounds = (Rectangle){(float)(cx + ScaleUIPx(x)), (float)(cy + ScaleUIPx(y + 20)),
|
||||
(float)ScaleUIPx(half_w), (float)ScaleUIPx(38)};
|
||||
props.id = 301;
|
||||
props.min = 1;
|
||||
props.max = 128;
|
||||
props.step = 1;
|
||||
props.value = &a->length;
|
||||
Spinbox(props);
|
||||
}
|
||||
label_text("Counter", cx + ScaleUIPx(x + half_w + 12), cy + ScaleUIPx(y), 14, text);
|
||||
{
|
||||
SpinboxProps props;
|
||||
|
||||
memset(&props, 0, sizeof(props));
|
||||
props.bounds = (Rectangle){(float)(cx + ScaleUIPx(x + half_w + 12)), (float)(cy + ScaleUIPx(y + 20)),
|
||||
(float)ScaleUIPx(half_w), (float)ScaleUIPx(38)};
|
||||
props.id = 302;
|
||||
props.min = 1;
|
||||
props.max = 999999;
|
||||
props.step = 1;
|
||||
props.value = &a->counter;
|
||||
Spinbox(props);
|
||||
}
|
||||
y += 62;
|
||||
|
||||
label_text("Excluded characters", cx + ScaleUIPx(x), cy + ScaleUIPx(y), 14, text);
|
||||
draw_field(&a->exclude, (Rectangle){(float)(cx + ScaleUIPx(x)), (float)(cy + ScaleUIPx(y + 22)),
|
||||
(float)ScaleUIPx(inner_w), (float)ScaleUIPx(38)}, 16, style);
|
||||
y += 66;
|
||||
|
||||
checkbox(cx + ScaleUIPx(x), cy + ScaleUIPx(y), "Lowercase", &a->lower);
|
||||
checkbox(cx + ScaleUIPx(x + half_w + 12), cy + ScaleUIPx(y), "Uppercase", &a->upper);
|
||||
y += 36;
|
||||
checkbox(cx + ScaleUIPx(x), cy + ScaleUIPx(y), "Digits", &a->digits);
|
||||
checkbox(cx + ScaleUIPx(x + half_w + 12), cy + ScaleUIPx(y), "Symbols", &a->symbols);
|
||||
y += 44;
|
||||
|
||||
if(button(cx + ScaleUIPx(x), cy + ScaleUIPx(y), ScaleUIPx(inner_w), ScaleUIPx(42),
|
||||
"Generate", UI_BUTTON_STYLE_PRIMARY, 0))
|
||||
generate(a);
|
||||
y += 50;
|
||||
if(button(cx + ScaleUIPx(x), cy + ScaleUIPx(y), ScaleUIPx(half_w), ScaleUIPx(42),
|
||||
"Copy for 20s", UI_BUTTON_STYLE_SECONDARY, a->generated[0] == '\0')) {
|
||||
clipboard_copy(a, a->generated);
|
||||
snprintf(a->message, sizeof(a->message), "%s", "Copied; clipboard clears in 20 seconds");
|
||||
}
|
||||
if(button(cx + ScaleUIPx(x + half_w + 12), cy + ScaleUIPx(y), ScaleUIPx(half_w), ScaleUIPx(42),
|
||||
"Clear", UI_BUTTON_STYLE_SECONDARY, 0)) {
|
||||
field_clear(&a->master);
|
||||
a->generated[0] = '\0';
|
||||
snprintf(a->message, sizeof(a->message), "%s", "Cleared");
|
||||
}
|
||||
y += 50;
|
||||
|
||||
DrawRectangleRounded((Rectangle){(float)(cx + ScaleUIPx(x)), (float)(cy + ScaleUIPx(y)),
|
||||
(float)ScaleUIPx(inner_w), (float)ScaleUIPx(72)}, 0.08f, 10,
|
||||
scheme.surface_container);
|
||||
if(a->generated[0] != '\0')
|
||||
DrawUITextInRect(a->generated,
|
||||
(Rectangle){(float)(cx + ScaleUIPx(x + 14)), (float)(cy + ScaleUIPx(y + 8)),
|
||||
(float)ScaleUIPx(inner_w - 28), (float)ScaleUIPx(40)},
|
||||
16, text);
|
||||
else
|
||||
label_text("Your generated password appears here", x + 14, y + 14, 14, scheme.on_surface_variant);
|
||||
if(a->message[0] != '\0')
|
||||
label_text(a->message, x + 14, y + 50, 11, scheme.on_surface_variant);
|
||||
|
||||
EndUIScrollContainer(area, view);
|
||||
}
|
||||
|
||||
void
|
||||
gopass_app_draw(GopassApp *a, int surface_w, int surface_h, float dpi,
|
||||
int top_reserved, int bottom_reserved)
|
||||
{
|
||||
int ui_w = (int)(surface_w / (dpi > 0.0f ? dpi : 1.0f) + 0.5f);
|
||||
int ui_h = (int)(surface_h / (dpi > 0.0f ? dpi : 1.0f) + 0.5f);
|
||||
|
||||
(void)ui_h;
|
||||
Background(GetThemeBackground());
|
||||
clipboard_tick(a);
|
||||
if(ui_w >= 560)
|
||||
draw_wide(a, ui_w, ui_h, top_reserved);
|
||||
else
|
||||
draw_narrow(a, ui_w, ui_h, top_reserved, bottom_reserved);
|
||||
}
|
||||
|
||||
void
|
||||
gopass_app_shutdown(GopassApp *a)
|
||||
{
|
||||
if(a == NULL)
|
||||
return;
|
||||
field_clear(&a->master);
|
||||
clipboard_clear(a);
|
||||
a->generated[0] = '\0';
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
#ifndef GOPASS_APP_H
|
||||
#define GOPASS_APP_H
|
||||
|
||||
typedef struct GopassApp GopassApp;
|
||||
|
||||
GopassApp *gopass_app(void);
|
||||
|
||||
/* Draws one frame. Surface sizes are physical pixels; dpi is the display
|
||||
* scale. top/bottom_reserved are safe-area insets in UI units (dp). */
|
||||
void gopass_app_draw(GopassApp *app, int surface_w, int surface_h, float dpi,
|
||||
int top_reserved, int bottom_reserved);
|
||||
|
||||
/* Clears secrets held in memory. */
|
||||
void gopass_app_shutdown(GopassApp *app);
|
||||
|
||||
#endif
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Android entry point for gopass. Raylib's Android backend provides
|
||||
/* Android entry point for pass. Raylib's Android backend provides
|
||||
* android_main and calls main(); this file owns window, theme, fonts, and
|
||||
* the frame loop. */
|
||||
|
||||
@@ -7,9 +7,10 @@
|
||||
#include "ui_dpi.h"
|
||||
#include "ui_core.h"
|
||||
#include "ui_scaling.h"
|
||||
#include "ui_text.h"
|
||||
|
||||
#include "android_bridge.h"
|
||||
#include "gopass_app.h"
|
||||
#include "pass_app.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@@ -20,6 +21,7 @@
|
||||
#endif
|
||||
|
||||
static const char *const FONT_ASSET_PATH = "vendor/kryon/fonts/noto/NotoSans-Regular.ttf";
|
||||
static const char *const EMOJI_FONT_ASSET_PATH = "gui/assets/emoji.ttf";
|
||||
|
||||
/* Kryon's shape drawing rides on a 1x1 white texture so rectangles tint
|
||||
* cleanly on the GL ES surface (same setup inbe performs on Android). */
|
||||
@@ -42,16 +44,35 @@ setup_ui_font(void)
|
||||
const EmbeddedAsset *asset = GetEmbeddedAsset(FONT_ASSET_PATH);
|
||||
|
||||
if(asset == NULL || asset->data == NULL || asset->size == 0) {
|
||||
TraceLog(LOG_WARNING, "GOPASS: missing embedded font asset");
|
||||
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, "GOPASS: RegisterUIFontSource failed");
|
||||
TraceLog(LOG_WARNING, "PASS: RegisterUIFontSource failed");
|
||||
return 0;
|
||||
}
|
||||
if(!UseUIFont("ui")) {
|
||||
TraceLog(LOG_WARNING, "GOPASS: UseUIFont failed");
|
||||
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_app_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;
|
||||
@@ -60,32 +81,36 @@ setup_ui_font(void)
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
GopassApp *app;
|
||||
PassApp *app;
|
||||
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
#if ANDROID_BUILD
|
||||
__android_log_write(ANDROID_LOG_INFO, "GOPASS_MAIN", "main start");
|
||||
__android_log_write(ANDROID_LOG_INFO, "PASS_MAIN", "main start");
|
||||
android_bridge_init();
|
||||
if(chdir("/data/user/0/xyz.waozi.pass/files") != 0)
|
||||
TraceLog(LOG_WARNING, "GOPASS: failed to switch to files directory");
|
||||
TraceLog(LOG_WARNING, "PASS: failed to switch to files directory");
|
||||
#endif
|
||||
|
||||
InitWindow(0, 0, "gopass");
|
||||
InitWindow(0, 0, "pass");
|
||||
if(!IsWindowReady()) {
|
||||
TraceLog(LOG_ERROR, "GOPASS: InitWindow failed");
|
||||
TraceLog(LOG_ERROR, "PASS: InitWindow failed");
|
||||
return 1;
|
||||
}
|
||||
InitUIDPI();
|
||||
SetThemeStyle(THEME_STYLE_MATERIAL);
|
||||
SetCurrentTheme(11, 1); /* Cobalt dark, same as the desktop GUI */
|
||||
SetCurrentTheme(GetDefaultThemeForThemeStyle(THEME_STYLE_MATERIAL), 0);
|
||||
android_bridge_apply_system_theme();
|
||||
SetThemeSource(THEME_SOURCE_SYSTEM);
|
||||
SetThemeMode(THEME_MODE_SYSTEM);
|
||||
setup_ui_font();
|
||||
setup_emoji_font();
|
||||
setup_shapes_texture();
|
||||
SetUITextInputPlatformCallback(android_bridge_set_soft_keyboard);
|
||||
SetTargetFPS(60);
|
||||
|
||||
app = gopass_app();
|
||||
app = pass_app();
|
||||
while(!WindowShouldClose()) {
|
||||
int width = GetScreenWidth();
|
||||
int height = GetScreenHeight();
|
||||
@@ -94,14 +119,14 @@ main(int argc, char **argv)
|
||||
|
||||
BeginDrawing();
|
||||
BeginUIFrame(width, height, dpi);
|
||||
gopass_app_draw(app, width, height, dpi,
|
||||
pass_app_draw(app, width, height, dpi,
|
||||
android_bridge_top_reserved(),
|
||||
android_bridge_bottom_reserved());
|
||||
EndUIFrame();
|
||||
EndDrawing();
|
||||
}
|
||||
|
||||
gopass_app_shutdown(app);
|
||||
pass_app_shutdown(app);
|
||||
CloseWindow();
|
||||
return 0;
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,17 @@
|
||||
#ifndef PASS_APP_H
|
||||
#define PASS_APP_H
|
||||
|
||||
typedef struct PassApp PassApp;
|
||||
|
||||
PassApp *pass_app(void);
|
||||
const int *pass_app_master_emoji_codepoints(int *count);
|
||||
|
||||
/* Draws one frame. Surface sizes are physical pixels; dpi is the display
|
||||
* scale. top/bottom_reserved are safe-area insets in UI units (dp). */
|
||||
void pass_app_draw(PassApp *app, int surface_w, int surface_h, float dpi,
|
||||
int top_reserved, int bottom_reserved);
|
||||
|
||||
/* Clears secrets held in memory. */
|
||||
void pass_app_shutdown(PassApp *app);
|
||||
|
||||
#endif
|
||||
@@ -1,9 +1,19 @@
|
||||
package xyz.waozi.pass;
|
||||
|
||||
import android.app.NativeActivity;
|
||||
import android.app.KeyguardManager;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Insets;
|
||||
import android.hardware.biometrics.BiometricPrompt;
|
||||
import android.hardware.fingerprint.FingerprintManager;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.CancellationSignal;
|
||||
import android.security.keystore.KeyGenParameterSpec;
|
||||
import android.security.keystore.KeyProperties;
|
||||
import android.util.TypedValue;
|
||||
import android.view.DisplayCutout;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
@@ -12,11 +22,30 @@ import android.view.WindowInsets;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.content.Context;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.KeyStore;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.KeyGenerator;
|
||||
import javax.crypto.SecretKey;
|
||||
import javax.crypto.spec.GCMParameterSpec;
|
||||
|
||||
/**
|
||||
* 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";
|
||||
private static final String KEY_ALIAS = "pass_master_key";
|
||||
private static final String PREF_CIPHERTEXT = "master_ciphertext";
|
||||
private static final String PREF_IV = "master_iv";
|
||||
private static final String PREF_BIOMETRIC = "master_biometric";
|
||||
private static final int SECURE_IDLE = 0;
|
||||
private static final int SECURE_PENDING = 1;
|
||||
private static final int SECURE_OK = 2;
|
||||
private static final int SECURE_ERROR = 3;
|
||||
|
||||
static {
|
||||
// Associate libmain with this class's loader so ART can resolve the
|
||||
// native methods below (NativeActivity loads it via the boot loader).
|
||||
@@ -24,6 +53,9 @@ public class MainActivity extends NativeActivity {
|
||||
}
|
||||
|
||||
private int lastDeleteRepeatCount = -1;
|
||||
private final Object secureLock = new Object();
|
||||
private int secureStatus = SECURE_IDLE;
|
||||
private String secureResult = "";
|
||||
|
||||
private native void nativeSetInsets(int status, int nav,
|
||||
int cutoutLeft, int cutoutTop, int cutoutRight, int cutoutBottom);
|
||||
@@ -35,9 +67,305 @@ public class MainActivity extends NativeActivity {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
applySystemBars();
|
||||
setupInsetsListener();
|
||||
}
|
||||
|
||||
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 = resolveThemeColor(android.R.attr.colorAccent,
|
||||
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 int resolveThemeColor(int attr, int fallback) {
|
||||
TypedValue value = new TypedValue();
|
||||
if (!getTheme().resolveAttribute(attr, value, true)) {
|
||||
return fallback;
|
||||
}
|
||||
if (value.type >= TypedValue.TYPE_FIRST_COLOR_INT
|
||||
&& value.type <= TypedValue.TYPE_LAST_COLOR_INT) {
|
||||
return value.data;
|
||||
}
|
||||
if (value.resourceId != 0) {
|
||||
try {
|
||||
ColorStateList list;
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
list = getResources().getColorStateList(value.resourceId, getTheme());
|
||||
} else {
|
||||
list = getResources().getColorStateList(value.resourceId);
|
||||
}
|
||||
if (list != null) {
|
||||
return list.getDefaultColor();
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
return fallback;
|
||||
}
|
||||
|
||||
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() {
|
||||
SharedPreferences prefs = getSharedPreferences(SECURE_PREFS, MODE_PRIVATE);
|
||||
return prefs.contains(PREF_CIPHERTEXT) && prefs.contains(PREF_IV);
|
||||
}
|
||||
|
||||
public boolean isStoredMasterBiometric() {
|
||||
return getSharedPreferences(SECURE_PREFS, MODE_PRIVATE).getBoolean(PREF_BIOMETRIC, false);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean isBiometricAvailable() {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) return false;
|
||||
try {
|
||||
FingerprintManager fm = (FingerprintManager)getSystemService(Context.FINGERPRINT_SERVICE);
|
||||
if (fm != null && fm.isHardwareDetected() && fm.hasEnrolledFingerprints()) return true;
|
||||
} catch (SecurityException ignored) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean isBiometricSetupRequired() {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) return false;
|
||||
try {
|
||||
FingerprintManager fm = (FingerprintManager)getSystemService(Context.FINGERPRINT_SERVICE);
|
||||
if (fm == null || !fm.isHardwareDetected()) return false;
|
||||
KeyguardManager km = (KeyguardManager)getSystemService(Context.KEYGUARD_SERVICE);
|
||||
return !fm.hasEnrolledFingerprints() || km == null || !km.isDeviceSecure();
|
||||
} catch (SecurityException ignored) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
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() {
|
||||
synchronized (secureLock) {
|
||||
return secureStatus;
|
||||
}
|
||||
}
|
||||
|
||||
public String takeSecureMasterResult() {
|
||||
synchronized (secureLock) {
|
||||
String value = secureResult == null ? "" : secureResult;
|
||||
secureResult = "";
|
||||
secureStatus = SECURE_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 (requireBiometric && !isBiometricAvailable()) {
|
||||
setSecureError(biometricUnavailableMessage());
|
||||
return;
|
||||
}
|
||||
try {
|
||||
Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding");
|
||||
cipher.init(Cipher.ENCRYPT_MODE, getOrCreateMasterKey());
|
||||
byte[] encrypted = cipher.doFinal(master.getBytes(StandardCharsets.UTF_8));
|
||||
byte[] iv = cipher.getIV();
|
||||
if (iv == null || iv.length == 0) {
|
||||
setSecureError("Save failed: missing encryption IV");
|
||||
return;
|
||||
}
|
||||
|
||||
SharedPreferences.Editor editor = getSharedPreferences(SECURE_PREFS, MODE_PRIVATE).edit();
|
||||
editor.putString(PREF_IV, b64(iv));
|
||||
editor.putString(PREF_CIPHERTEXT, b64(encrypted));
|
||||
editor.putBoolean(PREF_BIOMETRIC, requireBiometric);
|
||||
editor.apply();
|
||||
setSecureOk("Master password saved");
|
||||
} catch (Exception e) {
|
||||
setSecureError("Save failed: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void unlockMasterPassword() {
|
||||
if (!hasStoredMasterPassword()) {
|
||||
setSecureError("No saved master password");
|
||||
return;
|
||||
}
|
||||
if (isStoredMasterBiometric()) {
|
||||
authenticateThenDecrypt();
|
||||
return;
|
||||
}
|
||||
decryptStoredMaster();
|
||||
}
|
||||
|
||||
public void clearMasterPassword() {
|
||||
getSharedPreferences(SECURE_PREFS, MODE_PRIVATE).edit().clear().apply();
|
||||
setSecureOk("Saved master password removed");
|
||||
}
|
||||
|
||||
private void authenticateThenDecrypt() {
|
||||
if (!isBiometricAvailable()) {
|
||||
setSecureError(biometricUnavailableMessage());
|
||||
return;
|
||||
}
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) {
|
||||
setSecureError("Biometric prompt requires Android 9 or newer");
|
||||
return;
|
||||
}
|
||||
synchronized (secureLock) {
|
||||
secureStatus = SECURE_PENDING;
|
||||
secureResult = "Waiting for biometric unlock";
|
||||
}
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Executor executor = new Executor() {
|
||||
@Override
|
||||
public void execute(Runnable command) {
|
||||
runOnUiThread(command);
|
||||
}
|
||||
};
|
||||
BiometricPrompt prompt = new BiometricPrompt.Builder(MainActivity.this)
|
||||
.setTitle("Unlock master password")
|
||||
.setSubtitle("Use your fingerprint or device credential")
|
||||
.setDescription("pass will decrypt the saved master password after unlock")
|
||||
.setNegativeButton("Cancel", executor, (dialog, which) -> setSecureError("Unlock canceled"))
|
||||
.build();
|
||||
prompt.authenticate(new CancellationSignal(), executor,
|
||||
new BiometricPrompt.AuthenticationCallback() {
|
||||
@Override
|
||||
public void onAuthenticationSucceeded(BiometricPrompt.AuthenticationResult result) {
|
||||
decryptStoredMaster();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAuthenticationError(int errorCode, CharSequence errString) {
|
||||
setSecureError(errString == null ? "Unlock failed" : errString.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAuthenticationFailed() {
|
||||
setSecureError("Biometric unlock failed");
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void decryptStoredMaster() {
|
||||
try {
|
||||
SharedPreferences prefs = getSharedPreferences(SECURE_PREFS, MODE_PRIVATE);
|
||||
String ivText = prefs.getString(PREF_IV, "");
|
||||
String encryptedText = prefs.getString(PREF_CIPHERTEXT, "");
|
||||
if (ivText.length() == 0 || encryptedText.length() == 0) {
|
||||
setSecureError("No saved master password");
|
||||
return;
|
||||
}
|
||||
Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding");
|
||||
cipher.init(Cipher.DECRYPT_MODE, getOrCreateMasterKey(), new GCMParameterSpec(128, unb64(ivText)));
|
||||
byte[] decrypted = cipher.doFinal(unb64(encryptedText));
|
||||
setSecureOk(new String(decrypted, StandardCharsets.UTF_8));
|
||||
} catch (Exception e) {
|
||||
setSecureError("Unlock failed: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private SecretKey getOrCreateMasterKey() throws Exception {
|
||||
KeyStore keyStore = KeyStore.getInstance("AndroidKeyStore");
|
||||
keyStore.load(null);
|
||||
if (keyStore.containsAlias(KEY_ALIAS)) {
|
||||
return (SecretKey)keyStore.getKey(KEY_ALIAS, null);
|
||||
}
|
||||
KeyGenerator generator = KeyGenerator.getInstance(KeyProperties.KEY_ALGORITHM_AES, "AndroidKeyStore");
|
||||
KeyGenParameterSpec spec = new KeyGenParameterSpec.Builder(
|
||||
KEY_ALIAS, KeyProperties.PURPOSE_ENCRYPT | KeyProperties.PURPOSE_DECRYPT)
|
||||
.setBlockModes(KeyProperties.BLOCK_MODE_GCM)
|
||||
.setEncryptionPaddings(KeyProperties.ENCRYPTION_PADDING_NONE)
|
||||
.setRandomizedEncryptionRequired(true)
|
||||
.build();
|
||||
generator.init(spec);
|
||||
return generator.generateKey();
|
||||
}
|
||||
|
||||
private void setSecureOk(String value) {
|
||||
synchronized (secureLock) {
|
||||
secureStatus = SECURE_OK;
|
||||
secureResult = value == null ? "" : value;
|
||||
}
|
||||
}
|
||||
|
||||
private void setSecureError(String value) {
|
||||
synchronized (secureLock) {
|
||||
secureStatus = SECURE_ERROR;
|
||||
secureResult = value == null ? "Secure storage failed" : value;
|
||||
}
|
||||
}
|
||||
|
||||
private static String b64(byte[] data) {
|
||||
return android.util.Base64.encodeToString(data, android.util.Base64.NO_WRAP);
|
||||
}
|
||||
|
||||
private static byte[] unb64(String text) {
|
||||
return android.util.Base64.decode(text, android.util.Base64.NO_WRAP);
|
||||
}
|
||||
|
||||
public void setSoftKeyboardVisible(final boolean visible) {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">gopass</string>
|
||||
<string name="app_name">pass</string>
|
||||
</resources>
|
||||
@@ -13,5 +13,5 @@ dependencyResolutionManagement {
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.name = "gopass"
|
||||
rootProject.name = "pass"
|
||||
include ':app'
|
||||
@@ -0,0 +1 @@
|
||||
Initial release: deterministic, LessPass-compatible password generation with configurable length, counter, character classes, and excluded characters. Everything is computed locally; nothing is stored or uploaded.
|
||||
@@ -0,0 +1 @@
|
||||
New clipboard handling, vault support, and named profiles in the CLI, plus self-update checks in the desktop app. Android keeps the same local, stateless generator.
|
||||
@@ -0,0 +1,2 @@
|
||||
- Install pass on Android: a signed APK is now downloadable from pass.waozi.xyz alongside the desktop, terminal, and browser downloads.
|
||||
- Fix the Android master-password fingerprint and secure storage so the stored master password unlocks reliably across launches.
|
||||
@@ -0,0 +1,2 @@
|
||||
- Verify every download: releases now ship a SHA256SUMS file covering the command-line, desktop, Android, and browser downloads.
|
||||
- The Android app now builds entirely from source with no developer signing key, clearing the way for F-Droid distribution.
|
||||
@@ -0,0 +1,17 @@
|
||||
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.
|
||||
|
||||
Features:
|
||||
|
||||
• Deterministic, LessPass-compatible password generation
|
||||
• Configurable length, counter, character classes, and excluded characters
|
||||
• 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.
|
||||
|
||||
Source code: https://github.com/waozixyz/pass
|
||||
Website: https://pass.waozi.xyz
|
||||
|
||||
Licensed under BSD-3-Clause.
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 125 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 62 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 87 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 88 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 66 KiB |
@@ -0,0 +1 @@
|
||||
Deterministic passwords from site, login, and one master password.
|
||||
@@ -0,0 +1 @@
|
||||
pass
|
||||
@@ -1,4 +1,4 @@
|
||||
module github.com/waozixyz/gopass
|
||||
module github.com/waozixyz/pass
|
||||
|
||||
go 1.24
|
||||
|
||||
|
||||
+5
-1
@@ -13,11 +13,15 @@ type clipboardLease struct {
|
||||
func (c *clipboardLease) copy(value string, lifetime time.Duration) {
|
||||
c.write(value)
|
||||
c.value = value
|
||||
if lifetime <= 0 {
|
||||
c.expires = time.Time{}
|
||||
return
|
||||
}
|
||||
c.expires = c.now().Add(lifetime)
|
||||
}
|
||||
|
||||
func (c *clipboardLease) tick() bool {
|
||||
if c.value == "" || c.now().Before(c.expires) {
|
||||
if c.value == "" || c.expires.IsZero() || c.now().Before(c.expires) {
|
||||
return false
|
||||
}
|
||||
if c.read() == c.value {
|
||||
|
||||
+3
-3
@@ -1,12 +1,12 @@
|
||||
module github.com/waozixyz/gopass/gui
|
||||
module github.com/waozixyz/pass/gui
|
||||
|
||||
go 1.25.0
|
||||
|
||||
require (
|
||||
github.com/waozixyz/gopass v0.0.0
|
||||
github.com/waozixyz/pass v0.0.0
|
||||
github.com/waozixyz/kryon/go/kryui v0.0.0
|
||||
)
|
||||
|
||||
replace github.com/waozixyz/gopass => ..
|
||||
replace github.com/waozixyz/pass => ..
|
||||
|
||||
replace github.com/waozixyz/kryon/go/kryui => ../vendor/kryon/go/kryui
|
||||
+310
-50
@@ -2,14 +2,24 @@ package main
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
password "github.com/waozixyz/gopass"
|
||||
"github.com/waozixyz/kryon/go/kryui"
|
||||
password "github.com/waozixyz/pass"
|
||||
)
|
||||
|
||||
const clipboardLifetime = 20 * time.Second
|
||||
|
||||
type appView int
|
||||
|
||||
const (
|
||||
viewGenerate appView = iota
|
||||
viewProfiles
|
||||
viewSettings
|
||||
)
|
||||
|
||||
//go:embed icon.png
|
||||
var appIconPNG []byte
|
||||
|
||||
@@ -18,114 +28,244 @@ var emojiFontTTF []byte
|
||||
|
||||
type app struct {
|
||||
site, login, master, exclude *kryui.TextFieldState
|
||||
profileName *kryui.TextFieldState
|
||||
length, counter int32
|
||||
lower, upper, digits, symbols bool
|
||||
reveal bool
|
||||
generated, message, fingerprint string
|
||||
clipboard clipboardLease
|
||||
clearAfter int32
|
||||
view appView
|
||||
settings guiSettings
|
||||
config guiConfig
|
||||
profiles []profileEntry
|
||||
selectedProfile int
|
||||
}
|
||||
|
||||
func newApp() *app {
|
||||
return &app{
|
||||
cfg, err := loadGUIConfig()
|
||||
a := &app{
|
||||
site: kryui.NewTextField(101, 256), login: kryui.NewTextField(102, 256),
|
||||
master: kryui.NewPasswordField(103, 1024), exclude: kryui.NewTextField(104, 128),
|
||||
length: 16, counter: 1, lower: true, upper: true, digits: true, symbols: true,
|
||||
clipboard: clipboardLease{read: kryui.GetClipboardText, write: kryui.SetClipboardText, now: time.Now},
|
||||
profileName: kryui.NewTextField(105, 64),
|
||||
length: 16, counter: 1, lower: true, upper: true, digits: true, symbols: true,
|
||||
clipboard: clipboardLease{read: kryui.GetClipboardText, write: kryui.SetClipboardText, now: time.Now},
|
||||
settings: cfg.Settings,
|
||||
config: cfg,
|
||||
profiles: sortedProfiles(cfg.Profiles),
|
||||
clearAfter: int32(cfg.Settings.ClearAfter),
|
||||
view: viewGenerate,
|
||||
selectedProfile: -1,
|
||||
}
|
||||
if err != nil {
|
||||
a.message = err.Error()
|
||||
}
|
||||
return a
|
||||
}
|
||||
|
||||
func main() {
|
||||
kryui.SetConfigFlags(kryui.FlagWindowResizable)
|
||||
kryui.InitWindow(720, 690, "gopass")
|
||||
defer kryui.CloseWindow()
|
||||
kryui.InitWindow(720, 740, "pass")
|
||||
icon := kryui.LoadImageFromMemory(".png", appIconPNG)
|
||||
kryui.SetWindowIcon(icon)
|
||||
kryui.UnloadImage(icon)
|
||||
kryui.SetThemeStyle(kryui.ThemeStyleMaterial)
|
||||
kryui.SetCurrentTheme(11, true) // Cobalt dark
|
||||
kryui.SetCurrentTheme(11, true) // Cobalt dark (fallback palette)
|
||||
// Follow the system palette by default; Cobalt dark is the fallback when
|
||||
// no system theme can be read.
|
||||
kryui.SetThemeSource(kryui.ThemeSourceSystem)
|
||||
kryui.SetThemeMode(kryui.ThemeModeSystem)
|
||||
kryui.EnsureUIDefaultFont()
|
||||
// The emoji fingerprint font serves only the master-password emoji
|
||||
// codepoints; all other glyphs keep coming from the theme font.
|
||||
kryui.RegisterUIFixedFontData("gopass-emoji", ".ttf", emojiFontTTF, password.MasterEmojiCodepoints())
|
||||
kryui.RegisterUIFixedFontData("pass-emoji", ".ttf", emojiFontTTF, password.MasterEmojiCodepoints())
|
||||
kryui.SetWindowMinSize(560, 620)
|
||||
kryui.EnableEventWaiting()
|
||||
|
||||
a := newApp()
|
||||
defer func() { a.master.Clear(); a.clipboard.clear() }()
|
||||
for !kryui.WindowShouldClose() {
|
||||
updateCheckStart()
|
||||
for !kryui.WindowShouldClose() && !updateQuitRequested() {
|
||||
a.clipboard.tick()
|
||||
updatePoll()
|
||||
kryui.BeginDrawing()
|
||||
w := kryui.GetScreenWidth()
|
||||
kryui.BeginUI(kryui.Key("gopass/main"))
|
||||
kryui.BeginUI(kryui.Key("pass/main"))
|
||||
a.draw(w)
|
||||
kryui.EndUI()
|
||||
a.handleUIEvents()
|
||||
kryui.EndDrawing()
|
||||
}
|
||||
a.master.Clear()
|
||||
a.clipboard.clear()
|
||||
kryui.CloseWindow()
|
||||
// With the window down and secrets cleared, a pending update re-execs
|
||||
// the staged AppImage here.
|
||||
updateExecAfterUI()
|
||||
}
|
||||
|
||||
func (a *app) draw(width int32) {
|
||||
bg, text := kryui.GetThemeBackground(), kryui.GetThemeText()
|
||||
bg := kryui.GetThemeBackground()
|
||||
scheme := kryui.GetUIMaterialScheme()
|
||||
height := kryui.GetScreenHeight()
|
||||
kryui.ClearBackground(bg)
|
||||
contentW := width - 64
|
||||
if contentW > 720 {
|
||||
contentW = 720
|
||||
}
|
||||
x := (width - contentW) / 2
|
||||
kryui.DrawRectangleRounded(kryui.NewRectangle(float32(x), 22, 48, 48), .22, 10, scheme.Primary)
|
||||
kryui.DrawUIText("g", x+15, 29, kryui.UIText32, scheme.OnPrimary)
|
||||
kryui.DrawUIText("gopass", x+64, 24, kryui.UIText32, text)
|
||||
kryui.DrawUIText("Private by design · generated on this device", x+64, 60, kryui.UIText14, scheme.OnSurfaceVariant)
|
||||
kryui.DrawRectangleRounded(kryui.NewRectangle(float32(x), 92, float32(contentW), 550), .035, 10, scheme.Surface)
|
||||
kryui.DrawRectangleLinesEx(kryui.NewRectangle(float32(x), 92, float32(contentW), 550), 1, scheme.Outline)
|
||||
kryui.DrawUIText("PASSWORD DETAILS", x+24, 116, kryui.UIText12, scheme.Primary)
|
||||
cardH := height - 104
|
||||
if cardH < 520 {
|
||||
cardH = 520
|
||||
}
|
||||
kryui.DrawRectangleRounded(kryui.NewRectangle(float32(x), 22, float32(contentW), float32(cardH)), .035, 10, scheme.Surface)
|
||||
kryui.DrawRectangleLinesEx(kryui.NewRectangle(float32(x), 22, float32(contentW), float32(cardH)), 1, scheme.Outline)
|
||||
|
||||
style := inputStyle()
|
||||
y := int32(146)
|
||||
a.field("Site", a.site, x+24, y, contentW-48, style)
|
||||
y := int32(46)
|
||||
switch a.view {
|
||||
case viewProfiles:
|
||||
a.drawProfiles(x+24, y, contentW-48, style)
|
||||
case viewSettings:
|
||||
a.drawSettings(x+24, y, contentW-48)
|
||||
default:
|
||||
a.drawGenerate(x+24, y, contentW-48, style)
|
||||
}
|
||||
|
||||
a.drawBottomNav(width, height)
|
||||
a.updateDrawRow(x+24, 22+cardH+18, contentW-48)
|
||||
}
|
||||
|
||||
func (a *app) drawBottomNav(width, height int32) {
|
||||
result := kryui.BottomNav(kryui.BottomNavProps{
|
||||
ViewWidth: width,
|
||||
ViewHeight: height,
|
||||
Items: []kryui.BottomNavItem{
|
||||
{Route: int32(viewGenerate), Label: "Generate", Active: a.view == viewGenerate},
|
||||
{Route: int32(viewProfiles), Label: "Profiles", Active: a.view == viewProfiles},
|
||||
{Route: int32(viewSettings), Label: "Settings", Active: a.view == viewSettings},
|
||||
},
|
||||
})
|
||||
if result.ClickedRoute >= int32(viewGenerate) && result.ClickedRoute <= int32(viewSettings) {
|
||||
a.view = appView(result.ClickedRoute)
|
||||
}
|
||||
}
|
||||
|
||||
func (a *app) drawGenerate(x, y, width int32, style kryui.UITextInputStyle) {
|
||||
text := kryui.GetThemeText()
|
||||
scheme := kryui.GetUIMaterialScheme()
|
||||
kryui.DrawUIText("PASSWORD DETAILS", x, y, kryui.UIText12, scheme.Primary)
|
||||
y += 30
|
||||
a.field("Site", a.site, x, y, width, style)
|
||||
y += 76
|
||||
a.field("Login", a.login, x+24, y, contentW-48, style)
|
||||
a.field("Login", a.login, x, y, width, style)
|
||||
y += 76
|
||||
kryui.DrawUIText("Master password", x+24, y, kryui.UIText14, text)
|
||||
kryui.DrawUIText("Master password", x, y, kryui.UIText14, text)
|
||||
a.master.SetSecure(!a.reveal)
|
||||
kryui.TextField(a.master, kryui.FieldProps{Bounds: kryui.NewRectangle(float32(x+24), float32(y+24), float32(contentW-150), 38), Font: kryui.UIText16, Style: style})
|
||||
if a.fingerprint != "" {
|
||||
fontToken := kryui.PushUIFont("gopass-emoji")
|
||||
width := kryui.MeasureText(a.fingerprint, kryui.UIText16)
|
||||
kryui.DrawUIText(a.fingerprint, x+contentW-24-width, y, kryui.UIText16, scheme.OnSurfaceVariant)
|
||||
kryui.TextField(a.master, kryui.FieldProps{Bounds: kryui.NewRectangle(float32(x), float32(y+24), float32(width-126), 38), Font: kryui.UIText16, Style: style})
|
||||
if a.settings.ShowFingerprint && a.fingerprint != "" {
|
||||
fontToken := kryui.PushUIFont("pass-emoji")
|
||||
fpWidth := kryui.MeasureText(a.fingerprint, kryui.UIText16)
|
||||
kryui.DrawUIText(a.fingerprint, x+width-fpWidth, y, kryui.UIText16, scheme.OnSurfaceVariant)
|
||||
kryui.PopUIFont(fontToken)
|
||||
}
|
||||
kryui.Button(kryui.ButtonProps{Bounds: kryui.NewRectangle(float32(x+contentW-112), float32(y+24), 88, 38), Label: map[bool]string{true: "Hide", false: "Reveal"}[a.reveal], Style: kryui.UIButtonStyleSecondary, ID: 205})
|
||||
kryui.Button(kryui.ButtonProps{Bounds: kryui.NewRectangle(float32(x+width-88), float32(y+24), 88, 38), Label: map[bool]string{true: "Hide", false: "Reveal"}[a.reveal], Style: kryui.UIButtonStyleSecondary, ID: 205})
|
||||
y += 76
|
||||
|
||||
kryui.DrawUIText("PASSWORD RULES", x+24, y-10, kryui.UIText12, scheme.Primary)
|
||||
kryui.DrawUIText("PASSWORD RULES", x, y-10, kryui.UIText12, scheme.Primary)
|
||||
y += 14
|
||||
kryui.DrawUIText("Length", x+24, y, kryui.UIText14, text)
|
||||
kryui.Spinbox(kryui.SpinboxProps{Bounds: kryui.NewRectangle(float32(x+24), float32(y+24), 130, 38), ID: 301, Min: 1, Max: 128, Step: 1, Value: &a.length})
|
||||
kryui.DrawUIText("Counter", x+182, y, kryui.UIText14, text)
|
||||
kryui.Spinbox(kryui.SpinboxProps{Bounds: kryui.NewRectangle(float32(x+182), float32(y+24), 130, 38), ID: 302, Min: 1, Max: 999999, Step: 1, Value: &a.counter})
|
||||
kryui.TextField(a.exclude, kryui.FieldProps{Bounds: kryui.NewRectangle(float32(x+340), float32(y+24), float32(contentW-364), 38), Font: kryui.UIText16, Style: style})
|
||||
kryui.DrawUIText("Excluded characters", x+340, y, kryui.UIText14, text)
|
||||
kryui.DrawUIText("Length", x, y, kryui.UIText14, text)
|
||||
kryui.Spinbox(kryui.SpinboxProps{Bounds: kryui.NewRectangle(float32(x), float32(y+24), 130, 38), ID: 301, Min: 1, Max: 128, Step: 1, Value: &a.length})
|
||||
kryui.DrawUIText("Counter", x+158, y, kryui.UIText14, text)
|
||||
kryui.Spinbox(kryui.SpinboxProps{Bounds: kryui.NewRectangle(float32(x+158), float32(y+24), 130, 38), ID: 302, Min: 1, Max: 999999, Step: 1, Value: &a.counter})
|
||||
kryui.TextField(a.exclude, kryui.FieldProps{Bounds: kryui.NewRectangle(float32(x+316), float32(y+24), float32(width-316), 38), Font: kryui.UIText16, Style: style})
|
||||
kryui.DrawUIText("Excluded characters", x+316, y, kryui.UIText14, text)
|
||||
y += 76
|
||||
|
||||
kryui.DrawUICheckboxToggle(x+24, y, "Lowercase", &a.lower)
|
||||
kryui.DrawUICheckboxToggle(x+174, y, "Uppercase", &a.upper)
|
||||
kryui.DrawUICheckboxToggle(x+324, y, "Digits", &a.digits)
|
||||
kryui.DrawUICheckboxToggle(x+444, y, "Symbols", &a.symbols)
|
||||
kryui.DrawUICheckboxToggle(x, y, "Lowercase", &a.lower)
|
||||
kryui.DrawUICheckboxToggle(x+150, y, "Uppercase", &a.upper)
|
||||
kryui.DrawUICheckboxToggle(x+300, y, "Digits", &a.digits)
|
||||
kryui.DrawUICheckboxToggle(x+420, y, "Symbols", &a.symbols)
|
||||
y += 48
|
||||
kryui.Button(kryui.ButtonProps{Bounds: kryui.NewRectangle(float32(x+24), float32(y), 150, 42), Label: "Generate", Style: kryui.UIButtonStylePrimary, ID: 401})
|
||||
kryui.Button(kryui.ButtonProps{Bounds: kryui.NewRectangle(float32(x+190), float32(y), 150, 42), Label: "Copy for 20s", Style: kryui.UIButtonStyleSecondary, ID: 402, Disabled: a.generated == ""})
|
||||
kryui.Button(kryui.ButtonProps{Bounds: kryui.NewRectangle(float32(x+356), float32(y), 120, 42), Label: "Clear", Style: kryui.UIButtonStyleSecondary, ID: 403})
|
||||
kryui.Button(kryui.ButtonProps{Bounds: kryui.NewRectangle(float32(x), float32(y), 150, 42), Label: "Generate", Style: kryui.UIButtonStylePrimary, ID: 401})
|
||||
kryui.Button(kryui.ButtonProps{Bounds: kryui.NewRectangle(float32(x+166), float32(y), 150, 42), Label: "Copy", Style: kryui.UIButtonStyleSecondary, ID: 402, Disabled: a.generated == ""})
|
||||
kryui.Button(kryui.ButtonProps{Bounds: kryui.NewRectangle(float32(x+332), float32(y), 120, 42), Label: "Clear", Style: kryui.UIButtonStyleSecondary, ID: 403})
|
||||
y += 56
|
||||
kryui.DrawRectangleRounded(kryui.NewRectangle(float32(x+24), float32(y), float32(contentW-48), 72), .08, 10, scheme.SurfaceContainer)
|
||||
kryui.DrawRectangleRounded(kryui.NewRectangle(float32(x), float32(y), float32(width), 72), .08, 10, scheme.SurfaceContainer)
|
||||
if a.generated != "" {
|
||||
kryui.SelectableText(a.generated, x+42, y+15, kryui.UIText20, text)
|
||||
kryui.SelectableText(a.generated, x+18, y+15, kryui.UIText20, text)
|
||||
} else {
|
||||
kryui.DrawUIText("Your generated password appears here", x+42, y+17, kryui.UIText16, scheme.OnSurfaceVariant)
|
||||
kryui.DrawUIText("Your generated password appears here", x+18, y+17, kryui.UIText16, scheme.OnSurfaceVariant)
|
||||
}
|
||||
if a.message != "" {
|
||||
kryui.DrawUIText(a.message, x+42, y+45, kryui.UIText12, scheme.OnSurfaceVariant)
|
||||
kryui.DrawUIText(a.message, x+18, y+45, kryui.UIText12, scheme.OnSurfaceVariant)
|
||||
}
|
||||
}
|
||||
|
||||
func (a *app) drawProfiles(x, y, width int32, style kryui.UITextInputStyle) {
|
||||
text := kryui.GetThemeText()
|
||||
scheme := kryui.GetUIMaterialScheme()
|
||||
|
||||
kryui.DrawUIText("PROFILE", x, y, kryui.UIText12, scheme.Primary)
|
||||
y += 30
|
||||
a.field("Name", a.profileName, x, y, width, style)
|
||||
y += 76
|
||||
kryui.Button(kryui.ButtonProps{Bounds: kryui.NewRectangle(float32(x), float32(y), 154, 42), Label: "Save Current", Style: kryui.UIButtonStylePrimary, ID: 501})
|
||||
kryui.Button(kryui.ButtonProps{Bounds: kryui.NewRectangle(float32(x+170), float32(y), 120, 42), Label: "Delete", Style: kryui.UIButtonStyleSecondary, ID: 502, Disabled: a.selectedProfile < 0})
|
||||
y += 62
|
||||
|
||||
kryui.DrawUIText("SAVED PROFILES", x, y, kryui.UIText12, scheme.Primary)
|
||||
y += 28
|
||||
if len(a.profiles) == 0 {
|
||||
kryui.DrawUIText("No profiles saved yet", x, y, kryui.UIText14, scheme.OnSurfaceVariant)
|
||||
y += 34
|
||||
}
|
||||
for i, p := range a.profiles {
|
||||
if i >= 7 {
|
||||
kryui.DrawUIText(fmt.Sprintf("%d more profiles in settings file", len(a.profiles)-i), x, y+8, kryui.UIText12, scheme.OnSurfaceVariant)
|
||||
y += 32
|
||||
break
|
||||
}
|
||||
label := p.Name
|
||||
if p.Data.Site != "" {
|
||||
label = fmt.Sprintf("%s - %s", p.Name, p.Data.Site)
|
||||
}
|
||||
style := kryui.UIButtonStyleSecondary
|
||||
if i == a.selectedProfile {
|
||||
style = kryui.UIButtonStylePrimary
|
||||
}
|
||||
kryui.Button(kryui.ButtonProps{Bounds: kryui.NewRectangle(float32(x), float32(y), float32(width), 40), Label: label, Style: style, ID: int32(600 + i)})
|
||||
y += 48
|
||||
}
|
||||
if a.message != "" {
|
||||
kryui.DrawUIText(a.message, x, y+8, kryui.UIText12, text)
|
||||
}
|
||||
}
|
||||
|
||||
func (a *app) drawSettings(x, y, width int32) {
|
||||
text := kryui.GetThemeText()
|
||||
scheme := kryui.GetUIMaterialScheme()
|
||||
|
||||
kryui.DrawUIText("BEHAVIOR", x, y, kryui.UIText12, scheme.Primary)
|
||||
y += 32
|
||||
kryui.DrawUICheckboxToggle(x, y, "Auto-copy after Generate", &a.settings.AutoCopy)
|
||||
y += 42
|
||||
kryui.DrawUICheckboxToggle(x, y, "Show master fingerprint", &a.settings.ShowFingerprint)
|
||||
y += 48
|
||||
kryui.DrawUIText("Clipboard seconds", x, y, kryui.UIText14, text)
|
||||
kryui.Spinbox(kryui.SpinboxProps{Bounds: kryui.NewRectangle(float32(x), float32(y+24), 150, 38), ID: 701, Min: 0, Max: 3600, Step: 5, Value: &a.clearAfter})
|
||||
y += 82
|
||||
|
||||
kryui.DrawUIText("MASTER PASSWORD", x, y, kryui.UIText12, scheme.Primary)
|
||||
y += 30
|
||||
kryui.DrawUIText("Android can save and unlock the master password with system biometrics.", x, y, kryui.UIText14, scheme.OnSurfaceVariant)
|
||||
y += 34
|
||||
kryui.DrawUIText("Desktop keeps the master password only in memory for this session.", x, y, kryui.UIText14, scheme.OnSurfaceVariant)
|
||||
y += 54
|
||||
kryui.Button(kryui.ButtonProps{Bounds: kryui.NewRectangle(float32(x), float32(y), 140, 42), Label: "Save Settings", Style: kryui.UIButtonStylePrimary, ID: 503})
|
||||
y += 58
|
||||
if a.message != "" {
|
||||
kryui.DrawRectangleRounded(kryui.NewRectangle(float32(x), float32(y), float32(width), 56), .08, 10, scheme.SurfaceContainer)
|
||||
kryui.DrawUIText(a.message, x+16, y+20, kryui.UIText12, scheme.OnSurfaceVariant)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,14 +293,26 @@ func (a *app) handleUIEvents() {
|
||||
a.generate()
|
||||
case 402:
|
||||
if a.generated != "" {
|
||||
a.clipboard.copy(a.generated, clipboardLifetime)
|
||||
a.message = "Copied; clipboard clears in 20 seconds"
|
||||
a.copyGenerated()
|
||||
}
|
||||
case 403:
|
||||
a.master.Clear()
|
||||
a.fingerprint = ""
|
||||
a.generated = ""
|
||||
a.message = "Cleared"
|
||||
case 501:
|
||||
a.saveCurrentProfile()
|
||||
case 502:
|
||||
a.deleteSelectedProfile()
|
||||
case 503:
|
||||
a.saveSettings()
|
||||
default:
|
||||
if event.Key >= 600 && event.Key < kryui.UIKey(600+len(a.profiles)) {
|
||||
idx := int(event.Key - 600)
|
||||
a.selectedProfile = idx
|
||||
a.applyProfile(a.profiles[idx])
|
||||
a.view = viewGenerate
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -173,7 +325,115 @@ func (a *app) generate() {
|
||||
a.message = err.Error()
|
||||
return
|
||||
}
|
||||
a.generated, a.message = result, "Password generated locally"
|
||||
a.generated = result
|
||||
if a.settings.AutoCopy {
|
||||
a.copyGenerated()
|
||||
return
|
||||
}
|
||||
a.message = "Password generated locally"
|
||||
}
|
||||
|
||||
func (a *app) copyGenerated() {
|
||||
seconds := int(a.clearAfter)
|
||||
if seconds < 0 {
|
||||
seconds = 0
|
||||
}
|
||||
a.clipboard.copy(a.generated, clipboardDuration(seconds))
|
||||
if seconds > 0 {
|
||||
a.message = fmt.Sprintf("Copied; clipboard clears in %d seconds", seconds)
|
||||
} else {
|
||||
a.message = "Copied"
|
||||
}
|
||||
}
|
||||
|
||||
func clipboardDuration(seconds int) time.Duration {
|
||||
if seconds <= 0 {
|
||||
return 0
|
||||
}
|
||||
return time.Duration(seconds) * time.Second
|
||||
}
|
||||
|
||||
func (a *app) saveSettings() {
|
||||
if a.clearAfter < 0 {
|
||||
a.clearAfter = 0
|
||||
}
|
||||
a.settings.ClearAfter = int(a.clearAfter)
|
||||
a.config.Settings = a.settings
|
||||
if err := saveGUIConfig(a.config); err != nil {
|
||||
a.message = err.Error()
|
||||
return
|
||||
}
|
||||
a.message = "Settings saved"
|
||||
}
|
||||
|
||||
func (a *app) saveCurrentProfile() {
|
||||
name := strings.TrimSpace(a.profileName.Text())
|
||||
if name == "" {
|
||||
a.message = "Enter a profile name"
|
||||
return
|
||||
}
|
||||
if a.config.Profiles == nil {
|
||||
a.config.Profiles = map[string]storedProfile{}
|
||||
}
|
||||
a.config.Profiles[name] = storedProfile{
|
||||
Site: a.site.Text(),
|
||||
Login: a.login.Text(),
|
||||
Counter: uint64(a.counter),
|
||||
Length: int(a.length),
|
||||
Lowercase: a.lower,
|
||||
Uppercase: a.upper,
|
||||
Digits: a.digits,
|
||||
Symbols: a.symbols,
|
||||
Exclude: a.exclude.Text(),
|
||||
}
|
||||
a.config.Settings = a.settings
|
||||
if err := saveGUIConfig(a.config); err != nil {
|
||||
a.message = err.Error()
|
||||
return
|
||||
}
|
||||
a.profiles = sortedProfiles(a.config.Profiles)
|
||||
a.selectedProfile = -1
|
||||
for i, p := range a.profiles {
|
||||
if p.Name == name {
|
||||
a.selectedProfile = i
|
||||
break
|
||||
}
|
||||
}
|
||||
a.message = "Profile saved"
|
||||
}
|
||||
|
||||
func (a *app) deleteSelectedProfile() {
|
||||
if a.selectedProfile < 0 || a.selectedProfile >= len(a.profiles) {
|
||||
return
|
||||
}
|
||||
name := a.profiles[a.selectedProfile].Name
|
||||
delete(a.config.Profiles, name)
|
||||
if err := saveGUIConfig(a.config); err != nil {
|
||||
a.message = err.Error()
|
||||
return
|
||||
}
|
||||
a.profiles = sortedProfiles(a.config.Profiles)
|
||||
a.selectedProfile = -1
|
||||
a.profileName.SetText("")
|
||||
a.message = "Profile deleted"
|
||||
}
|
||||
|
||||
func (a *app) applyProfile(p profileEntry) {
|
||||
a.profileName.SetText(p.Name)
|
||||
a.site.SetText(p.Data.Site)
|
||||
a.login.SetText(p.Data.Login)
|
||||
if p.Data.Counter > 0 {
|
||||
a.counter = int32(p.Data.Counter)
|
||||
}
|
||||
if p.Data.Length > 0 {
|
||||
a.length = int32(p.Data.Length)
|
||||
}
|
||||
a.lower = p.Data.Lowercase
|
||||
a.upper = p.Data.Uppercase
|
||||
a.digits = p.Data.Digits
|
||||
a.symbols = p.Data.Symbols
|
||||
a.exclude.SetText(p.Data.Exclude)
|
||||
a.message = "Profile loaded"
|
||||
}
|
||||
|
||||
func inputStyle() kryui.UITextInputStyle {
|
||||
|
||||
+111
@@ -0,0 +1,111 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
)
|
||||
|
||||
type storedProfile struct {
|
||||
Site string `json:"site,omitempty"`
|
||||
Login string `json:"login"`
|
||||
Counter uint64 `json:"counter,omitempty"`
|
||||
Length int `json:"length,omitempty"`
|
||||
Lowercase bool `json:"lowercase"`
|
||||
Uppercase bool `json:"uppercase"`
|
||||
Digits bool `json:"digits"`
|
||||
Symbols bool `json:"symbols"`
|
||||
Exclude string `json:"exclude,omitempty"`
|
||||
}
|
||||
|
||||
type guiSettings struct {
|
||||
AutoCopy bool `json:"auto_copy"`
|
||||
ClearAfter int `json:"clear_after_seconds"`
|
||||
ShowFingerprint bool `json:"show_fingerprint"`
|
||||
}
|
||||
|
||||
type guiConfig struct {
|
||||
Settings guiSettings `json:"settings"`
|
||||
Profiles map[string]storedProfile `json:"profiles"`
|
||||
}
|
||||
|
||||
type profileEntry struct {
|
||||
Name string
|
||||
Data storedProfile
|
||||
}
|
||||
|
||||
func defaultGUISettings() guiSettings {
|
||||
return guiSettings{ClearAfter: 20, ShowFingerprint: true}
|
||||
}
|
||||
|
||||
func configFilePath() string {
|
||||
if dir := os.Getenv("XDG_CONFIG_HOME"); dir != "" {
|
||||
return filepath.Join(dir, "pass", "profiles.json")
|
||||
}
|
||||
home, err := os.UserHomeDir()
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
return filepath.Join(home, ".config", "pass", "profiles.json")
|
||||
}
|
||||
|
||||
func loadGUIConfig() (guiConfig, error) {
|
||||
cfg := guiConfig{Settings: defaultGUISettings(), Profiles: map[string]storedProfile{}}
|
||||
path := configFilePath()
|
||||
if path == "" {
|
||||
return cfg, nil
|
||||
}
|
||||
raw, err := os.ReadFile(path)
|
||||
if errors.Is(err, os.ErrNotExist) {
|
||||
return cfg, nil
|
||||
}
|
||||
if err != nil {
|
||||
return cfg, err
|
||||
}
|
||||
if len(raw) == 0 {
|
||||
return cfg, nil
|
||||
}
|
||||
if err := json.Unmarshal(raw, &cfg); err != nil {
|
||||
return cfg, err
|
||||
}
|
||||
if cfg.Profiles == nil {
|
||||
cfg.Profiles = map[string]storedProfile{}
|
||||
}
|
||||
if cfg.Settings.ClearAfter < 0 {
|
||||
cfg.Settings.ClearAfter = 0
|
||||
}
|
||||
if cfg.Settings.ClearAfter == 0 && !cfg.Settings.AutoCopy {
|
||||
cfg.Settings.ClearAfter = 20
|
||||
}
|
||||
return cfg, nil
|
||||
}
|
||||
|
||||
func saveGUIConfig(cfg guiConfig) error {
|
||||
path := configFilePath()
|
||||
if path == "" {
|
||||
return nil
|
||||
}
|
||||
if err := os.MkdirAll(filepath.Dir(path), 0o700); err != nil {
|
||||
return err
|
||||
}
|
||||
raw, err := json.MarshalIndent(cfg, "", " ")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return os.WriteFile(path, append(raw, '\n'), 0o600)
|
||||
}
|
||||
|
||||
func sortedProfiles(profiles map[string]storedProfile) []profileEntry {
|
||||
names := make([]string, 0, len(profiles))
|
||||
for name := range profiles {
|
||||
names = append(names, name)
|
||||
}
|
||||
sort.Strings(names)
|
||||
out := make([]profileEntry, 0, len(names))
|
||||
for _, name := range names {
|
||||
out = append(out, profileEntry{Name: name, Data: profiles[name]})
|
||||
}
|
||||
return out
|
||||
}
|
||||
+120
@@ -0,0 +1,120 @@
|
||||
package main
|
||||
|
||||
// Desktop update flow over kryon's kry_update_flow: check the release
|
||||
// appcast once per session, toast when a newer pass exists, and offer
|
||||
// download + restart in a small row under the main card. AppImage builds
|
||||
// self-update (verified download, atomic swap, re-exec); tarball, deb and
|
||||
// source installs stay on the release link.
|
||||
|
||||
import (
|
||||
"github.com/waozixyz/kryon/go/kryui"
|
||||
password "github.com/waozixyz/pass"
|
||||
)
|
||||
|
||||
const appcastURL = "https://github.com/waozixyz/pass/releases/latest/download/appcast.json"
|
||||
|
||||
const updateButtonID = 510
|
||||
|
||||
var (
|
||||
updater *kryui.UpdateFlow
|
||||
updateNoticed bool
|
||||
restartPending bool
|
||||
)
|
||||
|
||||
func updateCheckStart() {
|
||||
updater = kryui.StartUpdateFlow("pass", password.Version, appcastURL)
|
||||
}
|
||||
|
||||
func updatePoll() {
|
||||
if updater == nil {
|
||||
return
|
||||
}
|
||||
updater.Poll()
|
||||
if !updateNoticed && updater.State() == kryui.UpdateFlowAvailable {
|
||||
updateNoticed = true
|
||||
if updater.HasArtifact() {
|
||||
kryui.ShowToast("pass " + updater.NewVersion() + " available — update below")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func updateQuitRequested() bool {
|
||||
return restartPending
|
||||
}
|
||||
|
||||
// updateExecAfterUI re-execs the staged AppImage; call once the window is
|
||||
// closed and secrets are cleared. Does nothing when no restart is pending.
|
||||
func updateExecAfterUI() {
|
||||
if updater != nil && restartPending {
|
||||
updater.ExecPending()
|
||||
}
|
||||
}
|
||||
|
||||
// updateDrawRow renders the update row under the main card. Returns true
|
||||
// when it drew (the layout reserves the space unconditionally once an
|
||||
// update was seen, so the card doesn't jump while states change).
|
||||
func (a *app) updateDrawRow(x, y, width int32) bool {
|
||||
if updater == nil {
|
||||
return false
|
||||
}
|
||||
scheme := kryui.GetUIMaterialScheme()
|
||||
switch updater.State() {
|
||||
case kryui.UpdateFlowAvailable:
|
||||
if !updater.HasArtifact() {
|
||||
// system-managed or source install: one quiet link-out line
|
||||
if updater.ReleaseURL() == "" {
|
||||
return false
|
||||
}
|
||||
kryui.DrawUIText("pass "+updater.NewVersion()+" available", x, y, kryui.UIText12, scheme.OnSurfaceVariant)
|
||||
return true
|
||||
}
|
||||
kryui.DrawUIText("pass "+updater.NewVersion()+" available", x, y, kryui.UIText12, scheme.OnSurfaceVariant)
|
||||
if kryui.Button(kryui.ButtonProps{
|
||||
Bounds: kryui.NewRectangle(float32(x+width-96), float32(y-14), 96, 32),
|
||||
Label: "Download", Style: kryui.UIButtonStyleSecondary, ID: updateButtonID,
|
||||
}) {
|
||||
updater.Download()
|
||||
}
|
||||
case kryui.UpdateFlowDownloading:
|
||||
pct := int(updater.Progress()*100 + 0.5)
|
||||
if pct < 0 {
|
||||
pct = 0
|
||||
}
|
||||
kryui.DrawUIText("Downloading… "+itoa(pct)+"%", x, y, kryui.UIText12, scheme.OnSurfaceVariant)
|
||||
case kryui.UpdateFlowReady:
|
||||
kryui.DrawUIText("pass "+updater.NewVersion()+" ready to install", x, y, kryui.UIText12, scheme.OnSurfaceVariant)
|
||||
if kryui.Button(kryui.ButtonProps{
|
||||
Bounds: kryui.NewRectangle(float32(x+width-150), float32(y-14), 150, 32),
|
||||
Label: "Restart to update", Style: kryui.UIButtonStylePrimary, ID: updateButtonID,
|
||||
}) {
|
||||
if updater.Apply() {
|
||||
restartPending = true
|
||||
}
|
||||
}
|
||||
case kryui.UpdateFlowFailed:
|
||||
kryui.DrawUIText("Update failed: "+updater.Error(), x, y, kryui.UIText12, scheme.OnSurfaceVariant)
|
||||
if kryui.Button(kryui.ButtonProps{
|
||||
Bounds: kryui.NewRectangle(float32(x+width-96), float32(y-14), 96, 32),
|
||||
Label: "Retry", Style: kryui.UIButtonStyleSecondary, ID: updateButtonID,
|
||||
}) {
|
||||
updater.Download()
|
||||
}
|
||||
default:
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func itoa(n int) string {
|
||||
if n == 0 {
|
||||
return "0"
|
||||
}
|
||||
var buf [8]byte
|
||||
i := len(buf)
|
||||
for n > 0 {
|
||||
i--
|
||||
buf[i] = byte('0' + n%10)
|
||||
n /= 10
|
||||
}
|
||||
return string(buf[i:])
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package gopass
|
||||
package pass
|
||||
|
||||
import "crypto/sha256"
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package gopass
|
||||
package pass
|
||||
|
||||
import "testing"
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/* C port of the gopass Go generator (gopass.go, pbkdf2.go). The output is
|
||||
* byte-identical to the Go implementation; native/gopass_core_test.c checks
|
||||
/* C port of the pass Go generator (pass.go, pbkdf2.go). The output is
|
||||
* byte-identical to the Go implementation; native/pass_core_test.c checks
|
||||
* the same fixed vectors the Go tests use. */
|
||||
|
||||
#include "gopass_core.h"
|
||||
#include "pass_core.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@@ -175,6 +175,12 @@ sha256(const void *data, size_t len, uint8_t out[32])
|
||||
sha256_final(&ctx, out);
|
||||
}
|
||||
|
||||
void
|
||||
pass_sha256(const void *data, size_t len, uint8_t out[32])
|
||||
{
|
||||
sha256(data, len, out);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* HMAC-SHA256 */
|
||||
/* ------------------------------------------------------------------ */
|
||||
@@ -217,7 +223,7 @@ hmac_sha256(const void *key, size_t key_len,
|
||||
/* ------------------------------------------------------------------ */
|
||||
|
||||
void
|
||||
gopass_derive_key(const char *password, size_t password_len,
|
||||
pass_derive_key(const char *password, size_t password_len,
|
||||
const char *salt, size_t salt_len,
|
||||
uint8_t out[32])
|
||||
{
|
||||
@@ -241,7 +247,7 @@ gopass_derive_key(const char *password, size_t password_len,
|
||||
hmac_sha256(password, password_len, block_input, input_len, previous);
|
||||
memcpy(out, previous, 32);
|
||||
|
||||
for(round = 1; round < GOPASS_DERIVATION_ROUNDS; round++) {
|
||||
for(round = 1; round < PASS_DERIVATION_ROUNDS; round++) {
|
||||
hmac_sha256(password, password_len, previous, 32, previous);
|
||||
for(int i = 0; i < 32; i++)
|
||||
out[i] ^= previous[i];
|
||||
@@ -303,8 +309,8 @@ class_filtered(const char *characters, const char *exclude, char *out, int out_s
|
||||
}
|
||||
|
||||
int
|
||||
gopass_generate(const char *site, const char *login, const char *master,
|
||||
const GopassOptions *options,
|
||||
pass_generate(const char *site, const char *login, const char *master,
|
||||
const PassOptions *options,
|
||||
char *out, size_t out_size,
|
||||
char *err, size_t err_size)
|
||||
{
|
||||
@@ -380,7 +386,7 @@ gopass_generate(const char *site, const char *login, const char *master,
|
||||
salt_len += (size_t)snprintf(salt + salt_len, sizeof(salt) - salt_len,
|
||||
"%llu", (unsigned long long)options->counter);
|
||||
|
||||
gopass_derive_key(master != NULL ? master : "", master != NULL ? strlen(master) : 0,
|
||||
pass_derive_key(master != NULL ? master : "", master != NULL ? strlen(master) : 0,
|
||||
salt, salt_len, entropy);
|
||||
|
||||
password_length = options->length - class_count;
|
||||
@@ -1,10 +1,10 @@
|
||||
#ifndef GOPASS_CORE_H
|
||||
#define GOPASS_CORE_H
|
||||
#ifndef PASS_CORE_H
|
||||
#define PASS_CORE_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#define GOPASS_DERIVATION_ROUNDS 100000
|
||||
#define PASS_DERIVATION_ROUNDS 100000
|
||||
|
||||
typedef struct {
|
||||
int length;
|
||||
@@ -14,19 +14,23 @@ typedef struct {
|
||||
int digits;
|
||||
int symbols;
|
||||
const char *exclude; /* NUL-terminated; may be NULL or empty */
|
||||
} GopassOptions;
|
||||
} PassOptions;
|
||||
|
||||
/* Derives the 32-byte PBKDF2-HMAC-SHA256 key (one block, 100000 rounds),
|
||||
* the byte-exact counterpart of the Go package's deriveKey. */
|
||||
void gopass_derive_key(const char *password, size_t password_len,
|
||||
void pass_derive_key(const char *password, size_t password_len,
|
||||
const char *salt, size_t salt_len,
|
||||
uint8_t out[32]);
|
||||
|
||||
/* Computes SHA-256. Shared with UI code that must match the Go package's
|
||||
* master-password fingerprint derivation. */
|
||||
void pass_sha256(const void *data, size_t len, uint8_t out[32]);
|
||||
|
||||
/* Generates a LessPass-compatible password. Returns 0 on success and writes
|
||||
* the NUL-terminated password into out. Returns nonzero on invalid options
|
||||
* and writes the reason into err (English, matches the Go error strings). */
|
||||
int gopass_generate(const char *site, const char *login, const char *master,
|
||||
const GopassOptions *options,
|
||||
int pass_generate(const char *site, const char *login, const char *master,
|
||||
const PassOptions *options,
|
||||
char *out, size_t out_size,
|
||||
char *err, size_t err_size);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* Host-buildable vector test for gopass_core.c. The vectors are copied from
|
||||
* the Go tests (gopass_test.go) so the C generator stays byte-compatible. */
|
||||
/* Host-buildable vector test for pass_core.c. The vectors are copied from
|
||||
* the Go tests (pass_test.go) so the C generator stays byte-compatible. */
|
||||
|
||||
#include "gopass_core.h"
|
||||
#include "pass_core.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -11,7 +11,7 @@ static int failures = 0;
|
||||
|
||||
static void
|
||||
check_generate(int index, const char *site, const char *login, const char *master,
|
||||
GopassOptions options, const char *want, int want_error)
|
||||
PassOptions options, const char *want, int want_error)
|
||||
{
|
||||
char out[256];
|
||||
char err[256];
|
||||
@@ -19,7 +19,7 @@ check_generate(int index, const char *site, const char *login, const char *maste
|
||||
|
||||
memset(out, 0, sizeof(out));
|
||||
memset(err, 0, sizeof(err));
|
||||
result = gopass_generate(site, login, master, &options, out, sizeof(out), err, sizeof(err));
|
||||
result = pass_generate(site, login, master, &options, out, sizeof(out), err, sizeof(err));
|
||||
|
||||
if(want_error) {
|
||||
if(result == 0) {
|
||||
@@ -52,7 +52,7 @@ check_derive(int index, const char *password, const char *salt, const char *want
|
||||
char hex[65];
|
||||
int i;
|
||||
|
||||
gopass_derive_key(password, strlen(password), salt, strlen(salt), out);
|
||||
pass_derive_key(password, strlen(password), salt, strlen(salt), out);
|
||||
for(i = 0; i < 32; i++)
|
||||
sprintf(hex + i * 2, "%02x", out[i]);
|
||||
hex[64] = '\0';
|
||||
@@ -65,10 +65,30 @@ check_derive(int index, const char *password, const char *salt, const char *want
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
check_sha256(void)
|
||||
{
|
||||
uint8_t out[32];
|
||||
char hex[65];
|
||||
int i;
|
||||
|
||||
pass_sha256("correct horse battery staple", strlen("correct horse battery staple"), 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);
|
||||
failures++;
|
||||
} else {
|
||||
printf("ok sha256: %s\n", hex);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
check_shape(void)
|
||||
{
|
||||
GopassOptions options;
|
||||
PassOptions options;
|
||||
char out[256];
|
||||
char err[256];
|
||||
static const char *exclude = "abcXYZ019!@";
|
||||
@@ -87,7 +107,7 @@ check_shape(void)
|
||||
options.symbols = 1;
|
||||
options.exclude = exclude;
|
||||
|
||||
if(gopass_generate("host", "account", "secret", &options, out, sizeof(out), err, sizeof(err)) != 0) {
|
||||
if(pass_generate("host", "account", "secret", &options, out, sizeof(out), err, sizeof(err)) != 0) {
|
||||
printf("FAIL shape: %s\n", err);
|
||||
failures++;
|
||||
return;
|
||||
@@ -129,12 +149,13 @@ check_shape(void)
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
GopassOptions defaults;
|
||||
PassOptions defaults;
|
||||
|
||||
check_derive(1, "password", "salt",
|
||||
"0394a2ede332c9a13eb82e9b24631604c31df978b4e2f0fbd2c549944f9d79a5");
|
||||
check_derive(2, "", "examplealice1",
|
||||
"caa46554f5a676b76c15b368c655b0b24eaaad8595ef919999785c68e60fd5f5");
|
||||
check_sha256();
|
||||
|
||||
memset(&defaults, 0, sizeof(defaults));
|
||||
defaults.length = 16;
|
||||
@@ -149,7 +170,7 @@ main(void)
|
||||
defaults, "&vLf44D'/cSkP-_8", 0);
|
||||
|
||||
{
|
||||
GopassOptions o = defaults;
|
||||
PassOptions o = defaults;
|
||||
|
||||
o.length = 20;
|
||||
o.counter = 2;
|
||||
@@ -158,7 +179,7 @@ main(void)
|
||||
}
|
||||
|
||||
{
|
||||
GopassOptions o;
|
||||
PassOptions o;
|
||||
|
||||
memset(&o, 0, sizeof(o));
|
||||
o.length = 12;
|
||||
@@ -171,7 +192,7 @@ main(void)
|
||||
}
|
||||
|
||||
{
|
||||
GopassOptions o = defaults;
|
||||
PassOptions o = defaults;
|
||||
|
||||
o.length = 24;
|
||||
o.exclude = "0Ool1I!|";
|
||||
@@ -180,7 +201,7 @@ main(void)
|
||||
}
|
||||
|
||||
{
|
||||
GopassOptions o;
|
||||
PassOptions o;
|
||||
|
||||
memset(&o, 0, sizeof(o));
|
||||
o.length = 4;
|
||||
@@ -191,7 +212,7 @@ main(void)
|
||||
}
|
||||
|
||||
{
|
||||
GopassOptions o;
|
||||
PassOptions o;
|
||||
|
||||
memset(&o, 0, sizeof(o));
|
||||
o.length = 0;
|
||||
@@ -200,7 +221,7 @@ main(void)
|
||||
}
|
||||
|
||||
{
|
||||
GopassOptions o;
|
||||
PassOptions o;
|
||||
|
||||
memset(&o, 0, sizeof(o));
|
||||
o.length = 8;
|
||||
@@ -208,7 +229,7 @@ main(void)
|
||||
}
|
||||
|
||||
{
|
||||
GopassOptions o;
|
||||
PassOptions o;
|
||||
|
||||
memset(&o, 0, sizeof(o));
|
||||
o.length = 2;
|
||||
@@ -219,7 +240,7 @@ main(void)
|
||||
}
|
||||
|
||||
{
|
||||
GopassOptions o;
|
||||
PassOptions o;
|
||||
|
||||
memset(&o, 0, sizeof(o));
|
||||
o.length = 8;
|
||||
@@ -1,15 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<component type="desktop-application">
|
||||
<id>xyz.waozi.pass</id>
|
||||
<name>gopass</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>gopass 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/gopass</url>
|
||||
<provides><binary>gopass-gui</binary></provides>
|
||||
<releases><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>
|
||||
<url type="homepage">https://github.com/waozixyz/pass</url>
|
||||
<provides><binary>pass-gui</binary></provides>
|
||||
<releases><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,9 +1,9 @@
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=gopass
|
||||
Name=pass
|
||||
Comment=Generate deterministic passwords locally
|
||||
Exec=gopass-gui
|
||||
Icon=gopass
|
||||
Exec=pass-gui
|
||||
Icon=pass
|
||||
Terminal=false
|
||||
Categories=System;Security;
|
||||
StartupNotify=true
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
// Package gopass derives site-specific passwords without storing them.
|
||||
package gopass
|
||||
// Package pass derives site-specific passwords without storing them.
|
||||
package pass
|
||||
|
||||
import (
|
||||
"errors"
|
||||
@@ -1,4 +1,4 @@
|
||||
package gopass
|
||||
package pass
|
||||
|
||||
import (
|
||||
"encoding/hex"
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
name "gopass"
|
||||
name "pass"
|
||||
generated "build/kryon/generated"
|
||||
default_target "Run"
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package gopass
|
||||
package pass
|
||||
|
||||
import (
|
||||
"crypto/hmac"
|
||||
|
||||
@@ -5,17 +5,17 @@ root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
|
||||
version=$(sed -n 's/^const Version = "\([^"]*\)"/\1/p' "$root/version.go")
|
||||
arch=${APPIMAGE_ARCH:-$(uname -m)}
|
||||
linuxdeploy=${LINUXDEPLOY:-linuxdeploy}
|
||||
appdir="$root/build/package/appimage/gopass.AppDir"
|
||||
out="$root/build/release/gopass-${version}-${arch}.AppImage"
|
||||
appdir="$root/build/package/appimage/pass.AppDir"
|
||||
out="$root/build/release/pass-${version}-${arch}.AppImage"
|
||||
|
||||
test -n "$version"
|
||||
rm -rf "$appdir"
|
||||
mkdir -p "$appdir/usr/bin" "$appdir/usr/share/applications" "$appdir/usr/share/metainfo" "$appdir/usr/share/icons/hicolor/512x512/apps" "$(dirname "$out")"
|
||||
cp "$root/build/gopass-gui" "$appdir/usr/bin/gopass-gui"
|
||||
cp "$root/build/pass-gui" "$appdir/usr/bin/pass-gui"
|
||||
cp "$root/packaging/linux/xyz.waozi.pass.desktop" "$appdir/usr/share/applications/xyz.waozi.pass.desktop"
|
||||
cp "$root/packaging/linux/xyz.waozi.pass.appdata.xml" "$appdir/usr/share/metainfo/xyz.waozi.pass.appdata.xml"
|
||||
cp "$root/assets/app/icon.png" "$appdir/usr/share/icons/hicolor/512x512/apps/gopass.png"
|
||||
rm -f "$root"/gopass-*.AppImage
|
||||
cp "$root/assets/app/icon.png" "$appdir/usr/share/icons/hicolor/512x512/apps/pass.png"
|
||||
rm -f "$root"/pass-*.AppImage
|
||||
ARCH="$arch" "$linuxdeploy" --appdir "$appdir" --desktop-file "$root/packaging/linux/xyz.waozi.pass.desktop" --icon-file "$root/assets/app/icon.png" --output appimage
|
||||
image=$(find "$root" -maxdepth 1 -type f -name '*.AppImage' -print | head -n 1)
|
||||
test -n "$image"
|
||||
|
||||
@@ -4,23 +4,23 @@ set -eu
|
||||
root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
|
||||
version=$(sed -n 's/^const Version = "\([^"]*\)"/\1/p' "$root/version.go")
|
||||
arch=${DEB_ARCH:-$(dpkg --print-architecture)}
|
||||
stage="$root/build/package/deb/gopass"
|
||||
stage="$root/build/package/deb/pass"
|
||||
out="$root/build/release"
|
||||
|
||||
test -n "$version"
|
||||
rm -rf "$stage"
|
||||
mkdir -p "$stage/DEBIAN" "$stage/usr/bin" "$stage/usr/share/applications" "$stage/usr/share/metainfo" "$stage/usr/share/icons/hicolor/512x512/apps" "$stage/usr/share/doc/gopass" "$out"
|
||||
cp "$root/build/gopass-gui" "$stage/usr/bin/gopass-gui"
|
||||
mkdir -p "$stage/DEBIAN" "$stage/usr/bin" "$stage/usr/share/applications" "$stage/usr/share/metainfo" "$stage/usr/share/icons/hicolor/512x512/apps" "$stage/usr/share/doc/pass" "$out"
|
||||
cp "$root/build/pass-gui" "$stage/usr/bin/pass-gui"
|
||||
cp "$root/packaging/linux/xyz.waozi.pass.desktop" "$stage/usr/share/applications/xyz.waozi.pass.desktop"
|
||||
cp "$root/packaging/linux/xyz.waozi.pass.appdata.xml" "$stage/usr/share/metainfo/xyz.waozi.pass.appdata.xml"
|
||||
cp "$root/assets/app/icon.png" "$stage/usr/share/icons/hicolor/512x512/apps/gopass.png"
|
||||
cp "$root/LICENSE" "$root/README.md" "$stage/usr/share/doc/gopass/"
|
||||
cp "$root/assets/app/icon.png" "$stage/usr/share/icons/hicolor/512x512/apps/pass.png"
|
||||
cp "$root/LICENSE" "$root/README.md" "$stage/usr/share/doc/pass/"
|
||||
find "$stage" -type d -exec chmod 0755 {} \;
|
||||
chmod 0755 "$stage/usr/bin/gopass-gui"
|
||||
chmod 0755 "$stage/usr/bin/pass-gui"
|
||||
find "$stage/usr/share" -type f -exec chmod 0644 {} \;
|
||||
installed=$(du -sk "$stage" | awk '{print $1}')
|
||||
cat > "$stage/DEBIAN/control" <<EOF
|
||||
Package: gopass
|
||||
Package: pass
|
||||
Version: $version
|
||||
Architecture: $arch
|
||||
Maintainer: Waozi <[email protected]>
|
||||
@@ -32,4 +32,4 @@ Homepage: https://pass.waozi.xyz/
|
||||
Description: deterministic local password generator
|
||||
Generate repeatable passwords locally without a password database.
|
||||
EOF
|
||||
dpkg-deb --root-owner-group --build "$stage" "$out/gopass_${version}_${arch}.deb"
|
||||
dpkg-deb --root-owner-group --build "$stage" "$out/pass_${version}_${arch}.deb"
|
||||
Executable
+84
@@ -0,0 +1,84 @@
|
||||
#!/bin/sh
|
||||
# privacy_scan.sh — refuse to ship private terms.
|
||||
#
|
||||
# Scans a git tree (contents and file paths) or a directory for the
|
||||
# fixed-string terms listed in TERMS_FILE. The terms file lives outside
|
||||
# every repository — ~/.config/git/private-terms.txt for the local
|
||||
# pre-push hook, the PRIVATE_TERMS Actions secret in CI — so this script,
|
||||
# its workflow, and its self-test never contain or reveal the private
|
||||
# values. Reports redact every term before printing.
|
||||
#
|
||||
# Usage: privacy_scan.sh TERMS_FILE TREE-ISH|DIRECTORY [TREE-ISH...]
|
||||
# Exit: 0 clean, 1 a term was found, 2 bad usage / unusable terms file.
|
||||
|
||||
set -u
|
||||
|
||||
if [ "$#" -lt 2 ]; then
|
||||
echo "usage: $0 TERMS_FILE TREE-ISH|DIRECTORY..." >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
terms_file=$1
|
||||
shift
|
||||
|
||||
if [ ! -f "$terms_file" ]; then
|
||||
echo "privacy: terms file $terms_file not found" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
# Drop comments and blank lines; require at least one term.
|
||||
tmp_terms=$(mktemp) || exit 2
|
||||
trap 'rm -f "$tmp_terms"' EXIT
|
||||
chmod 600 "$tmp_terms"
|
||||
sed -e 's/#.*$//' -e '/^[[:space:]]*$/d' "$terms_file" > "$tmp_terms"
|
||||
if [ ! -s "$tmp_terms" ]; then
|
||||
echo "privacy: terms file $terms_file has no terms" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
redact() {
|
||||
awk -v terms_file="$tmp_terms" '
|
||||
BEGIN { while ((getline t < terms_file) > 0) terms[++nt] = tolower(t) }
|
||||
{
|
||||
line = $0
|
||||
for (i = 1; i <= nt; i++) {
|
||||
low = tolower(line)
|
||||
while ((p = index(low, terms[i])) > 0) {
|
||||
line = substr(line, 1, p - 1) "***" substr(line, p + length(terms[i]))
|
||||
low = tolower(line)
|
||||
}
|
||||
}
|
||||
print line
|
||||
}'
|
||||
}
|
||||
|
||||
found=0
|
||||
for target in "$@"; do
|
||||
if git rev-parse -q --verify "$target^{tree}" >/dev/null 2>&1; then
|
||||
# A git tree: search contents and file paths at that revision.
|
||||
hits=$(git grep -I -iF -f "$tmp_terms" "$target" -- . 2>/dev/null || true)
|
||||
paths=$(git ls-tree -r --name-only "$target" 2>/dev/null | grep -iF -f "$tmp_terms" || true)
|
||||
elif [ -d "$target" ]; then
|
||||
# A directory: search contents and file paths on disk.
|
||||
hits=$(grep -rI -iF -f "$tmp_terms" --exclude-dir=.git "$target" 2>/dev/null || true)
|
||||
paths=$(cd "$target" && find . -name .git -prune -o -print 2>/dev/null | grep -iF -f "$tmp_terms" || true)
|
||||
else
|
||||
echo "privacy: cannot scan $target (not a tree-ish or directory)" >&2
|
||||
exit 2
|
||||
fi
|
||||
if [ -n "$hits" ]; then
|
||||
found=1
|
||||
# git grep and grep -r output already carries the tree/path prefix.
|
||||
printf '%s\n' "$hits" | redact >&2
|
||||
fi
|
||||
if [ -n "$paths" ]; then
|
||||
found=1
|
||||
printf '%s\n' "$paths" | sed 's|^|path name match: |' | redact >&2
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$found" -ne 0 ]; then
|
||||
echo "privacy: PRIVATE DATA DETECTED — refusing to ship" >&2
|
||||
exit 1
|
||||
fi
|
||||
exit 0
|
||||
+55
-2
@@ -13,11 +13,64 @@ if [ -z "$release_date" ]; then
|
||||
fi
|
||||
|
||||
sed -E -i "s/^const Version = \"[^\"]+\"$/const Version = \"$release_version\"/" version.go
|
||||
sed -E -i "s/versionName \"[^\"]+\"/versionName \"$release_version\"/" droid/app/build.gradle
|
||||
|
||||
# Android versionName and versionCode: bump the code only when preparing a
|
||||
# different release, so rerunning this script for the same version is
|
||||
# idempotent.
|
||||
gradle_file=droid/app/build.gradle
|
||||
current_name=$(sed -n 's/.*versionName "\([^"]*\)".*/\1/p' "$gradle_file" | head -n 1)
|
||||
current_code=$(sed -n 's/^[[:space:]]*versionCode \([0-9][0-9]*\).*/\1/p' "$gradle_file" | head -n 1)
|
||||
if [ -z "$current_code" ]; then
|
||||
echo "Could not read versionCode from $gradle_file" >&2
|
||||
exit 1
|
||||
fi
|
||||
if [ "$current_name" = "$release_version" ]; then
|
||||
release_code=$current_code
|
||||
else
|
||||
release_code=$((current_code + 1))
|
||||
fi
|
||||
sed -E -i "s/versionName \"[^\"]+\"/versionName \"$release_version\"/" "$gradle_file"
|
||||
sed -E -i "s/^([[:space:]]*)versionCode [0-9]+/\1versionCode $release_code/" "$gradle_file"
|
||||
metainfo=packaging/linux/xyz.waozi.pass.appdata.xml
|
||||
if ! grep -F "<release version=\"$release_version\"" "$metainfo" >/dev/null; then
|
||||
sed -E -i "s#<releases>#<releases><release version=\"$release_version\" date=\"$release_date\"/>#" "$metainfo"
|
||||
fi
|
||||
grep -F "const Version = \"$release_version\"" version.go >/dev/null
|
||||
grep -F "versionName \"$release_version\"" droid/app/build.gradle >/dev/null
|
||||
grep -F "versionName \"$release_version\"" "$gradle_file" >/dev/null
|
||||
grep -E "^[[:space:]]*versionCode $release_code$" "$gradle_file" >/dev/null
|
||||
grep -F "<release version=\"$release_version\" date=\"$release_date\"" "$metainfo" >/dev/null
|
||||
|
||||
# Generate the Fastlane changelog for the Android versionCode being built.
|
||||
# Fastlane file names are versionCode values, not changelog positions, and
|
||||
# store listings cap changelogs at 500 characters.
|
||||
changelog_dir=fastlane/metadata/android/en-US/changelogs
|
||||
mkdir -p "$changelog_dir"
|
||||
changelog=$(awk -v ver="$release_version" '
|
||||
BEGIN { in_section = 0; buf = "" }
|
||||
/^## \[/ {
|
||||
if (in_section) exit
|
||||
if (index($0, "[" ver "]") > 0) {
|
||||
in_section = 1
|
||||
next
|
||||
}
|
||||
}
|
||||
in_section {
|
||||
if ($0 == "") next
|
||||
if (/^- /) {
|
||||
if (buf != "") print buf
|
||||
buf = $0
|
||||
next
|
||||
}
|
||||
if (buf != "") {
|
||||
line = $0
|
||||
sub(/^[ \t]+/, "", line)
|
||||
buf = buf " " line
|
||||
}
|
||||
}
|
||||
END { if (buf != "") print buf }
|
||||
' CHANGELOG.md)
|
||||
if [ -z "$changelog" ]; then
|
||||
echo "No changelog bullets found for $release_version in CHANGELOG.md" >&2
|
||||
exit 1
|
||||
fi
|
||||
printf '%s\n' "$changelog" | head -c 500 > "$changelog_dir/$release_code.txt"
|
||||
+1
-1
@@ -14,7 +14,7 @@ func TestDecryptAgainstOpenSSL(t *testing.T) {
|
||||
t.Skip("openssl not available")
|
||||
}
|
||||
dir := t.TempDir()
|
||||
file := filepath.Join(dir, ".secret_vault")
|
||||
file := filepath.Join(dir, ".vault")
|
||||
|
||||
encrypt := `printf 'my-top-secret' | openssl enc -aes-256-cbc -md sha512 -a -pbkdf2 -iter 100000 -salt -pass pass:masterpw > ` + file
|
||||
if out, err := exec.Command("sh", "-c", encrypt).CombinedOutput(); err != nil {
|
||||
|
||||
Vendored
+1
-1
Submodule vendor/kryon updated: 63e6d98463...2ddeeecbdd.
+2
-2
@@ -1,4 +1,4 @@
|
||||
package gopass
|
||||
package pass
|
||||
|
||||
// Version is the current application version.
|
||||
const Version = "0.2.0"
|
||||
const Version = "0.2.3"
|
||||
+2
-2
@@ -22,8 +22,8 @@ cp -R "$root_dir/web/site/app/icons" "$out_dir/app/icons"
|
||||
cp "$root_dir/web/site/app/sw.js" "$out_dir/app/sw.js"
|
||||
cp "$goroot/lib/wasm/wasm_exec.js" "$out_dir/app/wasm_exec.js" 2>/dev/null || \
|
||||
cp "$goroot/misc/wasm/wasm_exec.js" "$out_dir/app/wasm_exec.js"
|
||||
(cd "$root_dir/web/wasm" && GOOS=js GOARCH=wasm go build -o "$out_dir/app/gopass.wasm" .)
|
||||
(cd "$root_dir/web/wasm" && GOOS=js GOARCH=wasm go build -o "$out_dir/app/pass.wasm" .)
|
||||
|
||||
test -s "$out_dir/app/gopass.wasm"
|
||||
test -s "$out_dir/app/pass.wasm"
|
||||
test -s "$out_dir/home.js"
|
||||
printf 'built site at %s\n' "$out_dir"
|
||||
+9
-8
@@ -1,8 +1,9 @@
|
||||
/downloads/gopass-cli-linux-amd64.tar.gz https://github.com/waozixyz/gopass/releases/latest/download/gopass-cli-linux-amd64.tar.gz 302
|
||||
/downloads/gopass-cli-linux-arm64.tar.gz https://github.com/waozixyz/gopass/releases/latest/download/gopass-cli-linux-arm64.tar.gz 302
|
||||
/downloads/gopass-cli-darwin-amd64.tar.gz https://github.com/waozixyz/gopass/releases/latest/download/gopass-cli-darwin-amd64.tar.gz 302
|
||||
/downloads/gopass-cli-darwin-arm64.tar.gz https://github.com/waozixyz/gopass/releases/latest/download/gopass-cli-darwin-arm64.tar.gz 302
|
||||
/downloads/gopass-cli-windows-amd64.zip https://github.com/waozixyz/gopass/releases/latest/download/gopass-cli-windows-amd64.zip 302
|
||||
/downloads/gopass-cli-windows-arm64.zip https://github.com/waozixyz/gopass/releases/latest/download/gopass-cli-windows-arm64.zip 302
|
||||
/downloads/gopass-gui-linux-amd64.tar.gz https://github.com/waozixyz/gopass/releases/latest/download/gopass-gui-linux-amd64.tar.gz 302
|
||||
/downloads/gopass-gui-linux-arm64.tar.gz https://github.com/waozixyz/gopass/releases/latest/download/gopass-gui-linux-arm64.tar.gz 302
|
||||
/downloads/pass-cli-linux-amd64.tar.gz https://github.com/waozixyz/pass/releases/latest/download/pass-cli-linux-amd64.tar.gz 302
|
||||
/downloads/pass-cli-linux-arm64.tar.gz https://github.com/waozixyz/pass/releases/latest/download/pass-cli-linux-arm64.tar.gz 302
|
||||
/downloads/pass-cli-darwin-amd64.tar.gz https://github.com/waozixyz/pass/releases/latest/download/pass-cli-darwin-amd64.tar.gz 302
|
||||
/downloads/pass-cli-darwin-arm64.tar.gz https://github.com/waozixyz/pass/releases/latest/download/pass-cli-darwin-arm64.tar.gz 302
|
||||
/downloads/pass-cli-windows-amd64.zip https://github.com/waozixyz/pass/releases/latest/download/pass-cli-windows-amd64.zip 302
|
||||
/downloads/pass-cli-windows-arm64.zip https://github.com/waozixyz/pass/releases/latest/download/pass-cli-windows-arm64.zip 302
|
||||
/downloads/pass-gui-linux-amd64.tar.gz https://github.com/waozixyz/pass/releases/latest/download/pass-gui-linux-amd64.tar.gz 302
|
||||
/downloads/pass-gui-linux-arm64.tar.gz https://github.com/waozixyz/pass/releases/latest/download/pass-gui-linux-arm64.tar.gz 302
|
||||
/downloads/pass-android.apk https://github.com/waozixyz/pass/releases/latest/download/pass-android.apk 302
|
||||
+3
-3
@@ -3,12 +3,12 @@
|
||||
const byId = id => document.getElementById(id);
|
||||
const generate = byId('generate'), copy = byId('copy'), result = byId('result'), message = byId('message');
|
||||
let copied = '', clearTimer = 0;
|
||||
document.addEventListener('gopass-ready', () => { byId('runtime-status').textContent = 'Ready · runs locally'; generate.disabled = false; });
|
||||
document.addEventListener('pass-ready', () => { byId('runtime-status').textContent = 'Ready · runs locally'; generate.disabled = false; });
|
||||
const go = new Go();
|
||||
WebAssembly.instantiateStreaming(fetch('gopass.wasm'), go.importObject).then(instance => go.run(instance.instance)).catch(error => { byId('runtime-status').textContent = 'Generator failed to load'; message.textContent = error; });
|
||||
WebAssembly.instantiateStreaming(fetch('pass.wasm'), go.importObject).then(instance => go.run(instance.instance)).catch(error => { byId('runtime-status').textContent = 'Generator failed to load'; message.textContent = error; });
|
||||
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', () => {
|
||||
const response = window.gopassGenerate(byId('site').value, byId('login').value, byId('master').value, Number(byId('length').value), Number(byId('counter').value), byId('lower').checked, byId('upper').checked, byId('digits').checked, byId('symbols').checked, byId('exclude').value);
|
||||
const response = window.passGenerate(byId('site').value, byId('login').value, byId('master').value, Number(byId('length').value), Number(byId('counter').value), byId('lower').checked, byId('upper').checked, byId('digits').checked, byId('symbols').checked, byId('exclude').value);
|
||||
if (response.error) { result.textContent = 'Unable to generate'; message.textContent = response.error; copy.disabled = true; return; }
|
||||
result.textContent = response.password; message.textContent = 'Generated locally in this tab'; copy.disabled = false;
|
||||
});
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="theme-color" content="#f3f1ea"><title>Generate — gopass</title><meta name="description" content="Generate a deterministic password locally in your browser."><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 class="app-page"><header class="site-header"><div class="site-header-inner"><a class="brand" href="/"><img src="/icons/icon-192.png" alt="">GOPASS</a><nav class="header-nav"><a href="/">Home</a><span id="runtime-status">Loading secure generator…</span></nav></div></header>
|
||||
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="theme-color" content="#f3f1ea"><title>Generate — pass</title><meta name="description" content="Generate a deterministic password locally in your browser."><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 class="app-page"><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="/">Home</a><span id="runtime-status">Loading secure generator…</span></nav></div></header>
|
||||
<main class="generator-shell"><section class="generator-card"><p class="eyebrow">LOCAL PASSWORD GENERATOR</p><h1>Generate a password</h1><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>
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
const cacheName = 'gopass-app-v2';
|
||||
const appFiles = ['/app/', '/app/app.js', '/app/wasm_exec.js', '/app/gopass.wasm', '/styles.css', '/manifest.webmanifest', '/icons/icon-192.png', '/icons/icon-512.png'];
|
||||
const cacheName = 'pass-app-v2';
|
||||
const appFiles = ['/app/', '/app/app.js', '/app/wasm_exec.js', '/app/pass.wasm', '/styles.css', '/manifest.webmanifest', '/icons/icon-192.png', '/icons/icon-512.png'];
|
||||
self.addEventListener('install', event => {
|
||||
self.skipWaiting();
|
||||
event.waitUntil(caches.open(cacheName).then(cache => cache.addAll(appFiles)));
|
||||
|
||||
+3
-3
@@ -5,7 +5,7 @@
|
||||
let copied = '', clearTimer = 0, started = false, ready = false, pending = false;
|
||||
|
||||
function runGenerate() {
|
||||
const response = window.gopassGenerate(byId('site').value, byId('login').value, byId('master').value, Number(byId('length').value), Number(byId('counter').value), byId('lower').checked, byId('upper').checked, byId('digits').checked, byId('symbols').checked, byId('exclude').value);
|
||||
const response = window.passGenerate(byId('site').value, byId('login').value, byId('master').value, Number(byId('length').value), Number(byId('counter').value), byId('lower').checked, byId('upper').checked, byId('digits').checked, byId('symbols').checked, byId('exclude').value);
|
||||
if (response.error) { result.textContent = 'Unable to generate'; message.textContent = response.error; copy.disabled = true; return; }
|
||||
result.textContent = response.password; message.textContent = 'Generated locally in this tab'; copy.disabled = false;
|
||||
}
|
||||
@@ -17,14 +17,14 @@
|
||||
script.src = '/app/wasm_exec.js';
|
||||
script.onload = () => {
|
||||
const go = new Go();
|
||||
WebAssembly.instantiateStreaming(fetch('/app/gopass.wasm'), go.importObject).then(instance => go.run(instance.instance)).catch(error => { message.textContent = 'Generator failed to load'; generate.textContent = error; });
|
||||
WebAssembly.instantiateStreaming(fetch('/app/pass.wasm'), go.importObject).then(instance => go.run(instance.instance)).catch(error => { message.textContent = 'Generator failed to load'; generate.textContent = error; });
|
||||
};
|
||||
script.onerror = () => { message.textContent = 'Generator failed to load'; };
|
||||
document.head.appendChild(script);
|
||||
}
|
||||
|
||||
['focusin', 'input', 'click'].forEach(type => card.addEventListener(type, startLoad, {passive: true, capture: true}));
|
||||
document.addEventListener('gopass-ready', () => { ready = true; generate.disabled = false; if (pending) { pending = false; runGenerate(); } });
|
||||
document.addEventListener('pass-ready', () => { ready = true; generate.disabled = false; if (pending) { pending = false; runGenerate(); } });
|
||||
|
||||
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', () => { if (!ready) { pending = true; message.textContent = 'Loading secure generator…'; return; } runGenerate(); });
|
||||
|
||||
+7
-6
@@ -3,8 +3,8 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>gopass — deterministic passwords</title>
|
||||
<meta name="description" content="Generate deterministic passwords locally with the BSD-licensed gopass CLI, desktop app, or browser app.">
|
||||
<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">
|
||||
<link rel="manifest" href="/manifest.webmanifest">
|
||||
@@ -13,10 +13,10 @@
|
||||
<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="">GOPASS</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>
|
||||
<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="gopass"><h1>One master password.<br><span>Every site covered.</span></h1><p class="lede">gopass 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><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>
|
||||
@@ -27,8 +27,9 @@
|
||||
</div><div class="privacy-line">No network requests. No password database.</div></div></div>
|
||||
</section>
|
||||
<section id="downloads"><p class="eyebrow">DOWNLOADS</p><h2>Choose your interface</h2><div class="cards">
|
||||
<article><span class="tag">DESKTOP</span><h3>GUI</h3><p>Visual controls, secure masked input, and clipboard clearing.</p><div class="links"><a href="/downloads/gopass-gui-linux-amd64.tar.gz">Linux x86_64</a><a href="/downloads/gopass-gui-linux-arm64.tar.gz">Linux 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/gopass-cli-linux-amd64.tar.gz">Linux</a><a href="/downloads/gopass-cli-darwin-arm64.tar.gz">macOS</a><a href="/downloads/gopass-cli-windows-amd64.zip">Windows</a></div></article>
|
||||
<article><span class="tag">ANDROID</span><h3>APK</h3><p>Native Android app with the same generator and biometric-protected master password storage.</p><div class="links"><a href="/downloads/pass-android.apk">Download APK</a></div></article>
|
||||
<article><span class="tag">DESKTOP</span><h3>GUI</h3><p>Visual controls, secure masked input, and clipboard clearing.</p><div class="links"><a href="/downloads/pass-gui-linux-amd64.tar.gz">Linux x86_64</a><a href="/downloads/pass-gui-linux-arm64.tar.gz">Linux 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</a><a href="/downloads/pass-cli-darwin-arm64.tar.gz">macOS</a><a href="/downloads/pass-cli-windows-amd64.zip">Windows</a></div></article>
|
||||
<article><span class="tag">BROWSER</span><h3>Web app</h3><p>The same Go generator compiled to WebAssembly. Runs entirely in your tab.</p><div class="links"><a href="/app/">Open web app</a></div></article>
|
||||
</div></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>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "gopass",
|
||||
"short_name": "gopass",
|
||||
"name": "pass",
|
||||
"short_name": "pass",
|
||||
"description": "Generate deterministic passwords locally.",
|
||||
"start_url": "/app/",
|
||||
"scope": "/app/",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
: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(3,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}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}
|
||||
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}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}}
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
module github.com/waozixyz/gopass/web
|
||||
module github.com/waozixyz/pass/web
|
||||
|
||||
go 1.24
|
||||
|
||||
require github.com/waozixyz/gopass v0.0.0
|
||||
require github.com/waozixyz/pass v0.0.0
|
||||
|
||||
replace github.com/waozixyz/gopass => ../..
|
||||
replace github.com/waozixyz/pass => ../..
|
||||
+3
-3
@@ -5,7 +5,7 @@ package main
|
||||
import (
|
||||
"syscall/js"
|
||||
|
||||
password "github.com/waozixyz/gopass"
|
||||
password "github.com/waozixyz/pass"
|
||||
)
|
||||
|
||||
func generate(_ js.Value, args []js.Value) any {
|
||||
@@ -25,7 +25,7 @@ func generate(_ js.Value, args []js.Value) any {
|
||||
|
||||
func main() {
|
||||
fn := js.FuncOf(generate)
|
||||
js.Global().Set("gopassGenerate", fn)
|
||||
js.Global().Get("document").Call("dispatchEvent", js.Global().Get("CustomEvent").New("gopass-ready"))
|
||||
js.Global().Set("passGenerate", fn)
|
||||
js.Global().Get("document").Call("dispatchEvent", js.Global().Get("CustomEvent").New("pass-ready"))
|
||||
select {}
|
||||
}
|
||||
Reference in new issue
Block a user