mirror of
https://github.com/Yonle/bostr.git
synced 2025-03-17 21:32:43 +01:00
some helper.
Signed-off-by: Yonle <yonle@lecturify.net>
This commit is contained in:
parent
74c2e4c21f
commit
3be8e325e1
@ -39,8 +39,13 @@ module.exports = {
|
||||
|
||||
// Warning: Ensure that <authorized_keys> is NOT empty so only <authorized_keys> could access this bostr bouncer
|
||||
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.
|
||||
// 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) => {
|
||||
if (!privkey) return;
|
||||
if (privkey.startsWith("nsec")) privkey = nip19.decode(privkey).data;
|
||||
|
||||
let signed_challenge = {
|
||||
pubkey,
|
||||
created_at: Math.floor(Date.now() / 1000),
|
||||
|
Loading…
x
Reference in New Issue
Block a user