1.3.0 • Published 4 months ago

@opentdf/client v1.3.0

Weekly downloads
-
License
BSD-3-Clause-Clea...
Repository
github
Last release
4 months ago

An OpenTDF Library for Browsers and NodeJS Clients

This project packages a set of javascript modules that can write and read a variety of OpenTDF data formats, including NanoTDF, Dataset TDF, and the TDF3 with JSON envelopes.

Usage

NanoTDF

  const oidcCredentials: RefreshTokenCredentials = {
    clientId: keycloakClientId,
    exchange: 'refresh',
    refreshToken: refreshToken,
    oidcOrigin: keycloakUrl,
  }
  const authProvider = await AuthProviders.refreshAuthProvider(oidcCredentials);
  const client = new NanoTDFClient(authProvider, access);
  const cipherText = await client.encrypt(plainText);
  const clearText = await client.decrypt(cipherText);

TDF3

  const client = new TDF3Client({
    clientId: "tdf-client",
    kasEndpoint: 'http://localhost/kas',
    refreshToken: 'token', // Here is only difference in usage, browser build needs oidc tocken
    oidcOrigin: 'http://localhost/oidc',
  });
  const source = new ReadableStream({
    pull(controller) {
      controller.enqueue(new TextEncoder().encode(string));
      controller.close();
    },
  });
  const ciphertextStream = await client.encrypt({ offline: true, source });
  // Optionally: Save ciphertextStream to file or remote here.
  // For demo purposes, we pipe to decrypt.
  const plaintextStream = await client.decrypt({
    source: { type: 'stream', location: ciphertextStream }
  });
  const plaintext = await plaintextStream.toString(); // could be also ct.toFile('img.jpg');
  console.log(`deciphered text :${plaintext}`);

Examples

Review examples to see how to integrate. See Examples

2.0.0-beta.1204

4 months ago

2.0.0-beta.1202

5 months ago

1.2.0

10 months ago

1.1.0

10 months ago

2.0.0-beta.1165

7 months ago

2.0.0-beta.1168

7 months ago

1.3.0

9 months ago

1.2.1

9 months ago

1.2.0-beta.1000

10 months ago

1.3.0-beta.1069

9 months ago

1.2.1-beta.1016

10 months ago

2.0.0-beta.1150

7 months ago

2.0.0-beta.1096

8 months ago

1.1.0-beta.977

10 months ago

2.0.0-beta.1131

7 months ago

1.0.1-beta.925

10 months ago

2.0.0-beta.1179

6 months ago

1.3.1-beta.1080

9 months ago

1.3.0-beta.1073

9 months ago

1.2.0-beta.998

10 months ago

1.2.1-beta.1041

9 months ago

1.2.1-beta.1025

10 months ago

1.3.0-rc.1074

9 months ago

1.2.1-beta.1028

10 months ago

0.5.0-beta.786

12 months ago

1.0.0

11 months ago

1.0.0-rc.889

11 months ago

0.4.0-beta.784

12 months ago

0.5.0-rc.819

11 months ago

0.5.0-beta.791

12 months ago

0.5.0-beta.813

12 months ago

0.4.0-beta.739

1 year ago

0.4.0-beta.715

1 year ago

0.4.0-beta.765

1 year ago

0.4.0-beta.721

1 year ago

0.4.0-beta.654

1 year ago

0.4.0-beta.772

1 year ago

0.4.0-beta.661

1 year ago

0.4.0-beta.644

1 year ago

0.4.0-beta.607

1 year ago

0.4.0-beta.636

1 year ago

0.4.0-beta.501

1 year ago

0.4.0-beta.552

1 year ago

0.4.0-beta.540

1 year ago

0.3.0-beta.374

2 years ago

0.3.0-beta.364

2 years ago

0.3.0-beta.359

2 years ago