UNPKG

1.72 kBTypeScriptView Raw
1import { IClient, IPaginator, PaginateArgs, PaginatorState, ResourceClientCreate, ResourceClientDelete, ResourceClientLoad, ResourceClientPaginate, Response, SSHKey } from '../definitions';
2import { ResourceClient } from './http';
3export declare const ERROR_SSH_MISSING_PRIVKEY = "SSH_MISSING_PRIVKEY";
4export declare const ERROR_SSH_INVALID_PUBKEY = "SSH_INVALID_PUBKEY";
5export declare const ERROR_SSH_INVALID_PRIVKEY = "SSH_INVALID_PRIVKEY";
6export declare function getGeneratedPrivateKeyPath(userId?: number): Promise<string>;
7export declare function parsePublicKeyFile(pubkeyPath: string): Promise<[string, string, string, string]>;
8/**
9 * @return Promise<[full pubkey, algorithm, public numbers, annotation]>
10 */
11export declare function parsePublicKey(pubkey: string): Promise<[string, string, string, string]>;
12export declare function validatePrivateKey(keyPath: string): Promise<void>;
13export interface SSHKeyClientDeps {
14 readonly client: IClient;
15 readonly token: string;
16 readonly user: {
17 id: number;
18 };
19}
20export interface SSHKeyCreateDetails {
21 pubkey: string;
22}
23export declare class SSHKeyClient extends ResourceClient implements ResourceClientLoad<SSHKey>, ResourceClientDelete, ResourceClientCreate<SSHKey, SSHKeyCreateDetails>, ResourceClientPaginate<SSHKey> {
24 protected client: IClient;
25 protected token: string;
26 protected user: {
27 id: number;
28 };
29 constructor({ client, token, user }: SSHKeyClientDeps);
30 create({ pubkey }: SSHKeyCreateDetails): Promise<SSHKey>;
31 load(id: string): Promise<SSHKey>;
32 delete(id: string): Promise<void>;
33 paginate(args?: Partial<PaginateArgs<Response<SSHKey[]>>>): IPaginator<Response<SSHKey[]>, PaginatorState>;
34}