OAuth:...Signer(3pm)

πŸ“¦
version 0.11 Β· 2 versions
, in debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

✨ 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, 80 is 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 (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