@owlmeans/auth-otp 0.1.18-rc.3 → 0.1.18-rc.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/consts.d.ts CHANGED
@@ -7,4 +7,6 @@ export declare const OTP_RESOURCE = "auth-otp-cache";
7
7
  export declare const OTP_TTL_SECONDS = 600;
8
8
  /** OTP code length (numeric digits) */
9
9
  export declare const OTP_CODE_LENGTH = 6;
10
+ /** A challenge is invalidated on its fifth failed guess. */
11
+ export declare const OTP_MAX_FAILED_ATTEMPTS = 5;
10
12
  //# sourceMappingURL=consts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,qBAAqB,CAAA;AAE7C,yEAAyE;AACzE,eAAO,MAAM,aAAa,cAAc,CAAA;AAExC,yDAAyD;AACzD,eAAO,MAAM,YAAY,mBAAmB,CAAA;AAE5C,uCAAuC;AACvC,eAAO,MAAM,eAAe,MAAM,CAAA;AAElC,uCAAuC;AACvC,eAAO,MAAM,eAAe,IAAI,CAAA"}
1
+ {"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,qBAAqB,CAAA;AAE7C,yEAAyE;AACzE,eAAO,MAAM,aAAa,cAAc,CAAA;AAExC,yDAAyD;AACzD,eAAO,MAAM,YAAY,mBAAmB,CAAA;AAE5C,uCAAuC;AACvC,eAAO,MAAM,eAAe,MAAM,CAAA;AAElC,uCAAuC;AACvC,eAAO,MAAM,eAAe,IAAI,CAAA;AAEhC,4DAA4D;AAC5D,eAAO,MAAM,uBAAuB,IAAI,CAAA"}
package/build/consts.js CHANGED
@@ -7,4 +7,6 @@ export const OTP_RESOURCE = 'auth-otp-cache';
7
7
  export const OTP_TTL_SECONDS = 600;
8
8
  /** OTP code length (numeric digits) */
9
9
  export const OTP_CODE_LENGTH = 6;
10
+ /** A challenge is invalidated on its fifth failed guess. */
11
+ export const OTP_MAX_FAILED_ATTEMPTS = 5;
10
12
  //# sourceMappingURL=consts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"consts.js","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,kBAAkB,CAAA;AAE7C,yEAAyE;AACzE,MAAM,CAAC,MAAM,aAAa,GAAG,WAAW,CAAA;AAExC,yDAAyD;AACzD,MAAM,CAAC,MAAM,YAAY,GAAG,gBAAgB,CAAA;AAE5C,uCAAuC;AACvC,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,CAAA;AAElC,uCAAuC;AACvC,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAA"}
1
+ {"version":3,"file":"consts.js","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,kBAAkB,CAAA;AAE7C,yEAAyE;AACzE,MAAM,CAAC,MAAM,aAAa,GAAG,WAAW,CAAA;AAExC,yDAAyD;AACzD,MAAM,CAAC,MAAM,YAAY,GAAG,gBAAgB,CAAA;AAE5C,uCAAuC;AACvC,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,CAAA;AAElC,uCAAuC;AACvC,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAA;AAEhC,4DAA4D;AAC5D,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAA"}
package/build/types.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import type { InitializedService } from '@owlmeans/context';
2
2
  /** Passwordless email OTP service — generates, stores, and verifies short-lived one-time codes */
3
3
  export interface OtpService extends InitializedService {
4
- /** Generate a code, persist it with TTL, and email it to the user. */
5
- issueChallenge: (email: string) => Promise<void>;
6
- /** Verify and consume the code. Throws OtpInvalidError if the code is wrong or expired. */
7
- verifyChallenge: (email: string, code: string) => Promise<void>;
4
+ /** Generate a code, persist it with TTL, email it, and return its opaque issuance id. */
5
+ issueChallenge: (email: string) => Promise<string>;
6
+ /** Verify and atomically consume one issuance. */
7
+ verifyChallenge: (email: string, issuanceId: string, code: string) => Promise<void>;
8
8
  }
9
9
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAE3D,kGAAkG;AAClG,MAAM,WAAW,UAAW,SAAQ,kBAAkB;IACpD,sEAAsE;IACtE,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAChD,2FAA2F;IAC3F,eAAe,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CAChE"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAE3D,kGAAkG;AAClG,MAAM,WAAW,UAAW,SAAQ,kBAAkB;IACpD,yFAAyF;IACzF,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;IAClD,kDAAkD;IAClD,eAAe,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CACpF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@owlmeans/auth-otp",
3
- "version": "0.1.18-rc.3",
3
+ "version": "0.1.18-rc.30",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -22,12 +22,12 @@
22
22
  }
23
23
  },
24
24
  "dependencies": {
25
- "@owlmeans/context": "^0.1.18-rc.3",
26
- "@owlmeans/error": "^0.1.18-rc.3"
25
+ "@owlmeans/context": "^0.1.18-rc.32",
26
+ "@owlmeans/error": "^0.1.18-rc.34"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@owlmeans/dep-config": "workspace:*",
30
- "@types/bun": "^1.3.14",
30
+ "@types/bun": "^1.4.0",
31
31
  "nodemon": "^3.1.14",
32
32
  "typescript": "^7.0.2"
33
33
  },
package/src/consts.ts CHANGED
@@ -11,3 +11,6 @@ export const OTP_TTL_SECONDS = 600
11
11
 
12
12
  /** OTP code length (numeric digits) */
13
13
  export const OTP_CODE_LENGTH = 6
14
+
15
+ /** A challenge is invalidated on its fifth failed guess. */
16
+ export const OTP_MAX_FAILED_ATTEMPTS = 5
package/src/types.ts CHANGED
@@ -2,8 +2,8 @@ import type { InitializedService } from '@owlmeans/context'
2
2
 
3
3
  /** Passwordless email OTP service — generates, stores, and verifies short-lived one-time codes */
4
4
  export interface OtpService extends InitializedService {
5
- /** Generate a code, persist it with TTL, and email it to the user. */
6
- issueChallenge: (email: string) => Promise<void>
7
- /** Verify and consume the code. Throws OtpInvalidError if the code is wrong or expired. */
8
- verifyChallenge: (email: string, code: string) => Promise<void>
5
+ /** Generate a code, persist it with TTL, email it, and return its opaque issuance id. */
6
+ issueChallenge: (email: string) => Promise<string>
7
+ /** Verify and atomically consume one issuance. */
8
+ verifyChallenge: (email: string, issuanceId: string, code: string) => Promise<void>
9
9
  }