diff --git a/SendSafelyAPI/src/com/sendsafely/Privatekey.java b/SendSafelyAPI/src/com/sendsafely/Privatekey.java index d92d813..718d19d 100644 --- a/SendSafelyAPI/src/com/sendsafely/Privatekey.java +++ b/SendSafelyAPI/src/com/sendsafely/Privatekey.java @@ -8,12 +8,15 @@ public class Privatekey { public String getArmoredKey() { return privateKey; } + public void setArmoredKey(String privateKey) { this.privateKey = privateKey; } + public String getPublicKeyId() { return publicKeyId; } + public void setPublicKeyId(String publicKeyId) { this.publicKeyId = publicKeyId; } diff --git a/SendSafelyAPI/src/com/sendsafely/SendSafely.java b/SendSafelyAPI/src/com/sendsafely/SendSafely.java index b0a0846..9a2ac6d 100644 --- a/SendSafelyAPI/src/com/sendsafely/SendSafely.java +++ b/SendSafelyAPI/src/com/sendsafely/SendSafely.java @@ -455,12 +455,12 @@ public java.io.File downloadFile(String packageId, String fileId, String keyCode return handler.makeRequest(packageId, null, fileId, keyCode, progress, null); } - /* - * @ description Gets a list of Recipient History information. - * @ param recipientEmail - * @ returnType List - * @ return a List object containing a list of all recipient history items. - * @ throws RecipientFailedException + /** + * @description Retrieves a list of packages where the passed in email address is a package recipient. + * @param recipientEmail The email address of the recipient. + * @returnType List + * @return A List containing information about each package retrieved, including confirmed downloads for the recipient. + * @throws RecipientFailedException */ public List getRecipientHistory(String recipientEmail) throws RecipientFailedException{ GetRecipientHistoryHandler handler = ((GetRecipientHistoryHandler)HandlerFactory.getInstance(uploadManager, Endpoint.RECIPIENT_HISTORY)); @@ -568,8 +568,8 @@ public File encryptAndUploadFile(String packageId, String keyCode, FileManager f } /** - * @description Deletes a package given a package ID. - * @param packageId The unique package id of the package for the delete temporary package operation. + * @description Deletes a temporary package, which is a package that has not yet been finalized. + * @param packageId The unique package id of the package to be deleted. * @throws DeletePackageException */ public void deleteTempPackage(String packageId) throws DeletePackageException @@ -598,8 +598,9 @@ public File encryptAndUploadFile(String packageId, String keyCode, String server } /** - * @description Get all received packages - * @return List a list of all received package IDs. + * @description Retrieves a list of all active packages received for the given API User. + * @return A List containing package metadata for all received packages. + * @returnType List * @throws GetPackagesException */ public List getReceivedPackages() throws GetPackagesException @@ -892,7 +893,7 @@ public EnterpriseInfo getEnterpriseInfo() throws EnterpriseInfoFailedException } /** - * @description Generates a new RSA Key pair used to encrypt keycodes. The private key as well as an identifier associating the public Key is returned to the user. The public key is uploaded and stored on the SendSafely servers. + * @description Generates a new RSA Key pair used to encrypt keycodes. The private key as well as an identifier associating the public Key is returned to the user. The public key is uploaded and stored on the SendSafely servers. * @param description The description used for generating the key pair. * @returnType Privatekey * @return Returns a Private Key containing the armored private key and a Public Key ID associating a public key to the private key. @@ -912,6 +913,14 @@ public Privatekey generateKeyPair(String description) throws NoSuchAlgorithmExce return privateKey; } + /** + * @description Downloads and decrypts a keycode from the server for a given packageId and RSA Key pair. + * @param packageId The package id for the keycode. + * @param privateKey The private key associated with the RSA Key pair used to encrypt the package keycode. + * @return Returns the decrypted keycode. + * @returnType String + * @throws GetKeycodeFailedException + */ public String getKeycode(String packageId, Privatekey privateKey) throws GetKeycodeFailedException{ GetKeycode handler = new GetKeycode(uploadManager); return handler.get(packageId, privateKey); diff --git a/SendSafelyAPI/src/com/sendsafely/dto/RecipientHistory.java b/SendSafelyAPI/src/com/sendsafely/dto/RecipientHistory.java index a5e5c5c..8d43326 100644 --- a/SendSafelyAPI/src/com/sendsafely/dto/RecipientHistory.java +++ b/SendSafelyAPI/src/com/sendsafely/dto/RecipientHistory.java @@ -21,87 +21,115 @@ public class RecipientHistory { private Recipient packageRecipientResponse; private Set filenames; private boolean packageContainsMessage; + public String getPackageId() { return packageId; } + public void setPackageId(String packageId) { this.packageId = packageId; } + public String getPackageUserName() { return packageUserName; } + public void setPackageUserName(String packageUserName) { this.packageUserName = packageUserName; } + public String getPackageUserId() { return packageUserId; } + public void setPackageUserId(String packageUserId) { this.packageUserId = packageUserId; } + public int getPackageState() { return packageState; } + public void setPackageState(int packageState) { this.packageState = packageState; } + public String getPackageStateStr() { return packageStateStr; } + public void setPackageStateStr(String packageStateStr) { this.packageStateStr = packageStateStr; } + public String getPackageStateColor() { return packageStateColor; } + public void setPackageStateColor(String packageStateColor) { this.packageStateColor = packageStateColor; } + public int getPackageLife() { return packageLife; } + public void setPackageLife(int packageLife) { this.packageLife = packageLife; } + public String getPackageUpdateTimestampStr() { return packageUpdateTimestampStr; } + public void setPackageUpdateTimestampStr(String packageUpdateTimestampStr) { this.packageUpdateTimestampStr = packageUpdateTimestampStr; } + public Date getPackageUpdateTimestamp() { return packageUpdateTimestamp; } + public void setPackageUpdateTimestamp(Date packageUpdateTimestamp) { this.packageUpdateTimestamp = packageUpdateTimestamp; } + public String getPackageCode() { return packageCode; } + public void setPackageCode(String packageCode) { this.packageCode = packageCode; } + public String getPackageOS() { return packageOS; } + public void setPackageOS(String packageOS) { this.packageOS = packageOS; } + public Recipient getPackageRecipientResponse() { return packageRecipientResponse; } + public void setPackageRecipientResponse(Recipient packageRecipientResponse) { this.packageRecipientResponse = packageRecipientResponse; } + public Set getFilenames() { return filenames; } + public void setFilenames(Set filenames) { this.filenames = filenames; } + public boolean isPackageContainsMessage() { return packageContainsMessage; } + public void setPackageContainsMessage(boolean packageContainsMessage) { this.packageContainsMessage = packageContainsMessage; } diff --git a/SendSafelyAPI/src/com/sendsafely/handlers/GetOrganizationPackagesHandler.java b/SendSafelyAPI/src/com/sendsafely/handlers/GetOrganizationPackagesHandler.java index ec6e7b2..e1dab46 100644 --- a/SendSafelyAPI/src/com/sendsafely/handlers/GetOrganizationPackagesHandler.java +++ b/SendSafelyAPI/src/com/sendsafely/handlers/GetOrganizationPackagesHandler.java @@ -32,7 +32,7 @@ public GetOrganizationPackagesHandler(UploadManager uploadManager) { public PackageSearchResults makeRequest(Date fromDate, Date toDate, String sender, PackageStatus status, String recipient, String fileName) throws GetPackagesException { //Convert Date to String to pass to server. - SimpleDateFormat outputDateFormat = new SimpleDateFormat("MM/dd/YYYY"); + SimpleDateFormat outputDateFormat = new SimpleDateFormat("MM/dd/yyyy"); String fromDateStr = fromDate==null?"":outputDateFormat.format(fromDate); String toDateStr = toDate==null?"":outputDateFormat.format(toDate); request.setFromDate(fromDateStr); diff --git a/SendSafelyAPI/src/com/sendsafely/handlers/ParseLinksHandler.java b/SendSafelyAPI/src/com/sendsafely/handlers/ParseLinksHandler.java index 9e7ab58..c9de6e9 100644 --- a/SendSafelyAPI/src/com/sendsafely/handlers/ParseLinksHandler.java +++ b/SendSafelyAPI/src/com/sendsafely/handlers/ParseLinksHandler.java @@ -7,7 +7,7 @@ public class ParseLinksHandler { - private final String REGEX = "(https:\\/\\/[a-zA-Z\\.]+\\/receive\\/\\?[A-Za-z0-9&=\\-]+packageCode=[A-Za-z0-9\\-_]+#keyCode=[A-Za-z0-9\\-_]+)"; + private final String REGEX = "(https:\\/\\/[a-zA-Z\\.-]+\\/receive\\/\\?[A-Za-z0-9&=\\-]+packageCode=[A-Za-z0-9\\-_]+#keyCode=[A-Za-z0-9\\-_]+)"; public List parse(String text) { List links = new ArrayList();