Skip to content

Interface: UserProvider ​

Used to type the socket.data.user attribute with the correct user provider. This interface is exposed to allow type augmentation.

Extends ​

  • AccessTokensUserProviderContract<unknown>

Properties ​

PropertyTypeInherited from
[PROVIDER_REAL_USER]unknownAccessTokensUserProviderContract.[PROVIDER_REAL_USER]

Methods ​

createToken() ​

ts
createToken(
   user: unknown,
   abilities?: string[],
   options?: {
  expiresIn: string | number;
  name: string;
}): Promise<AccessToken>;

Create a token for a given user

Parameters ​

ParameterType
userunknown
abilities?string[]
options?{ expiresIn: string | number; name: string; }
options.expiresIn?string | number
options.name?string

Returns ​

Promise<AccessToken>

Inherited from ​

ts
AccessTokensUserProviderContract.createToken;

createUserForGuard() ​

ts
createUserForGuard(user: unknown): Promise<AccessTokensGuardUser<unknown>>;

Create a user object that acts as an adapter between the guard and real user value.

Parameters ​

ParameterType
userunknown

Returns ​

Promise<AccessTokensGuardUser<unknown>>

Inherited from ​

ts
AccessTokensUserProviderContract.createUserForGuard;

findById() ​

ts
findById(identifier: string | number | BigInt): Promise<null | AccessTokensGuardUser<unknown>>;

Find a user by the user id.

Parameters ​

ParameterType
identifierstring | number | BigInt

Returns ​

Promise<null | AccessTokensGuardUser<unknown>>

Inherited from ​

ts
AccessTokensUserProviderContract.findById;

invalidateToken() ​

ts
invalidateToken(tokenValue: Secret<string>): Promise<boolean>;

Invalidates a token identified by its publicly shared token.

Parameters ​

ParameterType
tokenValueSecret<string>

Returns ​

Promise<boolean>

Inherited from ​

ts
AccessTokensUserProviderContract.invalidateToken;

verifyToken() ​

ts
verifyToken(tokenValue: Secret<string>): Promise<null | AccessToken>;

Verify a token by its publicly shared value.

Parameters ​

ParameterType
tokenValueSecret<string>

Returns ​

Promise<null | AccessToken>

Inherited from ​

ts
AccessTokensUserProviderContract.verifyToken;