Given the following HashedAuthenticationCode
:
import CryptoKit
let key = SymmetricKey(size: .bits256)
let message = "Hello world!".data(using: .utf8)!
let authenticationCode = HMAC<SHA256>.authenticationCode(for: message, using: key)
print(authenticationCode) // "HMAC with SHA256: c818a1400a9995d5faafbb5d41cc88a6701b5d1a4ded8ac169498319a2597e2a"
How do I access the c818a1400a9995d5faafbb5d41cc88a6701b5d1a4ded8ac169498319a2597e2a
value? Utimately this must be encoded and serialized over a URLSession
, but I see no obvious property for getting the "code" part of the HAC!