signicat-client-ts
Version:
Community TypeScript client for Signicat Authentication REST API with automatic token management
36 lines (35 loc) • 1.28 kB
TypeScript
import type { EncryptionKey } from "../models/EncryptionKey";
/**
* Signicat Encryption Service
* Handles JWE encryption/decryption for Signicat API responses
*/
export declare class EncryptionService {
/**
* Generate a new RSA key pair for encryption
* @param keySize Key size in bits (2048 or 4096)
* @returns Promise containing public and private keys in JWK format
*/
static generateRSAKeyPair(keySize?: 2048 | 4096): Promise<{
publicKey: EncryptionKey;
privateKey: any;
}>;
/**
* Decrypt JWE response from Signicat
* @param jweToken The JWE token received from Signicat
* @param privateKey The private key in JWK format
* @returns Decrypted payload as JSON object
*/
static decryptJWE(jweToken: string, privateKey: any): Promise<any>;
/**
* Check if response is encrypted (JWE format)
* @param contentType The Content-Type header from the response
* @returns True if the response is encrypted
*/
static isEncryptedResponse(contentType: string): boolean;
/**
* Validate encryption key format
* @param key The encryption key to validate
* @returns True if the key is valid
*/
static validateEncryptionKey(key: EncryptionKey): boolean;
}