Skip to content

Conversation

@asimfarooq5
Copy link
Member

No description provided.

cmd/wshd/main.go Outdated
Comment on lines 299 to 309
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()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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
Comment on lines 319 to 322
keys, err := inv.ArgBytes(0)
if err != nil {
return xconn.NewInvocationError("wamp.error.invalid_argument", err.Error())
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Handle here accordingly

@asimfarooq5 asimfarooq5 force-pushed the key-sync-procedure branch 2 times, most recently from 7bbcf1d to 7d0cd14 Compare October 7, 2025 14:10
cmd/wshd/main.go Outdated
Comment on lines 314 to 316
argList, ok := inv.Args()[0].([]interface{})
if !ok {
return xconn.NewInvocationError("wamp.error.invalid_argument", "expected list of keys")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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())

Copy link
Member

@muzzammilshahid muzzammilshahid left a 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())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fmt.Println(sess.Details().Realm())

Copy link
Member Author

@asimfarooq5 asimfarooq5 Oct 8, 2025

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.

@asimfarooq5 asimfarooq5 merged commit f97b74f into main Oct 8, 2025
1 check passed
@asimfarooq5 asimfarooq5 deleted the key-sync-procedure branch October 8, 2025 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants