OAuth:...Signer(3pm)
β¨ OAuth::Lite2::Signer β¨
okay bestie, welcome to OAuth::Lite2::Signer β that's a 3pm manual page from your friendly neighborhood User Contributed Perl Documentation, and yes we are getting into OAuth 2.0 signature territory π
π¨ DEPRECATED ALERT π¨ this whole thing is for the old version of the OAuth 2.0 draft specification. It's giving vintage. It's giving archived. Just so you know before you build your whole personality around it, okay?
π¦ SYNOPSIS π¦
my $signed_params = OAuth::Lite2::Signer->sign(
secret => q{my_token_secret},
algorithm => q{hmac-sha256},
method => q{GET},
url => q{http://example.org/protected/resource},
);
πΈ DESCRIPTION πΈ
DEPRECATED. This is for the old version of the OAuth 2.0 draft specification. Ancient. Historical. A little artifact. πΊ
What does it do, though? Two things, and honestly it ate:
- it lets a client generate a signed request π
- it lets a server verify a request that came in π¬
So it's the whole glow-up pipeline: sign it, send it, check it. Periodt.
π METHODS π
π sign( %params )
Returns a hash reference that includes the parameters for an OAuth 2.0 signed request. So cute, so structured.
my $signed_params = OAuth::Lite2::Signer->sign(
secret => q{my_token_secret},
algorithm => q{hmac-sha256},
method => q{GET},
url => q{http://example.org/protected/resource},
);
Here's the deets on every param, no gatekeeping:
secretβ the access token secret. π€«algorithmβ the algorithm you're making the signature with. That's the vibe of your hash, essentially.methodβ the HTTP method of the request.urlβ the URL of the request.debug_nonceβ optional, bestie. If you omit this, the nonce string gets automatically generated as a random string. π²debug_timestampβ also optional. If you omit this, the current timestamp is set. β°
π§ normalize_string( %params )
Returns a normalized string according to the specification. It's the tidy-up step, the getting-ready step, the part where everything lines up perfectly. β¨
hostβ the host part of the url.portβ if you omit this,80is set by default. πͺnonceβ random string.timestampβ unix timestamp.algorithmβ name of hmac hash algorithm.methodβ HTTP method of the request.urlβ URL of the request.
π₯ verify( %params )
Verifies a signed request. The vibe check, but for signatures. π
unless ( OAuth::Lite2::Signer->verify( %params ) ) {
$app->error("Invalid request");
}
signatureβ the'signature'parameter of the received request.secretβ the access token secret.algorithmβ the'algorithm'parameter of the received request.methodβ the HTTP method of the received request.urlβ the URL of the received request.nonceβ the'nonce'parameter of the received request.timestampβ the'timestamp'parameter of the received request.
π«Ά AUTHOR π«Ά
Lyo Kato, <lyo.kato@gmail.com> β shoutout, icon behavior, we love a credited author π
π COPYRIGHT AND LICENSE π
Copyright (C) 2010 by Lyo Kato
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.
and that's the whole page, bestie π this one was written by perl v5.36.0, dated 2023-07-01 β and ngl, the original title was OAuth:...Signer(3pm) and yeah, we're still in the User Contributed Perl Documentation section. go sign something and slay β¨π
π¦ where this page comes from
- debian trixie: liboauth-lite2-perl 0.11-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: liboauth-lite2-perl 0.11-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: liboauth-lite2-perl 0.11-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: liboauth-lite2-perl 0.11-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms