Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SkillRequestSignatureVerifier

Implementation of Verifier which provides a utility method to verify the signature of a skill request.

Hierarchy

  • SkillRequestSignatureVerifier

Implements

Index

Constructors

constructor

Properties

Protected certCache

certCache: Map<string, string>

Methods

Private _getCertChainByUrl

  • _getCertChainByUrl(signatureCertChainUrl: string): Promise<string>
  • Loads the certificate chain from the URL.

    This method use the validated certificate url to retrieve certificate chain

    Parameters

    • signatureCertChainUrl: string

      URL for retrieving certificate chain

    Returns Promise<string>

Private _loadCertChain

  • _loadCertChain(signatureCertChainUrl: string): Promise<string>
  • Load certificate chain

    This method loads the certificate chain from the certificate cache. If there is a cache miss, the certificate chain is loaded from the certificate URL. If certificate chain is loaded from URL, validate it before return.

    Parameters

    • signatureCertChainUrl: string

      URL for retrieving certificate chain

    Returns Promise<string>

Private _validateCertChain

  • _validateCertChain(pemCert: string): void
  • Validate certificate chain

    This method uses the crypto module pki functions to validate the signature chain It checks if the passed in certificate chain is valid, i.e it is not expired and the Alexa domain is present in the SAN extensions of the certificate chain.

    Parameters

    • pemCert: string

      Certificate chain in pem format

    Returns void

Private _validateCertificateUrl

  • _validateCertificateUrl(signatureCertChainUrl: string): void

Private _validateRequestBody

  • _validateRequestBody(pemCert: string, signature: string, requestEnvelope: string): void
  • Validate the request body hash with signature

    This method checks if the hash value of the request body matches with the hash value of the signature

    Parameters

    • pemCert: string

      Certificate chain in pem format

    • signature: string

      Encrypted signature of the request

    • requestEnvelope: string

      Request body of the input POST request in string format

    Returns void

Private _validateUrlAndRetrieveCertChain

  • _validateUrlAndRetrieveCertChain(signatureCertChainUrl: string): Promise<string>
  • Validate Url and retrieve certificate chain

    This method validates if the URL is valid and loads the certificate chain, before returning it.

    Parameters

    • signatureCertChainUrl: string

      URL for retrieving certificate chain

    Returns Promise<string>

verify

  • verify(requestEnvelope: string, headers: IncomingHttpHeaders): Promise<void>