nostr_console icon indicating copy to clipboard operation
nostr_console copied to clipboard

New install just passing in private and public key as parameters

Open eldraquereal opened this issue 2 years ago • 8 comments

dart run bin/nostr_console.dart -p thekey -k theprivkey

Going to use the provided private key Going to use default file to read from and store events: all_nostr_events.txt Reading events from default file.......read 0 posts from file all_nostr_events.txt Waiting for user posts to come in........done Waiting for feed to come in..............done Unhandled exception: RangeError (end): Invalid value: Not in inclusive range 0..3: -1 #0 RangeError.checkValidRange (dart:core/errors.dart:363:9) #1 _StringBase.substring (dart:core-patch/string_patch.dart:400:27) #2 EventData.decryptDirectMessage (package:nostr_console/event_ds.dart:296:27) #3 EventData.translateAndExpandMentions (package:nostr_console/event_ds.dart:253:27) #4 Store.handleDirectMessages (package:nostr_console/tree_ds.dart:783:24) #5 new Store.fromEvents. (package:nostr_console/tree_ds.dart:845:9) #6 _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:617:13) #7 new Store.fromEvents (package:nostr_console/tree_ds.dart:829:24) #8 getTree (package:nostr_console/tree_ds.dart:2105:24) #9 main.. (file:///D:/Apps/nostr_console/bin/nostr_console.dart:312:26) #10 new Future.delayed. (dart:async/future.dart:424:39) #11 Timer._createTimer. (dart:async-patch/timer_patch.dart:18:15) #12 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:398:19) #13 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)

eldraquereal avatar Nov 08 '22 14:11 eldraquereal

Seems to run without the keys - also tested with compiled version

eldraquereal avatar Nov 08 '22 14:11 eldraquereal

It's basically crashing when trying to decrypt direct message. So either the code is buggy related to key, or its buggy related to event format ( can't handle event format).

By any chance your private or public key start with 0? There is a known issue where Nostr Console can't seem to handle public keys that start with 0.

vishalxl avatar Nov 08 '22 14:11 vishalxl

No, a 5 (pub) and an f (priv) - private key is one generated by Alby if any use?

Interestingly, if I just have the public key on the command line I can read and enter public channels fine - as soon as I add the private key it errors.

eldraquereal avatar Nov 08 '22 14:11 eldraquereal

can you check if any of these keys is not 64 bytes? It may happen, so just checking.

vishalxl avatar Nov 08 '22 15:11 vishalxl

No, a 5 (pub) and an f (priv) - private key is one generated by Alby if any use?

Interestingly, if I just have the public key on the command line I can read and enter public channels fine - as soon as I add the private key it errors.

have you tried using the priv key and only the priv key?

NorrinRadd avatar Nov 13 '22 06:11 NorrinRadd

Just for the record, there are two formats of keys: 1 is the hex format that nostr_console takes, and another is the npub format that's used by Damus. Both can be used to represent the same key.

vishalxl avatar Nov 13 '22 07:11 vishalxl

Issue b: Seems to be same issue: Almost exact same error is seen with private key 1 with argument --prikey=0000000000000000000000000000000000000000000000000000000000000001

Waiting for user posts to come in........done
Waiting for feed to come in..............done
Unhandled exception:
RangeError (end): Invalid value: Not in inclusive range 0..3: -1
#0      RangeError.checkValidRange (dart:core/errors.dart:363:9)
#1      _StringBase.substring (dart:core-patch/string_patch.dart:400:27)
#2      EventData.decryptDirectMessage (package:nostr_console/event_ds.dart:426:27)
#3      EventData.translateAndExpandMentions (package:nostr_console/event_ds.dart:383:27)
#4      Store.handleDirectMessages (package:nostr_console/tree_ds.dart:784:24)
#5      new Store.fromEvents.<anonymous closure> (package:nostr_console/tree_ds.dart:843:9)
#6      _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:617:13)
#7      new Store.fromEvents (package:nostr_console/tree_ds.dart:830:24)
#8      getTree (package:nostr_console/tree_ds.dart:2143:24)
#9      main.<anonymous closure>.<anonymous closure> (file:///C:/Users/Vishal/Documents/GitHub/nostr_console/bin/nostr_console.dart:333:26)
#10     new Future.delayed.<anonymous closure> (dart:async/future.dart:424:39)
#11     Timer._createTimer.<anonymous closure> (dart:async-patch/timer_patch.dart:18:15)
#12     _Timer._runTimers (dart:isolate-patch/timer_impl.dart:398:19)
#13     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)

vishalxl avatar Nov 18 '22 12:11 vishalxl

hi eldraquereal, can you try running the same keys with the latest release here, version 0.1.5-beta.

I have fixed some such crashes with it, wondering if yours too may get fixed.

vishalxl avatar Nov 20 '22 08:11 vishalxl

No further details known, closing.

vishalxl avatar Dec 21 '22 07:12 vishalxl