@leaguebrain/provenance 0.0.0-stage → 0.14.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 +7 -0
- package/README.md +135 -2
- package/dist/context-C2cW461e.d.ts +84 -0
- package/dist/helpers/index.d.ts +35 -0
- package/dist/helpers/index.js +113 -0
- package/dist/helpers/index.js.map +1 -0
- package/dist/index-CPpCO-Oc.d.ts +103 -0
- package/dist/index.d.ts +210 -0
- package/dist/index.js +551 -0
- package/dist/index.js.map +1 -0
- package/dist/initiatives/index.d.ts +19 -0
- package/dist/initiatives/index.js +74 -0
- package/dist/initiatives/index.js.map +1 -0
- package/dist/providers/index.d.ts +2 -0
- package/dist/providers/index.js +377 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/vite/index.d.ts +87 -0
- package/dist/vite/index.js +171 -0
- package/dist/vite/index.js.map +1 -0
- package/package.json +85 -3
- package/src/vite/sveltekit/runtime/js.d.ts +62 -0
- package/src/vite/sveltekit/runtime/js.js +412 -0
- package/src/vite/sveltekit/runtime/ts.ts +432 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import { R as Resolver, P as Provider } from './index-CPpCO-Oc.js';
|
|
2
|
+
export { a as ProviderCallbacks, g as github, k as keycloak, p as provider } from './index-CPpCO-Oc.js';
|
|
3
|
+
import { SerializeOptions } from 'cookie';
|
|
4
|
+
import { T as TokenRequestResult } from './context-C2cW461e.js';
|
|
5
|
+
export { C as Context } from './context-C2cW461e.js';
|
|
6
|
+
|
|
7
|
+
declare const localsResolver: <Session>() => Resolver<Session>;
|
|
8
|
+
|
|
9
|
+
declare const loginResolver: <Session>() => Resolver<Session>;
|
|
10
|
+
|
|
11
|
+
declare const logoutResolver: <Session>() => Resolver<Session>;
|
|
12
|
+
|
|
13
|
+
declare const redirectUriResolver: <Session>() => Resolver<Session>;
|
|
14
|
+
|
|
15
|
+
declare const refreshResolver: <Session extends {
|
|
16
|
+
refreshToken: string;
|
|
17
|
+
accessExpiresAt: number;
|
|
18
|
+
refreshExpiresAt?: number;
|
|
19
|
+
}>(options: {
|
|
20
|
+
/** in ms */
|
|
21
|
+
eagerRefresh: number;
|
|
22
|
+
}) => Resolver<Session>;
|
|
23
|
+
|
|
24
|
+
declare const signupResolver: <Session>() => Resolver<Session>;
|
|
25
|
+
|
|
26
|
+
declare const c: <State extends Record<string, any>>() => {
|
|
27
|
+
state: {
|
|
28
|
+
create(data: State): {
|
|
29
|
+
state: string;
|
|
30
|
+
cookie: Cookie;
|
|
31
|
+
};
|
|
32
|
+
use(cookies: Cookies): string;
|
|
33
|
+
decode(state: string): State;
|
|
34
|
+
};
|
|
35
|
+
pkce: {
|
|
36
|
+
create(): Promise<{
|
|
37
|
+
codeChallenge: string;
|
|
38
|
+
cookie: Cookie;
|
|
39
|
+
}>;
|
|
40
|
+
use(cookies: Cookies): string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
type ChecksModule<State extends Record<string, any>> = ReturnType<typeof c<State>>;
|
|
44
|
+
|
|
45
|
+
declare const o: <Session>(modules: {
|
|
46
|
+
checks: ChecksModule<{
|
|
47
|
+
referrer?: string;
|
|
48
|
+
}>;
|
|
49
|
+
}, provider: Provider<Session>, options: {
|
|
50
|
+
redirectUriPathname: string;
|
|
51
|
+
}) => {
|
|
52
|
+
/**
|
|
53
|
+
* create a redirect to the auth server for the user to login
|
|
54
|
+
* @param redirectUriOrigin origin for redirect uri.. typically the origin of the website that is logging in
|
|
55
|
+
* @param referrer the path that initiated the login
|
|
56
|
+
* @param setCookie a callback that will be used to set oauth check values in cookies to be consumed by the redirect uri handler
|
|
57
|
+
* @returns the generated auth server url
|
|
58
|
+
*/
|
|
59
|
+
login(redirectUriOrigin: string, referrer: string | null, setCookie: (name: string, value: string, opts: SerializeOptions & {
|
|
60
|
+
path: string;
|
|
61
|
+
}) => void): Promise<string>;
|
|
62
|
+
/**
|
|
63
|
+
* create a redirect to the auth server for the user to login
|
|
64
|
+
* @param redirectUriOrigin origin for redirect uri.. typically the origin of the website that is logging in
|
|
65
|
+
* @param referrer the path that initiated the login
|
|
66
|
+
* @param setCookie a callback that will be used to set oauth check values in cookies to be consumed by the redirect uri handler
|
|
67
|
+
* @returns the generated auth server url
|
|
68
|
+
*/
|
|
69
|
+
signup(redirectUriOrigin: string, referrer: string | null, setCookie: (name: string, value: string, opts: SerializeOptions & {
|
|
70
|
+
path: string;
|
|
71
|
+
}) => void): Promise<string>;
|
|
72
|
+
/**
|
|
73
|
+
* post to the oauth logout endpoint to destroy the oauth session (not the session stored in the cookies)
|
|
74
|
+
* @param fetch
|
|
75
|
+
*/
|
|
76
|
+
logout(fetch: (url: URL, body?: URLSearchParams) => Promise<Response>, session: Session): Promise<void>;
|
|
77
|
+
/**
|
|
78
|
+
* post to the oauth token endpoint to request a new set of tokens
|
|
79
|
+
* @param fetchRefreshedTokens
|
|
80
|
+
* @param refreshToken refreshToken as stored in session
|
|
81
|
+
* @returns fresh tokens
|
|
82
|
+
*/
|
|
83
|
+
refresh(fetchRefreshedTokens: (url: URL, body: {
|
|
84
|
+
client_id: string;
|
|
85
|
+
client_secret: string;
|
|
86
|
+
grant_type: "refresh_token";
|
|
87
|
+
refresh_token: string;
|
|
88
|
+
}) => Promise<Response>, refreshToken: string): Promise<TokenRequestResult>;
|
|
89
|
+
/**
|
|
90
|
+
* process the redirect from the oauth auth endpoint with a one time authorization code in url params
|
|
91
|
+
* @param url the url (with params such as code) that the auth server redirects to after user logs in (get from the request event on redirectUri)
|
|
92
|
+
* @param expectedState state stored in a cookie by this client at the start of the auth flow
|
|
93
|
+
* @returns one time authorization code to be used with the token endpoint
|
|
94
|
+
*/
|
|
95
|
+
processAuthResponse(url: URL, expectedState: string): {
|
|
96
|
+
code: string;
|
|
97
|
+
state: {
|
|
98
|
+
referrer?: string;
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* request a set of tokens from the oauth token endpoint using a one time authorization code
|
|
103
|
+
* @param fetchRequestToken callback that contains the fetch call
|
|
104
|
+
* @returns brand new tokens
|
|
105
|
+
*/
|
|
106
|
+
requestToken(fetchRequestToken: (url: URL, params: {
|
|
107
|
+
clientId: string;
|
|
108
|
+
clientSecret: string;
|
|
109
|
+
redirectUri: string;
|
|
110
|
+
}) => Promise<Response>): Promise<TokenRequestResult>;
|
|
111
|
+
};
|
|
112
|
+
type OAuthModule = ReturnType<typeof o>;
|
|
113
|
+
|
|
114
|
+
declare const r: (options: {
|
|
115
|
+
redirectUriPathname: string;
|
|
116
|
+
loginPathname: string;
|
|
117
|
+
signupPathname: string;
|
|
118
|
+
logoutPathname: string;
|
|
119
|
+
refreshPathname: string;
|
|
120
|
+
homePathname: string;
|
|
121
|
+
}) => {
|
|
122
|
+
redirectUri: {
|
|
123
|
+
pathname: string;
|
|
124
|
+
};
|
|
125
|
+
login: {
|
|
126
|
+
pathname: string;
|
|
127
|
+
};
|
|
128
|
+
signup: {
|
|
129
|
+
pathname: string;
|
|
130
|
+
};
|
|
131
|
+
logout: {
|
|
132
|
+
pathname: string;
|
|
133
|
+
};
|
|
134
|
+
refresh: {
|
|
135
|
+
pathname: string;
|
|
136
|
+
};
|
|
137
|
+
home: {
|
|
138
|
+
pathname: string;
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
type RoutesModule = ReturnType<typeof r>;
|
|
142
|
+
|
|
143
|
+
declare const s: <Session>(provider: Provider<Session>, options: {
|
|
144
|
+
sessionCookieName: string;
|
|
145
|
+
}) => {
|
|
146
|
+
/**
|
|
147
|
+
* create a session object from a set of tokens
|
|
148
|
+
* @param tokens
|
|
149
|
+
* @returns session to be stored in cookies
|
|
150
|
+
*/
|
|
151
|
+
create(tokens: TokenRequestResult): Session;
|
|
152
|
+
/**
|
|
153
|
+
* set the session object in cookies, splitting into chunks if too large
|
|
154
|
+
* @param cookies cookies from request event
|
|
155
|
+
* @param sessionCookieName
|
|
156
|
+
* @param session the session object to be set in cookies
|
|
157
|
+
*/
|
|
158
|
+
setCookie(set: (name: string, value: string, maxAge: number) => void, session: Session): void;
|
|
159
|
+
/**
|
|
160
|
+
* get the session object from cookies
|
|
161
|
+
* @param getAll call back for retrieving cookies
|
|
162
|
+
* @returns the session object stored in cookies or null if there is no session stored
|
|
163
|
+
*/
|
|
164
|
+
getCookie(getAll: () => {
|
|
165
|
+
name: string;
|
|
166
|
+
value: string;
|
|
167
|
+
}[]): Session | null;
|
|
168
|
+
/**
|
|
169
|
+
* expire the session object in cookies
|
|
170
|
+
* @param cookies cookies from request event
|
|
171
|
+
* @param sessionCookieName
|
|
172
|
+
*/
|
|
173
|
+
deleteCookie(getAll: () => {
|
|
174
|
+
name: string;
|
|
175
|
+
value: string;
|
|
176
|
+
}[], _delete: (name: string) => void): void;
|
|
177
|
+
};
|
|
178
|
+
type SessionModule<Session> = ReturnType<typeof s<Session>>;
|
|
179
|
+
|
|
180
|
+
type Cookie = {
|
|
181
|
+
name: string;
|
|
182
|
+
value: string;
|
|
183
|
+
options: SerializeOptions & {
|
|
184
|
+
path: string;
|
|
185
|
+
};
|
|
186
|
+
};
|
|
187
|
+
type Cookies = {
|
|
188
|
+
get: (name: string) => string | undefined;
|
|
189
|
+
delete: (name: string, opts: SerializeOptions & {
|
|
190
|
+
path: string;
|
|
191
|
+
}) => void;
|
|
192
|
+
};
|
|
193
|
+
type AuthOptions = {
|
|
194
|
+
/** defaults to `/auth` */
|
|
195
|
+
redirectUriPathname?: string;
|
|
196
|
+
/** defaults to `session` */
|
|
197
|
+
sessionCookieName?: string;
|
|
198
|
+
/** defaults to `/login` */
|
|
199
|
+
loginPathname?: string;
|
|
200
|
+
/** defaults to `/signup` */
|
|
201
|
+
signupPathname?: string;
|
|
202
|
+
/** defaults to `/logout` */
|
|
203
|
+
logoutPathname?: string;
|
|
204
|
+
/** defaults to `/refresh` */
|
|
205
|
+
refreshPathname?: string;
|
|
206
|
+
/** defaults to `/` */
|
|
207
|
+
homePathname?: string;
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
export { type AuthOptions, type ChecksModule, type Cookie, type Cookies, type OAuthModule, Provider, Resolver, type RoutesModule, type SessionModule, TokenRequestResult, c, localsResolver, loginResolver, logoutResolver, o, r, redirectUriResolver, refreshResolver, s, signupResolver };
|