daviddesmet / paseto-dotnet

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

Add support for version detection when decoding #4

Open daviddesmet opened 5 years ago

daviddesmet commented 5 years ago

Currently you need to specify the version when decoding.

It will be nice to omit this and have the functionality to auto-detect it. Shouldn't be an issue since it's specified on the header, however, the library is considering the ability to support custom protocols by just implementing the IPasetoProtocol interface. Even though user-defined homemade protocols are discouraged by Paseto but are allowed as long as the reserved official naming convention is not used. Read here for more information.

Anyway, the library could read the header version and try to find a match using the Version property from the registered protocols.