Repository navigation
refactor(rust): restructure codebase to facilitate server integration - #123
Merged
Merged
Conversation
Wrapping a key only needs its bytes, so `Wraps` now asks for `KeyMaterial`. `SymmetricKey` keeps what only a key that can seal needs. This makes room for wrapped keys that cannot wrap anything themselves, like a signing key. Also rename `RootKEK` to `RootKek`, the spelling the docs already use. No change to what is stored: the golden tests still pass unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The server has to store wrapped keys, but keygo-core also carries app-only code like TOTP, passkeys and the backup format. Move the key hierarchy, ids, AADs, KDFs and `Sealed<T>` into a crate both can depend on. Everything that can touch key material sits behind the `crypto` feature. Without it `Sealed<VaultKey>` can still be parsed and stored, but a key cannot be created, which is the view the server gets. The nonce is now plain bytes so `Sealed` compiles without the cipher, and const assertions keep the hard-coded lengths in line with it. `BackupKey`, `BackupAad` and `KeySource` move too, so `symmetric_key!` and the derive functions can stay private and no other crate can declare a key type. That makes `BackupKey`'s constructors, `Argon2Params` and `new_salt` public. keygo-core re-exports the crate as `crypto`, so its callers barely change. The stored format and the generated Kotlin bindings are unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A workspace build unifies features, so keygo-core turns `crypto` on and hides any dependency that leaks out from behind it. Build the crate on its own and fail if a cipher or KDF crate shows up in its tree. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…go-client The shared crate now holds more than keys, and the old keygo-core was only ever the app's: TOTP, passkeys, the backup format and the ARK session. The new names say which crate the server may depend on. Only names change. The generated Kotlin bindings are identical. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The server will store wrapped keys, so it needs their names and `Sealed<T>`, but must never be able to create a key. A workspace build turns `crypto` on for it anyway, so it would hide a server that uses it. Check the server on its own in CI too, and have the `serve` alias use `-p`, so it runs what the Docker image ships rather than a build with `crypto` on. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The OPAQUE identifier test used one repeated byte, so it could not see a change in byte order. Use distinct bytes, and pin the JSON form as well, before `UserId` moves to the shared crate. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Both sides hold the same id: it is generated by the client and equals the local user id. The shared type gains what the server relied on, `Deserialize`, `From<Uuid>` and `as_uuid`, and `domain` re-exports it so most callers stay as they are. `opaque_identifier` is server-only, and a method on a foreign type is not allowed, so it becomes a function. Its bytes and the JSON form are pinned by the tests added in the previous commit, whose expected values did not change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A workspace run unifies features, so keygo-client's crypto reached every crate and the builds without it were linted but never tested. Test both crates alone and leave keygo-server out of the workspace run. make test runs the same commands. The dependency checks could pass without checking anything: a failing cargo tree counted as no match, and renaming the feature hid a leak. Allow only the expected keygo-core deps, which also catches sha2 and any new mandatory dep, and confirm the pattern still matches keygo-client. Drop clippy -p keygo-server, as the new test step and clippy -p keygo-core catch what it did. Make rust-test wait for rust-lint, as the comments already said. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.