0

As per the instructions I modified the example.html file from https://github.com/stellar-deprecated/bifrost-js-sdk

I set the params as follows:

var params = {
    network: 'test',
    horizonURL: 'https://horizon-testnet.stellar.org',
    bifrostURL: 'http://localhost:8000',
    recoveryPublicKey: 'GBJWOWMXNBW2UOWIXHVVTUBTIWBOAB2MV7YCQ4UF5TLZV7VS53CJHDFY'
  };

But I get the error: params.recoveryPublicKey is invalid Because the instructions say this parameter is optional, I deleted it as follows:


var params = {
    network: 'test',
    horizonURL: 'https://horizon-testnet.stellar.org',
    bifrostURL: 'http://localhost:8002',
    horizonAllowHttp: true
  };

And as expected no longer got the error.

My questions is why am I getting the error? I am using the same format for the recoveryPublicKey as example.html and the key is valid.

Here is the code that generates the error:

 if (params.recoveryPublicKey !== undefined) {
            if (!_stellarSdk.StrKey.isValidEd25519PublicKey(params.recoveryPublicKey)) {
              throw new Error('params.recoveryPublicKey is invalid');
            }

Its part of this script in bifrost.js for the JS SDK

{
        key: '_checkParams',
        value: function _checkParams(params) {
          if (params === undefined) {
            throw new Error("params not provided");
          }

          if (['live', 'test'].indexOf(params.network) == -1) {
            throw new Error("Invalid params.network");
          }

          var requiredParams = ['bifrostURL', 'horizonURL'];
          var _iteratorNormalCompletion = true;
          var _didIteratorError = false;
          var _iteratorError = undefined;

          try {
            for (var _iterator = requiredParams[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
              var param = _step.value;

              if (typeof params[param] != 'string') {
                throw new Error('params.' + param + ' required and must be of type \'string\'');
              }
            }
          } catch (err) {
            _didIteratorError = true;
            _iteratorError = err;
          } finally {
            try {
              if (!_iteratorNormalCompletion && _iterator['return']) {
                _iterator['return']();
              }
            } finally {
              if (_didIteratorError) {
                throw _iteratorError;
              }
            }
          }

          if (params.recoveryPublicKey !== undefined) {
            if (!_stellarSdk.StrKey.isValidEd25519PublicKey(params.recoveryPublicKey)) {
              throw new Error('params.recoveryPublicKey is invalid');
            }
          }
        }
      },



1
  • I restarted the servers a couple of times and the error went away. Has not returned. =( so I don't know what was going on.
    – SamSmith
    Jun 28, 2020 at 1:59

1 Answer 1

0

I restarted the servers and browser and cleared the cache a couple of times and the error went away. Now it works with recoveryPublicKey: 'GBJWOWMXNBW2UOWIXHVVTUBTIWBOAB2MV7YCQ4UF5TLZV7VS53CJHDFY'. =) =(

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.