mirror of
https://github.com/XFox111/SimpleOTP.git
synced 2026-07-02 19:52:42 +03:00
Compare commits
32 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 40de8971e8 | |||
| beec314b3e | |||
| bd876fa0d1 | |||
| 14f45e1da5 | |||
| 9327264f18 | |||
| 3cbb8003a7 | |||
| 4723ce8558 | |||
| b835a892ec | |||
| d7fb086a25 | |||
| 3b1ebe38ce | |||
| 70c31fdfbe | |||
| e43c4d2e80 | |||
| 4218903ace | |||
| e257ad6bfd | |||
| 9c645e9f03 | |||
| 14e9a645ff | |||
| 0e361ccd0b | |||
| 269f85adf2 | |||
| 56b662441b | |||
| 80e18fd20a | |||
| f7f75ebd27 | |||
| f67cbd7b27 | |||
| 91d021ec50 | |||
| 225237f45f | |||
| 2ff4b5827a | |||
| f7c8e547be | |||
| 85a07d3163 | |||
| ef09e49aa3 | |||
| ce9d126087 | |||
| 989ed46f3b | |||
| ee0ae960d0 | |||
| 704d115208 |
@@ -3,7 +3,7 @@
|
||||
{
|
||||
"name": "SimpleOTP",
|
||||
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
|
||||
"image": "mcr.microsoft.com/devcontainers/dotnet:1-8.0",
|
||||
"image": "mcr.microsoft.com/devcontainers/dotnet:10.0",
|
||||
|
||||
// Features to add to the dev container. More info: https://containers.dev/features.
|
||||
// "features": {},
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
* @XFox111
|
||||
+15
-12
@@ -11,32 +11,35 @@ updates:
|
||||
- package-ecosystem: "nuget" # See documentation for possible values
|
||||
directory: "/" # Location of package manifests
|
||||
assignees:
|
||||
- "xfox111"
|
||||
reviewers:
|
||||
- "xfox111"
|
||||
- "XFox111"
|
||||
schedule:
|
||||
interval: monthly
|
||||
rebase-strategy: disabled
|
||||
open-pull-requests-limit: 20
|
||||
groups:
|
||||
all:
|
||||
patterns:
|
||||
- "*"
|
||||
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
assignees:
|
||||
- "xfox111"
|
||||
reviewers:
|
||||
- "xfox111"
|
||||
- "XFox111"
|
||||
schedule:
|
||||
interval: monthly
|
||||
rebase-strategy: disabled
|
||||
open-pull-requests-limit: 20
|
||||
groups:
|
||||
all:
|
||||
patterns:
|
||||
- "*"
|
||||
|
||||
- package-ecosystem: "devcontainers"
|
||||
directory: "/"
|
||||
assignees:
|
||||
- "xfox111"
|
||||
reviewers:
|
||||
- "xfox111"
|
||||
- "XFox111"
|
||||
schedule:
|
||||
interval: monthly
|
||||
rebase-strategy: disabled
|
||||
open-pull-requests-limit: 20
|
||||
groups:
|
||||
all:
|
||||
patterns:
|
||||
- "*"
|
||||
|
||||
@@ -8,7 +8,7 @@ name: "CodeQL"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
branches: [ "main", "next" ]
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
- 'LICENSE'
|
||||
@@ -19,7 +19,7 @@ on:
|
||||
- '.assets/*'
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches: [ "main" ]
|
||||
branches: [ "main", "next" ]
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
- 'LICENSE'
|
||||
@@ -49,11 +49,16 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v5
|
||||
with:
|
||||
dotnet-version: 9.0.x
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v3
|
||||
uses: github/codeql-action/init@v4
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||
@@ -67,7 +72,7 @@ jobs:
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v3
|
||||
uses: github/codeql-action/autobuild@v4
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
|
||||
@@ -80,4 +85,4 @@ jobs:
|
||||
# ./location_of_script_within_repo/buildscript.sh
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v3
|
||||
uses: github/codeql-action/analyze@v4
|
||||
|
||||
@@ -2,7 +2,7 @@ name: "Build workflow"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
branches: [ "main", "next" ]
|
||||
paths-ignore:
|
||||
- "**.md"
|
||||
- "LICENSE"
|
||||
@@ -12,7 +12,7 @@ on:
|
||||
- ".devcontainer/*"
|
||||
- "!.github/workflows/pr-workflow.yml"
|
||||
pull_request:
|
||||
branches: [ "main" ]
|
||||
branches: [ "main", "next" ]
|
||||
paths-ignore:
|
||||
- "**.md"
|
||||
- "LICENSE"
|
||||
@@ -28,12 +28,12 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
uses: actions/setup-dotnet@v5
|
||||
with:
|
||||
dotnet-version: 8.0.x
|
||||
dotnet-version: 10.0.x
|
||||
|
||||
- run: dotnet restore
|
||||
- run: dotnet build --no-restore
|
||||
@@ -46,7 +46,7 @@ jobs:
|
||||
with:
|
||||
name: SimpleOTP
|
||||
path: libraries/SimpleOTP/bin/Debug/EugeneFox.SimpleOTP*.*nupkg
|
||||
|
||||
|
||||
- name: Drop SimpleOTP.DependencyInjection
|
||||
uses: actions/upload-artifact@main
|
||||
with:
|
||||
|
||||
@@ -10,12 +10,12 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
uses: actions/setup-dotnet@v5
|
||||
with:
|
||||
dotnet-version: 8.0.x
|
||||
dotnet-version: 10.0.x
|
||||
|
||||
- run: dotnet restore
|
||||
- run: dotnet pack
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2024 Eugene Fox
|
||||
Copyright (c) 2025 Eugene Fox
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[](https://github.com/xfox111/SimpleOTP/releases/latest)
|
||||
[](https://github.com/XFox111/SimpleOTP/commits/main)
|
||||
|
||||

|
||||

|
||||
|
||||
Feature-rich and flexible .NET library for implementation of OTP authenticators and validatiors.
|
||||
|
||||
@@ -48,14 +48,14 @@ If you are interested in fixing issues and contributing directly to the code bas
|
||||
|
||||
---
|
||||
|
||||
[](https://twitter.com/xfox111)
|
||||
[](https://github.com/xfox111)
|
||||
[](https://buymeacoffee.com/xfox111)
|
||||
[](https://bsky.app/profile/xfox111.net)
|
||||
[](https://github.com/xfox111)
|
||||
[](https://buymeacoffee.com/xfox111)
|
||||
|
||||
> ©2024 Eugene Fox. Licensed under [MIT license][mit]
|
||||
> ©2026 Eugene Fox. Licensed under [MIT license][mit]
|
||||
|
||||
[RFC-6238]: https://
|
||||
[RFC-4226]: https://
|
||||
[RFC-6238]: https://www.rfc-editor.org/rfc/rfc6238
|
||||
[RFC-4226]: https://www.rfc-editor.org/rfc/rfc4226
|
||||
[otpauth-ID]: https://www.ietf.org/archive/id/draft-linuxgemini-otpauth-uri-00.html
|
||||
[nuget]: https://www.nuget.org/packages/EugeneFox.SimpleOTP
|
||||
[nuget-di]: https://www.nuget.org/packages/EugeneFox.SimpleOTP.DependencyInjection
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
|
||||
<PackageReference Include="NUnit" Version="4.2.2" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.7.0" />
|
||||
<PackageReference Include="NUnit" Version="4.6.1" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="6.2.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 512">
|
||||
<defs>
|
||||
<style>
|
||||
.cls-1 {
|
||||
stroke: #0e700e;
|
||||
}
|
||||
|
||||
.cls-1,
|
||||
.cls-2 {
|
||||
fill: none;
|
||||
stroke-linecap: round;
|
||||
stroke-miterlimit: 10;
|
||||
stroke-width: 12.69px;
|
||||
}
|
||||
|
||||
.cls-2 {
|
||||
opacity: .5;
|
||||
stroke: #9fd89f;
|
||||
}
|
||||
|
||||
.cls-3 {
|
||||
fill: #0e700e;
|
||||
}
|
||||
|
||||
.cls-4 {
|
||||
fill: #242424;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
.cls-1 {
|
||||
stroke: #54b054;
|
||||
}
|
||||
|
||||
.cls-2 {
|
||||
stroke: #094509;
|
||||
}
|
||||
|
||||
.cls-3 {
|
||||
fill: #54b054;
|
||||
}
|
||||
|
||||
.cls-4 {
|
||||
fill: #ffffff;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</defs>
|
||||
<circle class="cls-2" cx="412.24" cy="239.44" r="93.87" />
|
||||
<g>
|
||||
<path class="cls-4"
|
||||
d="M461.84,211.45v-19.62l2.8-7.47c2.49.62,4.05,2.18,4.67,4.67v26.16l-1.87,1.87-5.6-5.6ZM467.44,217.99l1.87,1.87v26.16c-.62,2.49-2.18,4.05-4.67,4.67l-2.8-7.47v-19.62l5.6-5.6Z" />
|
||||
<path class="cls-4"
|
||||
d="M496.4,193.71v17.75l-5.6,5.6-1.87-1.87v-24.29l7.47,2.8ZM496.4,224.53v19.62l-2.8,7.47c-2.49-.62-4.05-2.18-4.67-4.67v-26.16l1.87-1.87,5.6,5.61ZM518.82,191.84h-22.33l-7.47-2.8c.62-2.49,2.18-4.05,4.67-4.67h27.93l-2.8,7.47ZM512.28,215.19l-3.74,3.74-3.74-3.74v-21.48h7.47v21.48ZM520.68,211.45v-19.62l2.8-7.47c2.49.62,4.05,2.18,4.67,4.67v26.16l-1.87,1.87-5.6-5.6ZM526.29,218.93l1.87,1.87v26.16c-.62,2.49-2.18,4.05-4.67,4.67l-2.8-7.47v-19.62l5.6-5.61Z" />
|
||||
<path class="cls-4"
|
||||
d="M577.66,191.84h-22.42l-7.47-2.8v-4.67h29.89l3.74,3.74-3.74,3.74ZM555.25,193.71v17.75l-5.6,5.6-1.87-1.87v-24.29l7.47,2.8ZM555.25,224.53v19.62l-2.8,7.47c-2.49-.62-4.05-2.18-4.67-4.67v-26.16l1.87-1.87,5.6,5.61ZM579.53,214.26l3.74,3.74-3.74,3.74h-24.29l-3.74-3.74,3.74-3.74h24.29ZM579.53,211.45v-19.62l2.8-2.8,4.67,4.67v21.48l-1.87,1.87-5.6-5.6Z" />
|
||||
<path class="cls-4"
|
||||
d="M608.49,217.06l-1.87-1.87v-26.16c.62-2.49,2.18-4.05,4.67-4.67l2.8,7.47v19.62l-5.6,5.6ZM614.09,224.53v19.62l-2.8,7.47c-2.49-.62-4.05-2.18-4.67-4.67v-26.16l1.87-1.87,5.6,5.61ZM615.96,244.15h22.42l7.47,2.8c-.62,2.49-2.18,4.05-4.67,4.67h-28.02l2.8-7.47Z" />
|
||||
<path class="cls-4"
|
||||
d="M672.94,193.71v17.75l-5.6,5.6-1.87-1.87v-24.29l7.47,2.8ZM665.47,245.08v-24.29l1.87-1.87,5.6,5.61v17.75l-7.47,2.8ZM700.97,251.62h-30.83c-2.49-.62-4.05-2.18-4.67-4.67l7.47-2.8h25.22l2.8,7.47ZM698.16,191.84h-25.13l-7.47-2.8c.62-2.49,2.18-4.05,4.67-4.67h30.73l-2.8,7.47ZM697.23,214.26l3.74,3.74-3.74,3.74h-24.29l-3.74-3.74,3.74-3.74h24.29Z" />
|
||||
</g>
|
||||
<path class="cls-1"
|
||||
d="M412.24,145.57c-51.85,0-93.87,42.03-93.87,93.87s42.03,93.87,93.87,93.87c40.19,0,74.46-25.24,87.86-60.74" />
|
||||
<path class="cls-4"
|
||||
d="M394.28,200.33v28.6l-9.03,9.03-3.01-3.01v-39.14l12.04,4.52ZM434.92,293.66h-45.16c-4.02-1-6.52-3.51-7.53-7.53l12.04-4.52h36.13l4.52,12.04ZM394.43,197.32l-12.04-4.52c1-4.01,3.51-6.52,7.53-7.53h48.02c4.01,1,6.52,3.51,7.53,7.53l-12.04,4.52h-38.99ZM433.42,233.44l6.02,6.02-6.02,6.02h-39.14l-6.02-6.02,6.02-6.02h39.14ZM442.45,240.97l3.01,3.01v42.15c-1,4.01-3.51,6.52-7.53,7.53l-4.52-12.04v-31.61l9.03-9.03Z" />
|
||||
<g>
|
||||
<path class="cls-3" d="M574.97,273.46h-20.12v61.81h-11.94v-61.81h-20.07v-10.13h52.13v10.13Z" />
|
||||
<path class="cls-3"
|
||||
d="M597.55,310.24v25.04h-11.94v-71.95h22.18c8.26,0,14.61,1.93,19.04,5.79,4.43,3.86,6.65,9.42,6.65,16.68s-2.48,13.31-7.43,17.76c-4.95,4.45-11.62,6.67-20.02,6.67h-8.48ZM597.55,273.11v27.29h7.93c4.98,0,8.81-1.23,11.46-3.69,2.66-2.46,3.99-5.93,3.99-10.41s-1.25-7.59-3.74-9.83c-2.49-2.24-6.18-3.36-11.06-3.36h-8.58Z" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3.4 KiB |
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<TargetFrameworks>net8.0;net9.0;net10.0</TargetFrameworks>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
@@ -9,9 +9,9 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<PackageId>EugeneFox.SimpleOTP.DependencyInjection</PackageId>
|
||||
<Version>8.0.0.0</Version>
|
||||
<Version>10.0.4.0</Version>
|
||||
<Authors>Eugene Fox</Authors>
|
||||
<Copyright>Copyright © Eugene Fox 2024</Copyright>
|
||||
<Copyright>Copyright © Eugene Fox 2026</Copyright>
|
||||
<NeutralLanguage>en-US</NeutralLanguage>
|
||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||
</PropertyGroup>
|
||||
@@ -37,7 +37,7 @@
|
||||
service in your application.
|
||||
</Description>
|
||||
<PackageReleaseNotes>
|
||||
Initial release. See README.md for details.
|
||||
Updated `Microsoft.Extensions.Configuration.Binder` and `Microsoft.Extensions.DependencyInjection.Abstractions` to version 10.0.8.
|
||||
</PackageReleaseNotes>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -57,9 +57,8 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.*" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions"
|
||||
Version="8.0.*" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="10.0.9" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.9" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -2,8 +2,6 @@ using System.Security.Cryptography;
|
||||
|
||||
namespace SimpleOTP;
|
||||
|
||||
// TODO: Add tests
|
||||
|
||||
/// <summary>
|
||||
/// Represents an abstract class for generating and validating One-Time Passwords (OTP).
|
||||
/// </summary>
|
||||
|
||||
@@ -114,12 +114,12 @@ public partial record class OtpConfig
|
||||
|
||||
if (format.HasFlag(OtpUriFormat.Yubico))
|
||||
{
|
||||
if (config.Type == OtpType.Totp && config.Period is not 15 or 30 or 60)
|
||||
if (config is { Type: OtpType.Totp, Period: not (15 or 30 or 60) })
|
||||
errors.Add($"- '{nameof(config.Period)}' must be 15, 30 or 60.");
|
||||
}
|
||||
|
||||
// Check for digits value
|
||||
if (config.Digits is not 6 or 8)
|
||||
if (config.Digits is not (6 or 8))
|
||||
{
|
||||
// Now it's time for IBM and Yubico to be weird
|
||||
if (format.HasFlag(OtpUriFormat.IBM) && config.Digits is not 7 and not 9)
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<TargetFrameworks>net8.0;net9.0;net10.0</TargetFrameworks>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<IsAotCompatible>true</IsAotCompatible>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
@@ -14,9 +15,9 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<PackageId>EugeneFox.SimpleOTP</PackageId>
|
||||
<Version>8.0.0.0</Version>
|
||||
<Version>10.0.4.0</Version>
|
||||
<Authors>Eugene Fox</Authors>
|
||||
<Copyright>Copyright © Eugene Fox 2024</Copyright>
|
||||
<Copyright>Copyright © Eugene Fox 2026</Copyright>
|
||||
<NeutralLanguage>en-US</NeutralLanguage>
|
||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||
</PropertyGroup>
|
||||
@@ -35,7 +36,7 @@
|
||||
Feature-rich, fast, and customizable library for implementation TOTP/HOTP authenticators and validators.
|
||||
</Description>
|
||||
<PackageReleaseNotes>
|
||||
(BREAKING CHANGE) Complete overhaul of the library. See https://github.com/XFox111/SimpleOTP/releases/tag/2.0.0 for more details.
|
||||
- Fixed OTP config incorrect validation of TOTP period and code length.
|
||||
</PackageReleaseNotes>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user