Skip to content
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@
xcuserdata/
DerivedData/
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
scripts/update-libsecp/Package.resolved
scripts/update-libsecp/.build
scripts/update-libsecp/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
19 changes: 15 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
_K1_ is Swift wrapper around [libsecp256k1 (bitcoin-core/secp256k1)][lib], offering ECDSA, Schnorr ([BIP340][bip340]) and ECDH features.

> [!NOTE]
> Current `libsecp256k1` version is [0.6.0 (0cdc758a56360bf58a851fe91085a327ec97685a)](https://github.com/bitcoin-core/secp256k1/commit/0cdc758a56360bf58a851fe91085a327ec97685a)
> Current `libsecp256k1` version is [v0.6.0 (0cdc758a56360bf58a851fe91085a327ec97685a)](https://github.com/bitcoin-core/secp256k1/releases/tag/v0.6.0)

# Documentation
Read full documentation [here on SwiftPackageIndex][doc].
Expand Down Expand Up @@ -74,7 +74,7 @@ For each private key there exists two different `signature:for:options` (one tak

The `option` is a `K1.ECDSA.SigningOptions` struct, which by default specifies [`RFC6979`][rfc6979] deterministic signing, as per Bitcoin standard, however, you can change to use secure random nonce instead.

### NonRecoverable
### NonRecoverable

#### Sign

Expand All @@ -89,7 +89,7 @@ let hashedMessage: Data = // from somewhere
let signature = try alice.signature(for: hashedMessage)
```

##### Digest
##### Digest

```swift
let message: Data = // from somewhere
Expand Down Expand Up @@ -249,12 +249,23 @@ assert(ab.count == 65) // pass

# Development

Stand in root and run to setup submodules
## Setup submodule
Stand in root and run to setup submodule

```sh
make submodules
```

## Update submodule
```sh
just bump-dep
```

Or to use dry run:
```sh
just bump-dep true
```

## `gyb`

Some of the files in this project are autogenerated (metaprogramming) using the Swift Utils tools called [gyb](https://github.com/apple/swift/blob/main/utils/gyb.py) (_"generate your boilerplate"_). `gyb` is included in [`./scripts/gyb`](scripts/gyb).
Expand Down
10 changes: 10 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
default: test

test:
swift test

bump-dep dryRun="false":
swift run \
--package-path scripts/update-libsecp \
update-libsecp \
{{ if dryRun == "true" { "--dry-run" } else { "" } }}
30 changes: 30 additions & 0 deletions scripts/update-libsecp/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// swift-tools-version: 6.2.3

import PackageDescription

let package = Package(
name: "UpdateLibsecp",
platforms: [
.macOS(.v13),
],
products: [
.executable(
name: "update-libsecp",
targets: ["UpdateLibsecp"]
),
],
dependencies: [
.package(
url: "https://github.com/swiftlang/swift-subprocess",
from: "0.2.1"
),
],
targets: [
.executableTarget(
name: "UpdateLibsecp",
dependencies: [
.product(name: "Subprocess", package: "swift-subprocess"),
]
),
]
)
Loading
Loading