diff options
author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2014-05-06 00:05:11 +0000 |
---|---|---|
committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2014-05-06 00:05:11 +0000 |
commit | 0ba0c6d04d69f50292dd18e913a447ee70d92db7 (patch) | |
tree | 5d9d166079adab7945320f4cb6fa7abfca59cd2a | |
parent | 93f24ea86a1291cf653a8e4621a474a32430bd0e (diff) | |
download | infinitytier-0ba0c6d04d69f50292dd18e913a447ee70d92db7.tar.gz infinitytier-0ba0c6d04d69f50292dd18e913a447ee70d92db7.zip |
New netconf...
-rw-r--r-- | main.cpp | 1 | ||||
-rw-r--r-- | netconf-service/index.js | 14 |
2 files changed, 12 insertions, 3 deletions
@@ -189,6 +189,7 @@ static void printHelp(FILE *out,const char *pn) fprintf(out," getpublic <identity.secret>"ZT_EOL_S); fprintf(out," sign <identity.secret> <file>"ZT_EOL_S); fprintf(out," verify <identity.secret/public> <file> <signature>"ZT_EOL_S); + fprintf(out," mkcom <identity.secret> [<id,value,maxDelta> ...] (hexadecimal integers)"ZT_EOL_S); } static Identity getIdFromArg(char *arg) diff --git a/netconf-service/index.js b/netconf-service/index.js index 7ab2b35e..701e9dfe 100644 --- a/netconf-service/index.js +++ b/netconf-service/index.js @@ -184,19 +184,27 @@ function Identity(idstr) this.fromString = function(str) { thiz.str = ''; thiz.fields = []; - if (!str) + if (typeof str !== 'string') return; + for(var i=0;i<str.length;++i) { + if ("0123456789abcdef:ABCDEF".indexOf(str.charAt(i)) < 0) + return; // invalid character in identity + } var fields = str.split(':'); if ((fields.length < 3)||(fields[0].length !== 10)||(fields[1] !== '0')) return; thiz.fields = fields; - } + }; this.isValid = function() { if ((thiz.fields.length < 3)||(thiz.fields[0].length !== 10)||(thiz.fields[1] !== '0')) return true; return false; - } + }; + + this.hasSecretKey = function() { + return ((thiz.isValid())&&(thiz.fields.length >= 4)); + }; if (typeof idstr === 'string') thiz.fromString(idstr); |