I'm saving a password value on a "site" model using the Password::make field.
I would then like to display this password decrypted when a user with the correct privileges (which I already have working) presses an inline button "show password" on the detail view or index view.
I've tried using :
Text::make('Decrypted', function () {
return decrypt($this->password);
})
But unfortunately this gives me an "incorrect payload" error.
Any ideas?
Hashes Are Irreversible
Your password was hashed and not encrypted.
You should now that Laravel uses one way hash functions.
A one-way hash function is a mathematical function which takes a plain text input string and converts it into a fixed-length binary sequence. Furthermore, a one-way hash function is designed in such a way that it is hard to reverse the process, that is, to find a string that hashes to a given value (hence the name one-way.) A good hash function also makes it hard to find two strings that would produce the same hash value.
Besides
Showing a user's password on screen, especially in a web app, is likely a security vulnerability and may render the system vulnerable to script injection, screen reader, or man in the middle attacks.