Go to file
keefertaylor 989c169e96 Add tests in podspec. 2018-10-28 20:47:34 +00:00
MnemonicKit.xcodeproj Bundle test data file with tests. 2018-10-28 19:23:15 +00:00
MnemonicKit.xcworkspace Pod install 2018-10-28 18:44:37 +00:00
MnemonicKitTests Remove unneeded try statements. 2018-10-28 20:26:48 +00:00
Pods Have tests consume the MnemonicKit pod 2018-10-28 19:13:12 +00:00
Sources Remove error enum. No longer needed now that MnemonicKit doesn't throw errors. 2018-10-28 20:27:32 +00:00
.gitignore Update gitignore 2018-10-28 17:58:10 +00:00
.slather.yml Blowing away a bunch of infrastructure in preparation to regerenate it all. 2018-10-28 18:10:10 +00:00
.travis.yml Blowing away a bunch of infrastructure in preparation to regerenate it all. 2018-10-28 18:10:10 +00:00
Gemfile Fixing gemfile 2018-10-28 18:36:45 +00:00
LICENSE Initial commit 2017-07-24 21:59:55 +08:00
MnemonicKit.podspec Add tests in podspec. 2018-10-28 20:47:34 +00:00
Podfile Have tests consume the MnemonicKit pod 2018-10-28 19:13:12 +00:00
Podfile.lock Have tests consume the MnemonicKit pod 2018-10-28 19:13:12 +00:00
README.md Update README.md 2018-10-28 20:34:30 +00:00
codecov.yml Fixing code coverage. 2018-10-28 19:29:37 +00:00

README.md

MnemonicKit     Build Status     codecov

An implementation of BIP39 in Swift. MnemonicKit supports both English and Chinese mnemonics.

This library is originally forked from CKMnemonic: https://github.com/CikeQiu/CKMnemonic. Modifications are made for non-throwing APIs and support on OSX as well as iOS. Credit for most of this work is given to work_cocody@hotmail.com, qiuhongyang@askcoin.org.

Installation

CocoaPods

TezosKit supports installation via CocoaPods. You can depened on MnemonicKit by adding the following to your Podfile:

pod "MnemonicKit", :git => 'https://github.com/keefertaylor/MnemonicKit.git'

Usage

Generate a Mnemonic

  let englishMnemonic = Mnemonic.generateMnemonic(strength: 64, language: .english)
  let chineseMnemonic = Mnemonic.generateMnemonic(strength: 128, language: .chinese)

Generate a Mnemonic from a Hex Represetation

  let hexRepresentation: String = ...
  let mnemonic = Mnemonic.mnemonicString(from: hexRepresentation)
  print("Mnemonic: \(mnemonic)\nFrom hex string: \(hexRepresentation)")

Generate a Seed String

  let englishMnemonic = Mnemonic.generateMnemonic(strength: 64, language: .english)
  let passphrase: String = ...
  let deterministicSeedString = Mnemonic.deterministicSeedString(from: mnemonicString,
                                                                 passphrase: passphrase,
                                                                 language: .english)
  print("Deterministic Seed String: \(deterministicSeedString)")

Contributions

I am happy to accept pull requests. If anyone is able to reach the original authors of CKMnemonic, I am happy to merge this library upstream with them.

License

MIT