Skip to content

hexkpz/swift-bip

Repository files navigation

swift-bip

Swift implementation of BIP32, BIP39, BIP44, SLIP0010.

Platforms Swift

Installation

.package(url: "https://github.com/hexkpz/swift-bip.git", .upToNextMajor(from: "0.0.1"))

Ysage

secp256k1 & BIP32 / BIP39

import BIP

let mnemonica: Mnemonica = "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about"
let privateKey = try secp256k1.PrivateKey(mnemonica, algorithm: .ethereum(), derivationPath: "m/44'")

try print(privateKey.signature(for: Data("hello".utf8)))

Ed25519 (Curve25519) & SLIP0010 / BIP39

import BIP

let mnemonica: Mnemonica = "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about"
let privateKey = try Curve25519.Signing.PrivateKey(mnemonica, algorithm: .ton(), derivationPath: "m/44'/607'/0'")

try print(privateKey.signature(for: Data("hello".utf8)))

BIP44

import BIP

let mnemonica: Mnemonica = "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about"
let privateKey = try Curve25519.Signing.PrivateKey(mnemonica, algorithm: .ethereum(), hdWallet: .init(coin: .ethereum))

try print(privateKey.signature(for: Data("hello".utf8)))

Authors

About

Cross-platform Swift implementation of BIP32, BIP39, BIP44, SLIP0010

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Contributors