Sha256: 3f4a83635aef4e400e56f7d31698d0f0be50e6e9c006e2bd51b56301b68b622f
Contents?: true
Size: 513 Bytes
Versions: 1
Compression:
Stored size: 513 Bytes
Contents
require 'base64' module Fernet class Secret class InvalidSecret < RuntimeError; end def initialize(secret) @secret = Base64.urlsafe_decode64(secret) unless @secret.bytesize == 32 raise InvalidSecret, "Secret must be 32 bytes, instead got #{@secret.bytesize}" end end def encryption_key @secret.slice(16, 16) end def signing_key @secret.slice(0, 16) end def to_s "<Fernet::Secret [masked]>" end alias to_s inspect end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fernet-2.0.rc1 | lib/fernet/secret.rb |