mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-05-31 22:40:48 +00:00
New netconf...
This commit is contained in:
parent
93f24ea86a
commit
0ba0c6d04d
1
main.cpp
1
main.cpp
@ -189,6 +189,7 @@ static void printHelp(FILE *out,const char *pn)
|
|||||||
fprintf(out," getpublic <identity.secret>"ZT_EOL_S);
|
fprintf(out," getpublic <identity.secret>"ZT_EOL_S);
|
||||||
fprintf(out," sign <identity.secret> <file>"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," 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)
|
static Identity getIdFromArg(char *arg)
|
||||||
|
@ -184,19 +184,27 @@ function Identity(idstr)
|
|||||||
this.fromString = function(str) {
|
this.fromString = function(str) {
|
||||||
thiz.str = '';
|
thiz.str = '';
|
||||||
thiz.fields = [];
|
thiz.fields = [];
|
||||||
if (!str)
|
if (typeof str !== 'string')
|
||||||
return;
|
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(':');
|
var fields = str.split(':');
|
||||||
if ((fields.length < 3)||(fields[0].length !== 10)||(fields[1] !== '0'))
|
if ((fields.length < 3)||(fields[0].length !== 10)||(fields[1] !== '0'))
|
||||||
return;
|
return;
|
||||||
thiz.fields = fields;
|
thiz.fields = fields;
|
||||||
}
|
};
|
||||||
|
|
||||||
this.isValid = function() {
|
this.isValid = function() {
|
||||||
if ((thiz.fields.length < 3)||(thiz.fields[0].length !== 10)||(thiz.fields[1] !== '0'))
|
if ((thiz.fields.length < 3)||(thiz.fields[0].length !== 10)||(thiz.fields[1] !== '0'))
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
};
|
||||||
|
|
||||||
|
this.hasSecretKey = function() {
|
||||||
|
return ((thiz.isValid())&&(thiz.fields.length >= 4));
|
||||||
|
};
|
||||||
|
|
||||||
if (typeof idstr === 'string')
|
if (typeof idstr === 'string')
|
||||||
thiz.fromString(idstr);
|
thiz.fromString(idstr);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user