feat: add walletkit-testkit crate for reusable e2e test helpers#430
Open
kilianglas wants to merge 14 commits into
Open
feat: add walletkit-testkit crate for reusable e2e test helpers#430kilianglas wants to merge 14 commits into
kilianglas wants to merge 14 commits into
Conversation
…t-crate # Conflicts: # walletkit-cli/src/commands/proof.rs
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.
Summary
Adds a new
walletkit-testkitworkspace crate that consolidates the end-to-end / test-support logic previously triplicated acrosswalletkit-core's integration tests, thewalletkit-clibinary, and external consumers (e.g. orb-tools).walletkit-cliis migrated to consume it.The motivation: other services that interact with the World ID protocol via WalletKit (e.g. orb-tools) currently re-implement WalletKit's storage providers and on-chain proof logic by copy-pasting from the CLI. This crate exposes that surface as a reusable library so consumers can depend on it directly (by git rev) instead of duplicating it.
walletkit-testkitis not published (publish = false): it ships staging URLs and pre-registered test-RP / test-issuer private keys, and is intended to be consumed by git revision.What's in the crate
env—TestEnvconfig struct centralizing all staging fixtures (RP id/key, on-chain verifier address, World Chain RPC, faux-issuer URL + schema, local issuer key + schema).TestEnv::default()= staging; every field is overridable.storage— reusableStorageProviderimpls:InMemoryStorageProvider(ephemeral, XChaCha20Poly1305 keystore) andFsStorageProvider(filesystem, no-op keystore), plus store constructors and cleanup helpers.authenticator—init_authenticator(fs store + cached Groth16 +init_with_defaults) andregister_account(init_or_register→leaf_index).issuer— two interchangeable issuance strategies producing a sharedIssuedTestCredential:issue_faux_credential(hosted faux issuer, HTTP, schema 128) andissue_local_credential(local EdDSA, schema 47, deterministic / no service dependency).proof—build_test_request(RP-signed,TestEnv-parameterized) andverify_proof_onchain+VerifyItemResult(against theWorldIDVerifiercontract).flow—generate_and_verify_test_proof: high-level convenience wiring the full register → init → issue → prove → verify pipeline for either issuance strategy.CLI migration
walletkit-clinow consumes the testkit instead of carrying its own copies:provider.rs(storage now fromwalletkit_testkit::storage).sol\!verifier binding,VerifyItemResult,verify_proof_onchain,build_test_request,issue_test_credential, and all staging constants — imported from the testkit.--rpc-url/--verifier-addressare mapped onto aTestEnv.Testing
#[ignore]d staging e2e tests (tests/e2e.rs) exercise both issuance paths end-to-end and confirm on-chain verification. Both pass against staging.walletkit-clitests pass (including thegenerate-test-requesttests that drive the migrated builder).cargo clippy --workspace --all-targets,cargo fmt --check,cargo doc, andcargo build --workspaceare all green.Follow-ups (out of scope)
walletkit-core/teststo consume the testkit.walletkit-testkitby git rev and delete its copied modules.