Actions scope s. When requesting these proofs, the user will prove they have only performed that specific action, for that specific RP and app once. Ultimately this is reflected with the computation of the which takes the rp_id, app_id, and action information as inputs (as well as a user-specific input not relevant here).
Each different action will result in a different .
Authenticators expect a pre-encoded action to be able to process requests. ID Kit already does this in the background, but for reference, this is how the action is encoded.
Copy
Ask AI
#[serde(Serialize, Deserialize)] struct WorldIdAction { /// The timestamp when the action will expire expires_at: u64, /// Arbitrary data to be included. Typically this would be a string value, which simply gets UTF-8 encoded. data: Vec<u8>, /// Description shown to the user when they are prompted to perform the action description: String, } impl WorldIdAction { pub fn encode(&self) -> String { let encoded_bytes = serde_json::to_vec(self).unwrap(); let encoded_bytes = STANDARD.encode(&json_bytes); format!("act_{}", encoded_bytes) } }
The authenticator uses the encoded action to:
Display the description to the user.
Compute the hash of the action and use it in the proof (by removing the act_ prefix and using the base 64 decoded bytes as the input).
This section describes how authenticators receive and respond to requests from RPs. This also reflects what is implemented in the .The authenticator receives a request from an RP in the following format.
When using the any constraint, the order of credential types in the array determines priority order. The authenticator will attempt to provide the first available credential type in the list. If that credential is not available, it will fall back to the next type in the array, and so on.
Priority ordering only applies to any constraints. For all constraints, all specified credential types must be provided regardless of order.
Example:
Copy
Ask AI
{ "constraints": { "any": ["orb", "document"] }}
In this case:
If the user has an orb credential, the authenticator will provide it
If the user does not have an orb credential but has a document credential, the authenticator will provide the document instead
The orb credential type has priority over document
This priority mechanism allows RPs to request their preferred credential type while still accepting fallback options if the preferred type is unavailable.
Even though both orb and passport credentials were requested, only orb is returned in the response. This is because the any constraint is satisfied by providing just one credential, and orb appears first in the priority order. The authenticator provides the highest-priority available credential that satisfies the constraint.