devise_encryptable_aes 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 84f8fef8ce7fd3ef5539d997cc6c21551a9b9d01cc5acd606ea20d2641ab37d7
4
- data.tar.gz: ed56e0faa102cce47afb928a0359df772fa63e762472096e8b2cdc44267f4823
3
+ metadata.gz: e0d9a32775fffbb8f09338f8c710b7fd4a35016d0bb6a54c62c54601873dc4ef
4
+ data.tar.gz: 7389a7a3d98e9e4a7ed346a6d04743ba887d382765eeb0e682e4e31ff62d0a5e
5
5
  SHA512:
6
- metadata.gz: f1477b1b5ab0dbb1b5616211e18d5c03482ab2a829bdabfc04cddf7f1d53a3f05784ea6cd88172be2b6b1fea66e8dec4faa1546a97cc2d5d0bf193690e1b812a
7
- data.tar.gz: a9f458c109d64d7b5fe9635226a7114d5b1b527f92e80e5cc1ac382e88346eb31def8c424b25943eced58dead2b16e10ca05d6ca0ff50dca0d36b038c1a8e44d
6
+ metadata.gz: 783ca4cae910bae57248e20a5ed5007c59335c1486e5b7a2a9ca4145e450987c21e11990eed015a18c26bfc188a67cd7fd1343a03df5fc42c7d4bbbe68c48f28
7
+ data.tar.gz: f554575575ed449fa7dbffca2c82e0cafc41b9158d3743907961f1e1c41250ddd26b7711fab5f8605c4a30736d3ee69f6fa199db76a4b9286213a570a3aaca7b
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'aes'
4
+ require 'devise/encryptable/encryptors/base'
5
+
6
+ module Devise
7
+ module Encryptable
8
+ module Encryptors
9
+ class Aes256 < Base
10
+ class << self
11
+ def digest(password, _stretches, salt, pepper)
12
+ ::AES.encrypt(password, pepper, { iv: salt }) if password
13
+ rescue StandardError
14
+ nil
15
+ end
16
+
17
+ def salt(_stretches)
18
+ ::AES.iv(:base_64)
19
+ end
20
+
21
+ def decrypt(encrypted_password, pepper)
22
+ ::AES.decrypt(encrypted_password, pepper)
23
+ end
24
+
25
+ def compare(encrypted_password, password, pepper)
26
+ return false if encrypted_password.blank?
27
+
28
+ decrypt(encrypted_password, pepper) == password
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -1,7 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class DeviseEncryptableAes
4
- def self.hi
5
- puts "Hello world!"
6
- end
7
- end
3
+ require 'devise/encryptable/encryptors/aes256'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devise_encryptable_aes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pham Tat Dat
@@ -10,14 +10,15 @@ bindir: bin
10
10
  cert_chain: []
11
11
  date: 2023-05-31 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: A simple hello world gem
13
+ description: ''
14
14
  email: tatdat97dhbkhn@gmail.com
15
15
  executables: []
16
16
  extensions: []
17
17
  extra_rdoc_files: []
18
18
  files:
19
+ - lib/devise/encryptable/encryptors/aes256.rb
19
20
  - lib/devise_encryptable_aes.rb
20
- homepage: https://rubygems.org/gems/devise_encryptable_aes
21
+ homepage: https://github.com/tatdat97dhbkhn/devise_encryptable_aes
21
22
  licenses:
22
23
  - MIT
23
24
  metadata: {}
@@ -39,5 +40,5 @@ requirements: []
39
40
  rubygems_version: 3.4.9
40
41
  signing_key:
41
42
  specification_version: 4
42
- summary: Devise encryptable aes!
43
+ summary: Add AES encryption support for Devise
43
44
  test_files: []