spb/os-vault Public
Self-custody, multi-chain crypto wallet for macOS. One recovery phrase, six chain families, zero API keys — nothing leaves your Mac.
Swift 96%
Shell 3.4%
Makefile 0.6%
1import Foundation23public struct AccountMeta: Equatable, Codable, CustomDebugStringConvertible {4 public let publicKey: PublicKey5 public var isSigner: Bool6 public var isWritable: Bool78 // MARK: - Decodable910 enum CodingKeys: String, CodingKey {11 case pubkey, signer, writable12 }1314 public init(from decoder: Decoder) throws {15 let values = try decoder.container(keyedBy: CodingKeys.self)16 publicKey = try PublicKey(string: values.decode(String.self, forKey: .pubkey))17 isSigner = try values.decode(Bool.self, forKey: .signer)18 isWritable = try values.decode(Bool.self, forKey: .writable)19 }2021 public func encode(to encoder: Encoder) throws {22 var container = encoder.container(keyedBy: CodingKeys.self)23 try container.encode(publicKey.base58EncodedString, forKey: .pubkey)24 try container.encode(isSigner, forKey: .signer)25 try container.encode(isWritable, forKey: .writable)26 }2728 // Initializers29 public init(publicKey: PublicKey, isSigner: Bool, isWritable: Bool) {30 self.publicKey = publicKey31 self.isSigner = isSigner32 self.isWritable = isWritable33 }3435 public static func readonly(publicKey: PublicKey, isSigner: Bool) -> Self {36 .init(publicKey: publicKey, isSigner: isSigner, isWritable: false)37 }3839 public static func writable(publicKey: PublicKey, isSigner: Bool) -> Self {40 .init(publicKey: publicKey, isSigner: isSigner, isWritable: true)41 }4243 public var debugDescription: String {44 "{\"publicKey\": \"\(publicKey.base58EncodedString)\", \"isSigner\": \(isSigner), \"isWritable\": \(isWritable)}"45 }46}47