-
Notifications
You must be signed in to change notification settings - Fork 180
SELF-531: Clean the parameters in the Self SDK #793
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kevinsslin
wants to merge
10
commits into
dev
Choose a base branch
from
sel-531
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 9 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
5bb1fcf
Refactor: Change logoBase64 to logoUrl in SelfApp interface and relat…
kevinsslin e9ac996
feat: replace mockPassport with network parameter in SelfBackendVerifier
kevinsslin 68a60e1
feat: replace logoBase64 with logoUrl and default version to 2
kevinsslin 1c66de0
refactor: update mobile app data layer for logoUrl API
kevinsslin a2c7864
refactor: update mobile app UI components for logoUrl API
kevinsslin 7193275
test: update test files for new logoUrl API
kevinsslin 843cafe
docs: update SDK documentation for new API parameters
kevinsslin b02beda
docs: add CLAUDE.md developer documentation
kevinsslin 3d928fe
chore: Fix formatting issues and update CLAUDE.md with formatting gui…
kevinsslin 0bc2305
docs: Fix lint issues and add comprehensive CI/CD documentation
kevinsslin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,131 @@ | ||
| # CLAUDE.md | ||
|
|
||
| This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. | ||
|
|
||
| ## Overview | ||
|
|
||
| Self is an identity wallet that uses zk-SNARKs to generate privacy-preserving proofs from government-issued IDs (passports, ID cards). Users scan NFC chips to prove validity while revealing only specific attributes (age, nationality, humanity). | ||
|
|
||
| ## Monorepo Structure | ||
|
|
||
| This is a Yarn workspaces monorepo with these main packages: | ||
|
|
||
| - **`app/`** - React Native mobile app (iOS/Android) with web support via Vite | ||
| - **`circuits/`** - Zero-knowledge proof circuits written in Circom | ||
| - **`contracts/`** - Solidity smart contracts for on-chain verification | ||
| - **`common/`** - Shared utilities, constants, and types | ||
| - **`sdk/`** - SDKs for integration (core, qrcode) | ||
|
|
||
| ## Development Commands | ||
|
|
||
| ### Root Level | ||
| - `yarn install` - Bootstrap dependencies and setup husky hooks | ||
| - `yarn build` - Build all workspaces in topological order | ||
| - `yarn lint` - Run linting across all workspaces | ||
| - `yarn format` - Format code across all workspaces | ||
| - `yarn types` - Run TypeScript checks across workspaces | ||
|
|
||
| ### Mobile App (`app/`) | ||
| - `yarn start` - Start Metro bundler for React Native | ||
| - `yarn android` - Run on Android | ||
| - `yarn ios` - Run on iOS | ||
| - `yarn web` - Start Vite dev server for web | ||
| - `yarn test` - Run Jest tests | ||
| - `yarn types` - TypeScript type checking | ||
| - `yarn lint` / `yarn lint:fix` - ESLint | ||
| - `yarn fmt` - Check code formatting (Prettier) | ||
| - `yarn fmt:fix` - Fix code formatting issues | ||
| - `yarn setup` - Full setup including pods and dependencies | ||
| - `yarn reinstall` - Clean reinstall everything | ||
|
|
||
| ### Circuits (`circuits/`) | ||
| - `yarn test` - Run all circuit tests with Mocha | ||
| - `yarn test-register` - Test registration circuits | ||
| - `yarn test-dsc` - Test DSC verification circuits | ||
| - `yarn test-disclose` - Test disclosure circuits | ||
| - `yarn build-all` - Build all circuit types | ||
| - `yarn download` - Download pre-built circuits from AWS | ||
|
|
||
| ### Contracts (`contracts/`) | ||
| - `yarn build` - Compile Solidity contracts with Hardhat | ||
| - `yarn test` - Run contract tests | ||
| - `yarn test:local` - Run tests with local environment | ||
| - `yarn deploy:verifiers` - Deploy circuit verifiers | ||
| - `yarn deploy:registry` - Deploy identity registry | ||
| - `yarn deploy:hub:v2` - Deploy verification hub | ||
|
|
||
| ### Common (`common/`) | ||
| - `yarn build` - Build both ESM and CJS distributions | ||
| - `yarn test` - Run utility tests | ||
|
|
||
| ## Architecture Patterns | ||
|
|
||
| ### Mobile App Architecture | ||
| - **State Management**: Zustand stores (`stores/`) for global state | ||
| - **Navigation**: React Navigation with route definitions in `navigation/` | ||
| - **Platform Separation**: `.web.ts`/`.tsx` files for web-specific implementations | ||
| - **Providers**: Context providers for auth, database, passport data | ||
| - **Proving Flow**: XState machines for complex proof generation workflows | ||
|
|
||
| ### Circuit Architecture | ||
| - **Modular Design**: Separate circuits for register, disclose, DSC verification | ||
| - **Instance Generation**: Multiple algorithm-specific circuit instances | ||
| - **Test Coverage**: Comprehensive test suite for each circuit type | ||
| - **Utility Circuits**: Reusable components for cryptographic operations | ||
|
|
||
| ### Contract Architecture | ||
| - **Upgradeable Contracts**: Using OpenZeppelin upgradeable pattern | ||
| - **Registry Pattern**: Central registry for identity commitments | ||
| - **Verification Hub**: Orchestrates different proof types | ||
| - **Circuit Verifiers**: Generated Solidity verifiers for each circuit | ||
|
|
||
| ### Key Components | ||
| - **Passport Reading**: NFC scanning with platform-specific native modules | ||
| - **Proof Generation**: Browser/mobile-compatible proving using Web Workers | ||
| - **ZK Circuits**: Support for multiple hash algorithms and signature schemes | ||
| - **State Machines**: XState for complex async workflows like proving | ||
|
|
||
| ## Testing | ||
|
|
||
| ### Running Tests | ||
| - Mobile: `yarn test` (Jest with React Native Testing Library) | ||
| - Circuits: `yarn test` (Mocha with circom_tester) | ||
| - Contracts: `yarn test` (Hardhat with Chai) | ||
|
|
||
| ### Test Organization | ||
| - Integration tests in `test/integration/` | ||
| - Unit tests alongside source files or in `test/unit/` | ||
| - Mock data and utilities in `test/utils/` or `__setup__/` | ||
|
|
||
| ## Key Files to Understand | ||
|
|
||
| - `app/src/stores/selfAppStore.tsx` - WebSocket communication with verification backend | ||
| - `app/src/utils/proving/provingMachine.ts` - XState machine for proof generation | ||
| - `circuits/circuits/register/register.circom` - Core registration circuit | ||
| - `contracts/contracts/IdentityVerificationHubImplV2.sol` - Main verification contract | ||
| - `common/src/utils/passportData.ts` - Passport data parsing utilities | ||
|
|
||
| ## Development Notes | ||
|
|
||
| - Use `yarn` (v4.6.0) as package manager | ||
| - Gitleaks runs on commit to prevent secrets | ||
| - Platform-specific code uses `.web.ts` suffix for web implementations | ||
| - Circuit compilation requires significant memory (8GB+ recommended) | ||
| - Mobile development requires iOS/Android SDKs and simulators/devices | ||
|
|
||
| ## Code Formatting & CI | ||
|
|
||
| **IMPORTANT**: CI will fail if code formatting is incorrect. Always run formatting before committing: | ||
|
|
||
| ### App-specific formatting: | ||
| ```bash | ||
| cd app && yarn fmt:fix # Fix formatting in app workspace | ||
| cd app && yarn fmt # Check formatting passes | ||
| ``` | ||
|
|
||
| ### Root-level formatting: | ||
| ```bash | ||
| yarn format # Format all workspaces | ||
| ``` | ||
|
|
||
| **Note**: The app workspace uses `yarn fmt`/`yarn fmt:fix` while root uses `yarn format`. Both must pass for CI to succeed. |
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Improve type safety for database row mapping.
The
anycast reduces type safety. Consider creating a proper interface for the database row structure to maintain type checking while acknowledging the column name mismatch.📝 Committable suggestion
🤖 Prompt for AI Agents