internet-identity-attributes
Internet Identity Attributes
Prerequisites
This skill assumes a working sign-in built with @icp-sdk/auth: load the internet-identity skill first. The attribute bundle travels alongside a delegation, so there is nothing here to request without one.
The frontend_origins value configured below must be the origin identities are derived for, the primary origin where the app has pinned one, not the origin the user happens to be visiting. A suite gets this wrong by default.
- For the Motoko backend:
mo:identity-attributes>= 0.4.0 (mops), the mixin that injects the two sign-in methods and verifies the attribute bundle. It pulls inmo:core>= 2.5.0 and requiresmoc>= 1.6.0 forinclude. - For the Rust backend: the
identity-attributescrate andic-cdk>= 0.20.1.
Identity attributes
When the backend needs more than the principal (e.g. a verified email), II returns a signed attribute bundle alongside the delegation. The backend exposes two methods: _internet_identity_sign_in_start issues a nonce, _internet_identity_sign_in_finish verifies the bundle. The identity-attributes library adds both: the mo:identity-attributes mixin in Motoko, and the #[identity_attributes] attribute in Rust (see "Backend: Rust" below). Both return the same Candid types, so the frontend is the same against either.
Keys
requestAttributes({ keys, nonce }) requires both; there is no default key set.