src/Keypear.Shared/KyprClient.cs
/// <summary>
/// Newly created vaults are inintially in the unlocked state.
/// </summary>
Newly created vaults are inintially in the unlocked state.
Newly created vaults are inintially in the unlocked state .
public async Task<Vault> CreateVaultAsync(string label)
    {
        if (Account == null)
        {
            throw new InvalidOperationException("no account associated with this client");
        }
        var vault = new Vault();
        vault.Summary = new();
        vault.Summary.Label = label;
        vault.SecretKeyAlgor = _ske.Algor;
        vault.SecretKey = _ske.GenerateKey();
        vault.SecretKeyEnc = _ske.Encrypt(vault.SecretKey, Account.MasterKey!);
        vault.SummarySer = KpMsgPack.Ser(vault.Summary);
        vault.SummaryEnc = _ske.Encrypt(vault.SummarySer, vault.SecretKey);
        var details = await _server.CreateVaultAsync(new()
        {
            SecretKeyEnc = vault.SecretKeyEnc,
            SummaryEnc = vault.SummaryEnc,
        });
        vault.Id = details.VaultId;
        Vaults.Add(vault);
        return vault;
    }
public async Task < Vault > CreateVaultAsync ( string label ) { if ( Account == null ) { throw new InvalidOperationException ( " " ) ; } var vault = new Vault ( ) ; vault . Summary = new ( ) ; vault . Summary . Label = label ; vault . SecretKeyAlgor = _ske . Algor ; vault . SecretKey = _ske . GenerateKey ( ) ; vault . SecretKeyEnc = _ske . Encrypt ( vault . SecretKey , Account . MasterKey ! ) ; vault . SummarySer = KpMsgPack . Ser ( vault . Summary ) ; vault . SummaryEnc = _ske . Encrypt ( vault . SummarySer , vault . SecretKey ) ; var details = await _server . CreateVaultAsync ( new ( ) { SecretKeyEnc = vault . SecretKeyEnc , SummaryEnc = vault . SummaryEnc , } ) ; vault . Id = details . VaultId ; Vaults . Add ( vault ) ; return vault ; }
Newly created vaults are inintially in the unlocked state.
Newly created vaults are inintially in the unlocked state .
label
string