diff options
Diffstat (limited to 'app/models/active_storage/verified_key_with_expiration.rb')
-rw-r--r-- | app/models/active_storage/verified_key_with_expiration.rb | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/app/models/active_storage/verified_key_with_expiration.rb b/app/models/active_storage/verified_key_with_expiration.rb deleted file mode 100644 index 5cb07c6988..0000000000 --- a/app/models/active_storage/verified_key_with_expiration.rb +++ /dev/null @@ -1,22 +0,0 @@ -class ActiveStorage::VerifiedKeyWithExpiration - class << self - def encode(key, expires_in: nil) - ActiveStorage.verifier.generate([ key, expires_at(expires_in) ]) - end - - def decode(encoded_key) - key, expires_at = ActiveStorage.verifier.verified(encoded_key) - - key if key && fresh?(expires_at) - end - - private - def expires_at(expires_in) - expires_in ? Time.now.utc.advance(seconds: expires_in) : nil - end - - def fresh?(expires_at) - expires_at.nil? || Time.now.utc < expires_at - end - end -end |