Crypto SDK
    Preparing search index...

    Class CryptoClient

    Typed HTTP client for the Crypto Service Suite v2 API.

    const client = new CryptoClient({ baseUrl: 'http://localhost:3000' });
    const { data } = await client.hash({ algorithm: 'sha256', data: 'hello' });
    console.log(data.digest);
    Index
    • Encrypt plaintext using AEAD (AES-GCM or XChaCha20-Poly1305).

      Parameters

      • params: { key: string; plaintext: string }

      Returns Promise<ApiResponse<AeadResult>>

    • Decrypt ciphertext and return the original plaintext.

      Parameters

      • params: { key: string; ciphertext: string }

      Returns Promise<ApiResponse<{ plaintext: string }>>

    • Derive a key from a password using a KDF algorithm.

      Parameters

      • params: {
            algorithm: string;
            password: string;
            salt?: string;
            keyLength?: number;
            params?: Record<string, unknown>;
        }

      Returns Promise<ApiResponse<KdfResult>>

    • Compute a message authentication code (HMAC or KMAC).

      Parameters

      • params: { algorithm: string; key: string; data: string }

      Returns Promise<ApiResponse<MacResult>>

    • Verify a message authentication code.

      Parameters

      • params: { algorithm: string; key: string; data: string; mac: string }

      Returns Promise<ApiResponse<{ valid: boolean }>>

    • Hash a password using Argon2.

      Parameters

      • params: {
            password: string;
            variant?: string;
            timeCost?: number;
            memoryCost?: number;
            parallelism?: number;
        }

      Returns Promise<ApiResponse<PasswordHashResult>>

    • Verify a password against a stored Argon2 hash.

      Parameters

      • params: {
            password: string;
            hash: string;
            salt: string;
            params: { t: number; m: number; p: number };
            variant?: string;
        }

      Returns Promise<ApiResponse<{ valid: boolean }>>

    • Verify a digital signature against a public key.

      Parameters

      • params: { publicKey: string; message: string; signature: string }

      Returns Promise<ApiResponse<VerifyResult>>

    • Decapsulate a shared secret using hybrid KEM.

      Parameters

      • params: {
            x25519PrivateKey: string;
            mlKemSecretKey: string;
            x25519EphemeralPublic: string;
            mlKemCiphertext: string;
        }

      Returns Promise<ApiResponse<{ sharedSecret: string; algorithm: string }>>

    • Verify an ML-DSA signature.

      Parameters

      • params: { level: 44 | 65 | 87; publicKey: string; message: string; signature: string }

      Returns Promise<ApiResponse<MlDsaVerifyResult>>

    • Verify an SLH-DSA signature.

      Parameters

      • params: { variant: string; publicKey: string; message: string; signature: string }

      Returns Promise<ApiResponse<SlhDsaVerifyResult>>

    • Open a secretbox sealed ciphertext.

      Parameters

      • params: { key: string; ciphertext: string; aad?: string }

      Returns Promise<ApiResponse<{ plaintext: string }>>

    • Open a sealed box ciphertext with the recipient's secret key.

      Parameters

      • params: { recipientSecretKey: string; sealed: string }

      Returns Promise<ApiResponse<{ plaintext: string }>>

    • Decrypt password-encrypted ciphertext.

      Parameters

      • params: { password: string; ciphertext: string }

      Returns Promise<ApiResponse<{ plaintext: string }>>

    • Wrap (encrypt) a key with a key-encryption key.

      Parameters

      • params: { kek: string; keyToWrap: string; algorithm?: "aes-kw" | "aes-kwp" }

      Returns Promise<ApiResponse<KeyWrapResult>>

    • Unwrap (decrypt) a wrapped key.

      Parameters

      • params: { kek: string; wrappedKey: string; algorithm?: "aes-kw" | "aes-kwp" }

      Returns Promise<ApiResponse<{ key: string }>>

    • List all supported algorithms by category.

      Returns Promise<ApiResponse<Record<string, string[]>>>

    • Check API server health.

      Returns Promise<{ statusCode: number }>