0.13.0 • Published 2 years ago

@peersyst/xumm-module v0.13.0

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

Description

Nest framework TypeScript Module for interacting with XUMM wallet.

How to use it

Base kyc module

  • Import and register KycModule in AppModule and apply Signature middleware for SumsubController
import { Module, NestModule, MiddlewareConsumer } from "@nestjs/common";
import { KycModule, SignatureMiddleware, SumsubController, OrmType } from "@peersyst/kyc-module";

@Module({
    imports: [
        ConfigModule.forRoot(...),
        TypeOrmModule.forRootAsync(...),
        UserModule,
        KycModule.register(UserModule, ConfigModule, {
          ormType: OrmType.TYPEORM,
        }),
    ],
})
export class AppModule implements NestModule {
  configure(consumer: MiddlewareConsumer) {
    consumer.apply(SignatureMiddleware).forRoutes(SumsubController);
  }
}
  • Add configService configuration variables
export default (): any => ({
    sumsub: {
        secretKey: process.env.SUMSUB_SECRET_KEY,
        baseUrl: process.env.SUMSUB_BASE_URL,
        appToken: process.env.APP_TOKEN,
    },
});
  • Add KycErrorCode and KycErrorBody to app ErrorCodes
import { HttpStatus } from "@nestjs/common";
import { KycErrorCode, KycErrorBody } from "@peersyst/kyc-module";

// Define app error codes
enum AppErrorCode {}

export const ErrorCode = { ...AppErrorCode, ...KycErrorCode };
export type ErrorCodeType = AppErrorCode | KycErrorCode;

export const ErrorBody: { [code in ErrorCodeType]: { statusCode: HttpStatus; message: string } } = {
    // Define app error code bodies
    ...KycErrorBody,
};
  • If ormType is sequelize: create model in your models folder with name KycModel
export { KycModel } from "@peersyst/kyc-module";
  • If ormType is typeorm: create entity in your entities folder with name KycEntity
export { KycEntity } from "@peersyst/kyc-module";

Add Notifications

  • Set notifications to true in register module and add NotificationService
KycModule.register(UserModule, ConfigModule, {
    ...
    notifications: true,
    NotificationService: MyNotificationService,
}),
  • Implement KycNotificationInterface for your NotificationService
import { KycNotificationInterface } from "@peersyst/kyc-module";

@Injectable()
export class MyNotificationService implements KycNotificationInterface {...}

License

Nest is MIT licensed.

0.13.0

2 years ago

0.12.73

2 years ago

0.12.71

2 years ago

0.12.70

2 years ago

0.12.56

3 years ago

0.12.55

3 years ago

0.12.40

3 years ago

0.12.15

3 years ago

0.12.13

3 years ago

0.12.12

3 years ago

0.12.11

3 years ago

0.12.10

3 years ago

0.12.0

3 years ago

0.11.40

3 years ago

0.11.39

3 years ago

0.11.38

3 years ago

0.11.37

3 years ago

0.11.36

3 years ago

0.11.35

3 years ago

0.11.34

3 years ago

0.11.32

3 years ago

0.11.31

3 years ago

0.11.30

3 years ago

0.11.29

3 years ago

0.11.28

3 years ago

0.11.27

3 years ago

0.11.26

3 years ago

0.11.20

3 years ago

0.11.19

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.11.12

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.11.8

3 years ago

0.1.0

3 years ago

0.11.5

3 years ago

0.11.4

3 years ago

0.11.3

3 years ago

0.0.2

3 years ago

0.11.2

3 years ago

0.11.1

3 years ago

0.0.1

3 years ago