@authie/types 0.1.2

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Authie
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,4 @@
1
+ # `@authie/types`
2
+
3
+ Framework-neutral public contracts shared by Authie frontend, backend, React,
4
+ and framework SDKs. This package has no runtime dependencies.
@@ -0,0 +1,148 @@
1
+ export type AuthieId = string;
2
+ export type AuthieUser = {
3
+ id: AuthieId;
4
+ personId?: AuthieId;
5
+ email: string;
6
+ name: string;
7
+ emailVerified: boolean;
8
+ image?: string | null;
9
+ role?: string;
10
+ roles: string[];
11
+ permissions: string[];
12
+ entitlementVersion?: number;
13
+ publicMetadata: Record<string, unknown>;
14
+ /** Only returned by the Backend API. Never included in browser session resources or token claims. */
15
+ privateMetadata?: Record<string, unknown>;
16
+ createdAt?: string;
17
+ updatedAt?: string;
18
+ };
19
+ export type AuthieInvitation = {
20
+ id: AuthieId;
21
+ email: string;
22
+ applicationId: AuthieId;
23
+ roleKey: string | null;
24
+ status: "pending" | "accepted" | "expired" | "revoked";
25
+ expiresAt: string;
26
+ createdAt: string;
27
+ };
28
+ export type AuthieSession = {
29
+ id: AuthieId;
30
+ userId: AuthieId;
31
+ applicationId: AuthieId;
32
+ environmentId: AuthieId;
33
+ workspaceId?: AuthieId;
34
+ realmId?: AuthieId;
35
+ status: "active" | "pending" | "ended" | "revoked" | "expired";
36
+ currentTask?: string | null;
37
+ expiresAt: string;
38
+ lastActiveAt?: string;
39
+ user: AuthieUser;
40
+ };
41
+ export type AuthieClientResource = {
42
+ id: AuthieId;
43
+ activeSessionId: AuthieId | null;
44
+ sessionIds: AuthieId[];
45
+ lastActiveSessionId?: AuthieId | null;
46
+ };
47
+ export type AuthieSignInStatus = "needs_identifier" | "needs_first_factor" | "needs_second_factor" | "needs_new_password" | "needs_verification" | "complete";
48
+ export type AuthieSignUpStatus = "missing_requirements" | "needs_verification" | "complete";
49
+ export type AuthieVerificationStrategy = "password" | "email_code" | "email_link" | "totp" | "backup_code" | "passkey" | "oauth" | "enterprise_sso";
50
+ export type AuthieVerification = {
51
+ strategy: AuthieVerificationStrategy;
52
+ status: "unverified" | "verified" | "failed" | "expired";
53
+ errorCode?: string;
54
+ };
55
+ export type AuthieSignInAttempt = {
56
+ id: AuthieId;
57
+ status: AuthieSignInStatus;
58
+ identifier?: string;
59
+ supportedFirstFactors: AuthieVerificationStrategy[];
60
+ supportedSecondFactors: AuthieVerificationStrategy[];
61
+ firstFactorVerification?: AuthieVerification;
62
+ secondFactorVerification?: AuthieVerification;
63
+ createdSessionId?: AuthieId;
64
+ };
65
+ export type AuthieSignUpAttempt = {
66
+ id: AuthieId;
67
+ status: AuthieSignUpStatus;
68
+ email?: string;
69
+ name?: string;
70
+ missingFields: string[];
71
+ unverifiedFields: string[];
72
+ verifications: AuthieVerification[];
73
+ createdSessionId?: AuthieId;
74
+ createdUserId?: AuthieId;
75
+ };
76
+ export type AuthieSessionTokenClaims = {
77
+ iss: string;
78
+ aud: string | string[];
79
+ sub: string;
80
+ azp?: string;
81
+ authorized_party?: string;
82
+ jti: string;
83
+ iat: number;
84
+ nbf?: number;
85
+ exp: number;
86
+ sid: string;
87
+ workspace_id?: string;
88
+ realm_id?: string;
89
+ application_id: string;
90
+ environment_id: string;
91
+ membership_id?: string;
92
+ person_id?: string;
93
+ grant_id?: string;
94
+ roles: string[];
95
+ permissions: string[];
96
+ entitlement_version?: number;
97
+ auth_time?: number;
98
+ amr?: string[];
99
+ };
100
+ export type AuthieAuthObject = {
101
+ isAuthenticated: boolean;
102
+ userId: string | null;
103
+ sessionId: string | null;
104
+ applicationId: string | null;
105
+ environmentId: string | null;
106
+ workspaceId: string | null;
107
+ realmId: string | null;
108
+ roles: readonly string[];
109
+ permissions: readonly string[];
110
+ tokenType: "session_token" | "oauth_token" | "m2m_token" | null;
111
+ expiresAt: Date | null;
112
+ has(input: AuthieAuthorizationCheck): boolean;
113
+ getToken(): Promise<string | null>;
114
+ };
115
+ export type AuthieAuthorizationCheck = {
116
+ permission: string;
117
+ role?: never;
118
+ } | {
119
+ role: string;
120
+ permission?: never;
121
+ };
122
+ export type AuthieRequestStatus = "signed-in" | "signed-out" | "invalid" | "expired" | "handshake";
123
+ export type AuthieErrorCode = "configuration_error" | "authentication_required" | "authorization_failed" | "invalid_token" | "token_expired" | "identity_unavailable" | "invalid_webhook_signature" | "api_error";
124
+ export type AuthieApiErrorBody = {
125
+ code: string;
126
+ message: string;
127
+ requestId?: string;
128
+ errors?: Array<{
129
+ code: string;
130
+ message: string;
131
+ field?: string;
132
+ }>;
133
+ };
134
+ export type AuthieListResponse<T> = {
135
+ data: T[];
136
+ totalCount: number;
137
+ nextCursor: string | null;
138
+ };
139
+ export type AuthieWebhookEventType = "user.created" | "user.updated" | "user.deleted" | "session.created" | "session.ended" | "session.revoked" | "membership.created" | "membership.updated" | "membership.deleted";
140
+ export type AuthieWebhookEvent<TData = Record<string, unknown>> = {
141
+ id: string;
142
+ type: AuthieWebhookEventType;
143
+ applicationId: string;
144
+ environmentId: string;
145
+ createdAt: string;
146
+ data: TData;
147
+ };
148
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAE9B,MAAM,MAAM,UAAU,GAAG;IACvB,EAAE,EAAE,QAAQ,CAAC;IACb,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,OAAO,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC,qGAAqG;IACrG,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,EAAE,QAAQ,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,QAAQ,CAAC;IACxB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,MAAM,EAAE,SAAS,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,CAAC;IACvD,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EA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B,qBAAqB,GACrB,yBAAyB,GACzB,sBAAsB,GACtB,eAAe,GACf,eAAe,GACf,sBAAsB,GACtB,2BAA2B,GAC3B,WAAW,CAAC;AAEhB,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACnE,CAAC;AAEF,MAAM,MAAM,kBAAkB,CAAC,CAAC,IAAI;IAClC,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAC9B,cAAc,GACd,cAAc,GACd,cAAc,GACd,iBAAiB,GACjB,eAAe,GACf,iBAAiB,GACjB,oBAAoB,GACpB,oBAAoB,GACpB,oBAAoB,CAAC;AAEzB,MAAM,MAAM,kBAAkB,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;IAChE,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,sBAAsB,CAAC;IAC7B,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,KAAK,CAAC;CACb,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "@authie/types",
3
+ "version": "0.1.2",
4
+ "description": "Framework-neutral Authie resource, authentication, and webhook types.",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ }
13
+ },
14
+ "files": ["dist", "README.md"],
15
+ "sideEffects": false,
16
+ "scripts": {
17
+ "build": "tsc -p tsconfig.json"
18
+ },
19
+ "engines": {
20
+ "node": ">=20"
21
+ },
22
+ "author": "Authie",
23
+ "license": "MIT",
24
+ "homepage": "https://authie.ai",
25
+ "publishConfig": {
26
+ "access": "public",
27
+ "registry": "https://registry.npmjs.org/"
28
+ }
29
+ }