chore(vetkeys): split basic_ibe into self-contained motoko + rust examples#1443
Open
marc0olo wants to merge 6 commits into
Open
chore(vetkeys): split basic_ibe into self-contained motoko + rust examples#1443marc0olo wants to merge 6 commits into
marc0olo wants to merge 6 commits into
Conversation
…mples Previously basic_ibe lived only under rust/vetkeys/basic_ibe with a shared frontend symlinked into motoko/ and rust/ subdirs. Split it into two self-contained examples that match the basic_vetkd layout: motoko/vetkeys/basic_ibe/ backend/app.mo + own frontend/ + icp.yaml rust/vetkeys/basic_ibe/ backend/ (flattened) + own frontend/ + icp.yaml Frontend - Duplicated per language; bindings now generated by the @icp-sdk/bindgen Vite plugin from the committed backend/backend.did (replaces the shared scripts/gen_bindings.sh that always used the Rust .did). - Slimmed to the established shape: dropped eslint/prettier/gen_bindings and the BACKEND-env dev logic; added a root workspace package.json so `npm run dev` / `npm run build` run from the example root. Backend - Motoko: idiomatic camelCase public interface (getMyMessages, .encryptedMessage, ...); the vetKD management-canister interface is kept snake_case (fixed system API). moc 1.11.0 + --default-persistent-actors (dropped the now-redundant `persistent` keyword); dropped unused sha2 dep. Committed backend/backend.did. - Rust: unchanged (snake_case), just relocated to the flattened layout. Docs & CI - README split per language (cross-linked), prerequisites link each tool with its install command inline. - vetkeys-basic-ibe.yml: motoko + rust jobs now target the new paths, watch both motoko/** and rust/**, and run test.sh. CODEOWNERS is unchanged: /motoko/vetkeys/ and /rust/vetkeys/ both already map to @dfinity/core-protocol, so both examples keep that owner. Verified locally: Motoko deploy + test.sh + state survives an upgrade; Rust cargo/wasm build + deploy + test.sh; both frontends build and serve. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Splits the vetkeys/basic_ibe example into two self-contained examples (Motoko + Rust), each with its own frontend and project config, and updates CI accordingly to build/deploy/test both language variants independently.
Changes:
- Introduces standalone Motoko example at
motoko/vetkeys/basic_ibe(backend, frontend,icp.yaml,mops.toml, docs, tests). - Refactors Rust example at
rust/vetkeys/basic_ibeinto the flattened layout with its own frontend/bindgen flow, docs, and tests. - Updates
.github/workflows/vetkeys-basic-ibe.ymlto run Motoko + Rust deploy-and-test jobs against the new paths.
Reviewed changes
Copilot reviewed 30 out of 40 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
.github/workflows/vetkeys-basic-ibe.yml |
Runs deploy + test.sh for both Motoko and Rust example directories and watches both paths. |
motoko/vetkeys/basic_ibe/README.md |
Adds Motoko-specific README and cross-link to Rust variant. |
motoko/vetkeys/basic_ibe/icp.yaml |
Defines backend + frontend canisters and frontend build steps for Motoko example. |
motoko/vetkeys/basic_ibe/mops.toml |
Pins Motoko toolchain/settings and declares backend entry + candid path. |
motoko/vetkeys/basic_ibe/package.json |
Adds per-example npm workspace root for running frontend scripts from the example root. |
motoko/vetkeys/basic_ibe/test.sh |
Adds basic CLI tests for Motoko backend endpoints. |
motoko/vetkeys/basic_ibe/backend/app.mo |
Motoko backend implementation with camelCase public API and vetKD system API types. |
motoko/vetkeys/basic_ibe/backend/backend.did |
Committed Motoko Candid interface used for frontend bindgen. |
motoko/vetkeys/basic_ibe/frontend/index.html |
Adds Motoko frontend entry HTML for Vite build. |
motoko/vetkeys/basic_ibe/frontend/package.json |
Frontend deps/scripts including @icp-sdk/bindgen plugin usage. |
motoko/vetkeys/basic_ibe/frontend/tsconfig.json |
TypeScript config for the Motoko frontend. |
motoko/vetkeys/basic_ibe/frontend/vite.config.ts |
Vite config generating bindings from backend/backend.did and local dev cookie/proxy wiring. |
motoko/vetkeys/basic_ibe/frontend/.gitignore |
Ignores dist/, node_modules/, and generated bindings output. |
motoko/vetkeys/basic_ibe/frontend/public/.ic-assets.json5 |
Sets hardened asset canister headers/CSP for the Motoko frontend. |
motoko/vetkeys/basic_ibe/frontend/public/vite.svg |
Adds frontend favicon asset. |
motoko/vetkeys/basic_ibe/frontend/src/main.ts |
Motoko frontend logic using generated bindings and II auth. |
motoko/vetkeys/basic_ibe/frontend/src/style.css |
Frontend styling for the Motoko UI. |
motoko/vetkeys/basic_ibe/frontend/src/vite-env.d.ts |
Vite TS type reference. |
rust/vetkeys/basic_ibe/README.md |
Updates Rust README to match the new self-contained layout and bindgen flow. |
rust/vetkeys/basic_ibe/icp.yaml |
Renames canisters to backend/frontend, points to frontend/dist, and updates build commands. |
rust/vetkeys/basic_ibe/package.json |
Adds per-example npm workspace root for the Rust example. |
rust/vetkeys/basic_ibe/test.sh |
Adds basic CLI tests for Rust backend endpoints. |
rust/vetkeys/basic_ibe/Cargo.toml |
Adds a workspace root pointing at backend/. |
rust/vetkeys/basic_ibe/rust-toolchain.toml |
Ensures wasm32 target is configured for the example toolchain. |
rust/vetkeys/basic_ibe/backend/Cargo.toml |
Rust backend crate config + dependencies for the IBE canister. |
rust/vetkeys/basic_ibe/backend/Makefile |
Build + candid extraction helper targets for the Rust backend. |
rust/vetkeys/basic_ibe/backend/backend.did |
Committed Rust Candid interface used for frontend bindgen. |
rust/vetkeys/basic_ibe/backend/src/lib.rs |
Rust backend canister code (stable inboxes, vetKD integration, public API). |
rust/vetkeys/basic_ibe/backend/src/types.rs |
Shared Rust types and stable-structure serialization helpers. |
rust/vetkeys/basic_ibe/frontend/.gitignore |
Ignores dist/, node_modules/, and generated bindings output. |
rust/vetkeys/basic_ibe/frontend/package.json |
Slimmed frontend deps/scripts and adds bindgen plugin dependency. |
rust/vetkeys/basic_ibe/frontend/vite.config.ts |
Rust frontend Vite config generating bindings from backend/backend.did. |
rust/vetkeys/basic_ibe/frontend/src/main.ts |
Updates Rust frontend to import from generated bindings and use backend canister env key. |
rust/vetkeys/basic_ibe/frontend/scripts/gen_bindings.sh |
Removes legacy manual bindings generation script. |
rust/vetkeys/basic_ibe/frontend/eslint.config.mjs |
Removes legacy eslint config. |
rust/vetkeys/basic_ibe/frontend/.prettierrc |
Removes legacy prettier config. |
rust/vetkeys/basic_ibe/motoko/mops.toml |
Removes the old shared Motoko config under the Rust example tree. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- main.ts: the "Canister ID not set" error referenced the old canister name (basic_ibe); update it to `backend` to match the renamed PUBLIC_CANISTER_ID:backend env key, so a missing env cookie is not confusing to debug. - test.sh: call the query method (getMyMessages / get_my_messages) with `--query` instead of as an update. Applies to both the Motoko and Rust variants. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This was referenced Jul 16, 2026
Open
Bump the Rust recipe to @dfinity/rust@v3.3.0 and rename the Cargo package to `backend` (drops the custom `package:` in the recipe config). Drop backend/Makefile and advertise candid regeneration in the README via `icp build backend && candid-extractor … > backend/backend.did`. Verified: rust deploy + test.sh pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The example never had a test.sh on master; drop the ones added during the split and run deploy-only CI (the deploy verifies build + install). Persistence is unchanged — the `--default-persistent-actors` flag is kept (without it and without an explicit `persistent` keyword, moc 1.11.0 errors M0219; the flag is the forward-compatible choice and provably persists this main-canister actor class across upgrades). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
"The canister (IC smart contract) ensures ..." -> "The canister ensures ...". Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replace "dapp" with "app" and normalize the security best-practices link to https://docs.internetcomputer.org/guides/security/overview/. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
raymondk
approved these changes
Jul 18, 2026
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
Splits the vetkeys
basic_ibeexample into two self-contained examples — one per language — matching thebasic_vetkdlayout, and duplicates the frontend so each is independent.Previously
basic_ibelived only underrust/vetkeys/basic_ibe/with a sharedfrontend/symlinked intomotoko/andrust/subdirs, and agen_bindings.shthat always generated bindings from the Rust backend. Now:Frontend
@icp-sdk/bindgenVite plugin from the committedbackend/backend.did(replacing the sharedscripts/gen_bindings.sh).main.tsimports from./bindings/backend.eslint/prettier/gen_bindings.shand theBACKEND-env dev logic;package.jsonreduced toname: "frontend".package.jsonto each example sonpm run dev/npm run buildrun from the example root (matching ic-pos, daily_planner, …).Backend
getMyMessages,.encryptedMessage, …). The vetKD management-canister interface is kept snake_case (vetkd_public_key,key_id, …) since it's the fixed system API. moc 1.11.0 +--default-persistent-actors(the now-redundantpersistentkeyword removed). Dropped unusedsha2dep. Committedbackend/backend.did.Since the frontends are now separate, the Motoko frontend uses the camelCase interface and the Rust frontend keeps snake_case — each matches its own backend.
Docs & CI
vetkeys-basic-ibe.yml:motoko+rustjobs target the new paths, watch bothmotoko/**andrust/**, and runtest.sh.CODEOWNERS
Unchanged —
/motoko/vetkeys/and/rust/vetkeys/both already map to @dfinity/core-protocol, so both examples keep that owner.Verification (local,
icp1.x)mops generate candid, frontend build +tsc --noEmitclean,icp deploy,test.shPASS, and state survives an upgrade (sent a message → redeployed as upgrade → message still present, confirming persistence with the flag).icp deploy,test.shPASS.🤖 Generated with Claude Code