Expand description
walletkit-core contains the basic primitives for using a World ID.
It enables basic usage of a World ID to generate ZKPs using different credentials.
§Example
ⓘ
// Note: `Groth16Materials::from_embedded` requires the `embed-zkeys` Cargo feature.
// On native targets you can alternatively use `Groth16Materials::from_cache` after
// calling `storage::cache_embedded_groth16_material` to populate the on-disk cache.
use std::sync::Arc;
use walletkit_core::requests::ProofRequest;
use walletkit_core::storage::CredentialStore;
use walletkit_core::{Authenticator, Environment, Groth16Materials};
async fn generate_world_id_proof(
store: Arc<CredentialStore>,
) -> Result<(), Box<dyn std::error::Error>> {
let materials = Arc::new(Groth16Materials::from_embedded()?);
// Initialize an authenticator for an already-registered World ID.
let seed = b"my_secret_seed_at_length_32_bytes!";
let authenticator = Authenticator::init_with_defaults(
seed,
None, // uses default RPC URL
&Environment::Staging,
None, // uses default region
materials,
store,
)
.await?;
// Parse an incoming proof request from a relying party.
let json = r#"{ "id": "req_01", "version": 1, "credentials": [] }"#;
let request = ProofRequest::from_json(json)?;
// Generate a zero-knowledge proof and serialise the response.
let response = authenticator.generate_proof(&request, None).await?;
println!("{}", response.to_json()?);
Ok(())
}Re-exports§
pub use user_agent::UserAgent;pub use user_agent::UserAgentBuilder;
Modules§
- defaults
- Default configuration values for each
Environment. - error
- Contains error outputs from
WalletKit - issuers
- Credential issuers for World ID (NFC, etc.) Logic for different specific issuers of Credentials in World ID.
- logger
- Contains logging functionality that can be integrated with foreign language bindings.
- proof_
request_ credential_ constraints_ check - Pre-flight check of whether stored credentials can satisfy a
requests::ProofRequest. Pre-flight check of whether the credential store can satisfy a proof request. - requests
- Proof requests and responses in World ID v4.
- storage
- Credential storage primitives for World ID v4.
- user_
agent - User agent for HTTP requests. User agent for HTTP requests.
Structs§
- Authenticator
- The Authenticator is the main component with which users interact with the World ID Protocol.
- Credential
- A wrapper around
CoreCredentialto enable FFI interoperability. - Field
Element - A wrapper around
FieldElementto enable FFI interoperability. - Groth16
Materials - ZK Proof material for both Groth16 proofs (query & nullifier proofs)
- Initializing
Authenticator - Represents an Authenticator in the process of being initialized.
- Ownership
Proof - A WIP-103 Ownership Proof available to foreign bindings
- Recovery
Data - Identity material derived from a seed for use during account recovery.
- Recovery
Update Signature - The signature and signing nonce returned by
Authenticator::danger_sign_initiate_recovery_agent_update.
Enums§
- Environment
- Represents the environment in which a World ID is being presented and used.
- Region
- Region for node selection.
- Registration
Status - Registration status for a World ID being created through the gateway.