class SignedGlobalID
- SignedGlobalID
- Reference
- Object
Overview
Ported from Rails GlobalID SignedGlobalID semantics with Crystal adaptations. Upstream reference: https://github.com/rails/globalid/blob/main/lib/global_id/signed_global_id.rb Rails example SignedGlobalID.verifier.instance_variable_get(:@digest) # => "SHA1" SignedGlobalID.verifier.instance_variable_get(:@secret).bytes.join(",") # => "SHA1"
Defined in:
global_id/signed_global_id.crConstant Summary
-
DEFAULT_PURPOSE =
"default"
Constructors
Class Method Summary
- .create(gid : URI | String, verifier : ActiveSupport::MessageVerifier | Nil = nil, purpose : String = DEFAULT_PURPOSE, expires_at : ExpirationAtOption = ExpirationNotSet.new, expires_in : ExpiresInOption = ExpirationNotSet.new)
- .expires_in : Time::Span | Nil
- .expires_in=(value : Time::Span | Nil)
- .locate(sgid : String, verifier : ActiveSupport::MessageVerifier | Nil = nil, purpose : String = DEFAULT_PURPOSE, & : String, String, String, Hash(String, String) -> T) : T | Nil forall T
- .parse(sgid : String, verifier : ActiveSupport::MessageVerifier | Nil = nil, purpose : String = DEFAULT_PURPOSE) : self | Nil
- .pick_verifier(verifier : ActiveSupport::MessageVerifier | Nil) : ActiveSupport::MessageVerifier
- .verifier : ActiveSupport::MessageVerifier | Nil
- .verifier=(value : ActiveSupport::MessageVerifier | Nil)
Instance Method Summary
-
#==(other)
Returns
false(other can only be aValuehere). - #app : String
- #expires_at : Time | Nil
-
#hash(hasher)
See
Object#hash(hasher) -
#inspect
Keep Rails-style inspect parity and avoid exposing SGID payload internals in debug logs.
- #locate(& : String, String, String, Hash(String, String) -> T) : T forall T
- #model_id : String
- #model_name : String
- #params : Hash(String, String)
- #purpose : String
- #to_param
-
#to_s
Returns a nicely readable and concise string representation of this object, typically intended for users.
- #uri : URI
- #verifier : ActiveSupport::MessageVerifier
Constructor Detail
def self.new(gid : URI | String, verifier : ActiveSupport::MessageVerifier | Nil = nil, purpose : String = DEFAULT_PURPOSE, expires_at : ExpirationAtOption = ExpirationNotSet.new, expires_in : ExpiresInOption = ExpirationNotSet.new)
#
Class Method Detail
def self.create(gid : URI | String, verifier : ActiveSupport::MessageVerifier | Nil = nil, purpose : String = DEFAULT_PURPOSE, expires_at : ExpirationAtOption = ExpirationNotSet.new, expires_in : ExpiresInOption = ExpirationNotSet.new)
#
def self.locate(sgid : String, verifier : ActiveSupport::MessageVerifier | Nil = nil, purpose : String = DEFAULT_PURPOSE, & : String, String, String, Hash(String, String) -> T) : T | Nil forall T
#
def self.parse(sgid : String, verifier : ActiveSupport::MessageVerifier | Nil = nil, purpose : String = DEFAULT_PURPOSE) : self | Nil
#
def self.pick_verifier(verifier : ActiveSupport::MessageVerifier | Nil) : ActiveSupport::MessageVerifier
#
Instance Method Detail
def ==(other)
#
Description copied from class Reference
Returns false (other can only be a Value here).
def inspect
#
Keep Rails-style inspect parity and avoid exposing SGID payload internals in debug logs.