Skip to content

The Fraud Prevention library for Angular (@transmitsecurity/ngx-ts-riskid) is a wrapper of the Mosaic Fraud Prevention JavaScript SDK. Once integrated, the library automatically collects device and behavioral telemetry and submits it to Mosaic for analysis. When specific user actions occur (such as login or account registration), you can report those events to receive risk-based recommendations via the Recommendations backend API.

Capabilities

  • Collects device and behavioral data automatically in the background
  • Reports user action events (login, registration, transaction, etc.) for risk assessment
  • Provides action tokens for correlating client-side and backend events
  • Angular module and injectable service-based API

Installation

npm install @transmitsecurity/ngx-ts-riskid --save

Initialization

Import the NgxTsRiskidModule and configure the RISKID_SDK_CONFIG provider in your root module:

import { NgxTsRiskidModule, RiskidSdkConfig, RISKID_SDK_CONFIG } from '@transmitsecurity/ngx-ts-riskid';

@NgModule({
  declarations: [AppComponent],
  imports: [BrowserModule, FormsModule, HttpClientModule, NgxTsRiskidModule],
  providers: [
    {
      provide: RISKID_SDK_CONFIG,
      useValue: {
        clientId: 'CLIENT_ID',
        serverUrl: 'https://api.transmitsecurity.io/risk-collect/',
      } as RiskidSdkConfig,
    }
  ],
  bootstrap: [AppComponent],
})
export class AppModule { }

Configure the server URL based on your region:

RegionServer URL
UShttps://api.transmitsecurity.io/risk-collect/
EUhttps://api.eu.transmitsecurity.io/risk-collect/
Canadahttps://api.ca.transmitsecurity.io/risk-collect/
Australiahttps://api.au.transmitsecurity.io/risk-collect/
Japanhttps://api.gasne1-ts01.transmitsecurity.io/risk-collect/
Sandboxhttps://api.sbx.transmitsecurity.io/risk-collect/
Custom domainhttps://<your_custom_domain>/risk-collect/ (see Custom domains)

Usage

Inject the NgxTsRiskidService to trigger actions and manage user context:

import { NgxTsRiskidService } from '@transmitsecurity/ngx-ts-riskid';

@Component({ ... })
export class AppComponent {

  constructor(private riskidService: NgxTsRiskidService) {}

  async loginTriggered() {
    const actionResponse = await this.riskidService.triggerAction(NgxTsRiskidService.ACTION_TYPES.LOGIN);
    const actionToken = actionResponse.actionToken;
    // Send actionToken to your backend
  }
}

Next steps