teleport_pack
Pack secrets into AES-256-GCM encrypted bundles for secure sharing between machines using quantum teleportation mechanics.
Instructions
Pack secrets into an AES-256-GCM encrypted bundle for sharing between machines (quantum teleportation).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| keys | No | Specific keys to pack (all if omitted) | |
| passphrase | Yes | Encryption passphrase | |
| scope | No | Scope: global or project | |
| projectPath | No | Project root path for project-scoped secrets |
Implementation Reference
- src/core/teleport.ts:53-85 (handler)Core implementation of the teleportPack function which encrypts secret payloads.
export function teleportPack( secrets: { key: string; value: string; scope?: string }[], passphrase: string, ): string { const payload: TeleportPayload = { secrets, exportedAt: new Date().toISOString(), }; const plaintext = JSON.stringify(payload); const salt = randomBytes(SALT_LENGTH); const iv = randomBytes(IV_LENGTH); const key = deriveKey(passphrase, salt); const cipher = createCipheriv(ALGORITHM, key, iv); const encrypted = Buffer.concat([ cipher.update(plaintext, "utf8"), cipher.final(), ]); const tag = cipher.getAuthTag(); const bundle: TeleportBundle = { v: 1, data: encrypted.toString("base64"), salt: salt.toString("base64"), iv: iv.toString("base64"), tag: tag.toString("base64"), createdAt: new Date().toISOString(), count: secrets.length, }; return Buffer.from(JSON.stringify(bundle)).toString("base64"); } - src/mcp/server.ts:430-460 (registration)MCP tool registration for "teleport_pack".
server.tool( "teleport_pack", "Pack secrets into an AES-256-GCM encrypted bundle for sharing between machines (quantum teleportation).", { keys: z .array(z.string()) .optional() .describe("Specific keys to pack (all if omitted)"), passphrase: z.string().describe("Encryption passphrase"), scope: scopeSchema, projectPath: projectPathSchema, }, async (params) => { const o = opts(params); const entries = listSecrets(o); const secrets: { key: string; value: string; scope?: string }[] = []; for (const entry of entries) { if (params.keys && !params.keys.includes(entry.key)) continue; const value = getSecret(entry.key, { ...o, scope: entry.scope }); if (value !== null) { secrets.push({ key: entry.key, value, scope: entry.scope }); } } if (secrets.length === 0) return text("No secrets to pack", true); const bundle = teleportPack(secrets, params.passphrase); return text(bundle); }, ); - src/core/teleport.ts:23-38 (schema)Schema definitions for the Teleport bundle and payload structures.
export interface TeleportBundle { /** Format version */ v: 1; /** Base64-encoded encrypted payload */ data: string; /** Base64-encoded salt for key derivation */ salt: string; /** Base64-encoded initialization vector */ iv: string; /** Base64-encoded auth tag */ tag: string; /** ISO timestamp of creation */ createdAt: string; /** Number of secrets in the bundle */ count: number; }