// TODO: Make a test for this! // TODO: Extract some of the code and put it some place else. private Vault(Blob blob, byte[] encryptionKey) { ParserHelper.WithBytes(blob.Bytes, reader => { var chunks = ParserHelper.ExtractChunks(reader); if (!IsComplete(chunks)) throw new ParseException(ParseException.FailureReason.CorruptedBlob, "Blob is truncated"); Accounts = ParseAccounts(chunks, encryptionKey); }); }
// TODO: Make a test for this! public static Vault Create(Blob blob, string username, string password) { return new Vault(blob, blob.MakeEncryptionKey(username, password)); }