lib/refcode/encoder.rb in refcode-0.1.1 vs lib/refcode/encoder.rb in refcode-0.1.2
- old
+ new
@@ -11,9 +11,13 @@
Base64URL.encode(encrypt(YAML.dump(val)))
end
def decode val
YAML.load(decrypt(Base64URL.decode(val)))
end
+ def secret= secret
+ secret = secret * 2 until secret.size >= 32
+ @secret = secret
+ end
private
def encrypt val
Encryptor.encrypt(:value => val, :key => @secret, :salt => @salt, :iv => iv)