Links

Creating a signed message

Quick Guide on how you can create a signed message relevant to your client-id
This is not an endpoint but explains how you can create a compatible signed message to post or hide Lore.
----

Introduction

Within hyy.pe, all client-ids are mapped to a specific brand specific message string. This enables you to define what you want to show your community members as signature and create a more on-brand communication.

Breakdown

Let's take an example of 'the awesome brand' for posting a lore:
Name
Description
Brand name
The Awesome Brand
client id example
XXXXXfa9dd2ee590ec0011b7320b5d12edXXXXX
Brand_string_to_post_lore
Create lore by authenticating your wallet. One time code
Brand_string_to_hide_lore
Hide lore by authenticating your wallet. One time code
Brand_string_to_rename_nft
Change NFT name by authenticating your wallet. One time code
After you retrieved your nonce using Request Nonce then you final message for posting lore to present via the walletProvider will be
Message = Brand_string_to_post_lore+" : "+Nonce
So, if the nonce is 1653686747625 then the final message is
Create lore by authenticating your wallet. One time code : 1653686747625
Similar to this, a message to hide a lore will be
Hide lore by authenticating your wallet. One time code : 1653686747625
Once you finalize your brand string(s), Please reach out to us to add support for it. This is important and will be needed to start testing your e2e workflow.

Sample Implementation

Example code snippet of how to request this signature with personal_sign method
personal_sign
/**
* Personal Sign
*/
personalSign.onclick = async () => {
let brandStringCreateLore = 'Create lore by authenticating your wallet. One time code';
let nonce = '1653686747625';
//this is not static. generate this every time you post or hide a lore
let exampleMessage = brandStringCreateLore+' : '+nonce; //final message
try {
const from = accounts[0];
const msg = `${Buffer.from(exampleMessage).toString('hex')}`;
const sign = await ethereum.request({
method: 'personal_sign',
params: [msg, from, ''],
});
console.log(sign); //logs the signed message
} catch (err) {
console.error(err);
}
};
This will return something like this for the above sign constant
0x90068b7df4783dbbce278a6cec362b955a7e1fc3ade17e9c2be618ead3f19bf87bf44c9a7022ce94e701c208681edffdda9f56ee784b0705de0b14f17ddf6dbe1c
This is what you will send as part of the payload while sending a request to Post a lore or Hide a lore.