mirror of
https://github.com/Yonle/bostr.git
synced 2025-11-18 01:46:46 +01:00
@@ -39,8 +39,13 @@ module.exports = {
|
|||||||
|
|
||||||
// Warning: Ensure that <authorized_keys> is NOT empty so only <authorized_keys> could access this bostr bouncer
|
// Warning: Ensure that <authorized_keys> is NOT empty so only <authorized_keys> could access this bostr bouncer
|
||||||
private_keys: {
|
private_keys: {
|
||||||
// "pubkey-in-hex": "privatekey"
|
// "pubkey-in-hex": "privatekey",
|
||||||
|
// "pubkey-in-hex": "nsec ...."
|
||||||
}
|
}
|
||||||
|
// Tip: If you want to convert your pubkey/privatekey to hex,
|
||||||
|
// You could run the following command:
|
||||||
|
// $ node hexconverter.js npub....
|
||||||
|
// $ node hexconverter.js nsec....
|
||||||
|
|
||||||
// Server information.
|
// Server information.
|
||||||
// Only for when nostr client requesting server information.
|
// Only for when nostr client requesting server information.
|
||||||
|
|||||||
8
hexconverter.js
Normal file
8
hexconverter.js
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
const { nip19 } = require("nostr-tools");
|
||||||
|
const argv = process.argv.slice(2);
|
||||||
|
|
||||||
|
if (!argv.length) return console.log("Usage: node hexconverter.js <npub....|nsec....> ....");
|
||||||
|
|
||||||
|
for (i of argv) {
|
||||||
|
console.log(nip19.decode(i).data);
|
||||||
|
}
|
||||||
4
nip42.js
4
nip42.js
@@ -1,7 +1,9 @@
|
|||||||
const { getEventHash, getSignature } = require("nostr-tools");
|
const { getEventHash, getSignature, nip19 } = require("nostr-tools");
|
||||||
|
|
||||||
module.exports = (relay, pubkey, privkey, challenge) => {
|
module.exports = (relay, pubkey, privkey, challenge) => {
|
||||||
if (!privkey) return;
|
if (!privkey) return;
|
||||||
|
if (privkey.startsWith("nsec")) privkey = nip19.decode(privkey).data;
|
||||||
|
|
||||||
let signed_challenge = {
|
let signed_challenge = {
|
||||||
pubkey,
|
pubkey,
|
||||||
created_at: Math.floor(Date.now() / 1000),
|
created_at: Math.floor(Date.now() / 1000),
|
||||||
|
|||||||
Reference in New Issue
Block a user