Https Psndlnet Packages -
using Microsoft.Extensions.DependencyInjection;
using Psndlnet.Auth;
using Psndlnet.Core;
using Psndlnet.Http;
using Psndlnet.SecureStorage;
// Register all required services
var services = new ServiceCollection();
services.AddSingleton<ISecureTokenStore, FileSecureStore>(sp =>
new FileSecureStore(Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
"MyApp",
"psn-token.json")));
services.AddHttpClient<IPsnHttpClient, PsnHttpClient>()
.ConfigureHttpClient(client => client.BaseAddress = new Uri("https://api.playstation.com/"));
services.AddSingleton<IPsnAuthenticator, PsnAuthenticator>();
services.AddSingleton<IPsnClient, PsnClient>();
var provider = services.BuildServiceProvider();
| Package | Target Frameworks | Primary Purpose | Key Types |
|---------|-------------------|----------------|-----------|
| Psndlnet.Core | .NET Standard 2.1, .NET 6+ | Base abstractions (interfaces, models, exception hierarchy) | IPsnClient, PsnResponse<T> |
| Psndlnet.Http | .NET Standard 2.1, .NET 6+ | HTTP wrapper built on HttpClient with forced TLS 1.2/1.3 | PsnHttpClient, PsnRequestOptions |
| Psndlnet.Auth | .NET Standard 2.1, .NET 6+ | OAuth 2.0 token acquisition, refresh, revocation | PsnAuthenticator, OAuthToken |
| Psndlnet.SecureStorage | .NET Standard 2.1, .NET 6+ | Secure persistance of tokens/keys (DPAPI, Keychain, Android Keystore) | ISecureTokenStore, FileSecureStore |
| Psndlnet.Logging (optional) | .NET Standard 2.1, .NET 6+ | Structured logging of request/response metadata (never logs payloads) | PsnLogger, LogLevel |
Note: All packages are version‑matched; e.g.,
Psndlnet.Httpv2.3.0 works only withPsndlnet.Corev2.3.0. Keep them synchronized. https psndlnet packages
https://psndl.net/packages
services.AddHttpClient<IPsnHttpClient, PsnHttpClient>()
.ConfigurePrimaryHttpMessageHandler(() =>
var handler = new HttpClientHandler();
handler.ServerCertificateCustomValidationCallback = (request, cert, chain, errors) =>
// Expected SHA‑256 fingerprint of api.playstation.com TLS cert
const string ExpectedThumbprint = "A1B2C3D4E5F67890123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0";
// Compare thumbprint (case‑insensitive)
var actual = cert.GetCertHashString(HashAlgorithmName.SHA256);
return string.Equals(actual, ExpectedThumbprint, StringComparison.OrdinalIgnoreCase);
;
return handler;
);
Security tip: Keep the pinned thumbprint in a secure, version‑controlled location. Rotate it whenever Sony renews the certificate. using Microsoft
