@crossauth/fastify 0.0.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 +203 -0
- package/README.md +12 -0
- package/dist/fastifyadminclientendpoints.d.ts +149 -0
- package/dist/fastifyadminendpoints.d.ts +126 -0
- package/dist/fastifyapikey.d.ts +42 -0
- package/dist/fastifyoauthclient.d.ts +429 -0
- package/dist/fastifyoauthserver.d.ts +248 -0
- package/dist/fastifyresserver.d.ts +93 -0
- package/dist/fastifyserver.d.ts +293 -0
- package/dist/fastifysession.d.ts +767 -0
- package/dist/fastifysessionadapter.d.ts +48 -0
- package/dist/fastifyuserclientendpoints.d.ts +61 -0
- package/dist/fastifyuserendpoints.d.ts +193 -0
- package/dist/index.cjs +9085 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.js +9085 -0
- package/dist/tests/admincommon.d.ts +20 -0
- package/dist/tests/fastifyadminapiendpoints.test.d.ts +13 -0
- package/dist/tests/fastifyadminclientapiendpoints.test.d.ts +13 -0
- package/dist/tests/fastifyadminclientendpoints.test.d.ts +13 -0
- package/dist/tests/fastifyadminendpoints.test.d.ts +13 -0
- package/dist/tests/fastifyapikeyserver.test.d.ts +13 -0
- package/dist/tests/fastifyapiserver.test.d.ts +11 -0
- package/dist/tests/fastifyapitwofactor.test.d.ts +11 -0
- package/dist/tests/fastifyauthserver.test.d.ts +17 -0
- package/dist/tests/fastifyclient.test.d.ts +1 -0
- package/dist/tests/fastifymfaclient.test.d.ts +4 -0
- package/dist/tests/fastifyresserver.test.d.ts +1 -0
- package/dist/tests/fastifysessionserver.test.d.ts +13 -0
- package/dist/tests/fastifytwofactorserver.test.d.ts +17 -0
- package/dist/tests/fastifyuserclientapiendpoints.test.d.ts +13 -0
- package/dist/tests/fastifyuserclientendpoints.test.d.ts +13 -0
- package/dist/tests/inmemorytestdata.d.ts +3 -0
- package/dist/tests/oauthcommon.d.ts +45 -0
- package/package.json +75 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { InMemoryUserStorage, InMemoryKeyStorage, InMemoryOAuthClientStorage } from '@crossauth/backend';
|
|
2
|
+
import { FastifyServer, FastifyServerOptions } from '../fastifyserver';
|
|
3
|
+
|
|
4
|
+
export declare function makeAppWithOptions(options?: FastifyServerOptions): Promise<{
|
|
5
|
+
userStorage: InMemoryUserStorage;
|
|
6
|
+
keyStorage: InMemoryKeyStorage;
|
|
7
|
+
clientStorage: InMemoryOAuthClientStorage;
|
|
8
|
+
server: FastifyServer;
|
|
9
|
+
}>;
|
|
10
|
+
export declare function getCsrf(res: any): {
|
|
11
|
+
csrfCookie: string;
|
|
12
|
+
csrfToken: string;
|
|
13
|
+
};
|
|
14
|
+
export declare function getSession(res: any): string;
|
|
15
|
+
export declare function login(server: FastifyServer, username?: string, password?: string): Promise<{
|
|
16
|
+
csrfCookie: string;
|
|
17
|
+
csrfToken: string;
|
|
18
|
+
sessionCookie: string;
|
|
19
|
+
status: number;
|
|
20
|
+
}>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare var confirmEmailData: {
|
|
2
|
+
token: string;
|
|
3
|
+
email: string;
|
|
4
|
+
extraData: {
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
export declare var passwordResetData: {
|
|
9
|
+
token: string;
|
|
10
|
+
extraData: {
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export declare var emailTokenData: {
|
|
15
|
+
to: string;
|
|
16
|
+
otp: string;
|
|
17
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CSRFHEADER = "X-CROSSAUTH-CSRF";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare var confirmEmailData: {
|
|
2
|
+
token: string;
|
|
3
|
+
email: string;
|
|
4
|
+
extraData: {
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
export declare var passwordResetData: {
|
|
9
|
+
token: string;
|
|
10
|
+
extraData: {
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export declare var emailTokenData: {
|
|
15
|
+
to: string;
|
|
16
|
+
otp: string;
|
|
17
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { OAuthAuthorizationServer, InMemoryKeyStorage, OAuthClientStorage, EmailAuthenticator } from '@crossauth/backend';
|
|
2
|
+
import { OAuthClient } from '@crossauth/common';
|
|
3
|
+
|
|
4
|
+
export declare function createClient(secretRequired?: boolean): Promise<{
|
|
5
|
+
clientStorage: OAuthClientStorage;
|
|
6
|
+
client: OAuthClient;
|
|
7
|
+
}>;
|
|
8
|
+
export declare function getAuthServer({ aud, persistAccessToken, emptyScopeIsValid, secretRequired, rollingRefreshToken, }?: {
|
|
9
|
+
challenge?: boolean;
|
|
10
|
+
aud?: string;
|
|
11
|
+
persistAccessToken?: boolean;
|
|
12
|
+
emptyScopeIsValid?: boolean;
|
|
13
|
+
secretRequired?: boolean;
|
|
14
|
+
rollingRefreshToken?: boolean;
|
|
15
|
+
}): Promise<{
|
|
16
|
+
client: OAuthClient;
|
|
17
|
+
clientStorage: OAuthClientStorage;
|
|
18
|
+
authServer: OAuthAuthorizationServer;
|
|
19
|
+
keyStorage: InMemoryKeyStorage;
|
|
20
|
+
userStorage: import('@crossauth/backend').InMemoryUserStorage;
|
|
21
|
+
emailAuth: EmailAuthenticator;
|
|
22
|
+
}>;
|
|
23
|
+
export declare function getAuthorizationCode({ challenge, aud, persistAccessToken, rollingRefreshToken, }?: {
|
|
24
|
+
challenge?: boolean;
|
|
25
|
+
aud?: string;
|
|
26
|
+
persistAccessToken?: boolean;
|
|
27
|
+
rollingRefreshToken?: boolean;
|
|
28
|
+
}): Promise<{
|
|
29
|
+
code: string | undefined;
|
|
30
|
+
client: OAuthClient;
|
|
31
|
+
clientStorage: OAuthClientStorage;
|
|
32
|
+
authServer: OAuthAuthorizationServer;
|
|
33
|
+
keyStorage: InMemoryKeyStorage;
|
|
34
|
+
}>;
|
|
35
|
+
export declare function getAccessToken(): Promise<{
|
|
36
|
+
authServer: OAuthAuthorizationServer;
|
|
37
|
+
client: OAuthClient;
|
|
38
|
+
code: string | undefined;
|
|
39
|
+
clientStorage: OAuthClientStorage;
|
|
40
|
+
access_token: string | undefined;
|
|
41
|
+
error: string | undefined;
|
|
42
|
+
error_description: string | undefined;
|
|
43
|
+
refresh_token: string | undefined;
|
|
44
|
+
expires_in: number | undefined;
|
|
45
|
+
}>;
|
package/package.json
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@crossauth/fastify",
|
|
3
|
+
"private": false,
|
|
4
|
+
"version": "0.0.2",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"typings": "./dist/index.d.ts",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"files": [
|
|
11
|
+
"dist/*"
|
|
12
|
+
],
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"@types/node": "^20.10.8",
|
|
15
|
+
"@types/supertest": "^6.0.2",
|
|
16
|
+
"dotenv-flow": "^4.1.0",
|
|
17
|
+
"jimp": "^0.22.10",
|
|
18
|
+
"jsqr": "^1.4.0",
|
|
19
|
+
"supertest": "^6.3.3",
|
|
20
|
+
"typedoc": "^0.25.4",
|
|
21
|
+
"typescript": "^5.3.3",
|
|
22
|
+
"vite": "^5.0.8",
|
|
23
|
+
"vite-plugin-dts": "^3.6.4",
|
|
24
|
+
"vitest": "^1.1.0",
|
|
25
|
+
"vitest-fetch-mock": "^0.2.2"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@esbuild-plugins/node-modules-polyfill": "^0.2.2",
|
|
29
|
+
"@fastify/cookie": "^9.2.0",
|
|
30
|
+
"@fastify/cors": "^9.0.1",
|
|
31
|
+
"@fastify/formbody": "^7.4.0",
|
|
32
|
+
"@fastify/view": "^8.2.0",
|
|
33
|
+
"@prisma/client": "^5.9.1",
|
|
34
|
+
"@types/cookie": "^0.6.0",
|
|
35
|
+
"@types/cookie-parser": "^1.4.6",
|
|
36
|
+
"@types/express": "^4.17.21",
|
|
37
|
+
"@types/jsonwebtoken": "^9.0.5",
|
|
38
|
+
"@types/ldapjs": "^3.0.6",
|
|
39
|
+
"@types/nodemailer": "^6.4.14",
|
|
40
|
+
"@types/nunjucks": "^3.2.6",
|
|
41
|
+
"@types/qrcode": "^1.5.5",
|
|
42
|
+
"cookie": "^0.6.0",
|
|
43
|
+
"cookie-parser": "^1.4.6",
|
|
44
|
+
"dotenv": "^16.3.1",
|
|
45
|
+
"dotenv-cli": "^7.3.0",
|
|
46
|
+
"events": "^3.3.0",
|
|
47
|
+
"express": "^4.18.2",
|
|
48
|
+
"fastify": "^4.25.2",
|
|
49
|
+
"fastify-vite": "^3.0.0-beta.27",
|
|
50
|
+
"http-request-mock": "^1.8.18",
|
|
51
|
+
"jsonwebtoken": "^9.0.2",
|
|
52
|
+
"jwt-decode": "^4.0.0",
|
|
53
|
+
"ldap-async": "^2.1.1",
|
|
54
|
+
"ldapjs": "^3.0.7",
|
|
55
|
+
"nodemailer": "^6.9.8",
|
|
56
|
+
"nunjucks": "^3.2.4",
|
|
57
|
+
"otplib": "^12.0.1",
|
|
58
|
+
"prisma": "^5.9.1",
|
|
59
|
+
"qrcode": "^1.5.3",
|
|
60
|
+
"sonic-boom": "^3.7.0",
|
|
61
|
+
"@crossauth/common": "^0.0.2",
|
|
62
|
+
"@crossauth/backend": "^0.0.2"
|
|
63
|
+
},
|
|
64
|
+
"scripts": {
|
|
65
|
+
"dev": "vite",
|
|
66
|
+
"build": "vite build",
|
|
67
|
+
"preview": "vite preview",
|
|
68
|
+
"test": "dotenv -e .env.unittest vitest",
|
|
69
|
+
"testonce": "dotenv -e .env.unittest vitest run",
|
|
70
|
+
"doc": "typedoc",
|
|
71
|
+
"preinstall": "echo 'prisma not needed in this module'",
|
|
72
|
+
"postinstall": "echo 'prisma not needed in this module'",
|
|
73
|
+
"prisma": "echo 'prisma not needed in this module'"
|
|
74
|
+
}
|
|
75
|
+
}
|