Gathering detailed insights and metrics for @getlarge/kratos-client-wrapper
Gathering detailed insights and metrics for @getlarge/kratos-client-wrapper
A suite of libraries to make NestJS and Ory fall in love
npm install @getlarge/kratos-client-wrapper
Typescript
Module System
Node Version
NPM Version
69.7
Supply Chain
98
Quality
82
Maintenance
100
Vulnerability
100
License
keto-cli@0.2.9
Published on 01 Feb 2025
keto-client-wrapper@0.6.0
Published on 01 Feb 2025
keto-cli@0.2.8
Published on 12 Nov 2024
keto-client-wrapper@0.5.0
Published on 12 Nov 2024
keto-cli@0.2.7
Published on 06 Nov 2024
keto-client-wrapper@0.4.0
Published on 06 Nov 2024
TypeScript (94.08%)
JavaScript (5.52%)
Dockerfile (0.4%)
Total Downloads
10,796
Last Day
24
Last Week
234
Last Month
707
Last Year
10,582
15 Stars
215 Commits
1 Watching
10 Branches
1 Contributors
Minified
Minified + Gzipped
Latest Version
0.2.2
Package Id
@getlarge/kratos-client-wrapper@0.2.2
Unpacked Size
61.16 kB
Size
12.11 kB
File Count
51
NPM Version
10.9.0
Node Version
20.11.0
Publised On
07 Oct 2024
Cumulative downloads
Total Downloads
Last day
-7.7%
24
Compared to previous day
Last week
16.4%
234
Compared to previous week
Last month
28.1%
707
Compared to previous month
Last year
4,844.9%
10,582
Compared to previous year
1
4
This library is a wrapper around the Ory Kratos client - @ory/client. It provides :
OryIdentitiesModule
: a module to interact with the Ory Kratos Identities APIOryFrontendModule
: a module to interact with the Ory Kratos Frontend APIOryAuthenticationGuard
: a guard to protect your routes based on the Ory Kratos session1npm install @getlarge/kratos-client-wrapper
Import the module in your app:
1import { 2 OryIdentitiesModule, 3 OryFrontendModule, 4} from '@getlarge/kratos-client-wrapper'; 5import { Module } from '@nestjs/common'; 6 7@Module({ 8 imports: [ 9 OryIdentitiesModule.forRoot({ 10 basePath: 'http://localhost:4434', 11 accessToken: 'my-access-token', 12 }), 13 OryFrontendModule.forRootAsync({ 14 useFactory: () => ({ 15 baseUrl: 'http://localhost:4433', 16 }), 17 }), 18 ], 19}) 20export class YourModule {}
Inject the service in your provider:
1import { OryIdentitiesService } from '@getlarge/kratos-client-wrapper'; 2import { Injectable } from '@nestjs/common'; 3 4@Injectable() 5export class YourService { 6 constructor(private readonly oryIdentitiesService: OryIdentitiesService) {} 7}
Use the Guard to protect your routes:
1import { OryAuthenticationGuard } from '@getlarge/kratos-client-wrapper'; 2import { Controller, Get, Logger, UseGuards } from '@nestjs/common'; 3 4@Controller() 5export class YourController { 6 @UseGuards( 7 OryAuthenticationGuard({ 8 postValidationHook: (ctx, session) => { 9 const req = ctx.switchToHttp().getRequest(); 10 req.session = session; 11 req.user = session.identity; 12 }, 13 isValidSession(session): boolean { 14 return !!session.active; 15 }, 16 sessionTokenResolver: (ctx) => 17 ctx 18 .switchToHttp() 19 .getRequest() 20 ?.headers?.authorization?.replace('Bearer ', ''), 21 }) 22 ) 23 @Get() 24 async get() { 25 return 'Hello World'; 26 } 27}
Run nx build kratos-client-wrapper
to build the library.
Run nx test kratos-client-wrapper
to execute the unit tests via Jest.
No vulnerabilities found.
No security vulnerabilities found.