Skip to content

Commit 732e466

Browse files
committed
Add simple token verification tool.
1 parent 7d0a5ce commit 732e466

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/verify.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#include <iostream>
2+
3+
#include "scitokens.h"
4+
5+
int main(int argc, const char** argv) {
6+
if (argc < 2) {
7+
std::cerr << "Usage: " << argv[0] << " (TOKEN)" << std::endl;
8+
return 1;
9+
}
10+
std::string token(argv[1]);
11+
12+
SciToken scitoken;
13+
char *err_msg = nullptr;
14+
if (scitoken_deserialize(token.c_str(), &scitoken, &err_msg)) {
15+
std::cout << "Failed to deserialize a token: " << err_msg << std::endl;
16+
return 1;
17+
}
18+
std::cout << "Token deserialization successful." << std::endl;
19+
return 0;
20+
}
21+

0 commit comments

Comments
 (0)