Skip to content
SDKs · ServerIn developmentView source

Ruby

Ruby 3.1+. Depends only on faraday. Wire 8.0 from 0.7.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.

Gemfileruby
gem "rootherald"

The calls

  • RootHerald::Client.new(secret_key:, base_url:)
  • relay_enroll(blob) → the 201 body for the device's EnrollComplete / relay_activate(activation) → device_id. A flat TPM body is the 7.0 shape and is refused locally with ArgumentError.
  • issue_challenge(ask: %w[identity posture], expected_key:, expected_devices:) → Challenge with nonce, challenge.
  • verify(evidence, nonce:, expected_key:, expected_devices:) → AttestResult: verdict (:pass | :warn | :fail), device, device_id, expected, enrollment_required, assurance_claims_met.
  • issue_key_challenge(purpose:, expected_devices:), with "sign" or "decrypt", → KeyChallenge with nonce, key_challenge; certify_key(certification, nonce:) → CertifiedKey with device_id, key_id, alg, format, jwk, hardware_bound.
  • RootHerald::KeySignatures.verify(jwk, message, signature) — ES256 or RS256 by the JWK, OpenSSL, raw or DER.
  • RootHerald::DeviceEncryption.encrypt_to_device(key, plaintext) → the JWE compact serialization only that device opens: ECDH-ES for an EC key, RSA-OAEP-256 for an RSA key, A256GCM for both, with OpenSSL and no Root Herald call. key is the CertifiedKey from certify_key. A sign key is ArgumentError; a macOS apple-ecies key is EnvelopeFormatNotSupportedError, a subclass of it.
  • Errors: InvalidSecretKeyError, ChallengeError, InvalidEvidenceError, InvalidAskError, UnknownPolicyError, AdmissionRefusedError, QuotaExceededError, ActivationRefusedError, RateLimitedError, ExpectedNotEnforcedError; base RootHerald::HttpError carries the other codes. Each is an error code in the API reference.