The manakai project

Web::Transport::Base64

Base64 for the Web

SYNOPSIS

  use Web::Transport::Base64;
  
  $encoded = encode_web_base64 $bytes;
  $bytes = decode_web_base64 $string;

DESCRIPTION

The Web::Transport::Base64 module defines an API to encode or decode byte string using Base64.

FUNCTIONS

These functions are exported by default:

$string = encode_web_base64 $bytes

Encode a byte string using Base64 and return the result string (i.e. Base64-encoded ASCII string). The argument must not be a utf8-flagged string.

This function is an implementation of the "forgiving-base64 encode" operation of the Infra Standard.

$bytes = decode_web_base64 $string

Decode a byte or character string using Base64 and return the result byte string. If the input is not interpretable as a Base64-encoded string, undef is returned instead.

This function is an implementation of the "forgiving-base64 decode" operation of the Infra Standard.

$string = encode_web_base64url $bytes

Encode a byte string using base64url and return the result string (i.e. base64url-encoded ASCII string). The argument must not be a utf8-flagged string.

$bytes = decode_web_base64url $string

Decode a byte or character string using base64url and return the result byte string. If the input is not interpretable as a base64url-encoded string, undef is returned instead.

DEPENDENCY

This module is a wrapper of MIME::Base64, which is a core module of Perl.

SPECIFICATIONS

Infra Standard <https://infra.spec.whatwg.org/#forgiving-base64>.

base64url <https://wiki.suikawiki.org/n/base64url$659#section-Base64-%E3%81%AE%E4%BB%95%E6%A7%98%E6%9B%B8%E3%81%A8%E3%83%90%E3%83%AA%E3%82%A8%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3%E2%80%A8URL-%E5%AE%89%E5%85%A8-Base64%E2%80%A8%E5%87%A6%E7%90%86>.

AUTHOR

Wakaba <wakaba@suikawiki.org>.

LICENSE

Copyright 2018-2019 Wakaba <wakaba@suikawiki.org>.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.