@cactive/id
Version:
Interaction with the ID system.
51 lines (50 loc) • 1.57 kB
TypeScript
import { User } from './types';
declare type ConnectionOpts = {
base_url: string;
verbose: boolean;
};
declare class Connections {
private _token;
private _options;
constructor(token: string, options?: Partial<ConnectionOpts>);
private $;
/**
* Fetches a refresh token based on Identification token from an OAuth gateway
* @param identifier_token Identifier token provided by the oauth gateway
* @param client_id Project Client Id
* @param client_secret Project Client Secret
* @param redirect_uri Used Redirect URI
* @param scopes Used Scopes
* @returns Refresh token
*/
oauthIdentify(identifier_token: string, client_id: string, client_secret: string, redirect_uri: string, scopes: number[]): Promise<{
refresh: string;
access: string;
}>;
/**
* Creates an Access Token from a Refresh Token
* @param refresh_token Refresh token
* @returns Access token
*/
refreshToken(refresh_token: string): Promise<string>;
/**
* Fetches a user by an Access Token
* @param access_token Access token
* @returns User
*/
getUserByAccessToken(access_token: string): Promise<Partial<{
id: string;
name: string;
email: string;
connections: {
permissions: number;
}[];
}>>;
/**
* Fetches a User by their ID
* @param id User ID
* @returns User
*/
getUser(id: string): Promise<User>;
}
export default Connections;