summaryrefslogtreecommitdiffhomepage
path: root/app/src/main/java/com/wireguard/config
diff options
context:
space:
mode:
authorSamuel Holland <samuel@sholland.org>2017-08-17 03:32:01 -0500
committerSamuel Holland <samuel@sholland.org>2017-08-17 03:32:01 -0500
commitc2189a78b9dafc237afd3de5f9fc66bc1567eb15 (patch)
tree765b8b1e5b5c653786f9a7e16b1888a48bbfb930 /app/src/main/java/com/wireguard/config
parentcb48a7be3a0b30c50aed7bf5f7552aec33ce7ab2 (diff)
ConfigEditFragment: Add extremely basic validation
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'app/src/main/java/com/wireguard/config')
-rw-r--r--app/src/main/java/com/wireguard/config/Config.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/src/main/java/com/wireguard/config/Config.java b/app/src/main/java/com/wireguard/config/Config.java
index 9f1dbf4c..3f98cbcb 100644
--- a/app/src/main/java/com/wireguard/config/Config.java
+++ b/app/src/main/java/com/wireguard/config/Config.java
@@ -127,4 +127,12 @@ public class Config extends BaseObservable
sb.append('\n').append(peer);
return sb.toString();
}
+
+ public String validate() {
+ if (name == null || !isNameValid(name))
+ return "This configuration does not have a valid name.";
+ if (iface.getPublicKey() == null)
+ return "This configuration does not have a valid keypair.";
+ return null;
+ }
}