JavaScript HSM API Dinamo

    kind_interface User

    interface User {
        create(
            userId: string,
            password: string,
            permissions?: USER_PERMISSIONS[],
        ): Promise<boolean>;
        remove(userId: string): Promise<boolean>;
        block(userId: string): Promise<boolean>;
        unblock(userId: string): Promise<boolean>;
        changePassword(newPassword: string): Promise<boolean>;
        listTokens(): Promise<string[]>;
        generateToken(expiration?: Date): Promise<string>;
        revokeToken(token: string): Promise<boolean>;
    }
    theme_index

    kind_plural_method

    • Create a user in HSM.

      kind_plural_parameter

      theme_returns Promise<boolean>

      Returns true if the user was created successfully.

      Throws an exception if an error occurs when creating the user.

      Throws exception if userId or password are invalid.

      Example code: Creating a user

    • Removes a user from HSM.

      kind_plural_parameter

      theme_returns Promise<boolean>

      Returns true if the user was successfully removed.

      Throws an exception if an error occurs when removing the user.

      Throws exception if userId is invalid.

      Example code: Removing a user

    • Blocks a user in HSM.

      kind_plural_parameter

      theme_returns Promise<boolean>

      Example code: Blocking a user

    • Unlocks a user in HSM.

      kind_plural_parameter

      theme_returns Promise<boolean>

      Example code: Unlocking a user

    • Changes the authenticated user's password.

      kind_plural_parameter

      theme_returns Promise<boolean>

      Returns true if the password was changed successfully.

      Throws exception if an error occurs when changing the password.

      Throws exception if new password is invalid.

    • Lists the tokens of the authenticated user.

      theme_returns Promise<string[]>

      Returns an array with the user's tokens.

      Throws an exception if an error occurs when listing the tokens.

      Throws exception if token is invalid.

      Example code: Listing access tokens

    • Generates a token for the authenticated user.

      kind_plural_parameter

      • flag_optionalexpiration: Date

        Token expiration date. Default: No expiration.

      theme_returns Promise<string>

      Returns the generated token.

      Throws exception if an error occurs when generating the token.

      Throws exception if expiration date is invalid.

      Example code: Generating an access token

    • Revoke an authenticated user's token.

      kind_plural_parameter

      • token: string

        Token to be revoked. The token generated by the generateToken method or returned by the listTokens method.

      theme_returns Promise<boolean>

      Returns true if the token was successfully revoked.

      Throws exception if an error occurs when revoking the token.

      Throws exception if token is invalid.

      Example code: Revoking an access token

    MMNEPVFCICPMFPCPTTAAATR