@portone/server-sdk
Version:
PortOne JavaScript SDK for server-side usage
54 lines (53 loc) • 1.98 kB
TypeScript
import { AuthError } from "./AuthError.js";
import type { Unrecognized } from "./../../utils/unrecognized.js";
import { type PortOneClientInit } from "../../client.js";
import type { InvalidRequestError } from "../../generated/common/InvalidRequestError.js";
import type { LoginViaApiSecretResponse } from "../../generated/auth/LoginViaApiSecretResponse.js";
import type { RefreshTokenResponse } from "../../generated/auth/RefreshTokenResponse.js";
import type { UnauthorizedError } from "../../generated/common/UnauthorizedError.js";
/**
* 포트원 API 클라이언트를 생성합니다.
*/
export declare function AuthClient(init: PortOneClientInit): AuthClient;
export type AuthClient = {
/**
* API secret 를 사용한 토큰 발급
*
* API secret 를 통해 API 인증에 사용할 토큰을 가져옵니다.
*
* @throws {@link LoginViaApiSecretError}
*/
loginViaApiSecret: (options: {
/** 발급받은 API secret */
apiSecret: string;
}) => Promise<LoginViaApiSecretResponse>;
/**
* 토큰 갱신
*
* 리프레시 토큰을 사용해 유효기간이 연장된 새로운 토큰을 재발급합니다.
*
* @throws {@link RefreshTokenError}
*/
refreshToken: (options: {
/** 리프레시 토큰 */
refreshToken: string;
}) => Promise<RefreshTokenResponse>;
};
export declare class LoginViaApiSecretError extends AuthError {
readonly data: InvalidRequestError | UnauthorizedError | {
readonly type: Unrecognized;
};
/** @ignore */
constructor(data: InvalidRequestError | UnauthorizedError | {
readonly type: Unrecognized;
});
}
export declare class RefreshTokenError extends AuthError {
readonly data: InvalidRequestError | UnauthorizedError | {
readonly type: Unrecognized;
};
/** @ignore */
constructor(data: InvalidRequestError | UnauthorizedError | {
readonly type: Unrecognized;
});
}