Skip to content

Add Age key helper (X25519/Hybrid) and end-to-end key validation APIs#317

Merged
Goooler merged 13 commits into
trunkfrom
copilot/pull-768
Jun 7, 2026
Merged

Add Age key helper (X25519/Hybrid) and end-to-end key validation APIs#317
Goooler merged 13 commits into
trunkfrom
copilot/pull-768

Conversation

Copy link
Copy Markdown

Copilot AI commented Jun 7, 2026

This ports the upstream Age key helper feature into Tabby: users can now generate X25519/MLKEM768-X25519 keypairs, derive public keys from secrets, and validate Age keys from settings.
The change wires these capabilities through the full native/core stack and exposes them in Meta Feature settings.

Ports MetaCubeX#768.

  • Core bridge + native exports

    • Added Go native exports for:
      • keypair generation (genX25519KeyPair, genHybridKeyPair)
      • secret/public key validation
      • secret→public conversion
    • Added corresponding JNI bindings in core/src/main/cpp/main.c.
    • Extended Kotlin bridge externs in Bridge.kt and surfaced high-level APIs in Clash.kt.
    • Added AgeKeyPair model for typed keypair decoding.
  • Validation behavior

    • Updated age secret key validation to use core verification logic instead of prefix-only checks, so validation matches actual core parsing/acceptance behavior.
  • Settings UX (Meta Features)

    • Added an Age Key section with two entry points:
      • X25519
      • MLKEM768-X25519
    • Added helper dialog capabilities:
      • generate keypair
      • derive public key from secret
      • copy secret/public key
      • inline invalid-state feedback for secret/public fields
  • Localization/resources

    • Added new Age helper strings across existing locale files.
    • Added non-translatable key-type labels in ui/settings/src/main/res/values/non-translatable.xml.
val keyPair = Clash.genX25519KeyPair()
val okSecret = Clash.veritySecretKeys(keyPair.secretKey)
val publicKey = Clash.toPublicKeys(keyPair.secretKey).firstOrNull()
val okPublic = Clash.verityPublicKeys(publicKey.orEmpty())

Copilot AI changed the title Port ClashMetaForAndroid PR #768 age key helper Port PR #768: add Age key helper (X25519/Hybrid) and end-to-end key validation APIs Jun 7, 2026
Copilot AI requested a review from Goooler June 7, 2026 00:07
@Goooler Goooler changed the title Port PR #768: add Age key helper (X25519/Hybrid) and end-to-end key validation APIs Add Age key helper (X25519/Hybrid) and end-to-end key validation APIs Jun 7, 2026
@Goooler Goooler requested a review from Copilot June 7, 2026 00:24
@Goooler Goooler marked this pull request as ready for review June 7, 2026 00:25
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR ports the upstream “Age key helper” feature into Tabby, adding end-to-end support (native → JNI → Kotlin → settings UI) for generating Age keypairs (X25519 and MLKEM768-X25519), deriving public keys from secrets, and validating secret/public keys using core logic.

Changes:

  • Added native/core exports + JNI + Kotlin bridge APIs for Age keypair generation, secret→public derivation, and key validation.
  • Updated Age secret-key validation to rely on core verification instead of a prefix-only heuristic.
  • Added a Meta Features “Age Key” settings section with a helper dialog and localized strings/resources.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
ui/settings/src/main/res/values/strings.xml Adds Age Key helper UI strings (EN).
ui/settings/src/main/res/values/non-translatable.xml Adds non-translatable key-type labels (X25519 / MLKEM768-X25519).
ui/settings/src/main/res/values-zh/strings.xml Adds Age Key helper UI strings (ZH).
ui/settings/src/main/res/values-zh-rTW/strings.xml Adds Age Key helper UI strings (ZH-TW).
ui/settings/src/main/res/values-zh-rHK/strings.xml Adds Age Key helper UI strings (ZH-HK).
ui/settings/src/main/res/values-vi/strings.xml Adds Age Key helper UI strings (VI).
ui/settings/src/main/res/values-ru/strings.xml Adds Age Key helper UI strings (RU).
ui/settings/src/main/res/values-ko-rKR/strings.xml Adds Age Key helper UI strings (KO-KR).
ui/settings/src/main/res/values-ja-rJP/strings.xml Adds Age Key helper UI strings (JA-JP).
ui/settings/src/main/kotlin/com/github/kr328/clash/settings/ui/MetaFeatureSettingsScreen.kt Adds settings entries + Compose dialog for generating/deriving/copying/validating keys.
glue/src/main/kotlin/com/github/kr328/clash/glue/util/Validator.kt Switches Age secret key validator to core-based verification.
core/src/main/kotlin/com/github/kr328/clash/core/model/AgeKeyPair.kt Introduces a typed model for decoded keypair results.
core/src/main/kotlin/com/github/kr328/clash/core/Clash.kt Exposes high-level Kotlin APIs for keypair generation / validation / derivation.
core/src/main/kotlin/com/github/kr328/clash/core/bridge/Bridge.kt Adds new JNI extern declarations for Age helper APIs.
core/src/main/golang/native/config/age.go Adds Go-side wrappers for Age helper operations.
core/src/main/golang/native/config.go Exports new cgo functions for JNI to call (generate/verify/derive).
core/src/main/cpp/main.c Wires new exported native functions into JNI entry points.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread ui/settings/src/main/res/values/strings.xml Outdated
Comment thread ui/settings/src/main/res/values-zh/strings.xml Outdated
Comment thread ui/settings/src/main/res/values-zh-rTW/strings.xml Outdated
Comment thread ui/settings/src/main/res/values-zh-rHK/strings.xml Outdated
Comment thread ui/settings/src/main/res/values-vi/strings.xml Outdated
Comment thread ui/settings/src/main/res/values-ja-rJP/strings.xml Outdated
Comment thread glue/src/main/kotlin/com/github/kr328/clash/glue/util/Validator.kt
Comment thread core/src/main/kotlin/com/github/kr328/clash/core/Clash.kt
Goooler and others added 5 commits June 7, 2026 08:29
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 17 out of 17 changed files in this pull request and generated 3 comments.

Comment thread core/src/main/kotlin/com/github/kr328/clash/core/Clash.kt
Comment thread core/src/main/kotlin/com/github/kr328/clash/core/Clash.kt
Comment thread glue/src/main/kotlin/com/github/kr328/clash/glue/util/Validator.kt
Goooler and others added 2 commits June 7, 2026 08:41
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@Goooler Goooler merged commit 2788fe4 into trunk Jun 7, 2026
3 checks passed
@Goooler Goooler deleted the copilot/pull-768 branch June 7, 2026 00:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants