Flush Username Signature Structure
To authorize the flushUsername
operation within the MNS service, the user who currently owns the username must generate a cryptographic signature compliant with the EIP-191.
This signature proves the current username owner's intent and authorization to permanently delete their username registration and all associated data from the MNS service. This is an irreversible action.
Signed Message Format
The message is constructed by concatenating the following components as strings, separated by commas (,
):
string.concat(
"044695cb",
",",
_username,
",",
Strings.toString(_nonce)
)
1. MNS Flush Username Identifier (Hex String):
- Value:
044695cb
- Purpose: A specific identifier used within the EIP-191 framework to distinguish MNS
flushUsername
messages from other types of signed messages.
2. Target Username (String):
- Value: The
_username
string itself. - Purpose: Specifies the username registration that the owner is authorizing to be permanently flushed and deleted from the system.
3. MNS Nonce (String):
- Value: The result of
Strings.toString(_nonce)
. - Purpose: The string representation of the current username owner's nonce specific to the MNS contract for this
flushUsername
action. This prevents replay attacks of the irreversible deletion operation.
Practical Example
Let's say the current owner wants to permanently delete their username with the following parameters:
- Username:
"alice"
- Nonce:
25
The message would be constructed as:
"044695cb,alice,25"
Message Breakdown:
044695cb
: Function selector for flush username verificationalice
: The username that will be permanently deleted25
: The current username owner's nonce
This message would then be signed using EIP-191 standard, and the resulting signature would be used to verify the username deletion request in the verifyMessageSignedForFlushUsername
function.
⚠️ Warning: This operation is irreversible and will permanently delete the username registration and all associated data.
- The function selector
044695cb
is the first 4 bytes of the keccak256 hash of the function signature forverifyMessageSignedForFlushUsername
Strings.toString
converts a number to a string (standard OpenZeppelin utility)- The signature verification uses the EIP-191 standard for message signing
- Only the current owner of the username can flush their own username
- This operation is irreversible and permanently deletes the username registration and all associated data
- The
_nonce
parameter is the user's general nonce, similar to other deletion operations