Implement reference key server#71
Conversation
vqhuy
commented
Aug 15, 2016
- Implement registration function
There was a problem hiding this comment.
I think we could do ./main -genconfig -genkey=sign,vrf. Does it make sense?
There was a problem hiding this comment.
No, fallthrough just falls through, it doesn't check the second condition.
There was a problem hiding this comment.
I just tried with coniksserver -genconfig and it generated the config file only. So I think it worked as expected?
There was a problem hiding this comment.
Only because genkey doesn't have a default value, right. The code still gets executed but on the empty string, so nothing happens.
I guess it's ok with the fallthrough then, but maybe leave a comment saying that we're relying on that. Or not.
There was a problem hiding this comment.
boolStringFlag is no longer used.
There was a problem hiding this comment.
If you want to keep it, go back and look at,
keyTypes = strings.Split(keys, ",")
log.Println(keyTypes)
a437eed to
0ea4be3
Compare
There was a problem hiding this comment.
I wonder if this should be a path to dir?
There was a problem hiding this comment.
No, it's the path to config.toml (https://github.com/coniks-sys/coniks-go/blob/cdaf4bf18b7f801149e6766f7239a301ec0c2365/keyserver/server.go#L60-L64)
There was a problem hiding this comment.
I know, I was just thinking about,
cd keyserver/coniksserver/
mkdir config
./coniksserver -dir config -genconfig -genkey "sign,vrf"
./conkisserver -dir config // to run
But, ya, nevermind.
4e62d69 to
00d4868
Compare
There was a problem hiding this comment.
λ (registration *) ./coniksserver -genkey "sign"
2016/08/15 11:58:06 {true sign,vrf}
boolStringFlag still doesn't seem to be working.
There was a problem hiding this comment.
boolStringFlag is a bool type flag. The reason is I want to have a call like ./coniksserver -genkey with default value. I'm not sure if we want to change it to string type flag.
There was a problem hiding this comment.
Ok, but right now it doesn't support generating the keys individually. So there's no point in doing all the string split orchestration.
There was a problem hiding this comment.
Did you try -genkey=sign. I think it should work.
There was a problem hiding this comment.
Did you try -genkey=sign. I think it should work.
Well that's embarrassing. Yup, that works. You've even documented it correctly. Although, it's slightly unintuitive that ./coniksserver -genkey "sign" doesn't work, but at least I see why now. It shorts to bool and "sign" ends up being another argument.
Ok, sorry for being slow here. What you have is fine.
69ee0f0 to
16d7eb8
Compare
There was a problem hiding this comment.
Maybe a helper for this boilerplate?
func resolvePath(file, other string) other string {
if !filename.IsAbs(other) {
file = filepath.Join(filepath.Dir(file), other)
}
}
vrfPath := util.resolvePath(file, conf.Policies.VRFKeyPath)
There was a problem hiding this comment.
Maybe NewConiksServer could take an optional db?
There was a problem hiding this comment.
Maybe it's unnecessary, since this's just a modification for testing.
There was a problem hiding this comment.
Sorry, move this below the err check.
|
I'm still reviewing this pull, and was going through every single commit. Please don't merge this yet. |
There was a problem hiding this comment.
What does this image represent?
There was a problem hiding this comment.
I think it's an ascii onion. But, yeah, we should probably stick to CONIKS branding.
There was a problem hiding this comment.
Yes, it's Tor logo ascii. I hope you don't get mad at this :(
Sorry for clearing the history, I can restore it if you want :( |
|
Don't worry about it :) It's much easier to review a single commit and I had only made one small comment (which I've added back in). |
|
Phew |
There was a problem hiding this comment.
I think the panic should be on err not e, no? Otherwise, if the registration request resulted in an error as well, we'll end up panicking on that instead.
There was a problem hiding this comment.
I think the panic should be on err not e, no?
Yes, it should panic on err.
panic seems very wrong here.
I think if there is any error here, it must be our bug?
There was a problem hiding this comment.
I think if there is any error here, it must be our bug?
Not necessarily a bug? I'm not sure. But definitely internal server error (e.g. ErrorDirectory)
panicseems very wrong here.
@arlolra do you think we shouldn't be panicking here?
There was a problem hiding this comment.
But definitely internal server error (e.g. ErrorDirectory)
No, it is panic(err) which is an error returned by json.Marshal. That's why I said it's maybe our bug.
There was a problem hiding this comment.
No, it is panic(err) which is an error returned by json.Marshal. That's why I said it's maybe our bug.
Oh yeah you're right, it's definitely a bug in this case because the response might be malformed. My previous response more for the general case.
There was a problem hiding this comment.
Sorry, I hastily threw in the above comment. Don't mind me here.
it's definitely a bug in this case because the response might be malformed
Sounds right.
Thanks for digging into the error propagation so thoroughly.
40c2fb5 to
736eb0b
Compare
There was a problem hiding this comment.
That's Tor Messenger specific. We should keep this to CONIKS only. Since there's no logo, what if you just did "CONIKS" in ascii art?
Pick your favourite http://patorjk.com/software/taag/#p=display&f=Rectangles&t=CONIKS
_____ _____ _____ _____ _____ _____
| | | | | | | | __|
| --| | | | | |- -| -|__ |
|_____|_____|_|___|_____|__|__|_____|
There was a problem hiding this comment.
Yup, I probably should remove it :D. Sorry for the noise :D
d144f97 to
a2b9f3d
Compare
|
LGTM :) |
* Implement registration function