class Crypt::Signer
- Crypt::Signer
- Reference
- Object
Overview
Sign and verify given data.
Defined in:
signer.crConstant Summary
-
INVALID_SIGN =
"Not valid"
-
SIGN_SEP =
"__--"
Constructors
-
.new(secret : String, digest : Symbol = :sha1)
Create a
Signer
instance.
Class Method Summary
Instance Method Summary
-
#sign(value : String | Bytes) : String
Generates signed data.
-
#valid?(data, digest) : Bool
Compare data and digest.
-
#verify(signed_data, error_message = INVALID_SIGN) : String
Verify and decode.
-
#verify_and_decode(signed_data : String) : String | Nil
Verify and decode.
-
#verify_raw(signed_data : String, error_message = INVALID_SIGN) : Bytes
Verify and decode.
-
#verify_raw(signed_data : Bytes, error_message = INVALID_SIGN) : Bytes
Verify and decode.
Constructor Detail
Class Method Detail
Instance Method Detail
Generates signed data. Returns an URL and filename safe alphabet (RFC 4648).
Verify and decode. error_message allows to customize the error message when the signature is not valid.
Verify and decode.
It is recommended to use
#verify
which has a more precise return (returnsString
or raises aSignatureError
).
Verify and decode. error_message allows to customize the error message when the signature is not valid.
This method can produce a different error message than error_message.
Verify and decode. error_message allows to customize the error message when the signature is not valid.
This method can produce a different error message than error_message.