For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Log inSign up
Support
GuidesReference
GuidesReference
    • Core
      • Overview
    • Agents
      • Overview
      • AgentBase
      • AgentServer
      • Configuration
        • AuthHandler
        • ConfigLoader
        • Environment Variables
        • Logging
        • PromptManager
        • SchemaUtils
        • ServerlessAdapter
        • SessionManager
        • SslConfig
          • getCert
          • getHstsHeader
          • getKey
          • getServerOptions
          • hstsMiddleware
          • isConfigured
      • ContextBuilder
      • DataMap
      • FunctionResult
      • Helper Functions & Utilities
      • LiveWire
      • PomBuilder
      • Prefabs
      • SkillBase
      • SkillManager
      • SkillRegistry
      • Skills
      • SwaigFunction
      • SwmlBuilder
      • SWMLService
    • RELAY
      • Overview
      • Actions
      • Call
      • Constants
      • Events
      • Message
      • RelayClient
      • RelayError
    • REST Client
      • Overview
      • Addresses
      • Calling
      • ChatResource
      • Compat
      • Datasphere
      • Fabric
      • ImportedNumbersResource
      • Logs
      • LookupResource
      • MFA
      • Number Groups
      • Phone Numbers
      • Project
      • PubSubResource
      • Queues
      • Recordings
      • Registry
      • RestClient
      • RestError
      • Short Codes
      • SIP Profile
      • Verified Callers
      • Video
LogoLogoSignalWire Docs
Log inSign up
Support
On this page
  • Constructor
  • Properties
  • Methods
  • Example
AgentsConfiguration

SslConfig

|View as Markdown|Open in Claude|
Was this page helpful?
Edit this page
Previous

getCert

Next
Built with

SslConfig manages SSL/TLS configuration for serving agents over HTTPS. It reads from explicit options or falls back to environment variables (SWML_SSL_ENABLED, SWML_SSL_CERT_PATH, SWML_SSL_KEY_PATH, SWML_SSL_DOMAIN). See Environment Variables for the full list.

1import { SslConfig } from '@signalwire/sdk';
2
3const ssl = new SslConfig({ certPath: './cert.pem', keyPath: './key.pem' });

Constructor

opts
SslOptions

Optional SSL configuration overrides. Any field omitted falls back to the corresponding SWML_SSL_* environment variable. Accepts the same keys as the Properties section below (enabled, certPath, keyPath, domain, hsts, hstsMaxAge).

Properties

enabled
boolean

Whether SSL is enabled. Falls back to SWML_SSL_ENABLED env var.

certPath
string | null

Filesystem path to the PEM-encoded certificate. Falls back to SWML_SSL_CERT_PATH.

keyPath
string | null

Filesystem path to the PEM-encoded private key. Falls back to SWML_SSL_KEY_PATH.

domain
string | null

Domain name for HSTS headers. Falls back to SWML_SSL_DOMAIN.

hsts
booleanDefaults to true

Whether to emit Strict-Transport-Security headers.

hstsMaxAge
numberDefaults to 31536000

HSTS max-age value in seconds (default 1 year).

Methods

isConfigured

Check if SSL is fully configured with cert and key files.

getCert

Read the PEM certificate from disk.

getKey

Read the PEM private key from disk.

getHstsHeader

Build the HSTS header value.

getServerOptions

Create options for Node.js https.createServer().

hstsMiddleware

Hono middleware that appends HSTS headers.

Example

1import { SslConfig } from '@signalwire/sdk';
2
3const ssl = new SslConfig();
4
5if (ssl.isConfigured()) {
6 const opts = ssl.getServerOptions();
7 console.log('SSL ready with cert and key');
8} else {
9 console.log('SSL not configured — set SWML_SSL_ENABLED=true');
10}