I'm new to CryptoKit, and I'm struggling to translate this code from Node.js to Swift (using CryptoKit).
// create a sha256 hmac with the secret
var hmac = crypto.createHmac('sha256', key);
return hmac.update(what).digest('base64');
What I'm doing on Swift/CryptoKit is:
var hmac = SHA256.hash(data: Data(base64Encoded: key)!)
but I don't see how to handle the second line. On Ruby it can done on this way:
HMAC.digest('sha256', secret, what)
but CryptoKit "doesn't have" this method, any ideas?