Method: Casper::Entity::DeployService#sign_deploy

Defined in:
lib/entity/deploy.rb

#sign_deploy(deploy, key_pair) ⇒ Deploy

Returns the Deploy object.

Parameters:

  • deploy (Deploy)

    to sign

  • key_pair (Key)

    to sign deploy with

Returns:

  • (Deploy)

    the Deploy object



164
165
166
167
168
169
170
171
172
173
174
175
# File 'lib/entity/deploy.rb', line 164

def sign_deploy(deploy, key_pair)
  public_key = deploy.get_header[:account]
  signature = key_pair.sign(deploy.get_hash)
  # puts "Signer = #{signature}"
  signer = public_key
  approval = {
    "signer": signer,
    "signature": signature
  }
  deploy.add_approval(approval)
  deploy.to_hash
end