Blazor Server how to encrypt string in javascript and read result in razor component

I’m in need to retrieve a string save with javascript in the _Layout.cshtml with a simple

localStorage.setItem("MyString", strngValue);

and retrieve that value inside a Razor component.
I receive the value from an external service before anything is rendered but if I try to retrieve it I get and encryption error:

    var _savedString = await ProtLocalStore.GetAsync<string>("MyString");
    string SavedString = _savedString.Success ? _savedString.Value : "";

The error is risen at the await … GetAsync… statement.

If I check Chorme or Edge DevTools in the Application Tab I have noticed that the string I’m saving is not encrypted, so I guess the problem is that when the Blazor Razor Component reads it it’s not able to decrypt something that is not encrypted the it’s expected.

Any help is appreciated.