Stellar Bifrost JS SDK Getting error says params.recoveryPublicKey is invalid

Stellar Bifrost JS SDK Getting error says params.recoveryPublicKey is invalid

Manage alerts

Loading saved threads...

SamSmith · External communityPost link
External question — Stellar Stack Exchange Author: SamSmith Original post: https://stellar.stackexchange.com/questions/4170 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. 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'); } } } },
Quote
Report
SamSmith · External communityPost link
External answer — Stellar Stack Exchange Author: SamSmith Original post: https://stellar.stackexchange.com/a/4174 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. 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'. =) =(
Quote
Report

Post Reply

Quoted from Forex.com.bd-Editorial External question — Stellar Stack Exchange Author: SamSmith Source score (net votes, not local likes): 0 Original post: https://stellar.stackexchange.com/questions/4170 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. 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'); } } } },

Cancel quote

Checking account access…