daviddesmet / paseto-dotnet

🔑 Paseto.NET, a Paseto (Platform-Agnostic Security Tokens) implementation for .NET
MIT License
101 stars 8 forks source link

Unable to decode token #23

Closed M4urici0GM closed 4 years ago

M4urici0GM commented 4 years ago

As i saw in the tests, i'm building the token like this:

byte[] seed = new byte[32];
var sk = Ed25519.ExpandedPrivateKeyFromSeed(seed);
var token = new PasetoBuilder<Version2>()
                .WithKey(sk)
                .AddClaim("example", "Hello Paseto!")
                .Expiration(DateTime.UtcNow.AddHours(24))
                .AsPublic() // Purpose
                .Build();

Everything normal here, works fine. But when trying to decode the token: As i saw in the tests, you're using a PublicKeyV2 var with a base64 encoded value but, where do i get the public key? already tried using the same method as above, using the Ed25519.PublicKeyFromSeed(seed) rather than ExpandedPrivateKeyFromSeed(seed) but with no results, throwing the error "Invalid Signature" What's the proper way to decode the token? Thanks