@virtru/dsp-sdk 0.5.0 → 0.7.0

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 (130) hide show
  1. package/CHANGELOG.md +15 -1
  2. package/README.md +81 -3
  3. package/dist/src/fips.d.ts +7 -0
  4. package/dist/src/fips.js +12 -0
  5. package/dist/src/lib/dsp.d.ts +17 -1
  6. package/dist/src/lib/dsp.js +28 -5
  7. package/package.json +25 -4
  8. package/.prettierrc +0 -3
  9. package/.rush/temp/chunked-rush-logs/dsp-sdk._phase_build.chunks.jsonl +0 -12
  10. package/.rush/temp/chunked-rush-logs/dsp-sdk._phase_test.chunks.jsonl +0 -383
  11. package/.rush/temp/package-deps__phase_build.json +0 -76
  12. package/.rush/temp/shrinkwrap-deps.json +0 -1262
  13. package/CHANGELOG.json +0 -299
  14. package/buf.gen.yaml +0 -17
  15. package/buf.yaml +0 -4
  16. package/config/jest.config.json +0 -6
  17. package/config/rig.json +0 -8
  18. package/dist/tests/dsp-client.test.d.ts +0 -1
  19. package/dist/tests/dsp-client.test.js +0 -73
  20. package/dist/tests/dsp.test.d.ts +0 -1
  21. package/dist/tests/dsp.test.js +0 -92
  22. package/dist/tests/fips-crypto.unit.test.d.ts +0 -1
  23. package/dist/tests/fips-crypto.unit.test.js +0 -258
  24. package/dist/tests/mocks/create-export-artifacts.d.ts +0 -2
  25. package/dist/tests/mocks/create-export-artifacts.js +0 -13
  26. package/dist/tests/mocks/tagging-pdp-tag.d.ts +0 -2
  27. package/dist/tests/mocks/tagging-pdp-tag.js +0 -11
  28. package/dist/tests/mocks/well-known-configuration.d.ts +0 -2
  29. package/dist/tests/mocks/well-known-configuration.js +0 -12
  30. package/dist/tests/setup-msw.d.ts +0 -9
  31. package/dist/tests/setup-msw.js +0 -30
  32. package/dist/tests/setup-unit.d.ts +0 -7
  33. package/dist/tests/setup-unit.js +0 -70
  34. package/eslint.config.mjs +0 -28
  35. package/lib-commonjs/src/gen/buf/validate/validate_pb.js +0 -487
  36. package/lib-commonjs/src/gen/config/v1/config_pb.js +0 -142
  37. package/lib-commonjs/src/gen/config/v1/kas_config_pb.js +0 -72
  38. package/lib-commonjs/src/gen/config/v1/meta_pb.js +0 -36
  39. package/lib-commonjs/src/gen/config/v1/outlook_config_pb.js +0 -67
  40. package/lib-commonjs/src/gen/config/v1/secureviewer_config_pb.js +0 -67
  41. package/lib-commonjs/src/gen/config/v1/tagging_pb.js +0 -246
  42. package/lib-commonjs/src/gen/google/api/annotations_pb.js +0 -33
  43. package/lib-commonjs/src/gen/google/api/http_pb.js +0 -44
  44. package/lib-commonjs/src/gen/policyimportexport/v1/policy_import_export_pb.js +0 -93
  45. package/lib-commonjs/src/gen/shared/v1/shared_pb.js +0 -95
  46. package/lib-commonjs/src/gen/tagging/pdp/v2/tagging_pb.js +0 -277
  47. package/lib-commonjs/src/gen/version/v1/version_pb.js +0 -40
  48. package/lib-commonjs/src/gen/virtru/common/common_pb.js +0 -76
  49. package/lib-commonjs/src/gen/virtru/policy/certificates/v1/certificates_pb.js +0 -77
  50. package/lib-commonjs/src/gen/virtru/policy/objects_pb.js +0 -143
  51. package/lib-commonjs/src/index.js +0 -48
  52. package/lib-commonjs/src/lib/client.js +0 -66
  53. package/lib-commonjs/src/lib/consts.js +0 -10
  54. package/lib-commonjs/src/lib/dsp.js +0 -49
  55. package/lib-commonjs/src/lib/fips-crypto/asymmetric.js +0 -126
  56. package/lib-commonjs/src/lib/fips-crypto/key-format.js +0 -243
  57. package/lib-commonjs/src/lib/fips-crypto/keys.js +0 -134
  58. package/lib-commonjs/src/lib/fips-crypto/primitives.js +0 -112
  59. package/lib-commonjs/src/lib/fips-crypto/symmetric.js +0 -162
  60. package/lib-commonjs/src/lib/fips-crypto-service.js +0 -57
  61. package/lib-commonjs/src/lib/utils.js +0 -401
  62. package/lib-commonjs/tests/dsp-client.test.js +0 -75
  63. package/lib-commonjs/tests/dsp.test.js +0 -94
  64. package/lib-commonjs/tests/fips-crypto.unit.test.js +0 -260
  65. package/lib-commonjs/tests/mocks/create-export-artifacts.js +0 -17
  66. package/lib-commonjs/tests/mocks/tagging-pdp-tag.js +0 -15
  67. package/lib-commonjs/tests/mocks/well-known-configuration.js +0 -16
  68. package/lib-commonjs/tests/setup-msw.js +0 -33
  69. package/lib-commonjs/tests/setup-unit.js +0 -72
  70. package/public/virtru.wasm +0 -0
  71. package/src/gen/buf/validate/validate_pb.ts +0 -4879
  72. package/src/gen/config/formatters/testdata/v1/test_pb.ts +0 -287
  73. package/src/gen/config/v1/config_connect.ts +0 -111
  74. package/src/gen/config/v1/config_pb.ts +0 -439
  75. package/src/gen/config/v1/kas_config_pb.ts +0 -183
  76. package/src/gen/config/v1/meta_pb.ts +0 -72
  77. package/src/gen/config/v1/outlook_config_pb.ts +0 -242
  78. package/src/gen/config/v1/secureviewer_config_pb.ts +0 -161
  79. package/src/gen/config/v1/tagging_pb.ts +0 -456
  80. package/src/gen/google/api/annotations_pb.ts +0 -43
  81. package/src/gen/google/api/http_pb.ts +0 -486
  82. package/src/gen/helloworld/v1/helloworld_connect.ts +0 -49
  83. package/src/gen/helloworld/v1/helloworld_pb.ts +0 -104
  84. package/src/gen/kas/nanotdf/v1/nanotdf_rewrap_connect.ts +0 -39
  85. package/src/gen/kas/nanotdf/v1/nanotdf_rewrap_pb.ts +0 -207
  86. package/src/gen/policyimportexport/v1/policy_import_export_connect.ts +0 -56
  87. package/src/gen/policyimportexport/v1/policy_import_export_pb.ts +0 -332
  88. package/src/gen/shared/v1/shared_connect.ts +0 -61
  89. package/src/gen/shared/v1/shared_pb.ts +0 -240
  90. package/src/gen/shared/v2/shared_connect.ts +0 -39
  91. package/src/gen/shared/v2/shared_pb.ts +0 -122
  92. package/src/gen/tagging/pdp/v2/externalprocessors/processor_connect.ts +0 -156
  93. package/src/gen/tagging/pdp/v2/externalprocessors/processor_pb.ts +0 -709
  94. package/src/gen/tagging/pdp/v2/stanag/stanag_pb.ts +0 -953
  95. package/src/gen/tagging/pdp/v2/tagging_connect.ts +0 -73
  96. package/src/gen/tagging/pdp/v2/tagging_pb.ts +0 -1064
  97. package/src/gen/version/v1/version_connect.ts +0 -31
  98. package/src/gen/version/v1/version_pb.ts +0 -143
  99. package/src/gen/virtru/common/common_pb.ts +0 -201
  100. package/src/gen/virtru/policy/certificates/v1/certificates_connect.ts +0 -44
  101. package/src/gen/virtru/policy/certificates/v1/certificates_pb.ts +0 -305
  102. package/src/gen/virtru/policy/objects_pb.ts +0 -253
  103. package/src/gen/web-admin/v1/config_connect.ts +0 -52
  104. package/src/gen/web-admin/v1/config_pb.ts +0 -173
  105. package/src/index.ts +0 -62
  106. package/src/lib/client.ts +0 -90
  107. package/src/lib/consts.ts +0 -8
  108. package/src/lib/dsp.ts +0 -65
  109. package/src/lib/fips-crypto/asymmetric.ts +0 -162
  110. package/src/lib/fips-crypto/key-format.ts +0 -287
  111. package/src/lib/fips-crypto/keys.ts +0 -190
  112. package/src/lib/fips-crypto/primitives.ts +0 -197
  113. package/src/lib/fips-crypto/symmetric.ts +0 -213
  114. package/src/lib/fips-crypto-service.ts +0 -58
  115. package/src/lib/utils.test.ts +0 -415
  116. package/src/lib/utils.ts +0 -525
  117. package/src/vite-env.d.ts +0 -7
  118. package/temp/build/lint/_eslint-5eVG3S6w.json +0 -38
  119. package/temp/test/jest/haste-map-b055a9550e6d9f9b43d8ad29b1607278-49d19aee56a0732eca9c014a51272338-8710993d07b75a801b0956e67ffc46fa +0 -0
  120. package/tests/dsp-client.test.ts +0 -95
  121. package/tests/dsp.test.ts +0 -119
  122. package/tests/fips-crypto.unit.test.ts +0 -412
  123. package/tests/mocks/create-export-artifacts.ts +0 -16
  124. package/tests/mocks/tagging-pdp-tag.ts +0 -13
  125. package/tests/mocks/well-known-configuration.ts +0 -15
  126. package/tests/setup-msw.ts +0 -35
  127. package/tests/setup-unit.ts +0 -108
  128. package/tsconfig.json +0 -32
  129. package/update-protos.sh +0 -63
  130. package/vitest.config.ts +0 -48
package/CHANGELOG.md CHANGED
@@ -1,6 +1,20 @@
1
1
  # Change Log - @virtru/dsp-sdk
2
2
 
3
- This log was last generated on Thu, 12 Mar 2026 16:58:37 GMT and should not be manually modified.
3
+ This log was last generated on Mon, 20 Apr 2026 14:09:22 GMT and should not be manually modified.
4
+
5
+ ## 0.7.0
6
+ Mon, 20 Apr 2026 14:09:22 GMT
7
+
8
+ ### Minor changes
9
+
10
+ - update vite and related dependencies to specific versions
11
+
12
+ ## 0.6.0
13
+ Thu, 12 Mar 2026 20:33:42 GMT
14
+
15
+ ### Minor changes
16
+
17
+ - expose fipsCryptoService implementation, useFips option
4
18
 
5
19
  ## 0.5.0
6
20
  Thu, 12 Mar 2026 16:58:37 GMT
package/README.md CHANGED
@@ -79,16 +79,96 @@ console.log(decrypted); // "hello world"
79
79
 
80
80
  ```
81
81
 
82
+ ### FIPS Mode
83
+
84
+ The SDK supports FIPS 140-2 compliant cryptography using a validated BoringSSL WASM module. To enable FIPS mode:
85
+
86
+ ```typescript
87
+ import { AuthProviders, DSP } from '@virtru/dsp-sdk';
88
+ import { FipsCryptoService } from '@virtru/dsp-sdk/fips';
89
+
90
+ // Create auth provider with FIPS crypto service
91
+ const authProvider = await AuthProviders.clientSecretAuthProvider(
92
+ {
93
+ clientId: 'your-client-id',
94
+ clientSecret: 'your-client-secret',
95
+ oidcOrigin: 'https://oidc-endpoint',
96
+ exchange: 'client',
97
+ },
98
+ FipsCryptoService // Use FIPS-validated crypto
99
+ );
100
+
101
+ // Initialize DSP with FIPS mode enabled
102
+ const dsp = new DSP({
103
+ authProvider,
104
+ platformUrl: 'https://dsp-platform-url',
105
+ useFips: true, // Enables FIPS mode
106
+ });
107
+
108
+ // Check if FIPS is enabled
109
+ console.log('FIPS enabled:', dsp.fipsEnabled); // true
110
+ ```
111
+
112
+ When FIPS mode is enabled, TDF3/ZTDF cryptographic operations (encryption, decryption, signing, key generation) use the FIPS-validated BoringSSL WASM module instead of Web Crypto API (`crypto.subtle`). NanoTDF operations are not covered by FIPS mode and continue to use `crypto.subtle`.
113
+
114
+ **Note:** FIPS mode only supports RSA keys; EC (Elliptic Curve) operations are not available in FIPS mode.
115
+
82
116
  Refer to the API documentation for a complete list of available methods and configuration options.
83
117
 
84
118
  ## Testing
85
119
 
86
- 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:
120
+ This section is intended for repository maintainers and contributors.
121
+
122
+ The test setup is split into:
123
+ - **Unit tests** (`test:unit`): run in Vitest `jsdom` mode and do **not** require Playwright.
124
+ - **Integration/browser tests** (`test:integration`): run in Chromium via Playwright.
125
+
126
+ To run the unit suite:
127
+
128
+ ```bash
129
+ pnpm run build-fips-crypto
130
+ pnpm run copy-wasm
131
+ pnpm test:unit
132
+ ```
133
+
134
+ To run the browser/integration suite:
135
+
136
+ ```bash
137
+ pnpm test:integration
138
+ ```
139
+
140
+ To run both:
87
141
 
88
142
  ```bash
89
143
  pnpm test
90
144
  ```
91
145
 
146
+ ### Integration Tests
147
+
148
+ Integration tests verify end-to-end encrypt/decrypt operations against a live DSP server, including FIPS mode compliance testing.
149
+
150
+ **Required environment variables:**
151
+ ```bash
152
+ export DSP_PLATFORM_URL="http://localhost:8080" # DSP platform URL
153
+ export CLIENT_ID="your-client-id" # OAuth client ID
154
+ export CLIENT_SECRET="your-client-secret" # OAuth client secret
155
+ export OIDC_ENDPOINT="http://localhost:8888/auth/realms/opentdf" # OIDC endpoint
156
+ ```
157
+
158
+ **Run integration tests:**
159
+ ```bash
160
+ pnpm run build-fips-crypto
161
+ pnpm run copy-wasm
162
+ pnpm test:integration
163
+ ```
164
+
165
+ **Run all tests (unit + integration):**
166
+ ```bash
167
+ pnpm test
168
+ ```
169
+
170
+ Integration tests include FIPS compliance verification to ensure `crypto.subtle` is not used when FIPS mode is enabled (validating that only FIPS-certified BoringSSL WASM is used for cryptographic operations).
171
+
92
172
 
93
173
  ### Linting
94
174
 
@@ -165,5 +245,3 @@ You only need to regenerate the code when:
165
245
  - Proto dependencies are updated
166
246
 
167
247
  After regenerating, commit the updated files in `src/gen/` to version control.
168
-
169
-
@@ -0,0 +1,7 @@
1
+ /**
2
+ * FIPS entrypoint — only import this if @virtru-private/fips-crypto-js is installed.
3
+ *
4
+ * @example
5
+ * import { FipsCryptoService, initializeFipsCrypto } from '@virtru/dsp-sdk/fips';
6
+ */
7
+ export { FipsCryptoService, initializeFipsCrypto, } from './lib/fips-crypto-service';
@@ -0,0 +1,12 @@
1
+ /*
2
+ * Copyright (c) Virtru Corporation. All rights reserved.
3
+ *
4
+ * Your use of this file is governed by the Virtu Terms of Service <https://www.virtru.com/terms-of-service/>.
5
+ */
6
+ /**
7
+ * FIPS entrypoint — only import this if @virtru-private/fips-crypto-js is installed.
8
+ *
9
+ * @example
10
+ * import { FipsCryptoService, initializeFipsCrypto } from '@virtru/dsp-sdk/fips';
11
+ */
12
+ export { FipsCryptoService, initializeFipsCrypto, } from './lib/fips-crypto-service';
@@ -1,4 +1,4 @@
1
- import { OpenTDF, type OpenTDFOptions } from '@opentdf/sdk';
1
+ import { OpenTDF, type OpenTDFOptions, type CryptoService } from '@opentdf/sdk';
2
2
  import { type PlatformServices } from '@opentdf/sdk/platform';
3
3
  import { type DSPClientServicesV1, type DSPClientServicesV2 } from './client';
4
4
  import type { Interceptor } from '@connectrpc/connect';
@@ -7,8 +7,24 @@ export type DSPServicesV2 = DSPClientServicesV2;
7
7
  export interface DSPOptions extends OpenTDFOptions {
8
8
  platformUrl: string;
9
9
  interceptors?: Interceptor[];
10
+ /**
11
+ * Enable FIPS 140-2 compliant cryptography for TDF3/ZTDF operations.
12
+ * When true, uses @virtru-private/fips-mode for encryption/decryption.
13
+ * Requires @virtru-private/fips-crypto-js WASM module to be loaded.
14
+ *
15
+ * Note: NanoTDF operations are NOT affected by this flag and will
16
+ * continue to use native crypto.subtle (not FIPS-compliant).
17
+ */
18
+ useFips?: boolean;
19
+ /**
20
+ * Optional: Provide a custom CryptoService implementation for TDF3/ZTDF.
21
+ * If provided, this takes precedence over useFips flag.
22
+ * NanoTDF operations are not affected.
23
+ */
24
+ cryptoService?: CryptoService;
10
25
  }
11
26
  export declare class DSP extends OpenTDF {
27
+ readonly fipsEnabled: boolean;
12
28
  readonly services: {
13
29
  v1: DSPServicesV1;
14
30
  v2: DSPServicesV2;
@@ -3,21 +3,44 @@
3
3
  *
4
4
  * Your use of this file is governed by the Virtu Terms of Service <https://www.virtru.com/terms-of-service/>.
5
5
  */
6
- import { OpenTDF } from '@opentdf/sdk';
6
+ import { OpenTDF, } from '@opentdf/sdk';
7
7
  import { PlatformClient } from '@opentdf/sdk/platform';
8
8
  import { DSPClient, } from './client';
9
+ import { FipsCryptoService, initializeFipsCrypto } from './fips-crypto-service';
9
10
  export class DSP extends OpenTDF {
10
11
  constructor(options) {
11
- super(options);
12
+ // Validate required options first
13
+ if (!options.platformUrl) {
14
+ throw new Error('platformUrl is required for DSP client');
15
+ }
16
+ // Configure FIPS crypto service for TDF3/ZTDF
17
+ const configuredOptions = { ...options };
18
+ if (options.useFips && options.cryptoService) {
19
+ console.warn('[DSP] Both useFips and cryptoService are set. useFips will be ignored — the provided cryptoService will be used.');
20
+ }
21
+ if (options.cryptoService) {
22
+ configuredOptions.cryptoService = options.cryptoService;
23
+ }
24
+ else if (options.useFips) {
25
+ initializeFipsCrypto();
26
+ configuredOptions.cryptoService = FipsCryptoService;
27
+ }
28
+ // Pass configured options to OpenTDF
29
+ super(configuredOptions);
30
+ Object.defineProperty(this, "fipsEnabled", {
31
+ enumerable: true,
32
+ configurable: true,
33
+ writable: true,
34
+ value: void 0
35
+ });
12
36
  Object.defineProperty(this, "services", {
13
37
  enumerable: true,
14
38
  configurable: true,
15
39
  writable: true,
16
40
  value: void 0
17
41
  });
18
- if (!options.platformUrl) {
19
- throw new Error('platformUrl is required for DSP client');
20
- }
42
+ this.fipsEnabled = configuredOptions.cryptoService === FipsCryptoService;
43
+ // Setup DSP and Platform clients
21
44
  const dspClient = new DSPClient({
22
45
  platformUrl: options.platformUrl,
23
46
  interceptors: options.interceptors,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@virtru/dsp-sdk",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "main": "dist/src/index.js",
6
6
  "exports": {
@@ -9,12 +9,24 @@
9
9
  "import": "./dist/src/index.js",
10
10
  "require": "./dist-commonjs/src/index.js"
11
11
  },
12
+ "./fips": {
13
+ "types": "./dist/src/fips.d.ts",
14
+ "import": "./dist/src/fips.js",
15
+ "require": "./dist-commonjs/src/fips.js"
16
+ },
12
17
  "./platform/*": {
13
18
  "types": "./dist/src/gen/*.d.ts",
14
19
  "import": "./dist/src/gen/*.js",
15
20
  "require": "./dist-commonjs/src/gen/*.js"
16
21
  }
17
22
  },
23
+ "files": [
24
+ "dist/src/**",
25
+ "dist-commonjs/src/**",
26
+ "README.md",
27
+ "LICENSE",
28
+ "CHANGELOG.md"
29
+ ],
18
30
  "engines": {
19
31
  "node": ">=18.0.0"
20
32
  },
@@ -33,10 +45,10 @@
33
45
  "playwright": "^1.52.0",
34
46
  "typescript": "5.8.2",
35
47
  "typescript-eslint": "^8.39.1",
36
- "vite": "^5.4.21",
48
+ "vite": "8.0.8",
37
49
  "vite-plugin-dts": "^4.5.4",
38
50
  "vitest": "~3.1.3",
39
- "@virtru-private/fips-crypto-js": "0.3.0"
51
+ "@virtru-private/fips-crypto-js": "0.4.0"
40
52
  },
41
53
  "dependencies": {
42
54
  "@bufbuild/protobuf": "^2.7.0",
@@ -46,12 +58,21 @@
46
58
  "asn1js": "^3.0.5",
47
59
  "pkijs": "^3.0.19"
48
60
  },
61
+ "peerDependencies": {
62
+ "@virtru-private/fips-crypto-js": "0.4.0"
63
+ },
64
+ "peerDependenciesMeta": {
65
+ "@virtru-private/fips-crypto-js": {
66
+ "optional": true
67
+ }
68
+ },
49
69
  "scripts": {
50
70
  "build": "heft build --clean",
51
71
  "lint": "eslint .",
52
72
  "lint:fix": "eslint . --fix",
53
- "test": "npm run test:unit",
73
+ "test": "npm run test:unit && npm run test:integration",
54
74
  "test:unit": "npm run build-fips-crypto && npm run copy-wasm && npx vitest --run --config vitest.config.ts",
75
+ "test:integration": "npm run build-fips-crypto && npm run copy-wasm && npx vitest --run --config vitest.integration.config.ts",
55
76
  "update-protos": "./update-protos.sh",
56
77
  "build-fips-crypto": "npm run build --prefix ../fips-crypto-js",
57
78
  "copy-wasm": "mkdir -p public && cp ../fips-crypto-js/src/utils/virtru.wasm public/virtru.wasm",
package/.prettierrc DELETED
@@ -1,3 +0,0 @@
1
- {
2
- "singleQuote": true
3
- }
@@ -1,12 +0,0 @@
1
- {"kind":"O","text":"Invoking: heft build --clean --production\n"}
2
- {"kind":"O","text":" ---- build started ---- \n"}
3
- {"kind":"O","text":"[build:set-browserslist-ignore-old-data-env-var] Setting environment variable BROWSERSLIST_IGNORE_OLD_DATA=1\n"}
4
- {"kind":"O","text":"[build:sass] Starting...\n"}
5
- {"kind":"O","text":"[build:image-typings] Processing static assets...\n"}
6
- {"kind":"O","text":"[build:image-typings] Finished processing static assets.\n"}
7
- {"kind":"O","text":"[build:sass] No SCSS files to process.\n"}
8
- {"kind":"O","text":"[build:typescript] Using TypeScript version 5.8.2\n"}
9
- {"kind":"O","text":"[build:webpack] No Webpack configuration found\n"}
10
- {"kind":"O","text":"[build:lint] Using ESLint version 9.39.3\n"}
11
- {"kind":"O","text":" ---- build finished (6.641s) ---- \n"}
12
- {"kind":"O","text":"-------------------- Finished (6.647s) --------------------\n"}