@alien_org/auth-client 0.0.7-beta
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 +51 -0
- package/dist/index.cjs +1243 -0
- package/dist/index.d.cts +32 -0
- package/dist/index.d.mts +32 -0
- package/dist/index.mjs +1243 -0
- package/package.json +49 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { JWTVerifyGetKey } from "jose";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
//#region src/types.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Token info schema (parsed from JWT)
|
|
7
|
+
*/
|
|
8
|
+
declare const TokenInfoSchema: z.ZodObject<{
|
|
9
|
+
iss: z.ZodString;
|
|
10
|
+
sub: z.ZodString;
|
|
11
|
+
aud: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
|
|
12
|
+
exp: z.ZodNumber;
|
|
13
|
+
iat: z.ZodNumber;
|
|
14
|
+
nonce: z.ZodOptional<z.ZodString>;
|
|
15
|
+
auth_time: z.ZodOptional<z.ZodNumber>;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
type TokenInfo = z.infer<typeof TokenInfoSchema>;
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/index.d.ts
|
|
20
|
+
type AuthClientOptions = {
|
|
21
|
+
jwksUrl?: string;
|
|
22
|
+
};
|
|
23
|
+
declare class AuthClient {
|
|
24
|
+
private readonly jwks;
|
|
25
|
+
constructor(jwks: JWTVerifyGetKey);
|
|
26
|
+
verifyToken(accessToken: string): Promise<TokenInfo>;
|
|
27
|
+
}
|
|
28
|
+
declare const createAuthClient: ({
|
|
29
|
+
jwksUrl
|
|
30
|
+
}?: AuthClientOptions) => AuthClient;
|
|
31
|
+
//#endregion
|
|
32
|
+
export { type AuthClient, type AuthClientOptions, createAuthClient };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { JWTVerifyGetKey } from "jose";
|
|
3
|
+
|
|
4
|
+
//#region src/types.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Token info schema (parsed from JWT)
|
|
7
|
+
*/
|
|
8
|
+
declare const TokenInfoSchema: z.ZodObject<{
|
|
9
|
+
iss: z.ZodString;
|
|
10
|
+
sub: z.ZodString;
|
|
11
|
+
aud: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
|
|
12
|
+
exp: z.ZodNumber;
|
|
13
|
+
iat: z.ZodNumber;
|
|
14
|
+
nonce: z.ZodOptional<z.ZodString>;
|
|
15
|
+
auth_time: z.ZodOptional<z.ZodNumber>;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
type TokenInfo = z.infer<typeof TokenInfoSchema>;
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/index.d.ts
|
|
20
|
+
type AuthClientOptions = {
|
|
21
|
+
jwksUrl?: string;
|
|
22
|
+
};
|
|
23
|
+
declare class AuthClient {
|
|
24
|
+
private readonly jwks;
|
|
25
|
+
constructor(jwks: JWTVerifyGetKey);
|
|
26
|
+
verifyToken(accessToken: string): Promise<TokenInfo>;
|
|
27
|
+
}
|
|
28
|
+
declare const createAuthClient: ({
|
|
29
|
+
jwksUrl
|
|
30
|
+
}?: AuthClientOptions) => AuthClient;
|
|
31
|
+
//#endregion
|
|
32
|
+
export { type AuthClient, type AuthClientOptions, createAuthClient };
|