Skip to content

Commit 7434797

Browse files
committed
Release 1.2.1
1 parent 2c2da31 commit 7434797

File tree

12 files changed

+918
-23
lines changed

12 files changed

+918
-23
lines changed

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
## Change log
2+
3+
### Release 1.2.1
4+
- Support Markdown in Notes field
5+
- Support PassXYZ data format
6+
7+
### Release 1.2.0
8+
- Added PassXYZLib
9+
- Support KPCLibPy
10+
11+
### Release 1.1.9
12+
- Removed dependency of Xamarin.Forms so it can be built with any .Netstandard apps
13+
- Using SkiaSharp to handle Bitmap which is supported by .Netstandard and .Net Core
14+
- Removed UWP test app and added .Net Core test app

KPCLib.xunit/KPCLib.xunit.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
<Target Name="CopyDataFiles" AfterTargets="Build">
2525
<ItemGroup>
2626
<DataFiles Include="$(ProjectDir)\utdb.kdbx" />
27+
<DataFiles Include="$(ProjectDir)\pass_d_E8f4pEk.xyz" />
2728
</ItemGroup>
2829

2930
<Copy SourceFiles="@(DataFiles)" DestinationFolder="$(TargetDir)\" SkipUnchangedFiles="true" />

KPCLib.xunit/PassXYZLibTests.cs

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Diagnostics;
4+
using System.Text;
5+
6+
using Xunit;
7+
using KeePassLib;
8+
using KeePassLib.Keys;
9+
using KeePassLib.Security;
10+
using KeePassLib.Serialization;
11+
using KeePassLib.Utility;
12+
using PassXYZLib;
13+
14+
namespace KPCLib.xunit
15+
{
16+
public class PassXYZLibFixture : IDisposable
17+
{
18+
const string TEST_DB = "pass_d_E8f4pEk.xyz";
19+
const string TEST_DB_KEY = "12345";
20+
21+
public PassXYZLibFixture()
22+
{
23+
Logger = new KPCLibLogger();
24+
PxDb = new PxDatabase();
25+
IOConnectionInfo ioc = IOConnectionInfo.FromPath(TEST_DB);
26+
CompositeKey cmpKey = new CompositeKey();
27+
cmpKey.AddUserKey(new KcpPassword(TEST_DB_KEY));
28+
PxDb.Open(ioc, cmpKey, Logger);
29+
}
30+
31+
public void Dispose()
32+
{
33+
PxDb.Close();
34+
}
35+
36+
public PxDatabase PxDb { get; private set; }
37+
public KPCLibLogger Logger { get; private set; }
38+
39+
public string Username {
40+
get { return PxDefs.GetUserNameFromDataFile(TEST_DB); }
41+
}
42+
}
43+
44+
[CollectionDefinition("PassXYZLib collection")]
45+
public class PassXYZLibCollection : ICollectionFixture<PassXYZLibFixture>
46+
{
47+
// This class has no code, and is never created. Its purpose is simply
48+
// to be the place to apply [CollectionDefinition] and all the
49+
// ICollectionFixture<> interfaces.
50+
}
51+
52+
[Collection("PassXYZLib collection")]
53+
public class PassXYZLibTests
54+
{
55+
PassXYZLibFixture passxyz;
56+
57+
public PassXYZLibTests(PassXYZLibFixture passXYZLibFixture)
58+
{
59+
this.passxyz = passXYZLibFixture;
60+
}
61+
62+
[Fact]
63+
public void IsOpenDbTest()
64+
{
65+
Debug.WriteLine($"{passxyz.PxDb}, Username is {passxyz.Username}.");
66+
Assert.True((passxyz.PxDb.IsOpen));
67+
}
68+
69+
[Fact]
70+
public void CurrentGroupTests()
71+
{
72+
var currentGroup = passxyz.PxDb.CurrentGroup;
73+
Debug.WriteLine($"{currentGroup}");
74+
Assert.NotNull(currentGroup);
75+
}
76+
77+
[Fact]
78+
public void CurrentPathTests()
79+
{
80+
var currentPath = passxyz.PxDb.CurrentPath;
81+
Debug.WriteLine($"Current path is {currentPath}.");
82+
Assert.NotNull(currentPath);
83+
}
84+
85+
[Theory]
86+
[InlineData("/test1/WebDAV")]
87+
/// <summary>
88+
/// Change a protect field
89+
/// </summary>
90+
/// <param name="path">Destination path. Must not be <c>null</c>.</param>
91+
public void ChangeProtectedFieldTests(string path)
92+
{
93+
var entry = passxyz.PxDb.FindByPath<PwEntry>(path);
94+
95+
Debug.WriteLine($"Current path is {entry}.");
96+
// Update the existing protected field
97+
PxDefs.UpdatePxEntry(entry, PxDefs.PasswordField, "123456", true);
98+
Assert.True(entry.Strings.Get(PxDefs.FindEncodeKey(entry.Strings, PxDefs.PasswordField)).IsProtected);
99+
// Add a new protected field "PIN"
100+
PxDefs.UpdatePxEntry(entry, "PIN", "1234", true);
101+
Assert.True(entry.Strings.Get(PxDefs.FindEncodeKey(entry.Strings, "PIN")).IsProtected);
102+
// Remove a field
103+
PxDefs.UpdatePxEntry(entry, "002Email", String.Empty, false);
104+
foreach (KeyValuePair<string, ProtectedString> kvp in entry.Strings)
105+
{
106+
Debug.WriteLine($" {kvp.Key}={kvp.Value.ReadString()}, IsProtected={kvp.Value.IsProtected}");
107+
}
108+
109+
}
110+
111+
// The end of PassXYZLibTests
112+
}
113+
114+
}

KPCLib.xunit/PxDatabaseTests.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212

1313
namespace KPCLib.xunit
1414
{
15-
public class PassXYZFixture : IDisposable
15+
public class PxDatabaseFixture : IDisposable
1616
{
1717
const string TEST_DB = "utdb.kdbx";
1818
const string TEST_DB_KEY = "12345";
1919

20-
public PassXYZFixture()
20+
public PxDatabaseFixture()
2121
{
2222
Logger = new KPCLibLogger();
2323
PxDb = new PxDatabase();
@@ -37,7 +37,7 @@ public void Dispose()
3737
}
3838

3939
[CollectionDefinition("PxDatabase collection")]
40-
public class PxDatabaseCollection : ICollectionFixture<PassXYZFixture>
40+
public class PxDatabaseCollection : ICollectionFixture<PxDatabaseFixture>
4141
{
4242
// This class has no code, and is never created. Its purpose is simply
4343
// to be the place to apply [CollectionDefinition] and all the
@@ -47,9 +47,9 @@ public class PxDatabaseCollection : ICollectionFixture<PassXYZFixture>
4747
[Collection("PxDatabase collection")]
4848
public class PxDatabaseTests
4949
{
50-
PassXYZFixture passxyz;
50+
PxDatabaseFixture passxyz;
5151

52-
public PxDatabaseTests(PassXYZFixture passXYZFixture)
52+
public PxDatabaseTests(PxDatabaseFixture passXYZFixture)
5353
{
5454
this.passxyz = passXYZFixture;
5555
}
@@ -382,7 +382,7 @@ public class PxLibInfoTests
382382
public void PxLibVersion()
383383
{
384384
Debug.WriteLine($"{PxLibInfo.Version}");
385-
Assert.Equal(PxLibInfo.Version, new System.Version("1.2.0.1"));
385+
Assert.Equal(PxLibInfo.Version, new System.Version("1.2.1.0"));
386386
}
387387

388388
[Fact]

KPCLib.xunit/pass_d_E8f4pEk.xyz

4.32 KB
Binary file not shown.

KPCLib/KPCLib.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<OutputType>Library</OutputType>
77
<StartupObject />
88
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
9-
<Version>1.2.0</Version>
9+
<Version>1.2.1</Version>
1010
<PackageLicenseUrl>https://github.com/passxyz/KPCLib/blob/master/LICENSE</PackageLicenseUrl>
1111
<PackageProjectUrl>https://github.com/passxyz/KPCLib</PackageProjectUrl>
1212
<RepositoryUrl>https://github.com/passxyz/KPCLib</RepositoryUrl>
@@ -22,8 +22,8 @@
2222

2323
1.1.6 - KPCLib has been tested on all three platforms (Android, iOS and UWP).</PackageReleaseNotes>
2424
<NeutralLanguage>en-US</NeutralLanguage>
25-
<AssemblyVersion>1.2.0.1</AssemblyVersion>
26-
<FileVersion>1.2.0.1</FileVersion>
25+
<AssemblyVersion>1.2.1.0</AssemblyVersion>
26+
<FileVersion>1.2.1.0</FileVersion>
2727
</PropertyGroup>
2828

2929
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">

0 commit comments

Comments
 (0)