SwiftBIP39 is a Swift Package Manager library for BIP-39 mnemonic generation, validation, and seed derivation on Apple platforms.
This package is intentionally named for real search terms developers use:
- Swift BIP39
- Swift mnemonic generator
- Swift seed phrase library
- BIP-39 recovery phrase package
- iOS mnemonic / wallet phrase generator
- Generate valid 12, 15, 18, 21, and 24-word BIP-39 English mnemonics
- Convert entropy bytes into deterministic mnemonic phrases
- Parse and validate mnemonic phrases with checksum verification
- Derive the standard 64-byte BIP-39 seed with optional passphrase
- Bundle the canonical 2048-word BIP-39 English word list
- Avoid third-party Swift package dependencies
- Swift 6.2+
- iOS 15+
- macOS 12+
- tvOS 15+
- watchOS 8+
In Xcode:
- Open your app project.
- Go to File > Add Package Dependencies...
- Paste:
https://github.com/devdasx/swift-bip39-mnemonic.git
- Add the
SwiftBIP39library to your target.
Or in Package.swift:
dependencies: [
.package(url: "https://github.com/devdasx/swift-bip39-mnemonic.git", from: "1.0.2")
]import SwiftBIP39
let mnemonic = try BIP39.generate(strength: .bits128)
let phrase = mnemonic.phrase
let parsed = try BIP39.parse(phrase)
let isValid = BIP39.validate(phrase)
let seed = BIP39.seed(from: parsed, passphrase: "optional-passphrase")Generate a mnemonic:
let mnemonic12 = try BIP39.generate(strength: .bits128)
let mnemonic24 = try BIP39.generate(strength: .bits256)Build a mnemonic from known entropy:
let entropy = Data([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
let mnemonic = try BIP39.mnemonic(from: entropy)Validate a recovery phrase:
let isValid = BIP39.validate(phrase)Derive a BIP-39 seed:
let seed = try BIP39.seed(from: phrase, passphrase: "TREZOR")This package is tested against the official English BIP-39 reference vectors plus repeated random-generation validation.
Current checks include:
- all 24 official English test vectors
- checksum failure detection
- generation across supported strengths
- repeated random mnemonic generation + validation
Repository SEO is handled through:
- a direct standard-based package name:
SwiftBIP39 - a GitHub repository name targeting the primary query:
swift-bip39-mnemonic - README wording that includes BIP-39, mnemonic, seed phrase, recovery phrase, Swift, iOS, and wallet integration terms
- GitHub topics for Swift, BIP39, mnemonic, crypto wallet, and seed phrase searches
MIT