Import all the source code.
This commit is contained in:
parent
b25abdf8a0
commit
a548fc58f6
9 changed files with 959 additions and 0 deletions
11
examples/simple/dub.json
Normal file
11
examples/simple/dub.json
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"authors": [
|
||||
"Zhang"
|
||||
],
|
||||
"description": "A minimal D application.",
|
||||
"license": "proprietary",
|
||||
"name": "simple",
|
||||
"dependencies": {
|
||||
"hunt-jwt" : {"path": "../../"}
|
||||
}
|
||||
}
|
17
examples/simple/source/app.d
Normal file
17
examples/simple/source/app.d
Normal file
|
@ -0,0 +1,17 @@
|
|||
import std.stdio;
|
||||
|
||||
import jwt;
|
||||
import std.datetime;
|
||||
import std.exception;
|
||||
|
||||
void main()
|
||||
{
|
||||
string tokenString = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjEiLCJuYW1lIjoiYWxpY2UiLCJlbWFpbCI6ImFsaWNlQGdtYWlsLmNvbSIsInBob25lX251bWJlciI6IjE4ODAwMDAwMDAxIiwibmJmIjoxNTA5NDY0MzQwLCJleHAiOjE1MTAwNjkxNDAsImlhdCI6MTUwOTQ2NDM0MH0.nV7duR2gWHA3TB9xPhP1WWhDpXRn1GA_k8_zBBirT6g";
|
||||
|
||||
Token tk = decode(tokenString);
|
||||
|
||||
writeln(tk.header.json());
|
||||
writeln(tk.claims.json());
|
||||
|
||||
tk = verify(tokenString, "secret", []);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue