diff --git a/src/auth/nip98.js b/src/auth/nip98.js index 42e2751..2f00b31 100644 --- a/src/auth/nip98.js +++ b/src/auth/nip98.js @@ -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, diff --git a/src/git-remote-pear.js b/src/git-remote-pear.js index 6aac563..68e7852 100755 --- a/src/git-remote-pear.js +++ b/src/git-remote-pear.js @@ -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) diff --git a/src/list-remote.js b/src/list-remote.js index 576fadb..a3fbe0b 100644 --- a/src/list-remote.js +++ b/src/list-remote.js @@ -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)