@opentdf/sdk
    Preparing search index...

    Class OpenTDF

    The main OpenTDF class that provides methods for creating and reading TDF files. It supports both NanoTDF and ZTDF formats. It can be used to create new TDF files and read existing ones. This class is the entry point for using the OpenTDF SDK. It requires an authentication provider to be passed in the constructor. It also requires a platform URL to be set, which is used to fetch key access servers and policies.

    import { type Chunker, OpenTDF } from '@opentdf/sdk';

    const oidcCredentials: RefreshTokenCredentials = {
    clientId: keycloakClientId,
    exchange: 'refresh',
    refreshToken: refreshToken,
    oidcOrigin: keycloakUrl,
    };
    const authProvider = await AuthProviders.refreshAuthProvider(oidcCredentials);

    const client = new OpenTDF({
    authProvider,
    platformUrl: 'https://platform.example.com',
    });

    const cipherText = await client.createZTDF({
    source: { type: 'stream', location: source },
    autoconfigure: false,
    });

    const clearText = await client.read({ type: 'stream', location: cipherText });
    Index

    Constructors

    Properties

    authProvider: AuthProvider

    The auth provider for the OpenTDF instance.

    defaultCreateOptions: Omit<CreateOptions, "source">

    Default options for creating TDF objects.

    defaultReadOptions: Omit<ReadOptions, "source">

    Default options for reading TDF objects.

    dpopEnabled: boolean

    If DPoP is enabled for this instance.

    dpopKeys: Promise<CryptoKeyPair>

    The DPoP keys for this instance, if any.

    platformUrl: string

    The platform URL

    policyEndpoint: string

    The policy service endpoint

    tdf3Client: TDF3Client

    The TDF3 client for encrypting and decrypting ZTDF files.

    Methods

    • Closes the OpenTDF instance and releases any resources.

      Returns void