@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.
- package/.prettierrc +3 -0
- package/.rush/temp/operation/_phase_build/state.json +3 -0
- package/.rush/temp/package-deps__phase_build.json +41 -0
- package/.rush/temp/shrinkwrap-deps.json +329 -0
- package/CHANGELOG.json +103 -0
- package/CHANGELOG.md +53 -0
- package/README.md +98 -0
- package/dist/src/gen/buf/validate/validate_pb.d.ts +4517 -0
- package/dist/src/gen/buf/validate/validate_pb.js +484 -0
- package/dist/src/gen/config/v1/config_pb.d.ts +88 -0
- package/dist/src/gen/config/v1/config_pb.js +46 -0
- package/dist/src/gen/config/v1/meta_pb.d.ts +37 -0
- package/dist/src/gen/config/v1/meta_pb.js +33 -0
- package/dist/src/gen/config/v1/tagging_pb.d.ts +264 -0
- package/dist/src/gen/config/v1/tagging_pb.js +188 -0
- package/dist/src/gen/google/api/annotations_pb.d.ts +13 -0
- package/dist/src/gen/google/api/annotations_pb.js +30 -0
- package/dist/src/gen/google/api/http_pb.d.ts +440 -0
- package/dist/src/gen/google/api/http_pb.js +41 -0
- package/dist/src/gen/policyimportexport/v1/policy_import_export_pb.d.ts +241 -0
- package/dist/src/gen/policyimportexport/v1/policy_import_export_pb.js +89 -0
- package/dist/src/gen/shared/v1/shared_pb.d.ts +172 -0
- package/dist/src/gen/shared/v1/shared_pb.js +92 -0
- package/dist/src/gen/tagging/pdp/v2/tagging_pb.d.ts +872 -0
- package/dist/src/gen/tagging/pdp/v2/tagging_pb.js +274 -0
- package/dist/src/gen/version/v1/version_pb.d.ts +96 -0
- package/dist/src/gen/version/v1/version_pb.js +37 -0
- package/dist/src/index.d.ts +21 -0
- package/dist/src/index.js +28 -0
- package/dist/src/lib/client.d.ts +33 -0
- package/dist/src/lib/client.js +60 -0
- package/dist/src/lib/dsp.d.ts +18 -0
- package/dist/src/lib/dsp.js +44 -0
- package/dist/src/lib/utils.d.ts +15 -0
- package/dist/src/lib/utils.js +35 -0
- package/dist/tests/dsp-client.test.d.ts +1 -0
- package/dist/tests/dsp-client.test.js +49 -0
- package/dist/tests/dsp.test.d.ts +1 -0
- package/dist/tests/dsp.test.js +71 -0
- package/dist/tests/mocks/create-export-artifacts.d.ts +2 -0
- package/dist/tests/mocks/create-export-artifacts.js +13 -0
- package/dist/tests/mocks/tagging-pdp-tag.d.ts +2 -0
- package/dist/tests/mocks/tagging-pdp-tag.js +11 -0
- package/dist/tests/mocks/well-known-configuration.d.ts +2 -0
- package/dist/tests/mocks/well-known-configuration.js +12 -0
- package/dist/tests/setup-msw.d.ts +9 -0
- package/dist/tests/setup-msw.js +30 -0
- package/eslint.config.mjs +28 -0
- package/package.json +47 -0
- package/src/gen/buf/validate/validate_pb.ts +4879 -0
- package/src/gen/config/formatters/testdata/v1/test_pb.ts +287 -0
- package/src/gen/config/v1/config_pb.ts +137 -0
- package/src/gen/config/v1/meta_pb.ts +72 -0
- package/src/gen/config/v1/tagging_pb.ts +355 -0
- package/src/gen/google/api/annotations_pb.ts +43 -0
- package/src/gen/google/api/http_pb.ts +486 -0
- package/src/gen/helloworld/v1/helloworld_pb.ts +98 -0
- package/src/gen/policyimportexport/v1/policy_import_export_pb.ts +324 -0
- package/src/gen/shared/v1/shared_pb.ts +240 -0
- package/src/gen/shared/v2/shared_pb.ts +122 -0
- package/src/gen/tagging/pdp/v2/externalprocessors/processor_pb.ts +709 -0
- package/src/gen/tagging/pdp/v2/stanag/stanag_pb.ts +953 -0
- package/src/gen/tagging/pdp/v2/tagging_pb.ts +1064 -0
- package/src/gen/version/v1/version_pb.ts +143 -0
- package/src/index.ts +49 -0
- package/src/lib/client.ts +83 -0
- package/src/lib/dsp.ts +65 -0
- package/src/lib/utils.ts +43 -0
- package/src/vite-env.d.ts +7 -0
- package/tests/dsp-client.test.ts +67 -0
- package/tests/dsp.test.ts +95 -0
- package/tests/mocks/create-export-artifacts.ts +16 -0
- package/tests/mocks/tagging-pdp-tag.ts +13 -0
- package/tests/mocks/well-known-configuration.ts +15 -0
- package/tests/setup-msw.ts +35 -0
- package/tsconfig.json +32 -0
- 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
|
+
|