NAME
Net::Blossom::Server::AuthorizationResult - Verified Blossom authorization data
SYNOPSIS
my $result = $auth->authorize($request);
my $pubkey = $result->pubkey;
$result->require_hash($sha256, status => 409);
DESCRIPTION
Net::Blossom::Server::AuthorizationResult is returned by Net::Blossom::Server::Authorization after a BUD-11 token has been parsed, signature-checked, and matched to the request action.
The object carries the verified event pubkey, the matched action, and any validated x tag hashes. Mirror handling uses those hashes after the server downloads and hashes the remote blob.
CONSTRUCTOR
new
my $result = Net::Blossom::Server::AuthorizationResult->new(%args);
Required arguments are pubkey and action. Optional hashes is an array reference of lowercase 64-character SHA-256 hashes. Unknown arguments or invalid values croak.
ACCESSORS
pubkey
Returns the verified event pubkey.
action
Returns the verified Blossom action.
hashes
Returns a copy array reference of authorized x tag hashes.
METHODS
require_hash
$result->require_hash($sha256);
$result->require_hash($sha256, status => 409, reason => $reason);
Returns true when $sha256 is present in the authorized hash list. Otherwise throws Net::Blossom::Server::Error. The default status is 401 with a WWW-Authenticate: Nostr challenge. Supplying another status, such as the BUD-04 mirror 409, suppresses that challenge.