Skip to content

Commit

Permalink
fix: scopes for alby account app connection
Browse files Browse the repository at this point in the history
  • Loading branch information
rolznz committed Jul 11, 2024
1 parent 0d2ea76 commit 1f72cd8
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion alby/alby_oauth_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"github.com/getAlby/hub/events"
"github.com/getAlby/hub/lnclient"
"github.com/getAlby/hub/logger"
"github.com/getAlby/hub/nip47/permissions"
"github.com/getAlby/hub/service/keys"
)

Expand Down Expand Up @@ -385,13 +386,23 @@ func (svc *albyOAuthService) LinkAccount(ctx context.Context, lnClient lnclient.
return err
}

scopes, err := permissions.RequestMethodsToScopes(lnClient.GetSupportedNIP47Methods())
if err != nil {
logger.Logger.WithError(err).Error("Failed to get scopes from LNClient request methods")
return err
}
notificationTypes := lnClient.GetSupportedNIP47NotificationTypes()
if len(notificationTypes) > 0 {
scopes = append(scopes, permissions.NOTIFICATIONS_SCOPE)
}

app, _, err := db.NewDBService(svc.db, svc.eventPublisher).CreateApp(
"getalby.com",
connectionPubkey,
budget,
renewal,
nil,
lnClient.GetSupportedNIP47Methods(),
scopes,
)

if err != nil {
Expand Down

0 comments on commit 1f72cd8

Please sign in to comment.