Skip to content

Commit b7cf1b5

Browse files
kittibodecsGErP83tib
authored
swift 6 update (#3)
* changes * Update .swiftheaderignore * Create BCryptTests.swift * Create .unacceptablelanguageignore * Update .swiftheaderignore * fix naming * Update README.md * Update Sources/BCrypt/BCrypt.swift Co-authored-by: Tibor Bödecs <mail.tib@gmail.com> * Update Sources/BCrypt/BCrypt.swift Co-authored-by: Tibor Bödecs <mail.tib@gmail.com> * Update Sources/BCrypt/BCrypt.swift Co-authored-by: Tibor Bödecs <mail.tib@gmail.com> * Update Sources/BCrypt/BCrypt.swift Co-authored-by: Tibor Bödecs <mail.tib@gmail.com> * Update Sources/BCrypt/BCrypt.swift Co-authored-by: Tibor Bödecs <mail.tib@gmail.com> * Update README.md Co-authored-by: Tibor Bödecs <mail.tib@gmail.com> * Update Sources/BCrypt/BCrypt.swift Co-authored-by: Tibor Bödecs <mail.tib@gmail.com> * Update Sources/BCrypt/BCrypt.swift Co-authored-by: Tibor Bödecs <mail.tib@gmail.com> * Update README.md --------- Co-authored-by: GErP83 <gurrka@gmail.com> Co-authored-by: Tibor Bödecs <mail.tib@gmail.com>
1 parent 4602228 commit b7cf1b5

21 files changed

Lines changed: 809 additions & 382 deletions

File tree

.github/workflows/deployment.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Create Docomentation and Deploy it
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
- '[0-9]*'
8+
9+
jobs:
10+
11+
create-docc-and-deploy:
12+
uses: BinaryBirds/github-workflows/.github/workflows/docc_deploy.yml@main
13+
permissions:
14+
contents: read
15+
pages: write
16+
id-token: write
17+
with:
18+
docc_swift_version: "6.2"

.github/workflows/testing.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Actions
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
jobs:
9+
10+
swiftlang_checks:
11+
name: Swiftlang Checks
12+
uses: swiftlang/github-workflows/.github/workflows/soundness.yml@main
13+
with:
14+
license_header_check_project_name: "project"
15+
format_check_enabled : true
16+
broken_symlink_check_enabled : true
17+
unacceptable_language_check_enabled : true
18+
docs_check_enabled : true
19+
api_breakage_check_enabled : false
20+
license_header_check_enabled : false
21+
shell_check_enabled : false
22+
yamllint_check_enabled : false
23+
python_lint_check_enabled : false
24+
25+
bb_checks:
26+
name: BB Checks
27+
uses: BinaryBirds/github-workflows/.github/workflows/extra_soundness.yml@main
28+
with:
29+
local_swift_dependencies_check_enabled : true
30+
run_tests_with_cache_enabled : true
31+
headers_check_enabled : true
32+
run_tests_swift_versions: '["6.1","6.2"]'

.swiftformatignore

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

.swiftheaderignore

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
.gitignore
2+
.swift-format
3+
.swiftformatignore
4+
.swiftheaderignore
5+
Sources/CBCrypt/**
6+
.github/**
7+
docker/**
8+
AGENTS.md
9+
LICENSE
10+
Makefile
11+
Package.swift
12+
Package.resolved
13+
README.md
14+
.unacceptablelanguageignore
15+
docker-compose.yaml

.unacceptablelanguageignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Tests/BCryptTests/BCryptTests.swift

Makefile

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,41 @@
1-
build:
2-
swift build
1+
SHELL=/bin/bash
32

4-
release:
5-
swift build -c release
6-
7-
test:
8-
swift test --parallel
3+
baseUrl = https://raw.githubusercontent.com/BinaryBirds/github-workflows/refs/heads/main/scripts
4+
5+
check: symlinks language deps lint headers
96

10-
test-with-coverage:
11-
swift test --parallel --enable-code-coverage
7+
symlinks:
8+
curl -s $(baseUrl)/check-broken-symlinks.sh | bash
129

13-
clean:
14-
rm -rf .build
10+
language:
11+
curl -s $(baseUrl)/check-unacceptable-language.sh | bash
12+
13+
deps:
14+
curl -s $(baseUrl)/check-local-swift-dependencies.sh | bash
15+
16+
lint:
17+
curl -s $(baseUrl)/run-swift-format.sh | bash
1518

1619
format:
17-
swift-format -i -r ./Sources && swift-format -i -r ./Tests
20+
curl -s $(baseUrl)/run-swift-format.sh | bash -s -- --fix
21+
22+
docc-local:
23+
curl -s $(baseUrl)/generate-docc.sh | bash -s -- --local
24+
25+
run-docc:
26+
curl -s $(baseUrl)/run-docc-docker.sh | bash
27+
28+
docc-warnings:
29+
curl -s $(baseUrl)/check-docc-warnings.sh | bash
30+
31+
headers:
32+
curl -s $(baseUrl)/check-swift-headers.sh | bash
33+
34+
fix-headers:
35+
curl -s $(baseUrl)/check-swift-headers.sh | bash -s -- --fix
36+
37+
test:
38+
swift test --parallel
39+
40+
docker-test:
41+
docker build -t feather-database-tests . -f ./docker/tests/Dockerfile && docker run --rm feather-database-tests

Package.swift

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,26 @@
1-
// swift-tools-version:5.9
1+
// swift-tools-version:6.1
22
import PackageDescription
33

4+
// NOTE: https://github.com/swift-server/swift-http-server/blob/main/Package.swift
5+
var defaultSwiftSettings: [SwiftSetting] =
6+
[
7+
// https://github.com/swiftlang/swift-evolution/blob/main/proposals/0441-formalize-language-mode-terminology.md
8+
.swiftLanguageMode(.v6),
9+
// https://github.com/swiftlang/swift-evolution/blob/main/proposals/0444-member-import-visibility.md
10+
.enableUpcomingFeature("MemberImportVisibility"),
11+
// https://forums.swift.org/t/experimental-support-for-lifetime-dependencies-in-swift-6-2-and-beyond/78638
12+
.enableExperimentalFeature("Lifetimes"),
13+
// https://github.com/swiftlang/swift/pull/65218
14+
.enableExperimentalFeature("AvailabilityMacro=featherDatabase 1.0:macOS 15.0, iOS 18.0, tvOS 18.0, watchOS 11.0, visionOS 2.0"),
15+
]
16+
17+
#if compiler(>=6.2)
18+
defaultSwiftSettings.append(
19+
// https://github.com/swiftlang/swift-evolution/blob/main/proposals/0461-async-function-isolation.md
20+
.enableUpcomingFeature("NonisolatedNonsendingByDefault")
21+
)
22+
#endif
23+
424
let package = Package(
525
name: "swift-bcrypt",
626
platforms: [
@@ -11,19 +31,19 @@ let package = Package(
1131
.visionOS(.v1),
1232
],
1333
products: [
14-
.library(name: "Bcrypt", targets: ["Bcrypt"]),
34+
.library(name: "BCrypt", targets: ["BCrypt"]),
1535
],
1636
dependencies: [
1737
],
1838
targets: [
19-
.target(name: "CBcrypt"),
20-
.target(name: "Bcrypt", dependencies: [
21-
.target(name: "CBcrypt"),
39+
.target(name: "CBCrypt"),
40+
.target(name: "BCrypt", dependencies: [
41+
.target(name: "CBCrypt"),
2242
]),
2343
.testTarget(
24-
name: "BcryptTests",
44+
name: "BCryptTests",
2545
dependencies: [
26-
.target(name: "Bcrypt"),
46+
.target(name: "BCrypt"),
2747
]
2848
),
2949
]

README.md

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,53 @@
11
# Swift BCrypt
22

3-
## Install
3+
Swift BCrypt implementation for securely hashing and verifying passwords using
4+
adaptive cost factors, random salts, and constant-time comparison.
45

5-
Add the repository as a dependency:
6+
![Release: 2.0.0](https://img.shields.io/badge/Release-2%2E0%2E0-F05138)
7+
8+
## Requirements
9+
10+
![Swift 6.1+](https://img.shields.io/badge/Swift-6%2E1%2B-F05138)
11+
![Platforms: Linux, macOS, iOS, tvOS, watchOS, visionOS](https://img.shields.io/badge/Platforms-Linux_%7C_macOS_%7C_iOS_%7C_tvOS_%7C_watchOS_%7C_visionOS-F05138)
12+
13+
- Swift 6.1+
14+
15+
- Platforms:
16+
- Linux
17+
- macOS 15+
18+
- iOS 18+
19+
- tvOS 18+
20+
- watchOS 11+
21+
- visionOS 2+
22+
23+
## Installation
24+
25+
Use Swift Package Manager; add the dependency to your `Package.swift` file:
626

727
```swift
828
.package(url: "https://github.com/binarybirds/swift-bcrypt", from: "1.0.0"),
929
```
1030

11-
Add `Bcrypt` to the target dependencies:
31+
Then add `Bcrypt` to your target dependencies:
1232

1333
```swift
1434
.product(name: "Bcrypt", package: "swift-bcrypt"),
1535
```
1636

1737
Update the packages and you are ready.
1838

39+
## Usage
40+
41+
![DocC API documentation](https://img.shields.io/badge/DocC-API_documentation-F05138)
42+
43+
API documentation is available at the following [link] (https://binarybirds.github.io/bcrypt). Refer to the mock objects in the Tests directory if you want to build a custom database driver implementation.
44+
45+
> [!TIP]
46+
> Avoid calling `database.execute` while in a transaction; use the transaction `connection` instead.
47+
48+
> [!WARNING]
49+
> This repository is a work in progress, things can break until it reaches v1.0.0.
50+
1951
## Usage example
2052

2153
Basic example
@@ -32,3 +64,16 @@ let res = try Bcrypt.verify("binary-birds", created: digest)
3264
This code is derived from the Vapor web framework:
3365

3466
- [Vapor](https://github.com/vapor/vapor)
67+
68+
## Development
69+
70+
- Build: `swift build`
71+
- Test:
72+
- local: `swift test`
73+
- using Docker: `make docker-test`
74+
- Format: `make format`
75+
- Check: `make check`
76+
77+
## Contributing
78+
79+
[Pull requests](https://github.com/binarybirds/swift-bcrypt/pulls) are welcome. Please keep changes focused and include tests for new logic. 🙏

0 commit comments

Comments
 (0)