.NET
Managed C# over HttpClient, .NET 8 LTS and 9. Auth is attached per request, so an injected HttpClient is never mutated. Wire 8.0 from 0.1.0-preview.5.
In development
This SDK is implemented but not yet published to its package registry. Until it ships, collect an opaque evidence blob on the device and appraise it server-side with @rootherald/node (or any available server SDK). The API shown below is the planned surface and may change before release.
terminalbash
dotnet add package RootHerald.AspNetCoreThe calls
new RootHeraldClient(secretKey, baseUrl?, httpClient?)RelayEnrollAsync(blob)→ the 201 body for the device'sEnrollComplete/RelayActivateAsync(activation)→DeviceId. A flat TPM body is the 7.0 shape and is refused locally withArgumentException.IssueChallengeAsync(new ChallengeOptions { Ask = [Ask.Identity, Ask.Posture], ExpectedKey, ExpectedDevices })→RootHeraldChallenge(Nonce, Challenge, ExpiresAt).VerifyAsync(evidence, new AttestOptions { Nonce, ExpectedKey, ExpectedDevices })→AttestResult:Verdict,IsPass,DeviceId,VerdictData,Expected,EnrollmentRequired,AssuranceClaimsMet; a verdict that does not echo the binding isExpectedNotEnforcedException.IssueKeyChallengeAsync(new KeyChallengeOptions { Purpose, ExpectedDevices })→RootHeraldKeyChallenge(Nonce, KeyChallenge, ExpiresAt);CertifyKeyAsync(nonce, certification)→CertifiedKey(DeviceId, KeyId, Purpose, Alg, Format, Jwk, HardwareBound, CertifiedAt).PurposeisKeyPurpose.SignorKeyPurpose.Decrypt;Formatis set on a decrypt key.RootHeraldClient.VerifyKeySignature(jwk, message, signature)— ES256 or RS256 by the JWK,System.Security.Cryptography, raw or DER, never throws.RootHeraldClient.EncryptToDevice(key, plaintext)→ the JWE compact serialization as a string. ECDH-ES for an EC key, RSA-OAEP-256 for an RSA key, A256GCM for both, withSystem.Security.Cryptographyand no Root Herald call. A sign key isArgumentException; a macOSapple-ecieskey isEnvelopeFormatNotSupportedException.- Exceptions:
InvalidSecretKeyException,ChallengeException,InvalidEvidenceException,InvalidAskException,UnknownPolicyException,AdmissionRefusedException,QuotaExceededException,ActivationRefusedException,RateLimitedException; baseRootHeraldApiExceptioncarries the other codes. Each is an error code in the API reference.