Celestial Verification Flow: WebRTC proof exchange integration #3
Open
SupremaLex wants to merge 16 commits intomainfrom
Open
Celestial Verification Flow: WebRTC proof exchange integration #3SupremaLex wants to merge 16 commits intomainfrom
SupremaLex wants to merge 16 commits intomainfrom
Conversation
Add WebRTC functionality for proof generation and exchange with desktop client: - Add WebRTC AAR libraries (webrtc-core, webrtc-firebase) - Integrate WebRTC flow into existing QR scanner (no new UI screens) - Add WebRTCProofCoordinator for managing proof exchange flow - Add Firebase configuration and auth support - Fix nested parallel context issue in proof generation - Add network security config for local development - Update BaseConfig with development endpoints This is a work-in-progress implementation. The flow works but needs: - Additional testing and error handling - UI feedback improvements - Production endpoint configuration - Code cleanup and optimization
Compute passport dataType dynamically from CircuitAAType structure:
- Use dg15DigestPositionShift + aaKeyPositionShift to calculate circuit size
- Build constant name: P_{ALGORITHM}_{HASH}_{SIZE}[_3]
- Example: P_RSA_SHA1_2688 where 2688 = 2432 + 256
Compute zkType from circuit name:
- Convert registerIdentity_X to Z_NOIR_PASSPORT_X
- Apply keccak256 hash using ABI encoding (Hash.sha3String)
Both values now computed correctly instead of using hardcoded constants.
- Add PlonkProof.fromHexString() for automatic public signal detection - Replace manual proof parsing in ExtIntegratorApiManager with universal function - Translate Russian comments to English - Document proof structure: N pub signals * 32 bytes + 2144 bytes proof data Benefits: - Works with any circuit (registration, query, etc.) - Cleaner code: 1 line instead of 30 lines of manual parsing - Automatically calculates number of public signals - Better error handling and documentation
- Update contract addresses and RPC URLs for Eden testnet - Change chainId to 3735928814 for Eden network - Add current_date field from contract instead of generating locally - Use real issueTimestamp and identityCounter values - Fix PlonkProof parser to dynamically detect public signals count - Fix zkPoints extraction to avoid duplicate 0x prefix
821bd74 to
95f766e
Compare
- Update RELAYER_URL to Cloud Run service for both TestNet and Mainnet - Sync MainnetConfig with TestNet (Eden testnet endpoints and contracts) - Reorder registerIdentityLight circuits
- Update applicationId to com.grnddsystems.celestials - Rename package directories and update all imports - Update google-services.json with new Firebase app - Rename project to Celestials
- Update WebRTC AAR libraries (race condition fix, TURN servers, reconnect support) - Add NoirLock global mutex to prevent concurrent native proof generation crashes - Add duplicate flow protection and state reset on disconnect in WebRTCProofCoordinator - Add per-step timing logs to query proof generation pipeline for performance profiling
- Remove hardcoded Firebase database URL from WebRTCModule, read from FirebaseApp options - Update trusted setup URL to zk-celestial-store bucket - Fix queryIdentity URL typo (vv0.1.0 → v0.1.0)
xgreenx
reviewed
Feb 9, 2026
| ) { | ||
| @OptIn(ExperimentalStdlibApi::class) | ||
| suspend fun register(callData: ByteArray, destination: String): RegisterResponseBody { | ||
| ErrorHandler.logDebug("RegistrationAPIManager calldata", callData.toHexString()) |
| import org.web3j.tx.gas.ContractGasProvider; | ||
|
|
||
| /** | ||
| * <p>Auto generated code. |
There was a problem hiding this comment.
I suppose it is generated from ABI of our contract, correct?
| val value = amount | ||
|
|
||
| val chainId = 7368L | ||
| val chainId = 3735928814L |
There was a problem hiding this comment.
Do we need to use another chain_id for the mainnet version? If yes, it would be nice to make it part of some config file
| ErrorHandler.logError(TAG, "Error calling getProof for certificate registration", e) | ||
| throw e | ||
| } | ||
| certificatesSMTContract.getProof(slaveCertificateIndex).send() |
| @@ -235,144 +207,82 @@ class ProofGenerationManager @Inject constructor( | |||
| } | |||
|
|
|||
| private suspend fun isDocumentRegistered(eDocument: EDocument, proof: UniversalProof): Boolean { | |||
There was a problem hiding this comment.
Why this function always returns false?
| val inputs = buildPlonkRegistrationInputs(eDocument, registerIdentityCircuitType) | ||
|
|
||
| return withContext(customDispatcher) { | ||
| com.grnddsystems.celestials.util.NoirLock.mutex.lock() |
| is UniversalProof.Plonk -> { | ||
| ErrorHandler.logDebug("RegistrationManager", "Building Plonk registration calldata") | ||
|
|
||
| Log.i("UniversalProof.Plonk", zkProof.proof.proof) |
Use AndroidOpenSSL provider for MD5 instead of BouncyCastle, add SharedPreferences cache for file hashes to skip redundant re-computation on unchanged files.
Add shaPrepad() to CircuitUtil for Merkle-Damgård padding outside the circuit. Add getBlockSizeBytes()/getLengthFieldBytes() helpers to hash type enums. Fix getChunkNumber() to use correct length field size for SHA-384/512.
Prepad dg1, dg15, ec, sa with SHA padding before passing to the circuit, matching the prepadded hash functions on the circuit side.
Replace local asset loading of query.json with download via CircuitNoirDownloader. Update circuit download URLs from v0.1.0 to v0.2.0.
…sizing - Map prime192v1 alias to SECP192R1 curve type in EDocument - Add prime256v1/secp256r1 with SHA-1 circuit signature types (staticId=20) - Generalize ECDSA signature parsing to support variable coordinate sizes instead of hardcoded 32 bytes
…sion - Wrap Noir circuit prove calls with NoirLock mutex to prevent concurrent access - Fix BigInteger.toByteArray() sign byte issue in hex conversion by using toString(16) with padding instead of Numeric.toHexString - Remove verbose diagnostic logs from proof generation
- Send passportHash as passportKey for passports without Active Authentication - Handle empty aaSignature byte array (not just null) with takeIf check - Use 0x00 for zero-value fields to avoid JS BigInt(0n) falsy check in Dapp - Fix decimal-to-hex conversion with proper bytes32 padding - Remove TIMING logs, verbose diagnostic blocks and redundant debug output
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
desktop client
Changes
WebRTC Integration
Proof Handling Improvements
Passport Type Computation
Eden Testnet Configuration