Signature
Umiverse SDK features require a signature to use. To implement the md5 sign of an object parameter in TypeScript, we need to sort the object parameters in name=value&name=value format and add a timestamp to prevent data tampering. Then, we can use the md5 algorithm to generate the sign. Here's an example implementation:
In this implementation, we define an interface Params
to represent the object parameter. The generateSign
function takes two parameters: the object parameter params
and the secret key secretKey
. The function first generates a timestamp and adds it to the sorted object parameter. It then concatenates the name-value pairs with the secret key and generates the md5 hash of the resulting string. The function returns the md5 hash as the sign.
Last updated