Skip to content

Signer

Defined in: src/signer.ts:179

Client for interacting with an ICRC-25 compliant signer.

Signers are applications that hold private keys and can sign messages on behalf of a user. They communicate over a Transport using JSON-RPC 2.0 messages as defined by the ICRC-25 standard.

https://github.com/dfinity/wg-identity-authentication/blob/main/topics/icrc_25_signer_interaction_standard.md

import { Signer } from "@icp-sdk/signer";
import { PostMessageTransport } from "@icp-sdk/signer/web";
const transport = new PostMessageTransport({ url: "https://oisy.com/sign" });
const signer = new Signer({ transport });
const standards = await signer.getSupportedStandards();
const accounts = await signer.getAccounts();

T extends Transport = Transport

new Signer<T>(options): Signer<T>

Defined in: src/signer.ts:187

SignerOptions<T>

Signer<T>

get transport(): T

Defined in: src/signer.ts:204

The transport used to communicate with the signer.

T

callCanister(params): Promise<{ certificate: Uint8Array; contentMap: Uint8Array; }>

Defined in: src/signer.ts:555

Requests the signer to execute a canister call on behalf of the user. The signer will prompt the user for approval before signing and submitting the call to the Internet Computer.

The canister call parameters.

Uint8Array

The Candid-encoded call arguments.

Principal

The target canister.

string

The canister method to invoke.

Uint8Array<ArrayBufferLike>

Optional nonce (max 32 bytes) for replay protection.

Principal

The principal executing the call.

Promise<{ certificate: Uint8Array; contentMap: Uint8Array; }>

The CBOR-encoded content map and certificate from the IC, which can be used to verify the call’s execution.

https://github.com/dfinity/wg-identity-authentication/blob/main/topics/icrc_49_call_canister.md


closeChannel(): Promise<void>

Defined in: src/signer.ts:240

Closes the current communication channel, if open.

Promise<void>


getAccounts(): Promise<object[]>

Defined in: src/signer.ts:457

Requests the accounts managed by the signer. Each account has an owner Principal and an optional 32-byte subaccount.

Requires the icrc27_accounts permission scope.

Promise<object[]>

https://github.com/dfinity/wg-identity-authentication/blob/main/topics/icrc_27_accounts.md


getPermissions(): Promise<object[]>

Defined in: src/signer.ts:428

Queries the current state of all permission scopes.

Promise<object[]>

The current permission state for each scope the signer supports.


getSupportedStandards(): Promise<SupportedStandard[]>

Defined in: src/signer.ts:370

Queries which ICRC standards the signer supports. Use this to determine signer capabilities before calling other methods.

Promise<SupportedStandard[]>

https://github.com/dfinity/wg-identity-authentication/blob/main/topics/icrc_25_signer_interaction_standard.md


openChannel(): Promise<Channel>

Defined in: src/signer.ts:212

Opens a communication channel with the signer. Reuses an existing open channel if available.

Promise<Channel>


requestDelegation(params): Promise<DelegationChain>

Defined in: src/signer.ts:495

Requests a delegation chain from the signer for session-based authentication. This allows the relying party to sign canister calls without requiring user approval for each individual call.

The delegation request parameters.

bigint

Optional maximum delegation lifetime in nanoseconds.

PublicKey

The session’s public key to delegate to.

Principal[]

Optional canister IDs to restrict the delegation to. When provided, the signer creates an account delegation; otherwise a relying party delegation.

Promise<DelegationChain>

A DelegationChain that can be used with DelegationIdentity.

https://github.com/dfinity/wg-identity-authentication/blob/main/topics/icrc_34_delegation.md


requestPermissions(scopes): Promise<object[]>

Defined in: src/signer.ts:398

Requests the signer to grant permission for the given scopes. The signer may prompt the user for approval.

PermissionScope[]

The permission scopes to request.

Promise<object[]>

The current state of each requested scope after the user’s decision.


sendRequest(request): Promise<JsonRpcResponse>

Defined in: src/signer.ts:248

Sends a JSON-RPC request over the transport channel.

JsonRpcRequest

The JSON-RPC request to send.

Promise<JsonRpcResponse>