@capgo/cli
Version:
A CLI to upload to capgo servers
24 lines (23 loc) • 1.31 kB
TypeScript
import { Buffer } from 'node:buffer';
export declare function generateSessionKey(key: string): {
sessionKey: Buffer;
ivSessionKey: string;
};
export declare function encryptSource(source: Buffer, sessionKey: Buffer, ivSessionKey: string): Buffer;
export declare function decryptSource(source: Buffer, ivSessionKey: string, key: string): Buffer;
export declare function encryptChecksum(checksum: string, key: string): string;
export declare function encryptChecksumV3(checksum: string, key: string): string;
export declare function decryptChecksum(checksum: string, key: string): string;
export declare function decryptChecksumV3(checksum: string, key: string): string;
export type { RSAKeys } from '../schemas/crypto';
type RSAKeys = import('../schemas/crypto').RSAKeys;
export declare function createRSA(): RSAKeys;
/**
* Calculate the key ID from a public key
* Shows the first 20 characters of base64-encoded key body for easy visual verification
* Note: First 12 characters (MIIBCgKCAQEA) are always the same for 2048-bit RSA PKCS#1 keys,
* but we show all of them so users can easily match with their key file
* @param publicKey - RSA public key in PEM format
* @returns 20-character key ID or empty string if key is invalid
*/
export declare function calcKeyId(publicKey: string): string;