Skip to content

Commit 231efa8

Browse files
authored
Merge pull request #21 from swift-libp2p/soundness
Soundness
2 parents 8985bab + fa0e3c9 commit 231efa8

37 files changed

+4526
-3643
lines changed

.license_header_template

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
@@===----------------------------------------------------------------------===@@
2+
@@
3+
@@ This source file is part of the swift-libp2p open source project
4+
@@
5+
@@ Copyright (c) YEARS swift-libp2p project authors
6+
@@ Licensed under MIT
7+
@@
8+
@@ See LICENSE for license information
9+
@@ See CONTRIBUTORS for the list of swift-libp2p project authors
10+
@@
11+
@@ SPDX-License-Identifier: MIT
12+
@@
13+
@@===----------------------------------------------------------------------===@@

.licenseignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.github/workflows/configs/.flake8
2+
**/*.yml
3+
*.md
4+
*.txt
5+
Package.swift
6+
Package.resolved
7+
.gitignore
8+
.swift-format
9+
.licenseignore
10+
.license_header_template
11+
Sources/LibP2PCrypto/Protobufs/keys.pb.swift

.swift-format

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
{
2+
"version" : 1,
3+
"indentation" : {
4+
"spaces" : 4
5+
},
6+
"tabWidth" : 4,
7+
"fileScopedDeclarationPrivacy" : {
8+
"accessLevel" : "private"
9+
},
10+
"spacesAroundRangeFormationOperators" : false,
11+
"indentConditionalCompilationBlocks" : false,
12+
"indentSwitchCaseLabels" : false,
13+
"lineBreakAroundMultilineExpressionChainComponents" : false,
14+
"lineBreakBeforeControlFlowKeywords" : false,
15+
"lineBreakBeforeEachArgument" : true,
16+
"lineBreakBeforeEachGenericRequirement" : true,
17+
"lineLength" : 120,
18+
"maximumBlankLines" : 1,
19+
"respectsExistingLineBreaks" : true,
20+
"prioritizeKeepingFunctionOutputTogether" : true,
21+
"noAssignmentInExpressions" : {
22+
"allowedFunctions" : [
23+
"XCTAssertNoThrow",
24+
"XCTAssertThrowsError"
25+
]
26+
},
27+
"rules" : {
28+
"AllPublicDeclarationsHaveDocumentation" : false,
29+
"AlwaysUseLiteralForEmptyCollectionInit" : false,
30+
"AlwaysUseLowerCamelCase" : false,
31+
"AmbiguousTrailingClosureOverload" : true,
32+
"BeginDocumentationCommentWithOneLineSummary" : false,
33+
"DoNotUseSemicolons" : true,
34+
"DontRepeatTypeInStaticProperties" : true,
35+
"FileScopedDeclarationPrivacy" : true,
36+
"FullyIndirectEnum" : true,
37+
"GroupNumericLiterals" : true,
38+
"IdentifiersMustBeASCII" : true,
39+
"NeverForceUnwrap" : false,
40+
"NeverUseForceTry" : false,
41+
"NeverUseImplicitlyUnwrappedOptionals" : false,
42+
"NoAccessLevelOnExtensionDeclaration" : true,
43+
"NoAssignmentInExpressions" : true,
44+
"NoBlockComments" : true,
45+
"NoCasesWithOnlyFallthrough" : true,
46+
"NoEmptyTrailingClosureParentheses" : true,
47+
"NoLabelsInCasePatterns" : true,
48+
"NoLeadingUnderscores" : false,
49+
"NoParensAroundConditions" : true,
50+
"NoVoidReturnOnFunctionSignature" : true,
51+
"OmitExplicitReturns" : true,
52+
"OneCasePerLine" : true,
53+
"OneVariableDeclarationPerLine" : true,
54+
"OnlyOneTrailingClosureArgument" : true,
55+
"OrderedImports" : true,
56+
"ReplaceForEachWithForLoop" : true,
57+
"ReturnVoidInsteadOfEmptyTuple" : true,
58+
"UseEarlyExits" : false,
59+
"UseExplicitNilCheckInConditions" : false,
60+
"UseLetInEveryBoundCaseVariable" : false,
61+
"UseShorthandTypeNames" : true,
62+
"UseSingleLinePropertyGetter" : false,
63+
"UseSynthesizedInitializer" : false,
64+
"UseTripleSlashForDocumentationComments" : true,
65+
"UseWhereClausesInForLoops" : false,
66+
"ValidateDocumentationComments" : false
67+
}
68+
}

LICENSE.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2025 swift-libp2p
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
14+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
15+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
17+
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
18+
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
19+
OR OTHER DEALINGS IN THE SOFTWARE.

Package.swift

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,42 @@
1-
// swift-tools-version:5.3
2-
// The swift-tools-version declares the minimum version of Swift required to build this package.
1+
// swift-tools-version:5.5
2+
//===----------------------------------------------------------------------===//
3+
//
4+
// This source file is part of the swift-libp2p open source project
5+
//
6+
// Copyright (c) 2022-2025 swift-libp2p project authors
7+
// Licensed under MIT
8+
//
9+
// See LICENSE for license information
10+
// See CONTRIBUTORS for the list of swift-libp2p project authors
11+
//
12+
// SPDX-License-Identifier: MIT
13+
//
14+
//===----------------------------------------------------------------------===//
315

416
import PackageDescription
517

618
let package = Package(
719
name: "swift-libp2p-crypto",
820
platforms: [
921
.macOS(.v10_15),
10-
.iOS(.v13)
22+
.iOS(.v13),
1123
],
1224
products: [
1325
// Products define the executables and libraries a package produces, and make them visible to other packages.
1426
.library(
1527
name: "LibP2PCrypto",
16-
targets: ["LibP2PCrypto"]),
28+
targets: ["LibP2PCrypto"]
29+
)
1730
],
1831
dependencies: [
1932
// Multibase Support
2033
.package(url: "https://github.com/swift-libp2p/swift-multibase.git", .upToNextMinor(from: "0.0.1")),
2134
// Protobuf Marshaling
22-
.package(name: "SwiftProtobuf", url: "https://github.com/apple/swift-protobuf.git", .upToNextMajor(from: "1.12.0")),
35+
.package(
36+
name: "SwiftProtobuf",
37+
url: "https://github.com/apple/swift-protobuf.git",
38+
.upToNextMajor(from: "1.12.0")
39+
),
2340
// Secp256k1 Support
2441
.package(name: "secp256k1", url: "https://github.com/Boilertalk/secp256k1.swift.git", .exact("0.1.7")),
2542
// 🔑 Hashing (BCrypt, SHA2, HMAC), encryption (AES), public-key (RSA), PEM and DER file handling, and random data generation.
@@ -41,10 +58,12 @@ let package = Package(
4158
.product(name: "CryptoSwift", package: "CryptoSwift"),
4259
],
4360
resources: [
44-
.copy("Protobufs/keys.proto")
45-
]),
61+
.copy("Protobufs/keys.proto")
62+
]
63+
),
4664
.testTarget(
4765
name: "LibP2PCryptoTests",
48-
dependencies: ["LibP2PCrypto"]),
66+
dependencies: ["LibP2PCrypto"]
67+
),
4968
]
5069
)

0 commit comments

Comments
 (0)