Add Custom Metadata Signature Structure
To authorize the addCustomMetadata
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 add or update a specific custom metadata field (_value
) associated with their username (_username
).
Signed Message Format
The message is constructed by concatenating the following components as strings, separated by commas (,
):
string.concat(
"e6efeffa",
",",
_username,
",",
_value,
",",
Strings.toString(_mateNameServiceNonce)
)
1. MNS Add Custom Metadata Identifier (Hex String):
- Value:
e6efeffa
- Purpose: A specific identifier used within the EIP-191 framework to distinguish MNS
addCustomMetadata
messages from other types of signed messages.
2. Target Username (String):
- Value: The
_username
string itself. - Purpose: Specifies the username to which this custom metadata entry applies.
3. Metadata Value (String):
- Value: The
_value
string itself, exactly as provided by the user. - Purpose: Represents the custom data being associated with the username (e.g., a profile link, description, or other user-defined information).
4. 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
addCustomMetadata
action. This prevents replay attacks of the metadata update operation initiated by the owner.
tip
addressToString
converts an address to a lowercase stringStrings.toString
converts a number to a stringAdvancedStrings.bytes32ToString(bytes32 _input)
converts abytes32
value into its lowercase hexadecimal string representation