Class: Webhookdb::Crypto::Boxed
- Inherits:
-
Object
- Object
- Webhookdb::Crypto::Boxed
- Defined in:
- lib/webhookdb/crypto.rb
Class Method Summary collapse
Instance Method Summary collapse
- #base64 ⇒ String
-
#initialize(raw, b64) ⇒ Boxed
constructor
A new instance of Boxed.
- #raw ⇒ String
Constructor Details
#initialize(raw, b64) ⇒ Boxed
Returns a new instance of Boxed.
49 50 51 52 |
# File 'lib/webhookdb/crypto.rb', line 49 def initialize(raw, b64) @raw = raw @b64 = b64 end |
Class Method Details
.from_b64(b64str) ⇒ Object
44 45 46 47 |
# File 'lib/webhookdb/crypto.rb', line 44 def self.from_b64(b64str) raise ArgumentError, "base64 string cannot be nil" if b64str.nil? return self.new(nil, b64str) end |
.from_raw(bytestr) ⇒ Object
39 40 41 42 |
# File 'lib/webhookdb/crypto.rb', line 39 def self.from_raw(bytestr) raise ArgumentError, "bytes string cannot be nil" if bytestr.nil? return self.new(bytestr, nil) end |
Instance Method Details
#base64 ⇒ String
55 56 57 58 |
# File 'lib/webhookdb/crypto.rb', line 55 def base64 @b64 ||= Base64.urlsafe_encode64(@raw) return @b64 end |
#raw ⇒ String
61 62 63 64 |
# File 'lib/webhookdb/crypto.rb', line 61 def raw @raw ||= Base64.urlsafe_decode64(@b64) return @raw end |