Skip to main content
After this page, you know how an owner verifies the notification inbox of an account, each outcome of the two calls, and how a rule document then uses notify.
Today, the engine accepts the sign-in of the code request only when the EIP-4361 message names the domain of the Anafi dapp, app.ana.fi. The Anafi API refuses a sign-in for another domain with 422. An integration on another domain cannot complete this flow today. An owner can verify the inbox in the Anafi dapp. Your app can then name that inbox in global.notification_email.

How it fits together

  1. The owner verifies one inbox for the account: a code request, then a code check.
  2. The rule document names that inbox in global.notification_email.
  3. Each notify action of the document sends its message to that inbox when its rule fires.
The engine refuses at the stage a document whose global.notification_email is not the verified inbox of the account (NotificationEmailNotVerifiedError). The refusal is the same when the account has another verified inbox, and when it has none.

Preconditions

  • The signer is a signer of the account: an owner of the Safe, or the ERC20Allow address. The account does not need a commit yet.
  • adapter names an adapter that the deployment serves. The engine checks the signer through the account kind of that adapter.
  • The call can reach the Anafi API. Today, the Anafi API hosts answer CORS only for https://app.ana.fi.

Sequence

Steps

1

Request a code

Call requestNotificationEmailCode({ aa, adapter, email, eoa }).
  1. The SDK computes the canonical form of email: it removes ASCII whitespace at the two ends and changes it to lower case. It refuses an empty address, a non-ASCII character, inner whitespace, and the characters <, >, ,, ;, ". Use canonicalNotificationEmail(raw) to run the same check in your form; it returns null for a refused address.
  2. It builds an EIP-4361 message: the statement Verify <email> to receive notifications from wallet <account>., an Expiration Time 5 minutes after Issued At, and one resource urn:anafi:notification-email-code:<account>:<keccak256(email)>. The wallet shows a sign-in message prompt.
  3. It encrypts { adapter, email, siwe_message, signature } to the engine, bound to the route, the network and the account. It sends POST /api/wallets/{aa}/notification_email/request_code with { "sealed": ... }.
  4. It opens the reply and checks that it names the same account.
The result is { aa, email, outcome }:
2

Check the code

The owner reads the 6-digit code in the email. The code expires 15 minutes after it was sent.Call verifyNotificationEmailCode({ aa, codeToken, code }). There is no wallet prompt. The SDK encrypts { code_token, code } and sends POST /api/wallets/{aa}/notification_email/verify_code.
3

Name the inbox in the document

Set global.notification_email to the canonical inbox, and add notify actions:
documentWithNotificationEmail(yaml, canonicalEmail) sets the field for you. When the document already names the same inbox, it keeps the text of that document. documentNotificationEmail(yaml) reads the field. Then stage and commit as usual.

What notify does

See Actions and Document.

What can refuse

Resume

Example