Skip to content

awncorp/zing-encoder-jwt

Repository files navigation

NAME

Zing::Encoder::Jwt - JWT Serialization Abstraction

ABSTRACT

JWT Data Serialization Abstraction

SYNOPSIS

use Zing::Encoder::Jwt;

my $encoder = Zing::Encoder::Jwt->new(
  secret => '...',
);

# $encoder->encode({ status => 'okay' });

DESCRIPTION

This package provides a Crypt::JWT data serialization abstraction for use with Zing::Store stores. The JWT encoding algorithm can be set using the ZING_JWT_ALGO environment variable or the algo attribute, and defaults to HS256. The JWT secret can be set using the ZING_JWT_SECRET environment variable or the secret attribute.

LIBRARIES

This package uses type constraints from:

Zing::Types

METHODS

This package implements the following methods:

decode

decode(Str $data) : HashRef

The decode method decodes the data provided.

  • decode example #1

      # given: synopsis
    
      $encoder->decode('eyJhbGciOiJIUzI1NiJ9.eyJzdGF0dXMiOiJva2F5In0.tXdQmMPi25VOJZaOySFS-hM2ofIxbyFBVTA7I-GI_lU');
    

encode

encode(HashRef $data) : Str

The encode method encodes the data provided.

  • encode example #1

      # given: synopsis
    
      $encoder->encode({ status => 'okay' });
    

AUTHOR

Al Newkirk, awncorp@cpan.org

LICENSE

Copyright (C) 2011-2019, Al Newkirk, et al.

This is free software; you can redistribute it and/or modify it under the terms of the The Apache License, Version 2.0, as elucidated in the "license file".

PROJECT

Wiki

Project

Initiatives

Milestones

Contributing

Issues