@virtru/dsp-sdk 0.1.10-pr604.7ef7a158

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/.prettierrc +3 -0
  2. package/.rush/temp/operation/_phase_build/state.json +3 -0
  3. package/.rush/temp/package-deps__phase_build.json +41 -0
  4. package/.rush/temp/shrinkwrap-deps.json +329 -0
  5. package/CHANGELOG.json +103 -0
  6. package/CHANGELOG.md +53 -0
  7. package/README.md +98 -0
  8. package/dist/src/gen/buf/validate/validate_pb.d.ts +4517 -0
  9. package/dist/src/gen/buf/validate/validate_pb.js +484 -0
  10. package/dist/src/gen/config/v1/config_pb.d.ts +88 -0
  11. package/dist/src/gen/config/v1/config_pb.js +46 -0
  12. package/dist/src/gen/config/v1/meta_pb.d.ts +37 -0
  13. package/dist/src/gen/config/v1/meta_pb.js +33 -0
  14. package/dist/src/gen/config/v1/tagging_pb.d.ts +264 -0
  15. package/dist/src/gen/config/v1/tagging_pb.js +188 -0
  16. package/dist/src/gen/google/api/annotations_pb.d.ts +13 -0
  17. package/dist/src/gen/google/api/annotations_pb.js +30 -0
  18. package/dist/src/gen/google/api/http_pb.d.ts +440 -0
  19. package/dist/src/gen/google/api/http_pb.js +41 -0
  20. package/dist/src/gen/policyimportexport/v1/policy_import_export_pb.d.ts +241 -0
  21. package/dist/src/gen/policyimportexport/v1/policy_import_export_pb.js +89 -0
  22. package/dist/src/gen/shared/v1/shared_pb.d.ts +172 -0
  23. package/dist/src/gen/shared/v1/shared_pb.js +92 -0
  24. package/dist/src/gen/tagging/pdp/v2/tagging_pb.d.ts +872 -0
  25. package/dist/src/gen/tagging/pdp/v2/tagging_pb.js +274 -0
  26. package/dist/src/gen/version/v1/version_pb.d.ts +96 -0
  27. package/dist/src/gen/version/v1/version_pb.js +37 -0
  28. package/dist/src/index.d.ts +21 -0
  29. package/dist/src/index.js +28 -0
  30. package/dist/src/lib/client.d.ts +33 -0
  31. package/dist/src/lib/client.js +60 -0
  32. package/dist/src/lib/dsp.d.ts +18 -0
  33. package/dist/src/lib/dsp.js +44 -0
  34. package/dist/src/lib/utils.d.ts +15 -0
  35. package/dist/src/lib/utils.js +35 -0
  36. package/dist/tests/dsp-client.test.d.ts +1 -0
  37. package/dist/tests/dsp-client.test.js +49 -0
  38. package/dist/tests/dsp.test.d.ts +1 -0
  39. package/dist/tests/dsp.test.js +71 -0
  40. package/dist/tests/mocks/create-export-artifacts.d.ts +2 -0
  41. package/dist/tests/mocks/create-export-artifacts.js +13 -0
  42. package/dist/tests/mocks/tagging-pdp-tag.d.ts +2 -0
  43. package/dist/tests/mocks/tagging-pdp-tag.js +11 -0
  44. package/dist/tests/mocks/well-known-configuration.d.ts +2 -0
  45. package/dist/tests/mocks/well-known-configuration.js +12 -0
  46. package/dist/tests/setup-msw.d.ts +9 -0
  47. package/dist/tests/setup-msw.js +30 -0
  48. package/eslint.config.mjs +28 -0
  49. package/package.json +47 -0
  50. package/src/gen/buf/validate/validate_pb.ts +4879 -0
  51. package/src/gen/config/formatters/testdata/v1/test_pb.ts +287 -0
  52. package/src/gen/config/v1/config_pb.ts +137 -0
  53. package/src/gen/config/v1/meta_pb.ts +72 -0
  54. package/src/gen/config/v1/tagging_pb.ts +355 -0
  55. package/src/gen/google/api/annotations_pb.ts +43 -0
  56. package/src/gen/google/api/http_pb.ts +486 -0
  57. package/src/gen/helloworld/v1/helloworld_pb.ts +98 -0
  58. package/src/gen/policyimportexport/v1/policy_import_export_pb.ts +324 -0
  59. package/src/gen/shared/v1/shared_pb.ts +240 -0
  60. package/src/gen/shared/v2/shared_pb.ts +122 -0
  61. package/src/gen/tagging/pdp/v2/externalprocessors/processor_pb.ts +709 -0
  62. package/src/gen/tagging/pdp/v2/stanag/stanag_pb.ts +953 -0
  63. package/src/gen/tagging/pdp/v2/tagging_pb.ts +1064 -0
  64. package/src/gen/version/v1/version_pb.ts +143 -0
  65. package/src/index.ts +49 -0
  66. package/src/lib/client.ts +83 -0
  67. package/src/lib/dsp.ts +65 -0
  68. package/src/lib/utils.ts +43 -0
  69. package/src/vite-env.d.ts +7 -0
  70. package/tests/dsp-client.test.ts +67 -0
  71. package/tests/dsp.test.ts +95 -0
  72. package/tests/mocks/create-export-artifacts.ts +16 -0
  73. package/tests/mocks/tagging-pdp-tag.ts +13 -0
  74. package/tests/mocks/well-known-configuration.ts +15 -0
  75. package/tests/setup-msw.ts +35 -0
  76. package/tsconfig.json +32 -0
  77. package/vitest.config.ts +42 -0
package/README.md ADDED
@@ -0,0 +1,98 @@
1
+ # DSP Web SDK
2
+
3
+ The DSP Web SDK enables integration with the Virtru Data Security Platform (DSP).
4
+ It provides tools for encrypting and decrypting TDF (Trusted Data Format) content, as well as managing Attribute-Based Access Control (ABAC) operations.
5
+
6
+ ## Overview
7
+ The DSP Web SDK is designed to help developers secure sensitive data in web applications by leveraging the Trusted Data Format (TDF) and Attribute-Based Access Control (ABAC). Key features include:
8
+ - Easy encryption and decryption of data using TDF.
9
+ - Fine-grained access control with ABAC policies.
10
+ - Seamless integration with DSP services for key management and policy enforcement.
11
+ - Support for modern web frameworks and environments.
12
+
13
+ ## Table of Contents
14
+ - [DSP Web SDK](#dsp-web-sdk)
15
+ - [Overview](#overview)
16
+ - [Table of Contents](#table-of-contents)
17
+ - [Installation](#installation)
18
+ - [Usage](#usage)
19
+ - [Testing](#testing)
20
+ - [Linting](#linting)
21
+
22
+ ## Installation
23
+ Install the SDK using your preferred package manager. This will add the SDK as a dependency to your project, making its APIs available for import.
24
+
25
+ > **Note:** The package name is subject to change before public release.
26
+
27
+ ```sh
28
+ # Using npm
29
+ npm install @virtru/dsp-sdk
30
+
31
+ ```
32
+
33
+ ## Usage
34
+
35
+ The following example demonstrates how to authenticate with DSP, initialize the platform client, and perform common operations such as tagging and fetching configuration.
36
+
37
+ ```typescript
38
+ import { AuthProviders, DSP } from '@virtru/dsp-sdk';
39
+
40
+ const authProvider = await AuthProviders.refreshAuthProvider({
41
+ clientId: 'oids-client-id',
42
+ exchange: 'refresh',
43
+ refreshToken: 'refresh-token',
44
+ oidcOrigin: 'oidc-issuer-url',
45
+ });
46
+
47
+ const dsp = new DSP({
48
+ authProvider,
49
+ platformUrl: '/api',
50
+ });
51
+
52
+ // Tag PDP
53
+ const taggingResponse = await dsp.services.v2.taggingPDPService.tag({});
54
+
55
+ // List policy attributes
56
+ const attributesResponse = await dsp.services.v1.attributes.listAttributes({});
57
+
58
+ // Encrypts string into a NanoTDF
59
+ const nano = await dsp.createNanoTDF({
60
+ source: {
61
+ type: "buffer",
62
+ location: new TextEncoder().encode("hello world"),
63
+ },
64
+ });
65
+
66
+ await nano.pipeTo(
67
+ new WritableStream({
68
+ write(chunk) {
69
+ console.log(chunk);
70
+ },
71
+ })
72
+ );
73
+
74
+ ```
75
+
76
+ Refer to the API documentation for a complete list of available methods and configuration options.
77
+
78
+ ## Testing
79
+
80
+ This section is intended for repository maintainers and contributors. To verify the integrity of the SDK and ensure all features work as expected, run the test suite using the following command:
81
+
82
+ ```bash
83
+ pnpm test
84
+ ```
85
+
86
+
87
+ ### Linting
88
+
89
+ - ESLint is used for linting. To check for linting errors:
90
+ ```bash
91
+ pnpm lint
92
+ ```
93
+ - To automatically fix linting errors:
94
+ ```bash
95
+ pnpm lint:fix
96
+ ```
97
+
98
+