Merge pull request #2814 from PhilippC/feature/otpauth-uris
Add support for otpauth:// URIs
This commit is contained in:
@@ -243,6 +243,15 @@ The scheme=file is still there for old OS devices. It's also queried by apps lik
|
|||||||
<action android:name="keepass2android.ACTION_START_WITH_TASK" />
|
<action android:name="keepass2android.ACTION_START_WITH_TASK" />
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
<data android:scheme="otpauth"/>
|
||||||
|
<data android:host="totp"/>
|
||||||
|
<data android:host="hotp"/>
|
||||||
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<uses-library android:required="false" android:name="com.sec.android.app.multiwindow" />
|
<uses-library android:required="false" android:name="com.sec.android.app.multiwindow" />
|
||||||
<meta-data android:name="com.sec.android.support.multiwindow" android:value="true" />
|
<meta-data android:name="com.sec.android.support.multiwindow" android:value="true" />
|
||||||
|
|||||||
@@ -255,7 +255,14 @@ The scheme=file is still there for old OS devices. It's also queried by apps lik
|
|||||||
<action android:name="keepass2android.ACTION_START_WITH_TASK" />
|
<action android:name="keepass2android.ACTION_START_WITH_TASK" />
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
x
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
<data android:scheme="otpauth"/>
|
||||||
|
<data android:host="totp"/>
|
||||||
|
<data android:host="hotp"/>
|
||||||
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<uses-library android:required="false" android:name="com.sec.android.app.multiwindow" />
|
<uses-library android:required="false" android:name="com.sec.android.app.multiwindow" />
|
||||||
<meta-data android:name="com.sec.android.support.multiwindow" android:value="true" />
|
<meta-data android:name="com.sec.android.support.multiwindow" android:value="true" />
|
||||||
|
|||||||
@@ -236,6 +236,14 @@ The scheme=file is still there for old OS devices. It's also queried by apps lik
|
|||||||
<action android:name="keepass2android.ACTION_START_WITH_TASK" />
|
<action android:name="keepass2android.ACTION_START_WITH_TASK" />
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
<data android:scheme="otpauth"/>
|
||||||
|
<data android:host="totp"/>
|
||||||
|
<data android:host="hotp"/>
|
||||||
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<uses-library android:required="false" android:name="com.sec.android.app.multiwindow" />
|
<uses-library android:required="false" android:name="com.sec.android.app.multiwindow" />
|
||||||
<meta-data android:name="com.sec.android.support.multiwindow" android:value="true" />
|
<meta-data android:name="com.sec.android.support.multiwindow" android:value="true" />
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ using KeePassLib.Serialization;
|
|||||||
using Console = System.Console;
|
using Console = System.Console;
|
||||||
using Object = Java.Lang.Object;
|
using Object = Java.Lang.Object;
|
||||||
using AndroidX.Core.Content;
|
using AndroidX.Core.Content;
|
||||||
|
using Uri = Android.Net.Uri;
|
||||||
|
|
||||||
namespace keepass2android
|
namespace keepass2android
|
||||||
{
|
{
|
||||||
@@ -302,9 +303,23 @@ namespace keepass2android
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
if (Intent.Action == Intent.ActionView)
|
if (Intent.Action == Intent.ActionView)
|
||||||
{
|
{
|
||||||
GetIocFromViewIntent(Intent);
|
if (IsOtpUri(Intent.Data))
|
||||||
|
{
|
||||||
|
AppTask = new CreateEntryThenCloseTask()
|
||||||
|
{
|
||||||
|
AllFields = Newtonsoft.Json.JsonConvert.SerializeObject(new Dictionary<string, string>()
|
||||||
|
{
|
||||||
|
{ "otp", Intent.DataString }
|
||||||
|
})
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GetIocFromViewIntent(Intent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (Intent.Action == Intent.ActionSend)
|
else if (Intent.Action == Intent.ActionSend)
|
||||||
{
|
{
|
||||||
@@ -334,6 +349,11 @@ namespace keepass2android
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool IsOtpUri(Uri? uri)
|
||||||
|
{
|
||||||
|
return uri?.Scheme == "otpauth";
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnStart()
|
protected override void OnStart()
|
||||||
{
|
{
|
||||||
base.OnStart();
|
base.OnStart();
|
||||||
|
|||||||
Reference in New Issue
Block a user