@subnoto/api-client 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,11 @@
1
+ import type { SubnotoClient } from "../client.js";
2
+ export interface UploadDocumentOptions {
3
+ workspaceUuid: string;
4
+ fileBuffer: Buffer;
5
+ envelopeTitle: string;
6
+ }
7
+ export interface UploadDocumentResult {
8
+ envelopeUuid: string;
9
+ documentUuid: string;
10
+ }
11
+ export declare function uploadDocument(client: SubnotoClient, options: UploadDocumentOptions): Promise<UploadDocumentResult>;
@@ -0,0 +1,3 @@
1
+ import type { Middleware } from "openapi-fetch";
2
+ import type { ApiCredentials } from "../types.js";
3
+ export declare function createSignatureMiddleware(credentials: ApiCredentials): Middleware;
@@ -0,0 +1,3 @@
1
+ import type { Middleware } from "openapi-fetch";
2
+ import { SessionManager } from "../session.js";
3
+ export declare function createTunnelMiddleware(sessionManager: SessionManager): Middleware;
@@ -0,0 +1,18 @@
1
+ import type { SubnotoConfig } from "./types.js";
2
+ export declare class SessionManager {
3
+ private session;
4
+ private sessionId;
5
+ private config;
6
+ private handshakeInProgress;
7
+ private cookieJar;
8
+ constructor(config: SubnotoConfig);
9
+ ensureSession(): Promise<void>;
10
+ private handshake;
11
+ encryptRequest(plaintext: string | Buffer): Buffer;
12
+ decryptResponse(encrypted: Uint8Array | Buffer): Buffer;
13
+ getSessionId(): string | null;
14
+ getCookies(url: string): Promise<string>;
15
+ destroy(): void;
16
+ getAttestationResults(): string | null;
17
+ getAttestationStatus(): string | null;
18
+ }
package/src/types.d.ts ADDED
@@ -0,0 +1,16 @@
1
+ export interface ApiCredentials {
2
+ accessKey: string;
3
+ secretKey: string;
4
+ }
5
+ export interface SubnotoConfig {
6
+ apiBaseUrl: string;
7
+ accessKey: string;
8
+ secretKey: string;
9
+ unattested?: boolean;
10
+ attesterKey?: Buffer;
11
+ }
12
+ export declare class SubnotoError extends Error {
13
+ statusCode?: number | undefined;
14
+ code?: string | undefined;
15
+ constructor(message: string, statusCode?: number | undefined, code?: string | undefined);
16
+ }