diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 00000000..196708f9 --- /dev/null +++ b/index.d.ts @@ -0,0 +1,44 @@ +export interface BaseAuthConfiguration { + issuer: string; + clientId: string; +} +export interface AuthConfiguration extends BaseAuthConfiguration { + scopes: string[]; + redirectUrl: string; + additionalParameters?: { [name: string]: string }; +} + +export interface RevokeConfiguration { + clientId: string; + issuer: string; +} + +export interface AuthorizeResult { + accessToken: string; + accessTokenExpirationDate: string; + additionalParameters?: { [name: string]: string }; + idToken: string; + refreshToken: string; + tokenType: string; +} + +export interface RevokeConfiguration { + tokenToRevoke: string; + sendClientId?: boolean; +} + +export interface RefreshConfiguration { + refreshToken: string; +} + +export function authorize(config: AuthConfiguration): Promise; + +export function refresh( + config: AuthConfiguration, + refreshConfig: RefreshConfiguration +): Promise; + +export function revoke( + config: BaseAuthConfiguration, + revokeConfig: RevokeConfiguration +): Promise; diff --git a/package.json b/package.json index b97954e2..7b5115c8 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "version": "2.0.0", "description": "React Native bridge for AppAuth for supporting any OAuth 2 provider", "main": "index.js", + "types": "index.d.ts", "scripts": { "test": "jest", "lint": "eslint .", @@ -12,6 +13,10 @@ "*.js": [ "eslint --fix", "git add" + ], + "*.ts": [ + "prettier --write", + "git add" ] }, "files": [