Skip to main content
Glama
encrypt.js897 B
import { FlattenedEncrypt } from '../flattened/encrypt.js'; export class CompactEncrypt { #flattened; constructor(plaintext) { this.#flattened = new FlattenedEncrypt(plaintext); } setContentEncryptionKey(cek) { this.#flattened.setContentEncryptionKey(cek); return this; } setInitializationVector(iv) { this.#flattened.setInitializationVector(iv); return this; } setProtectedHeader(protectedHeader) { this.#flattened.setProtectedHeader(protectedHeader); return this; } setKeyManagementParameters(parameters) { this.#flattened.setKeyManagementParameters(parameters); return this; } async encrypt(key, options) { const jwe = await this.#flattened.encrypt(key, options); return [jwe.protected, jwe.encrypted_key, jwe.iv, jwe.ciphertext, jwe.tag].join('.'); } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Valerio357/bet-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server