mirror of
https://github.com/aljazceru/gitpear.git
synced 2025-12-17 14:14:22 +01:00
@@ -1,6 +1,7 @@
|
|||||||
const { nip98, nip19, finalizeEvent } = require('nostr-tools')
|
const { nip98, nip19, finalizeEvent } = require('nostr-tools')
|
||||||
|
|
||||||
async function getToken({ url, method, data }) {
|
async function getToken({ url, method, data }) {
|
||||||
|
if (!process.env.GIT_PEAR_AUTH_NSEC) throw new Error('Missing NSEC')
|
||||||
const { data: sK } = nip19.decode(process.env.GIT_PEAR_AUTH_NSEC)
|
const { data: sK } = nip19.decode(process.env.GIT_PEAR_AUTH_NSEC)
|
||||||
return nip98.getToken(
|
return nip98.getToken(
|
||||||
url,
|
url,
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ const repoName = matches[2]
|
|||||||
|
|
||||||
const store = new Corestore(RAM)
|
const store = new Corestore(RAM)
|
||||||
const swarmOpts = {}
|
const swarmOpts = {}
|
||||||
if (process.env.GIT_PEAR_AUTH && process.env.GIT_PEAR_AUTH !== 'native') {
|
if (process.env.GIT_PEAR_AUTH === 'native') {
|
||||||
swarmOpts.keyPair = home.getKeyPair()
|
swarmOpts.keyPair = home.getKeyPair()
|
||||||
}
|
}
|
||||||
const swarm = new Hyperswarm(swarmOpts)
|
const swarm = new Hyperswarm(swarmOpts)
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ module.exports = async function listRemote (url) {
|
|||||||
console.log('Connecting to:', targetKey)
|
console.log('Connecting to:', targetKey)
|
||||||
|
|
||||||
const swarmOpts = {}
|
const swarmOpts = {}
|
||||||
if (process.env.GIT_PEAR_AUTH && process.env.GIT_PEAR_AUTH !== 'native') {
|
if (process.env.GIT_PEAR_AUTH === 'native') {
|
||||||
swarmOpts.keyPair = home.getKeyPair()
|
swarmOpts.keyPair = home.getKeyPair()
|
||||||
}
|
}
|
||||||
const swarm = new Hyperswarm(swarmOpts)
|
const swarm = new Hyperswarm(swarmOpts)
|
||||||
|
|||||||
Reference in New Issue
Block a user