ICRC-25: Signer Interactions

ICRC-25: Signer Interactions

This standard outlines a foundational protocol for communication between decentralized apps (dApps) and signers. It specifies a set of messages to facilitate this interaction, ensuring a seamless and secure exchange of information. ICRC-25 aims to create a uniform language for dApps and signers, enhancing interoperability and simplifying the development process.

We invite the community to contribute adapters for other signers to @nfid/identity-kit, but you can also use custom adapters from your own or other external packages.

Import and configure Signer
import * as IdentityKit from "@nfid/identity-kit"
 
// adapter contributed to this open source package
import { NFID, II } from "@nfid/identity-kit/adapter"
 
// bring your own adapter
import { CUSTOM } from "@your-package/icrc-25-compatible-signer"
 
// NFID Signer
const nfid = NFID.config({
  providerUrl: "https://nfid.one",
})
 
// Internet Identity Signer
const ii = II.config({
  providerUrl: "https://identity.ic0.app",
})
 
// You're free to build your custom signer by complying to the specs.
const custom = CUSTOM.config({
  providerUrl: "https://your.signer.app",
})
Initialize Identity Kit
IdentityKit.config({
  derivationOrigin: "https://<canisterId>.ic0.app",
})
 
// Establish a connection with the Signer the user has selected:
const connection = await IdentityKit.connect({
  signer: custom,
})

Exploring available standards on a given signer:

To understand what standards are supported on a user selected signer, you will be able to call connection.getSupportedStandards() which returns the list of strings representing the standard references.

Request Permissions:

The purpose of the requestPermissions method is for the relying party to request permission scopes to perform further actions. If the set of granted scopes is not empty and there was no session before, a new session is created.

Granted Permissions Method:

The purpose of the grantedPermissions method is for the relying party to query the granted permission scopes on the active session.

Revoke Permissions Method:

The relying party can request to revoke all or a subset of the previously granted permission scopes. If all granted permission scopes are revoked, the session (if any) is terminated.