Exception: Nostr::InvalidHRPError

Inherits:
KeyValidationError show all
Defined in:
lib/nostr/errors/invalid_hrp_error.rb

Overview

Raised when the human readable part of a Bech32 string is invalid

Instance Method Summary collapse

Constructor Details

#initialize(given_hrp, allowed_hrp) ⇒ InvalidHRPError

Initializes the error

Examples:

InvalidHRPError.new('example wrong hrp', 'nsec')

Parameters:

  • given_hrp (String)

    The given human readable part of the Bech32 string

  • allowed_hrp (String)

    The allowed human readable part of the Bech32 string



17
18
19
# File 'lib/nostr/errors/invalid_hrp_error.rb', line 17

def initialize(given_hrp, allowed_hrp)
  super("Invalid hrp: #{given_hrp}. The allowed hrp value for this kind of entity is '#{allowed_hrp}'.")
end