@owlmeans/auth-otp 0.1.5 → 0.1.7

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
@@ -1,2 +1,10 @@
1
1
  export declare const OTP_SERVICE = "auth-otp-service";
2
+ /** The auth plugin type string that selects the email-OTP auth plugin */
3
+ export declare const OTP_AUTH_TYPE = "email-otp";
4
+ /** Redis resource alias for storing pending OTP codes */
5
+ export declare const OTP_RESOURCE = "auth-otp-cache";
6
+ /** Code TTL in seconds (10 minutes) */
7
+ export declare const OTP_TTL_SECONDS = 600;
8
+ /** OTP code length (numeric digits) */
9
+ export declare const OTP_CODE_LENGTH = 6;
2
10
  //# 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"}
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"}
package/build/consts.js CHANGED
@@ -1,2 +1,10 @@
1
1
  export const OTP_SERVICE = 'auth-otp-service';
2
+ /** The auth plugin type string that selects the email-OTP auth plugin */
3
+ export const OTP_AUTH_TYPE = 'email-otp';
4
+ /** Redis resource alias for storing pending OTP codes */
5
+ export const OTP_RESOURCE = 'auth-otp-cache';
6
+ /** Code TTL in seconds (10 minutes) */
7
+ export const OTP_TTL_SECONDS = 600;
8
+ /** OTP code length (numeric digits) */
9
+ export const OTP_CODE_LENGTH = 6;
2
10
  //# 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"}
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"}
package/build/types.d.ts CHANGED
@@ -1,5 +1,9 @@
1
1
  import type { InitializedService } from '@owlmeans/context';
2
- /** Passwordless OTP/magic-link authentication service — implemented in Phase 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
8
  }
5
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,kFAAkF;AAClF,MAAM,WAAW,UAAW,SAAQ,kBAAkB;CAErD"}
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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@owlmeans/auth-otp",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -22,8 +22,8 @@
22
22
  }
23
23
  },
24
24
  "dependencies": {
25
- "@owlmeans/context": "^0.1.5",
26
- "@owlmeans/error": "^0.1.5"
25
+ "@owlmeans/context": "^0.1.7",
26
+ "@owlmeans/error": "^0.1.7"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@owlmeans/dep-config": "workspace:*",
package/src/consts.ts CHANGED
@@ -1 +1,13 @@
1
1
  export const OTP_SERVICE = 'auth-otp-service'
2
+
3
+ /** The auth plugin type string that selects the email-OTP auth plugin */
4
+ export const OTP_AUTH_TYPE = 'email-otp'
5
+
6
+ /** Redis resource alias for storing pending OTP codes */
7
+ export const OTP_RESOURCE = 'auth-otp-cache'
8
+
9
+ /** Code TTL in seconds (10 minutes) */
10
+ export const OTP_TTL_SECONDS = 600
11
+
12
+ /** OTP code length (numeric digits) */
13
+ export const OTP_CODE_LENGTH = 6
package/src/types.ts CHANGED
@@ -1,6 +1,9 @@
1
1
  import type { InitializedService } from '@owlmeans/context'
2
2
 
3
- /** Passwordless OTP/magic-link authentication service — implemented in Phase 2 */
3
+ /** Passwordless email OTP service — generates, stores, and verifies short-lived one-time codes */
4
4
  export interface OtpService extends InitializedService {
5
- // Phase 2: issueChallenge, verifyChallenge
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>
6
9
  }