The Token
The secret used to encode the JWTToken
The algoirthm used to encode the JWTToken
The buffer to store the decoded Header of the JWTToken
The buffer to store the decoded Payload of the JWTToken
0 if everything is ok, everything means the token is not ok
import std.format : format; string secret = "supersecret"; auto alg = JWTAlgorithm.HS256; StringBuffer buf; encodeJWTToken(buf, alg, secret, "sub", 1337); StringBuffer header; StringBuffer payload; int rslt = decodeJWTToken(buf.getData(), secret, alg, header, payload); assert(rslt == 0, format("%d", rslt));
This function decodes a JWTToken.