@adonisjs/auth
Version:
Official authentication provider for Adonis framework
47 lines (46 loc) • 1.28 kB
TypeScript
import { DateTime } from 'luxon';
import { OpaqueTokenContract } from '@ioc:Adonis/Addons/Auth';
/**
* Opaque token represents a persisted token generated for a given user
*
* Calling `opaqueToken.toJSON()` will give you an object, that you can send back
* as response to share the token with the client.
*/
export declare class OpaqueToken implements OpaqueTokenContract<any> {
name: string;
token: string;
user: any;
/**
* The type of the token. Always set to bearer
*/
type: "bearer";
/**
* The datetime in which the token will expire
*/
expiresAt?: DateTime;
/**
* Time left until token gets expired
*/
expiresIn?: number;
/**
* Any meta data attached to the token
*/
meta: any;
/**
* Hash of the token saved inside the database. Make sure to never share
* this with the client
*/
tokenHash: string;
constructor(name: string, // Name associated with the token
token: string, // The raw token value. Only available for the first time
user: any);
/**
* Shareable version of the token
*/
toJSON(): {
expires_in?: number | undefined;
expires_at?: string | undefined;
type: "bearer";
token: string;
};
}