Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Maskbook/Persona/JsonWebKey.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import Foundation
import SwiftMsgPack
import web3swift

struct JsonWebKey: Codable {
struct RsaOtherPrimesInfo: Codable {
Expand Down Expand Up @@ -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)
}
}