server-examples/ruby-example.rb
def recover_verified_public_address_from_signature(web3_signature_v,web3_signature_r,web3_signature_s,challenge_hash)
    #Use the data to recover the public key and then the public address
    vrs_data = [web3_signature_v,web3_signature_r,web3_signature_s]

    public_key_raw =  Ethereum::Secp256k1.recover_pubkey(challenge_hash, vrs_data , compressed: false)

    public_key_hex =  Ethereum::Utils.encode_hex( public_key_raw )

    public_key = Ethereum::PublicKey.new(  public_key_hex)
     
    # it is important to note here that because we 'recovered' this public address from the metamask challenge response, 
    #then that proves to us that the client must know the private key that corresponds to this public address.  
    #That is the basis for this entire authentication method and that is why it is called 'verified_public_address' in this instance
    verified_public_address = Ethereum::Utils.encode_hex( public_key.to_address )
    
     if !verified_public_address.start_with?("0x")
      verified_public_address = "0x" + verified_public_address
    end
    
    return verified_public_address
end
#Accepts the signature output from Metamask's personal_sign and returns the verified public address extracted from the signature.  This is the public address of the Ethereum account that signed the challenge.
Accepts the signature output from Metamask's personal_sign and returns the verified public address extracted from the signature.  This is the public address of the Ethereum account that signed the challenge.
Accepts the signature output from Metamask ' s personal_sign and returns the verified public address extracted from the signature . This is the public address of the Ethereum account that signed the challenge .
def recover_verified_public_address_from_signature(web3_signature_v,web3_signature_r,web3_signature_s,challenge_hash)
    vrs_data = [web3_signature_v,web3_signature_r,web3_signature_s]
    public_key_raw =  Ethereum::Secp256k1.recover_pubkey(challenge_hash, vrs_data , compressed: false)
    public_key_hex =  Ethereum::Utils.encode_hex( public_key_raw )
    public_key = Ethereum::PublicKey.new(  public_key_hex)
    verified_public_address = Ethereum::Utils.encode_hex( public_key.to_address )
     if !verified_public_address.start_with?("0x")
      verified_public_address = "0x" + verified_public_address
    end
    return verified_public_address
end
def recover_verified_public_address_from_signature ( web3_signature_v , web3_signature_r , web3_signature_s , challenge_hash ) vrs_data = [ web3_signature_v , web3_signature_r , web3_signature_s ] public_key_raw = Ethereum :: Secp256k1 . recover_pubkey ( challenge_hash , vrs_data , compressed : false ) public_key_hex = Ethereum :: Utils . encode_hex ( public_key_raw ) public_key = Ethereum :: PublicKey . new ( public_key_hex ) verified_public_address = Ethereum :: Utils . encode_hex ( public_key . to_address ) if ! verified_public_address . start_with? ( "0x" ) verified_public_address = "0x" + verified_public_address end return verified_public_address end
Accepts the signature output from Metamask's personal_sign and returns the verified public address extracted from the signature.
Accepts the signature output from Metamask ' s personal_sign and returns the verified public address extracted from the signature .
#Use the data to recover the public key and then the public address # it is important to note here that because we 'recovered' this public address from the metamask challenge response,  #then that proves to us that the client must know the private key that corresponds to this public address.   #That is the basis for this entire authentication method and that is why it is called 'verified_public_address' in this instance
web3_signature_v
web3_signature_r
web3_signature_s
challenge_hash