Module: Parsel
- Defined in:
- lib/parsel.rb,
lib/parsel/json.rb,
lib/parsel/marshal.rb,
lib/parsel/version.rb
Defined Under Namespace
Modules: JSON, Marshal, Version
Constant Summary
collapse
- DEFAULT_IV =
"f89209ffcdd1a225".freeze
- CIPHER =
"AES-256-CBC".freeze
Class Method Summary
collapse
Class Method Details
.decrypt(*args) ⇒ Object
36
37
38
39
40
41
42
|
# File 'lib/parsel.rb', line 36
def self.decrypt(*args)
Parsel.print_deprecation_message
key, iv, data = expand_args(args)
cipher(:decrypt, key, iv, decode(data))
rescue Exception
false
end
|
.default_iv ⇒ Object
25
26
27
|
# File 'lib/parsel.rb', line 25
def self.default_iv
@default_iv
end
|
.default_iv=(iv) ⇒ Object
21
22
23
|
# File 'lib/parsel.rb', line 21
def self.default_iv=(iv)
@default_iv = iv
end
|
.expand_args(args) ⇒ Object
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/parsel.rb', line 44
def self.expand_args(args)
if args.size == 2
iv = default_iv
key, data = args
else
key, iv, data = args
end
[key, iv, data]
end
|
.print_deprecation_message ⇒ Object
13
14
15
16
17
18
19
|
# File 'lib/parsel.rb', line 13
def self.print_deprecation_message
warn <<~TEXT
`parsel` is no longer supported. Use at your own risk.
Called from #{caller[1]}
TEXT
end
|