@@ -128,12 +128,16 @@ export type AccessTokenDbColumns = {
128128}
129129
130130/**
131- * Access token providers are used verify an access token
132- * during authentication
131+ * Access token providers are used to verify an access token
132+ * during authentication and manage token lifecycle
133133 */
134134export interface AccessTokensProviderContract < Tokenable extends LucidModel > {
135135 /**
136136 * Create a token for a given user
137+ *
138+ * @param user - The user instance to create a token for
139+ * @param abilities - Optional array of abilities the token should have
140+ * @param options - Optional token configuration including name and expiration
137141 */
138142 create (
139143 user : InstanceType < Tokenable > ,
@@ -147,11 +151,15 @@ export interface AccessTokensProviderContract<Tokenable extends LucidModel> {
147151 /**
148152 * Verifies a publicly shared access token and returns an
149153 * access token for it.
154+ *
155+ * @param tokenValue - The token value to verify
150156 */
151157 verify ( tokenValue : Secret < string > ) : Promise < AccessToken | null >
152158
153159 /**
154160 * Invalidates a token identified by its publicly shared token
161+ *
162+ * @param tokenValue - The token value to invalidate
155163 */
156164 invalidate ( tokenValue : Secret < string > ) : Promise < boolean >
157165}
@@ -182,11 +190,18 @@ export type AccessTokensLucidUserProviderOptions<
182190 * and the guard.
183191 *
184192 * The guard is user provider agnostic and therefore it
185- * needs a adapter to known some basic info about the
193+ * needs an adapter to know some basic info about the
186194 * user.
187195 */
188196export type AccessTokensGuardUser < RealUser > = {
197+ /**
198+ * Get the unique identifier for the user
199+ */
189200 getId ( ) : string | number | BigInt
201+
202+ /**
203+ * Get the original user object from the provider
204+ */
190205 getOriginal ( ) : RealUser
191206}
192207
@@ -200,11 +215,17 @@ export interface AccessTokensUserProviderContract<RealUser> {
200215 /**
201216 * Create a user object that acts as an adapter between
202217 * the guard and real user value.
218+ *
219+ * @param user - The real user object from the provider
203220 */
204221 createUserForGuard ( user : RealUser ) : Promise < AccessTokensGuardUser < RealUser > >
205222
206223 /**
207224 * Create a token for a given user
225+ *
226+ * @param user - The user to create a token for
227+ * @param abilities - Optional array of abilities the token should have
228+ * @param options - Optional token configuration including name and expiration
208229 */
209230 createToken (
210231 user : RealUser ,
@@ -217,16 +238,22 @@ export interface AccessTokensUserProviderContract<RealUser> {
217238
218239 /**
219240 * Invalidates a token identified by its publicly shared token.
241+ *
242+ * @param tokenValue - The token value to invalidate
220243 */
221244 invalidateToken ( tokenValue : Secret < string > ) : Promise < boolean >
222245
223246 /**
224247 * Find a user by the user id.
248+ *
249+ * @param identifier - The unique identifier of the user
225250 */
226251 findById ( identifier : string | number | BigInt ) : Promise < AccessTokensGuardUser < RealUser > | null >
227252
228253 /**
229254 * Verify a token by its publicly shared value.
255+ *
256+ * @param tokenValue - The token value to verify
230257 */
231258 verifyToken ( tokenValue : Secret < string > ) : Promise < AccessToken | null >
232259}
0 commit comments