NoneHandler

Structure that can be used to handle tokens without signatures. Requires that the token has "alg": "none" in the header and no sign part.

Members

Functions

isValid
bool isValid(V value, S sign)
Undocumented in source. Be warned that the author may not have intended to support it.
isValidAlg
bool isValidAlg(JWTAlgorithm alg)
Undocumented in source. Be warned that the author may not have intended to support it.
sign
int sign(S sink, V value)
Undocumented in source. Be warned that the author may not have intended to support it.
signAlg
JWTAlgorithm signAlg()
Undocumented in source. Be warned that the author may not have intended to support it.

Examples

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);

Meta