diff --git a/.github/dependabot.yml b/.github/dependabot.yml index a372eb1..8f405e5 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -5,8 +5,12 @@ version: 2 updates: - - package-ecosystem: "" # See documentation for possible values - directory: "/" # Location of package manifests + - package-ecosystem: "nuget" + directory: "/" schedule: - interval: "weekly" - + interval: "monthly" + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "monthly" diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..ec1ca49 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,51 @@ +name: publish +on: + workflow_dispatch: # Allow running the workflow manually from the GitHub UI + release: + types: + - published # Run the workflow when a new GitHub release is published + +env: + DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 + DOTNET_NOLOGO: true + NuGetDirectory: ${{ github.workspace }}/nuget + +defaults: + run: + shell: pwsh + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + with: + fetch-depth: 0 # Get all history to allow automatic versioning using MinVer + + - name: Install pnpm + uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d #v3 + with: + version: 9 + + - name: Setup .NET + uses: actions/setup-dotnet@e4c228a8417679d13c6a1e7131e3e8d82dff4cd3 #v4 + with: + dotnet-version: 9.0.x + + - name: Install wasm-tools + run: dotnet workload install wasm-tools + + - name: Restore + run: dotnet restore + + - name: Build + run: dotnet build -c Release --no-restore + + - name: Pack + run: dotnet pack -c Release --no-build --output ${{ env.NuGetDirectory }} + + - name: Push nupkg + run: dotnet nuget push ${{ env.NuGetDirectory }}/*.nupkg --api-key "${{ secrets.NUGET_APIKEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate + + - name: Push snupkg + run: dotnet nuget push ${{ env.NuGetDirectory }}/*.snupkg --api-key "${{ secrets.NUGET_APIKEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate diff --git a/BlazorSodium.Demo/BlazorSodium.Demo.csproj b/BlazorSodium.Demo/BlazorSodium.Demo.csproj index dd2f02b..0e40220 100644 --- a/BlazorSodium.Demo/BlazorSodium.Demo.csproj +++ b/BlazorSodium.Demo/BlazorSodium.Demo.csproj @@ -8,8 +8,9 @@ - - + + + diff --git a/BlazorSodium/BlazorSodium.csproj b/BlazorSodium/BlazorSodium.csproj index 6fe3b1e..0c6194f 100644 --- a/BlazorSodium/BlazorSodium.csproj +++ b/BlazorSodium/BlazorSodium.csproj @@ -1,12 +1,12 @@  - net8.0 + net8.0;net9.0 enable disable true true - True + true BlazorSodium Jack Edwards Simple wrapper over libsodium.js to use in Blazor WASM projects @@ -16,9 +16,16 @@ True True snupkg - 1.3.2 - 1.3.2 12 + true + + + + 1701;1702;NU5105;CS1591;NU5105;NU5105;CS1584 + + + + 1701;1702;NU5105;CS1591;NU5105;NU5105;CS1584 @@ -26,7 +33,12 @@ - + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + @@ -35,9 +47,21 @@ - + + + + + + + + + minor + preview.0 + v + + diff --git a/BlazorSodium/Sodium/GenericHash.Interop.cs b/BlazorSodium/Sodium/GenericHash.Interop.cs index 4496d48..d2aac6d 100644 --- a/BlazorSodium/Sodium/GenericHash.Interop.cs +++ b/BlazorSodium/Sodium/GenericHash.Interop.cs @@ -58,7 +58,7 @@ public static partial class GenericHash /// /// [JSImport("sodium.crypto_generichash_init", "blazorSodium")] - internal static partial int Crypto_GenericHash_Init_Interop(byte[] key, [JSMarshalAs] long hashLength); + internal static partial int Crypto_GenericHash_Init_Interop(byte[]? key, [JSMarshalAs] long hashLength); /// /// Internal method. diff --git a/BlazorSodium/Sodium/PublicKeySignature.Interop.cs b/BlazorSodium/Sodium/PublicKeySignature.Interop.cs index 257141e..c901149 100644 --- a/BlazorSodium/Sodium/PublicKeySignature.Interop.cs +++ b/BlazorSodium/Sodium/PublicKeySignature.Interop.cs @@ -91,7 +91,7 @@ public static partial class PublicKeySignature /// /// /// - /// Switching the return type to 'long' and applying a [return: JSMarshalAs] + /// Switching the return type to 'long' and applying a [return: JSMarshalAs<JSType.Number>] /// attribute does not work any better than simply returning an 'int'. /// /// A 'System.Runtime.InteropServices.JavaScript.JSException' exception is thrown when diff --git a/BlazorSodium/package.json b/BlazorSodium/package.json index 56ba535..335ee72 100644 --- a/BlazorSodium/package.json +++ b/BlazorSodium/package.json @@ -11,13 +11,13 @@ }, "devDependencies": { "path": "^0.12.7", - "vite": "^4.4.9", - "vite-plugin-compression2": "^0.10.3" + "vite": "^6.0.5", + "vite-plugin-compression2": "^1.3.3" }, "dependencies": { "buffer": "^6.0.3", - "crypto-browserify": "^3.12.0", - "libsodium-wrappers-sumo": "^0.7.11", + "crypto-browserify": "^3.12.1", + "libsodium-wrappers-sumo": "^0.7.15", "stream-browserify": "^3.0.0" } } diff --git a/README.md b/README.md index df4b901..4768e39 100644 --- a/README.md +++ b/README.md @@ -39,3 +39,7 @@ Now use the static wrapper methods from anywhere in your application. When a Sodium methods returns `byte[]` data, you often need to use `Array.CopyTo(Array array, int index)` to copy the data to an initialized array if you intend to use the data outside of the current scope. Otherwise the `byte[]` may be garbage collected and your variable will be `null`. + +## Useful developer documentation + +[Supported JSInterop types](https://learn.microsoft.com/en-us/aspnet/core/blazor/javascript-interoperability/import-export-interop) \ No newline at end of file