UNPKG

1.28 kBTypeScriptView Raw
1import { GraphQLClient } from "./graphql";
2import { CommandIncoming, EventIncoming } from "./payload";
3export declare type CredentialResolver<T> = (graphClient: GraphQLClient, payload: CommandIncoming | EventIncoming) => Promise<T>;
4export interface GitHubCredential {
5 token: string;
6 scopes: string[];
7}
8export interface GitHubAppCredential {
9 token: string;
10 permissions: Record<string, "write" | "read">;
11}
12export declare function isGitHubCredential(spec: any): spec is GitHubCredential;
13export declare function isGitHubAppCredential(spec: any): spec is GitHubAppCredential;
14export declare function gitHubUserToken(): CredentialResolver<GitHubCredential>;
15export declare function gitHubAppToken(id: {
16 owner: string;
17 repo: string;
18 apiUrl?: string;
19} | string): CredentialResolver<GitHubAppCredential | GitHubCredential>;
20export interface CredentialProvider {
21 resolve<T>(spec: CredentialResolver<T>): Promise<T | undefined>;
22}
23export declare class DefaultCredentialProvider implements CredentialProvider {
24 private readonly graphClient;
25 private readonly payload;
26 constructor(graphClient: GraphQLClient, payload: CommandIncoming | EventIncoming);
27 resolve<T>(spec: CredentialResolver<T>): Promise<T>;
28}
29//# sourceMappingURL=secrets.d.ts.map
\No newline at end of file