diff --git a/types/passport-kakao/index.d.ts b/types/passport-kakao/index.d.ts new file mode 100644 index 0000000000..d99f608ab7 --- /dev/null +++ b/types/passport-kakao/index.d.ts @@ -0,0 +1,35 @@ +// Type definitions for passport-kakao 0.1 +// Project: https://github.com/rotoshine/passport-kakao +// Definitions by: Park9eon +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import passport = require("passport"); +import express = require("express"); + +export interface Profile extends passport.Profile { + id: string; + provider: string; + + _raw: string; + _json: any; +} + +export interface StrategyOption { + clientID: string; + clientSecret: string; + callbackURL: string; + + scopeSeparator?: string; + customHeaders?: string; +} + +export type VerifyFunction = + (accessToken: string, refreshToken: string, profile: Profile, done: (error: any, user?: any, info?: any) => void) => void; + +export class Strategy implements passport.Strategy { + constructor(options: StrategyOption, verify: VerifyFunction); + + authenticate: (req: express.Request, options?: any) => void; + userProfile: (accessToken: string, done: (error: any, user?: any) => void) => void; +} diff --git a/types/passport-kakao/passport-kakao-tests.ts b/types/passport-kakao/passport-kakao-tests.ts new file mode 100644 index 0000000000..595404cc5b --- /dev/null +++ b/types/passport-kakao/passport-kakao-tests.ts @@ -0,0 +1,10 @@ +import {Strategy as KakaoStrategy } from 'passport-kakao'; + +new KakaoStrategy({ + clientID: 'client', + clientSecret: 'clientSecret', + callbackURL: 'callbackUrl' + }, + (accessToken: string, refreshToken: string, profile: any, done: any) => { + // signUp or signIn + }); diff --git a/types/passport-kakao/tsconfig.json b/types/passport-kakao/tsconfig.json new file mode 100644 index 0000000000..784cbe32e8 --- /dev/null +++ b/types/passport-kakao/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "passport-kakao-tests.ts" + ] +} diff --git a/types/passport-kakao/tslint.json b/types/passport-kakao/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/passport-kakao/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file diff --git a/types/passport-naver/index.d.ts b/types/passport-naver/index.d.ts new file mode 100644 index 0000000000..75c21b76ed --- /dev/null +++ b/types/passport-naver/index.d.ts @@ -0,0 +1,46 @@ +// Type definitions for passport-naver 0.1 +// Project: https://github.com/naver/passport-naver +// Definitions by: Park9eon +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import passport = require("passport"); +import express = require("express"); + +export interface Profile extends passport.Profile { + id: string; + provider: string; + + _json: { + email: string, + nickname: string, + profile_image: string, + age: number, + birthday: any + id: string + }; +} + +export interface StrategyOption { + clientID: string; + clientSecret: string; + callbackURL: string; + + svcType?: number; + authType?: string; + + authorizationURL?: string; + tokenURL?: string; + profileURL?: string; +} + +export type VerifyFunction = + (accessToken: string, refreshToken: string, profile: Profile, done: (error: any, user?: any, info?: any) => void) => void; + +export class Strategy implements passport.Strategy { + constructor(options: StrategyOption, verify: VerifyFunction); + + authenticate: (req: express.Request, options?: any) => void; + authorizationParams: (options: any) => any; + userProfile: (accessToken: string, done: (error: any, user?: any) => void) => void; +} diff --git a/types/passport-naver/passport-naver-tests.ts b/types/passport-naver/passport-naver-tests.ts new file mode 100644 index 0000000000..72e76d32e7 --- /dev/null +++ b/types/passport-naver/passport-naver-tests.ts @@ -0,0 +1,10 @@ +import {Strategy as NaverStrategy } from 'passport-naver'; + +new NaverStrategy({ + clientID: 'client', + clientSecret: 'clientSecret', + callbackURL: 'callbackUrl' + }, + (accessToken: string, refreshToken: string, profile: any, done: any) => { + // signUp or signIn + }); diff --git a/types/passport-naver/tsconfig.json b/types/passport-naver/tsconfig.json new file mode 100644 index 0000000000..1a8826dcfd --- /dev/null +++ b/types/passport-naver/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "passport-naver-tests.ts" + ] +} diff --git a/types/passport-naver/tslint.json b/types/passport-naver/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/passport-naver/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file