Skip to content

Commit 9b4b95c

Browse files
committed
fix linting
1 parent 771117c commit 9b4b95c

25 files changed

Lines changed: 122 additions & 121 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ DerivedData/
77
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
88
scripts/update-libsecp/Package.resolved
99
scripts/update-libsecp/.build
10+
scripts/*.pyc
1011
scripts/update-libsecp/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2.7.18

LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@
187187
same "printed page" as the copyright notice for easier
188188
identification within third-party archives.
189189

190-
Copyright [yyyy] [name of copyright owner]
190+
Copyright 2022-2026 Alexander Cyon
191191

192192
Licensed under the Apache License, Version 2.0 (the "License");
193193
you may not use this file except in compliance with the License.

Sources/K1/K1/ECDSA/ECDSASignatureNonRecoverable.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ extension K1.ECDSA {
88
/// from which users can recover a public key with the message that was signed.
99
public struct Signature: Sendable, Hashable, ContiguousBytes {
1010
typealias Wrapped = FFI.ECDSA.Wrapped
11-
internal let wrapped: Wrapped
11+
let wrapped: Wrapped
1212

1313
init(wrapped: Wrapped) {
1414
self.wrapped = wrapped
@@ -78,7 +78,7 @@ extension K1.ECDSA.Signature {
7878
}
7979

8080
extension K1.ECDSA.Signature {
81-
internal static let byteCount = FFI.ECDSAWithKeyRecovery.byteCount
81+
static let byteCount = FFI.ECDSAWithKeyRecovery.byteCount
8282
}
8383

8484
// MARK: Equatable

Sources/K1/K1/ECDSA/ECDSASignatureRecoverable.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ extension K1.ECDSAWithKeyRecovery {
1616
/// from which users **cannot** recover the public key, not without the `RecoveryID`.
1717
public struct Signature: Sendable, Hashable, ContiguousBytes {
1818
typealias Wrapped = FFI.ECDSAWithKeyRecovery.Wrapped
19-
internal let wrapped: Wrapped
19+
let wrapped: Wrapped
2020

21-
internal init(wrapped: Wrapped) {
21+
init(wrapped: Wrapped) {
2222
self.wrapped = wrapped
2323
}
2424
}
@@ -54,7 +54,7 @@ extension K1.ECDSAWithKeyRecovery.Signature {
5454

5555
// MARK: Serialize
5656
extension K1.ECDSAWithKeyRecovery.Signature {
57-
internal var internalRepresentation: Data {
57+
var internalRepresentation: Data {
5858
Data(wrapped.bytes)
5959
}
6060

@@ -127,11 +127,11 @@ extension K1.ECDSAWithKeyRecovery.Signature.Compact {
127127
/// Controls the order of the three components `R`, `S` and `V` (`RecoveryID`), specifyin
128128
/// either `R || S || V` called `.rsv` or `V || R || S` called `vrs`.
129129
public enum SerializationFormat {
130-
/// `R || S || V` - the format `libsecp256k1` v0.3.0 uses as internal representation
130+
/// `R || S || V` - the format `libsecp256k1` v0.3.0 uses as representation
131131
/// This is the default value of this library.
132132
case rsv
133133

134-
/// We use `R || S || V` as default values since `libsecp256k1` v0.3.0 uses it as its internal representation.
134+
/// We use `R || S || V` as default values since `libsecp256k1` v0.3.0 uses it as its representation.
135135
public static let `default`: Self = .rsv
136136

137137
/// `V || R || S`.

Sources/K1/K1/ECDSA/RecoveryID.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ extension K1.ECDSAWithKeyRecovery.Signature {
88
case _2 = 2
99
case _3 = 3
1010

11-
internal var recid: Int32 {
11+
var recid: Int32 {
1212
Int32(rawValue)
1313
}
1414
}

Sources/K1/K1/Keys/Keys.generated.swift

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ extension K1.KeyAgreement {
1111
typealias Impl = K1._PrivateKeyImplementation
1212
public typealias PublicKey = K1.KeyAgreement.PublicKey
1313

14-
internal let impl: Impl
15-
internal let publicKeyImpl: K1._PublicKeyImplementation
14+
let impl: Impl
15+
let publicKeyImpl: K1._PublicKeyImplementation
1616

1717
/// The corresponding public key.
1818
public var publicKey: PublicKey {
@@ -111,8 +111,8 @@ extension K1.KeyAgreement {
111111
/// A `secp256k1` public key used for key agreement.
112112
public struct PublicKey: Sendable, Hashable {
113113
typealias Impl = K1._PublicKeyImplementation
114-
internal let impl: Impl
115-
internal init(impl: Impl) {
114+
let impl: Impl
115+
init(impl: Impl) {
116116
self.impl = impl
117117
}
118118

@@ -233,8 +233,8 @@ extension K1.Schnorr {
233233
typealias Impl = K1._PrivateKeyImplementation
234234
public typealias PublicKey = K1.Schnorr.PublicKey
235235

236-
internal let impl: Impl
237-
internal let publicKeyImpl: K1._PublicKeyImplementation
236+
let impl: Impl
237+
let publicKeyImpl: K1._PublicKeyImplementation
238238

239239
/// The corresponding public key.
240240
public var publicKey: PublicKey {
@@ -334,8 +334,8 @@ extension K1.Schnorr {
334334
/// more specifically Schnorr signatures
335335
public struct PublicKey: Sendable, Hashable {
336336
typealias Impl = K1._PublicKeyImplementation
337-
internal let impl: Impl
338-
internal init(impl: Impl) {
337+
let impl: Impl
338+
init(impl: Impl) {
339339
self.impl = impl
340340
}
341341

@@ -456,8 +456,8 @@ extension K1.ECDSA {
456456
typealias Impl = K1._PrivateKeyImplementation
457457
public typealias PublicKey = K1.ECDSA.PublicKey
458458

459-
internal let impl: Impl
460-
internal let publicKeyImpl: K1._PublicKeyImplementation
459+
let impl: Impl
460+
let publicKeyImpl: K1._PublicKeyImplementation
461461

462462
/// The corresponding public key.
463463
public var publicKey: PublicKey {
@@ -557,8 +557,8 @@ extension K1.ECDSA {
557557
/// more specifically ECDSA signatures, that do not offer recovery of the public key.
558558
public struct PublicKey: Sendable, Hashable {
559559
typealias Impl = K1._PublicKeyImplementation
560-
internal let impl: Impl
561-
internal init(impl: Impl) {
560+
let impl: Impl
561+
init(impl: Impl) {
562562
self.impl = impl
563563
}
564564

@@ -679,8 +679,8 @@ extension K1.ECDSAWithKeyRecovery {
679679
typealias Impl = K1._PrivateKeyImplementation
680680
public typealias PublicKey = K1.ECDSAWithKeyRecovery.PublicKey
681681

682-
internal let impl: Impl
683-
internal let publicKeyImpl: K1._PublicKeyImplementation
682+
let impl: Impl
683+
let publicKeyImpl: K1._PublicKeyImplementation
684684

685685
/// The corresponding public key.
686686
public var publicKey: PublicKey {
@@ -780,8 +780,8 @@ extension K1.ECDSAWithKeyRecovery {
780780
/// more specifically ECDSA signatures that offers recovery of the public key.
781781
public struct PublicKey: Sendable, Hashable {
782782
typealias Impl = K1._PublicKeyImplementation
783-
internal let impl: Impl
784-
internal init(impl: Impl) {
783+
let impl: Impl
784+
init(impl: Impl) {
785785
self.impl = impl
786786
}
787787

Sources/K1/K1/Keys/Keys.swift.gyb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ extension K1.${FEATURE} {
5252
typealias Impl = K1._PrivateKeyImplementation
5353
public typealias PublicKey = K1.${FEATURE}.PublicKey
5454

55-
internal let impl: Impl
56-
internal let publicKeyImpl: K1._PublicKeyImplementation
55+
let impl: Impl
56+
let publicKeyImpl: K1._PublicKeyImplementation
5757

5858
/// The corresponding public key.
5959
public var publicKey: PublicKey {
@@ -154,8 +154,8 @@ extension K1.${FEATURE} {
154154
public struct PublicKey: Sendable, Hashable {
155155

156156
typealias Impl = K1._PublicKeyImplementation
157-
internal let impl: Impl
158-
internal init(impl: Impl) {
157+
let impl: Impl
158+
init(impl: Impl) {
159159
self.impl = impl
160160
}
161161

@@ -244,22 +244,22 @@ extension K1.${FEATURE} {
244244
}
245245

246246
// MARK: Group Operations
247-
247+
248248
/// Adds two public keys (points) on the secp256k1 curve
249249
public static func + (lhs: Self, rhs: Self) throws -> Self {
250250
try Self(impl: lhs.impl + rhs.impl)
251251
}
252-
252+
253253
/// Subtracts two public keys (points) on the secp256k1 curve
254254
public static func - (lhs: Self, rhs: Self) throws -> Self {
255255
try Self(impl: lhs.impl - rhs.impl)
256256
}
257-
257+
258258
/// Negates a public key (point) on the secp256k1 curve
259259
public func negate() throws -> Self {
260260
try Self(impl: impl.negate())
261261
}
262-
262+
263263
/// Combines multiple public keys (points) on the secp256k1 curve
264264
public static func sum(keys: [Self]) throws -> Self {
265265
let impls = keys.map { $0.impl }

Sources/K1/K1/Keys/PrivateKeyImplementation.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ protocol _K1KeyImportable {
1717
init(x963Representation: some ContiguousBytes) throws
1818
}
1919

20-
typealias _K1KeyPortable = _K1KeyImportable & _K1KeyExportable
20+
typealias _K1KeyPortable = _K1KeyExportable & _K1KeyImportable
2121

2222
// MARK: - _K1PrivateKeyProtocol
2323
protocol _K1PrivateKeyProtocol: _K1KeyPortable {
@@ -30,11 +30,11 @@ protocol _K1PrivateKeyProtocol: _K1KeyPortable {
3030
extension K1 {
3131
struct _PrivateKeyImplementation: Sendable, Hashable, _K1PrivateKeyProtocol {
3232
typealias Wrapped = FFI.PrivateKey.Wrapped
33-
internal let wrapped: Wrapped
33+
let wrapped: Wrapped
3434

3535
let publicKey: _PublicKeyImplementation
3636

37-
internal init(wrapped: Wrapped) {
37+
init(wrapped: Wrapped) {
3838
self.wrapped = wrapped
3939
self.publicKey = PublicKey(wrapped: wrapped.publicKey)
4040
}

Sources/K1/K1/Keys/PublicKeyImplementation.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ protocol _K1PublicKeyProtocol: _K1KeyPortable, Sendable, Hashable {
1010
extension K1 {
1111
struct _PublicKeyImplementation: Sendable, Hashable, _K1PublicKeyProtocol {
1212
typealias Wrapped = FFI.PublicKey.Wrapped
13-
internal let wrapped: Wrapped
13+
let wrapped: Wrapped
1414

15-
internal init(wrapped: Wrapped) {
15+
init(wrapped: Wrapped) {
1616
self.wrapped = wrapped
1717
}
1818
}
@@ -140,20 +140,20 @@ extension K1._PublicKeyImplementation {
140140
public static func + (lhs: Self, rhs: Self) throws -> Self {
141141
try Self(wrapped: lhs.wrapped + rhs.wrapped)
142142
}
143-
143+
144144
/// Subtracts two public keys (points) on the secp256k1 curve
145145
public static func - (lhs: Self, rhs: Self) throws -> Self {
146146
try Self(wrapped: lhs.wrapped - rhs.wrapped)
147147
}
148-
148+
149149
/// Negates a public key (point) on the secp256k1 curve
150150
public func negate() throws -> Self {
151151
try Self(wrapped: wrapped.negate())
152152
}
153-
153+
154154
/// Combines multiple public keys (points) on the secp256k1 curve
155155
public static func sum(keys: [Self]) throws -> Self {
156-
let wrappedKeys = keys.map { $0.wrapped }
156+
let wrappedKeys = keys.map(\.wrapped)
157157
return try Self(wrapped: FFI.PublicKey.Wrapped.sum(keys: wrappedKeys))
158158
}
159159
}

0 commit comments

Comments
 (0)