### Install OpenTDF SDKs Source: https://opentdf.io Installation commands for the TypeScript, Go, and Java SDKs. ```bash npm install @opentdf/sdk ``` ```bash go get github.com/opentdf/platform/sdk ``` ```gradle implementation 'io.opentdf.platform:sdk:' ``` -------------------------------- ### Encrypt and Decrypt Data with OpenTDF SDK Source: https://opentdf.io Demonstrates initializing the OpenTDF client, encrypting data with attribute-based policies, and reading the encrypted content. ```typescript import { OpenTDF } from '@opentdf/sdk'; // Connect to the platform const client = new OpenTDF({ authProvider, platformUrl: 'https://platform.example.com', }); // Encrypt with attribute-based policy const encrypted = await client.createTDF({ source: { type: 'buffer', location: new TextEncoder().encode('Hello, OpenTDF!') }, attributes: ['https://example.com/attr/classification/value/secret'], }); // Only entities whose entitlements satisfy // the policy will be able to decrypt. const decrypted = await client.read({ source: { type: 'stream', location: encrypted }, }); console.log(await new Response(decrypted).text()); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.