-
Notifications
You must be signed in to change notification settings - Fork 0
Add wamp procedure for keys sync #31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
399dc23 to
609ed7c
Compare
609ed7c to
bdc8881
Compare
e9c454a to
65e1609
Compare
cmd/wshd/main.go
Outdated
| lines, err := keyStore.AuthorizedKeys() | ||
| if err != nil { | ||
| return fmt.Errorf("failed to get authorized keys: %w", err) | ||
| } | ||
|
|
||
| plaintext := strings.Join(lines, "\n") | ||
| if plaintext == "" { | ||
| return fmt.Errorf("no keys to sync") | ||
| } | ||
|
|
||
| callResponse := session.Call(procedureSyncKeys).Args(plaintext).Do() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| lines, err := keyStore.AuthorizedKeys() | |
| if err != nil { | |
| return fmt.Errorf("failed to get authorized keys: %w", err) | |
| } | |
| plaintext := strings.Join(lines, "\n") | |
| if plaintext == "" { | |
| return fmt.Errorf("no keys to sync") | |
| } | |
| callResponse := session.Call(procedureSyncKeys).Args(plaintext).Do() | |
| lines, err := keyStore.AuthorizedKeys() | |
| if err != nil { | |
| return fmt.Errorf("failed to get authorized keys: %w", err) | |
| } | |
| callResponse := session.Call(procedureSyncKeys).Args(lines).Do() |
We should send keys as list instead of converting it to string
cmd/wshd/main.go
Outdated
| keys, err := inv.ArgBytes(0) | ||
| if err != nil { | ||
| return xconn.NewInvocationError("wamp.error.invalid_argument", err.Error()) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Handle here accordingly
7bbcf1d to
7d0cd14
Compare
cmd/wshd/main.go
Outdated
| argList, ok := inv.Args()[0].([]interface{}) | ||
| if !ok { | ||
| return xconn.NewInvocationError("wamp.error.invalid_argument", "expected list of keys") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| argList, ok := inv.Args()[0].([]interface{}) | |
| if !ok { | |
| return xconn.NewInvocationError("wamp.error.invalid_argument", "expected list of keys") | |
| argList, err := inv.ArgList(0) | |
| if err != nil { | |
| return xconn.NewInvocationError("wamp.error.invalid_argument", err.Error()) |
7d0cd14 to
f76c4c6
Compare
muzzammilshahid
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Please make sure to test it once more before merging and in followup, please add a way to specify the realm in wsh.
cmd/wshd/main.go
Outdated
| log.Fatal(err) | ||
| } | ||
|
|
||
| fmt.Println(sess.Details().Realm()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| fmt.Println(sess.Details().Realm()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes have already been tested, and as we discussed, the realm option will be handled in a separate PR, so we don’t need to include it here.
f76c4c6 to
cf8b17b
Compare
No description provided.