def issue_certificates(conf, interactive=False):
    # check if issuance address has not been revoked!
    # TODO: REVOKE ADDRESS CMD

    pdf_utils.add_metadata_only_to_pdf_certificates(conf, interactive)

    # get certificate file list here (to ensure it is identical to both
    # 'hash_certificates' and 'insert_proof_to_certificates')
    certificates_directory = os.path.join(conf.working_directory,
                                          conf.certificates_directory)
    cert_files = glob.glob(certificates_directory + os.path.sep +
                           "*.[pP][dD][fF]")

    cert_hashes = pdf_utils.hash_certificates(cert_files)
    cp = prepare_chainpoint_tree(cert_hashes)

    # create OP_RETURN in bytes
    if conf.expiry_date:
        op_return_bstring = cred_protocol.issue_abs_expiry_cmd(
            conf.issuer_identifier, cp.get_merkle_root(), conf.expiry_date)
    else:
        op_return_bstring = cred_protocol.issue_cmd(conf.issuer_identifier,
                                                    cp.get_merkle_root())

    txid = publish_hash.issue_op_return(conf, op_return_bstring, interactive)
    insert_proof_to_certificates(conf, cp, txid, cert_files, interactive)

    return txid
def main():
    if sys.version_info.major < 3:
        sys.stderr.write('Python 3 is required!')
        sys.exit(1)

    conf = load_config()

    # check if issuance address has not been revoked!
    # TODO: REVOKE ADDRESS CMD

    pdf_utils.populate_pdf_certificates(conf)

    # get certificate file list here (to ensure it is identical to both
    # 'hash_certificates' and 'insert_proof_to_certificates'
    certificates_directory = os.path.join(conf.working_directory,
                                          conf.certificates_directory)
    cert_files = glob.glob(certificates_directory + os.path.sep + "*.pdf")

    cert_hashes = pdf_utils.hash_certificates(cert_files)
    cp = prepare_chainpoint_tree(cert_hashes)

    # create OP_RETURN in hex
    op_return_hex = cred_protocol.issue_cmd(conf.issuer_identifier,
                                            cp.get_merkle_root())
    txid = publish_hash.issue_op_return(conf, op_return_hex)
    insert_proof_to_certificates(conf, cp, txid, cert_files)
    print('\nTx hash: {}'.format(txid))
예제 #3
0
def main():
    if sys.version_info.major < 3:
        sys.stderr.write('Python 3 is required!')
        sys.exit(1)

    conf = load_config()
    pdf_utils.populate_pdf_certificates(conf)
    cert_hashes = pdf_utils.hash_certificates(conf)
    pdf_utils.create_certificates_index(conf, cert_hashes)
def main():
    if sys.version_info.major < 3:
        sys.stderr.write('Python 3 is required!')
        sys.exit(1)

    conf = load_config()
    pdf_utils.populate_pdf_certificates(conf, False)

    # get certificate file list
    certificates_directory = os.path.join(conf.working_directory,
                                          conf.certificates_directory)
    cert_files = glob.glob(certificates_directory + os.path.sep + "*.pdf")

    cert_hashes = pdf_utils.hash_certificates(cert_files)
    pdf_utils.create_certificates_index(conf, cert_hashes)
예제 #5
0
def main():
    if sys.version_info.major < 3:
        sys.stderr.write('Python 3 is required!')
        sys.exit(1)

    conf = load_config()
    pdf_utils.add_metadata_only_to_pdf_certificates(conf)

    # get certificate file list here (to ensure it is identical to both
    # 'hash_certificates' and 'insert_proof_to_certificates')
    certificates_directory = os.path.join(conf.working_directory, conf.certificates_directory)
    cert_files = glob.glob(certificates_directory + os.path.sep + "*.[pP][dD][fF]")

    cert_hashes = pdf_utils.hash_certificates(cert_files)
    cp = prepare_chainpoint_tree(cert_hashes)
    txid = publish_hash.issue_hash(conf, True, cp.get_merkle_root())
    insert_proof_to_certificates(conf, cp, txid, cert_files)
    print('\nTx hash: {}'.format(txid))