sdk.js
function createAddressRegistrationStatement(address, keys, options) {
  options = options || {};

  /* Create an extended JSON Web Signatures object */
  let jws = {
    hash: {
      type: (hashes.indexOf(options.hash) > -1) ? options.hash : 'sha256',
      value: ''
    },
    payload: {
      address: address,
      keys: [
        keys.public
      ],
      threshold: 1
    },
    signatures: [
      {
        header: {
          alg: keys.scheme,
          kid: '0'
        },
        signature: ''
      }
    ]
  };

  /* Generate a cryptogrphic hash of the payload */
  jws.hash.value = crypto.createHash(jws.hash.type)
    .update(JSON.stringify(jws.payload)).digest('hex');

  /* Sign the hash of the payload */
  jws.signatures[0].signature = schemes[keys.scheme]
    .sign(jws.hash.value, keys.private, 'hex').toDER('hex');

  return jws;
}
function createAddressRegistrationStatement(address, keys, options) {
  options = options || {};

  /* Create an extended JSON Web Signatures object */
  let jws = {
    hash: {
      type: (hashes.indexOf(options.hash) > -1) ? options.hash : 'sha256',
      value: ''
    },
    payload: {
      address: address,
      keys: [
        keys.public
      ],
      threshold: 1
    },
    signatures: [
      {
        header: {
          alg: keys.scheme,
          kid: '0'
        },
        signature: ''
      }
    ]
  };

  /* Generate a cryptogrphic hash of the payload */
  jws.hash.value = crypto.createHash(jws.hash.type)
    .update(JSON.stringify(jws.payload)).digest('hex');

  /* Sign the hash of the payload */
  jws.signatures[0].signature = schemes[keys.scheme]
    .sign(jws.hash.value, keys.private, 'hex').toDER('hex');

  return jws;
}
function createAddressRegistrationStatement ( address , keys , options ) { options = options || { } ; /* Create an extended JSON Web Signatures object */ let jws = { hash : { type : ( hashes . indexOf ( options . hash ) > - 1 ) ? options . hash : 'sha256' , value : '' } , payload : { address : address , keys : [ keys . public ] , threshold : 1 } , signatures : [ { header : { alg : keys . scheme , kid : '0' } , signature : '' } ] } ; /* Generate a cryptogrphic hash of the payload */ jws . hash . value = crypto . createHash ( jws . hash . type ) . update ( JSON . stringify ( jws . payload ) ) . digest ( 'hex' ) ; /* Sign the hash of the payload */ jws . signatures [ 0 ] . signature = schemes [ keys . scheme ] . sign ( jws . hash . value , keys . private , 'hex' ) . toDER ( 'hex' ) ; return jws ; }
Creates and signs a statement to be sent for registering an address
@param {string} address - A wallet address
@param {Object} keys - An object containing a cryptograhic key pair
@param {Object} options - Parameters such as hash type
@return {Object} - A cryptographically signed statement
Creates and signs a statement to be sent for registering an address