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r8KuTxSfMOGWtazQeipI//XyLCvV7BohkL6PhzMKKHwAoM/0xNaqA0d5t9Q32OqEn6I+deu4SF4OwMXkQ96xGp0zLlsWnw3HdG2rVtx5KYARMmGA=YA+CqdT0RXQUyyTacKp4hY3PI58oxI/9L9by52cX6VAgCKMsplDKkwad0vwveLGQ5WqaKIjME88xy+NHiMTAYycECDgs1ZNA+RrHHEDBL9vznQkINPQ0GDB9u7E2vVnttHVoLR31KY9gKe9nLJ9Y2WtF9JN3mVpYZa9NUfXOLVc+zs6ChwqfryfrkgQGHZXNFtwYhG4KuOLkrQy2S4etJEWn+NMbJVYEmy1Sg99BZs4eyi0666B30ofUsx6GwyCa9IXgDm4cJnUDQu0ZEGNU7LX+p9lFym13DkWt4z9TuE3QeOSr7jHEQz1CdE8a4zsqdf3TKP2Fl05+URL35kr/MQ==";
+ var rsa = RSA.Create(2048);
+ rsa.FromXmlString(privateKeyXml);
+
+ options.AddEncryptionKey(new SymmetricSecurityKey(Convert.FromBase64String("DRjd/GnduI3Efzen9V9BvbNUfc/VKgXltV7Kbk9sMkY=")));
+ options.AddSigningKey(new RsaSecurityKey(rsa));
+
+ return options;
+ }
+
+}
\ No newline at end of file
diff --git a/sandbox/OpenIddict.Sandbox.Avalonia.Client/OpenIddict.Sandbox.Avalonia.Client/OpenId/MauiHostApplicationLifetime.cs b/sandbox/OpenIddict.Sandbox.Avalonia.Client/OpenIddict.Sandbox.Avalonia.Client/OpenId/MauiHostApplicationLifetime.cs
new file mode 100644
index 000000000..8e6624aad
--- /dev/null
+++ b/sandbox/OpenIddict.Sandbox.Avalonia.Client/OpenIddict.Sandbox.Avalonia.Client/OpenId/MauiHostApplicationLifetime.cs
@@ -0,0 +1,24 @@
+//#if IOS || MACCATALYST || WINDOWS
+using Microsoft.Extensions.Hosting;
+using System;
+using System.Threading;
+
+namespace OpenIddict.Sandbox.Maui.Client;
+
+public class MauiHostApplicationLifetime : IHostApplicationLifetime
+{
+ private readonly CancellationTokenSource _source = new();
+
+ public CancellationToken ApplicationStarted => new(canceled: true);
+
+ public CancellationToken ApplicationStopping => _source.Token;
+
+ public CancellationToken ApplicationStopped => _source.Token;
+
+ public void StopApplication()
+ {
+ _source.Cancel(throwOnFirstException: false);
+ Environment.Exit(0);
+ }
+}
+//#endif
diff --git a/sandbox/OpenIddict.Sandbox.Avalonia.Client/OpenIddict.Sandbox.Avalonia.Client/OpenId/MauiHostedServiceAdapter.cs b/sandbox/OpenIddict.Sandbox.Avalonia.Client/OpenIddict.Sandbox.Avalonia.Client/OpenId/MauiHostedServiceAdapter.cs
new file mode 100644
index 000000000..66697f41c
--- /dev/null
+++ b/sandbox/OpenIddict.Sandbox.Avalonia.Client/OpenIddict.Sandbox.Avalonia.Client/OpenId/MauiHostedServiceAdapter.cs
@@ -0,0 +1,20 @@
+//#if IOS || MACCATALYST || WINDOWS
+using Microsoft.Extensions.Hosting;
+using Microsoft.Maui.Hosting;
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace OpenIddict.Sandbox.Maui.Client;
+
+public class MauiHostedServiceAdapter : IMauiInitializeService
+{
+ private readonly IHostedService _service;
+
+ public MauiHostedServiceAdapter(IHostedService service)
+ => _service = service ?? throw new ArgumentNullException(nameof(service));
+
+ public void Initialize(IServiceProvider services)
+ => Task.Run(() => _service.StartAsync(CancellationToken.None)).GetAwaiter().GetResult();
+}
+//#endif
diff --git a/sandbox/OpenIddict.Sandbox.Avalonia.Client/OpenIddict.Sandbox.Avalonia.Client/OpenId/MauiHosting.cs b/sandbox/OpenIddict.Sandbox.Avalonia.Client/OpenIddict.Sandbox.Avalonia.Client/OpenId/MauiHosting.cs
new file mode 100644
index 000000000..c2c68670c
--- /dev/null
+++ b/sandbox/OpenIddict.Sandbox.Avalonia.Client/OpenIddict.Sandbox.Avalonia.Client/OpenId/MauiHosting.cs
@@ -0,0 +1,27 @@
+using System;
+
+namespace Microsoft.Maui.Hosting
+{
+ ///