Skip to content

Commit

Permalink
Use Url to construct wallet url in login
Browse files Browse the repository at this point in the history
  • Loading branch information
janedegtiareva committed Jul 10, 2019
1 parent 0126866 commit afe0b7d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,12 @@ exports.login = async function(options) {
if (!options.walletUrl) {
console.log("Log in is not needed on this environment. Please use appropriate master account for shell operations.")
} else {
const title = 'Near Shell';
const newUrl = new URL(options.walletUrl);
const title = 'NEAR Shell';
newUrl.searchParams.set('title', title);
const keyPair = await KeyPair.fromRandom('ed25519');
console.log(`Please navigate to this url and follow the insturctions to log in: ` +
`${options.walletUrl}/login/?title=${title}&public_key=${keyPair.getPublicKey()}&account_id=${options.accountId}`);
newUrl.searchParams.set('public_key', keyPair.getPublicKey());
newUrl.searchParams.set('account_id', options.accountId)
console.log(`Please navigate to this url and follow the insturctions to log in: ${newUrl.toString()}`);
}
}

0 comments on commit afe0b7d

Please sign in to comment.