feat: EIP-712-style typed structured data hashing & credential hash registry (#64) - #70
Merged
michaelvic123 merged 1 commit intoJul 30, 2026
Conversation
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.
Description
Closes #64.
This PR implements an EIP-712-style typed structured data hashing scheme for StellarID credentials. It allows credentials to be verified off-chain (e.g. via QR code, NFC tap, or HTTP header) using only the credential fields and the issuer's public key, without performing any on-chain network queries.
Changes Made
Credentialstruct to includepub credential_hash: BytesN<32>.SHA-256("StellarID:v1:" || contract_address_32_bytes).SHA-256(domain_separator || schema_id_be || subject_32_bytes || issuer_32_bytes || issued_at_be || expires_at_be)compute_expected_hash(env, schema_id, subject, issuer, issued_at, expires_at) -> BytesN<32>(pure helper for verifiers)get_credential_hash(env, credential_id) -> BytesN<32>verify_credential_hash(env, credential_id) -> boolissue_credential,batch_issue_credentials,bridge_credential, andissue_multisig_credentialto compute and store credential hashes.docs/ARCHITECTURE.mdwith the canonical hashing specification.Test Plan & Verification
test_credential_hash_calculation_and_verification: Verifies that stored credential hashes match off-chain computed hashes.test_credential_hash_modifying_field_changes_hash: Verifies that altering any field changes the resulting hash.cargo test.