[ad_1]
I am utilizing SymmetricKey in some code to create a JWT, however now we’re being informed the app has to assist variations of iOS sooner than 13.0. What’s the various to SymmetricKey in iOS 12 or 11?
The code is used on this content material:
<snip>
let payload = Payload(theIat: iat,
theExp: exp,
theSub: mdn!,
theIss: iss,
theAlg: "ECDSA-256",
theSecret: authId!)
let payloadJSONData = strive! JSONEncoder().encode(payload)
let base64EncodedPayload = payloadJSONData.urlSafeBase64EncodedString()
let token = (base64EncodedHeader + "." + base64EncodedPayload).knowledge(utilizing: .utf8)!
let secret = privateKey()
let secretAsSymmetricKey = SymmetricKey(knowledge: secret.knowledge(utilizing: .utf8)!)
let signature = HMAC<SHA256>.authenticationCode(for: token, utilizing: secretAsSymmetricKey)
let signatureBase64String = Knowledge(signature).urlSafeBase64EncodedString()
<snip>
[ad_2]
