lib/slosilo/key.rb in slosilo-0.4.0 vs lib/slosilo/key.rb in slosilo-0.4.1

- old
+ new

@@ -79,11 +79,11 @@ signature = Base64::urlsafe_decode64(token.delete "signature") (Time.parse(token["timestamp"]) + expiry > Time.now) && verify_signature(token, signature) end def sign_string value - salt = self.salt + salt = shake_salt key.private_encrypt(hash_function.digest(salt + value)) + salt end def fingerprint @fingerprint ||= OpenSSL::Digest::MD5.hexdigest key.public_key.to_der @@ -98,10 +98,11 @@ def hash to_der.hash end private + # Note that this is currently somewhat shallow stringification -- # to implement originating tokens we may need to make it deeper. def stringify value case value when Hash @@ -111,10 +112,10 @@ else value.to_json end end - def salt + def shake_salt Slosilo::Random::salt end def hash_function @hash_function ||= OpenSSL::Digest::SHA256