Esempio n. 1
0
def _send_kyc_data_and_receipient_signature(
    command: offchain.PaymentCommand, ) -> offchain.PaymentCommand:
    sig_msg = command.travel_rule_metadata_signature_message(_hrp())
    user_id = get_account_id_from_subaddr(
        command.receiver_subaddress(_hrp()).hex())

    return command.new_command(
        recipient_signature=_compliance_private_key().sign(sig_msg).hex(),
        kyc_data=_user_kyc_data(user_id),
        status=offchain.Status.ready_for_settlement,
    )
Esempio n. 2
0
    def _send_kyc_data_and_receipient_signature(
        self,
        command: offchain.PaymentCommand,
    ) -> offchain.PaymentCommand:
        sig_msg = command.travel_rule_metadata_signature_message(self.hrp)
        subaddress = command.receiver_subaddress(self.hrp)
        user = self._find_user_by_subaddress(subaddress)

        return command.new_command(
            recipient_signature=self.compliance_key.sign(sig_msg).hex(),
            kyc_data=user.kyc_data(),
            status=offchain.Status.ready_for_settlement,
        )
Esempio n. 3
0
    def _ready_for_settlement(
            self, account_id: str,
            cmd: offchain.PaymentCommand) -> offchain.Command:
        if cmd.is_sender():
            return cmd.new_command(status=Status.ready_for_settlement)

        sig_msg = cmd.travel_rule_metadata_signature_message(
            self.app.diem_account.hrp)
        sig = self.app.diem_account.sign_by_compliance_key(sig_msg).hex()
        kyc_data = self.app.store.find(Account,
                                       id=account_id).kyc_data_object()
        return cmd.new_command(recipient_signature=sig,
                               kyc_data=kyc_data,
                               status=Status.ready_for_settlement)