mirror of
https://github.com/aljazceru/gitpear.git
synced 2025-12-17 06:04:25 +01:00
@@ -1,6 +1,7 @@
|
||||
const { nip98, nip19, finalizeEvent } = require('nostr-tools')
|
||||
|
||||
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)
|
||||
return nip98.getToken(
|
||||
url,
|
||||
|
||||
@@ -29,7 +29,7 @@ const repoName = matches[2]
|
||||
|
||||
const store = new Corestore(RAM)
|
||||
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()
|
||||
}
|
||||
const swarm = new Hyperswarm(swarmOpts)
|
||||
|
||||
@@ -18,7 +18,7 @@ module.exports = async function listRemote (url) {
|
||||
console.log('Connecting to:', targetKey)
|
||||
|
||||
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()
|
||||
}
|
||||
const swarm = new Hyperswarm(swarmOpts)
|
||||
|
||||
Reference in New Issue
Block a user