Expand description
§World ID
World ID is a protocol built to enable anonymous proof of human (PoH) at global scale and to complement existing identity systems. World ID allows individuals to prove things about themselves — like they are a real and unique human, not a bot — without revealing any personal information. Read more about World ID.
Good places to start:
- Learn more about World ID: To learn more about World ID in general, see the World ID Website.
- Integrating World ID: The best place to start for integrating World ID is the Developer Docs.
- Protocol Repo: The source code for the protocol can be found in this repo.
§High level architecture
The following diagram shows the main parties which interact in the World ID Protocol.
§About this crate
Core foundational types and structures for the World ID Protocol.
Importantly, this crate keeps dependencies to a minimum and does not implement any logic beyond serialization and deserialization.
Re-exports§
pub use poseidon::DomainSeparator;pub use poseidon::VariableLengthDomainSeparator;pub use credential::Credential;pub use credential::CredentialVersion;pub use credential::POH_ISSUER_SCHEMA_ID;pub use oprf::OprfPrefix;pub use oprf::OprfPrefixedFieldElement;pub use proof::EmbeddingSimilarityProof;pub use proof::OwnershipProof;pub use proof::ZeroKnowledgeProof;pub use request::ConstraintExpr;pub use request::ConstraintKind;pub use request::ConstraintNode;pub use request::EmbeddingSimilarityParams;pub use request::EmbeddingSimilarityResponseItem;pub use request::MAX_CONSTRAINT_NODES;pub use request::ProofRequest;pub use request::ProofResponse;pub use request::ProofType;pub use request::RequestItem;pub use request::RequestVersion;pub use request::ResponseItem;pub use request::ValidationError;
Modules§
- api_
types - Contains API request/response types and shared API enums. Shared API request/response payloads for gateway and indexer services.
- authenticator
- Contains types related to the Authenticator.
- authenticator_
assertion - Trust Anchor Key Tokens and Authenticator Assertion Tokens (WIP-106): issuance, encoding and verification. Authenticator Assertions (WIP-106).
- authenticator_
message - The message and deeplink formats that World ID authenticators use to talk to each other, as defined in WIP-105.
- billing
- WIP-107 per-period fees: billing contexts, actions, periods and nullifiers. Types and helpers for WIP-107 per-period World ID fees.
- cbor
- Deterministic CBOR and
COSE_Sign1for the encodings WIPs specify. Deterministic CBOR (RFC 8949 §4.2.1) and untaggedCOSE_Sign1(RFC 9052) for the encodings WIPs specify. - credential
- Base definition of a “Credential” in the World ID Protocol.
- merkle
- Contains base types for operations with Merkle trees.
- oprf
- Contains types specifically related to the OPRF services.
- poseidon
- Domain-separated Poseidon2 hashing over a fixed number of field elements.
- proof
- Contains the quintessential zero-knowledge proof type. Wire types of finished World ID proofs.
- request
- Contains request/response types and validation helpers for RP proof requests. Module containing all the functionality to handle requests from Relying Parties (RPs) to Authenticators.
- rp
- Contains types specifically related to relying parties.
- serde_
utils - Serde helpers shared across the protocol.
- sponge
- SAFE-style sponge utilities and helpers.
Structs§
- Authenticator
Public KeySet - A set of off-chain authenticator public keys for a World ID Account.
- Config
- Global configuration to interact with the different components of the Protocol.
- EdDSA
Private Key - A private key for the
EdDSAsignature scheme. - EdDSA
Public Key - A public key for the
EdDSAsignature scheme over theBabyJubJubCurve. - EdDSA
Signature - An
EdDSAsignature on the Baby Jubjub curve, using Poseidon2 as the internal hash function for the Fiat-Shamir transform. - Field
Element - Represents an element of the field used in the World ID Protocol (
Fq), which is theBabyJubJubbase field. - Nullifier
- A nullifier is a unique, one-time identifier derived from (user, rpId, action) that lets RPs detect
duplicate actions without learning who the user is. Used with the contract’s
verify()function. - Oprf
KeyId - The id of a relying party.
- Session
Id - An identifier for a session (can be re-used).
- Session
Nullifier - A session nullifier for World ID Session proofs. It is analogous to a request nonce,
it does NOT guarantee uniqueness of a World ID as a
Nullifierdoes. - Share
Epoch - Represents an epoch for the
DLogsecret-share. - Signer
- The inner signer which can sign requests for both on-chain and off-chain operations. Both issuers and authenticators use this.
Enums§
- Ohttp
Kem - Which key of an OHTTP gateway’s key list a client encrypts to.
- Primitive
Error - Generic errors that may occur with basic serialization and deserialization.
- Service
Endpoint - Configuration for a protocol service endpoint (indexer or gateway).
- Session
Ref - How a proof request refers to a session.
- Sparse
Authenticator Pubkeys Error - Errors for decoding sparse authenticator pubkey slots.
Constants§
- MAX_
AUTHENTICATOR_ KEYS - The maximum number of authenticator public keys that can be registered at any time per World ID Account.
- TREE_
DEPTH - The depth of the Merkle tree used in the World ID Protocol for the
WorldIDRegistrycontract.
Functions§
- decode_
authenticator_ pubkey - Decodes an authenticator public key from its
WorldIDRegistryrepresentation.
Type Aliases§
- Scalar
Field - The scalar field used in the World ID Protocol.