Class: Zilliqa::Util::Validator
- Inherits:
-
Object
- Object
- Zilliqa::Util::Validator
- Defined in:
- lib/zilliqa/util/validator.rb
Class Method Summary collapse
- .address?(address) ⇒ Boolean
- .bech32?(address) ⇒ Boolean
- .private_key?(private_key) ⇒ Boolean
- .public_key?(public_key) ⇒ Boolean
- .signature?(signature) ⇒ Boolean
Class Method Details
.address?(address) ⇒ Boolean
14 15 16 17 18 |
# File 'lib/zilliqa/util/validator.rb', line 14 def self.address?(address) return true if bech32?(address) m = /(0x)?\h{40}/ =~ address m != nil end |
.bech32?(address) ⇒ Boolean
25 26 27 28 |
# File 'lib/zilliqa/util/validator.rb', line 25 def self.bech32?(address) m = /^zil1[qpzry9x8gf2tvdw0s3jn54khce6mua7l]{38}/ =~ address m != nil end |
.private_key?(private_key) ⇒ Boolean
9 10 11 12 |
# File 'lib/zilliqa/util/validator.rb', line 9 def self.private_key?(private_key) m = /(0x)?\h{64}/ =~ private_key m != nil end |
.public_key?(public_key) ⇒ Boolean
4 5 6 7 |
# File 'lib/zilliqa/util/validator.rb', line 4 def self.public_key?(public_key) m = /(0x)?\h{66}/ =~ public_key m != nil end |
.signature?(signature) ⇒ Boolean
20 21 22 23 |
# File 'lib/zilliqa/util/validator.rb', line 20 def self.signature?(signature) m = /(0x)?\h{128}/ =~ signature m != nil end |