src/Keypear.Shared/KyprClient.cs
/// <summary>
/// Refreshed vaults are initially in the locked state.
/// </summary>
Refreshed vaults are initially in the locked state.
Refreshed vaults are initially in the locked state .
public async Task RefreshVaultsAsync()
    {
        if (Account == null)
        {
            throw new InvalidOperationException("no account associated with this client");
        }
        foreach (var v in Vaults)
        {
            LockRecords(v);
            LockVault(v);
        }
        Vaults.Clear();
        var vaultIds = await _server.ListVaultsAsync();
        foreach (var vid in vaultIds)
        {
            var vaultDetails = (await _server.GetVaultAsync(vid))!;
            var recordsDetails = await _server.GetRecordsAsync(vid);
            var vault = new Vault()
            {
                Id = vaultDetails.VaultId,
                SecretKeyAlgor = _ske.Algor,
                SecretKeyEnc = vaultDetails.SecretKeyEnc,
                SummaryEnc = vaultDetails.SummaryEnc,
            };
            foreach (var rd in recordsDetails)
            {
                vault.Records.Add(new()
                {
                    Id = rd.RecordId,
                    SummaryEnc = rd.SummaryEnc,
                    ContentEnc = rd.ContentEnc,
                });
            }
            Vaults.Add(vault);
        }
    }
public async Task RefreshVaultsAsync ( ) { if ( Account == null ) { throw new InvalidOperationException ( " " ) ; } foreach ( var v in Vaults ) { LockRecords ( v ) ; LockVault ( v ) ; } Vaults . Clear ( ) ; var vaultIds = await _server . ListVaultsAsync ( ) ; foreach ( var vid in vaultIds ) { var vaultDetails = ( await _server . GetVaultAsync ( vid ) ) ! ; var recordsDetails = await _server . GetRecordsAsync ( vid ) ; var vault = new Vault ( ) { Id = vaultDetails . VaultId , SecretKeyAlgor = _ske . Algor , SecretKeyEnc = vaultDetails . SecretKeyEnc , SummaryEnc = vaultDetails . SummaryEnc , } ; foreach ( var rd in recordsDetails ) { vault . Records . Add ( new ( ) { Id = rd . RecordId , SummaryEnc = rd . SummaryEnc , ContentEnc = rd . ContentEnc , } ) ; } Vaults . Add ( vault ) ; } }
Refreshed vaults are initially in the locked state.
Refreshed vaults are initially in the locked state .
// First we lock and clear any cached Vaults // Assemble and store the Vaults and Records into a "locked" state