You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+14-14Lines changed: 14 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ _K1_ is Swift wrapper around [libsecp256k1 (bitcoin-core/secp256k1)][lib], offer
12
12
Read full documentation [here on SwiftPackageIndex][doc].
13
13
14
14
## Quick overview
15
-
The API of K1 maps almost 1:1 with Apple's [CryptoKit][ck], vendoring a set of keypairs, one per feature. E.g. in CryptoKit you have `Curve25519.KeyAgreement.PrivateKey` and `Curve25519.KeyAgreement.PublicKey` which are seperate for `Curve25519.Signing.PrivateKey` and `Curve25519.Signing.PublicKey`.
15
+
The API of K1 maps almost 1:1 with Apple's [CryptoKit][ck], vendoring a set of keypairs, one per feature. E.g. in CryptoKit you have `Curve25519.KeyAgreement.PrivateKey` and `Curve25519.KeyAgreement.PublicKey` which are separate for `Curve25519.Signing.PrivateKey` and `Curve25519.Signing.PublicKey`.
16
16
17
17
Just like that K1 vendors these key pairs:
18
18
-`K1.KeyAgreement.PrivateKey` / `K1.KeyAgreement.PublicKey` for key agreement (ECDH)
@@ -112,7 +112,7 @@ let signature = try alice.signature(forUnhashed: message)
112
112
113
113
```swift
114
114
let hashedMessage: Data =// from somewhere
115
-
let publicKey: K1.ECDSA.PublicKey = alice.publcKey
115
+
let publicKey: K1.ECDSA.PublicKey = alice.publicKey
116
116
let signature: K1.ECDSA.Signature // from above
117
117
118
118
assert(
@@ -205,12 +205,12 @@ Returning only the `X` coordinate of the point, following [ANSI X9.63][x963] sta
205
205
You can retrieve the `X` coordinate as raw data using `withUnsafeBytes` if you need to.
Using `libsecp256k1` default behaviour, returning a SHA-256 hash of the **compressed** point, embedded in a [`CryptoKit.SharedSecret`][ckss], which is useful since you can use `CryptoKit` key derivation functions.
Returns an entire uncompressed EC point, without hashing it. Might be useful if you wanna construct your own cryptographic functions, e.g. some custom ECIES.
235
235
236
236
```swift
237
-
letab: Data =try alice.ecdhPoint(with: bob.publicKey)
238
-
letba: Data =try bob.ecdhPoint(with: alice.publicKey)
239
-
assert(ab==ba) // pass
237
+
letaliceBob: Data =try alice.ecdhPoint(with: bob.publicKey)
238
+
letbobAlice: Data =try bob.ecdhPoint(with: alice.publicKey)
0 commit comments