Closed tibroc closed 7 months ago
In the file encrypted_cookie_manager.py from the package streamlit_cookies_manager. Change this:
@st.cache
def key_from_parameters(salt: bytes, iterations: int, password: str):
kdf = PBKDF2HMAC(
algorithm=hashes.SHA256(),
length=32,
salt=salt,
iterations=iterations,
)
return base64.urlsafe_b64encode(kdf.derive(password.encode('utf-8')))
to this
@st.cache_data
def key_from_parameters(salt: bytes, iterations: int, password: str):
kdf = PBKDF2HMAC(
algorithm=hashes.SHA256(),
length=32,
salt=salt,
iterations=iterations,
)
return base64.urlsafe_b64encode(kdf.derive(password.encode('utf-8')))
That should solve the issue.
The package seems to be unmaintained since three years, we should switch to another, or we need to maintain this ourselves.
Ok, I'll check it out
Maybe something like https://discuss.streamlit.io/t/streamlit-cookies-which-package-to-use-so-many-of-them/50500
I remember now why I chose this package. The one of extra_streamlit_components apparently has the issue of not working with a docker container
https://discuss.streamlit.io/t/cookies-support-in-streamlit/16144/50?page=2
I am using the cookies manager with following code. my code works in local environment, but i need to deploy my application in a docker container, and surprisingly application is not able to store cookies there, and not even throwing any error.
In the meantime, installing this: https://github.com/ktosiek/streamlit-cookies-manager/pull/7/commits/6bf9704f0813f69bc770da2192bd718749ae2d4b
Should solve the deprecated error message without having to change any files manually. I updated the requirements
https://docs.streamlit.io/library/advanced-features/caching