Rand Stats

HTTP::Signature

github:pierre-vigier

Perl6-HTTP-Signature

Build Status

SYNOPSIS

ALPHA Implementation of http signature as defined in IETFF draft version 3

Heavily inspired from Authen::HTTP::Signature on perl5

To sign a request:

use HTTP::Signature;
use HTTP::UserAgent;
use HTTP::Request;

my $req = HTTP::Request.new(
    :GET('http://www.example.com/path')
);

my $signer = HTTP::Signature.new(
    keyid       => 'Test',
    secret      => 'MySuperSecretKey',
    algorithm   => 'hmac-sha256',
);
my $signed-request = $signer->sign-request( $req );
my $ua = HTTP::UserAgent.new;
my $response = $ua.request( $signed-request );

To verify a request:

use HTTP::Signature;

my $signer = HTTP::Signature.new(
    secret      => 'MySuperSecretKey',
);
if $signer.verify-request( $req ) {
    ...
}

DESCRIPTION