Skip to content

Commit d784f08

Browse files
merging into trunk for release v1.0.2 (#14)
* doc: release the first official version * release: change the version to the first official ver * feat: add eslint config file * feat: deleting file .gitkeep * build: fix version for the beta release * feat: replacing the xotp types with the corresponding services * feat: just a wrapper around the xotp secret. * release: preparing the release v1.0.1 * doc: add xotp and nestjs logo * doc: add the logo of both XOTP and Nestjs. * release: ready to ship v1.0.2 * correction: already the version for a release was generated
1 parent 4c345d8 commit d784f08

File tree

2 files changed

+24
-12
lines changed

2 files changed

+24
-12
lines changed

README.md

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
<h1 align="center">nestjs-xotp</h1>
22

3+
<p align="center">
4+
<a href="https://github.com/farshidbeheshti/xotp" ><img src="https://github.com/user-attachments/assets/8ef372d6-3cd7-4202-88b2-519f45f67160" width="120" /></a>
5+
<img src="https://github.com/user-attachments/assets/ffa87094-83ab-4754-9550-82e3f922abea" width="70" />
6+
<a href="https://github.com/nestjs/nest" > <img src="https://github.com/user-attachments/assets/32099c9a-7221-4008-a4bf-c1ada206878e" width="125" /></a>
7+
</p>
8+
39
<p align="center">
410
A <a href="https://github.com/nestjs/nest" rel="nofollow" >Nest</a> module wrapper for <a href="https://github.com/farshidbeheshti/xotp">XOTP</a>.
511
</p>
@@ -20,7 +26,11 @@ import { Module } from '@nestjs/common';
2026
import { XOTPModule } from 'nestjs-xotp';
2127

2228
@Module({
23-
imports: [XOTPModule.forRoot(/* your options, if any */)],
29+
imports: [
30+
XOTPModule.forRoot({
31+
/* your options, if any */
32+
}),
33+
],
2434
})
2535
export class AppModule {}
2636
```
@@ -73,7 +83,7 @@ Example #2: To authenticate, verify the otp sent by the user.
7383
authenticate(userOTP: string): boolean {
7484
return this.xotpService.totp.validate({
7585
token: userOTP,
76-
secret: this.xotpService.secret.from('your Secret Key'),
86+
secret: this.xotpService.secret.from('YOUR_SECRET_KEY'),
7787
});
7888
}
7989
```
@@ -93,22 +103,24 @@ getKeyUri(): string {
93103

94104
Option is an optional object the same as original xotp [options](https://github.com/farshidbeheshti/xotp?tab=readme-ov-file#totp-options).
95105

96-
```javascript
106+
```json
97107
{
98-
digits: 6,
99-
window: 1,
100-
algorithm: 'sha1',
101-
duration: 30,
102-
issuer:'xotp'
108+
"digits": 6,
109+
"window": 1,
110+
"algorithm": "sha1",
111+
"duration": 30,
112+
"issuer": "xotp"
103113
}
104114
```
105115

106116
That options are applied to both TOTP and HOTP services.But you could also set more specific options for either/both of TOTP or HOTP. for example, you want to change the digit length of hotp token:
107117

108-
```javascript
118+
```json
109119
{
110-
digits: 6,
111-
hotp: {digits: 4}
120+
"digits": 6,
121+
"hotp": {
122+
"digits": 4
123+
}
112124
}
113125
```
114126

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nestjs-xotp",
3-
"version": "1.0.0-alpha.0",
3+
"version": "1.0.1",
44
"description": "NestJS XOTP - A powerful one-time password (OTP) library for NestJS.",
55
"author": "Farshid Beheshti",
66
"license": "MIT",

0 commit comments

Comments
 (0)