-
Notifications
You must be signed in to change notification settings - Fork 18
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
App child key derived from wallet master key #736
base: master
Are you sure you want to change the base?
Conversation
scopes []string, | ||
isolated bool, | ||
metadata map[string]interface{}, | ||
walletChildPrivKeyGeneratorFunc func(appId uint32) (string, 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.
Minor: rather than passing this method as an argument, the keys could be passed to the db_service
in the NewDBService
function
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.
I tried that but get:
package command-line-arguments
imports github.com/getAlby/hub/http
imports github.com/getAlby/hub/alby
imports github.com/getAlby/hub/config
imports github.com/getAlby/hub/db
imports github.com/getAlby/hub/service/keys
imports github.com/getAlby/hub/config: import cycle not allowed
Is is possible to easily fix this import cycle without too much refactoring?
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.
This might be fixed in #710 which I move the app management out of the db package. This will cause some conflicts here when it's merged, which I can then resolve.
service/start.go
Outdated
|
||
func (svc *service) startAllExistingAppsWalletSubscriptions(ctx context.Context, relay *nostr.Relay) { | ||
var apps []db.App | ||
result := svc.db.Where("wallet_child_pubkey != ?", "").Find(&apps) |
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.
is this query correct, shouldn't it be wallet_child_pubkey IS NOT NIL
?
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.
I'm actually not sure, because if for some reason an app DB row is created but then it fails to update the column with the calculated pubkey it will have an empty string '' as value, which the current query filters, and IS NOT NULL
does not.
Is there a way to make sure that when a new DB row is created without passing a value to that column it will have NULL value instead of ''?
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.
Ah, gorm uses the default value of the column type. If it was a *string
instead of a string
it would work. But maybe we will ensure all the apps have keys, so this is no longer an issue.
fixes #724