lib/reth/keystore.rb
##
# Check if json has the structure of a keystore file version 3.
#
# Note that this test is not complete, e.g. it doesn't check key
# derivation or cipher parameters.
#
# @param json [Hash] data load from json file
# @return [Bool] `true` if the data appears to be valid, otherwise
#   `false`
#
Check if json has the structure of a keystore file version 3.
Note that this test is not complete, e.g. it doesn't check key
derivation or cipher parameters.
Check if json has the structure of a keystore file version 3 . Note that this test is not complete e . g . it doesn ' t check key derivation or cipher parameters .
def validate(json)
        return false unless json.has_key?('crypto') || json.has_key?('Crypto')
        return false unless json['version'] == 3
        crypto = json['crypto'] || json['Crypto']
        return false unless crypto.has_key?('cipher')
        return false unless crypto.has_key?('ciphertext')
        return false unless crypto.has_key?('kdf')
        return false unless crypto.has_key?('mac')
        true
      end
def validate ( json ) return false unless json . has_key? ( 'crypto' ) || json . has_key? ( 'Crypto' ) return false unless json [ 'version' ] == 3 crypto = json [ 'crypto' ] || json [ 'Crypto' ] return false unless crypto . has_key? ( 'cipher' ) return false unless crypto . has_key? ( 'ciphertext' ) return false unless crypto . has_key? ( 'kdf' ) return false unless crypto . has_key? ( 'mac' ) true end
Check if json has the structure of a keystore file version 3.
Check if json has the structure of a keystore file version 3 .
`true` if the data appears to be valid, otherwise `false`
` true ` if the data appears to be valid otherwise ` false `
Bool
json
data load from json file
data load from json file