-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: remove Newtonsoft.Json dependency, closes #64
- Loading branch information
1 parent
ec1b477
commit fac4979
Showing
7 changed files
with
102 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,72 +1,71 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup Label="Build"> | ||
<TargetFrameworks>net6.0;net8.0</TargetFrameworks> | ||
<LangVersion>latest</LangVersion> | ||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup Label="Package"> | ||
<Authors>David De Smet</Authors> | ||
<Company /> | ||
<Description>A Paseto (Platform-Agnostic Security Tokens) implementation for .NET</Description> | ||
<Copyright>Copyright © 2018-2024 David De Smet</Copyright> | ||
<PackageId>Paseto.Core</PackageId> | ||
<PackageTags>paseto paserk tokens cryptography dotnet dotnet-core netstandard</PackageTags> | ||
<PackageLicenseExpression>MIT</PackageLicenseExpression> | ||
<PackageProjectUrl>https://github.com/daviddesmet/paseto-dotnet</PackageProjectUrl> | ||
<PackageReadmeFile>README.md</PackageReadmeFile> | ||
<PackageReleaseNotes>https://github.com/daviddesmet/paseto-dotnet/releases</PackageReleaseNotes> | ||
<RepositoryUrl>https://github.com/daviddesmet/paseto-dotnet.git</RepositoryUrl> | ||
<RepositoryType>git</RepositoryType> | ||
<RepositoryBranch>master</RepositoryBranch> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup Label="Signing"> | ||
<SignAssembly>true</SignAssembly> | ||
<AssemblyOriginatorKeyFile>../../Key.snk</AssemblyOriginatorKeyFile> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup Label="Source Link"> | ||
<!-- Optional: Declare that the Repository URL can be published to NuSpec --> | ||
<PublishRepositoryUrl>true</PublishRepositoryUrl> | ||
<!-- Optional: Embed source files that are not tracked by the source control manager to the PDB --> | ||
<EmbedUntrackedSources>true</EmbedUntrackedSources> | ||
<!-- Optional: Include PDB in the built .nupkg --> | ||
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder> | ||
<!-- Deterministic --> | ||
<ContinuousIntegrationBuild Condition="'$(GITHUB_ACTIONS)' == 'true'">true</ContinuousIntegrationBuild> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<None Include="../../README.md" Pack="true" Visible="false" PackagePath="" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup Label="Package References"> | ||
<PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="All" Version="8.0.0" /> | ||
<PackageReference Include="MinVer" Version="5.0.0"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
<PackageReference Include="NaCl.Core" Version="2.0.5" /> | ||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> | ||
<PackageReference Include="Portable.BouncyCastle" Version="1.9.0" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup Label="Package References for Windows" Condition=" '$(TargetFramework)' == 'net48' "> | ||
<Reference Include="System" /> | ||
<Reference Include="Microsoft.CSharp" /> | ||
</ItemGroup> | ||
|
||
<Target Name="Versioning" BeforeTargets="MinVer"> | ||
<PropertyGroup Label="Build"> | ||
<AssemblyVersion>$(MinVerMajor).$(MinVerMinor).$(MinVerPatch).0</AssemblyVersion> | ||
<MinVerVerbosity>normal</MinVerVerbosity> | ||
</PropertyGroup> | ||
</Target> | ||
|
||
<Target Name="LogDebugInfo"> | ||
<Message Text="Building for $(TargetFramework) on $(OS)" Importance="High" /> | ||
</Target> | ||
|
||
</Project> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup Label="Build"> | ||
<TargetFrameworks>net6.0;net8.0</TargetFrameworks> | ||
<LangVersion>latest</LangVersion> | ||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup Label="Package"> | ||
<Authors>David De Smet</Authors> | ||
<Company /> | ||
<Description>A Paseto (Platform-Agnostic Security Tokens) implementation for .NET</Description> | ||
<Copyright>Copyright © 2018-2024 David De Smet</Copyright> | ||
<PackageId>Paseto.Core</PackageId> | ||
<PackageTags>paseto paserk tokens cryptography dotnet dotnet-core netstandard</PackageTags> | ||
<PackageLicenseExpression>MIT</PackageLicenseExpression> | ||
<PackageProjectUrl>https://github.com/daviddesmet/paseto-dotnet</PackageProjectUrl> | ||
<PackageReadmeFile>README.md</PackageReadmeFile> | ||
<PackageReleaseNotes>https://github.com/daviddesmet/paseto-dotnet/releases</PackageReleaseNotes> | ||
<RepositoryUrl>https://github.com/daviddesmet/paseto-dotnet.git</RepositoryUrl> | ||
<RepositoryType>git</RepositoryType> | ||
<RepositoryBranch>master</RepositoryBranch> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup Label="Signing"> | ||
<SignAssembly>true</SignAssembly> | ||
<AssemblyOriginatorKeyFile>../../Key.snk</AssemblyOriginatorKeyFile> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup Label="Source Link"> | ||
<!-- Optional: Declare that the Repository URL can be published to NuSpec --> | ||
<PublishRepositoryUrl>true</PublishRepositoryUrl> | ||
<!-- Optional: Embed source files that are not tracked by the source control manager to the PDB --> | ||
<EmbedUntrackedSources>true</EmbedUntrackedSources> | ||
<!-- Optional: Include PDB in the built .nupkg --> | ||
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder> | ||
<!-- Deterministic --> | ||
<ContinuousIntegrationBuild Condition="'$(GITHUB_ACTIONS)' == 'true'">true</ContinuousIntegrationBuild> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<None Include="../../README.md" Pack="true" Visible="false" PackagePath="" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup Label="Package References"> | ||
<PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="All" Version="8.0.0" /> | ||
<PackageReference Include="MinVer" Version="5.0.0"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
<PackageReference Include="NaCl.Core" Version="2.0.5" /> | ||
<PackageReference Include="Portable.BouncyCastle" Version="1.9.0" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup Label="Package References for Windows" Condition=" '$(TargetFramework)' == 'net48' "> | ||
<Reference Include="System" /> | ||
<Reference Include="Microsoft.CSharp" /> | ||
</ItemGroup> | ||
|
||
<Target Name="Versioning" BeforeTargets="MinVer"> | ||
<PropertyGroup Label="Build"> | ||
<AssemblyVersion>$(MinVerMajor).$(MinVerMinor).$(MinVerPatch).0</AssemblyVersion> | ||
<MinVerVerbosity>normal</MinVerVerbosity> | ||
</PropertyGroup> | ||
</Target> | ||
|
||
<Target Name="LogDebugInfo"> | ||
<Message Text="Building for $(TargetFramework) on $(OS)" Importance="High" /> | ||
</Target> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,15 @@ | ||
namespace Paseto.Serializers; | ||
|
||
using System; | ||
using System.Linq; | ||
using Newtonsoft.Json; | ||
using Newtonsoft.Json.Linq; | ||
using System.Text.Json; | ||
|
||
/// <summary> | ||
/// JSON serializer using Newtonsoft.Json implementation. | ||
/// JSON serializer using System.Text.Json implementation. | ||
/// </summary> | ||
public sealed class JsonNetSerializer : IJsonSerializer | ||
{ | ||
private readonly JsonSerializer _serializer; | ||
|
||
/// <summary> | ||
/// Creates a new instance of <see cref="JsonNetSerializer" />. | ||
/// </summary> | ||
/// <remarks>Uses <see cref="JsonSerializer.CreateDefault()" /> as internal serializer.</remarks> | ||
public JsonNetSerializer() : this(JsonSerializer.CreateDefault()) { } | ||
|
||
/// <summary> | ||
/// Creates a new instance of <see cref="JsonNetSerializer" />. | ||
/// </summary> | ||
/// <param name="serializer">Internal <see cref="JsonSerializer" /> to use for serialization.</param> | ||
public JsonNetSerializer(JsonSerializer serializer) => _serializer = serializer ?? throw new ArgumentNullException(nameof(serializer)); | ||
|
||
/// <inheritdoc /> | ||
public string Serialize(object obj) => JObject.FromObject(obj, _serializer).ToString(_serializer.Formatting, _serializer.Converters.ToArray()); | ||
public string Serialize(object obj, JsonSerializerOptions options = null) => JsonSerializer.Serialize(obj, options); | ||
|
||
/// <inheritdoc /> | ||
public T Deserialize<T>(string json) => JObject.Parse(json).ToObject<T>(_serializer); | ||
public T Deserialize<T>(string json, JsonSerializerOptions options = null) => JsonSerializer.Deserialize<T>(json, options); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters