Skip to content
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

feat: app child key derived from wallet master key #736

Merged
merged 55 commits into from
Nov 7, 2024
Merged
Changes from 1 commit
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
83de003
feat(appwalletKey): add GetBIP32ChildKey
frnandu Oct 14, 2024
546322c
feat: fix interface
frnandu Oct 14, 2024
8cbe566
feat: adding subscription WiP
frnandu Oct 15, 2024
853beed
feat: handle nostr subscriptions for lifecycle of apps
frnandu Oct 18, 2024
8cb135d
Delete .idea/.gitignore
frnandu Oct 18, 2024
616a69b
Delete .idea/hub.iml
frnandu Oct 18, 2024
55113ce
Delete .idea/modules.xml
frnandu Oct 18, 2024
78c2faa
Delete .idea/vcs.xml
frnandu Oct 18, 2024
e7ae82c
fix: remove unnecessary
frnandu Oct 18, 2024
dc404dd
fix: missing handling legacy app
frnandu Oct 18, 2024
b145c41
fix: review fixes
frnandu Oct 21, 2024
23b35c8
fix: use app.ID for key calculation instead of passing in event
frnandu Oct 21, 2024
b64c8cf
fix: add TODO
frnandu Oct 21, 2024
d0b0354
fix: remove unnecessary check
frnandu Oct 25, 2024
0c5949c
fix: improve err handling and remove check
frnandu Oct 25, 2024
324f113
Merge remote-tracking branch 'origin/master' into feat/wallet-child-k…
rolznz Oct 28, 2024
b4d1f3e
chore: store master nostr key to avoid deriving each time
rolznz Oct 29, 2024
a1dc936
chore: rename app nostr_pubkey to app_pubkey, extract app consumers i…
rolznz Oct 29, 2024
bedc82d
chore: finish renaming
rolznz Oct 29, 2024
200c172
fix: update app wallet pubkey on app creation
rolznz Oct 29, 2024
aef3142
fix: not NULL check
rolznz Oct 29, 2024
96a71bc
fix: fix HandleEvent
frnandu Oct 29, 2024
b359339
fix: error handling
frnandu Oct 29, 2024
aa2c3c1
fix: error handling
frnandu Oct 29, 2024
9f69b1a
fix: move StartSubscription to start.go
frnandu Oct 29, 2024
0d61bb2
fix: remove duplicated error check
frnandu Oct 29, 2024
b530632
fix: make tests use AppsService for creating apps
frnandu Oct 29, 2024
d4c6a60
chore: remove unused code
rolznz Oct 29, 2024
63c3fd9
chore: minor event handler improvements
rolznz Oct 29, 2024
1d79b8a
fix: add event_handler tests for legacy app
frnandu Oct 29, 2024
55d9515
chore: add comment about legacy apps in deleteAppConsumer
rolznz Oct 29, 2024
b1bcc58
Merge branch 'feat/wallet-child-key-per-connection' of github.com:get…
rolznz Oct 29, 2024
c56d1d1
fix: remove unused app from tests
rolznz Oct 29, 2024
bc923eb
fix: error handling in startAppWalletSubscription
rolznz Oct 29, 2024
606fb32
fix: only create event info and nostr subscription for master key if …
frnandu Oct 30, 2024
932a9fb
fix: add legacy tests
frnandu Oct 31, 2024
17c9c0b
fix: move fetching of Nip47 event info to deleteAppConsumer
frnandu Oct 31, 2024
8127fea
fix: fixed arguments
frnandu Oct 31, 2024
7cff2a7
fix: use require instead of assert
frnandu Nov 1, 2024
339d420
Merge branch 'master' into feat/wallet-child-key-per-connection
frnandu Nov 1, 2024
606c33b
fix: adapt GetAppWalletKey to use DeriveKey with path 1'
frnandu Nov 1, 2024
877509e
fix: for backends that don't use a mnemonic, create appKey from nostr…
frnandu Nov 4, 2024
c47d923
fix: cleanup eventPublisher Subscribers when relay reconnects
frnandu Nov 4, 2024
7bfd140
fix: bip32.FirstHardenedChild + appID
frnandu Nov 6, 2024
ce4c5cf
fix: remove unused env vars
frnandu Nov 6, 2024
8c1ef4b
fix: generate new mnemonic if empty
frnandu Nov 6, 2024
aea59f0
fix: add tests.CreateTestServiceWithMnemonic to fix TestEncryptedBackup
frnandu Nov 6, 2024
78f59bc
fix: handle both relay and main ctx Done
frnandu Nov 6, 2024
b322f4c
Merge branch 'master' into feat/wallet-child-key-per-connection
rolznz Nov 7, 2024
b4bf53f
chore: add keys tests
rolznz Nov 7, 2024
caed3b3
chore: add extra assertions to keys test
rolznz Nov 7, 2024
2b14d3c
chore: log when legacy app subscription is created
rolznz Nov 7, 2024
dc54213
chore: remove unnecessary break
rolznz Nov 7, 2024
0be7e32
chore: add log when relay is successfully connected
rolznz Nov 7, 2024
287607d
fix: only auto-start node if it has been started before
rolznz Nov 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: minor event handler improvements
- fix error code response when failing to update request event
- fix log content when failing to decrypt request event
- move logging of app to correct place
  • Loading branch information
rolznz committed Oct 29, 2024
commit 63c3fd96c47f9eb94e1e9261ac8d39d935db10c2
16 changes: 8 additions & 8 deletions nip47/event_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ func (svc *nip47Service) HandleEvent(ctx context.Context, relay nostrmodels.Rela
return
im-adithya marked this conversation as resolved.
Show resolved Hide resolved
}

logger.Logger.WithFields(logrus.Fields{
"requestEventNostrId": event.ID,
"eventKind": event.Kind,
"appId": app.ID,
}).Debug("App found for nostr event")

appWalletPrivKey := svc.keys.GetNostrSecretKey()

if app.WalletPubkey != nil {
Expand Down Expand Up @@ -113,7 +119,7 @@ func (svc *nip47Service) HandleEvent(ctx context.Context, relay nostrmodels.Rela

nip47Response = &models.Response{
Error: &models.Error{
Code: constants.ERROR_UNAUTHORIZED,
Code: constants.ERROR_INTERNAL,
Message: fmt.Sprintf("Failed to save app to nostr event: %s", err.Error()),
},
}
Expand All @@ -137,12 +143,6 @@ func (svc *nip47Service) HandleEvent(ctx context.Context, relay nostrmodels.Rela
return
}

logger.Logger.WithFields(logrus.Fields{
"requestEventNostrId": event.ID,
"eventKind": event.Kind,
"appId": app.ID,
}).Debug("App found for nostr event")

payload, err := nip04.Decrypt(event.Content, ss)
if err != nil {
logger.Logger.WithFields(logrus.Fields{
Expand All @@ -153,7 +153,7 @@ func (svc *nip47Service) HandleEvent(ctx context.Context, relay nostrmodels.Rela
logger.Logger.WithFields(logrus.Fields{
"requestEventNostrId": event.ID,
"eventKind": event.Kind,
}).WithError(err).Error("Failed to process event")
}).WithError(err).Error("Failed to decrypt request event")

requestEvent.State = db.REQUEST_EVENT_STATE_HANDLER_ERROR
err = svc.db.Save(&requestEvent).Error
Expand Down
Loading