BIP39 1.0.0

BIP39 1.0.0

Bitmark维护。



BIP39 1.0.0

BIP39 Logo

Swift 5.0 Version Platform Carthage Compatible SPM

BIP39

这是一个简单的Swift封装器,用于BIP39,实现BIP 39“生成确定性密钥的助记码”标准,用于在Blockchain Commons软件项目中使用**

安装

CocoaPods

BIP39 可以通过 CocoaPods 获取。要安装它,只需将以下行添加到您的 Podfile 中

pod 'BIP39'

Carthage

Carthage 是一个去中心化的依赖管理器,它构建你的依赖关系并为您提供二进制框架。

要使用 Carthage 将 BIP39 集成到您的 Xcode 项目中,请在 Cartfile 中指定它。

github "bitmark-inc/bip39-swift"

运行 carthage update 命令来构建框架,并将构建好的 BIP39.framework 文件拖到您的 Xcode 项目中。

在您应用程序目标的“构建阶段”设置选项卡中,点击“+”图标,选择“新建运行脚本阶段”,并根据 Carthage 快速入门步骤 4、5 和 6 添加框架路径。

Swift Package Manager

要使用苹果的Swift Package Manager进行集成,请将以下内容作为依赖项添加到您的Package.swift中。

dependencies: [
    .package(url: "[email protected]:bitmark-inc/bip39-swift.git", from: "1.0.0")
]

或者,导航到您的Xcode项目,选择Swift Packages并点击+图标以搜索BIP39

手动

如果您不希望使用上述任何依赖项管理器,您可以手动将BIP39集成到您的项目中。只需将源文件文件夹拖入您的Xcode项目。

示例代码

返回给定BIP39单词的英语助记字符串

BIP39Util.mnemonicFromWord(1) // "ability"

返回给定英语助记符的BIP39单词

BIP39Util.wordFromMnemonic("ability") // 1

返回给定秘密的BIP39英语助记符

BIP39Util.mnemonicsFromSecret(Data(hexString: "baadf00dbaadf00d")!)

返回给定英语助记符的秘密

BIP39Util.secretFromMnemonics(["rival", "hurdle", "address", "inspire", "tenant", "alone"])

贡献

贡献非常欢迎🙌

许可证

BIP39
Copyright (c) 2020 Bitmark Inc [email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.