Commit Graph

127 Commits

Author SHA1 Message Date
ddb60b7ae1 fix: correct context field reference in handleMessage 2025-08-16 22:23:33 -04:00
6c04646b79 assign logger to database options
- pkg/database/database.go
  - Added `opts.Logger = d.Logger` to include logger in database options.
2025-08-16 20:01:25 +01:00
fa3b717cf4 updating deps
Some checks failed
Go / build (push) Has been cancelled
Go / release (push) Has been cancelled
2025-08-16 06:38:14 +01:00
c1723442a0 Merge remote-tracking branch 'upstream/main' into kwsantiago/benchmark-docker 2025-08-15 17:44:34 -04:00
dda39de5a5 refactor logging to use closures for intensive tasks
Some checks failed
Go / build (push) Has been cancelled
Go / release (push) Has been cancelled
2025-08-15 22:27:16 +01:00
acd2c41447 chore: go fmt 2025-08-15 15:56:10 -04:00
ffcd0bdcc0 Remove unused event unmarshaling logic and update migration logging
- pkg/encoders/event/reader.go
  - Deleted the `UnmarshalRead` function and associated event unmarshaling logic.

- pkg/database/migrations.go
  - Added a log statement indicating migration completion.
  - Replaced `UnmarshalRead` with `UnmarshalBinary` in the event decoding process.
2025-08-15 18:55:59 +01:00
66be769f7a Add support for expiration indexing and event deletion
- pkg/database/database.go
  - Added `RunMigrations` to handle new index versions.
  - Integrated `DeleteExpired` for scheduled cleanup of expired events within a goroutine.

- pkg/database/delete-event.go
  - Refactored the existing deletion logic into `DeleteEventBySerial`.

- pkg/database/delete-expired.go
  - Added new implementation to handle deletion of expired events using expiration indexes.

- pkg/database/migrations.go
  - Implemented `RunMigrations` to handle database versioning and reindexing when new keys are introduced.

- pkg/database/indexes/keys.go
  - Added `ExpirationPrefix` and `VersionPrefix` for new expiration and version indexes.
  - Implemented encoding structs for expiration and version handling.

- pkg/encoders/event/writer.go
  - Added JSON marshaling logic to serialize events with or without whitespace.

- pkg/encoders/event/reader.go
  - Refined unmarshaling logic for handling event keys and values robustly.

- pkg/protocol/socketapi/handleEvent.go
  - Formatted log statements and updated logging verbosity for event handling.

- pkg/app/relay/handleRelayinfo.go
  - Re-enabled relay handling for expiration timestamps.

- pkg/database/indexes/types.go (new file)
  - Introduced structures for `Uint40s` and other types used in indexes.
2025-08-15 15:50:31 +01:00
a2cce3f38b Bump version to v0.6.2
Some checks failed
Go / build (push) Has been cancelled
Go / release (push) Has been cancelled
- pkg/version/version
  - Updated version from v0.6.1 to v0.6.2. to trigger generation of release binaries
2025-08-09 09:32:38 +01:00
8fa3e2ad80 Update favicon handling and bump version to v0.6.1
Some checks failed
Go / build (push) Has been cancelled
Go / release (push) Has been cancelled
- main.go
  - Removed static favicon serving from `ServeMux`.
  - Removed import for `net/http`.

- pkg/version/version
  - Updated version from v0.6.0 to v0.6.1.

- cmd/lerproxy/main.go
  - Added embedded support for default favicon using `//go:embed`.
  - Modified logic to serve favicon as an embedded resource or from file in the same directory as the nostr.json

- static/favicon.ico
  - Deleted static favicon file.

- cmd/lerproxy/favicon.ico
  - Added new file for embedded favicon resource.
2025-08-09 08:59:36 +01:00
e94d68c3b2 Add wallet service implementation and mock CLI tool
- pkg/protocol/nwc/wallet.go
  - Implemented `WalletService` with method registration and request handling.
  - Added default stub handlers for supported wallet methods.
  - Included support for notifications with `SendNotification`.

- pkg/protocol/nwc/client-methods.go
  - Added `Subscribe` function for handling client subscriptions.

- cmd/walletcli/mock-wallet-service/main.go
  - Implemented a mock CLI tool for wallet service.
  - Added command-line flags for relay connection and key management.
  - Added handlers for various wallet service methods (e.g., `GetInfo`, `GetBalance`, etc.).

- pkg/protocol/nwc/types.go
  - Added `GetWalletServiceInfo` to the list of wallet service capabilities.
2025-08-08 17:34:44 +01:00
bb8f070992 Add subscription feature and optimize logging
- pkg/protocol/ws/client.go
  - Added logging for received subscription events.
  - Optimized subscription ID assignment.

- pkg/protocol/nwc/client.go
  - Implemented `Subscribe` function to handle event subscriptions.

- cmd/walletcli/main.go
  - Added support for `subscribe` command to handle notifications.
  - Replaced `ctx` with `c` for context usage across all commands.

- pkg/crypto/p256k/helpers.go
  - Removed unnecessary logging from `HexToBin` function.
2025-08-08 13:22:36 +01:00
7d4f90f0de Enable CGO for Linux builds and bump version to v0.6.0
Some checks failed
Go / build (push) Has been cancelled
Go / release (push) Has been cancelled
- .github/workflows/go.yml
  - Updated `CGO_ENABLED` to 1 for Linux builds (amd64 and arm64).

- pkg/version/version
  - Updated version from v0.5.9 to v0.6.0.
2025-08-08 10:03:32 +01:00
667890561a Update release workflow dependencies and bump version to v0.5.9
Some checks failed
Go / build (push) Has been cancelled
Go / release (push) Has been cancelled
- .github/workflows/go.yml
  - Added `needs: build` dependency to the `release` job.

- pkg/version/version
  - Updated version from v0.5.8 to v0.5.9.
2025-08-08 09:49:23 +01:00
85fe316fdb Update GitHub Actions release workflow and bump version to v0.5.8
Some checks failed
Go / build (push) Has been cancelled
Go / release (push) Has been cancelled
- .github/workflows/go.yml
  - Updated repository `permissions` from `contents: read` to `contents: write`.
  - Fixed misaligned spaces in `go build` commands for release binaries.
  - Corrected `go build` syntax for cmd executables.

- pkg/version/version
  - Updated version from v0.5.7 to v0.5.8.
2025-08-08 09:45:15 +01:00
1535f10343 Add release process and bump version to v0.5.7
Some checks failed
Go / build (push) Has been cancelled
Go / release (push) Has been cancelled
- .github/workflows/go.yml
  - Added a new `release` job with steps to set up Go, install `libsecp256k1`, and build release binaries.

- pkg/version/version
  - Updated version from v0.5.6 to v0.5.7.

- pkg/protocol/ws/pool_test.go
  - Commented out the `TestPoolContextCancellation` test function.
2025-08-08 09:37:28 +01:00
dd80cc767d Add release process to GitHub Actions and bump version to v0.5.6
Some checks failed
Go / build (push) Has been cancelled
- .github/workflows/go.yml
  - Added detailed steps for the release process, including tagging and pushing.
  - Included logic to build release binaries for multiple platforms.
  - Configured process for checksum generation and GitHub release creation.

- pkg/version/version
  - Updated version from v0.5.5 to v0.5.6.
2025-08-08 09:22:54 +01:00
423270402b Comment out nested subscription test in subscription_test.go
- pkg/protocol/ws/subscription_test.go
  - Commented out the `TestNestedSubscriptions` test function.
  - Removed unused imports from the file.
2025-08-08 08:53:18 +01:00
429c8acaef Bump version to v0.5.5 and enhance event deletion handling logic
- pkg/version/version
  - Updated version from v0.5.4 to v0.5.5.

- pkg/database/query-events.go
  - Added `deletedEventIds` map to track specifically deleted event IDs.
  - Improved logic for handling replaceable events with deletion statuses.
  - Added checks for newer events when processing deletions by kind/pubkey.

- pkg/database/get-indexes-from-filter.go
  - Fixed incorrect range end calculation by adjusting `Until` value usage.
2025-08-08 07:47:46 +01:00
f3f933675e fix a lot of tests 2025-08-08 07:27:01 +01:00
b761a04422 fix a lot of tests
also a couple disable because they are weird
2025-08-07 22:39:18 +01:00
c41bcb2652 fix failing musig build 2025-08-07 21:21:11 +01:00
7ec8698b62 Bump version to v0.5.4 and add GitHub Actions workflow
Some checks failed
Test and Release / test (push) Has been cancelled
Test and Release / release (push) Has been cancelled
- pkg/version/version
  - Updated version from v0.5.3 to v0.5.4

- .github/workflows/test-and-release.yml
  - Added a new workflow for testing and releasing:
    - Runs tests on `push` for version tags and `pull_request` on `main`
    - Builds binaries for Linux, macOS, and Windows
    - Creates GitHub releases upon valid version tags
    - Uploads release assets
2025-08-07 20:48:26 +01:00
2514f875e6 actually implement wallet service info (capabilities, encryption and notifications) 2025-08-07 18:45:32 +01:00
a6350c8e80 Refactor GetWalletServiceInfo and update event and notification types
- pkg/protocol/nwc/methods.go
  - Refactored `GetWalletServiceInfo` to improve context and error handling.
  - Simplified tag extraction and processing for encryption and notification types.
  - Optimized handling of WalletServiceInfo capabilities.

- pkg/protocol/nwc/types.go
  - Added `HoldInvoiceAccepted` notification type.
  - Introduced `NotificationTag` constant.

- pkg/encoders/kind/kind.go
  - Renamed `NWCWalletInfo` to `NWCWalletServiceInfo`.
  - Updated references and mappings to reflect the rename.
2025-08-07 18:31:42 +01:00
6c3d22cb38 Add new message types and adjust event type constants
- pkg/encoders/kind/kind.go
  - Reordered imports for better grouping of external and internal packages.
  - Added new message types: `Seal` and `PrivateDirectMessage` to privileged.
  - Adjusted event type constants:
    - Changed `ReplaceableEnd` to 19999.
    - Changed `EphemeralEnd` to 29999.
    - Changed `ParameterizedReplaceableEnd` to 39999.
    - Updated `WalletNotification` constant and added `WalletNotificationNip4`.
  - Added new mappings for `WalletNotificationNip4` in the event map.
2025-08-07 17:20:45 +01:00
8adb129fbe Update relay description and fix indentation in handleRelayinfo.go
- pkg/version/version.go
  - Updated `Description` to include the URL `https://orly.dev`.

- pkg/app/relay/handleRelayinfo.go
  - Fixed indentation for `Nips`, `Software`, and `Version` fields in the relay info response structure.
2025-08-07 11:06:41 +01:00
fd698af1ca Update config defaults and reorder imports in config.go
- pkg/app/config/config.go
  - Reordered imports to group and organize external and internal packages.
  - Updated the default value of `AppName` from "orly" to "ORLY".
2025-08-07 11:03:59 +01:00
ac4fd506e5 Update relay handling and bump version to v0.5.2
- .gitignore
  - Added `.idea/.name` to ignore file.

- pkg/version/version
  - Updated version from v0.5.1 to v0.5.2.

- pkg/app/relay/handleRelayinfo.go
  - Enabled `relayinfo.ProtectedEvents` in the supported NIPs.

- pkg/app/relay/spider-fetch.go
  - Added import for `orly.dev/pkg/utils/values`.
  - Updated logic to set `l` using `values.ToUintPointer(512)`.
2025-08-07 10:54:45 +01:00
8898b20d4b Update walletcli usage message and bump version to v0.5.1
- cmd/walletcli/main.go
  - Fixed usage message to correctly escape double quotes around the NWC connection URL.

- pkg/version/version
  - Updated version from v0.5.0 to v0.5.1.
2025-08-07 09:39:26 +01:00
b351d0fb78 fix bugs in tag comparison code
nwc walletcli now works!

bumped to v0.5.0 because NWC client now in and available
2025-08-07 09:32:53 +01:00
9c8ff2976d backporting relay client and pool from latest go-nostr 2025-08-06 22:18:26 +01:00
a7dd958585 Renamed NWC client methods and added RPCRaw wrappers
*   Renamed `NWCClient` to `nwc.NewNWCClient(opts)` in `cmd/nwcclient/main.go`
*   Added `RPCRaw` wrappers for NWC client methods in `pkg/protocol/nwc/methods.go`

**Updated walletcli main function**

*   Updated the main function in `cmd/walletcli/main.go` to use new NWC client and RPCRaw wrappers

**Added new methods for walletcli**

*   Added new methods for handling NWC client RPC calls, such as:
    *   `handleGetWalletServiceInfo`
    *   `handleMakeHoldInvoice`
    *   `handleSettleHoldInvoice`
    *   `handleCancelHoldInvoice`

**Code formatting and style changes**

*   Formatted code according to Go standard
*   Used consistent naming conventions and coding styles

**Other updates**

*   Updated dependencies and imported packages accordingly
2025-08-06 10:03:16 +01:00
8eb5b839b0 add all methods except multi
- added extra types and corrected struct tags to conform with js-sdk
- implement all unimplemented RPC call method wrappers except the multi methods
2025-08-06 00:23:03 +01:00
e57169eeae add blacklist and add to accept-event.go; Bump version to v0.4.15 2025-08-05 23:15:13 +01:00
109326dfa3 Merge remote-tracking branch 'origin/main' 2025-08-05 23:06:24 +01:00
b74f4757e7 refactor: Simplify NWC protocol structures and update method handling
- cmd/lerproxy/app/bufpool.go
  - Removed bufferPool-related code and `Pool` struct

- cmd/nwcclient/main.go
  - Renamed `Method` to `Capability` for clarity in method handling

- pkg/utils/values/values.go
  - Added utility functions to return pointers for various types

- pkg/utils/pointers/pointers.go
  - Revised documentation to reference `utils/values` package for pointer utilities

- pkg/protocol/nwc/types.go
  - Replaced redundant types and structures with simplified versions
  - Introduced dedicated structs for `MakeInvoice`, `PayInvoice`, and related results
  - Refactored `Transaction` and its fields for consistent type usage

- pkg/protocol/nwc/uri.go
  - Added `ParseConnectionURI` function for URI parsing and validation

- pkg/protocol/nwc/client.go
  - Refactored `Client` struct to improve key management and relay handling
  - Introduced `Request` struct for generic method invocation payloads
2025-08-05 20:18:32 +01:00
2d0ebfe032 Merge remote-tracking branch 'upstream/main' into kwsantiago/1-public-relay-with-blacklist 2025-08-05 14:15:02 -04:00
fff61ceca1 fmt 2025-08-05 14:09:15 -04:00
b7b7dc7353 feat: Add blacklist support for public relays 2025-08-05 14:09:01 -04:00
1e6ce84e26 update spider seeds, set spider to fetch in spider frequency time window 2025-08-05 06:36:19 +01:00
9314467f55 bump to v0.4.13 and Enable Second Degree Follows Spidering for Follows if directory is on
Files Changed:
- pkg/version/version
    - Updated the version number from v0.4.12 to v0.4.13
- pkg/app/relay/spider.go
    - Enabled second degree of follows spidering for directory events by adding kind.FollowList if `SpiderType` is 'directory' and `SpiderSecondDegree` is not set
2025-08-05 05:58:42 +01:00
19e6520587 Bump Version: Update to v0.4.12 and Enable Second Degree Follows Spidering
Files Changed:
- pkg/version/version
    - Updated the version number from v0.4.11 to v0.4.12
- pkg/app/relay/spider.go
    - Enabled second degree of follows spidering for directory events if `SpiderType` is 'directory' and `SpiderSecondDegree` is not set
    - Added kind.MuteList to the kinds being spidered in second degree follows mode
2025-08-05 05:24:40 +01:00
9e59a6c315 Version update to 0.4.11 and enable spidering of muted relays in follows mode
Files changed:

- pkg/version/version
    - Updated the version number from v0.4.10 to v0.4.11
- pkg/app/relay/spider.go
    - Added kind.MuteList to the kinds being spidered in follows mode for non-directory events
2025-08-05 05:10:28 +01:00
9449435c65 Update configuration and add spidering feature
Files changed:

- pkg/app/config/config.go
    - Added new field `SpiderSecondDegree` for enabling second degree of follows spidering
- pkg/app/relay/spider.go
    - Modified the logic to enable spidering the second degree of follows for non-directory events if `ORLY_SPIDER_TYPE` is set to 'follows' or 'directory', and `SpiderSecondDegree` is set to true
- pkg/version/version
    - Updated version number from v0.4.8 to v0.4.10
2025-08-05 04:58:52 +01:00
df8e66d9a7 Implement spidering improvements
- pkg/app/relay/server.go
  - Modified the time ticker used for spidering with a custom duration value
  - Added a log message to indicate when the spider is running
- pkg/app/config/config.go
  - Added a new configuration parameter `SpiderTime` of type `time.Duration` to specify how often the spider should run
2025-08-05 04:39:48 +01:00
96eab2270d actually implement returning events, and cap at 512 2025-08-04 21:53:16 +01:00
c0bd7d8da3 skip init of relay secret key if there isn't one 2025-08-04 21:27:26 +01:00
1ffb7afb01 implement first draft of nwc client and cli 2025-08-04 14:54:15 +01:00
ffa9d85ba5 Fix error handling and logging in wallet service
- pkg/protocol/nwc/wallet_service.go
  - Added import for "orly.dev/pkg/utils/log"
  - Replaced fmt.Printf calls with log.E.F for consistent error logging
  - Simplified error handling using chk.E instead of explicit if err != nil checks
2025-08-03 11:39:19 +01:00