File: jws_empty_payload.t

package info (click to toggle)
libcrypt-jwt-perl 0.037-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 348 kB
  • sloc: perl: 993; makefile: 2
file content (14 lines) | stat: -rw-r--r-- 366 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use strict;
use warnings;
use Test::More;

plan tests => 2;

use Crypt::JWT 'decode_jwt';

my $jws = '{"protected":"eyJhbGciOiJIUzI1NiJ9","payload":"","signature":"sd3ENUazK8vJX_adQ9xDR3N_oXk_pdfV9-OFlen2FmU"}';

my ( $header, $payload ) = decode_jwt( token => $jws, decode_header => 1, key => 'secret' );

is_deeply( $header, {'alg' => 'HS256'} );
is $payload, '';