oauth2-server-grant-type-apple
Version:
Apple grant type for @node-oauth/oauth2-server
45 lines (44 loc) • 1.57 kB
text/typescript
import * as _$_node_oauth_oauth2_server0 from "@node-oauth/oauth2-server";
import { AbstractGrantType, AuthorizationCodeModel, Client, ClientCredentialsModel, ExtensionModel, PasswordModel, RefreshTokenModel, Request, Token, TokenOptions, User } from "@node-oauth/oauth2-server";
//#region src/types.d.ts
type Oauth2ServerModel = AuthorizationCodeModel | ClientCredentialsModel | RefreshTokenModel | PasswordModel | ExtensionModel;
type AppleTokenData = {
sub: string;
aud: string;
email?: string;
email_verified?: boolean | string;
is_private_email?: boolean | string;
name?: string;
[key: string]: unknown;
};
type Model = Oauth2ServerModel & {
appleGrantType: {
appId: string | string[];
};
getUserWithApple: (data: AppleTokenData) => Promise<User>;
};
//#endregion
//#region src/apple-grant-type.d.ts
interface Options extends TokenOptions {
model: Model;
}
declare class AppleGrantType extends AbstractGrantType {
model: Model;
appIds: string[];
constructor(options: Options);
handle(request: Request, client: Client): Promise<Token | _$_node_oauth_oauth2_server0.Falsey>;
getUser(request: Request): Promise<User>;
saveToken(user: User, client: Client, scope: string[]): Promise<Token | _$_node_oauth_oauth2_server0.Falsey>;
}
//#endregion
//#region src/verify-token.d.ts
declare const verifyToken: ({
token,
audience
}: {
token: string;
audience?: string | string[];
}) => Promise<AppleTokenData>;
//#endregion
export { AppleGrantType, AppleTokenData, Model, Options, verifyToken };
//# sourceMappingURL=index.d.cts.map