0.13.0 • Published 1 year ago

@peersyst/xumm-module v0.13.0

Weekly downloads
-
License
-
Repository
-
Last release
1 year 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

1 year ago

0.12.73

1 year ago

0.12.71

1 year ago

0.12.70

1 year ago

0.12.56

2 years ago

0.12.55

2 years ago

0.12.40

2 years ago

0.12.15

2 years ago

0.12.13

2 years ago

0.12.12

2 years ago

0.12.11

2 years ago

0.12.10

2 years ago

0.12.0

2 years ago

0.11.40

2 years ago

0.11.39

2 years ago

0.11.38

2 years ago

0.11.37

2 years ago

0.11.36

2 years ago

0.11.35

2 years ago

0.11.34

2 years ago

0.11.32

2 years ago

0.11.31

2 years ago

0.11.30

2 years ago

0.11.29

2 years ago

0.11.28

2 years ago

0.11.27

2 years ago

0.11.26

2 years ago

0.11.20

2 years ago

0.11.19

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.11.12

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.11.8

2 years ago

0.1.0

2 years ago

0.11.5

2 years ago

0.11.4

2 years ago

0.11.3

2 years ago

0.0.2

2 years ago

0.11.2

2 years ago

0.11.1

2 years ago

0.0.1

2 years ago