Skip to content

Commit

Permalink
Add the methods from prev commit to LicenseKey
Browse files Browse the repository at this point in the history
  • Loading branch information
artemlos committed Feb 1, 2019
1 parent a4c5093 commit 4b34267
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 13 deletions.
38 changes: 25 additions & 13 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions src/main/java/io/cryptolens/models/LicenseKey.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.google.gson.Gson;
import io.cryptolens.JavaSecuritySignatureVerifier;
import io.cryptolens.methods.Helpers;

import java.nio.charset.StandardCharsets;
import java.util.Base64;
Expand Down Expand Up @@ -108,4 +109,30 @@ public static LicenseKey LoadFromString(String RSAPubKey, String licenseString,

return license;
}

/**
* Check if the current license has expired.
* @return True if it has expired and false otherwise.
*/
public boolean HasExpired() {
return Helpers.HasExpired(this);
}

/**
* Check if the current license has not expired.
* @return True if it has not expired and false otherwise.
*/
public boolean HasNotExpired() {
return Helpers.HasNotExpired(this);
}

/**
* Check if this license has a certain feature enabled (i.e. set to true).
* @param feature The feature, eg 1 to 8.
* @return If the feature is set to true, true is returned and false otherwise.
*/
public boolean HasFeature(int feature) {
return Helpers.HasFeature(this, feature);
}

}

0 comments on commit 4b34267

Please sign in to comment.