Sha256: 53de62c51ce0cfe09101ed8edd70d71f2ef04277f491d68b42464879f7909689
Contents?: true
Size: 824 Bytes
Versions: 4
Compression:
Stored size: 824 Bytes
Contents
require 'spec_helper' require 'fernet/secret' describe Fernet::Secret do it "can resolve a URL safe base64 encoded 32 byte string" do resolves_input(Base64.urlsafe_encode64("A"*16 + "B"*16)) end it "can resolve a base64 encoded 32 byte string" do resolves_input(Base64.encode64("A"*16 + "B"*16)) end it "can resolve a 32 byte string without encoding" do resolves_input("A"*16 + "B"*16) end it "fails loudly when an invalid secret is provided" do secret = Base64.urlsafe_encode64("bad") expect do Fernet::Secret.new(secret) end.to raise_error(Fernet::Secret::InvalidSecret) end def resolves_input(input) secret = Fernet::Secret.new(input) expect( secret.signing_key ).to eq("A"*16) expect( secret.encryption_key ).to eq("B"*16) end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
fernet-2.1.1 | spec/secret_spec.rb |
fernet-2.1 | spec/secret_spec.rb |
fernet-2.0 | spec/secret_spec.rb |
fernet-2.0.rc2 | spec/secret_spec.rb |