Protecting your sensitive data
MoonPay is highly committed to security. For this reason, whenever sensitive information such as email or wallet addresses are transmitted to the widget, you are required to use the signature
parameter, otherwise, the MoonPay widget will not load. This measure makes it more difficult for unauthorized third parties to misuse the the widget's pre-fill feature.
A signed URL helps limit access from unauthorized third parties by providing limited permissions and time to make a request. Passing the signature
parameter is mandatory if you're using the walletAddress
or walletAddresses
parameter and it must be appended at the end of the URL. If your widget URL contains sensitive information, we strongly recommend using the signature
parameter.
You can generate a signature
of the URL server-side and append it to the end of the URL. If the signature
is provided, we'll check the validity of the query string to make sure it has not been altered. If the signature is invalid for any reason the MoonPay widget will fail to load.
When using the SDK, you'll need to
Send your widget URL to your backend server.
Your backend will add a special signature to the URL using the secret key found in your .
Return the signature and update the SDK with it.
Use this signed URL to show the widget.
Use a tool to create an HMAC (Hash-based Message Authentication Code) using the SHA-256 hash function.
Use your secret API key as the key and the original URL's query string as the message.
Make sure all query parameter values are URL encoded before creating the signature.
All query parameter values including the signature (not the entire query string) need to be URL encoded before generating the signature in order for it to be valid.
⚠️AttentionThe API gateway of some cloud providers change your parameter's order, resulting in a failed signature validation.
Updated 3 months ago
Table of Contents
How to sign URLs
How to generate signatures