Update README.md
A secondary encapsulation of https://github.com/Boilertalk/secp256k1.swift, well-tested and easy to use.
You can use The Swift Package Manager to install Secp256k1Swift by adding the proper description to your Package.swift file:
Secp256k1Swift
Package.swift
import PackageDescription let package = Package( name: "YOUR_PROJECT_NAME", dependencies: [ .package(url: "https://github.com/LanfordCai/Secp256k1Swift.git", from: "0.1.2"), ] )
Then run swift build whenever you get prepared.
swift build
let (privkey, pubkey) = try! Secp256k1.keyPair()
let result = Secp256k1.isValidPrivateKey(privkey)
let sig = try! Secp256k1.sign(msg: msg, with: privkey, nonceFunction: .default)
let result = Secp256k1.verify(msg: msg, sig: sig, pubkey: pubkey)
let (sig, recID) = try! Secp256k1.signCompact(msg: msg, with: privkey, nonceFunction: .default)
let result = Secp256k1.verifyCompact(msg: msg, sig: sig, pubkey: pubkey)
For more usage examples, please checkout the Tests
The test vectors are from https://github.com/btccom/secp256k1-go
©Copyright 2023 CCF 开源发展委员会 Powered by Trustie& IntelliDE 京ICP备13000930号
Secp256k1Swift
A secondary encapsulation of https://github.com/Boilertalk/secp256k1.swift, well-tested and easy to use.
Integration
You can use The Swift Package Manager to install
Secp256k1Swift
by adding the proper description to yourPackage.swift
file:Then run
swift build
whenever you get prepared.Basic Usage
Generate Secp256k1 key pairs
Verify a private key
Sign a message
Verify a signature
Sign compact
Verify compact
For more usage examples, please checkout the Tests
Test Vectors
The test vectors are from https://github.com/btccom/secp256k1-go