![]() |
VOOZH | about |
dotnet add package NATS.NKeys --version 1.0.2
NuGet\Install-Package NATS.NKeys -Version 1.0.2
<PackageReference Include="NATS.NKeys" Version="1.0.2" />
<PackageVersion Include="NATS.NKeys" Version="1.0.2" />Directory.Packages.props
<PackageReference Include="NATS.NKeys" />Project file
paket add NATS.NKeys --version 1.0.2
#r "nuget: NATS.NKeys, 1.0.2"
#:package NATS.NKeys@1.0.2
#addin nuget:?package=NATS.NKeys&version=1.0.2Install as a Cake Addin
#tool nuget:?package=NATS.NKeys&version=1.0.2Install as a Cake Tool
NKeys is an Ed25519 public-key signature system for NATS authentication and security.
dotnet add package NATS.NKeys
Create a new key pair:
// Create a new key pair for a user
KeyPair keyPair = KeyPair.CreatePair(PrefixByte.User);
// Get the seed
// Output example (your seed will be different):
// Seed: SUAOBFVHF4ZWKTBJ6QP4C362WLBBBFIE7ENFTPYKUGZ3M2ESOXY353LXDI
string seed = keyPair.GetSeed();
Console.WriteLine($"Seed: {seed}");
// Get the public key
// Output example (your public key will be different):
// Public key: UBIWK4X3RXCPJ4CMIAVLAFDFABMLCCMZDDLAO5OZZ2265MDLXUTOGO4B
string publicKey = keyPair.GetPublicKey();
Console.WriteLine($"Public key: {publicKey}");
Sign and verify a message:
// Using already generated seed and public key
var seed = "SOAELH6NJCEK4HST5644G4HK7TOAFZGRRJHNM4EUKUY7PPNDLIKO5IH4JM";
var publicKey = "ODPWIBQJVIQ42462QAFI2RKJC4RZHCQSIVPRDDHWFCJAP52NRZK6Z2YC";
// Create a key pair from seed
KeyPair pair1 = KeyPair.FromSeed(seed);
Assert.Equal(seed, pair1.GetSeed());
Assert.Equal(publicKey, pair1.GetPublicKey());
// Create a key pair from public key
KeyPair pair2 = KeyPair.FromPublicKey(publicKey);
Assert.Equal(publicKey, pair2.GetPublicKey());
// Sign and verify
var message = new ReadOnlyMemory<byte>([42, 43, 44]);
var signature = new Memory<byte>(new byte[64]);
pair1.Sign(message, signature);
Assert.True(pair2.Verify(message, signature));
// Verify fails with corrupt data
var corrupt = new ReadOnlyMemory<byte>([43, 44]);
Assert.False(pair2.Verify(corrupt, signature));
Part of the NATS ecosystem. See also the reference Go implementation.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 3 NuGet packages that depend on NATS.NKeys:
| Package | Downloads |
|---|---|
|
NATS.Client.Core
Core client for NATS, the high-performance cloud-native messaging system. Provides async pub/sub, request-reply, and queue groups for .NET applications. |
|
|
NATS.Jwt
JWT token library for the NATS messaging ecosystem. Create and encode operator, account, and user JWTs signed with NKeys for NATS decentralized authentication and authorization. |
|
|
CosmoBroker
High-performance messaging engine with NATS support, optional native AMQP 0-9-1 support for RabbitMQ-style workloads, and SQL-backed persistence. |
Showing the top 1 popular GitHub repositories that depend on NATS.NKeys:
| Repository | Stars |
|---|---|
|
nats-io/nats.net
Async .NET client for NATS: pub/sub, request/reply, JetStream, KV, Object Store, Services
|
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.2 | 4,820 | 4/10/2026 |
| 1.0.1 | 135,534 | 4/7/2026 |
| 1.0.0 | 3,613 | 3/17/2026 |
| 1.0.0-preview.3 | 81,471 | 4/2/2025 |
| 1.0.0-preview.2 | 5,012 | 2/10/2025 |
| 1.0.0-preview.1 | 20,051 | 5/21/2024 |