Options
All
  • Public
  • Public/Protected
  • All
Menu

Class implementing cryptographic operations required to sign and verify the validity of access tokens (i.e. the IAccessTokenSigner interface from virgil-sdk), using VirgilCrypto.

Hierarchy

  • VirgilAccessTokenSigner

Index

Constructors

constructor

Methods

generateTokenSignature

  • generateTokenSignature(token: Buffer | string, privateKey: IPrivateKey): Buffer
  • Generates digital signature of the given access token using the given private key.

    Parameters

    • token: Buffer | string

      The access token bytes.

    • privateKey: IPrivateKey

      The private key object.

    Returns Buffer

    • The signature.

getAlgorithm

  • getAlgorithm(): string
  • Returns an identifier of the algorithm used for signature calculation and verification.

    Returns string

    The algorithm identifier. Currently 'VEDS512'

verifyTokenSignature

  • verifyTokenSignature(token: Buffer | string, signature: Buffer | string, publicKey: IPublicKey): boolean
  • Verifies the validity of the given signature for the given token and public key.

    Parameters

    • token: Buffer | string

      The token.

    • signature: Buffer | string

      The signature.

    • publicKey: IPublicKey

      The signer's public key.

    Returns boolean

    • true if signature is valid, otherwise false