-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhancing the profile manager to selectively show the password tab, contingent upon the presence of securely hashed credentials stored in the local storage. #509
Conversation
…e is credentials hashed and stored in the local storage.
Enter doesn't respect Mnemonic value connector_issue_1.mp4Using keydown.enter will cause some unexpected cases; It's better to use <form> with onsubmit event as it won't fire event if the button is disabled |
let mountedTimeout: any; | ||
watch( | ||
() => props.modelValue, | ||
m => { | ||
if (m) { | ||
if (mountedTimeout) { | ||
clearTimeout(mountedTimeout); | ||
} | ||
mountedTimeout = setTimeout(() => { | ||
mounted(); | ||
}); | ||
} | ||
}, | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't use setTimeout
api to wait as it might lead to unexpected results like old playground
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Used requestAnimationFrame
instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't use requestAnimationFrame
either.
Please check nextTick
import { nextTick } from "vue"
nextTicket().then(mounte)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Mahmoud-Emad any updates?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be done
|
||
function getCredentials() { | ||
const getCredentials = localStorage.getItem("wallet"); | ||
let credentials: Credentials = {}; | ||
|
||
if (getCredentials) { | ||
credentials = JSON.parse(getCredentials); | ||
} | ||
return credentials; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function getCredentials() { | |
const getCredentials = localStorage.getItem("wallet"); | |
let credentials: Credentials = {}; | |
if (getCredentials) { | |
credentials = JSON.parse(getCredentials); | |
} | |
return credentials; | |
} | |
const version = 1; // for example | |
const WALLET_KEY = "wallet.v" + version | |
function getCredentials() { | |
const getCredentials = localStorage.getItem(WALLET_KEY); | |
let credentials: Credentials = {}; | |
if (getCredentials) { | |
credentials = JSON.parse(getCredentials); | |
} | |
return credentials; | |
} |
Support versioning for wallet as we might change how we manage password and mnemonic from time to time.
let's imagine if we changed the storing way when the user open his browser it will be broken as we will be expecting another way of parsing data and here versioning comes into play it won't respect any wallet beside the new one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's assume that we changed the version of storing the wallet, in that case, we have to update the version
, which is the way we're going to update the wallet
key, in both cases we have to change the key, what is the difference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updating the version should be done whenever we change the behaviour of the wallet so it will break the user browser
@AhmedHanafy725
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the version will make it easier to migrate from the old key to the new one. if the same key is used, you will have to check which one is used first and then decide whether to migrate to the new one or not.
…r_shared_password Clear profile manager fields when switching between Login and Connect
Description
It enhances the profile manager to selectively show the password tab, contingent upon the presence of securely hashed credentials stored in the local storage.
Changes
passwordHash
andmnemonicHash
fields to represent securely hashed credentials.Credentials
interface likegetCredentials
,setCredentials
andisStoredCredentials
to facilitate the handling and retrieval of stored credentials.login
orconnect
functions when the Enter key is pressed on the password input, provided there are no validation errors.Store and login
button text toConnect
Related Issues
Screenshots
Update
Checklist