Status |
---|
Draft |
This standard defines a transport channel to send ICRC-25 messages from a relying party to a signer. The transport channel is based on the window.postMessage API.
- signer: A service that manages a user's keys and can sign and perform canister calls on their behalf.
- relying party: A service that wants to request calls on a specific canister.
For this standard to represent an ICRC-25 compliant transport channel, the following assumptions must hold:
- The user's machine is not compromised. In particular, the browser must deliver messages unchanged and represent the
origin
of the different parties correctly. - DNS entries are not compromised. The user's machine must be able to resolve the domain names of the relying party and signer correctly.
A window.postMessage communication channel is initiated by the relying party. The relying party opens a new window and waits for the signer to send a message indicating that it is ready for interactions.
The message is a JSON-RPC 2.0 notification with the method icrc29_ready
and no parameters:
{
"jsonrpc": "2.0",
"method": "icrc29_ready"
}
After this message has been received, the relying party can send ICRC-25 messages to the signer using the window.postMessage API.
- The relying party must authenticate the signer by the
origin
of the window that it opens. - The singer must authenticate the relying party by the
origin
property of themessage
event that it received.
Messages are sent by calling window.postMessage
on the signer window, or the window.opener
respectively.
When sending messages, the targetOrigin
parameter must be set to the origin of the signer or relying party window.
The relying party may close the signer window in between interactions. If the relying party wants to continue a session after having closed the window, it must again go through the process of establishing a communication channel.
After sending a message, the relying party should wait for the signer to send a response before closing the window. If the window is closed before the signer has sent a response, the relying party must not make any assumptions about the state of the request.
If the signer window is closed unexpectedly, the relying party should handle this as if it had received a NOT_GRANTED
error.
Closing the window does not end the session (see ICRC-25 session), and the relying party can open a new window and continue the session.
If either party receives malformed, unexpected, or otherwise invalid messages, it should ignore them.