Remove Custom Metadata Signature Structure
To authorize the removeCustomMetadata operation within the MNS service, the user who currently owns the username must generate a cryptographic signature compliant with the EIP-191 standard.
This signature proves the current username owner's intent and authorization to remove a specific custom metadata entry (identified by its key/index _key) associated with their username (_username).
Signed Message Format
The signature verification uses the SignatureRecover.signatureVerification function with the following structure:
SignatureRecover.signatureVerification(
Strings.toString(evvmID), // EVVM ID as string
"removeCustomMetadata", // Action type
string.concat( // Concatenated parameters
_username,
",",
Strings.toString(_key),
",",
Strings.toString(_nonce)
),
signature,
signer
);
Internal Message Construction
This results in a message format:
"{evvmID},removeCustomMetadata,{username},{key},{nonce}"
Message Components
1. EVVM ID (String):
- The result of
Strings.toString(evvmID) - Purpose: Identifies the specific EVVM instance
2. Action Type (String):
- Fixed value:
"removeCustomMetadata" - Purpose: Identifies this as a remove custom metadata operation
3. Concatenated Parameters (String):
3.1. Target Username (String):
- The
_usernamestring itself - Purpose: Specifies the username from which the custom metadata entry will be removed
3.2. Metadata Key/Index (String):
- The result of
Strings.toString(_key) - Purpose: The identifier for the specific metadata entry targeted for removal
3.3. Nonce (String):
- The result of
Strings.toString(_nonce) - Purpose: Provides replay protection for metadata removal operations
Example
Scenario: Owner wants to remove custom metadata from their username "alice"
Parameters:
evvmID:1_username:"alice"_key:3(metadata entry identifier)_nonce:15
Signature verification call:
SignatureRecover.signatureVerification(
"1",
"removeCustomMetadata",
"alice,3,15",
signature,
signer
);
Final message to be signed:
1,removeCustomMetadata,alice,3,15
EIP-191 formatted message hash:
keccak256(abi.encodePacked(
"\x19Ethereum Signed Message:\n33",
"1,removeCustomMetadata,alice,3,15"
))
Message Breakdown:
8adf3927: Function selector for remove custom metadata verificationalice: The username from which the metadata will be removed3: The key/index of the specific metadata entry to remove15: 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 metadata removal request in the verifyMessageSignedForRemoveCustomMetadata function.
- The function selector
8adf3927is the first 4 bytes of the keccak256 hash of the function signature forverifyMessageSignedForRemoveCustomMetadata Strings.toStringconverts 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 remove custom metadata from their username
- The
_keyparameter identifies which specific metadata entry to remove by its index/identifier - The
_nonceparameter is the user's general nonce, not specifically the name service nonce