@nstudio/nativescript-auth0
Version:
Auth0 for NativeScript
133 lines (132 loc) • 3.91 kB
TypeScript
export declare class Credentials {
static fromNative(credentials: NSCAuth0Credentials): Credentials;
private credentials;
constructor(info?: {
accessToken?: string;
tokenType?: string;
idToken?: string;
refreshToken?: string;
expiresIn?: Date;
scope?: string;
recoveryCode: string;
});
get native(): NSCAuth0Credentials;
get accessToken(): string;
get expiresIn(): Date;
get idToken(): string;
get recoveryCode(): string;
get refreshToken(): string;
get scope(): string;
get tokenType(): string;
toJSON(): {
accessToken: string;
expiresIn: Date;
idToken: string;
recoveryCode: string;
refreshToken: string;
scope: string;
tokenType: string;
};
}
export declare class CredentialsManager {
static fromNative(manager: NSCAuth0CredentialsManager): CredentialsManager;
private credentialsManager;
get native(): NSCAuth0CredentialsManager;
clear(): void;
credentials(scope?: string, minTtl?: number, parameters?: Record<string, any>, forceRefresh?: boolean): Promise<Credentials>;
store(credentials: Credentials): void;
hasValidCredentials(minTtl?: number): boolean;
}
export declare class WebAuth {
static fromNative(auth: NSCAuth0WebAuth): WebAuth;
get native(): NSCAuth0WebAuth;
private webAuth;
useHTTPS(): this;
start(options?: {
scheme?: string;
scope?: string;
audience?: string;
redirectUrl?: string;
}): Promise<Credentials>;
clear(): Promise<void>;
}
export declare class JWT {
static fromNative(jwt: NSCAuth0DecodedJWT): JWT;
private jwt;
get native(): NSCAuth0DecodedJWT;
get identifier(): string;
get subject(): string;
get issuer(): string;
get audience(): any;
get issuedAt(): Date;
get expiresAt(): Date;
get notBefore(): Date;
get body(): any;
toJSON(): {
identifier: string;
subject: string;
issuer: string;
audience: any;
issuedAt: Date;
expiresAt: Date;
notBefore: Date;
body: any;
};
}
export declare function decodeJWT(token: string): JWT;
export declare class UserInfo {
static fromNative(userInfo: NSCAuth0UserInfo): UserInfo;
private userInfo;
get native(): NSCAuth0UserInfo;
get address(): any;
get birthdate(): string;
get customClaims(): Record<string, any>;
get email(): string;
get emailVerified(): boolean;
get familyName(): string;
get gender(): string;
get givenName(): string;
get locale(): string;
get middleName(): string;
get name(): string;
get nickname(): string;
get phoneNumber(): string;
get phoneNumberVerified(): boolean;
get picture(): string | null;
get preferredUsername(): string;
get profile(): string | null;
get sub(): string;
get updatedAt(): Date;
get website(): string | null;
get zoneinfo(): string;
}
export declare class Authentication {
static fromNative(auth: NSCAuth0Authentication): Authentication;
private authentication;
get native(): NSCAuth0Authentication;
userInfo(options: {
accessToken: string;
headers?: Record<string, string>;
}): Promise<UserInfo>;
refreshToken(options: {
refreshToken: string;
audience?: string;
scope?: string;
headers?: Record<string, string>;
}): Promise<Credentials>;
revoke(options: {
refreshToken: string;
headers?: Record<string, string>;
}): Promise<void>;
}
export declare class Auth0 {
readonly clientId: string;
readonly domain: string;
readonly webAuth: WebAuth;
readonly auth: Authentication;
readonly credentialsManager: CredentialsManager;
constructor(options: {
clientId: string;
domain: string;
});
}