diff --git a/Maskbook/Persona/JsonWebKey.swift b/Maskbook/Persona/JsonWebKey.swift index 04cf22a0..d3da10f9 100644 --- a/Maskbook/Persona/JsonWebKey.swift +++ b/Maskbook/Persona/JsonWebKey.swift @@ -8,6 +8,7 @@ import Foundation import SwiftMsgPack +import web3swift struct JsonWebKey: Codable { struct RsaOtherPrimesInfo: Codable { @@ -80,3 +81,16 @@ extension JsonWebKey { privateKeyPackedData?.base64EncodedString() } } + +extension JsonWebKey { + func getRawData() -> Data? { + guard let x = x, let y = y else { + return nil + } + guard let xData = Data(base64Encoded: x), + let yData = Data(base64Encoded: y) else { + return nil + } + return SECP256K1.combineSerializedPublicKeys(keys: [xData, yData], outputCompressed: true) + } +}