notify.
How it fits together
- The owner verifies one inbox for the account: a code request, then a code check.
- The rule document names that inbox in
global.notification_email. - Each
notifyaction of the document sends itsmessageto that inbox when its rule fires.
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.
adapternames 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 }).- 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<,>,,,;,". UsecanonicalNotificationEmail(raw)to run the same check in your form; it returnsnullfor a refused address. - It builds an EIP-4361 message: the statement
Verify <email> to receive notifications from wallet <account>., anExpiration Time5 minutes afterIssued At, and one resourceurn:anafi:notification-email-code:<account>:<keccak256(email)>. The wallet shows a sign-in message prompt. - It encrypts
{ adapter, email, siwe_message, signature }to the engine, bound to the route, the network and the account. It sendsPOST /api/wallets/{aa}/notification_email/request_codewith{ "sealed": ... }. - It opens the reply and checks that it names the same account.
{ 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.