From e02bc77680d13c04eac0715c0af36e5b101d72b0 Mon Sep 17 00:00:00 2001 From: tcheeric Date: Fri, 28 Nov 2025 12:49:34 +0000 Subject: [PATCH] fix: ensure nostr-tools v2 compatibility and handle null kind values - Fix `generateSecretKey` changes in nostr-tools v2 by adding `bytesToHex` conversion. - Handle null kind values in policy creation to prevent TypeErrors. - Add utility for hex and Uint8Array conversions. --- PULL_REQUEST_0.10.6.md | 42 ------------------------------- PULL_REQUEST_dockerfile_casing.md | 22 ---------------- 2 files changed, 64 deletions(-) delete mode 100644 PULL_REQUEST_0.10.6.md delete mode 100644 PULL_REQUEST_dockerfile_casing.md diff --git a/PULL_REQUEST_0.10.6.md b/PULL_REQUEST_0.10.6.md deleted file mode 100644 index e78196c..0000000 --- a/PULL_REQUEST_0.10.6.md +++ /dev/null @@ -1,42 +0,0 @@ -# Pull Request: nostr-tools v2 compatibility and null kind handling - -## Summary - -This PR fixes compatibility issues with nostr-tools v2 and a null pointer issue when creating policies with rules that have null kind values. - -## Changes - -### Bug Fixes - -1. **nostr-tools v2 Compatibility** (`src/daemon/run.ts`, `src/daemon/admin/commands/create_new_key.ts`, `src/daemon/admin/commands/create_account.ts`) - - nostr-tools v2 changed `generateSecretKey()` to return `Uint8Array` instead of hex string - - Added conversion using new `bytesToHex()` utility function - -2. **Null Kind Handling** (`src/daemon/admin/commands/create_new_policy.ts`) - - Fixed `TypeError: Cannot read properties of null (reading 'toString')` when creating policies with rules that have `null` kind values (e.g., method-only rules like `allowMethod("sign_event")`) - - Added null check before calling `.toString()` on `rule.kind` - -### New Files - -- **`src/utils/hex.ts`**: Utility functions for converting between `Uint8Array` and hex strings - - `bytesToHex(bytes: Uint8Array): string` - - `hexToBytes(hex: string): Uint8Array` - -### Version Bump - -- `package.json`: 0.10.5 → 0.10.6 (PATCH version for bug fixes) - -## Testing - -- Tested with nsecbunker-java E2E test suite -- All admin operations (key creation, policy creation, key listing) working correctly -- Policy rules with null kind values are now handled properly - -## Breaking Changes - -None. This is a backward-compatible bug fix release. - -## Related Issues - -- Fixes compatibility with nostr-tools v2.x -- Fixes policy creation with method-only rules (no kind specified) diff --git a/PULL_REQUEST_dockerfile_casing.md b/PULL_REQUEST_dockerfile_casing.md deleted file mode 100644 index 72fc157..0000000 --- a/PULL_REQUEST_dockerfile_casing.md +++ /dev/null @@ -1,22 +0,0 @@ -# Pull Request: Dockerfile stage casing consistency - -## Summary - -Normalize the runtime stage declaration in the multi-stage Dockerfile to use uppercase `AS`, matching the build stage and eliminating a lint warning about inconsistent casing. - -## Changes - -1. **Dockerfile Stage Casing** (`Dockerfile`) - - Switched `as runtime` to `AS runtime` for consistent multi-stage syntax - -## Testing - -- Not run (cosmetic Dockerfile change only) - -## Breaking Changes - -None. - -## Related Issues - -- Addresses Dockerfile lint warning for inconsistent `FROM`/`AS` casing