SHA256
Добавить аватар профиля через Arweave и мастер загрузки
This commit is contained in:
@@ -65,6 +65,20 @@ export async function loadEncryptedUserSecrets(login, storagePwd) {
|
||||
return decryptJsonWithStoragePwd(row.encrypted, storagePwd);
|
||||
}
|
||||
|
||||
export async function updateEncryptedUserSecrets(login, storagePwd, updater) {
|
||||
if (typeof updater !== 'function') {
|
||||
throw new Error('updateEncryptedUserSecrets: updater должен быть функцией');
|
||||
}
|
||||
|
||||
const current = await loadEncryptedUserSecrets(login, storagePwd);
|
||||
const next = await updater(current);
|
||||
if (!next || typeof next !== 'object') {
|
||||
throw new Error('updateEncryptedUserSecrets: updater должен вернуть объект secrets');
|
||||
}
|
||||
await saveEncryptedUserSecrets(login, storagePwd, next);
|
||||
return next;
|
||||
}
|
||||
|
||||
export async function saveSessionMaterial(login, material) {
|
||||
await put(STORE_SESSIONS, {
|
||||
login,
|
||||
|
||||
Reference in New Issue
Block a user