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 Foundation23// MARK: - Derivation path45extension String {6 var isValidDerivationPath: Bool {7 range(of: "^m(\\/[0-9]+'?)+$", options: .regularExpression, range: nil, locale: nil) != nil8 }910 var replacingDerive: String {11 replacingOccurrences(of: "'", with: "")12 }13}1415// MARK: - Bytes1617extension UInt32 {18 var edBytes: [UInt8] {19 var bigEndian = self.bigEndian20 let count = MemoryLayout<UInt32>.size21 let bytePtr = withUnsafePointer(to: &bigEndian) {22 $0.withMemoryRebound(to: UInt8.self, capacity: count) {23 UnsafeBufferPointer(start: $0, count: count)24 }25 }26 return Array(bytePtr)27 }28}29