Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
root = true

[*]
charset = utf-8
end_of_line = crlf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[*.{cs,csproj,props,targets,sln}]
charset = utf-8-bom

[*.{json,yml,yaml}]
indent_size = 2

[*.md]
trim_trailing_whitespace = false
23 changes: 23 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
version: 2
updates:
- package-ecosystem: nuget
directory: /
schedule:
interval: weekly
open-pull-requests-limit: 10
commit-message:
prefix: chore
include: scope
groups:
tests:
patterns: ["xunit*", "AwesomeAssertions"]
ignore:
# Never reintroduce FluentAssertions (commercial license since v8)
- dependency-name: "FluentAssertions"

- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
commit-message:
prefix: ci
41 changes: 25 additions & 16 deletions .github/workflows/publish-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@ on:
branches: [ master ]

env:
REPOSITORY_URL: https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
CURRENT_REPO_URL: https://github.com/${{ github.repository }}

permissions:
contents: write
issues: write
pull-requests: write

jobs:
publish:
runs-on: ubuntu-latest
Expand All @@ -17,34 +21,39 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v5
with:
fetch-depth: 0

- name: Setup .NET SDKs
uses: actions/setup-dotnet@v3
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: |
8.0.x
9.0.x
10.0.x

global-json-file: global.json

- name: Restore dependencies
run: dotnet restore
run: dotnet restore

- name: Build
run: dotnet build --no-restore
run: dotnet build --no-restore -c Release

- name: Test
run: dotnet test --no-build -c Release

- name: Semantic Release
id: semantic
uses: cycjimmy/semantic-release-action@v3
uses: cycjimmy/semantic-release-action@v4
with:
semantic_version: 24
extra_plugins: |
@semantic-release/changelog
@semantic-release/git
@semantic-release/changelog@6
@semantic-release/git@10
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Generate Package
run: dotnet pack -c Release -o out -p:PackageVersion=${{ steps.semantic.outputs.new_release_version }} -p:RepositoryUrl=${{env.CURRENT_REPO_URL}}
if: steps.semantic.outputs.new_release_published == 'true'
run: dotnet pack -c Release -o out -p:Version=${{ steps.semantic.outputs.new_release_version }} -p:RepositoryUrl=${{ env.CURRENT_REPO_URL }}

- name: Publish the package to nuget.org
run: dotnet nuget push ./out/*.nupkg -n -d -k ${{ secrets.NUGET_AUTH_TOKEN}} -s https://api.nuget.org/v3/index.json
if: steps.semantic.outputs.new_release_published == 'true'
run: dotnet nuget push ./out/*.nupkg --skip-duplicate -k ${{ secrets.NUGET_AUTH_TOKEN }} -s https://api.nuget.org/v3/index.json
29 changes: 18 additions & 11 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
name: Pull Request Analisys
name: Pull Request Analysis

on:
pull_request:
branches: [ master ]

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -13,21 +16,25 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v5
with:
fetch-depth: 0

- name: Setup .NET SDKs
uses: actions/setup-dotnet@v3
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: |
8.0.x
9.0.x
10.0.x

global-json-file: global.json

- name: Restore dependencies
run: dotnet restore

- name: Build
run: dotnet build --no-restore
run: dotnet build --no-restore -c Release

- name: Test
run: dotnet test --no-build
run: dotnet test --no-build -c Release

- name: Check vulnerable packages
run: |
dotnet list package --vulnerable --include-transitive 2>&1 | tee vulnerable.txt
! grep -q "has the following vulnerable packages" vulnerable.txt
11 changes: 11 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<Project>
<!-- Shared settings for every project under this repository -->
<PropertyGroup>
<LangVersion>latest</LangVersion>
<!-- Fail the build when a dependency has a known vulnerability (NuGet Audit) -->
<NuGetAudit>true</NuGetAudit>
<NuGetAuditMode>all</NuGetAuditMode>
<WarningsAsErrors>$(WarningsAsErrors);NU1901;NU1902;NU1903;NU1904</WarningsAsErrors>
<ContinuousIntegrationBuild Condition="'$(CI)' == 'true'">true</ContinuousIntegrationBuild>
</PropertyGroup>
</Project>
34 changes: 34 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<Project>
<!--
Central Package Management: every version lives here, csproj files only declare <PackageReference Include="..." />.
Microsoft.* packages that ship with .NET follow the target framework (net10.0 -> 10.0.x).
-->
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
</PropertyGroup>

<ItemGroup>
<!-- Libraries -->
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.15" />
<PackageVersion Include="Microsoft.Extensions.Identity.Core" Version="10.0.15" />
<PackageVersion Include="Microsoft.Extensions.Options" Version="10.0.15" />
<PackageVersion Include="Sodium.Core" Version="1.4.1" />
<PackageVersion Include="BCrypt.Net-Core" Version="1.6.0" />

<!-- Demo -->
<PackageVersion Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="10.0.15" />
<PackageVersion Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="10.0.15" />
<PackageVersion Include="Microsoft.AspNetCore.Identity.UI" Version="10.0.15" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="10.0.15" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Tools" Version="10.0.15" />
<PackageVersion Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.23.0" />

<!-- Tests -->
<PackageVersion Include="AwesomeAssertions" Version="9.6.0" />
<PackageVersion Include="Bogus" Version="35.6.5" />
<PackageVersion Include="Bogus.Tools.Analyzer" Version="35.6.5" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="10.0.15" />
<PackageVersion Include="xunit.v3" Version="4.0.3" />
</ItemGroup>
</Project>
Binary file modified README.md
Binary file not shown.
9 changes: 9 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"sdk": {
"version": "10.0.100",
"rollForward": "latestFeature"
},
"test": {
"runner": "Microsoft.Testing.Platform"
}
}
27 changes: 27 additions & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<Project>
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />

<!-- Shared settings and NuGet metadata for every project under src/ -->
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<Authors>brunobritodev</Authors>
<Company>NetDevPack</Company>
<NeutralLanguage>en</NeutralLanguage>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<RepositoryUrl>https://github.com/NetDevPack/Security.PasswordHasher</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<RepositoryBranch>master</RepositoryBranch>
<PackageProjectUrl>https://github.com/NetDevPack/Security.PasswordHasher</PackageProjectUrl>
<PackageIcon>icon.png</PackageIcon>
<PackageReadmeFile>README.md</PackageReadmeFile>

<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>

<ItemGroup Condition="'$(IsPackable)' != 'false'">
<None Include="$(MSBuildThisFileDirectory)../icon.png" Pack="true" PackagePath="\" Visible="false" />
<None Include="$(MSBuildThisFileDirectory)../README.md" Pack="true" PackagePath="\" Visible="false" />
</ItemGroup>
</Project>
Binary file modified src/NetDevPack.Security.PasswordHasher.Argon2/Argon2id.cs
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,40 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net8.0;net9.0;net10.0</TargetFrameworks>
<Version>3.0.0</Version>
<Authors>brunobritodev</Authors>
<Company>NetDevPack</Company>
<PackageTags>argon2;argon2id;identity;aspnetcore;password-hashing;security;cryptography;libsodium;netdevpack</PackageTags>
<Title>Argon2id password hasher for ASP.NET Core Identity</Title>
<Description>ASP.NET Core Identity IPasswordHasher implementation backed by libsodium Argon2id.
Supports configurable opslimit/memlimit or strength presets through NetDevPack builder options.
Detects ASP.NET Identity v2/v3 hashes and rehashes them to Argon2id after successful verification.</Description>
<PackageReleaseNotes>Argon2id-based IPasswordHasher with configurable cost factors, NetDevPack DI extensions, and automatic upgrade path for legacy ASP.NET Identity hashes.</PackageReleaseNotes>
<NeutralLanguage>en</NeutralLanguage>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<RepositoryUrl>https://github.com/NetDevPack/Security.PasswordHasher</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<RepositoryBranch>main</RepositoryBranch>
<PackageProjectUrl>https://github.com/NetDevPack/Security.PasswordHasher</PackageProjectUrl>
<PackageIcon>icon.png</PackageIcon>

<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
<LangVersion>latest</LangVersion>
</PropertyGroup>

<ItemGroup>
<None Include="..\..\icon.png" Pack="true" PackagePath="\" />
<None Include="..\..\README.md" Pack="true" PackagePath="\" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Identity.Core" Version="10.0.2" />
<PackageReference Include="Sodium.Core" Version="1.4.0" />
<PackageReference Include="Microsoft.Extensions.Identity.Core" />
<PackageReference Include="Sodium.Core" />
</ItemGroup>

<ItemGroup>
Expand Down
Binary file modified src/NetDevPack.Security.PasswordHasher.Bcrypt/BCrypt.cs
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,40 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net8.0;net9.0;net10.0</TargetFrameworks>
<Version>3.0.0</Version>
<Authors>brunobritodev</Authors>
<Company>NetDevPack</Company>
<PackageTags>bcrypt;identity;aspnetcore;password-hashing;security;cryptography;netdevpack</PackageTags>
<Title>BCrypt password hasher for ASP.NET Core Identity</Title>
<Description>ASP.NET Core Identity IPasswordHasher built on BCrypt.Net.
Lets you tune work factor and salt revision through NetDevPack builder options.
Recognizes ASP.NET Identity v2/v3 hashes and rehashes them with bcrypt after successful verification.</Description>
<PackageReleaseNotes>BCrypt-based IPasswordHasher with configurable work factor and salt revision, NetDevPack DI extensions, and automatic upgrade of legacy ASP.NET Identity hashes.</PackageReleaseNotes>
<NeutralLanguage>en</NeutralLanguage>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<RepositoryUrl>https://github.com/NetDevPack/Security.PasswordHasher</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<RepositoryBranch>main</RepositoryBranch>
<PackageProjectUrl>https://github.com/NetDevPack/Security.PasswordHasher</PackageProjectUrl>
<PackageIcon>icon.png</PackageIcon>

<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
<LangVersion>latest</LangVersion>
</PropertyGroup>

<ItemGroup>
<None Include="..\..\icon.png" Pack="true" PackagePath="\" />
<None Include="..\..\README.md" Pack="true" PackagePath="\" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Identity.Core" Version="10.0.2" />
<PackageReference Include="BCrypt.Net-Core" Version="1.6.0" />
<PackageReference Include="Microsoft.Extensions.Identity.Core" />
<PackageReference Include="BCrypt.Net-Core" />
</ItemGroup>

<ItemGroup>
Expand Down
Binary file modified src/NetDevPack.Security.PasswordHasher.Core/BcryptSaltRevision.cs
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,47 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net8.0;net9.0;net10.0</TargetFrameworks>
<Version>2.0.0</Version>
<Authors>brunobritodev</Authors>
<Company>NetDevPack</Company>
<PackageTags>password-hashing;security;identity;aspnetcore;cryptography;dependency-injection;netdevpack;options</PackageTags>
<Title>Core library for NetDevPack PasswordHasher</Title>
<Description>Core abstractions shared by NetDevPack password hashing algorithms for ASP.NET Core Identity.
Provides options and builder extensions to tune work factor, salt revision, and memory/ops limits.
Includes utilities to detect legacy ASP.NET Identity hashes for smoother upgrades.</Description>
<PackageReleaseNotes>Provides shared options, DI builder, and hash format detection used by NetDevPack Argon2, BCrypt, and Scrypt password hashers.</PackageReleaseNotes>
<NeutralLanguage>en</NeutralLanguage>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<RepositoryUrl>https://github.com/NetDevPack/Security.PasswordHasher</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<RepositoryBranch>main</RepositoryBranch>
<PackageProjectUrl>https://github.com/NetDevPack/Security.PasswordHasher</PackageProjectUrl>
<PackageIcon>icon.png</PackageIcon>

<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
<LangVersion>latest</LangVersion>
</PropertyGroup>

<ItemGroup>
<None Include="..\..\icon.png" Pack="true" PackagePath="\" />
<None Include="..\..\README.md" Pack="true" PackagePath="\" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" />
<PackageReference Include="Microsoft.Extensions.Options" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.2" />
<PackageReference Include="Microsoft.Extensions.Options" Version="10.0.2" />
</ItemGroup>

<Target Name="CopyHook" AfterTargets="AfterBuild" Condition="'$(Configuration)' == 'Debug'">
<Target Name="CopyHook" AfterTargets="AfterBuild" Condition="'$(Configuration)' == 'Debug' And '$(CI)' != 'true'">
<ItemGroup>
<_CustomFiles Include="../../.github/hooks/commit-msg" />
</ItemGroup>
<Copy SourceFiles="@(_CustomFiles)" DestinationFolder="../../.git/hooks" />
<Copy SourceFiles="@(_CustomFiles)" DestinationFolder="$(MSBuildThisFileDirectory)../../.git/hooks" Condition="Exists('$(MSBuildThisFileDirectory)../../.git')" />
</Target>

</Project>
Binary file not shown.
Loading
Loading