SPB Git

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%
769 B · 34 lines swift
Raw Blame History
1import Foundation23public protocol BytesEncodable {4    var bytes: [UInt8] { get }5}67extension UInt8: BytesEncodable {8    public var bytes: [UInt8] { [self] }9}1011extension UInt64: BytesEncodable {}1213extension UInt32: BytesEncodable {}1415// extension SolanaSDK.PublicKey: BytesEncodable {}1617extension Data: BytesEncodable {}1819extension Bool: BytesEncodable {20    public var bytes: [UInt8] { self ? [UInt8(1)] : [UInt8(0)] }21}2223extension Array: BytesEncodable where Element == BytesEncodable {24    public var bytes: [UInt8] { reduce([]) { $0 + $1.bytes } }25}2627public extension RawRepresentable where RawValue == UInt32 {28    var bytes: [UInt8] { rawValue.bytes }29}3031public extension RawRepresentable where RawValue == UInt8 {32    var bytes: [UInt8] { rawValue.bytes }33}34