Skip to content

Commit

Permalink
Add team to shared folder
Browse files Browse the repository at this point in the history
  • Loading branch information
sk-keeper committed Nov 7, 2024
1 parent ff70564 commit 6644d72
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 39 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,5 @@ nuget.config

Help/
.vscode/

packages.config
12 changes: 0 additions & 12 deletions Commander/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,10 @@
</appSettings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.4.1" newVersion="4.0.4.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.4.0" newVersion="4.1.4.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
6 changes: 3 additions & 3 deletions Commander/Commander.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@
<Reference Include="CommandLine, Version=2.9.1.0, Culture=neutral, PublicKeyToken=5a870481e358d379, processorArchitecture=MSIL">
<HintPath>..\packages\CommandLineParser.2.9.1\lib\net461\CommandLine.dll</HintPath>
</Reference>
<Reference Include="Google.Protobuf, Version=3.27.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
<HintPath>..\packages\Google.Protobuf.3.27.1\lib\net45\Google.Protobuf.dll</HintPath>
<Reference Include="Google.Protobuf, Version=3.28.3.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
<HintPath>..\packages\Google.Protobuf.3.28.3\lib\net45\Google.Protobuf.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
Expand All @@ -70,7 +70,7 @@
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.5.3\lib\netstandard2.0\System.Memory.dll</HintPath>
<HintPath>..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
Expand Down
5 changes: 1 addition & 4 deletions Commander/packages.config
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="CommandLineParser" version="2.9.1" targetFramework="net472" />
<package id="Google.Protobuf" version="3.27.1" targetFramework="net472" />
<package id="Portable.BouncyCastle" version="1.9.0" targetFramework="net472" />
<package id="System.Buffers" version="4.5.1" targetFramework="net472" />
<package id="System.Memory" version="4.5.3" targetFramework="net472" />
<package id="System.Memory" version="4.5.5" targetFramework="net472" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net472" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.3" targetFramework="net472" />
</packages>
14 changes: 4 additions & 10 deletions KeeperSdk/KeeperSdk.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net452</TargetFrameworks>
<LangVersion>7.1</LangVersion>
<Version>1.0.6-beta02</Version>
<Version>1.0.6</Version>
<Authors>Keeper Security Inc.</Authors>
<Product>.NET Keeper Sdk</Product>
<PackageTags>keeper password manager</PackageTags>
Expand All @@ -13,8 +13,8 @@
<RepositoryType>Github</RepositoryType>
<PackageProjectUrl>https://github.com/Keeper-Security/keeper-sdk-dotnet</PackageProjectUrl>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<AssemblyVersion>1.0.6.40</AssemblyVersion>
<FileVersion>1.0.6.40</FileVersion>
<AssemblyVersion>1.0.6.41</AssemblyVersion>
<FileVersion>1.0.6.41</FileVersion>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects>
<IncludeSymbols>true</IncludeSymbols>
Expand Down Expand Up @@ -44,19 +44,13 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Google.Protobuf" Version="3.27.1" />
<PackageReference Include="Google.Protobuf" Version="3.28.3" />
<PackageReference Include="Portable.BouncyCastle" Version="1.9.0" />
</ItemGroup>

<ItemGroup>
<Reference Include="System.Web" Condition="'$(TargetFramework)' == 'net452'" />
<Reference Include="System.Net.Http" Condition="'$(TargetFramework)' == 'net452'" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="System.Runtime.CompilerServices.Unsafe">
<Version>4.5.3</Version>
</PackageReference>
</ItemGroup>

</Project>
5 changes: 4 additions & 1 deletion KeeperSdk/vault/SharedFolderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,11 @@ public async Task PutUserToSharedFolder(string sharedFolderUid,
else
{
byte[] encryptedSharedFolderKey;
EncryptedKeyType keyType;
if (TryGetTeam(userId, out var team))
{
encryptedSharedFolderKey = CryptoUtils.EncryptAesV1(sharedFolder.SharedFolderKey, team.TeamKey);
keyType = EncryptedKeyType.EncryptedByDataKey;
}
else
{
Expand All @@ -106,6 +108,7 @@ public async Task PutUserToSharedFolder(string sharedFolderUid,

var tpk = CryptoUtils.LoadPublicKey(tk.key.Base64UrlDecode());
encryptedSharedFolderKey = CryptoUtils.EncryptRsa(sharedFolder.SharedFolderKey, tpk);
keyType = EncryptedKeyType.EncryptedByPublicKey;
}

request.SharedFolderAddTeam.Add(new Folder.SharedFolderUpdateTeam
Expand All @@ -116,7 +119,7 @@ public async Task PutUserToSharedFolder(string sharedFolderUid,
TypedSharedFolderKey = new EncryptedDataKey
{
EncryptedKey = ByteString.CopyFrom(encryptedSharedFolderKey),
EncryptedKeyType = EncryptedKeyType.EncryptedByPublicKey,
EncryptedKeyType = keyType,
}
});
}
Expand Down
7 changes: 2 additions & 5 deletions Tests/DataVault.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ protected Task<byte[]> MockExecuteRest(string endpoint, ApiRequestPayload payloa

public static class DataVault
{
internal const string TestClientVersion = "c15.0.0";
internal const string TestClientVersion = "c16.0.0";

public const string DefaultEnvironment = "env.company.com";

Expand Down Expand Up @@ -331,10 +331,7 @@ public static IConfigurationStorage GetConfigurationStorage()
};
storage.Servers.Put(serverConf);

var userConf = new UserConfiguration(UserName)
{
Password = UserPassword
};
var userConf = new UserConfiguration(UserName);
storage.Users.Put(userConf);
storage.LastServer = DefaultEnvironment;
storage.LastLogin = UserName;
Expand Down
8 changes: 4 additions & 4 deletions Tests/Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="xunit" Version="2.8.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.1"><IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2"><IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Moq" Version="4.20.70" />
<PackageReference Include="Moq" Version="4.20.72" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit 6644d72

Please sign in to comment.