CSJCurrent en:Revoke a Transfer

Aus Cryptshare Documentation
Version vom 9. März 2022, 07:41 Uhr von Maintenance script (Diskussion | Beiträge) (Edited by replacement maintenance script.)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Wechseln zu:Navigation, Suche



The transfer may be revoked if e.g. access to previously provided and outdated information needs to be prohibited for all recipients.

Usage

It is possible for the sender to revoke their transfer and notify the recipients about the revocation by calling `Client.revokeTransfer` and passing the transfer's tracking ID. The sender also receives a notification email as a confirmation:

client.revokeTransfer("my-tracking-id");

By default, the Cryptshare Server sends a notification email containing a default message to all transfer recipients. It is possible to provide a custom message for the recipients of the transfer:

final String message = "The information in this document are no longer valid and a transfer containing updated information has been provided. Please disregard this transfer.";
client.revokeTransfer("my-tracking-id", message);

If you want to control whether the sender and/or recipients should receive a notification email, you can provide additional parameters:

// Send a notification email to the recipients, but not the sender.
client.revokeTransfer("my-tracking-id", true, false);
// Same as above, but also provide a custom message.
final String message = "A new transfer containing updated documents is on its way, please ignore this transfer.";
client.revokeTransfer("my-tracking-id", true, false, message);

Error Handling

Attempting to revoke a transfer might result in an exception which should be handled. For instance, attempting to revoke a non-existent transfer or a transfer for which the client is not the sender results in a `CryptshareServerException`:

try {
	client.revokeTransfer("transfer-is-not-mine-or-does-not-exist");
} catch (CryptshareServerException e) {
	System.err.println("Failed to revoke the transfer: ");
	e.printStackTrace();
}

If you cannot guarantee that the target Cryptshare Server supports the "Revoke Transfer" feature (see Compatibility), you may want to wrap the call in a try-catch since the API will throw an exception if the Cryptshare Server does not support the operation.

try {
	client.revokeTransfer("my-tracking-id");
} catch (CryptshareServerException e) {
	if (e.getCode() == 0) {
		System.err.println("The Cryptshare Server does not support revoking a transfer: ");
		e.printStackTrace();
	}
}