@spfn/auth 0.1.0-alpha.87 → 0.2.0-beta.1
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/README.md +1385 -1199
- package/dist/config.d.ts +405 -0
- package/dist/config.js +240 -0
- package/dist/config.js.map +1 -0
- package/dist/dto-81uR9gzF.d.ts +630 -0
- package/dist/errors.d.ts +196 -0
- package/dist/errors.js +173 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +273 -14
- package/dist/index.js +511 -6665
- package/dist/index.js.map +1 -1
- package/dist/nextjs/api.js +345 -0
- package/dist/nextjs/api.js.map +1 -0
- package/dist/{adapters/nextjs → nextjs}/server.d.ts +47 -65
- package/dist/nextjs/server.js +179 -0
- package/dist/nextjs/server.js.map +1 -0
- package/dist/server.d.ts +4328 -529
- package/dist/server.js +7841 -1247
- package/dist/server.js.map +1 -1
- package/migrations/{0000_familiar_firebrand.sql → 0000_mysterious_colossus.sql} +53 -23
- package/migrations/meta/0000_snapshot.json +281 -46
- package/migrations/meta/_journal.json +2 -2
- package/package.json +33 -33
- package/dist/adapters/nextjs/api.d.ts +0 -446
- package/dist/adapters/nextjs/api.js +0 -3279
- package/dist/adapters/nextjs/api.js.map +0 -1
- package/dist/adapters/nextjs/server.js +0 -3645
- package/dist/adapters/nextjs/server.js.map +0 -1
- package/dist/lib/api/auth-codes-verify.d.ts +0 -37
- package/dist/lib/api/auth-codes-verify.js +0 -2949
- package/dist/lib/api/auth-codes-verify.js.map +0 -1
- package/dist/lib/api/auth-codes.d.ts +0 -37
- package/dist/lib/api/auth-codes.js +0 -2949
- package/dist/lib/api/auth-codes.js.map +0 -1
- package/dist/lib/api/auth-exists.d.ts +0 -38
- package/dist/lib/api/auth-exists.js +0 -2949
- package/dist/lib/api/auth-exists.js.map +0 -1
- package/dist/lib/api/auth-invitations-accept.d.ts +0 -38
- package/dist/lib/api/auth-invitations-accept.js +0 -2883
- package/dist/lib/api/auth-invitations-accept.js.map +0 -1
- package/dist/lib/api/auth-invitations-cancel.d.ts +0 -37
- package/dist/lib/api/auth-invitations-cancel.js +0 -2883
- package/dist/lib/api/auth-invitations-cancel.js.map +0 -1
- package/dist/lib/api/auth-invitations-delete.d.ts +0 -36
- package/dist/lib/api/auth-invitations-delete.js +0 -2883
- package/dist/lib/api/auth-invitations-delete.js.map +0 -1
- package/dist/lib/api/auth-invitations-resend.d.ts +0 -37
- package/dist/lib/api/auth-invitations-resend.js +0 -2883
- package/dist/lib/api/auth-invitations-resend.js.map +0 -1
- package/dist/lib/api/auth-invitations.d.ts +0 -109
- package/dist/lib/api/auth-invitations.js +0 -2887
- package/dist/lib/api/auth-invitations.js.map +0 -1
- package/dist/lib/api/auth-keys-rotate.d.ts +0 -37
- package/dist/lib/api/auth-keys-rotate.js +0 -2949
- package/dist/lib/api/auth-keys-rotate.js.map +0 -1
- package/dist/lib/api/auth-login.d.ts +0 -39
- package/dist/lib/api/auth-login.js +0 -2949
- package/dist/lib/api/auth-login.js.map +0 -1
- package/dist/lib/api/auth-logout.d.ts +0 -36
- package/dist/lib/api/auth-logout.js +0 -2949
- package/dist/lib/api/auth-logout.js.map +0 -1
- package/dist/lib/api/auth-me.d.ts +0 -50
- package/dist/lib/api/auth-me.js +0 -2949
- package/dist/lib/api/auth-me.js.map +0 -1
- package/dist/lib/api/auth-password.d.ts +0 -36
- package/dist/lib/api/auth-password.js +0 -2949
- package/dist/lib/api/auth-password.js.map +0 -1
- package/dist/lib/api/auth-register.d.ts +0 -38
- package/dist/lib/api/auth-register.js +0 -2949
- package/dist/lib/api/auth-register.js.map +0 -1
- package/dist/lib/api/index.d.ts +0 -356
- package/dist/lib/api/index.js +0 -3261
- package/dist/lib/api/index.js.map +0 -1
- package/dist/lib/config.d.ts +0 -70
- package/dist/lib/config.js +0 -64
- package/dist/lib/config.js.map +0 -1
- package/dist/lib/contracts/auth.d.ts +0 -302
- package/dist/lib/contracts/auth.js +0 -2951
- package/dist/lib/contracts/auth.js.map +0 -1
- package/dist/lib/contracts/index.d.ts +0 -3
- package/dist/lib/contracts/index.js +0 -3190
- package/dist/lib/contracts/index.js.map +0 -1
- package/dist/lib/contracts/invitation.d.ts +0 -243
- package/dist/lib/contracts/invitation.js +0 -2883
- package/dist/lib/contracts/invitation.js.map +0 -1
- package/dist/lib/crypto.d.ts +0 -76
- package/dist/lib/crypto.js +0 -127
- package/dist/lib/crypto.js.map +0 -1
- package/dist/lib/index.d.ts +0 -4
- package/dist/lib/index.js +0 -313
- package/dist/lib/index.js.map +0 -1
- package/dist/lib/session.d.ts +0 -68
- package/dist/lib/session.js +0 -126
- package/dist/lib/session.js.map +0 -1
- package/dist/lib/types/api.d.ts +0 -45
- package/dist/lib/types/api.js +0 -1
- package/dist/lib/types/api.js.map +0 -1
- package/dist/lib/types/index.d.ts +0 -3
- package/dist/lib/types/index.js +0 -2647
- package/dist/lib/types/index.js.map +0 -1
- package/dist/lib/types/schemas.d.ts +0 -45
- package/dist/lib/types/schemas.js +0 -2647
- package/dist/lib/types/schemas.js.map +0 -1
- package/dist/lib.js +0 -1
- package/dist/lib.js.map +0 -1
- package/dist/plugin.d.ts +0 -12
- package/dist/plugin.js +0 -9083
- package/dist/plugin.js.map +0 -1
- package/dist/server/entities/index.d.ts +0 -11
- package/dist/server/entities/index.js +0 -395
- package/dist/server/entities/index.js.map +0 -1
- package/dist/server/entities/invitations.d.ts +0 -241
- package/dist/server/entities/invitations.js +0 -184
- package/dist/server/entities/invitations.js.map +0 -1
- package/dist/server/entities/permissions.d.ts +0 -196
- package/dist/server/entities/permissions.js +0 -49
- package/dist/server/entities/permissions.js.map +0 -1
- package/dist/server/entities/role-permissions.d.ts +0 -107
- package/dist/server/entities/role-permissions.js +0 -115
- package/dist/server/entities/role-permissions.js.map +0 -1
- package/dist/server/entities/roles.d.ts +0 -196
- package/dist/server/entities/roles.js +0 -50
- package/dist/server/entities/roles.js.map +0 -1
- package/dist/server/entities/schema.d.ts +0 -14
- package/dist/server/entities/schema.js +0 -7
- package/dist/server/entities/schema.js.map +0 -1
- package/dist/server/entities/user-permissions.d.ts +0 -163
- package/dist/server/entities/user-permissions.js +0 -193
- package/dist/server/entities/user-permissions.js.map +0 -1
- package/dist/server/entities/user-public-keys.d.ts +0 -227
- package/dist/server/entities/user-public-keys.js +0 -156
- package/dist/server/entities/user-public-keys.js.map +0 -1
- package/dist/server/entities/user-social-accounts.d.ts +0 -189
- package/dist/server/entities/user-social-accounts.js +0 -149
- package/dist/server/entities/user-social-accounts.js.map +0 -1
- package/dist/server/entities/users.d.ts +0 -235
- package/dist/server/entities/users.js +0 -117
- package/dist/server/entities/users.js.map +0 -1
- package/dist/server/entities/verification-codes.d.ts +0 -191
- package/dist/server/entities/verification-codes.js +0 -49
- package/dist/server/entities/verification-codes.js.map +0 -1
- package/dist/server/routes/auth/index.d.ts +0 -10
- package/dist/server/routes/auth/index.js +0 -4460
- package/dist/server/routes/auth/index.js.map +0 -1
- package/dist/server/routes/index.d.ts +0 -6
- package/dist/server/routes/index.js +0 -6584
- package/dist/server/routes/index.js.map +0 -1
- package/dist/server/routes/invitations/index.d.ts +0 -10
- package/dist/server/routes/invitations/index.js +0 -4395
- package/dist/server/routes/invitations/index.js.map +0 -1
- /package/dist/{lib.d.ts → nextjs/api.d.ts} +0 -0
package/dist/lib/config.d.ts
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @spfn/auth - Global Configuration
|
|
3
|
-
*
|
|
4
|
-
* Manages global auth configuration including session TTL
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Cookie names used by SPFN Auth
|
|
8
|
-
*/
|
|
9
|
-
declare const COOKIE_NAMES: {
|
|
10
|
-
/** Encrypted session data (userId, privateKey, keyId, algorithm) */
|
|
11
|
-
readonly SESSION: "spfn_session";
|
|
12
|
-
/** Current key ID (for key rotation) */
|
|
13
|
-
readonly SESSION_KEY_ID: "spfn_session_key_id";
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* Parse duration string to seconds
|
|
17
|
-
*
|
|
18
|
-
* Supports: '30d', '12h', '45m', '3600s', or plain number
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* parseDuration('30d') // 2592000 (30 days in seconds)
|
|
22
|
-
* parseDuration('12h') // 43200
|
|
23
|
-
* parseDuration('45m') // 2700
|
|
24
|
-
* parseDuration('3600') // 3600
|
|
25
|
-
*/
|
|
26
|
-
declare function parseDuration(duration: string | number): number;
|
|
27
|
-
/**
|
|
28
|
-
* Auth configuration
|
|
29
|
-
*/
|
|
30
|
-
interface AuthConfig {
|
|
31
|
-
/**
|
|
32
|
-
* Default session TTL in seconds or duration string
|
|
33
|
-
*
|
|
34
|
-
* Supports:
|
|
35
|
-
* - Number: seconds (e.g., 2592000)
|
|
36
|
-
* - String: '30d', '12h', '45m', '3600s'
|
|
37
|
-
*
|
|
38
|
-
* @default 7d (7 days)
|
|
39
|
-
*/
|
|
40
|
-
sessionTtl?: string | number;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Configure global auth settings
|
|
44
|
-
*
|
|
45
|
-
* @param config - Auth configuration
|
|
46
|
-
*
|
|
47
|
-
* @example
|
|
48
|
-
* ```typescript
|
|
49
|
-
* configureAuth({
|
|
50
|
-
* sessionTtl: '30d', // 30 days
|
|
51
|
-
* });
|
|
52
|
-
* ```
|
|
53
|
-
*/
|
|
54
|
-
declare function configureAuth(config: AuthConfig): void;
|
|
55
|
-
/**
|
|
56
|
-
* Get current auth configuration
|
|
57
|
-
*/
|
|
58
|
-
declare function getAuthConfig(): AuthConfig;
|
|
59
|
-
/**
|
|
60
|
-
* Get session TTL in seconds
|
|
61
|
-
*
|
|
62
|
-
* Priority:
|
|
63
|
-
* 1. Runtime override (remember parameter)
|
|
64
|
-
* 2. Global config (configureAuth)
|
|
65
|
-
* 3. Environment variable (SPFN_AUTH_SESSION_TTL)
|
|
66
|
-
* 4. Default (7 days)
|
|
67
|
-
*/
|
|
68
|
-
declare function getSessionTtl(override?: string | number): number;
|
|
69
|
-
|
|
70
|
-
export { type AuthConfig, COOKIE_NAMES, configureAuth, getAuthConfig, getSessionTtl, parseDuration };
|
package/dist/lib/config.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
// src/lib/config.ts
|
|
2
|
-
var COOKIE_NAMES = {
|
|
3
|
-
/** Encrypted session data (userId, privateKey, keyId, algorithm) */
|
|
4
|
-
SESSION: "spfn_session",
|
|
5
|
-
/** Current key ID (for key rotation) */
|
|
6
|
-
SESSION_KEY_ID: "spfn_session_key_id"
|
|
7
|
-
};
|
|
8
|
-
function parseDuration(duration) {
|
|
9
|
-
if (typeof duration === "number") {
|
|
10
|
-
return duration;
|
|
11
|
-
}
|
|
12
|
-
const match = duration.match(/^(\d+)([dhms]?)$/);
|
|
13
|
-
if (!match) {
|
|
14
|
-
throw new Error(`Invalid duration format: ${duration}. Use format like '30d', '12h', '45m', '3600s', or plain number.`);
|
|
15
|
-
}
|
|
16
|
-
const value = parseInt(match[1], 10);
|
|
17
|
-
const unit = match[2] || "s";
|
|
18
|
-
switch (unit) {
|
|
19
|
-
case "d":
|
|
20
|
-
return value * 24 * 60 * 60;
|
|
21
|
-
case "h":
|
|
22
|
-
return value * 60 * 60;
|
|
23
|
-
case "m":
|
|
24
|
-
return value * 60;
|
|
25
|
-
case "s":
|
|
26
|
-
return value;
|
|
27
|
-
default:
|
|
28
|
-
throw new Error(`Unknown duration unit: ${unit}`);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
var globalConfig = {
|
|
32
|
-
sessionTtl: "7d"
|
|
33
|
-
// Default: 7 days
|
|
34
|
-
};
|
|
35
|
-
function configureAuth(config) {
|
|
36
|
-
globalConfig = {
|
|
37
|
-
...globalConfig,
|
|
38
|
-
...config
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
function getAuthConfig() {
|
|
42
|
-
return { ...globalConfig };
|
|
43
|
-
}
|
|
44
|
-
function getSessionTtl(override) {
|
|
45
|
-
if (override !== void 0) {
|
|
46
|
-
return parseDuration(override);
|
|
47
|
-
}
|
|
48
|
-
if (globalConfig.sessionTtl !== void 0) {
|
|
49
|
-
return parseDuration(globalConfig.sessionTtl);
|
|
50
|
-
}
|
|
51
|
-
const envTtl = process.env.SPFN_AUTH_SESSION_TTL;
|
|
52
|
-
if (envTtl) {
|
|
53
|
-
return parseDuration(envTtl);
|
|
54
|
-
}
|
|
55
|
-
return 7 * 24 * 60 * 60;
|
|
56
|
-
}
|
|
57
|
-
export {
|
|
58
|
-
COOKIE_NAMES,
|
|
59
|
-
configureAuth,
|
|
60
|
-
getAuthConfig,
|
|
61
|
-
getSessionTtl,
|
|
62
|
-
parseDuration
|
|
63
|
-
};
|
|
64
|
-
//# sourceMappingURL=config.js.map
|
package/dist/lib/config.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lib/config.ts"],"sourcesContent":["/**\n * @spfn/auth - Global Configuration\n *\n * Manages global auth configuration including session TTL\n */\n\n/**\n * Cookie names used by SPFN Auth\n */\nexport const COOKIE_NAMES = {\n /** Encrypted session data (userId, privateKey, keyId, algorithm) */\n SESSION: 'spfn_session',\n /** Current key ID (for key rotation) */\n SESSION_KEY_ID: 'spfn_session_key_id',\n} as const;\n\n/**\n * Parse duration string to seconds\n *\n * Supports: '30d', '12h', '45m', '3600s', or plain number\n *\n * @example\n * parseDuration('30d') // 2592000 (30 days in seconds)\n * parseDuration('12h') // 43200\n * parseDuration('45m') // 2700\n * parseDuration('3600') // 3600\n */\nexport function parseDuration(duration: string | number): number\n{\n if (typeof duration === 'number')\n {\n return duration;\n }\n\n const match = duration.match(/^(\\d+)([dhms]?)$/);\n if (!match)\n {\n throw new Error(`Invalid duration format: ${duration}. Use format like '30d', '12h', '45m', '3600s', or plain number.`);\n }\n\n const value = parseInt(match[1], 10);\n const unit = match[2] || 's';\n\n switch (unit)\n {\n case 'd':\n return value * 24 * 60 * 60;\n case 'h':\n return value * 60 * 60;\n case 'm':\n return value * 60;\n case 's':\n return value;\n default:\n throw new Error(`Unknown duration unit: ${unit}`);\n }\n}\n\n/**\n * Auth configuration\n */\nexport interface AuthConfig\n{\n /**\n * Default session TTL in seconds or duration string\n *\n * Supports:\n * - Number: seconds (e.g., 2592000)\n * - String: '30d', '12h', '45m', '3600s'\n *\n * @default 7d (7 days)\n */\n sessionTtl?: string | number;\n}\n\n/**\n * Global auth configuration state\n */\nlet globalConfig: AuthConfig = {\n sessionTtl: '7d', // Default: 7 days\n};\n\n/**\n * Configure global auth settings\n *\n * @param config - Auth configuration\n *\n * @example\n * ```typescript\n * configureAuth({\n * sessionTtl: '30d', // 30 days\n * });\n * ```\n */\nexport function configureAuth(config: AuthConfig): void\n{\n globalConfig = {\n ...globalConfig,\n ...config,\n };\n}\n\n/**\n * Get current auth configuration\n */\nexport function getAuthConfig(): AuthConfig\n{\n return { ...globalConfig };\n}\n\n/**\n * Get session TTL in seconds\n *\n * Priority:\n * 1. Runtime override (remember parameter)\n * 2. Global config (configureAuth)\n * 3. Environment variable (SPFN_AUTH_SESSION_TTL)\n * 4. Default (7 days)\n */\nexport function getSessionTtl(override?: string | number): number\n{\n // 1. Runtime override\n if (override !== undefined)\n {\n return parseDuration(override);\n }\n\n // 2. Global config\n if (globalConfig.sessionTtl !== undefined)\n {\n return parseDuration(globalConfig.sessionTtl);\n }\n\n // 3. Environment variable\n const envTtl = process.env.SPFN_AUTH_SESSION_TTL;\n if (envTtl)\n {\n return parseDuration(envTtl);\n }\n\n // 4. Default: 7 days\n return 7 * 24 * 60 * 60;\n}"],"mappings":";AASO,IAAM,eAAe;AAAA;AAAA,EAExB,SAAS;AAAA;AAAA,EAET,gBAAgB;AACpB;AAaO,SAAS,cAAc,UAC9B;AACI,MAAI,OAAO,aAAa,UACxB;AACI,WAAO;AAAA,EACX;AAEA,QAAM,QAAQ,SAAS,MAAM,kBAAkB;AAC/C,MAAI,CAAC,OACL;AACI,UAAM,IAAI,MAAM,4BAA4B,QAAQ,kEAAkE;AAAA,EAC1H;AAEA,QAAM,QAAQ,SAAS,MAAM,CAAC,GAAG,EAAE;AACnC,QAAM,OAAO,MAAM,CAAC,KAAK;AAEzB,UAAQ,MACR;AAAA,IACI,KAAK;AACD,aAAO,QAAQ,KAAK,KAAK;AAAA,IAC7B,KAAK;AACD,aAAO,QAAQ,KAAK;AAAA,IACxB,KAAK;AACD,aAAO,QAAQ;AAAA,IACnB,KAAK;AACD,aAAO;AAAA,IACX;AACI,YAAM,IAAI,MAAM,0BAA0B,IAAI,EAAE;AAAA,EACxD;AACJ;AAsBA,IAAI,eAA2B;AAAA,EAC3B,YAAY;AAAA;AAChB;AAcO,SAAS,cAAc,QAC9B;AACI,iBAAe;AAAA,IACX,GAAG;AAAA,IACH,GAAG;AAAA,EACP;AACJ;AAKO,SAAS,gBAChB;AACI,SAAO,EAAE,GAAG,aAAa;AAC7B;AAWO,SAAS,cAAc,UAC9B;AAEI,MAAI,aAAa,QACjB;AACI,WAAO,cAAc,QAAQ;AAAA,EACjC;AAGA,MAAI,aAAa,eAAe,QAChC;AACI,WAAO,cAAc,aAAa,UAAU;AAAA,EAChD;AAGA,QAAM,SAAS,QAAQ,IAAI;AAC3B,MAAI,QACJ;AACI,WAAO,cAAc,MAAM;AAAA,EAC/B;AAGA,SAAO,IAAI,KAAK,KAAK;AACzB;","names":[]}
|
|
@@ -1,302 +0,0 @@
|
|
|
1
|
-
import * as _sinclair_typebox from '@sinclair/typebox';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @spfn/auth - Auth API Contracts
|
|
5
|
-
*
|
|
6
|
-
* Type-safe API contracts for authentication operations
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* POST /codes - Send verification code
|
|
10
|
-
*
|
|
11
|
-
* Sends a 6-digit verification code to email or phone
|
|
12
|
-
* Final path: /_auth/codes
|
|
13
|
-
*/
|
|
14
|
-
declare const sendVerificationCodeContract: {
|
|
15
|
-
readonly method: "POST";
|
|
16
|
-
readonly path: "/_auth/codes";
|
|
17
|
-
readonly body: _sinclair_typebox.TObject<{
|
|
18
|
-
target: _sinclair_typebox.TString;
|
|
19
|
-
targetType: _sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"email">, _sinclair_typebox.TLiteral<"phone">]>;
|
|
20
|
-
purpose: _sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"registration">, _sinclair_typebox.TLiteral<"login">, _sinclair_typebox.TLiteral<"password_reset">]>;
|
|
21
|
-
}>;
|
|
22
|
-
readonly response: _sinclair_typebox.TUnion<[_sinclair_typebox.TObject<{
|
|
23
|
-
success: _sinclair_typebox.TLiteral<true>;
|
|
24
|
-
data: _sinclair_typebox.TObject<{
|
|
25
|
-
success: _sinclair_typebox.TBoolean;
|
|
26
|
-
expiresAt: _sinclair_typebox.TString;
|
|
27
|
-
}>;
|
|
28
|
-
message: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
29
|
-
}>, _sinclair_typebox.TObject<{
|
|
30
|
-
success: _sinclair_typebox.TLiteral<false>;
|
|
31
|
-
error: _sinclair_typebox.TObject<{
|
|
32
|
-
code: _sinclair_typebox.TString;
|
|
33
|
-
message: _sinclair_typebox.TString;
|
|
34
|
-
details: _sinclair_typebox.TOptional<_sinclair_typebox.TAny>;
|
|
35
|
-
}>;
|
|
36
|
-
}>]>;
|
|
37
|
-
};
|
|
38
|
-
/**
|
|
39
|
-
* POST /codes/verify - Verify code (without creating account)
|
|
40
|
-
*
|
|
41
|
-
* Validates verification code, returns a temporary token
|
|
42
|
-
* Final path: /_auth/codes/verify
|
|
43
|
-
*/
|
|
44
|
-
declare const verifyCodeContract: {
|
|
45
|
-
readonly method: "POST";
|
|
46
|
-
readonly path: "/_auth/codes/verify";
|
|
47
|
-
readonly body: _sinclair_typebox.TObject<{
|
|
48
|
-
target: _sinclair_typebox.TString;
|
|
49
|
-
targetType: _sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"email">, _sinclair_typebox.TLiteral<"phone">]>;
|
|
50
|
-
code: _sinclair_typebox.TString;
|
|
51
|
-
purpose: _sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"registration">, _sinclair_typebox.TLiteral<"login">, _sinclair_typebox.TLiteral<"password_reset">]>;
|
|
52
|
-
}>;
|
|
53
|
-
readonly response: _sinclair_typebox.TUnion<[_sinclair_typebox.TObject<{
|
|
54
|
-
success: _sinclair_typebox.TLiteral<true>;
|
|
55
|
-
data: _sinclair_typebox.TObject<{
|
|
56
|
-
valid: _sinclair_typebox.TBoolean;
|
|
57
|
-
verificationToken: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
58
|
-
}>;
|
|
59
|
-
message: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
60
|
-
}>, _sinclair_typebox.TObject<{
|
|
61
|
-
success: _sinclair_typebox.TLiteral<false>;
|
|
62
|
-
error: _sinclair_typebox.TObject<{
|
|
63
|
-
code: _sinclair_typebox.TString;
|
|
64
|
-
message: _sinclair_typebox.TString;
|
|
65
|
-
details: _sinclair_typebox.TOptional<_sinclair_typebox.TAny>;
|
|
66
|
-
}>;
|
|
67
|
-
}>]>;
|
|
68
|
-
};
|
|
69
|
-
/**
|
|
70
|
-
* POST /exists - Check if account exists
|
|
71
|
-
*
|
|
72
|
-
* Checks if an email or phone number is already registered
|
|
73
|
-
* Final path: /_auth/exists (prefix added from package.json)
|
|
74
|
-
*/
|
|
75
|
-
declare const checkAccountExistsContract: {
|
|
76
|
-
readonly method: "POST";
|
|
77
|
-
readonly path: "/_auth/exists";
|
|
78
|
-
readonly body: _sinclair_typebox.TObject<{
|
|
79
|
-
email: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
80
|
-
phone: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
81
|
-
}>;
|
|
82
|
-
readonly response: _sinclair_typebox.TUnion<[_sinclair_typebox.TObject<{
|
|
83
|
-
success: _sinclair_typebox.TLiteral<true>;
|
|
84
|
-
data: _sinclair_typebox.TObject<{
|
|
85
|
-
exists: _sinclair_typebox.TBoolean;
|
|
86
|
-
identifier: _sinclair_typebox.TString;
|
|
87
|
-
identifierType: _sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"email">, _sinclair_typebox.TLiteral<"phone">]>;
|
|
88
|
-
}>;
|
|
89
|
-
message: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
90
|
-
}>, _sinclair_typebox.TObject<{
|
|
91
|
-
success: _sinclair_typebox.TLiteral<false>;
|
|
92
|
-
error: _sinclair_typebox.TObject<{
|
|
93
|
-
code: _sinclair_typebox.TString;
|
|
94
|
-
message: _sinclair_typebox.TString;
|
|
95
|
-
details: _sinclair_typebox.TOptional<_sinclair_typebox.TAny>;
|
|
96
|
-
}>;
|
|
97
|
-
}>]>;
|
|
98
|
-
};
|
|
99
|
-
/**
|
|
100
|
-
* POST /register - Register new user
|
|
101
|
-
*
|
|
102
|
-
* Register with email/phone and password, includes public key
|
|
103
|
-
* Final path: /_auth/register (prefix added from package.json)
|
|
104
|
-
*/
|
|
105
|
-
declare const registerContract: {
|
|
106
|
-
readonly method: "POST";
|
|
107
|
-
readonly path: "/_auth/register";
|
|
108
|
-
readonly body: _sinclair_typebox.TObject<{
|
|
109
|
-
email: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
110
|
-
phone: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
111
|
-
verificationToken: _sinclair_typebox.TString;
|
|
112
|
-
password: _sinclair_typebox.TString;
|
|
113
|
-
publicKey: _sinclair_typebox.TString;
|
|
114
|
-
keyId: _sinclair_typebox.TString;
|
|
115
|
-
fingerprint: _sinclair_typebox.TString;
|
|
116
|
-
algorithm: _sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"ES256">, _sinclair_typebox.TLiteral<"RS256">]>;
|
|
117
|
-
keySize: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
|
|
118
|
-
}>;
|
|
119
|
-
readonly response: _sinclair_typebox.TUnion<[_sinclair_typebox.TObject<{
|
|
120
|
-
success: _sinclair_typebox.TLiteral<true>;
|
|
121
|
-
data: _sinclair_typebox.TObject<{
|
|
122
|
-
userId: _sinclair_typebox.TString;
|
|
123
|
-
email: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
124
|
-
phone: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
125
|
-
}>;
|
|
126
|
-
message: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
127
|
-
}>, _sinclair_typebox.TObject<{
|
|
128
|
-
success: _sinclair_typebox.TLiteral<false>;
|
|
129
|
-
error: _sinclair_typebox.TObject<{
|
|
130
|
-
code: _sinclair_typebox.TString;
|
|
131
|
-
message: _sinclair_typebox.TString;
|
|
132
|
-
details: _sinclair_typebox.TOptional<_sinclair_typebox.TAny>;
|
|
133
|
-
}>;
|
|
134
|
-
}>]>;
|
|
135
|
-
};
|
|
136
|
-
/**
|
|
137
|
-
* POST /login - User login
|
|
138
|
-
*
|
|
139
|
-
* Authenticate user with email/phone and password
|
|
140
|
-
* Replaces existing key with new one
|
|
141
|
-
* Final path: /_auth/login (prefix added from package.json)
|
|
142
|
-
*/
|
|
143
|
-
declare const loginContract: {
|
|
144
|
-
readonly method: "POST";
|
|
145
|
-
readonly path: "/_auth/login";
|
|
146
|
-
readonly body: _sinclair_typebox.TObject<{
|
|
147
|
-
email: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
148
|
-
phone: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
149
|
-
password: _sinclair_typebox.TString;
|
|
150
|
-
publicKey: _sinclair_typebox.TString;
|
|
151
|
-
keyId: _sinclair_typebox.TString;
|
|
152
|
-
fingerprint: _sinclair_typebox.TString;
|
|
153
|
-
oldKeyId: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
154
|
-
algorithm: _sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"ES256">, _sinclair_typebox.TLiteral<"RS256">]>;
|
|
155
|
-
keySize: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
|
|
156
|
-
}>;
|
|
157
|
-
readonly response: _sinclair_typebox.TUnion<[_sinclair_typebox.TObject<{
|
|
158
|
-
success: _sinclair_typebox.TLiteral<true>;
|
|
159
|
-
data: _sinclair_typebox.TObject<{
|
|
160
|
-
userId: _sinclair_typebox.TString;
|
|
161
|
-
email: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
162
|
-
phone: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
163
|
-
passwordChangeRequired: _sinclair_typebox.TBoolean;
|
|
164
|
-
}>;
|
|
165
|
-
message: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
166
|
-
}>, _sinclair_typebox.TObject<{
|
|
167
|
-
success: _sinclair_typebox.TLiteral<false>;
|
|
168
|
-
error: _sinclair_typebox.TObject<{
|
|
169
|
-
code: _sinclair_typebox.TString;
|
|
170
|
-
message: _sinclair_typebox.TString;
|
|
171
|
-
details: _sinclair_typebox.TOptional<_sinclair_typebox.TAny>;
|
|
172
|
-
}>;
|
|
173
|
-
}>]>;
|
|
174
|
-
};
|
|
175
|
-
/**
|
|
176
|
-
* POST /logout - Logout user
|
|
177
|
-
*
|
|
178
|
-
* Revokes current key (requires authentication)
|
|
179
|
-
* Final path: /_auth/logout (prefix added from package.json)
|
|
180
|
-
*/
|
|
181
|
-
declare const logoutContract: {
|
|
182
|
-
readonly method: "POST";
|
|
183
|
-
readonly path: "/_auth/logout";
|
|
184
|
-
readonly body: _sinclair_typebox.TObject<{}>;
|
|
185
|
-
readonly response: _sinclair_typebox.TUnion<[_sinclair_typebox.TObject<{
|
|
186
|
-
success: _sinclair_typebox.TLiteral<true>;
|
|
187
|
-
data: _sinclair_typebox.TObject<{
|
|
188
|
-
success: _sinclair_typebox.TBoolean;
|
|
189
|
-
}>;
|
|
190
|
-
message: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
191
|
-
}>, _sinclair_typebox.TObject<{
|
|
192
|
-
success: _sinclair_typebox.TLiteral<false>;
|
|
193
|
-
error: _sinclair_typebox.TObject<{
|
|
194
|
-
code: _sinclair_typebox.TString;
|
|
195
|
-
message: _sinclair_typebox.TString;
|
|
196
|
-
details: _sinclair_typebox.TOptional<_sinclair_typebox.TAny>;
|
|
197
|
-
}>;
|
|
198
|
-
}>]>;
|
|
199
|
-
};
|
|
200
|
-
/**
|
|
201
|
-
* POST /keys/rotate - Rotate key
|
|
202
|
-
*
|
|
203
|
-
* Replace current key with new one (requires authentication)
|
|
204
|
-
* Final path: /_auth/keys/rotate (prefix added from package.json)
|
|
205
|
-
*/
|
|
206
|
-
declare const rotateKeyContract: {
|
|
207
|
-
readonly method: "POST";
|
|
208
|
-
readonly path: "/_auth/keys/rotate";
|
|
209
|
-
readonly body: _sinclair_typebox.TObject<{
|
|
210
|
-
publicKey: _sinclair_typebox.TString;
|
|
211
|
-
keyId: _sinclair_typebox.TString;
|
|
212
|
-
fingerprint: _sinclair_typebox.TString;
|
|
213
|
-
algorithm: _sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"ES256">, _sinclair_typebox.TLiteral<"RS256">]>;
|
|
214
|
-
keySize: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
|
|
215
|
-
}>;
|
|
216
|
-
readonly response: _sinclair_typebox.TUnion<[_sinclair_typebox.TObject<{
|
|
217
|
-
success: _sinclair_typebox.TLiteral<true>;
|
|
218
|
-
data: _sinclair_typebox.TObject<{
|
|
219
|
-
success: _sinclair_typebox.TBoolean;
|
|
220
|
-
keyId: _sinclair_typebox.TString;
|
|
221
|
-
}>;
|
|
222
|
-
message: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
223
|
-
}>, _sinclair_typebox.TObject<{
|
|
224
|
-
success: _sinclair_typebox.TLiteral<false>;
|
|
225
|
-
error: _sinclair_typebox.TObject<{
|
|
226
|
-
code: _sinclair_typebox.TString;
|
|
227
|
-
message: _sinclair_typebox.TString;
|
|
228
|
-
details: _sinclair_typebox.TOptional<_sinclair_typebox.TAny>;
|
|
229
|
-
}>;
|
|
230
|
-
}>]>;
|
|
231
|
-
};
|
|
232
|
-
/**
|
|
233
|
-
* PUT /password - Change user password
|
|
234
|
-
*
|
|
235
|
-
* Allows authenticated users to change their password
|
|
236
|
-
* Requires current password for verification
|
|
237
|
-
* Final path: /_auth/password (prefix added from package.json)
|
|
238
|
-
*/
|
|
239
|
-
declare const changePasswordContract: {
|
|
240
|
-
readonly method: "PUT";
|
|
241
|
-
readonly path: "/_auth/password";
|
|
242
|
-
readonly body: _sinclair_typebox.TObject<{
|
|
243
|
-
currentPassword: _sinclair_typebox.TString;
|
|
244
|
-
newPassword: _sinclair_typebox.TString;
|
|
245
|
-
}>;
|
|
246
|
-
readonly response: _sinclair_typebox.TUnion<[_sinclair_typebox.TObject<{
|
|
247
|
-
success: _sinclair_typebox.TLiteral<true>;
|
|
248
|
-
data: _sinclair_typebox.TObject<{
|
|
249
|
-
success: _sinclair_typebox.TBoolean;
|
|
250
|
-
}>;
|
|
251
|
-
message: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
252
|
-
}>, _sinclair_typebox.TObject<{
|
|
253
|
-
success: _sinclair_typebox.TLiteral<false>;
|
|
254
|
-
error: _sinclair_typebox.TObject<{
|
|
255
|
-
code: _sinclair_typebox.TString;
|
|
256
|
-
message: _sinclair_typebox.TString;
|
|
257
|
-
details: _sinclair_typebox.TOptional<_sinclair_typebox.TAny>;
|
|
258
|
-
}>;
|
|
259
|
-
}>]>;
|
|
260
|
-
};
|
|
261
|
-
/**
|
|
262
|
-
* GET /me - Get current user info
|
|
263
|
-
*
|
|
264
|
-
* Returns authenticated user's information including role and permissions
|
|
265
|
-
* Requires authentication
|
|
266
|
-
* Final path: /_auth/me (prefix added from package.json)
|
|
267
|
-
*/
|
|
268
|
-
declare const getMeContract: {
|
|
269
|
-
readonly method: "GET";
|
|
270
|
-
readonly path: "/_auth/me";
|
|
271
|
-
readonly body: _sinclair_typebox.TObject<{}>;
|
|
272
|
-
readonly response: _sinclair_typebox.TUnion<[_sinclair_typebox.TObject<{
|
|
273
|
-
success: _sinclair_typebox.TLiteral<true>;
|
|
274
|
-
data: _sinclair_typebox.TObject<{
|
|
275
|
-
userId: _sinclair_typebox.TString;
|
|
276
|
-
email: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
277
|
-
phone: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
278
|
-
role: _sinclair_typebox.TObject<{
|
|
279
|
-
id: _sinclair_typebox.TNumber;
|
|
280
|
-
name: _sinclair_typebox.TString;
|
|
281
|
-
displayName: _sinclair_typebox.TString;
|
|
282
|
-
priority: _sinclair_typebox.TNumber;
|
|
283
|
-
}>;
|
|
284
|
-
permissions: _sinclair_typebox.TArray<_sinclair_typebox.TObject<{
|
|
285
|
-
id: _sinclair_typebox.TNumber;
|
|
286
|
-
name: _sinclair_typebox.TString;
|
|
287
|
-
displayName: _sinclair_typebox.TString;
|
|
288
|
-
category: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
289
|
-
}>>;
|
|
290
|
-
}>;
|
|
291
|
-
message: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
292
|
-
}>, _sinclair_typebox.TObject<{
|
|
293
|
-
success: _sinclair_typebox.TLiteral<false>;
|
|
294
|
-
error: _sinclair_typebox.TObject<{
|
|
295
|
-
code: _sinclair_typebox.TString;
|
|
296
|
-
message: _sinclair_typebox.TString;
|
|
297
|
-
details: _sinclair_typebox.TOptional<_sinclair_typebox.TAny>;
|
|
298
|
-
}>;
|
|
299
|
-
}>]>;
|
|
300
|
-
};
|
|
301
|
-
|
|
302
|
-
export { changePasswordContract, checkAccountExistsContract, getMeContract, loginContract, logoutContract, registerContract, rotateKeyContract, sendVerificationCodeContract, verifyCodeContract };
|