Go
Dependency-free module over net/http. Construct once; safe for concurrent use. Wire 8.0 from v0.3.0.
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
go get github.com/RootHerald/sdk-goThe calls
rootherald.NewClient(secretKey, WithBaseURL(…), WithHTTPClient(…))RelayEnroll(ctx, blob)orRelayEnrollJSON(ctx, body)→ the 201 body for the device'sEnrollComplete/RelayActivate(ctx, activation)→DeviceID. A flat TPM body is the 7.0 shape and is refused locally withErrInvalidEnrollBlob.IssueChallengeWithOptions(ctx, ChallengeOptions{Ask, ExpectedKey, ExpectedDevices})→Challenge{Nonce, Challenge, ExpiresAt}.IssueChallenge(ctx)asks for identity + posture.Verify(ctx, evidence, AttestOptions{Nonce, RequestedDisclosureClass, ExpectedKey, ExpectedDevices})→AttestResult{Verdict, Device, Expected, AssuranceClaimsMet, EnrollmentRequired, Raw}; a verdict that does not echo the binding isErrExpectedNotEnforced.IssueKeyChallenge(ctx, KeyChallengeOptions{Purpose, ExpectedDevices})→KeyChallenge{Nonce, KeyChallenge, ExpiresAt};CertifyKey(ctx, nonce, certification)→CertifiedKey{DeviceID, KeyID, Purpose, Alg, Format, JWK, HardwareBound, CertifiedAt}.Formatis set on a decrypt key.VerifyKeySignature(jwk, message, signature) bool— ES256 or RS256 by the JWK,crypto/ecdsa/crypto/rsa, raw or DER, never panics.EncryptToDevice(key CertifiedKey, plaintext []byte) (string, error)— the JWE compact serialization only that device opens: ECDH-ES for an EC key, RSA-OAEP-256 for an RSA key, A256GCM for both, withcrypto/ecdh/crypto/rsaand no Root Herald call. A sign key isErrInvalidArgument; a macOSapple-ecieskey isErrEnvelopeFormatNotSupported.- Sentinels for
errors.Is:ErrInvalidSecretKey,ErrChallenge,ErrInvalidEvidence,ErrInvalidAsk,ErrUnknownPolicy,ErrAdmissionRefused,ErrQuotaExceeded,ErrActivationRefused,ErrRateLimited; other codes areErrAttestHTTPwithAPIError.Codepreserved. Each is an error code in the API reference.