Error: no auth mechanism defined

I am trying to use the storj.es6.js library and trying to play around with the basic methods.

var storj = new Storj();

const encryptionKey = storj.generateEncryptionKey()
console.log(“Encryption Key:”, encryptionKey)
const storjInstance = new Storj({
bridge: ‘’,
basicAuth: {
user: ‘’,
password: ‘password’,
encryptionKey: encryptionKey
const keypair = storjInstance.generateKeyPair()

const privateKey = keypair.getPrivateKey()
const publicKey = keypair.getPublicKey()

console.log(“Private key:”, privateKey)
console.log(“Public key:”, publicKey)

storj.on(‘ready’, function () {
storjInstance.registerKey(publicKey, (err, res) => {console.log(err,res)})

However, the registerKey methods throws this error:

request.js:120 POST net::ERR_NAME_NOT_RESOLVED

Error: no auth mechanism defined
at Auth.onRequest (auth.js:133)
at Request.auth (request.js:1360)
at Request.init (request.js:378)
at new Request (request.js:130)
at request (index.js:54)
at _request (index.js:1213)
at retryAttempt (async.js:4410)
at Object.retry (async.js:4419)
at BridgeClient._request (index.js:1228)
at BridgeClient.addPublicKey (index.js:203) undefined

any ideas how to authenticate?

You trying to use a deprecated v2 protocol library, it will not work, because v2 has been shutdown a year ago,
Please, use the v3 bindings instead:

1 Like