File: test_jwt_header.cc

package info (click to toggle)
cpp-jwt 1.5%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 508 kB
  • sloc: cpp: 3,374; ansic: 33; sh: 31; makefile: 12
file content (19 lines) | stat: -rw-r--r-- 436 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <iostream>
#include "jwt/jwt.hpp"

void test_basic_header()
{
  jwt::jwt_header hdr;
  hdr = jwt::jwt_header{jwt::algorithm::HS256};
  std::string jstr = to_json_str(hdr);
  std::cout << jstr << std::endl;

  std::string enc_str = hdr.base64_encode();
  std::cout << "Base64: " << enc_str << std::endl;
  std::cout << "Decoded: " << hdr.base64_decode(enc_str) << std::endl;
}

int main() {
  test_basic_header();
  return 0;
}