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
          • expressMiddleware
          • getAuthInfo
          • hasApiKeyAuth
          • hasBasicAuth
          • hasBearerAuth
          • middleware
          • validate
          • verifyApiKey
          • verifyBasicAuth
          • verifyBearerToken
        • ConfigLoader
        • Environment Variables
        • Logging
        • PromptManager
        • SchemaUtils
        • ServerlessAdapter
        • SessionManager
        • SslConfig
      • 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
  • Parameters
  • Returns
  • Example
AgentsConfigurationAuthHandler

verifyBasicAuth

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

verifyBearerToken

Next
Built with

Verify a Basic Auth username/password pair against the configured credentials. Uses a constant-time comparison to prevent timing attacks. Useful for custom auth flows where you need to check credentials outside a middleware context.

Returns false immediately when Basic Auth is not configured (i.e., basicAuth was not passed to the constructor). For full request validation including Bearer and API key fallbacks, use validate() or attach middleware() to your Hono app.

Parameters

username
stringRequired

The username to verify.

password
stringRequired

The password to verify.

Returns

boolean — true if the credentials match; false if they don’t, or if Basic Auth was not configured.

Example

1import { AuthHandler } from '@signalwire/sdk';
2
3const auth = new AuthHandler({
4 basicAuth: ['admin', 'secret-password'],
5});
6
7function login(username: string, password: string) {
8 if (auth.verifyBasicAuth(username, password)) {
9 return { ok: true, user: username };
10 }
11 return { ok: false };
12}