Sending a request to our platform will generate a wallet pass for mobile devices
Verify Ownership
3mint Wallet
We validate users who own a 3mint wallet automatically by leveraging their existing authentication. You can skip to the "Creating a pass" section, otherwise you must generate a signature for other crypto wallets.
Other Wallets
To create a mobile pass associated with the user's crypto wallet or NFT, their ownership must be proven. This is achieved by requesting the user to sign a message from their wallet.
We require the message to sign to be in the following format:
`Sign this message to generate a mobile pass with 3mint.io\n${userPublicAddress}\n${Date.now()}`;
The message contains the user's public wallet address and a timestamp to ensure every signed message is unique.
Using the message, a user must sign it using their crypto wallet, such as MetaMask or Coinbase wallets. This process will generate the signature which allows anyone to decrypt it using the user's associated public key for verification.
The user's wallet is responsible for signing the message and can be achieved using a web3 library such as ether.js to trigger the action. It will initiate a signing request for the user's wallet, then it is up to the user to interact and follow the wallet prompts:
// Initializeconstprovider=newethers.providers.Web3Provider(window.ethereum);// ConnectconstpublicAddresses=awaitprovider.send("eth_requestAccounts", []);// Signconstmessage=`Sign this message to generate a mobile pass with 3mint.io\n${publicAddresses[0]}\n${Date.now()}`;constsigner=provider.getSigner();constsignature=awaitsigner.signMessage(message);
Creating a Pass
Now that we have a signature that proves the user's ownership of the wallet or NFT, we can create a request to generate a mobile pass:
With this payload, you can send the request to our 3mint endpoint, ensure your account is authenticated by providing the 3mint API key in the request header:
The fileURL value can be offered as a link for the users to tap from their mobile device. It will prompt the user to add the pass to their Apple or Google wallet:
QR Code
You may create a QR code using a library, such as qrcode, to display it for the user to scan with their mobile camera by passing in the file URL from the previous response:
consturl=QRCode.toDataURL(response.fileURL);...<imgsrc={url} width="250"height="250"alt="QR Code for Mobile Pass" />