Options
All
  • Public
  • Public/Protected
  • All
Menu
description

The main service to handle documents in the authChallenges collection.

since

v0.3.0

Hierarchy

  • ChallengesService

Index

Constructors

Methods

  • This method executes a count query using the {@link model} argument.

    Caution: Count queries require a considerable amount of RAM to execute. It is preferred to use pro-active statistics with collections that contain one document with a counter.

    Parameters

    Returns Promise<number>

    The number of matching challenges.

  • This method updates exactly one document in a collection and uses an upsert operation if it doesn't exist yet.

    async

    Parameters

    • query: AuthChallengeQuery

      The query configuration with sort, order, pageNumber, pageSize.

    • data: AuthChallengeModel

      The fields or data that has to be updated (will be added to $set: {}).

    • ops: Record<string, any> = {}

      The operations that must be run additionally (e.g. $inc: {}) (optional).

    Returns Promise<AuthChallengeDocument>

    The updated authChallenges document.

  • Method to query the existence of a document in the authChallenges collection.

    This executes a lean mongoose query such that the properties of the returned document are reduced to only the "_id" field.

    Parameters

    • query: AuthChallengeQuery

      The query configuration with sort, order, pageNumber, pageSize.

    Returns Promise<boolean>

    Whether a document exists which validates the passed query.

  • generateChallenge(challengeSize?: number): string
  • This method generates a random authentication challenge.

    The size of the generated authentication challenges can be changed in the configuration file config/security.ts.

    Note that by modifying the default challenge size, you may affect the operations processor and thereby the data that is returned by the backend.

    Parameters

    • challengeSize: number = 8

      (Optional) The size of the generated authentication challenge, defaults to 8.

    Returns string

    An authentication challenge that can be attached on-chain.

Generated using TypeDoc