Swiftpack.co - lumoscompany/keestore as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by lumoscompany.
lumoscompany/keestore 0.23.0
Pure Swift account manager for some blockchain networks
⭐️ 1
🕓 5 weeks ago
iOS macOS
.package(url: "https://github.com/lumoscompany/keestore.git", from: "0.23.0")

Keestore Tests

Pure Swift account manager for web2 & web3

  • BIP32, BIP39, BIP44

Installation

.package(
    url: "https://github.com/lumoscompany/keestore.git",
    .upToNextMajor(from: "0.9.0")
)

Usage samples

Importing blockchain accounts

import Keestore

let key = DerivedKey(string: "123456")
let passphrase = "12/24/32 words"

let account = try Account.Blockchain.create(
    for: .ethereum(),
    with: .mnemonica(
        passphrase.components(separatedBy: " "),
        HDWallet(coin: .ethereum).derivationPath
    ),
    using: key
)

print(account.address)

Storing accounts using .keestore document


let fileName = "default"
let directoryURL = URL(fileURLWithPath: "file:///")
let file = Document(direcotryURL: directoryURL, fileNamed: fileName)

guard file.isExists
else {
    return
}

let keestore = try await file.read()
let account = keestore.accounts[0]

switch account.kind {
case let .blockchain(value):
    let key = DerivedKey(string: "${key}")
    let credentials = try? account.credentials?.decrypt(using: key)
    print(credentials)
default:
    break
}

Signing

let account: Account
let key: DerivedKey

let signature = try? account.signer?.sign(data, using: key)
print(signature)

Authors

GitHub

link
Stars: 1
Last commit: 5 weeks ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Dependencies

Release Notes

0.16.1
29 weeks ago

Add publicKey

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics