-
-
Save cardoso/d309ea2ea465899fb3e48b988a6b0961 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import CryptoKit | |
func importPublicKey(_ publicKey: String) throws -> P256.KeyAgreement.PublicKey { | |
let base64PublicKey = publicKey.removingPercentEncoding! | |
let rawPublicKey = Data(base64Encoded: base64PublicKey)! | |
let publicKey = try P256.KeyAgreement.PublicKey(rawRepresentation: rawPublicKey) | |
return publicKey | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment