@creator.co/module-identity-client - v1.1.11
    Preparing search index...

    Class Utils

    Utility class with static methods for common operations such as string and number validation, case-insensitive object manipulation, Node.js environment detection, timestamp calculations, encryption and decryption using PKCS standards, and opening external pages.

    Index

    Constructors

    Properties

    caseInsensitiveObjectForKey: (obj: any, key: any) => any = ...

    Finds the value in the given object for a case-insensitive key match.

    Type declaration

      • (obj: any, key: any): any
      • Parameters

        • obj: any

          The object to search for the key.

        • key: any

          The key to search for in a case-insensitive manner.

        Returns any

        The value corresponding to the key if found, otherwise null.

    caseInsensitiveObjectForKeyOnArray: (obj: any, key: any) => any = ...

    Searches for a case-insensitive key in an array of objects and returns the corresponding value.

    Type declaration

      • (obj: any, key: any): any
      • Parameters

        • obj: any

          The array of objects to search through.

        • key: any

          The key to search for in a case-insensitive manner.

        Returns any

        The value corresponding to the key if found, otherwise null.

    caseInsensitiveSetObjectForKey: (obj: any, key: any, value: any) => any = ...

    Sets a key-value pair in an object with case-insensitive key matching. If a key with the same name (case-insensitive) already exists, it updates the value.

    Type declaration

      • (obj: any, key: any, value: any): any
      • Parameters

        • obj: any

          The object to set the key-value pair in.

        • key: any

          The key to set in the object (case-insensitive).

        • value: any

          The value to set for the key.

        Returns any

        The updated object with the key-value pair set.

    decryptPKCS: (privateKey: any, hash: any) => any = ...

    Decrypts a hash using the provided private key using RSAES-PKCS1-V1_5 padding scheme.

    Type declaration

      • (privateKey: any, hash: any): any
      • Parameters

        • privateKey: any

          The private key used for decryption.

        • hash: any

          The hash to be decrypted.

        Returns any

        The decrypted hash.

    encryptPKCS: (publicKey: any, object: any) => string = ...

    Encrypts the given object using the provided public key using RSAES-PKCS1-V1_5 encryption scheme.

    Type declaration

      • (publicKey: any, object: any): string
      • Parameters

        • publicKey: any

          The public key used for encryption.

        • object: any

          The object to be encrypted.

        Returns string

        The encrypted object encoded in base64 format.

    isAccessEnabled: (flag: AccessLevel, accessLevel: AccessLevel) => boolean = ...
    isNodeJS: () => boolean = ...

    Checks if the code is running in a Node.js environment.

    Type declaration

      • (): boolean
      • Returns boolean

        true if running in Node.js, false otherwise

    isValidNumber: (number: any) => boolean = ...

    Checks if the input is a valid number.

    Type declaration

      • (number: any): boolean
      • Parameters

        • number: any

          The input to be checked for validity as a number.

        Returns boolean

        Returns true if the input is a valid number, false otherwise.

    isValidString: (string: any) => boolean = ...

    Check if a given value is a valid string.

    Type declaration

      • (string: any): boolean
      • Parameters

        • string: any

          The value to be checked.

        Returns boolean

        Returns true if the value is a non-empty string and not an array, otherwise false.

    loadPublicKey: (publicKey: string) => PublicKey = ...

    Load a public key from a PEM formatted string using Forge library.

    Type declaration

      • (publicKey: string): PublicKey
      • Parameters

        • publicKey: string

          The public key in PEM format.

        Returns PublicKey

        The public key object.

    openExternalPage: (url: any, appendProtocol: any) => void = ...

    Opens an external page in a new tab/window.

    Type declaration

      • (url: any, appendProtocol: any): void
      • Parameters

        • url: any

          The URL of the external page to open.

        • appendProtocol: any

          A flag indicating whether to append the protocol from the current page's URL.

        Returns void

        None

    timestampAfterHours: (hours: any) => any = ...

    Returns a timestamp after the specified number of hours from the current date and time.

    Type declaration

      • (hours: any): any
      • Parameters

        • hours: any

          The number of hours to add to the current date and time.

        Returns any

        The timestamp after the specified number of hours.

    timestampAfterHoursFromDate: (hours: any, date: any) => any = ...

    Calculates the timestamp after adding a specified number of hours to a given date.

    Type declaration

      • (hours: any, date: any): any
      • Parameters

        • hours: any

          The number of hours to add to the date.

        • date: any

          The initial date to start from.

        Returns any

        The timestamp representing the date after adding the specified hours.