-
Notifications
You must be signed in to change notification settings - Fork 93
Open
Labels
Description
Description:
Create the on-chain identity registry contract. This stores a mapping from a Stellar wallet address to a hashed user ID (BytesN<32>), enabling on-chain proof that a wallet belongs to a registered FreightFlow user.
Create:
contracts/identity/Cargo.tomlcontracts/identity/src/lib.rs
Acceptance Criteria:
-
Cargo.toml:crate-type = ["cdylib"],soroban-sdk = { version = "22.0.0", features = ["alloc"] },testutilsfeature gate, release profile withlto = true, panic = "abort" -
IdentityErrorenum with#[contracterror]:AlreadyRegistered = 1,NotRegistered = 2,Unauthorized = 3,NotInitialized = 4 -
DataKeyenum:Identity(Address),Admin -
initialize(env, admin: Address)— one-time setup; returnsErr(NotInitialized)if re-called -
register_identity(env, user_id_hash: BytesN<32>, wallet: Address)—wallet.require_auth(), store mapping, extend TTL ~1 year (6,307,200 ledgers) -
verify_identity(env, wallet: Address) → bool -
get_user_identity(env, wallet: Address) → Result<BytesN<32>, IdentityError> -
revoke_identity(env, wallet: Address)— admin-only - 4 unit tests (using
Env::default()+env.mock_all_auths()): register+verify success, double-register returnsAlreadyRegistered, revoke removes entry, get on unregistered returnsNotRegistered - Added to
contracts/Cargo.tomlworkspace members
Reactions are currently unavailable