optcg-auth-client 0.1.0
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 +21 -0
- package/README.md +24 -0
- package/dist/index.d.ts +67 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +108 -0
- package/dist/index.js.map +1 -0
- package/package.json +44 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Poneglyph
|
|
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,24 @@
|
|
|
1
|
+
# optcg-auth-client
|
|
2
|
+
|
|
3
|
+
Typed browser client for the Poneglyph auth service.
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
import { createAuthClient } from "optcg-auth-client";
|
|
7
|
+
|
|
8
|
+
const auth = createAuthClient();
|
|
9
|
+
await auth.login({ username: "name", password: "password" });
|
|
10
|
+
const session = await auth.getSession();
|
|
11
|
+
await auth.logout();
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Requests use `credentials: "include"` so the browser sends and receives the `auth.poneglyph.one` HTTP-only session cookie.
|
|
15
|
+
|
|
16
|
+
## API
|
|
17
|
+
|
|
18
|
+
- `buildAuthUrl(path, params?, options?)`
|
|
19
|
+
- `authFetch(path, params?, options?)`
|
|
20
|
+
- `authPost(path, body, options?)`
|
|
21
|
+
- `createAuthClient(options?)`
|
|
22
|
+
- `AuthClientError`
|
|
23
|
+
|
|
24
|
+
The default auth origin is `https://auth.poneglyph.one`. Pass `baseUrl` to target a local or preview auth service.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
export declare const DEFAULT_AUTH_BASE_URL = "https://auth.poneglyph.one";
|
|
2
|
+
export type QueryParams = Record<string, string | number | boolean | null | undefined>;
|
|
3
|
+
export type AuthFetchImplementation = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
|
|
4
|
+
export type AuthClientOptions = {
|
|
5
|
+
baseUrl?: string;
|
|
6
|
+
fetch?: AuthFetchImplementation;
|
|
7
|
+
};
|
|
8
|
+
export type AuthRequestOptions = AuthClientOptions & {
|
|
9
|
+
signal?: AbortSignal;
|
|
10
|
+
};
|
|
11
|
+
export type AuthUser = {
|
|
12
|
+
id: string;
|
|
13
|
+
username: string;
|
|
14
|
+
display_name: string;
|
|
15
|
+
email: string | null;
|
|
16
|
+
email_verified: boolean;
|
|
17
|
+
};
|
|
18
|
+
export type AuthSession = {
|
|
19
|
+
id: string;
|
|
20
|
+
expires_at: string;
|
|
21
|
+
};
|
|
22
|
+
export type LoginInput = {
|
|
23
|
+
username: string;
|
|
24
|
+
password: string;
|
|
25
|
+
};
|
|
26
|
+
export type RegisterInput = {
|
|
27
|
+
username: string;
|
|
28
|
+
password: string;
|
|
29
|
+
display_name?: string;
|
|
30
|
+
email?: string | null;
|
|
31
|
+
};
|
|
32
|
+
export type AuthResponse = {
|
|
33
|
+
data: {
|
|
34
|
+
user: AuthUser;
|
|
35
|
+
session: AuthSession;
|
|
36
|
+
token: string;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export type AuthSessionResponse = {
|
|
40
|
+
data: {
|
|
41
|
+
user: AuthUser;
|
|
42
|
+
session: AuthSession;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
export type LogoutResponse = {
|
|
46
|
+
data: {
|
|
47
|
+
ok: true;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
export declare class AuthClientError extends Error {
|
|
51
|
+
readonly status: number;
|
|
52
|
+
readonly body: unknown;
|
|
53
|
+
constructor(status: number, message: string, body: unknown);
|
|
54
|
+
}
|
|
55
|
+
export declare function buildAuthUrl(path: string, params?: QueryParams, options?: Pick<AuthClientOptions, "baseUrl">): string;
|
|
56
|
+
export declare function authFetch<T>(path: string, params?: QueryParams, options?: AuthRequestOptions): Promise<T>;
|
|
57
|
+
export declare function authPost<T>(path: string, body: unknown, options?: AuthRequestOptions): Promise<T>;
|
|
58
|
+
export declare function createAuthClient(options?: AuthClientOptions): {
|
|
59
|
+
buildUrl(path: string, params?: QueryParams): string;
|
|
60
|
+
fetch<T>(path: string, params?: QueryParams, requestOptions?: AuthRequestOptions): Promise<T>;
|
|
61
|
+
post<T>(path: string, body: unknown, requestOptions?: AuthRequestOptions): Promise<T>;
|
|
62
|
+
login(input: LoginInput, requestOptions?: AuthRequestOptions): Promise<AuthResponse>;
|
|
63
|
+
register(input: RegisterInput, requestOptions?: AuthRequestOptions): Promise<AuthResponse>;
|
|
64
|
+
logout(requestOptions?: AuthRequestOptions): Promise<LogoutResponse>;
|
|
65
|
+
getSession(requestOptions?: AuthRequestOptions): Promise<AuthSessionResponse>;
|
|
66
|
+
};
|
|
67
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,+BAA+B,CAAC;AAElE,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;AAEvF,MAAM,MAAM,uBAAuB,GAAG,CACpC,KAAK,EAAE,MAAM,GAAG,GAAG,GAAG,OAAO,EAC7B,IAAI,CAAC,EAAE,WAAW,KACf,OAAO,CAAC,QAAQ,CAAC,CAAC;AAEvB,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,uBAAuB,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,iBAAiB,GAAG;IACnD,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,cAAc,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,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U,mBAAkB,kBAAkB;oBAG3C,aAAa,mBAAkB,kBAAkB;4BAG1C,kBAAkB;gCAGd,kBAAkB;EAIhD"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
export const DEFAULT_AUTH_BASE_URL = "https://auth.poneglyph.one";
|
|
2
|
+
export class AuthClientError extends Error {
|
|
3
|
+
status;
|
|
4
|
+
body;
|
|
5
|
+
constructor(status, message, body) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.name = "AuthClientError";
|
|
8
|
+
this.status = status;
|
|
9
|
+
this.body = body;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function isRecord(value) {
|
|
13
|
+
return typeof value === "object" && value !== null;
|
|
14
|
+
}
|
|
15
|
+
function readStringField(record, key) {
|
|
16
|
+
const value = record[key];
|
|
17
|
+
return typeof value === "string" ? value : null;
|
|
18
|
+
}
|
|
19
|
+
function parseJsonText(text) {
|
|
20
|
+
return JSON.parse(text);
|
|
21
|
+
}
|
|
22
|
+
function extractErrorMessage(body) {
|
|
23
|
+
if (!isRecord(body))
|
|
24
|
+
return null;
|
|
25
|
+
const error = body.error;
|
|
26
|
+
if (isRecord(error)) {
|
|
27
|
+
const nestedMessage = readStringField(error, "message");
|
|
28
|
+
if (nestedMessage)
|
|
29
|
+
return nestedMessage;
|
|
30
|
+
}
|
|
31
|
+
return readStringField(body, "message");
|
|
32
|
+
}
|
|
33
|
+
function resolveFetch(fetchImpl) {
|
|
34
|
+
if (fetchImpl)
|
|
35
|
+
return fetchImpl;
|
|
36
|
+
if (typeof globalThis.fetch === "function") {
|
|
37
|
+
return globalThis.fetch.bind(globalThis);
|
|
38
|
+
}
|
|
39
|
+
throw new Error("No fetch implementation is available");
|
|
40
|
+
}
|
|
41
|
+
async function readJsonBody(response) {
|
|
42
|
+
const text = await response.text();
|
|
43
|
+
return (text ? parseJsonText(text) : undefined);
|
|
44
|
+
}
|
|
45
|
+
async function requestJson(url, init, options = {}) {
|
|
46
|
+
const fetchImpl = resolveFetch(options.fetch);
|
|
47
|
+
const response = await fetchImpl(url, {
|
|
48
|
+
...init,
|
|
49
|
+
credentials: "include",
|
|
50
|
+
signal: options.signal,
|
|
51
|
+
});
|
|
52
|
+
const body = await readJsonBody(response);
|
|
53
|
+
if (!response.ok) {
|
|
54
|
+
throw new AuthClientError(response.status, extractErrorMessage(body) ?? `Auth API error ${response.status}`, body);
|
|
55
|
+
}
|
|
56
|
+
return body;
|
|
57
|
+
}
|
|
58
|
+
export function buildAuthUrl(path, params, options = {}) {
|
|
59
|
+
const normalizedPath = path.startsWith("/") ? path : `/${path}`;
|
|
60
|
+
const origin = (options.baseUrl ?? DEFAULT_AUTH_BASE_URL).replace(/\/+$/, "");
|
|
61
|
+
const url = new URL(`/v1${normalizedPath}`, `${origin}/`);
|
|
62
|
+
if (params) {
|
|
63
|
+
for (const [key, value] of Object.entries(params)) {
|
|
64
|
+
if (value !== undefined && value !== null) {
|
|
65
|
+
url.searchParams.set(key, String(value));
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return url.toString();
|
|
70
|
+
}
|
|
71
|
+
export async function authFetch(path, params, options = {}) {
|
|
72
|
+
return requestJson(buildAuthUrl(path, params, options), {}, options);
|
|
73
|
+
}
|
|
74
|
+
export async function authPost(path, body, options = {}) {
|
|
75
|
+
return requestJson(buildAuthUrl(path, undefined, options), {
|
|
76
|
+
method: "POST",
|
|
77
|
+
headers: {
|
|
78
|
+
"Content-Type": "application/json",
|
|
79
|
+
},
|
|
80
|
+
body: JSON.stringify(body),
|
|
81
|
+
}, options);
|
|
82
|
+
}
|
|
83
|
+
export function createAuthClient(options = {}) {
|
|
84
|
+
return {
|
|
85
|
+
buildUrl(path, params) {
|
|
86
|
+
return buildAuthUrl(path, params, options);
|
|
87
|
+
},
|
|
88
|
+
fetch(path, params, requestOptions = {}) {
|
|
89
|
+
return authFetch(path, params, { ...options, ...requestOptions });
|
|
90
|
+
},
|
|
91
|
+
post(path, body, requestOptions = {}) {
|
|
92
|
+
return authPost(path, body, { ...options, ...requestOptions });
|
|
93
|
+
},
|
|
94
|
+
login(input, requestOptions = {}) {
|
|
95
|
+
return authPost("/auth/login", input, { ...options, ...requestOptions });
|
|
96
|
+
},
|
|
97
|
+
register(input, requestOptions = {}) {
|
|
98
|
+
return authPost("/auth/register", input, { ...options, ...requestOptions });
|
|
99
|
+
},
|
|
100
|
+
logout(requestOptions = {}) {
|
|
101
|
+
return authPost("/auth/logout", {}, { ...options, ...requestOptions });
|
|
102
|
+
},
|
|
103
|
+
getSession(requestOptions = {}) {
|
|
104
|
+
return authFetch("/auth/session", undefined, { ...options, ...requestOptions });
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,qBAAqB,GAAG,4BAA4B,CAAC;AAgElE,MAAM,OAAO,eAAgB,SAAQ,KAAK;IAC/B,MAAM,CAAS;IACf,IAAI,CAAU;IAEvB,YAAY,MAAc,EAAE,OAAe,EAAE,IAAa;QACxD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAC9B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AACrD,CAAC;AAED,SAAS,eAAe,CAAC,MAA+B,EAAE,GAAW;IACnE,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IAC1B,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,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GAAG,cAAc,EAAE,CAAC,CAAC;QAC5F,CAAC;QACD,MAAM,CAAC,iBAAqC,EAAE;YAC5C,OAAO,QAAQ,CAAiB,cAAc,EAAE,EAAE,EAAE,EAAE,GAAG,OAAO,EAAE,GAAG,cAAc,EAAE,CAAC,CAAC;QACzF,CAAC;QACD,UAAU,CAAC,iBAAqC,EAAE;YAChD,OAAO,SAAS,CAAsB,eAAe,EAAE,SAAS,EAAE,EAAE,GAAG,OAAO,EAAE,GAAG,cAAc,EAAE,CAAC,CAAC;QACvG,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "optcg-auth-client",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Typed browser client for the Poneglyph auth service",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/Reldnahc/optcg-auth-client.git"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/Reldnahc/optcg-auth-client#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/Reldnahc/optcg-auth-client/issues"
|
|
14
|
+
},
|
|
15
|
+
"main": "./dist/index.js",
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"import": "./dist/index.js"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist",
|
|
25
|
+
"README.md",
|
|
26
|
+
"LICENSE"
|
|
27
|
+
],
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=20"
|
|
30
|
+
},
|
|
31
|
+
"publishConfig": {
|
|
32
|
+
"access": "public"
|
|
33
|
+
},
|
|
34
|
+
"scripts": {
|
|
35
|
+
"build": "tsc -p tsconfig.json",
|
|
36
|
+
"prepare": "npm run build",
|
|
37
|
+
"prepublishOnly": "npm run test",
|
|
38
|
+
"test": "npm run build && node test/client.test.mjs"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@types/node": "^24.12.0",
|
|
42
|
+
"typescript": "^5.9.3"
|
|
43
|
+
}
|
|
44
|
+
}
|