chGoodchild / GLTollGate

6 stars 2 forks source link

Generate nsec on the router #42

Closed chGoodchild closed 3 months ago

chGoodchild commented 4 months ago

Generate the secret key on the router so that the router can contact its manager for configuration details

chGoodchild commented 3 months ago

https://github.com/chGoodchild/TollGateNostrToolKit/issues/4#issuecomment-2293140442

It works now

chGoodchild commented 3 months ago

generate_keys.sh seems to work too

root@GL-AR300M:/tmp# ./generate_keys.sh 
/tmp/nostr_keys.json does not exist or is empty.
./generate_keys.sh: line 40: ./install/install_keygen.sh: not found
Nostr keys are already present and valid in /tmp/nostr_keys.json
Nostr keys generated and saved to /tmp/nostr_keys.json
root@GL-AR300M:/tmp# cat /tmp/nostr_keys.json 
{
  "npub_hex": "74c802bb5f9422bed33d9d505e5cd356b0a6fdab1d3ea6e64dcb709cf5b65669",
  "nsec_hex": "dc230e2f0473dd25a871e1cba22af79dadf3ce0863887594ce4080c22fbccd57"
}
root@GL-AR300M:/tmp# ./generate_keys.sh 
Nostr keys are already present and valid in /tmp/nostr_keys.json
root@GL-AR300M:/tmp# cat /tmp/nostr_keys.json 
{
  "npub_hex": "74c802bb5f9422bed33d9d505e5cd356b0a6fdab1d3ea6e64dcb709cf5b65669",
  "nsec_hex": "dc230e2f0473dd25a871e1cba22af79dadf3ce0863887594ce4080c22fbccd57"
}
root@GL-AR300M:/tmp# rm /tmp/nostr_keys.json 
root@GL-AR300M:/tmp# ./generate_keys.sh 
/tmp/nostr_keys.json does not exist or is empty.
./generate_keys.sh: line 40: ./install/install_keygen.sh: not found
Nostr keys are already present and valid in /tmp/nostr_keys.json
Nostr keys generated and saved to /tmp/nostr_keys.json
root@GL-AR300M:/tmp# cat /tmp/nostr_keys.json 
{
  "npub_hex": "1ab1f189c97140405ab1232826f48c899fec46fc9b055f5e614e87485246296b",
  "nsec_hex": "7089825c93d91c0339d8d333c70bd5762b1d22485ed2e3d20b9298630e12c582"
}
chGoodchild commented 3 months ago

After one line setup:

root@GL-AR300M:/nostr/shell# ./test_nostr_functionality.sh 
Nostr keys are already present and valid in /www/cgi-bin/nostr_keys.json
SUCCESS: nostr_keys.json exists and is not empty.
Downloading checksums.json...
Downloading /tmp/sign_event_mips...
Checksum verification passed for /tmp/sign_event_mips
Setting execute permission on /tmp/sign_event_mips
["EVENT", {
  "id": "a6f1622a905b7a6574d647fe7b7ae53f6d69e2bfafd3d0585cef95ae76697719",
  "pubkey": "3682654af36e115577a96ffa34147e09bfaf2b6d837a4a982a1634c5e67618af",
  "created_at": 1724356015,
  "kind": 1,
  "tags": [],
  "content": "Hello, Nostr from mips@1724356008",
  "sig": "b519f22bb09ed6e2ee8be98048884c5a2e9c1a3a96ba9ae11584d40a91264df2d72dbc68dd3634368817c3ca500a33a4d8d1d4871f7da2a312f29c9a64e1ec2e"
} ]
SUCCESS: /tmp/send.json exists and is not empty.
[2024/08/22 19:47:05:2247] N: lws_create_context: LWS: 4.3.2-unknown, NET CLI SRV H1 H2 WS ConMon IPV6-on
[2024/08/22 19:47:05:2265] N: __lws_lc_tag:  ++ [wsi|0|pipe] (1)
[2024/08/22 19:47:05:2277] N: __lws_lc_tag:  ++ [vh|0|netlink] (1)
[2024/08/22 19:47:05:2293] N: __lws_lc_tag:  ++ [vh|1|default||-1] (2)
[2024/08/22 19:47:07:7882] N: __lws_lc_tag:  ++ [wsicli|0|WS/h1/default/orangesync.tech] (1)
[2024/08/22 19:47:08:0265] N: lws_gate_accepts: on = 0
[2024/08/22 19:47:08:2727] N: lws_gate_accepts: on = 0
[2024/08/22 19:47:08:3798] N: __lws_lc_untag:  -- [wsi|0|pipe] (0) 3.153s
[2024/08/22 19:47:08:3825] N: lws_gate_accepts: on = 0
[2024/08/22 19:47:08:4106] N: __lws_lc_untag:  -- [vh|1|default||-1] (1) 3.181s
[2024/08/22 19:47:08:4123] N: __lws_lc_untag:  -- [wsicli|0|WS/h1/default/orangesync.tech] (0) 624.070ms
[2024/08/22 19:47:08:4146] N: __lws_lc_untag:  -- [vh|0|netlink] (0) 3.186s
SUCCESS: publish.sh ran successfully and the event was accepted by the relay.
[2024/08/22 19:47:10:6365] N: lws_create_context: LWS: 4.3.2-unknown, NET CLI SRV H1 H2 WS ConMon IPV6-on
[2024/08/22 19:47:10:6385] N: __lws_lc_tag:  ++ [wsi|0|pipe] (1)
[2024/08/22 19:47:10:6396] N: __lws_lc_tag:  ++ [vh|0|netlink] (1)
[2024/08/22 19:47:10:6417] N: __lws_lc_tag:  ++ [vh|1|default||-1] (2)
[2024/08/22 19:47:13:1941] N: __lws_lc_tag:  ++ [wsicli|0|WS/h1/default/orangesync.tech] (1)
[2024/08/22 19:47:13:2468] N: lws_gate_accepts: on = 0
[2024/08/22 19:47:13:5165] N: lws_gate_accepts: on = 0
[2024/08/22 19:47:13:6165] N: __lws_lc_untag:  -- [wsi|0|pipe] (0) 2.977s
[2024/08/22 19:47:13:6193] N: lws_gate_accepts: on = 0
[2024/08/22 19:47:13:6482] N: __lws_lc_untag:  -- [vh|1|default||-1] (1) 3.006s
[2024/08/22 19:47:13:6499] N: __lws_lc_untag:  -- [wsicli|0|WS/h1/default/orangesync.tech] (0) 455.823ms
[2024/08/22 19:47:13:6522] N: __lws_lc_untag:  -- [vh|0|netlink] (0) 3.012s
SUCCESS: fetch_notes.sh ran successfully and the event was fetched.
\nAll tests passed successfully.
root@GL-AR300M:/nostr/shell# cat /www/cgi-bin/nostr_keys.json 
{
  "npub_hex": "d003d60dafc173c6f97957ab3349c8eb76709d13aa89795070937466fa65c9a6",
  "nsec_hex": "05e8c273591ddd496091e01062ed9dbcbf04f2c7d79941791e06aca84290fa67"
}