Skip to content

Commit cb9ba0f

Browse files
authored
Merge pull request #132
Using PolySharp to allow use of C#13
2 parents 8a4072e + 8c4428c commit cb9ba0f

File tree

89 files changed

+300
-792
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+300
-792
lines changed

.editorconfig

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,12 @@ resharper_csharp_wrap_parameters_style = chop_always
2929
# C# files
3030
[*.cs]
3131

32+
# Use concrete types when possible for improved performance
33+
dotnet_diagnostic.CA1859.severity = suggestion
34+
3235
#### Core EditorConfig Options ####
3336

34-
# We can't do this until C# 9.
35-
csharp_style_implicit_object_creation_when_type_is_apparent = false
37+
csharp_style_implicit_object_creation_when_type_is_apparent = true
3638

3739
# Indentation and spacing
3840
indent_size = 4
@@ -341,6 +343,9 @@ csharp_style_var_for_built_in_types = true:suggestion
341343
csharp_style_unused_value_expression_statement_preference = unused_local_variable:none
342344
resharper_for_simple_types = use_var
343345

346+
# CA1860: Avoid using 'Enumerable.Any()' extension method
347+
dotnet_diagnostic.CA1860.severity = suggestion
348+
344349
# CA1707: Identifiers should not contain underscores
345350
dotnet_diagnostic.ca1707.severity = none
346351

@@ -362,3 +367,5 @@ dotnet_diagnostic.ca1014.severity = none
362367
csharp_style_var_elsewhere = false:warning
363368
csharp_style_var_for_built_in_types = false:warning
364369
csharp_style_var_when_type_is_apparent = true:warning
370+
dotnet_diagnostic.IDE0007.severity = none
371+
dotnet_diagnostic.IDE0008.severity = none

.github/workflows/build-pull-requests.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ jobs:
6363
with:
6464
name: Nuget Packages ReleaseWithDocs
6565
path: |
66-
Yubico.DotNetPolyfills/src/bin/ReleaseWithDocs/*.nupkg
6766
Yubico.Core/src/bin/ReleaseWithDocs/*.nupkg
6867
Yubico.YubiKey/src/bin/ReleaseWithDocs/*.nupkg
6968
@@ -72,6 +71,5 @@ jobs:
7271
with:
7372
name: Assemblies ReleaseWithDocs
7473
path: |
75-
Yubico.DotNetPolyfills/src/bin/ReleaseWithDocs/**/*.dll
7674
Yubico.Core/src/bin/ReleaseWithDocs/**/*.dll
7775
Yubico.YubiKey/src/bin/ReleaseWithDocs/**/*.dll

.github/workflows/build.yml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,7 @@ jobs:
7171
- uses: actions/checkout@v4
7272
- uses: actions/setup-dotnet@v4
7373
with:
74-
global-json-file: global.json
75-
74+
global-json-file: "./global.json"
7675
- name: Add local NuGet repository
7776
run: dotnet nuget add source --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/Yubico/index.json"
7877

@@ -81,7 +80,6 @@ jobs:
8180
run: |
8281
$file = gci ./build/Versions.props
8382
$versionProp = [xml](gc $file.FullName)
84-
$versionProp.Project.PropertyGroup.YubicoDotNetPolyfillsVersion = "${{ github.event.inputs.version }}"
8583
$versionProp.Project.PropertyGroup.YubicoCoreVersion = "${{ github.event.inputs.version }}"
8684
$versionProp.Project.PropertyGroup.YubicoYubiKeyVersion = "${{ github.event.inputs.version }}"
8785
$versionProp.Save($file.FullName)
@@ -102,7 +100,6 @@ jobs:
102100
with:
103101
name: Nuget Packages
104102
path: |
105-
Yubico.DotNetPolyfills/src/bin/ReleaseWithDocs/*.nupkg
106103
Yubico.Core/src/bin/ReleaseWithDocs/*.nupkg
107104
Yubico.YubiKey/src/bin/ReleaseWithDocs/*.nupkg
108105
@@ -111,7 +108,6 @@ jobs:
111108
with:
112109
name: Symbols Packages
113110
path: |
114-
Yubico.DotNetPolyfills/src/bin/ReleaseWithDocs/*.snupkg
115111
Yubico.Core/src/bin/ReleaseWithDocs/*.snupkg
116112
Yubico.YubiKey/src/bin/ReleaseWithDocs/*.snupkg
117113
@@ -120,21 +116,17 @@ jobs:
120116
with:
121117
name: Assemblies
122118
path: |
123-
Yubico.DotNetPolyfills/src/bin/ReleaseWithDocs/**/*.dll
124119
Yubico.Core/src/bin/ReleaseWithDocs/**/*.dll
125120
Yubico.YubiKey/src/bin/ReleaseWithDocs/**/*.dll
126121
127122
- name: Generate artifact attestation
128123
uses: actions/attest-build-provenance@v2
129124
with:
130125
subject-path: |
131-
Yubico.DotNetPolyfills/src/bin/ReleaseWithDocs/*.nupkg
132126
Yubico.Core/src/bin/ReleaseWithDocs/*.nupkg
133127
Yubico.YubiKey/src/bin/ReleaseWithDocs/*.nupkg
134-
Yubico.DotNetPolyfills/src/bin/ReleaseWithDocs/*.snupkg
135128
Yubico.Core/src/bin/ReleaseWithDocs/*.snupkg
136129
Yubico.YubiKey/src/bin/ReleaseWithDocs/*.snupkg
137-
Yubico.DotNetPolyfills/src/bin/ReleaseWithDocs/**/*.dll
138130
Yubico.Core/src/bin/ReleaseWithDocs/**/*.dll
139131
Yubico.YubiKey/src/bin/ReleaseWithDocs/**/*.dll
140132
@@ -179,10 +171,8 @@ jobs:
179171
with:
180172
name: Nuget Packages
181173
- run: |
182-
$polyfills = (Get-ChildItem -Recurse Yubico.DotnetPolyfills/*.nupkg)[0].FullName
183174
$core = (Get-ChildItem -Recurse Yubico.Core/*.nupkg)[0].FullName
184175
$yubikey = (Get-ChildItem -Recurse Yubico.YubiKey/*.nupkg)[0].FullName
185176
dotnet nuget add source --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/Yubico/index.json"
186-
dotnet nuget push $polyfills --source "github" --api-key ${{ secrets.GITHUB_TOKEN }}
187177
dotnet nuget push $core --source "github" --api-key ${{ secrets.GITHUB_TOKEN }}
188178
dotnet nuget push $yubikey --source "github" --api-key ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test-macos.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
- uses: actions/checkout@v4
3131
- uses: actions/setup-dotnet@v4
3232
with:
33-
global-json-file: global.json
33+
global-json-file: "./global.json"
3434

3535
- name: Add local NuGet repository
3636
run: dotnet nuget add source --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/Yubico/index.json"

.github/workflows/test-ubuntu.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
- uses: actions/checkout@v4
3131
- uses: actions/setup-dotnet@v4
3232
with:
33-
global-json-file: global.json
33+
global-json-file: "./global.json"
3434

3535
- name: Add local NuGet repository
3636
run: dotnet nuget add source --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/Yubico/index.json"

.github/workflows/test-windows.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ jobs:
3030
- uses: actions/checkout@v4
3131
- uses: actions/setup-dotnet@v4
3232
with:
33-
global-json-file: global.json
33+
global-json-file: "./global.json"
34+
3435
- name: Add local NuGet repository
3536
run: dotnet nuget add source --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/Yubico/index.json"
3637

.github/workflows/verify-code-style.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ jobs:
3636
- uses: actions/checkout@v4
3737
- uses: actions/setup-dotnet@v4
3838
with:
39-
global-json-file: global.json
39+
global-json-file: "./global.json"
40+
4041
- name: Add local NuGet repository
4142
run: dotnet nuget add source --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/Yubico/index.json"
4243
#- name: Build Yubico.NET.SDK.sln

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,5 +210,5 @@ The following rules must be followed for PRs that include files from another pro
210210
- The contribution is correctly attributed, as needed (generally in LICENSE.txt or NOTICE.txt in
211211
project root).
212212

213-
See [CborTag.cs](./Yubico.DotNetPolyfills/src/System.Formats.Cbor/CborTag.cs) for an example of a
213+
See [CryptographicOperations.cs](./Yubico.Core/src/System.Security.Cryptography/CryptographicOperations.cs) for an example of a
214214
file copied from another project and attributed in the [LICENSE.txt](./LICENSE.txt) file.

LICENSE.txt

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -200,41 +200,10 @@
200200
See the License for the specific language governing permissions and
201201
limitations under the License.
202202

203-
204-
205-
==================================================
206-
The following license applies to
207-
\Yubico.DotNetPolyfills\src\Contrib.Bcl.Ranges\Range.cs
208-
\Yubico.DotNetPolyfills\src\Contrib.Bcl.Ranges\Index.cs
209-
210-
MIT License
211-
212-
Copyright (c) 2019 Stuart Lang
213-
Copyright (c) .NET Foundation and Contributors
214-
215-
Permission is hereby granted, free of charge, to any person obtaining a copy
216-
of this software and associated documentation files (the "Software"), to deal
217-
in the Software without restriction, including without limitation the rights
218-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
219-
copies of the Software, and to permit persons to whom the Software is
220-
furnished to do so, subject to the following conditions:
221-
222-
The above copyright notice and this permission notice shall be included in all
223-
copies or substantial portions of the Software.
224-
225-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
226-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
227-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
228-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
229-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
230-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
231-
SOFTWARE.
232-
233-
234203
==================================================
235204
The following license applies to
236205
\CONTRIBUTING.md
237-
\Yubico.DotNetPolyfills\src\System.Security.Cryptography\CryptographicOperations.cs
206+
\Yubico.Core\src\System.Security.Cryptography\CryptographicOperations.cs
238207
\Yubico.YubiKey\src\Yubico\YubiKey\Cryptography\RandomNumberGeneratorExt.cs
239208

240209
The MIT License (MIT)

README.md

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,23 @@ limitations under the License. -->
2424
Enterprise-grade cross-platform SDK for YubiKey integration, built on .NET.
2525

2626
## Table of Contents
27-
- [Quick Start](#quick-start)
28-
- [Documentation](#documentation)
29-
- [SDK Support](#sdk-support)
30-
- [SDK Packages](#sdk-packages)
31-
- [Project Structure](#project-structure)
32-
- [Contributing](#contributing)
33-
- [Security](#security)
27+
- [.NET YubiKey SDK](#net-yubikey-sdk)
28+
- [Table of Contents](#table-of-contents)
29+
- [Quick Start](#quick-start)
30+
- [Installation](#installation)
31+
- [Basic Usage](#basic-usage)
32+
- [Documentation](#documentation)
33+
- [SDK Support](#sdk-support)
34+
- [SDK Packages](#sdk-packages)
35+
- [Public Assemblies](#public-assemblies)
36+
- [Yubico.YubiKey](#yubicoyubikey)
37+
- [Yubico.Core](#yubicocore)
38+
- [Internal Assemblies](#internal-assemblies)
39+
- [Yubico.NativeShims](#yubiconativeshims)
40+
- [Project Structure](#project-structure)
41+
- [Contributing](#contributing)
42+
- [Building the Project](#building-the-project)
43+
- [Connect with us](#connect-with-us)
3444

3545
## Quick Start
3646

@@ -44,7 +54,7 @@ dotnet add package Yubico.YubiKey
4454
using Yubico.YubiKey;
4555

4656
// Chooses the first YubiKey found on the computer.
47-
IYubiKeyDevice? SampleChooseYubiKey()
57+
IYubiKeyDevice? GetFirstYubiKey()
4858
{
4959
IEnumerable<IYubiKeyDevice> list = YubiKeyDevice.FindAll();
5060
return list.First();
@@ -83,10 +93,6 @@ Platform abstraction layer (PAL) providing:
8393

8494
### Internal Assemblies
8595

86-
#### Yubico.DotNetPolyfills
87-
> ⚠️ **Not for public use**
88-
> Backports BCL features needed by the SDK.
89-
9096
#### Yubico.NativeShims
9197
> ⚠️ **Not for public use**
9298
> 🔧 **Unmanaged Library**

0 commit comments

Comments
 (0)