diff options
Diffstat (limited to 'wrappers')
55 files changed, 0 insertions, 4054 deletions
diff --git a/wrappers/csharp/.gitignore b/wrappers/csharp/.gitignore deleted file mode 100644 index 115bb34..0000000 --- a/wrappers/csharp/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -bin/ -obj/ -/packages/ -.vs/ diff --git a/wrappers/csharp/Discovery.cs b/wrappers/csharp/Discovery.cs deleted file mode 100644 index 21c979f..0000000 --- a/wrappers/csharp/Discovery.cs +++ /dev/null @@ -1,157 +0,0 @@ -using System; -using System.Diagnostics; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Text; - -// Make InsecureTestingSetExtraKey visible to tests -[assembly: InternalsVisibleTo("EduVpnCommonTests")] - -namespace EduVpnCommon -{ - public static class Discovery - { - /// <summary> - /// Verifies the signature on the JSON server_list.json/organization_list.json file. - /// If the function returns, the signature is valid for the given file type. - /// </summary> - /// <param name="signatureFileContent">.minisig signature file contents.</param> - /// <param name="signedJson">Signed .json file contents.</param> - /// <param name="expectedFileName">The file type to be verified, one of <c>"server_list.json"</c> or <c>"organization_list.json"</c>.</param> - /// <param name="minSignTime">Minimum time for signature. Should be set to at least the time of the previous signature.</param> - /// <exception cref="ArgumentException">If <c>expectedFileName</c> is not one of the allowed values.</exception> - /// <exception cref="VerifyException">If signature verification fails.</exception> - public static void Verify( - ArraySegment<byte> signatureFileContent, // Span<byte> would be nicer, but is not available in .NET Standard 2.0 - ArraySegment<byte> signedJson, - string expectedFileName, - DateTimeOffset minSignTime) - { - VerifyReturnCode result; - { - using var signatureHandle = GoSliceHandle.FromArray(signatureFileContent); - using var jsonHandle = GoSliceHandle.FromArray(signedJson); - using var expectedFileHandle = GoSliceHandle.FromString(expectedFileName); - - result = Verify(signatureHandle.Slice, jsonHandle.Slice, expectedFileHandle.Slice, - (ulong) minSignTime.ToUnixTimeSeconds()); - } - - switch (result) - { - case VerifyReturnCode.Ok: - return; - case VerifyReturnCode.ErrUnknownExpectedFileName: - throw new ArgumentException("unknown expected file name", nameof(expectedFileName)); - case VerifyReturnCode.ErrInvalidSignature: - throw new InvalidSignatureException(); - case VerifyReturnCode.ErrInvalidSignatureUnknownKey: - throw new InvalidSignatureUnknownKeyException(); - case VerifyReturnCode.ErrTooOld: - throw new SignatureTooOldException(); - default: - throw new UnknownVerifyException((sbyte) result); - } - } - - /// <summary>Use for testing only, see Go documentation.</summary> - internal static void InsecureTestingSetExtraKey(string keyString) - { - using var keyHandle = GoSliceHandle.FromString(keyString); - InsecureTestingSetExtraKey(keyHandle.Slice); - } - - const string LibName = "eduvpn_common"; - - [DllImport(LibName)] - static extern VerifyReturnCode Verify(GoSlice signatureFileContent, GoSlice signedJson, GoSlice expectedFileName, ulong minSignTime); - - [DllImport(LibName)] static extern void InsecureTestingSetExtraKey(GoSlice keyStr); - - /// <summary> - /// Safe auto-disposing Go slice handle. - /// Non-copying alternative to `Marshal.AllocHGlobal` etc. - /// </summary> - class GoSliceHandle : IDisposable - { - GCHandle gcHandle_; - readonly GoSlice slice_; - - public GoSlice Slice => gcHandle_.IsAllocated - ? slice_ - : throw new InvalidOperationException("Handle was disposed"); - - GoSliceHandle(Array array, int offset, int count) - { - Debug.Assert(offset <= array.Length && /*prevent overflow:*/ count <= array.Length && offset <= array.Length - count); - gcHandle_ = GCHandle.Alloc(array, GCHandleType.Pinned); - var elemSize = Marshal.SizeOf(array.GetType().GetElementType()!); - slice_ = new GoSlice(gcHandle_.AddrOfPinnedObject() + offset * elemSize, count * elemSize); - } - - public static GoSliceHandle FromArray<T>(ArraySegment<T> segment) where T : struct => - new GoSliceHandle(segment.Array!, segment.Offset, segment.Count); - - /// <summary>From string as UTF-8.</summary> - public static GoSliceHandle FromString(string str) => - FromArray(new ArraySegment<byte>(Encoding.UTF8.GetBytes(str))); - - public void Dispose() => gcHandle_.Free(); - } - - // C-compatible structure - readonly struct GoSlice - { - readonly IntPtr data_; - readonly long len_, cap_; - - public GoSlice(IntPtr data, long len, long cap) - { - data_ = data; - len_ = len; - cap_ = cap; - } - - public GoSlice(IntPtr data, long len) : this(data, len, len) { } - } - } - - /// <summary>Verification failed, do not trust the file.</summary> - public abstract class VerifyException : Exception - { - protected VerifyException(string message) : base(message) { } - } - - /// <summary>Signature is invalid (for the expected file type).</summary> - public sealed class InvalidSignatureException : VerifyException - { - public InvalidSignatureException() : base("invalid signature") { } - } - - /// <summary>Signature was created with an unknown key and has not been verified.</summary> - public sealed class InvalidSignatureUnknownKeyException : VerifyException - { - public InvalidSignatureUnknownKeyException() : base("invalid signature (unknown key)") { } - } - - /// <summary>Signature timestamp smaller than specified minimum signing time (rollback).</summary> - public sealed class SignatureTooOldException : VerifyException - { - public SignatureTooOldException() : base("replay of previous signature (rollback)") { } - } - - /// <summary>Other unknown error.</summary> - public sealed class UnknownVerifyException : VerifyException - { - public UnknownVerifyException(sbyte code) : base($"unknown verify error ({code})") => Debug.Assert(code != 0); - } - - enum VerifyReturnCode : sbyte - { - Ok, - ErrUnknownExpectedFileName, - ErrInvalidSignature, - ErrInvalidSignatureUnknownKey, - ErrTooOld - } -} diff --git a/wrappers/csharp/EduVpnCommon.csproj b/wrappers/csharp/EduVpnCommon.csproj deleted file mode 100644 index 587601c..0000000 --- a/wrappers/csharp/EduVpnCommon.csproj +++ /dev/null @@ -1,73 +0,0 @@ -<Project Sdk="Microsoft.NET.Sdk"> - - <PropertyGroup> - <TargetFramework>netstandard2.0</TargetFramework> - <LangVersion>8</LangVersion> - <Nullable>enable</Nullable> - <PackageId>EduVpn.Common</PackageId> - <PackageVersion>0.1.0</PackageVersion> - <Authors /> - <Description>Common EduVpn logic</Description> - <Product>EduVpn</Product> - </PropertyGroup> - - <ItemGroup> - <Compile Remove="EduVpnCommonTests/**" /> - <EmbeddedResource Remove="EduVpnCommonTests/**" /> - <None Remove="EduVpnCommonTests/**" /> - </ItemGroup> - - <!-- Include EXPORTS_LIB_PATH, LIB_NAME definitions --> - <ImportGroup Label="PropertySheets"> - <Import Project="EduVpnCommon.props" /> - </ImportGroup> - - <Target Name="Build library for current OS" BeforeTargets="PrepareForBuild" - Condition="!(Exists('$(EXPORTS_LIB_PATH)/windows/amd64/$(LIB_NAME).dll') - Or Exists('$(EXPORTS_LIB_PATH)/windows/386/$(LIB_NAME).dll') - Or Exists('$(EXPORTS_LIB_PATH)/windows/arm/$(LIB_NAME).dll') - Or Exists('$(EXPORTS_LIB_PATH)/windows/arm64/$(LIB_NAME).dll') - Or Exists('$(EXPORTS_LIB_PATH)/linux/amd64/lib$(LIB_NAME).so') - Or Exists('$(EXPORTS_LIB_PATH)/linux/arm/lib$(LIB_NAME).so') - Or Exists('$(EXPORTS_LIB_PATH)/linux/arm64/lib$(LIB_NAME).so'))"> - <Message Text="!! Shared $(LIB_NAME) library not found, you should build that one first" Importance="high" /> - </Target> - - <ItemGroup> - <!-- - See https://docs.microsoft.com/en-us/nuget/create-packages/supporting-multiple-target-frameworks#architecture-specific-folders - and https://docs.microsoft.com/en-us/dotnet/core/rid-catalog - --> - - <None Condition="Exists('$(EXPORTS_LIB_PATH)/windows/amd64/$(LIB_NAME).dll')" - Include="$(EXPORTS_LIB_PATH)/windows/amd64/$(LIB_NAME).dll" Pack="true" PackagePath="runtimes/win-x64/native/"> - <CopyToOutputDirectory>Always</CopyToOutputDirectory> - </None> - <None Condition="Exists('$(EXPORTS_LIB_PATH)/windows/386/$(LIB_NAME).dll')" - Include="$(EXPORTS_LIB_PATH)/windows/386/$(LIB_NAME).dll" Pack="true" PackagePath="runtimes/win-x86/native/"> - <CopyToOutputDirectory>Always</CopyToOutputDirectory> - </None> - <None Condition="Exists('$(EXPORTS_LIB_PATH)/windows/arm/$(LIB_NAME).dll')" - Include="$(EXPORTS_LIB_PATH)/windows/arm/$(LIB_NAME).dll" Pack="true" PackagePath="runtimes/win-arm/native/"> - <CopyToOutputDirectory>Always</CopyToOutputDirectory> - </None> - <None Condition="Exists('$(EXPORTS_LIB_PATH)/windows/arm64/$(LIB_NAME).dll')" - Include="$(EXPORTS_LIB_PATH)/windows/arm64/$(LIB_NAME).dll" Pack="true" PackagePath="runtimes/win-arm64/native/"> - <CopyToOutputDirectory>Always</CopyToOutputDirectory> - </None> - - <None Condition="Exists('$(EXPORTS_LIB_PATH)/linux/amd64/lib$(LIB_NAME).so')" - Include="$(EXPORTS_LIB_PATH)/linux/amd64/lib$(LIB_NAME).so" Pack="true" PackagePath="runtimes/linux-x64/native/"> - <CopyToOutputDirectory>Always</CopyToOutputDirectory> - </None> - <None Condition="Exists('$(EXPORTS_LIB_PATH)/linux/arm/lib$(LIB_NAME).so')" - Include="$(EXPORTS_LIB_PATH)/linux/arm/lib$(LIB_NAME).so" Pack="true" PackagePath="runtimes/linux-arm/native/"> - <CopyToOutputDirectory>Always</CopyToOutputDirectory> - </None> - <None Condition="Exists('$(EXPORTS_LIB_PATH)/linux/arm64/lib$(LIB_NAME).so')" - Include="$(EXPORTS_LIB_PATH)/linux/arm64/lib$(LIB_NAME).so" Pack="true" PackagePath="runtimes/linux-arm64/native/"> - <CopyToOutputDirectory>Always</CopyToOutputDirectory> - </None> - </ItemGroup> - -</Project> diff --git a/wrappers/csharp/EduVpnCommon.props b/wrappers/csharp/EduVpnCommon.props deleted file mode 100644 index 97c2289..0000000 --- a/wrappers/csharp/EduVpnCommon.props +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <PropertyGroup> - <EXPORTS_LIB_PATH Condition="'$(EXPORTS_LIB_PATH)' == ''">$(SolutionDir)../../exports/lib</EXPORTS_LIB_PATH> - <LIB_NAME Condition="'$(LIB_NAME)' == ''">eduvpn_common</LIB_NAME> - </PropertyGroup> -</Project> diff --git a/wrappers/csharp/EduVpnCommon.sln b/wrappers/csharp/EduVpnCommon.sln deleted file mode 100644 index 0d59e2f..0000000 --- a/wrappers/csharp/EduVpnCommon.sln +++ /dev/null @@ -1,22 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EduVpnCommon", "EduVpnCommon.csproj", "{D95F43A0-EF74-41FD-A526-8987151ABB30}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EduVpnCommonTests", "EduVpnCommonTests/EduVpnCommonTests.csproj", "{B7A75F1A-C83F-4FAB-AD16-E9DB7EF58EBC}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {D95F43A0-EF74-41FD-A526-8987151ABB30}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D95F43A0-EF74-41FD-A526-8987151ABB30}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D95F43A0-EF74-41FD-A526-8987151ABB30}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D95F43A0-EF74-41FD-A526-8987151ABB30}.Release|Any CPU.Build.0 = Release|Any CPU - {B7A75F1A-C83F-4FAB-AD16-E9DB7EF58EBC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B7A75F1A-C83F-4FAB-AD16-E9DB7EF58EBC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B7A75F1A-C83F-4FAB-AD16-E9DB7EF58EBC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B7A75F1A-C83F-4FAB-AD16-E9DB7EF58EBC}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection -EndGlobal diff --git a/wrappers/csharp/EduVpnCommonTests/EduVpnCommonTests.csproj b/wrappers/csharp/EduVpnCommonTests/EduVpnCommonTests.csproj deleted file mode 100644 index 9a44848..0000000 --- a/wrappers/csharp/EduVpnCommonTests/EduVpnCommonTests.csproj +++ /dev/null @@ -1,19 +0,0 @@ -<Project Sdk="Microsoft.NET.Sdk"> - - <PropertyGroup> - <TargetFramework>net5.0</TargetFramework> - <IsPackable>false</IsPackable> - </PropertyGroup> - - <ItemGroup> - <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" /> - <PackageReference Include="NUnit" Version="3.13.1" /> - <PackageReference Include="NUnit3TestAdapter" Version="3.17.0" /> - <PackageReference Include="coverlet.collector" Version="3.0.2" /> - </ItemGroup> - - <ItemGroup> - <ProjectReference Include="../EduVpnCommon.csproj" /> - </ItemGroup> - -</Project> diff --git a/wrappers/csharp/EduVpnCommonTests/VerifyTests.cs b/wrappers/csharp/EduVpnCommonTests/VerifyTests.cs deleted file mode 100644 index fba2161..0000000 --- a/wrappers/csharp/EduVpnCommonTests/VerifyTests.cs +++ /dev/null @@ -1,82 +0,0 @@ -using System; -using System.IO; -using System.Linq; -using EduVpnCommon; -using NUnit.Framework; - -namespace EduVpnCommonTests -{ - [TestFixture(TestOf = typeof(Discovery)), Parallelizable] - public class VerifyTests - { - // Relative to e.g. EduVpnCommonTests/bin/Debug/net5.0 - readonly string testDataDir_ = $"{TestContext.CurrentContext.TestDirectory}/../../../../../../src/test_data"; - - [OneTimeSetUp] - public void OneTimeSetUp() => - Discovery.InsecureTestingSetExtraKey(File.ReadLines($"{testDataDir_}/public.key").Last()); - - [Test] - [TestCase("server_list.json.minisig", "server_list.json", "server_list.json")] - [TestCase("organization_list.json.minisig", "organization_list.json", "organization_list.json")] - public void TestValid(string sigFile, string jsonFile, string expectedFileName) => - Discovery.Verify( - File.ReadAllBytes($"{testDataDir_}/{sigFile}"), - File.ReadAllBytes($"{testDataDir_}/{jsonFile}"), - expectedFileName, - DateTimeOffset.FromUnixTimeSeconds(10)); - - [Test] - [TestCase("server_list.json.minisig", "server_list.json", "server_list.json")] - public void TestValidSegment(string sigFile, string jsonFile, string expectedFileName) - { - var bytes = new byte[] { 1, 2, 3 }.Concat(File.ReadAllBytes($"{testDataDir_}/{jsonFile}")) - .Concat(new byte[] { 1, 2, 3 }).ToArray(); - Discovery.Verify( - File.ReadAllBytes($"{testDataDir_}/{sigFile}"), - new(bytes, 3, bytes.Length - 3 - 3), - expectedFileName, - DateTimeOffset.UnixEpoch); - } - - [Test] - [TestCase("random.txt", "server_list.json", "server_list.json")] - public void TestInvalidSignature(string sigFile, string jsonFile, string expectedFileName) => - Assert.Throws<InvalidSignatureException>( - () => Discovery.Verify( - File.ReadAllBytes($"{testDataDir_}/{sigFile}"), - File.ReadAllBytes($"{testDataDir_}/{jsonFile}"), - expectedFileName, - DateTimeOffset.UnixEpoch)); - - [Test] - [TestCase("server_list.json.wrong_key.minisig", "server_list.json", "server_list.json")] - public void TestWrongKey(string sigFile, string jsonFile, string expectedFileName) => - Assert.Throws<InvalidSignatureUnknownKeyException>( - () => Discovery.Verify( - File.ReadAllBytes($"{testDataDir_}/{sigFile}"), - File.ReadAllBytes($"{testDataDir_}/{jsonFile}"), - expectedFileName, - DateTimeOffset.UnixEpoch)); - - [Test] - [TestCase("server_list.json.minisig", "server_list.json", "server_list.json")] - public void TestOldSignature(string sigFile, string jsonFile, string expectedFileName) => - Assert.Throws<SignatureTooOldException>( - () => Discovery.Verify( - File.ReadAllBytes($"{testDataDir_}/{sigFile}"), - File.ReadAllBytes($"{testDataDir_}/{jsonFile}"), - expectedFileName, - DateTimeOffset.FromUnixTimeSeconds(11))); - - [Test] - [TestCase("other_list.json.minisig", "other_list.json", "other_list.json")] - public void TestUnknownExpectedFile(string sigFile, string jsonFile, string expectedFileName) => - Assert.Throws<ArgumentException>( - () => Discovery.Verify( - File.ReadAllBytes($"{testDataDir_}/{sigFile}"), - File.ReadAllBytes($"{testDataDir_}/{jsonFile}"), - expectedFileName, - DateTimeOffset.UnixEpoch)); - } -} diff --git a/wrappers/csharp/Makefile b/wrappers/csharp/Makefile deleted file mode 100644 index 187ddbd..0000000 --- a/wrappers/csharp/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -.PHONY: build pack test clean - -EXPORTS_PATH ?= ../../exports -include $(EXPORTS_PATH)/common.mk - -# Export, see EduVpnCommon.props -export EXPORTS_LIB_PATH - -build: - dotnet publish EduVpnCommon.csproj --configuration Release - -pack: - dotnet pack EduVpnCommon.csproj --configuration Release - -test: .try-build-lib - dotnet test - -clean: - rm -rf bin/ obj/ EduVpnCommonTests/bin/ EduVpnCommonTests/obj/ diff --git a/wrappers/csharp/README.md b/wrappers/csharp/README.md deleted file mode 100644 index 1ff1123..0000000 --- a/wrappers/csharp/README.md +++ /dev/null @@ -1,43 +0,0 @@ -# C# wrapper - -## Requirements - -You will need to install the [.NET SDK](https://dotnet.microsoft.com/download), which includes the `dotnet` tool. The -wrapper targets .NET Standard 2.0, which means that at least .NET Core 2.0 is required (.NET 5+ is also fine). For the -tests, .NET 5 is required. (Or change `<TargetFramework>` in EduVpnCommonTests.csproj to e.g. `net6.0` to use newer -versions.) - -## Build & test - -First build the shared Go library. Next: - -Build `EduVpnCommon` (Release): - -```shell -make -``` - -Build as nupkg, including shared Go library for all platforms built in `exports/lib/`: - -```shell -make pack -``` - -If you do not build this as part of the full repository, specify `EXPORTS_PATH="path/to/exports-folder"` -when calling make. This folder must contain `common.mk` and the `lib/` folder with built libraries. - -The wrapper targets .NET Standard 2.0, which means that it can be referenced by projects using either .NET Framework -4.6.1+, .NET Core 2.0+, or .NET 5+. - -Currently, directly referencing the project may not work (with `System.BadImageFormatException`) if you have multiple -dynamic libraries compiled in the `exports/lib/` folder. If you instead add the `.nupkg`, e.g. with one of the -methods [here](https://stackoverflow.com/q/43400069) or [here](https://stackoverflow.com/q/10240029), it automatically -copies the correct library. - -This also means that tests may fail if you have multiple dynamic libraries compiled! - -Test: - -```shell -make test -``` diff --git a/wrappers/java-android/.gitignore b/wrappers/java-android/.gitignore deleted file mode 100644 index 41445b2..0000000 --- a/wrappers/java-android/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -*.iml -.gradle/ -.idea/ -/build/ -/captures/ -.cxx/ -.externalNativeBuild/ -CMakeFiles/ -local.properties diff --git a/wrappers/java-android/Makefile b/wrappers/java-android/Makefile deleted file mode 100644 index c60b074..0000000 --- a/wrappers/java-android/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -.PHONY: build pack android-test connected-android-test test clean - -EXPORTS_PATH ?= ../../exports -include $(EXPORTS_PATH)/common.mk - -ifeq ($(NO_DAEMON),1) -override GRADLE_FLAGS += --no-daemon -endif - -build: - ./gradlew $(GRADLE_FLAGS) assembleRelease - -pack: build - -# Unit tests use library for desktop OS platform, so we still need .try-build-lib for this -# The unit tests find this library through the library path set in common.mk -unit-test: .try-build-lib - ./gradlew $(GRADLE_FLAGS) test - -android-test: - ./gradlew $(GRADLE_FLAGS) pixel2DebugAndroidTest - -connected-android-test: - ./gradlew $(GRADLE_FLAGS) connectedAndroidTest - -test: .try-build-lib -ifeq ($(NO_EMULATOR),1) - ./gradlew $(GRADLE_FLAGS) test -else - ./gradlew $(GRADLE_FLAGS) test pixel2DebugAndroidTest -endif - -clean: - rm -rf lib/build lib/.cxx lib/CMakeFiles lib/src/test/resources/* -ifeq ($(CLEAN_ALL),1) - rm -rf .gradle/ -endif diff --git a/wrappers/java-android/README.md b/wrappers/java-android/README.md deleted file mode 100644 index 50e1868..0000000 --- a/wrappers/java-android/README.md +++ /dev/null @@ -1,89 +0,0 @@ -# Android (Java) wrapper - -## Requirements - -You will need to install the JDK compatible with Gradle and the Android Gradle plugin. Gradle specifies -a [maximum supported JDK version](https://docs.gradle.org/current/userguide/compatibility.html), while the Android -Gradle plugin specifies a [minimum supported JDK version](https://developer.android.com/studio/releases/gradle-plugin) ( -see 'Compatibility' table for the right Gradle version). Additionally, the Android Gradle plugin requires -a [certain Gradle version range](https://developer.android.com/studio/releases/gradle-plugin#updating-gradle). Lastly, ( -older versions of) Android Studio and especially IntelliJ Ultimate may not support some newer Android Gradle plugin -versions. - -If you see `Unsupported class file major version xx` then Gradle wants you to use an older Java version. If you -see `Android Gradle plugin requires Java xx to run.` then the Android Gradle plugin wants you to use a newer Java -version. Set `JAVA_HOME` to the right JDK install. - -See the [list of Gradle releases](https://github.com/gradle/gradle/releases) -and [list of Android Gradle plugin releases](https://maven.google.com/web/?q=com.android.tools.build#com.android.tools.build:gradle) -. - -Versions are managed per project by -the [Gradle wrapper](https://docs.gradle.org/current/userguide/gradle_wrapper.html) (see `gradle*` files). -Run `./gradlew --version` to get the project Gradle version. Look at the dependencies in `/build.gradle` for the current -Android Gradle plugin version. This means that you do not need to install Gradle separately yourself. - -Currently, versions are Gradle 7.0.2 and Android Gradle plugin 7.0.4, which means you have to install a **JDK with a -version between 11 and 16**. If desired, these can be upgraded to e.g. 7.4 and 7.1.1 respectively without problems, but -as mentioned, IDE support may be limited with newer versions. The Gradle wrapper may be updated using -e.g. `./gradlew wrapper --gradle-version 7.4`. After that, the Android Gradle plugin may be updated by changing the -version in `/build.gradle`. - -You will also need the Android SDK, which comes with [Android Studio](https://developer.android.com/studio/). - -## Build & test - -Build AAR (Gradle will also run unit tests): - -```shell -make -``` - -This will build an AAR in `lib/build/outputs/aar`, which will include the shared Go library for all Android -architectures, which it will build using the Android NDK via CMake, which calls `make` with the right compiler. - -Run unit tests without an Android emulator: - -```shell -make unit-test -``` - -This will build the library for your current desktop OS and use that. - -Run Android instrumented tests on a new emulator: - -```shell -make android-test -``` - -This uses [Gradle managed virtual devices](https://developer.android.com/studio/preview/features#gmd). This experimental -feature is enabled in `gradle.properties`. It is normal that tests that pass are not logged. - -Run Android instrumented tests on an already running emulator: - -```shell -make connected-android-test -``` - -This will be faster when used multiple times, as the emulator is reused. - -Run both unit tests and Android instrumented tests on a new emulator: - -```shell -make test -``` - -For all commands you can specify options to pass to Gradle via `GRADLE_FLAGS=`, e.g. `GRADLE_FLAGS=--info`. -Specify `NO_DAEMON=1` to add `--no-daemon`. - -## Notes - -The same Java code is used for the Android instrumented tests as for the unit tests. Both use Java resources that are -copied from the `../../src/test_data` folder by Gradle. - -This library uses JNA, not JNI. Hence, there is no C wrapper. The library is dynamically opened with `dlopen` -via `libjnidispatch.so` which comes with the JNA AAR. - -If you want to know how the tests would look like with JUnit 5, or if for some reason you want to look at a pure Java -wrapper using Maven, -see [`b60ecf2`](https://github.com/stevenwdv/eduvpn-common/tree/b60ecf2fe5ddfe506e02093286b3931873187e91/wrappers/java). diff --git a/wrappers/java-android/build.gradle b/wrappers/java-android/build.gradle deleted file mode 100644 index c9f995e..0000000 --- a/wrappers/java-android/build.gradle +++ /dev/null @@ -1,23 +0,0 @@ -// Top-level build file where you can add configuration options common to all sub-projects/modules. -buildscript { - repositories { - google() - mavenCentral() - } - dependencies { - classpath 'com.android.tools.build:gradle:7.0.4' - - // NOTE: Do not place your application dependencies here; they belong - // in the individual module build.gradle files - } -} - -allprojects { - tasks.withType(JavaCompile) { - options.deprecation = true - } -} - -task clean(type: Delete) { - delete rootProject.buildDir -} diff --git a/wrappers/java-android/gradle.properties b/wrappers/java-android/gradle.properties deleted file mode 100644 index 4b5f10f..0000000 --- a/wrappers/java-android/gradle.properties +++ /dev/null @@ -1,24 +0,0 @@ -# Project-wide Gradle settings. -# IDE (e.g. Android Studio) users: -# Gradle settings configured through the IDE *will override* -# any settings specified in this file. -# For more details on how to configure your build environment visit -# http://www.gradle.org/docs/current/userguide/build_environment.html -# Specifies the JVM arguments used for the daemon process. -# The setting is particularly useful for tweaking memory settings. -org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 -# When configured, Gradle will run in incubating parallel mode. -# This option should only be used with decoupled projects. More details, visit -# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects -# org.gradle.parallel=true -# AndroidX package structure to make it clearer which packages are bundled with the -# Android operating system, and which are packaged with your app's APK -# https://developer.android.com/topic/libraries/support-library/androidx-rn -android.useAndroidX=true -# Automatically convert third-party libraries to use AndroidX -android.enableJetifier=true -# Enable all warnings -org.gradle.warning.mode=all -# Enable Gradle managed devices for older Android plugin versions -android.experimental.androidTest.useUnifiedTestPlatform=true -# To test with ATD images (but native stuff seems to malfunction?): android.sdk.channel=3 diff --git a/wrappers/java-android/gradle/wrapper/gradle-wrapper.jar b/wrappers/java-android/gradle/wrapper/gradle-wrapper.jar Binary files differdeleted file mode 100644 index 7454180..0000000 --- a/wrappers/java-android/gradle/wrapper/gradle-wrapper.jar +++ /dev/null diff --git a/wrappers/java-android/gradle/wrapper/gradle-wrapper.properties b/wrappers/java-android/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 0f80bbf..0000000 --- a/wrappers/java-android/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/wrappers/java-android/gradlew b/wrappers/java-android/gradlew deleted file mode 100755 index 1b6c787..0000000 --- a/wrappers/java-android/gradlew +++ /dev/null @@ -1,234 +0,0 @@ -#!/bin/sh - -# -# Copyright © 2015-2021 the original authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -############################################################################## -# -# Gradle start up script for POSIX generated by Gradle. -# -# Important for running: -# -# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is -# noncompliant, but you have some other compliant shell such as ksh or -# bash, then to run this script, type that shell name before the whole -# command line, like: -# -# ksh Gradle -# -# Busybox and similar reduced shells will NOT work, because this script -# requires all of these POSIX shell features: -# * functions; -# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», -# «${var#prefix}», «${var%suffix}», and «$( cmd )»; -# * compound commands having a testable exit status, especially «case»; -# * various built-in commands including «command», «set», and «ulimit». -# -# Important for patching: -# -# (2) This script targets any POSIX shell, so it avoids extensions provided -# by Bash, Ksh, etc; in particular arrays are avoided. -# -# The "traditional" practice of packing multiple parameters into a -# space-separated string is a well documented source of bugs and security -# problems, so this is (mostly) avoided, by progressively accumulating -# options in "$@", and eventually passing that to Java. -# -# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, -# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; -# see the in-line comments for details. -# -# There are tweaks for specific operating systems such as AIX, CygWin, -# Darwin, MinGW, and NonStop. -# -# (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt -# within the Gradle project. -# -# You can find Gradle at https://github.com/gradle/gradle/. -# -############################################################################## - -# Attempt to set APP_HOME - -# Resolve links: $0 may be a link -app_path=$0 - -# Need this for daisy-chained symlinks. -while - APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path - [ -h "$app_path" ] -do - ls=$( ls -ld "$app_path" ) - link=${ls#*' -> '} - case $link in #( - /*) app_path=$link ;; #( - *) app_path=$APP_HOME$link ;; - esac -done - -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" -APP_BASE_NAME=${0##*/} - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD=maximum - -warn () { - echo "$*" -} >&2 - -die () { - echo - echo "$*" - echo - exit 1 -} >&2 - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "$( uname )" in #( - CYGWIN* ) cygwin=true ;; #( - Darwin* ) darwin=true ;; #( - MSYS* | MINGW* ) msys=true ;; #( - NONSTOP* ) nonstop=true ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD=$JAVA_HOME/jre/sh/java - else - JAVACMD=$JAVA_HOME/bin/java - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then - case $MAX_FD in #( - max*) - MAX_FD=$( ulimit -H -n ) || - warn "Could not query maximum file descriptor limit" - esac - case $MAX_FD in #( - '' | soft) :;; #( - *) - ulimit -n "$MAX_FD" || - warn "Could not set maximum file descriptor limit to $MAX_FD" - esac -fi - -# Collect all arguments for the java command, stacking in reverse order: -# * args from the command line -# * the main class name -# * -classpath -# * -D...appname settings -# * --module-path (only if needed) -# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. - -# For Cygwin or MSYS, switch paths to Windows format before running java -if "$cygwin" || "$msys" ; then - APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) - - JAVACMD=$( cygpath --unix "$JAVACMD" ) - - # Now convert the arguments - kludge to limit ourselves to /bin/sh - for arg do - if - case $arg in #( - -*) false ;; # don't mess with options #( - /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath - [ -e "$t" ] ;; #( - *) false ;; - esac - then - arg=$( cygpath --path --ignore --mixed "$arg" ) - fi - # Roll the args list around exactly as many times as the number of - # args, so each arg winds up back in the position where it started, but - # possibly modified. - # - # NB: a `for` loop captures its iteration list before it begins, so - # changing the positional parameters here affects neither the number of - # iterations, nor the values presented in `arg`. - shift # remove old arg - set -- "$@" "$arg" # push replacement arg - done -fi - -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. - -set -- \ - "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ - "$@" - -# Use "xargs" to parse quoted args. -# -# With -n1 it outputs one arg per line, with the quotes and backslashes removed. -# -# In Bash we could simply go: -# -# readarray ARGS < <( xargs -n1 <<<"$var" ) && -# set -- "${ARGS[@]}" "$@" -# -# but POSIX shell has neither arrays nor command substitution, so instead we -# post-process each arg (as a line of input to sed) to backslash-escape any -# character that might be a shell metacharacter, then use eval to reverse -# that process (while maintaining the separation between arguments), and wrap -# the whole thing up as a single "set" statement. -# -# This will of course break if any of these variables contains a newline or -# an unmatched quote. -# - -eval "set -- $( - printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | - xargs -n1 | - sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | - tr '\n' ' ' - )" '"$@"' - -exec "$JAVACMD" "$@" diff --git a/wrappers/java-android/gradlew.bat b/wrappers/java-android/gradlew.bat deleted file mode 100755 index 107acd3..0000000 --- a/wrappers/java-android/gradlew.bat +++ /dev/null @@ -1,89 +0,0 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/wrappers/java-android/lib/.gitignore b/wrappers/java-android/lib/.gitignore deleted file mode 100644 index 1ac6136..0000000 --- a/wrappers/java-android/lib/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/build -/src/test/resources/* diff --git a/wrappers/java-android/lib/CMakeLists.txt b/wrappers/java-android/lib/CMakeLists.txt deleted file mode 100644 index 8e8ff87..0000000 --- a/wrappers/java-android/lib/CMakeLists.txt +++ /dev/null @@ -1,36 +0,0 @@ -cmake_minimum_required(VERSION 3.18.1) -project(eduvpn_common) - -# Android -> Go architecture map -set(arch_map_x86 386) -set(arch_map_x86_64 amd64) -set(arch_map_arm arm) -set(arch_map_arm64 arm64) - -set(GOARCH ${arch_map_${ANDROID_ARCH_NAME}}) - -find_program(MAKE_EXECUTABLE - NAMES gmake mingw32-make make - NAMES_PER_DIR - DOC "GNU Make" - REQUIRED -) - -# Inspired by https://github.com/WireGuard/wireguard-android/blob/1.0.20211029/tunnel/tools/CMakeLists.txt - -# --target has to be specified to compiler & linker as e.g. ANDROID_C_COMPILER may just be 'clang' without prefixes -# CGO_CPPFLAGS are concatenated to CGO_CFLAGS and CGO_CXXFLAGS -add_custom_target(shared-lib - WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../../../exports" - COMMENT "Building shared library for ${ANDROID_LLVM_TRIPLE}" - VERBATIM - COMMAND ${MAKE_EXECUTABLE} - GOOS=android GOARCH=${GOARCH} - CC=${ANDROID_C_COMPILER} CXX=${ANDROID_CXX_COMPILER} - CGO_CPPFLAGS=--target=${ANDROID_LLVM_TRIPLE} CGO_CFLAGS=${CMAKE_C_FLAGS} CGO_CXXFLAGS=${CMAKE_CXX_FLAGS} - CGO_LDFLAGS=${CMAKE_SHARED_LINKER_FLAGS}\ --target=${ANDROID_LLVM_TRIPLE} - COPY_LIB_TO=${CMAKE_LIBRARY_OUTPUT_DIRECTORY} -) - -# Note about COPY_LIB_TO: this is an easy cross-platform alternative to calling `cp` -# file(COPY ...) does not work since it runs at the configure stage... diff --git a/wrappers/java-android/lib/build.gradle b/wrappers/java-android/lib/build.gradle deleted file mode 100644 index 04cb00e..0000000 --- a/wrappers/java-android/lib/build.gradle +++ /dev/null @@ -1,107 +0,0 @@ -import com.android.build.api.dsl.ManagedVirtualDevice - -plugins { - id 'com.android.library' // Build AAR -} - -android { - compileSdk 31 - - defaultConfig { - minSdk 21 - targetSdk 31 - versionCode 1 - versionName '1.0' - - testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' - - consumerProguardFiles 'consumer-rules.pro' - - externalNativeBuild { - cmake { - // Specify which target we want to build - targets 'shared-lib' - } - } - } - - buildTypes { - release { - minifyEnabled true - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - } - - // Support Java 8+ - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - externalNativeBuild { - cmake { - version '3.18.1' // See cmake_minimum_required in CMakeLists.txt - path 'CMakeLists.txt' - } - } - - sourceSets { - androidTest { - // Use same sources & resources for Android instrumented tests as unit tests - java.srcDirs = sourceSets.test.java.srcDirs - resources.srcDirs = sourceSets.test.resources.srcDirs - } - } - - task copyTestData(type: Copy, description: 'Copy test_data to test resources') { - from('../../../src/test_data') { - exclude '**/*.py', '**/*.sh' - } - into sourceSets.test.resources.srcDirs[0].toPath().resolve('org/eduvpn/common') - } - - // Copy test_data to Java resources before these are processed - // (.named does not find all tasks. Task names were obtained with com.dorongold.task-tree plugin) - tasks.matching { t -> - t.name in [ - 'processDebugUnitTestJavaRes', 'processReleaseUnitTestJavaRes', - 'processDebugAndroidTestJavaRes', 'processReleaseAndroidTestJavaRes'] - }.all { - dependsOn copyTestData - } - - // Do not cache unit test results as the shared library may have changed - tasks.matching { t -> t.name in ['testDebugUnitTest', 'testReleaseUnitTest'] }.all { - outputs.upToDateWhen { false } - } - - testOptions { - // Display full exceptions and passed tests for unit tests - unitTests.all { - testLogging { - events 'passed', 'skipped', 'failed' - exceptionFormat 'full' - } - } - - devices { - pixel2(ManagedVirtualDevice) { - device = 'Pixel 2' - apiLevel = 30 - systemImageSource = 'aosp' - abi = 'x86_64' - } - } - } -} - -dependencies { - implementation 'net.java.dev.jna:jna:5.10.0@aar' - - testImplementation 'commons-io:commons-io:2.11.0' - testImplementation 'net.java.dev.jna:jna:5.10.0' // Include jnidispatch library in unit tests - testImplementation 'junit:junit:4.+' - - androidTestImplementation 'commons-io:commons-io:2.11.0' - androidTestImplementation 'androidx.test:runner:1.4.0' -} diff --git a/wrappers/java-android/lib/consumer-rules.pro b/wrappers/java-android/lib/consumer-rules.pro deleted file mode 100644 index e69de29..0000000 --- a/wrappers/java-android/lib/consumer-rules.pro +++ /dev/null diff --git a/wrappers/java-android/lib/proguard-rules.pro b/wrappers/java-android/lib/proguard-rules.pro deleted file mode 100644 index f1b4245..0000000 --- a/wrappers/java-android/lib/proguard-rules.pro +++ /dev/null @@ -1,21 +0,0 @@ -# Add project specific ProGuard rules here. -# You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} - -# Uncomment this to preserve the line number information for -# debugging stack traces. -#-keepattributes SourceFile,LineNumberTable - -# If you keep the line number information, uncomment this to -# hide the original source file name. -#-renamesourcefileattribute SourceFile diff --git a/wrappers/java-android/lib/src/main/AndroidManifest.xml b/wrappers/java-android/lib/src/main/AndroidManifest.xml deleted file mode 100644 index 5a49838..0000000 --- a/wrappers/java-android/lib/src/main/AndroidManifest.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<manifest package="org.eduvpn.common"> - -</manifest> diff --git a/wrappers/java-android/lib/src/main/java/org/eduvpn/common/Discovery.java b/wrappers/java-android/lib/src/main/java/org/eduvpn/common/Discovery.java deleted file mode 100644 index dfeef71..0000000 --- a/wrappers/java-android/lib/src/main/java/org/eduvpn/common/Discovery.java +++ /dev/null @@ -1,80 +0,0 @@ -package org.eduvpn.common; - -import com.sun.jna.*; - -import java.nio.charset.StandardCharsets; - -public final class Discovery { - private static final String LIB_NAME = "eduvpn_common"; - private static final NativeApi discovery = Native.load(LIB_NAME, NativeApi.class); - - /** - * Verifies the signature on the JSON server_list.json/organization_list.json file. - * If the function returns, the signature is valid for the given file type. - * - * @param signature .minisig signature file contents. - * @param signedJson Signed .json file contents. - * @param expectedFileName The file type to be verified, one of {@code "server_list.json"} or {@code "organization_list.json"}. - * @param minSignTime Minimum time for signature (UNIX timestamp, seconds). Should be set to at least the time of the previous signature. - * @throws IllegalArgumentException If {@code expectedFileName} is not one of the allowed values or one of the parameters is empty. - * @throws VerifyException If signature verification fails. - */ - public static void verify(byte[] signature, byte[] signedJson, String expectedFileName, long minSignTime) throws VerifyException { - byte err = discovery.Verify(NativeApi.GoSlice.fromArray(signature), NativeApi.GoSlice.fromArray(signedJson), - NativeApi.GoSlice.fromString(expectedFileName), minSignTime); - - switch (err) { - case 0: - return; - case 1: - throw new IllegalArgumentException("unknown expected file name"); - case 2: - throw new InvalidSignatureException(); - case 3: - throw new InvalidSignatureUnknownKeyException(); - case 4: - throw new SignatureTooOldException(); - default: - throw new UnknownVerifyException(err); - } - } - - /** Use for testing only, see Go documentation. */ - /*package-private*/ - static void insecureTestingSetExtraKey(String keyString) { - discovery.InsecureTestingSetExtraKey(NativeApi.GoSlice.fromArray(keyString.getBytes(StandardCharsets.UTF_8))); - } - - private interface NativeApi extends Library { - // C-compatible structure - @Structure.FieldOrder({"data", "len", "cap"}) - class GoSlice extends Structure implements Structure.ByValue { - public Pointer data; - public long len, cap; - - public GoSlice(Pointer data, long len, long cap) { - this.data = data; - this.len = len; - this.cap = cap; - } - - public static GoSlice fromArray(byte[] bytes) { - Memory memory = new Memory(bytes.length); - memory.write(0, bytes, 0, bytes.length); - return new GoSlice(memory, bytes.length, bytes.length); - } - - /** From string as UTF-8. */ - public static GoSlice fromString(String str) { - return fromArray(str.getBytes(StandardCharsets.UTF_8)); - } - } - - byte Verify(GoSlice signatureFileContent, GoSlice signedJson, GoSlice expectedFileName, long minSignTime); - - void InsecureTestingSetExtraKey(GoSlice keyString); - } - - private Discovery() { - } -} diff --git a/wrappers/java-android/lib/src/main/java/org/eduvpn/common/InvalidSignatureException.java b/wrappers/java-android/lib/src/main/java/org/eduvpn/common/InvalidSignatureException.java deleted file mode 100644 index b739dd7..0000000 --- a/wrappers/java-android/lib/src/main/java/org/eduvpn/common/InvalidSignatureException.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.eduvpn.common; - -/** Signature is invalid (for the expected file type). */ -public final class InvalidSignatureException extends VerifyException { - public InvalidSignatureException() { - super("invalid signature"); - } -} diff --git a/wrappers/java-android/lib/src/main/java/org/eduvpn/common/InvalidSignatureUnknownKeyException.java b/wrappers/java-android/lib/src/main/java/org/eduvpn/common/InvalidSignatureUnknownKeyException.java deleted file mode 100644 index 6d651e5..0000000 --- a/wrappers/java-android/lib/src/main/java/org/eduvpn/common/InvalidSignatureUnknownKeyException.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.eduvpn.common; - -/** Signature was created with an unknown key and has not been verified. */ -public final class InvalidSignatureUnknownKeyException extends VerifyException { - public InvalidSignatureUnknownKeyException() { - super("invalid signature (unknown key)"); - } -} diff --git a/wrappers/java-android/lib/src/main/java/org/eduvpn/common/SignatureTooOldException.java b/wrappers/java-android/lib/src/main/java/org/eduvpn/common/SignatureTooOldException.java deleted file mode 100644 index c89136f..0000000 --- a/wrappers/java-android/lib/src/main/java/org/eduvpn/common/SignatureTooOldException.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.eduvpn.common; - -/** Signature timestamp smaller than specified minimum signing time (rollback). */ -public final class SignatureTooOldException extends VerifyException { - public SignatureTooOldException() { - super("replay of previous signature (rollback)"); - } -} diff --git a/wrappers/java-android/lib/src/main/java/org/eduvpn/common/UnknownVerifyException.java b/wrappers/java-android/lib/src/main/java/org/eduvpn/common/UnknownVerifyException.java deleted file mode 100644 index 80b74ea..0000000 --- a/wrappers/java-android/lib/src/main/java/org/eduvpn/common/UnknownVerifyException.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.eduvpn.common; - -/** Other unknown error. */ -public final class UnknownVerifyException extends VerifyException { - public UnknownVerifyException(byte code) { - super(String.format("unknown verify error (%d)", code)); - assert code != 0; - } -} diff --git a/wrappers/java-android/lib/src/main/java/org/eduvpn/common/VerifyException.java b/wrappers/java-android/lib/src/main/java/org/eduvpn/common/VerifyException.java deleted file mode 100644 index 686ea41..0000000 --- a/wrappers/java-android/lib/src/main/java/org/eduvpn/common/VerifyException.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.eduvpn.common; - -/** Verification failed, do not trust the file. */ -public abstract class VerifyException extends Exception { - protected VerifyException(String message) { - super(message); - } -} diff --git a/wrappers/java-android/lib/src/test/java/org/eduvpn/common/VerifyTests.java b/wrappers/java-android/lib/src/test/java/org/eduvpn/common/VerifyTests.java deleted file mode 100644 index 92a4648..0000000 --- a/wrappers/java-android/lib/src/test/java/org/eduvpn/common/VerifyTests.java +++ /dev/null @@ -1,77 +0,0 @@ -package org.eduvpn.common; - -import org.apache.commons.io.IOUtils; -import org.junit.BeforeClass; -import org.junit.Test; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; - -public class VerifyTests { - private static byte[] readAll(String resource) throws IOException { - try (InputStream stream = VerifyTests.class.getResourceAsStream(resource)) { - return IOUtils.toByteArray(stream); - } - } - - @SuppressWarnings("OptionalGetWithoutIsPresent") - @BeforeClass - public static void oneTimeSetup() throws IOException { - try (BufferedReader reader = new BufferedReader(new InputStreamReader( - VerifyTests.class.getResourceAsStream("public.key")))) { - Discovery.insecureTestingSetExtraKey(reader.lines().reduce((a, b) -> b).get()); - } - } - - @Test - public void testValid() throws IOException, VerifyException { - Discovery.verify( - readAll("server_list.json.minisig"), - readAll("server_list.json"), - "server_list.json", - 10 - ); - } - - @Test(expected = InvalidSignatureException.class) - public void testInvalidSignature() throws IOException, VerifyException { - Discovery.verify( - readAll("random.txt"), - readAll("server_list.json"), - "server_list.json", - 0 - ); - } - - @Test(expected = InvalidSignatureUnknownKeyException.class) - public void testWrongKey() throws IOException, VerifyException { - Discovery.verify( - readAll("server_list.json.wrong_key.minisig"), - readAll("server_list.json"), - "server_list.json", - 0 - ); - } - - @Test(expected = SignatureTooOldException.class) - public void testOldSignature() throws IOException, VerifyException { - Discovery.verify( - readAll("server_list.json.minisig"), - readAll("server_list.json"), - "server_list.json", - 11 - ); - } - - @Test(expected = IllegalArgumentException.class) - public void testUnknownExpectedFile() throws IOException, VerifyException { - Discovery.verify( - readAll("other_list.json.minisig"), - readAll("other_list.json"), - "other_list.json", - 0 - ); - } -} diff --git a/wrappers/java-android/settings.gradle b/wrappers/java-android/settings.gradle deleted file mode 100644 index b603bb3..0000000 --- a/wrappers/java-android/settings.gradle +++ /dev/null @@ -1,9 +0,0 @@ -dependencyResolutionManagement { - repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) - repositories { - google() - mavenCentral() - } -} -rootProject.name = 'eduvpn_common' -include ':lib' diff --git a/wrappers/php/.gitignore b/wrappers/php/.gitignore deleted file mode 100644 index bdaa6e3..0000000 --- a/wrappers/php/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -/vendor/ -/lib/* -composer.phar -.phpunit* -*.h diff --git a/wrappers/php/Makefile b/wrappers/php/Makefile deleted file mode 100644 index 89b9759..0000000 --- a/wrappers/php/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -.PHONY: install-header test install-dev-dependencies clean - -EXPORTS_PATH ?= ../../exports -include $(EXPORTS_PATH)/common.mk - -# Add phpunit to PATH -export PATH := $(abspath vendor/bin):$(PATH) - -ifeq ($(COPY_LIB),1) -COPY_LIB_DIR ?= lib -endif -ifdef COPY_LIB_DIR -override COPY_LIB_DIR := $(COPY_LIB_DIR)/ -endif - -# Strip / replace elements confusing PHP's limited C parser: __SIZE_TYPE__, _Complex, extern "C" -# Also add FFI_LIB library name, see https://www.php.net/manual/en/ffi.load -install-header: .try-build-lib - mkdir -p src/headers - sed --null-data \ - -e 's/DO NOT EDIT/Modified for PHP/' \ - \ - -e 's/__SIZE_TYPE__/size_t/g' \ - -e 's/[^\n]*_Complex[^\n]*//g' \ - -e 's/#ifdef __cplusplus[^#]*#endif//g' \ - \ - -e 's/^/#define FFI_LIB "$(subst /,\/,$(COPY_LIB_DIR))$(LIB_FILE)"\n\n/' \ - \ - "$(EXPORTS_LIB_SUBFOLDER_PATH)/$(LIB_NAME).h" >src/headers/$(LIB_NAME)_php.h -ifdef COPY_LIB_DIR - install "$(EXPORTS_LIB_SUBFOLDER_PATH)/$(LIB_FILE)" -Dt "$(COPY_LIB_DIR)" -endif - -test: install-header install-dev-dependencies - phpunit - -composers = composer composer.phar ./composer ./composer.phar -# Find first composer from list above, default to 'composer' -find_composer = $(firstword $(foreach bin,$(composers),$(if $(shell command -v $(bin) 2>/dev/null),$(bin),)) composer) -# Lazy variable: https://blog.jgc.org/2016/07/lazy-gnu-make-variables.html -COMPOSER ?= $(eval COMPOSER := $(find_composer))$(COMPOSER) - -# Try: composer, composer.phar, ./composer.phar, ./composer -# check-platform-reqs is needed because of config.platform in composer.json, see https://getcomposer.org/doc/06-config.md#platform -install-dev-dependencies: - $(COMPOSER) install - $(COMPOSER) check-platform-reqs - -clean: - rm -rf .phpunit* src/headers/*.h lib/* -ifeq ($(CLEAN_ALL),1) - rm -rf vendor/ -endif diff --git a/wrappers/php/README.md b/wrappers/php/README.md deleted file mode 100644 index 01e4d3e..0000000 --- a/wrappers/php/README.md +++ /dev/null @@ -1,35 +0,0 @@ -# PHP Wrapper - -## Requirements - -You will need to install [PHP](https://www.php.net/downloads) 7.4 or later. For testing, you can use dependency -manager [Composer](https://getcomposer.org/doc/00-intro.md) to download PHPUnit. - -Activate the [FFI](https://www.php.net/manual/en/ffi.setup.php) extension (Composer will also warn if you do not have it -enabled). - -## Test etc. - -Test (also installs PHPUnit using Composer and builds shared Go library for current platform): - -```shell -make test -``` - -Only build shared library and copy modified C header for the current platform to the right directory: - -```shell -make install-header -``` - -Or for the specified platform: - -```shell -make install-header GOOS=windows GOARCH=amd64 -``` - -When using this library, you will need to make sure that the linker can find the shared Go library. Alternatively, -pass `COPY_LIB=1` to `make install-header` to copy the library over to this folder and load it via this relative path. - -If you do not build this as part of the full repository, specify `EXPORTS_PATH="path/to/exports-folder"` when calling -make. This folder must contain `common.mk` and the `lib/` folder with built libraries and headers. diff --git a/wrappers/php/composer.json b/wrappers/php/composer.json deleted file mode 100644 index ddc70ec..0000000 --- a/wrappers/php/composer.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "eduvpn/common", - "type": "library", - "require-dev": { - "phpunit/phpunit": "^9.5" - }, - "autoload": { - "psr-4": { - "EduVpn\\Common\\": "src/" - } - }, - "require": { - "php": ">=7.4", - "ext-ffi": "*" - }, - "config": { - "platform": { - "php": "7.4.0" - } - } -} diff --git a/wrappers/php/composer.lock b/wrappers/php/composer.lock deleted file mode 100644 index 9555d16..0000000 --- a/wrappers/php/composer.lock +++ /dev/null @@ -1,2118 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", - "This file is @generated automatically" - ], - "content-hash": "a9c9b1e302faebe8dfab5800e35fa745", - "packages": [], - "packages-dev": [ - { - "name": "doctrine/instantiator", - "version": "1.4.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/d56bf6102915de5702778fe20f2de3b2fe570b5b", - "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b", - "shasum": "" - }, - "require": { - "php": "^7.1 || ^8.0" - }, - "require-dev": { - "doctrine/coding-standard": "^8.0", - "ext-pdo": "*", - "ext-phar": "*", - "phpbench/phpbench": "^0.13 || 1.0.0-alpha2", - "phpstan/phpstan": "^0.12", - "phpstan/phpstan-phpunit": "^0.12", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "https://ocramius.github.io/" - } - ], - "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://www.doctrine-project.org/projects/instantiator.html", - "keywords": [ - "constructor", - "instantiate" - ], - "support": { - "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/1.4.0" - }, - "funding": [ - { - "url": "https://www.doctrine-project.org/sponsorship.html", - "type": "custom" - }, - { - "url": "https://www.patreon.com/phpdoctrine", - "type": "patreon" - }, - { - "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", - "type": "tidelift" - } - ], - "time": "2020-11-10T18:47:58+00:00" - }, - { - "name": "myclabs/deep-copy", - "version": "1.10.2", - "source": { - "type": "git", - "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/776f831124e9c62e1a2c601ecc52e776d8bb7220", - "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220", - "shasum": "" - }, - "require": { - "php": "^7.1 || ^8.0" - }, - "replace": { - "myclabs/deep-copy": "self.version" - }, - "require-dev": { - "doctrine/collections": "^1.0", - "doctrine/common": "^2.6", - "phpunit/phpunit": "^7.1" - }, - "type": "library", - "autoload": { - "psr-4": { - "DeepCopy\\": "src/DeepCopy/" - }, - "files": [ - "src/DeepCopy/deep_copy.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Create deep copies (clones) of your objects", - "keywords": [ - "clone", - "copy", - "duplicate", - "object", - "object graph" - ], - "support": { - "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.10.2" - }, - "funding": [ - { - "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", - "type": "tidelift" - } - ], - "time": "2020-11-13T09:40:50+00:00" - }, - { - "name": "nikic/php-parser", - "version": "v4.13.2", - "source": { - "type": "git", - "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "210577fe3cf7badcc5814d99455df46564f3c077" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/210577fe3cf7badcc5814d99455df46564f3c077", - "reference": "210577fe3cf7badcc5814d99455df46564f3c077", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": ">=7.0" - }, - "require-dev": { - "ircmaxell/php-yacc": "^0.0.7", - "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" - }, - "bin": [ - "bin/php-parse" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.9-dev" - } - }, - "autoload": { - "psr-4": { - "PhpParser\\": "lib/PhpParser" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Nikita Popov" - } - ], - "description": "A PHP parser written in PHP", - "keywords": [ - "parser", - "php" - ], - "support": { - "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.13.2" - }, - "time": "2021-11-30T19:35:32+00:00" - }, - { - "name": "phar-io/manifest", - "version": "2.0.3", - "source": { - "type": "git", - "url": "https://github.com/phar-io/manifest.git", - "reference": "97803eca37d319dfa7826cc2437fc020857acb53" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", - "reference": "97803eca37d319dfa7826cc2437fc020857acb53", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-phar": "*", - "ext-xmlwriter": "*", - "phar-io/version": "^3.0.1", - "php": "^7.2 || ^8.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - }, - { - "name": "Sebastian Heuer", - "email": "sebastian@phpeople.de", - "role": "Developer" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "Developer" - } - ], - "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", - "support": { - "issues": "https://github.com/phar-io/manifest/issues", - "source": "https://github.com/phar-io/manifest/tree/2.0.3" - }, - "time": "2021-07-20T11:28:43+00:00" - }, - { - "name": "phar-io/version", - "version": "3.1.0", - "source": { - "type": "git", - "url": "https://github.com/phar-io/version.git", - "reference": "bae7c545bef187884426f042434e561ab1ddb182" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/bae7c545bef187884426f042434e561ab1ddb182", - "reference": "bae7c545bef187884426f042434e561ab1ddb182", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - }, - { - "name": "Sebastian Heuer", - "email": "sebastian@phpeople.de", - "role": "Developer" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "Developer" - } - ], - "description": "Library for handling version information and constraints", - "support": { - "issues": "https://github.com/phar-io/version/issues", - "source": "https://github.com/phar-io/version/tree/3.1.0" - }, - "time": "2021-02-23T14:00:09+00:00" - }, - { - "name": "phpdocumentor/reflection-common", - "version": "2.2.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-2.x": "2.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jaap van Otterdijk", - "email": "opensource@ijaap.nl" - } - ], - "description": "Common reflection classes used by phpdocumentor to reflect the code structure", - "homepage": "http://www.phpdoc.org", - "keywords": [ - "FQSEN", - "phpDocumentor", - "phpdoc", - "reflection", - "static analysis" - ], - "support": { - "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues", - "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x" - }, - "time": "2020-06-27T09:03:43+00:00" - }, - { - "name": "phpdocumentor/reflection-docblock", - "version": "5.3.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "622548b623e81ca6d78b721c5e029f4ce664f170" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/622548b623e81ca6d78b721c5e029f4ce664f170", - "reference": "622548b623e81ca6d78b721c5e029f4ce664f170", - "shasum": "" - }, - "require": { - "ext-filter": "*", - "php": "^7.2 || ^8.0", - "phpdocumentor/reflection-common": "^2.2", - "phpdocumentor/type-resolver": "^1.3", - "webmozart/assert": "^1.9.1" - }, - "require-dev": { - "mockery/mockery": "~1.3.2", - "psalm/phar": "^4.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - }, - { - "name": "Jaap van Otterdijk", - "email": "account@ijaap.nl" - } - ], - "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "support": { - "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.3.0" - }, - "time": "2021-10-19T17:43:47+00:00" - }, - { - "name": "phpdocumentor/type-resolver", - "version": "1.5.1", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "a12f7e301eb7258bb68acd89d4aefa05c2906cae" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/a12f7e301eb7258bb68acd89d4aefa05c2906cae", - "reference": "a12f7e301eb7258bb68acd89d4aefa05c2906cae", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0", - "phpdocumentor/reflection-common": "^2.0" - }, - "require-dev": { - "ext-tokenizer": "*", - "psalm/phar": "^4.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-1.x": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - } - ], - "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", - "support": { - "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.5.1" - }, - "time": "2021-10-02T14:08:47+00:00" - }, - { - "name": "phpspec/prophecy", - "version": "v1.15.0", - "source": { - "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/bbcd7380b0ebf3961ee21409db7b38bc31d69a13", - "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.2", - "php": "^7.2 || ~8.0, <8.2", - "phpdocumentor/reflection-docblock": "^5.2", - "sebastian/comparator": "^3.0 || ^4.0", - "sebastian/recursion-context": "^3.0 || ^4.0" - }, - "require-dev": { - "phpspec/phpspec": "^6.0 || ^7.0", - "phpunit/phpunit": "^8.0 || ^9.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Prophecy\\": "src/Prophecy" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - }, - { - "name": "Marcello Duarte", - "email": "marcello.duarte@gmail.com" - } - ], - "description": "Highly opinionated mocking framework for PHP 5.3+", - "homepage": "https://github.com/phpspec/prophecy", - "keywords": [ - "Double", - "Dummy", - "fake", - "mock", - "spy", - "stub" - ], - "support": { - "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/v1.15.0" - }, - "time": "2021-12-08T12:19:24+00:00" - }, - { - "name": "phpunit/php-code-coverage", - "version": "9.2.10", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "d5850aaf931743067f4bfc1ae4cbd06468400687" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/d5850aaf931743067f4bfc1ae4cbd06468400687", - "reference": "d5850aaf931743067f4bfc1ae4cbd06468400687", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-libxml": "*", - "ext-xmlwriter": "*", - "nikic/php-parser": "^4.13.0", - "php": ">=7.3", - "phpunit/php-file-iterator": "^3.0.3", - "phpunit/php-text-template": "^2.0.2", - "sebastian/code-unit-reverse-lookup": "^2.0.2", - "sebastian/complexity": "^2.0", - "sebastian/environment": "^5.1.2", - "sebastian/lines-of-code": "^1.0.3", - "sebastian/version": "^3.0.1", - "theseer/tokenizer": "^1.2.0" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "suggest": { - "ext-pcov": "*", - "ext-xdebug": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "9.2-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", - "homepage": "https://github.com/sebastianbergmann/php-code-coverage", - "keywords": [ - "coverage", - "testing", - "xunit" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.10" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2021-12-05T09:12:13+00:00" - }, - { - "name": "phpunit/php-file-iterator", - "version": "3.0.6", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", - "reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "FilterIterator implementation that filters files based on a list of suffixes.", - "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", - "keywords": [ - "filesystem", - "iterator" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2021-12-02T12:48:52+00:00" - }, - { - "name": "phpunit/php-invoker", - "version": "3.1.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-invoker.git", - "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67", - "reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "ext-pcntl": "*", - "phpunit/phpunit": "^9.3" - }, - "suggest": { - "ext-pcntl": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.1-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Invoke callables with a timeout", - "homepage": "https://github.com/sebastianbergmann/php-invoker/", - "keywords": [ - "process" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/php-invoker/issues", - "source": "https://github.com/sebastianbergmann/php-invoker/tree/3.1.1" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-09-28T05:58:55+00:00" - }, - { - "name": "phpunit/php-text-template", - "version": "2.0.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", - "reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Simple template engine.", - "homepage": "https://github.com/sebastianbergmann/php-text-template/", - "keywords": [ - "template" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/php-text-template/issues", - "source": "https://github.com/sebastianbergmann/php-text-template/tree/2.0.4" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-10-26T05:33:50+00:00" - }, - { - "name": "phpunit/php-timer", - "version": "5.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", - "reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Utility class for timing", - "homepage": "https://github.com/sebastianbergmann/php-timer/", - "keywords": [ - "timer" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/php-timer/issues", - "source": "https://github.com/sebastianbergmann/php-timer/tree/5.0.3" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-10-26T13:16:10+00:00" - }, - { - "name": "phpunit/phpunit", - "version": "9.5.10", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "c814a05837f2edb0d1471d6e3f4ab3501ca3899a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c814a05837f2edb0d1471d6e3f4ab3501ca3899a", - "reference": "c814a05837f2edb0d1471d6e3f4ab3501ca3899a", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.3.1", - "ext-dom": "*", - "ext-json": "*", - "ext-libxml": "*", - "ext-mbstring": "*", - "ext-xml": "*", - "ext-xmlwriter": "*", - "myclabs/deep-copy": "^1.10.1", - "phar-io/manifest": "^2.0.3", - "phar-io/version": "^3.0.2", - "php": ">=7.3", - "phpspec/prophecy": "^1.12.1", - "phpunit/php-code-coverage": "^9.2.7", - "phpunit/php-file-iterator": "^3.0.5", - "phpunit/php-invoker": "^3.1.1", - "phpunit/php-text-template": "^2.0.3", - "phpunit/php-timer": "^5.0.2", - "sebastian/cli-parser": "^1.0.1", - "sebastian/code-unit": "^1.0.6", - "sebastian/comparator": "^4.0.5", - "sebastian/diff": "^4.0.3", - "sebastian/environment": "^5.1.3", - "sebastian/exporter": "^4.0.3", - "sebastian/global-state": "^5.0.1", - "sebastian/object-enumerator": "^4.0.3", - "sebastian/resource-operations": "^3.0.3", - "sebastian/type": "^2.3.4", - "sebastian/version": "^3.0.2" - }, - "require-dev": { - "ext-pdo": "*", - "phpspec/prophecy-phpunit": "^2.0.1" - }, - "suggest": { - "ext-soap": "*", - "ext-xdebug": "*" - }, - "bin": [ - "phpunit" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "9.5-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ], - "files": [ - "src/Framework/Assert/Functions.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "The PHP Unit Testing framework.", - "homepage": "https://phpunit.de/", - "keywords": [ - "phpunit", - "testing", - "xunit" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.10" - }, - "funding": [ - { - "url": "https://phpunit.de/donate.html", - "type": "custom" - }, - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2021-09-25T07:38:51+00:00" - }, - { - "name": "sebastian/cli-parser", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/cli-parser.git", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library for parsing CLI options", - "homepage": "https://github.com/sebastianbergmann/cli-parser", - "support": { - "issues": "https://github.com/sebastianbergmann/cli-parser/issues", - "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.1" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-09-28T06:08:49+00:00" - }, - { - "name": "sebastian/code-unit", - "version": "1.0.8", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit.git", - "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120", - "reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Collection of value objects that represent the PHP code units", - "homepage": "https://github.com/sebastianbergmann/code-unit", - "support": { - "issues": "https://github.com/sebastianbergmann/code-unit/issues", - "source": "https://github.com/sebastianbergmann/code-unit/tree/1.0.8" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-10-26T13:08:54+00:00" - }, - { - "name": "sebastian/code-unit-reverse-lookup", - "version": "2.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", - "reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Looks up which function or method a line of code belongs to", - "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "support": { - "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", - "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/2.0.3" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-09-28T05:30:19+00:00" - }, - { - "name": "sebastian/comparator", - "version": "4.0.6", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "55f4261989e546dc112258c7a75935a81a7ce382" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/55f4261989e546dc112258c7a75935a81a7ce382", - "reference": "55f4261989e546dc112258c7a75935a81a7ce382", - "shasum": "" - }, - "require": { - "php": ">=7.3", - "sebastian/diff": "^4.0", - "sebastian/exporter": "^4.0" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - } - ], - "description": "Provides the functionality to compare PHP values for equality", - "homepage": "https://github.com/sebastianbergmann/comparator", - "keywords": [ - "comparator", - "compare", - "equality" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/comparator/issues", - "source": "https://github.com/sebastianbergmann/comparator/tree/4.0.6" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-10-26T15:49:45+00:00" - }, - { - "name": "sebastian/complexity", - "version": "2.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "739b35e53379900cc9ac327b2147867b8b6efd88" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/739b35e53379900cc9ac327b2147867b8b6efd88", - "reference": "739b35e53379900cc9ac327b2147867b8b6efd88", - "shasum": "" - }, - "require": { - "nikic/php-parser": "^4.7", - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library for calculating the complexity of PHP code units", - "homepage": "https://github.com/sebastianbergmann/complexity", - "support": { - "issues": "https://github.com/sebastianbergmann/complexity/issues", - "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.2" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-10-26T15:52:27+00:00" - }, - { - "name": "sebastian/diff", - "version": "4.0.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/3461e3fccc7cfdfc2720be910d3bd73c69be590d", - "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3", - "symfony/process": "^4.2 || ^5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - } - ], - "description": "Diff implementation", - "homepage": "https://github.com/sebastianbergmann/diff", - "keywords": [ - "diff", - "udiff", - "unidiff", - "unified diff" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/4.0.4" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-10-26T13:10:38+00:00" - }, - { - "name": "sebastian/environment", - "version": "5.1.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "388b6ced16caa751030f6a69e588299fa09200ac" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/388b6ced16caa751030f6a69e588299fa09200ac", - "reference": "388b6ced16caa751030f6a69e588299fa09200ac", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "suggest": { - "ext-posix": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.1-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", - "keywords": [ - "Xdebug", - "environment", - "hhvm" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/environment/issues", - "source": "https://github.com/sebastianbergmann/environment/tree/5.1.3" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-09-28T05:52:38+00:00" - }, - { - "name": "sebastian/exporter", - "version": "4.0.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/65e8b7db476c5dd267e65eea9cab77584d3cfff9", - "reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9", - "shasum": "" - }, - "require": { - "php": ">=7.3", - "sebastian/recursion-context": "^4.0" - }, - "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "https://www.github.com/sebastianbergmann/exporter", - "keywords": [ - "export", - "exporter" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.4" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2021-11-11T14:18:36+00:00" - }, - { - "name": "sebastian/global-state", - "version": "5.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "23bd5951f7ff26f12d4e3242864df3e08dec4e49" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/23bd5951f7ff26f12d4e3242864df3e08dec4e49", - "reference": "23bd5951f7ff26f12d4e3242864df3e08dec4e49", - "shasum": "" - }, - "require": { - "php": ">=7.3", - "sebastian/object-reflector": "^2.0", - "sebastian/recursion-context": "^4.0" - }, - "require-dev": { - "ext-dom": "*", - "phpunit/phpunit": "^9.3" - }, - "suggest": { - "ext-uopz": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", - "keywords": [ - "global state" - ], - "support": { - "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.3" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2021-06-11T13:31:12+00:00" - }, - { - "name": "sebastian/lines-of-code", - "version": "1.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/c1c2e997aa3146983ed888ad08b15470a2e22ecc", - "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc", - "shasum": "" - }, - "require": { - "nikic/php-parser": "^4.6", - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library for counting the lines of code in PHP source code", - "homepage": "https://github.com/sebastianbergmann/lines-of-code", - "support": { - "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", - "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.3" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-11-28T06:42:11+00:00" - }, - { - "name": "sebastian/object-enumerator", - "version": "4.0.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "5c9eeac41b290a3712d88851518825ad78f45c71" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71", - "reference": "5c9eeac41b290a3712d88851518825ad78f45c71", - "shasum": "" - }, - "require": { - "php": ">=7.3", - "sebastian/object-reflector": "^2.0", - "sebastian/recursion-context": "^4.0" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Traverses array structures and object graphs to enumerate all referenced objects", - "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "support": { - "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", - "source": "https://github.com/sebastianbergmann/object-enumerator/tree/4.0.4" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-10-26T13:12:34+00:00" - }, - { - "name": "sebastian/object-reflector", - "version": "2.0.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", - "reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Allows reflection of object attributes, including inherited and non-public ones", - "homepage": "https://github.com/sebastianbergmann/object-reflector/", - "support": { - "issues": "https://github.com/sebastianbergmann/object-reflector/issues", - "source": "https://github.com/sebastianbergmann/object-reflector/tree/2.0.4" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-10-26T13:14:26+00:00" - }, - { - "name": "sebastian/recursion-context", - "version": "4.0.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/cd9d8cf3c5804de4341c283ed787f099f5506172", - "reference": "cd9d8cf3c5804de4341c283ed787f099f5506172", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "support": { - "issues": "https://github.com/sebastianbergmann/recursion-context/issues", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.4" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-10-26T13:17:30+00:00" - }, - { - "name": "sebastian/resource-operations", - "version": "3.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", - "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides a list of PHP built-in functions that operate on resources", - "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "support": { - "issues": "https://github.com/sebastianbergmann/resource-operations/issues", - "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.3" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-09-28T06:45:17+00:00" - }, - { - "name": "sebastian/type", - "version": "2.3.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/type.git", - "reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b8cd8a1c753c90bc1a0f5372170e3e489136f914", - "reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "require-dev": { - "phpunit/phpunit": "^9.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.3-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Collection of value objects that represent the types of the PHP type system", - "homepage": "https://github.com/sebastianbergmann/type", - "support": { - "issues": "https://github.com/sebastianbergmann/type/issues", - "source": "https://github.com/sebastianbergmann/type/tree/2.3.4" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2021-06-15T12:49:02+00:00" - }, - { - "name": "sebastian/version", - "version": "3.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "c6c1022351a901512170118436c764e473f6de8c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c", - "reference": "c6c1022351a901512170118436c764e473f6de8c", - "shasum": "" - }, - "require": { - "php": ">=7.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library that helps with managing the version number of Git-hosted PHP projects", - "homepage": "https://github.com/sebastianbergmann/version", - "support": { - "issues": "https://github.com/sebastianbergmann/version/issues", - "source": "https://github.com/sebastianbergmann/version/tree/3.0.2" - }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2020-09-28T06:39:44+00:00" - }, - { - "name": "symfony/polyfill-ctype", - "version": "v1.23.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/46cd95797e9df938fdd2b03693b5fca5e64b01ce", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "suggest": { - "ext-ctype": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for ctype functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "ctype", - "polyfill", - "portable" - ], - "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.23.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-02-19T12:13:01+00:00" - }, - { - "name": "theseer/tokenizer", - "version": "1.2.1", - "source": { - "type": "git", - "url": "https://github.com/theseer/tokenizer.git", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-tokenizer": "*", - "ext-xmlwriter": "*", - "php": "^7.2 || ^8.0" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - } - ], - "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", - "support": { - "issues": "https://github.com/theseer/tokenizer/issues", - "source": "https://github.com/theseer/tokenizer/tree/1.2.1" - }, - "funding": [ - { - "url": "https://github.com/theseer", - "type": "github" - } - ], - "time": "2021-07-28T10:34:58+00:00" - }, - { - "name": "webmozart/assert", - "version": "1.10.0", - "source": { - "type": "git", - "url": "https://github.com/webmozarts/assert.git", - "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webmozarts/assert/zipball/6964c76c7804814a842473e0c8fd15bab0f18e25", - "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0", - "symfony/polyfill-ctype": "^1.8" - }, - "conflict": { - "phpstan/phpstan": "<0.12.20", - "vimeo/psalm": "<4.6.1 || 4.6.2" - }, - "require-dev": { - "phpunit/phpunit": "^8.5.13" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.10-dev" - } - }, - "autoload": { - "psr-4": { - "Webmozart\\Assert\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Assertions to validate method input/output with nice error messages.", - "keywords": [ - "assert", - "check", - "validate" - ], - "support": { - "issues": "https://github.com/webmozarts/assert/issues", - "source": "https://github.com/webmozarts/assert/tree/1.10.0" - }, - "time": "2021-03-09T10:59:23+00:00" - } - ], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": [], - "prefer-stable": false, - "prefer-lowest": false, - "platform": { - "php": ">=7.4", - "ext-ffi": "*" - }, - "platform-dev": [], - "platform-overrides": { - "php": "7.4.0" - }, - "plugin-api-version": "2.1.0" -} diff --git a/wrappers/php/phpunit.xml b/wrappers/php/phpunit.xml deleted file mode 100644 index 74b4581..0000000 --- a/wrappers/php/phpunit.xml +++ /dev/null @@ -1,7 +0,0 @@ -<phpunit colors="true"> - <testsuites> - <testsuite name="EduVpnCommon tests"> - <directory suffix=".php">./tests/</directory> - </testsuite> - </testsuites> -</phpunit> diff --git a/wrappers/php/src/Discovery.php b/wrappers/php/src/Discovery.php deleted file mode 100644 index 39aa53d..0000000 --- a/wrappers/php/src/Discovery.php +++ /dev/null @@ -1,74 +0,0 @@ -<?php declare(strict_types=1); - -namespace EduVpn\Common; - -use EduVpn\Common\Impl\GoSlice; -use Error; -use FFI; -use InvalidArgumentException; - -final class Discovery -{ - public function __construct() { } - - const LIB_NAME = 'eduvpn_common'; - - private static ?FFI $ffi = null; - - private static function ffi(): FFI - { - if (!self::$ffi) { - if (!(self::$ffi = FFI::load(__DIR__ . '/headers/' . self::LIB_NAME . '_php.h'))) - throw new Error('failed to load ' . self::LIB_NAME); - } - return self::$ffi; - } - - /** - * Verifies the signature on the JSON server_list.json/organization_list.json file. - * If the function returns, the signature is valid for the given file type. - * - * @param string $signature .minisig signature file contents. - * @param string $signedJson Signed .json file contents. - * @param string $expectedFileName The file type to be verified, one of "server_list.json" or - * "organization_list.json". - * @param int $minSignTime Minimum time for signature (UNIX timestamp, seconds). Should be set to at least - * the time of the previous signature. - * @return void - * @throws InvalidArgumentException If expectedFileName is not one of the allowed values. - * @throws VerifyException If signature verification fails. - */ - public static function verify(string $signature, string $signedJson, string $expectedFileName, - int $minSignTime): void - { - $ffi = self::ffi(); - $signatureData = new GoSlice($ffi, $signature); - $jsonData = new GoSlice($ffi, $signedJson); - $expectedNameData = new GoSlice($ffi, $expectedFileName); - - $result = $ffi->Verify($signatureData->slice(), $jsonData->slice(), $expectedNameData->slice(), $minSignTime); - - switch ($result) { - case 0: - return; - case 1: - throw new InvalidArgumentException('unknown expected file name', $result); - case 2: - throw new InvalidSignatureException(); - case 3: - throw new InvalidSignatureUnknownKeyException(); - case 4: - throw new SignatureTooOldException(); - default: - throw new UnknownVerifyException($result); - } - } - - /** @internal Use for testing only, see Go documentation. */ - public static function insecureTestingSetExtraKey(string $keyString): void - { - $ffi = self::ffi(); - $keyData = new GoSlice($ffi, $keyString); - $ffi->InsecureTestingSetExtraKey($keyData->slice()); - } -} diff --git a/wrappers/php/src/Impl/GoSlice.php b/wrappers/php/src/Impl/GoSlice.php deleted file mode 100644 index b285cfd..0000000 --- a/wrappers/php/src/Impl/GoSlice.php +++ /dev/null @@ -1,43 +0,0 @@ -<?php declare(strict_types=1); - -/** @internal */ - -namespace EduVpn\Common\Impl; - -use FFI; -use FFI\CData; -use RuntimeException; - -/** @internal */ -class GoSlice -{ - // Will be destroyed along with this GoSlice - private CData $cData, $slice; - - public function __construct(FFI $ffi, string $data) - { - $len = strlen($data); - $cData = FFI::new(FFI::arrayType(FFI::type('char'), [$len]), false); - if ($cData === null) throw new RuntimeException('error allocating buffer'); - $this->cData = $cData; - FFI::memcpy($cData, $data, $len); - - $slice = $ffi->new('GoSlice'); - if ($slice === null) throw new RuntimeException('error allocating buffer'); - $this->slice = $slice; - $slice->data = FFI::addr($cData); // $cData must not be destroyed while $slice is in use - $slice->cap = $slice->len = $len; - } - - public function slice(): CData - { - return $this->slice; - } - - public function __destruct() - { - // Make sure we do not unknowingly use a slice with deallocated data - $this->slice->data = null; - $this->slice->cap = $this->slice->len = 0; - } -} diff --git a/wrappers/php/src/InvalidSignatureException.php b/wrappers/php/src/InvalidSignatureException.php deleted file mode 100644 index d5d4164..0000000 --- a/wrappers/php/src/InvalidSignatureException.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php declare(strict_types=1); - -namespace EduVpn\Common; - -/** Signature is invalid (for the expected file type). */ -final class InvalidSignatureException extends VerifyException -{ - public function __construct() - { - parent::__construct('invalid signature', 2); - } -} diff --git a/wrappers/php/src/InvalidSignatureUnknownKeyException.php b/wrappers/php/src/InvalidSignatureUnknownKeyException.php deleted file mode 100644 index 73a535e..0000000 --- a/wrappers/php/src/InvalidSignatureUnknownKeyException.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php declare(strict_types=1); - -namespace EduVpn\Common; - -/** Signature was created with an unknown key and has not been verified. */ -final class InvalidSignatureUnknownKeyException extends VerifyException -{ - public function __construct() - { - parent::__construct('invalid signature (unknown key)', 3); - } -} diff --git a/wrappers/php/src/SignatureTooOldException.php b/wrappers/php/src/SignatureTooOldException.php deleted file mode 100644 index 4b7e341..0000000 --- a/wrappers/php/src/SignatureTooOldException.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php declare(strict_types=1); - -namespace EduVpn\Common; - -/** Signature timestamp smaller than specified minimum signing time (rollback). */ -final class SignatureTooOldException extends VerifyException -{ - public function __construct() - { - parent::__construct('replay of previous signature (rollback)', 4); - } -} diff --git a/wrappers/php/src/UnknownVerifyException.php b/wrappers/php/src/UnknownVerifyException.php deleted file mode 100644 index 1290cc3..0000000 --- a/wrappers/php/src/UnknownVerifyException.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php declare(strict_types=1); - -namespace EduVpn\Common; - -/** Other unknown error. */ -final class UnknownVerifyException extends VerifyException -{ - public function __construct(int $code) - { - parent::__construct("unknown verify error ($code)", $code); - } -} diff --git a/wrappers/php/src/VerifyException.php b/wrappers/php/src/VerifyException.php deleted file mode 100644 index 101f728..0000000 --- a/wrappers/php/src/VerifyException.php +++ /dev/null @@ -1,14 +0,0 @@ -<?php declare(strict_types=1); - -namespace EduVpn\Common; - -use Exception; - -/** Verification failed, do not trust the file. */ -abstract class VerifyException extends Exception -{ - public function __construct(string $message, int $code) - { - parent::__construct($message, $code); - } -} diff --git a/wrappers/php/tests/DiscoveryTest.php b/wrappers/php/tests/DiscoveryTest.php deleted file mode 100644 index 9a3e14c..0000000 --- a/wrappers/php/tests/DiscoveryTest.php +++ /dev/null @@ -1,58 +0,0 @@ -<?php declare(strict_types=1); - -use EduVpn\Common\Discovery; -use EduVpn\Common\InvalidSignatureException; -use EduVpn\Common\InvalidSignatureUnknownKeyException; -use EduVpn\Common\SignatureTooOldException; -use PHPUnit\Framework\TestCase; - -class DiscoveryTest extends TestCase -{ - private const TEST_DATA_DIR = '../../src/test_data'; - - public static function setUpBeforeClass(): void - { - preg_match('/[\r\n](\S+)\s*/', file_get_contents(self::TEST_DATA_DIR . '/public.key'), $matches); - Discovery::insecureTestingSetExtraKey($matches[1]); - } - - public function testValid(): void - { - $this->expectNotToPerformAssertions(); - Discovery::verify(file_get_contents(self::TEST_DATA_DIR . '/server_list.json.minisig'), - file_get_contents(self::TEST_DATA_DIR . '/server_list.json'), - 'server_list.json', 10); - } - - public function testInvalidSignature(): void - { - $this->expectException(InvalidSignatureException::class); - Discovery::verify(file_get_contents(self::TEST_DATA_DIR . '/random.txt'), - file_get_contents(self::TEST_DATA_DIR . '/server_list.json'), - 'server_list.json', 0); - } - - public function testWrongKey(): void - { - $this->expectException(InvalidSignatureUnknownKeyException::class); - Discovery::verify(file_get_contents(self::TEST_DATA_DIR . '/server_list.json.wrong_key.minisig'), - file_get_contents(self::TEST_DATA_DIR . '/server_list.json'), - 'server_list.json', 0); - } - - public function testOldSignature(): void - { - $this->expectException(SignatureTooOldException::class); - Discovery::verify(file_get_contents(self::TEST_DATA_DIR . '/server_list.json.minisig'), - file_get_contents(self::TEST_DATA_DIR . '/server_list.json'), - 'server_list.json', 11); - } - - public function testUnknownExpectedFileName(): void - { - $this->expectException(InvalidArgumentException::class); - Discovery::verify(file_get_contents(self::TEST_DATA_DIR . '/other_list.json.minisig'), - file_get_contents(self::TEST_DATA_DIR . '/other_list.json'), - 'other_list.json', 0); - } -} diff --git a/wrappers/swift/.gitignore b/wrappers/swift/.gitignore deleted file mode 100644 index 32d8b26..0000000 --- a/wrappers/swift/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -.DS_Store -.build/ -Packages/ -*.xcodeproj -xcuserdata/ -DerivedData/ -*.xcworkspacedata -*.h diff --git a/wrappers/swift/CEduVpnCommon/Package.swift b/wrappers/swift/CEduVpnCommon/Package.swift deleted file mode 100644 index 884f042..0000000 --- a/wrappers/swift/CEduVpnCommon/Package.swift +++ /dev/null @@ -1,13 +0,0 @@ -// swift-tools-version:5.1 - -import PackageDescription - -let package = Package( - name: "CEduVpnCommon", - products: [ - .library(name: "CEduVpnCommon", targets: ["CEduVpnCommon"]), - ], - targets: [ - .systemLibrary(name: "CEduVpnCommon"), - ] -) diff --git a/wrappers/swift/CEduVpnCommon/Sources/CEduVpnCommon/module.modulemap b/wrappers/swift/CEduVpnCommon/Sources/CEduVpnCommon/module.modulemap deleted file mode 100644 index 2c50cfd..0000000 --- a/wrappers/swift/CEduVpnCommon/Sources/CEduVpnCommon/module.modulemap +++ /dev/null @@ -1,5 +0,0 @@ -module CEduVpnCommon { - header "Headers/eduvpn_common.h" - link "eduvpn_common" - export * -} diff --git a/wrappers/swift/Makefile b/wrappers/swift/Makefile deleted file mode 100644 index 659b51f..0000000 --- a/wrappers/swift/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -.PHONY: build test install-header clean - -EXPORTS_PATH ?= ../../exports -include $(EXPORTS_PATH)/common.mk - -ifeq ($(OS),Windows_NT) -SWIFT = ./swift.cmd -else -SWIFT = swift -endif - -build: install-header - $(SWIFT) build --configuration release -Xlinker -L"$(EXPORTS_LIB_SUBFOLDER_PATH)" - -test: install-header - $(SWIFT) test --parallel -Xlinker -L"$(EXPORTS_LIB_SUBFOLDER_PATH)" - -install-header: .try-build-lib - mkdir -p CEduVpnCommon/Sources/CEduVpnCommon/Headers - cp "$(EXPORTS_LIB_SUBFOLDER_PATH)/$(LIB_NAME).h" CEduVpnCommon/Sources/CEduVpnCommon/Headers/ # Copy header for modulemap - -clean: - rm -rf .build/ CEduVpnCommon/Sources/CEduVpnCommon/Headers/*.h diff --git a/wrappers/swift/Package.swift b/wrappers/swift/Package.swift deleted file mode 100644 index 5b675ac..0000000 --- a/wrappers/swift/Package.swift +++ /dev/null @@ -1,23 +0,0 @@ -// swift-tools-version:5.0 - -import PackageDescription - -let package = Package( - name: "EduVpnCommon", - products: [ - .library( - name: "EduVpnCommon", - targets: ["EduVpnCommon"]), - ], - dependencies: [ - .package(path: "CEduVpnCommon"), - ], - targets: [ - .target( - name: "EduVpnCommon", - dependencies: ["CEduVpnCommon"]), - .testTarget( - name: "EduVpnCommonTests", - dependencies: ["EduVpnCommon"]), - ] -) diff --git a/wrappers/swift/README.md b/wrappers/swift/README.md deleted file mode 100644 index 30642c4..0000000 --- a/wrappers/swift/README.md +++ /dev/null @@ -1,47 +0,0 @@ -# Swift wrapper - -## Requirements - -You will need to install the [Swift SDK](https://www.swift.org/getting-started), which includes the `swift` tool. This -project does not require Xcode as it uses the Swift Package Manager. - -## Build & test - -Build `EduVpnCommon` using shared Go library for current platform: - -```shell -make -``` - -Build `EduVpnCommon` using shared Go library for specified platform, e.g.: - -```shell -make GOOS=linux GOARCH=amd64 -``` - -When using this library, you will need to make sure that the dynamic linker can find the shared Go library. - -Currently, `.dylib`s for multiple architectures generated by cgo are not merged into one. For a pointer on how to do -this, see [this](https://stackoverflow.com/q/22783453). - -<details><summary>Windows</summary><small> -On Windows, you will also need to generate a .lib import library for the .dll. You can -use `exports/generate_lib.ps1` -for this, passing in the path to the DLL file. Execute this from a Visual Studio Developer shell before building the -Swift project. Alternatively, you could use `objdump` and `llvm-dlltool`. You only need to update this if the list of -exported symbols changes.</small></details> - -If you just want to copy over the C header file to the right directory for the modulemap in `CEduVpnCommon`, run: - -```shell -make install-header -``` - -If you do not build this as part of the full repository, specify `EXPORTS_PATH="path/to/exports-folder"` when calling -make. This folder must contain `common.mk` and the `lib/` folder with built libraries and headers. - -Test: - -```shell -make test -``` diff --git a/wrappers/swift/Sources/EduVpnCommon/EduVpnCommon.swift b/wrappers/swift/Sources/EduVpnCommon/EduVpnCommon.swift deleted file mode 100644 index b849626..0000000 --- a/wrappers/swift/Sources/EduVpnCommon/EduVpnCommon.swift +++ /dev/null @@ -1,77 +0,0 @@ -import Foundation -import CEduVpnCommon - -private extension Data { - /// Execute `body` with `GoSlice` pointing to `self` - /// - Important: `GoSlice` pointer must not be written to - func withSlice<ResultType>(_ body: (GoSlice) throws -> ResultType) rethrows -> ResultType { - // Could also use raw NSData.bytes, but then you have to be careful that the NSData must remain valid during the call - // This closure method guarantees this - try withUnsafeBytes { (pointer: UnsafeRawBufferPointer) -> ResultType in - // Note: UnsafeRawBufferPointer.startIndex will always be 0, see docs - // Cast to UnsafeMutableRawPointer, assumes it will not actually be written to - try body(GoSlice(data: UnsafeMutableRawPointer(mutating: pointer.baseAddress), - len: GoInt(pointer.count), cap: GoInt(pointer.count))) - } - } -} - -private extension String { - /// Execute `body` with `GoSlice` pointing to UTF-8 bytes copied from `self` - func withSlice<ResultType>(_ body: (GoSlice) throws -> ResultType) rethrows -> ResultType { - try data(using: .utf8)!.withSlice(body) - } -} - -public enum VerifyErr: Error, Equatable { - /// Expected file name is not one of the recognized values. - case ErrUnknownExpectedFileName - /// Signature is invalid (for the expected file type). - case ErrInvalidSignature - /// Signature was created with an unknown key and has not been verified. - case ErrInvalidSignatureUnknownKey - /// Signature has a timestamp lower than the specified minimum signing time. - case ErrTooOld - /// Other unknown error - case Unknown(code: GoInt8) - - static func fromCode(_ code: GoInt8) -> VerifyErr { - precondition(code != 0) - switch code { - case 1: return ErrUnknownExpectedFileName - case 2: return ErrInvalidSignature - case 3: return ErrInvalidSignatureUnknownKey - case 4: return ErrTooOld - default: return Unknown(code: code) - } - } -} - -/// Verifies the signature on the JSON server_list.json/organization_list.json file. -/// If the function returns, the signature is valid for the given file type. -/// -/// - Parameters: -/// - signature: .minisig signature file contents. -/// - signedJson: Signed .json file contents. -/// - expectedFileName: The file type to be verified, one of "server_list.json" or "organization_list.json". -/// - minSignTime: Minimum time for signature. Should be set to at least the time of the previous signature. -/// - Throws: VerifyErr: If signature verification fails or `expectedFileName` is not one of the allowed values. -public func Verify(signature: Data, signedJson: Data, expectedFileName: String, minSignTime: Date) throws { - let result = signature.withSlice { signatureData in - signedJson.withSlice { jsonData in - expectedFileName.withSlice { expectedNameData in - CEduVpnCommon.Verify(signatureData, jsonData, expectedNameData, GoUint64(minSignTime.timeIntervalSince1970)) - } - } - } - if result != 0 { - throw VerifyErr.fromCode(result) - } -} - -/// Use for testing only, see Go documentation. -internal func InsecureTestingSetExtraKey(keyString: String) { - keyString.withSlice { keyData in - CEduVpnCommon.InsecureTestingSetExtraKey(keyData); - } -} diff --git a/wrappers/swift/Tests/EduVpnCommonTests/EduVpnCommonTests.swift b/wrappers/swift/Tests/EduVpnCommonTests/EduVpnCommonTests.swift deleted file mode 100644 index bd2eabd..0000000 --- a/wrappers/swift/Tests/EduVpnCommonTests/EduVpnCommonTests.swift +++ /dev/null @@ -1,60 +0,0 @@ -import XCTest -@testable import EduVpnCommon - -final class EduVpnCommonTests: XCTestCase { - private static let testDataDir = "../../src/test_data" - - override class func setUp() { - // Swift is confused by CRLF, so on some systems we cannot just take the second-to-last element - InsecureTestingSetExtraKey(keyString: try! String(contentsOfFile: "\(testDataDir)/public.key") - .components(separatedBy: .newlines).last(where: { !$0.isEmpty })!) - } - - func testValid() throws { - try Verify( - signature: try! Data(contentsOf: URL(fileURLWithPath: "\(EduVpnCommonTests.testDataDir)/server_list.json.minisig")), - signedJson: try! Data(contentsOf: URL(fileURLWithPath: "\(EduVpnCommonTests.testDataDir)/server_list.json")), - expectedFileName: "server_list.json", - minSignTime: Date(timeIntervalSince1970: 10)) - } - - func testInvalidSignature() throws { - XCTAssertThrowsError( - try Verify( - signature: try! Data(contentsOf: URL(fileURLWithPath: "\(EduVpnCommonTests.testDataDir)/random.txt")), - signedJson: try! Data(contentsOf: URL(fileURLWithPath: "\(EduVpnCommonTests.testDataDir)/server_list.json")), - expectedFileName: "server_list.json", - minSignTime: Date(timeIntervalSince1970: 0)), - "", {err in XCTAssertEqual(err as? VerifyErr, VerifyErr.ErrInvalidSignature)}); - } - - func testWrongKey() throws { - XCTAssertThrowsError( - try Verify( - signature: try! Data(contentsOf: URL(fileURLWithPath: "\(EduVpnCommonTests.testDataDir)/server_list.json.wrong_key.minisig")), - signedJson: try! Data(contentsOf: URL(fileURLWithPath: "\(EduVpnCommonTests.testDataDir)/server_list.json")), - expectedFileName: "server_list.json", - minSignTime: Date(timeIntervalSince1970: 0)), - "", {err in XCTAssertEqual(err as? VerifyErr, VerifyErr.ErrInvalidSignatureUnknownKey)}); - } - - func testOldSignature() throws { - XCTAssertThrowsError( - try Verify( - signature: try! Data(contentsOf: URL(fileURLWithPath: "\(EduVpnCommonTests.testDataDir)/server_list.json.minisig")), - signedJson: try! Data(contentsOf: URL(fileURLWithPath: "\(EduVpnCommonTests.testDataDir)/server_list.json")), - expectedFileName: "server_list.json", - minSignTime: Date(timeIntervalSince1970: 11)), - "", {err in XCTAssertEqual(err as? VerifyErr, VerifyErr.ErrTooOld)}); - } - - func testUnknownExpectedFile() throws { - XCTAssertThrowsError( - try Verify( - signature: try! Data(contentsOf: URL(fileURLWithPath: "\(EduVpnCommonTests.testDataDir)/other_list.json.minisig")), - signedJson: try! Data(contentsOf: URL(fileURLWithPath: "\(EduVpnCommonTests.testDataDir)/other_list.json")), - expectedFileName: "other_list.json", - minSignTime: Date(timeIntervalSince1970: 0)), - "", {err in XCTAssertEqual(err as? VerifyErr, VerifyErr.ErrUnknownExpectedFileName)}); - } -} diff --git a/wrappers/swift/swift.cmd b/wrappers/swift/swift.cmd deleted file mode 100755 index 57040bd..0000000 --- a/wrappers/swift/swift.cmd +++ /dev/null @@ -1,9 +0,0 @@ -@echo off - -:: Rename PATH -> Path because of swift issue https://github.com/compnerd/swift-build/issues/413 -set _p=%PATH% -set PATH= -set Path=%_p% -set _p= - -swift.exe %* |
