Build Auth from its package and hash with the crypto package: manifest, lock, Makefile, Pass, the host, tests, Android sources and docs
This commit is contained in:
1 parent
1a4e0e0891
commit
ae502a322d
16 files changed
+85
-47
No files matched your search
@@ -142,7 +142,7 @@ jobs:
|
||||
path: |
|
||||
droid/app/.cxx
|
||||
droid/app/build/intermediates/cxx
|
||||
key: android-native-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('src/*.zi', 'shared/*.zi', 'apps/*/*.zi', 'droid/app/src/main/cpp/CMakeLists.txt', 'droid/app/build.gradle', 'ziran.lock') }}
|
||||
key: android-native-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('src/*.zi', 'apps/*/*.zi', 'droid/app/src/main/cpp/CMakeLists.txt', 'droid/app/build.gradle', 'ziran.lock') }}
|
||||
restore-keys: |
|
||||
android-native-${{ runner.os }}-${{ runner.arch }}-
|
||||
- name: Install Android SDK components
|
||||
|
||||
@@ -124,7 +124,7 @@ jobs:
|
||||
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', 'src/*.zi', 'shared/*.zi', 'apps/*/*.zi', 'ziran.lock') }}
|
||||
key: android-native-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('droid/app/src/main/cpp/CMakeLists.txt', 'droid/app/build.gradle', 'src/*.zi', 'apps/*/*.zi', 'ziran.lock') }}
|
||||
restore-keys: |
|
||||
android-native-${{ runner.os }}-${{ runner.arch }}-
|
||||
- name: Install Android SDK components
|
||||
|
||||
@@ -5,12 +5,13 @@ first.
|
||||
|
||||
## Tools are separate apps
|
||||
|
||||
- Each tool lives in `apps/<tool>/` and builds into its own bundle,
|
||||
`build/apps/<tool>.zx`. A tool reaches the host only through
|
||||
`shared/werk_app.zi`; the host (`src/apps.zi`) checks every call a
|
||||
bundle asks for and keeps each tool's files, assets and secret separate.
|
||||
- Tools never import another tool's modules. Code two tools need goes in
|
||||
`shared/`, as SHA-256 and PBKDF2 do.
|
||||
- Each tool builds into its own bundle, `build/apps/<tool>.zx`: Pass,
|
||||
Calculator and Clock from `apps/<tool>/`, Auth and Workbook from their own
|
||||
Ziran packages. The host (`src/apps.zi`) checks every call a bundle asks
|
||||
for and keeps each tool's files, assets and secret separate.
|
||||
- Tools never import another tool's modules. Code two tools need comes from
|
||||
a Ziran package, as SHA-256 and PBKDF2 come from `crypto`; no git
|
||||
submodules.
|
||||
- Keep the host interface small and generic (files, clock, clipboard,
|
||||
key derivation, device secret, input). A new host call needs a new host
|
||||
build before any bundle can use it.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
ZIRAN ?= ./scripts/ziran.sh
|
||||
# Gradle invokes make again for portable bundles. Inherited environment
|
||||
# variables otherwise export these shell-derived paths while resolving them.
|
||||
unexport ZIRAN_ROOT KRYON_DIR RAYLIB_DIR MINGCUTE_DIR LIBOQS_DIR MONOCYPHER_DIR QRCODE_DIR WORKBOOK_DIR ENTITY_DIR APPS_DIR
|
||||
unexport ZIRAN_ROOT KRYON_DIR RAYLIB_DIR MINGCUTE_DIR LIBOQS_DIR MONOCYPHER_DIR QRCODE_DIR WORKBOOK_DIR ENTITY_DIR APPS_DIR AUTH_DIR CRYPTO_DIR
|
||||
# Local overrides refer to the real root repositories. Published builds
|
||||
# require the exact versions recorded in the committed lock.
|
||||
LOCK_FLAGS := $(if $(wildcard ziran.local.toml),,--locked)
|
||||
@@ -18,6 +18,9 @@ QRCODE_DIR = $(shell $(ZIRAN) pkg path qrcode $(LOCK_FLAGS))
|
||||
WORKBOOK_DIR = $(shell $(ZIRAN) pkg path workbook $(LOCK_FLAGS))
|
||||
ENTITY_DIR = $(shell $(ZIRAN) pkg path entity $(LOCK_FLAGS))
|
||||
APPS_DIR = $(shell $(ZIRAN) pkg path apps $(LOCK_FLAGS))
|
||||
# Auth is its own package; SHA-256 and PBKDF2 come from the crypto package.
|
||||
AUTH_DIR = $(shell $(ZIRAN) pkg path auth $(LOCK_FLAGS))
|
||||
CRYPTO_DIR = $(shell $(ZIRAN) pkg path crypto $(LOCK_FLAGS))
|
||||
LIBOQS_FLAGS := -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_SHARED_LIBS=OFF -DOQS_BUILD_ONLY_LIB=ON \
|
||||
-DOQS_USE_OPENSSL=OFF -DOQS_DIST_BUILD=OFF -DOQS_OPT_TARGET=generic -DOQS_MINIMAL_BUILD=SIG_ml_dsa_44
|
||||
MONOCYPHER_SOURCES = $(MONOCYPHER_DIR)/src/monocypher.c $(MONOCYPHER_DIR)/src/optional/monocypher-ed25519.c
|
||||
@@ -28,7 +31,7 @@ DESKTOP_DIR ?= $(shell xdg-user-dir DESKTOP 2>/dev/null)
|
||||
# The tool bundles and Werkzeug's other files.
|
||||
LIB_DIR ?= $(HOME)/.local/lib/werk
|
||||
WEB_CC ?= $(if $(wildcard $(HOME)/emsdk/upstream/emscripten/emcc),$(HOME)/emsdk/upstream/emscripten/emcc,emcc)
|
||||
SOURCES := $(wildcard src/*.zi shared/*.zi apps/*/*.zi)
|
||||
SOURCES := $(wildcard src/*.zi apps/*/*.zi)
|
||||
LIBRARY_SOURCES = $(wildcard $(KRYON_DIR)/src/ui/*.zi $(KRYON_DIR)/src/ui/*/module.zi $(KRYON_DIR)/src/kss/*.zi $(KRYON_DIR)/src/backend/*.zi $(KRYON_DIR)/src/backend/*/module.zi $(ZIRAN_ROOT)/std/*.zi)
|
||||
ZIRAN_RUNTIME_SOURCES = $(wildcard $(ZIRAN_ROOT)/cmd/zir/*.[ch] $(ZIRAN_ROOT)/include/*.h)
|
||||
ENTITY_SOURCES = $(wildcard $(ENTITY_DIR)/src/*.zi $(ENTITY_DIR)/assets/entity/*)
|
||||
@@ -52,12 +55,12 @@ cli: build/pass
|
||||
|
||||
# Each app is its own bundle; Werkzeug runs them in one window. Workbook runs
|
||||
# only in the Linux desktop app, so the web and Android apps leave it out.
|
||||
APPS := pass auth calculator clock
|
||||
PORTABLE_BUNDLES := $(APPS:%=build/apps/%.zx) build/apps/entity.zx build/apps/apps.zx
|
||||
APPS := pass calculator clock
|
||||
PORTABLE_BUNDLES := $(APPS:%=build/apps/%.zx) build/apps/auth.zx build/apps/entity.zx build/apps/apps.zx
|
||||
APP_BUNDLES := $(PORTABLE_BUNDLES) build/apps/workbook.zx
|
||||
SHARED_SOURCES := $(wildcard shared/*.zi)
|
||||
CRYPTO_SOURCES = $(wildcard $(CRYPTO_DIR)/src/*.zi)
|
||||
APPS_UI_SOURCES = $(wildcard $(APPS_DIR)/src/*.zi $(APPS_DIR)/ui/*.zi $(APPS_DIR)/ui/locales/*.json)
|
||||
APP_MODULE_PATHS = --module-path shared --module-path kryon=$(KRYON_DIR)/src/backend --module-path kryon=$(KRYON_DIR)/src/ui --module-path $(KRYON_DIR)/src/ui --module-path $(MINGCUTE_DIR)/src --module-path $(ZIRAN_ROOT)/std
|
||||
APP_MODULE_PATHS = --module-path crypto=$(CRYPTO_DIR)/src --module-path kryon=$(KRYON_DIR)/src/backend --module-path kryon=$(KRYON_DIR)/src/ui --module-path $(KRYON_DIR)/src/ui --module-path $(MINGCUTE_DIR)/src --module-path $(ZIRAN_ROOT)/std
|
||||
apps: $(APP_BUNDLES)
|
||||
portable-apps: $(PORTABLE_BUNDLES)
|
||||
# Compile the shared screen with the host's compiler and UI library. The
|
||||
@@ -70,11 +73,16 @@ build/apps/apps.zx: $(APPS_UI_SOURCES) $(LIBRARY_SOURCES) $(ZIRAN_RUNTIME_SOURCE
|
||||
sha256sum $@ | cut -d ' ' -f 1 > $(@D)/apps.sha256
|
||||
test "$$(cat $(@D)/apps.sha256)" = "$$(cat apps-controller.sha256)"
|
||||
.SECONDEXPANSION:
|
||||
build/apps/%.zx: $$(wildcard apps/$$*/*.zi apps/$$*/assets/*) $(SHARED_SOURCES) $(LIBRARY_SOURCES) $(ZIRAN_RUNTIME_SOURCES) ziran.lock Makefile scripts/ziran.sh
|
||||
build/apps/%.zx: $$(wildcard apps/$$*/*.zi apps/$$*/assets/*) $(CRYPTO_SOURCES) $(LIBRARY_SOURCES) $(ZIRAN_RUNTIME_SOURCES) ziran.lock Makefile scripts/ziran.sh
|
||||
mkdir -p $(@D)
|
||||
$(ZIRAN) bundle --root . --module-path apps/$* $(APP_MODULE_PATHS) --define KRYON_HOSTED_UI --define WERK_APP \
|
||||
$(if $(wildcard apps/$*/assets),--asset-dir assets=apps/$*/assets) --entry $*:Main -o $@ apps/$*/$*.zi
|
||||
|
||||
build/apps/auth.zx: $(wildcard $(AUTH_DIR)/src/*.zi) $(CRYPTO_SOURCES) $(LIBRARY_SOURCES) $(ZIRAN_RUNTIME_SOURCES) ziran.lock Makefile scripts/ziran.sh
|
||||
mkdir -p $(@D)
|
||||
$(ZIRAN) bundle --root $(AUTH_DIR) --module-path $(AUTH_DIR)/src $(APP_MODULE_PATHS) --define KRYON_HOSTED_UI --define WERK_APP \
|
||||
--entry auth:Main -o $@ $(AUTH_DIR)/src/auth.zi
|
||||
|
||||
build/apps/workbook.zx: $(wildcard $(WORKBOOK_DIR)/src/*.zi) $(LIBRARY_SOURCES) $(ZIRAN_RUNTIME_SOURCES) ziran.lock Makefile
|
||||
mkdir -p $(@D)
|
||||
$(ZIRAN) bundle --root $(WORKBOOK_DIR) --module-path $(WORKBOOK_DIR)/src $(APP_MODULE_PATHS) \
|
||||
@@ -89,7 +97,7 @@ build/apps/entity.zx: $(ENTITY_SOURCES) $(LIBRARY_SOURCES) $(ZIRAN_RUNTIME_SOURC
|
||||
build/ziran/libziran.a: ziran.lock $(ZIRAN_RUNTIME_SOURCES)
|
||||
env -u DISPLAY -u WAYLAND_DISPLAY -u MAKEFLAGS -u MFLAGS -u MAKEOVERRIDES $(MAKE) -C $(ZIRAN_ROOT) BUILD_DIR=$(abspath build/ziran) $(abspath $@)
|
||||
|
||||
build/generated/desktop/.complete: $(wildcard src/*.zi) $(wildcard $(WORKBOOK_DIR)/src/*.zi) $(SHARED_SOURCES) $(LIBRARY_SOURCES) $(ENTITY_SOURCES) ziran.toml ziran.lock
|
||||
build/generated/desktop/.complete: $(wildcard src/*.zi) $(wildcard $(WORKBOOK_DIR)/src/*.zi) $(CRYPTO_SOURCES) $(LIBRARY_SOURCES) $(ENTITY_SOURCES) ziran.toml ziran.lock
|
||||
rm -rf $(@D)
|
||||
mkdir -p $(@D)
|
||||
$(ZIRAN) build $(PROJECT) --define PLATFORM_DESKTOP --target=c --entry desktop:main -o $(@D) src/desktop.zi
|
||||
@@ -139,7 +147,7 @@ WEB_AR ?= $(dir $(WEB_CC))emar
|
||||
build/web-runtime/libziran.a: ziran.lock
|
||||
env -u DISPLAY -u WAYLAND_DISPLAY -u MAKEFLAGS -u MFLAGS -u MAKEOVERRIDES $(MAKE) -C $(ZIRAN_ROOT) BOOTSTRAP=1 BUILD_DIR=$(abspath build/web-runtime) \
|
||||
CC=$(WEB_CC) AR=$(WEB_AR) OBJCOPY=true CFLAGS=-O2 $(abspath $@)
|
||||
build/generated/browser/.complete: $(wildcard src/*.zi) $(SHARED_SOURCES) $(LIBRARY_SOURCES) ziran.toml ziran.lock
|
||||
build/generated/browser/.complete: $(wildcard src/*.zi) $(CRYPTO_SOURCES) $(LIBRARY_SOURCES) ziran.toml ziran.lock
|
||||
rm -rf $(@D)
|
||||
mkdir -p $(@D)
|
||||
$(ZIRAN) build $(PROJECT) --define PLATFORM_WEB --target=c -o $(@D) src/browser.zi
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#import "sha256"
|
||||
#import "crypto/sha256"
|
||||
#if #defined(WERK_APP) {
|
||||
#import "kryon/app_context"
|
||||
}
|
||||
@@ -57,10 +57,14 @@ DeriveKey :: (password: string, salt: string) -> [32]u8 {
|
||||
derive_failed = !AppPbkdf2Sha256(password, salt, 100000, output[:])
|
||||
return output
|
||||
} else {
|
||||
return Pbkdf2Sha256(password, salt, 100000)
|
||||
return Pbkdf2Sha256(password, ifx salt.count > PASS_SALT_LIMIT then salt[0:PASS_SALT_LIMIT] else salt, 100000)
|
||||
}
|
||||
}
|
||||
|
||||
// Werkzeug's key derivation has always read at most this many salt bytes,
|
||||
// and existing vault keys depend on it; the host derives the same way.
|
||||
PASS_SALT_LIMIT :: 508
|
||||
|
||||
|
||||
PassClassEmptyError :: (class_index: s32) -> string {
|
||||
if class_index == 0 {
|
||||
@@ -319,7 +323,7 @@ MasterEmoji :: (master: string, output: []u8) -> s32 {
|
||||
if output.count <= 0 { return 0 }
|
||||
output[0] = cast(u8)0
|
||||
|
||||
digest := Sha256(master)
|
||||
digest := Sha256Of(master)
|
||||
used: s32 = 0
|
||||
for index: 0..3 {
|
||||
codepoint: u32 = cast(u32)master_emoji_codepoints[
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#import "pass_core"
|
||||
#import "sha256"
|
||||
#import "crypto/sha256"
|
||||
|
||||
#program_export
|
||||
DigestMatches :: (left: [32]u8, right: [32]u8) -> bool {
|
||||
@@ -11,8 +11,8 @@ DigestMatches :: (left: [32]u8, right: [32]u8) -> bool {
|
||||
|
||||
#program_export
|
||||
Answer :: () -> s32 {
|
||||
empty := Sha256("")
|
||||
abc := Sha256("abc")
|
||||
empty := Sha256Of("")
|
||||
abc := Sha256Of("abc")
|
||||
derived := DeriveKey("password", "salt")
|
||||
if empty[0] != cast(u8)0xe3 || empty[31] != cast(u8)0x55 { return 1 }
|
||||
if abc[0] != cast(u8)0xba || abc[31] != cast(u8)0xad { return 2 }
|
||||
@@ -117,7 +117,7 @@ Answer :: () -> s32 {
|
||||
|
||||
#program_export
|
||||
PortableAnswer :: () -> s32 {
|
||||
digest := HmacSha256("password", "salt")
|
||||
digest := HmacSha256Of("password", "salt")
|
||||
if digest[0] != cast(u8)0xfc || digest[31] != cast(u8)0xd0 {
|
||||
return 1
|
||||
}
|
||||
|
||||
+9
-8
@@ -94,12 +94,14 @@ opens the window on one tool, as Harmony's Auth entry does.
|
||||
|
||||
## Tools are separate apps
|
||||
|
||||
Each tool lives in `apps/<tool>/` and is built into its own portable bundle,
|
||||
`build/apps/<tool>.zx`. All four are preinstalled. A tool reaches the host
|
||||
only through the calls in `shared/werk_app.zi` (its private files,
|
||||
clipboard, clock, key derivation and device-protected secret), and the host
|
||||
checks every call a bundle asks for before it runs. Tools never import each
|
||||
other.
|
||||
Each tool is built into its own portable bundle, `build/apps/<tool>.zx`:
|
||||
Pass, Calculator and Clock from `apps/<tool>/`, Auth from its own Ziran
|
||||
package ([waozixyz/auth](https://github.com/waozixyz/auth)). All four are
|
||||
preinstalled. A tool reaches the host only through Kryon's app context (its
|
||||
private files, clipboard, clock, key derivation and device-protected
|
||||
secret), and the host checks every call a bundle asks for before it runs.
|
||||
Tools never import each other; what two need, such as SHA-256 and PBKDF2,
|
||||
comes from a Ziran package (`crypto`).
|
||||
|
||||
## Build and test
|
||||
|
||||
@@ -191,10 +193,9 @@ print the generated password instead. Run `pass --help` for all flags.
|
||||
|
||||
```text
|
||||
apps/pass/ Pass: LessPass core, settings and profiles, screens, CLI
|
||||
apps/auth/ Auth: TOTP, otpauth links, exports, accounts and screens
|
||||
auth (package) Auth: TOTP, otpauth links, exports, accounts and screens (waozixyz/auth)
|
||||
apps/calculator/ Calculator
|
||||
apps/clock/ Clock and stopwatch
|
||||
shared/ the app interface, protocol and SHA-256/PBKDF2
|
||||
src/werk.zi home screen, profile screen and the bar above a tool
|
||||
src/apps.zi loads, checks and runs the app bundles
|
||||
src/platform.zi files, clock, clipboard and secrets per platform
|
||||
|
||||
@@ -41,7 +41,7 @@ werk_package(RAYLIB_DIR raylib "/src")
|
||||
werk_package(LIBOQS_DIR liboqs "")
|
||||
werk_package(MONOCYPHER_DIR monocypher "")
|
||||
file(GLOB_RECURSE SOURCE_INPUTS CONFIGURE_DEPENDS
|
||||
"${REPO_ROOT}/src/*.zi" "${REPO_ROOT}/shared/*.zi" "${KRYON_DIR}/src/*.zi" "${ZIRAN_ROOT}/std/*.zi")
|
||||
"${REPO_ROOT}/src/*.zi" "${KRYON_DIR}/src/*.zi" "${ZIRAN_ROOT}/std/*.zi")
|
||||
list(APPEND SOURCE_INPUTS "${REPO_ROOT}/ziran.toml" "${REPO_ROOT}/ziran.lock")
|
||||
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${SOURCE_INPUTS})
|
||||
execute_process(COMMAND "${ZIRAN}" build --project ${LOCK_FLAGS} ${DEFINES}
|
||||
|
||||
@@ -8,12 +8,15 @@ cd "$root"
|
||||
ziran_root=$("$ziran" pkg path ziran)
|
||||
kryon=$("$ziran" pkg path kryon)
|
||||
mingcute=$("$ziran" pkg path mingcute)
|
||||
# Auth runs its own tests from its package, with the hashes from crypto.
|
||||
auth=$("$ziran" pkg path auth)
|
||||
crypto=$("$ziran" pkg path crypto)
|
||||
mkdir -p build/app-logic-test
|
||||
"$ziran" bundle --root . --module-path apps/auth --module-path shared --module-path "$ziran_root/std" \
|
||||
--entry totp_test:Run -o build/app-logic-test/totp.zx apps/auth/totp_test.zi
|
||||
"$ziran" bundle --root "$auth" --module-path "$auth/src" --module-path "crypto=$crypto/src" --module-path "$ziran_root/std" \
|
||||
--entry totp_test:Run -o build/app-logic-test/totp.zx "$auth/tests/totp_test.zi"
|
||||
test "$("$ziran" run build/app-logic-test/totp.zx)" = 0
|
||||
"$ziran" bundle --root . --module-path apps/auth --module-path shared --module-path "$ziran_root/std" \
|
||||
--entry exports_test:Run -o build/app-logic-test/exports.zx apps/auth/exports_test.zi
|
||||
"$ziran" bundle --root "$auth" --module-path "$auth/src" --module-path "crypto=$crypto/src" --module-path "$ziran_root/std" \
|
||||
--entry exports_test:Run -o build/app-logic-test/exports.zx "$auth/tests/exports_test.zi"
|
||||
test "$("$ziran" run build/app-logic-test/exports.zx)" = 0
|
||||
"$ziran" bundle --root . --module-path apps/calculator --module-path "$ziran_root/std" \
|
||||
--entry arithmetic_test:Run -o build/app-logic-test/arithmetic.zx apps/calculator/arithmetic_test.zi
|
||||
|
||||
@@ -7,7 +7,8 @@ root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
|
||||
cd "$root"
|
||||
ziran_root=$("$ziran" pkg path ziran)
|
||||
kryon=$("$ziran" pkg path kryon)
|
||||
args="--root tests --module-path apps/pass --module-path shared --module-path kryon=$kryon/src/backend --module-path kryon=$kryon/src/ui --module-path $kryon/src/ui --module-path $ziran_root/std"
|
||||
crypto=$("$ziran" pkg path crypto)
|
||||
args="--root tests --module-path apps/pass --module-path crypto=$crypto/src --module-path kryon=$kryon/src/backend --module-path kryon=$kryon/src/ui --module-path $kryon/src/ui --module-path $ziran_root/std"
|
||||
mkdir -p build/pass-state-test
|
||||
"$ziran" build $args --target=c -o build/pass-state-test/c tests/pass_state_test.zi
|
||||
${CC:-cc} -std=c99 -O2 -ffunction-sections -fdata-sections -Wl,--gc-sections -I"$ziran_root/include" -Ibuild/pass-state-test/c build/pass-state-test/c/*.c -o build/pass-state-test/native
|
||||
|
||||
@@ -50,7 +50,7 @@ window = None
|
||||
FIXTURE_SECRET = base64.b32encode(b"12345678901234567890").decode()
|
||||
FIXTURE_LINK = f"otpauth://totp/Fixture:[email protected]?secret={FIXTURE_SECRET}&issuer=Fixture"
|
||||
# A Google Authenticator export of the same key, an RFC 6238 SHA-256 key and
|
||||
# a counter-based account (see apps/auth/exports_test.zi).
|
||||
# a counter-based account (see tests/exports_test.zi in the auth package).
|
||||
MIGRATION_LINK = ("otpauth-migration://offline?data=CjoKFDEyMzQ1Njc4OTAxMjM0NTY3ODkwEhxFeGFtcGxlIENvOmFsaWNl"
|
||||
"QGV4YW1wbGUuY29tIAEoATACCjUKIDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MDEyEgNib2IaBlNlY29uZCAC"
|
||||
"KAIwAgorChQxMjM0NTY3ODkwMTIzNDU2Nzg5MBIHY291bnRlchoESG90cCABKAEwARABGAEgACi5YA%3D%3D")
|
||||
|
||||
@@ -4,7 +4,7 @@ ziran=${1:?pass the ziran command}
|
||||
repo=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
|
||||
cd "$repo"
|
||||
ziran_root=$("$ziran" pkg path ziran)
|
||||
paths="--module-path apps/pass --module-path shared"
|
||||
paths="--module-path apps/pass --module-path crypto=$("$ziran" pkg path crypto)/src"
|
||||
mkdir -p build/core-test
|
||||
"$ziran" check --root tests $paths tests/core_main.zi
|
||||
"$ziran" build --target=c --root tests $paths -o build/core-test/c tests/core_main.zi
|
||||
|
||||
+6
-2
@@ -20,7 +20,7 @@ using UI :: #import "kryon/Widgets";
|
||||
#import "kryon/key_input"
|
||||
#import "platform"
|
||||
#import "files"
|
||||
#import "sha256"
|
||||
#import "crypto/sha256"
|
||||
#import "records"
|
||||
#import "entity_host"
|
||||
#import "entity_management"
|
||||
@@ -384,7 +384,11 @@ AppCall :: (context: *void, module: *u8, function: *u8,
|
||||
ReturnText(result, "")
|
||||
return 1
|
||||
}
|
||||
derived := Pbkdf2Sha256(ArgumentText(arguments[0]), ArgumentText(arguments[1]), cast(s32)iterations)
|
||||
// Key derivation has always read at most 508 salt bytes; existing
|
||||
// vault keys depend on it.
|
||||
salt := ArgumentText(arguments[1])
|
||||
if salt.count > 508 { salt = salt[0:508] }
|
||||
derived := Pbkdf2Sha256(ArgumentText(arguments[0]), salt, cast(s32)iterations)
|
||||
ReturnBytes(result, derived[:])
|
||||
for index: 0..31 {
|
||||
derived[index] = cast(u8)0
|
||||
|
||||
+2
-2
@@ -8,8 +8,8 @@
|
||||
#import "std/text_buffer"
|
||||
#import "std/number_text"
|
||||
#import "std/timer_linux"
|
||||
#import "totp"
|
||||
#import "exports"
|
||||
#import "auth/totp"
|
||||
#import "auth/exports"
|
||||
Platform :: #import "platform";
|
||||
Accounts :: #import "account";
|
||||
Records :: #import "records";
|
||||
|
||||
+10
-2
@@ -84,6 +84,14 @@
|
||||
"source": true,
|
||||
"url": "https://github.com/LoupVaillant/Monocypher.git"
|
||||
},
|
||||
{
|
||||
"commit": "fbbffbc53e3cabaf6190cff468b56d967da045c8",
|
||||
"dependencies": {"crypto": "pf039d7a776333200", "kryon": "p681e883c26cf5268", "mingcute": "pe1027b9d16704793"},
|
||||
"id": "p83f5089a79a17294",
|
||||
"name": "auth",
|
||||
"ref": "master",
|
||||
"url": "https://github.com/waozixyz/auth.git"
|
||||
},
|
||||
{
|
||||
"commit": "f7449b379540f6f6f53c64c980cb5d4d4abcf399",
|
||||
"dependencies": {"daochi_client": "p0cff069893bdc938", "kryon": "p681e883c26cf5268", "monocypher": "p809b4d31a48625a3", "qrcode": "p0dfa70137405b096"},
|
||||
@@ -101,7 +109,7 @@
|
||||
"url": "https://github.com/kryonlabs/mingcute.git"
|
||||
},
|
||||
{
|
||||
"commit": "08bbad051379813d0fd1c3bb7bb6814f3491da75",
|
||||
"commit": "d11e915b5ee809b1f76b35850dda71f63ec9e09c",
|
||||
"dependencies": {},
|
||||
"id": "pf039d7a776333200",
|
||||
"name": "crypto",
|
||||
@@ -110,7 +118,7 @@
|
||||
}
|
||||
],
|
||||
"root": {
|
||||
"dependencies": {"apps": "p3c73796b4662b488", "daochi_client": "p0cff069893bdc938", "entity": "pb7942f184eef21db", "kryon": "p681e883c26cf5268", "liboqs": "p4b0a50b49959e674", "mingcute": "pe1027b9d16704793", "monocypher": "p809b4d31a48625a3", "oqs": "p7098ac9cd92f7e5f", "workbook": "p0e0131936e76f979"},
|
||||
"dependencies": {"apps": "p3c73796b4662b488", "auth": "p83f5089a79a17294", "crypto": "pf039d7a776333200", "daochi_client": "p0cff069893bdc938", "entity": "pb7942f184eef21db", "kryon": "p681e883c26cf5268", "liboqs": "p4b0a50b49959e674", "mingcute": "pe1027b9d16704793", "monocypher": "p809b4d31a48625a3", "oqs": "p7098ac9cd92f7e5f", "workbook": "p0e0131936e76f979"},
|
||||
"name": "Werkzeug"
|
||||
},
|
||||
"toolchain": {
|
||||
|
||||
+9
-1
@@ -2,7 +2,7 @@
|
||||
tool = "kryon"
|
||||
name = "Werkzeug"
|
||||
entry = "src/desktop.zi"
|
||||
module_roots = ["src", "shared", "apps/pass", "apps/auth"]
|
||||
module_roots = ["src", "apps/pass"]
|
||||
|
||||
[toolchain]
|
||||
git = "https://github.com/ziranlang/ziran.git"
|
||||
@@ -52,6 +52,14 @@ source = true
|
||||
git = "https://github.com/waozixyz/entity.git"
|
||||
ref = "master"
|
||||
|
||||
[dependencies.auth]
|
||||
git = "https://github.com/waozixyz/auth.git"
|
||||
ref = "master"
|
||||
|
||||
[dependencies.crypto]
|
||||
git = "https://github.com/ziranlang/crypto.git"
|
||||
ref = "master"
|
||||
|
||||
[dependencies.workbook]
|
||||
git = "https://github.com/waozixyz/workbook.git"
|
||||
ref = "master"
|
||||
Reference in new issue
Block a user