docs(authentication): use mo:core/CallerAttributes for the Motoko backend example#207
Merged
marc0olo merged 1 commit intodfinity:mainfrom May 6, 2026
Merged
Conversation
The Motoko side now uses CallerAttributes.getAttributes<system>() from mo:core (>= 2.5.0). The wrapper bakes in the trusted-signer check via the canister's trusted_attribute_signers env var, so the example no longer hardcodes the II principal in code: it moves to icp.yaml as deploy-time config. Notable changes: - Drops the mo:prim import on the Motoko path. The wrapper handles the caller-info primitive calls and the signer comparison. - Splits the prose intro into a per-language list, since the Rust path is unchanged (no ic-cdk wrapper for the trusted-signer check yet). - Adds an icp.yaml settings.environment_variables snippet showing how to declare trusted_attribute_signers. - Updates the "common mistakes" bullet to describe both paths.
marc0olo
approved these changes
May 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Companion to dfinity/icskills#182. Updates the Motoko backend example on the Internet Identity guide to use
mo:core/CallerAttributes(motoko-core v2.5.0+) instead of the manualPrim.callerInfoSigner/Prim.callerInfoDatadance.CallerAttributes.getAttributes<system>() : ?Blobreturns the bundle and traps when the signer isn't listed in the canister'strusted_attribute_signersenv var. The hardcoded II principal moves out of code and into deploy config.mo:primimport on the Motoko path (the wrapper handles primitives + signer comparison).icp.yamlsettings.environment_variablessnippet for declaringtrusted_attribute_signers.msg_caller_info_signer()check, no CDK wrapper yet) stays distinct from Motoko.npm run buildpasses; no new agent-docs warnings on the affected file.Sync recommendation
informed by caffeinelabs/motoko-core (
src/CallerAttributes.mo); dfinity/icp-cli (docs/reference/canister-settings.md#environment_variables); dfinity/icskills (skills/internet-identity/SKILL.mdcompanion PR #182)