import jwtlited; import std.stdio; NoneHandler handler; char[512] token; enum payload = `{"foo":42}`; immutable len = handler.encode(token[], payload); assert(len > 0); writeln("NONE: ", token[0..len]); assert(handler.validate(token[0..len])); char[32] pay; assert(handler.decode(token[0..len], pay[])); assert(pay[0..payload.length] == payload);
Structure that can be used to handle tokens without signatures. Requires that the token has "alg": "none" in the header and no sign part.