File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -407,6 +407,15 @@ <h1>📝 Live Notes</h1>
407407 import git from 'isomorphic-git' ;
408408 import * as nostrTools from 'nostr-tools' ;
409409
410+ // Helper to convert hex string to Uint8Array
411+ function hexToBytes ( hex ) {
412+ const bytes = new Uint8Array ( hex . length / 2 ) ;
413+ for ( let i = 0 ; i < bytes . length ; i ++ ) {
414+ bytes [ i ] = parseInt ( hex . substr ( i * 2 , 2 ) , 16 ) ;
415+ }
416+ return bytes ;
417+ }
418+
410419 const REPO = 'https://solid.social/mel/public/notes' ;
411420 const REPO_ID = 'notes' ;
412421 const RELAYS = [ 'wss://relay.damus.io' , 'wss://nos.lol' ] ;
@@ -697,7 +706,7 @@ <h3>${titleCased}</h3>
697706 } ;
698707
699708 // Use finalizeEvent which hashes and signs
700- const signedEvent = nostrTools . finalizeEvent ( authEvent , nostrTools . hexToBytes ( privkey ) ) ;
709+ const signedEvent = nostrTools . finalizeEvent ( authEvent , hexToBytes ( privkey ) ) ;
701710
702711 // Base64 encode the event
703712 const authHeader = 'Nostr ' + btoa ( JSON . stringify ( signedEvent ) ) ;
@@ -714,7 +723,7 @@ <h3>${titleCased}</h3>
714723 }
715724
716725 async function publishNostrEvent ( commit ) {
717- const secretKey = nostrTools . hexToBytes ( privkey ) ;
726+ const secretKey = hexToBytes ( privkey ) ;
718727
719728 const eventTemplate = {
720729 kind : 30618 ,
You can’t perform that action at this time.
0 commit comments