@virtru/dsp-sdk 0.4.1 → 0.6.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.
- package/CHANGELOG.md +15 -1
- package/README.md +81 -3
- package/dist/src/fips.d.ts +7 -0
- package/dist/src/fips.js +12 -0
- package/dist/src/lib/dsp.d.ts +17 -1
- package/dist/src/lib/dsp.js +28 -5
- package/dist/src/lib/fips-crypto/asymmetric.d.ts +35 -0
- package/dist/src/lib/fips-crypto/asymmetric.js +116 -0
- package/dist/src/lib/fips-crypto/key-format.d.ts +51 -0
- package/dist/src/lib/fips-crypto/key-format.js +233 -0
- package/dist/src/lib/fips-crypto/keys.d.ts +26 -0
- package/dist/src/lib/fips-crypto/keys.js +123 -0
- package/dist/src/lib/fips-crypto/primitives.d.ts +41 -0
- package/dist/src/lib/fips-crypto/primitives.js +105 -0
- package/dist/src/lib/fips-crypto/symmetric.d.ts +61 -0
- package/dist/src/lib/fips-crypto/symmetric.js +152 -0
- package/dist/src/lib/fips-crypto-service.d.ts +5 -0
- package/dist/src/lib/fips-crypto-service.js +44 -0
- package/dist/src/lib/utils.d.ts +8 -2
- package/dist/src/lib/utils.js +8 -9
- package/package.json +31 -5
- package/.prettierrc +0 -3
- package/.rush/temp/chunked-rush-logs/dsp-sdk._phase_build.chunks.jsonl +0 -12
- package/.rush/temp/chunked-rush-logs/dsp-sdk._phase_test.chunks.jsonl +0 -43
- package/.rush/temp/package-deps__phase_build.json +0 -68
- package/.rush/temp/shrinkwrap-deps.json +0 -1257
- package/CHANGELOG.json +0 -278
- package/buf.gen.yaml +0 -17
- package/buf.yaml +0 -4
- package/config/jest.config.json +0 -6
- package/config/rig.json +0 -8
- package/dist/tests/dsp-client.test.d.ts +0 -1
- package/dist/tests/dsp-client.test.js +0 -73
- package/dist/tests/dsp.test.d.ts +0 -1
- package/dist/tests/dsp.test.js +0 -92
- package/dist/tests/mocks/create-export-artifacts.d.ts +0 -2
- package/dist/tests/mocks/create-export-artifacts.js +0 -13
- package/dist/tests/mocks/tagging-pdp-tag.d.ts +0 -2
- package/dist/tests/mocks/tagging-pdp-tag.js +0 -11
- package/dist/tests/mocks/well-known-configuration.d.ts +0 -2
- package/dist/tests/mocks/well-known-configuration.js +0 -12
- package/dist/tests/setup-msw.d.ts +0 -9
- package/dist/tests/setup-msw.js +0 -30
- package/eslint.config.mjs +0 -28
- package/lib-commonjs/src/gen/buf/validate/validate_pb.js +0 -487
- package/lib-commonjs/src/gen/config/v1/config_pb.js +0 -142
- package/lib-commonjs/src/gen/config/v1/kas_config_pb.js +0 -72
- package/lib-commonjs/src/gen/config/v1/meta_pb.js +0 -36
- package/lib-commonjs/src/gen/config/v1/outlook_config_pb.js +0 -67
- package/lib-commonjs/src/gen/config/v1/secureviewer_config_pb.js +0 -67
- package/lib-commonjs/src/gen/config/v1/tagging_pb.js +0 -246
- package/lib-commonjs/src/gen/google/api/annotations_pb.js +0 -33
- package/lib-commonjs/src/gen/google/api/http_pb.js +0 -44
- package/lib-commonjs/src/gen/policyimportexport/v1/policy_import_export_pb.js +0 -93
- package/lib-commonjs/src/gen/shared/v1/shared_pb.js +0 -95
- package/lib-commonjs/src/gen/tagging/pdp/v2/tagging_pb.js +0 -277
- package/lib-commonjs/src/gen/version/v1/version_pb.js +0 -40
- package/lib-commonjs/src/gen/virtru/common/common_pb.js +0 -76
- package/lib-commonjs/src/gen/virtru/policy/certificates/v1/certificates_pb.js +0 -77
- package/lib-commonjs/src/gen/virtru/policy/objects_pb.js +0 -143
- package/lib-commonjs/src/index.js +0 -48
- package/lib-commonjs/src/lib/client.js +0 -66
- package/lib-commonjs/src/lib/consts.js +0 -10
- package/lib-commonjs/src/lib/dsp.js +0 -49
- package/lib-commonjs/src/lib/utils.js +0 -402
- package/lib-commonjs/tests/dsp-client.test.js +0 -75
- package/lib-commonjs/tests/dsp.test.js +0 -94
- package/lib-commonjs/tests/mocks/create-export-artifacts.js +0 -17
- package/lib-commonjs/tests/mocks/tagging-pdp-tag.js +0 -15
- package/lib-commonjs/tests/mocks/well-known-configuration.js +0 -16
- package/lib-commonjs/tests/setup-msw.js +0 -33
- package/src/gen/buf/validate/validate_pb.ts +0 -4879
- package/src/gen/config/formatters/testdata/v1/test_pb.ts +0 -287
- package/src/gen/config/v1/config_connect.ts +0 -111
- package/src/gen/config/v1/config_pb.ts +0 -439
- package/src/gen/config/v1/kas_config_pb.ts +0 -183
- package/src/gen/config/v1/meta_pb.ts +0 -72
- package/src/gen/config/v1/outlook_config_pb.ts +0 -242
- package/src/gen/config/v1/secureviewer_config_pb.ts +0 -161
- package/src/gen/config/v1/tagging_pb.ts +0 -456
- package/src/gen/google/api/annotations_pb.ts +0 -43
- package/src/gen/google/api/http_pb.ts +0 -486
- package/src/gen/helloworld/v1/helloworld_connect.ts +0 -49
- package/src/gen/helloworld/v1/helloworld_pb.ts +0 -104
- package/src/gen/kas/nanotdf/v1/nanotdf_rewrap_connect.ts +0 -39
- package/src/gen/kas/nanotdf/v1/nanotdf_rewrap_pb.ts +0 -207
- package/src/gen/policyimportexport/v1/policy_import_export_connect.ts +0 -56
- package/src/gen/policyimportexport/v1/policy_import_export_pb.ts +0 -332
- package/src/gen/shared/v1/shared_connect.ts +0 -61
- package/src/gen/shared/v1/shared_pb.ts +0 -240
- package/src/gen/shared/v2/shared_connect.ts +0 -39
- package/src/gen/shared/v2/shared_pb.ts +0 -122
- package/src/gen/tagging/pdp/v2/externalprocessors/processor_connect.ts +0 -156
- package/src/gen/tagging/pdp/v2/externalprocessors/processor_pb.ts +0 -709
- package/src/gen/tagging/pdp/v2/stanag/stanag_pb.ts +0 -953
- package/src/gen/tagging/pdp/v2/tagging_connect.ts +0 -73
- package/src/gen/tagging/pdp/v2/tagging_pb.ts +0 -1064
- package/src/gen/version/v1/version_connect.ts +0 -31
- package/src/gen/version/v1/version_pb.ts +0 -143
- package/src/gen/virtru/common/common_pb.ts +0 -201
- package/src/gen/virtru/policy/certificates/v1/certificates_connect.ts +0 -44
- package/src/gen/virtru/policy/certificates/v1/certificates_pb.ts +0 -305
- package/src/gen/virtru/policy/objects_pb.ts +0 -253
- package/src/gen/web-admin/v1/config_connect.ts +0 -52
- package/src/gen/web-admin/v1/config_pb.ts +0 -173
- package/src/index.ts +0 -62
- package/src/lib/client.ts +0 -90
- package/src/lib/consts.ts +0 -8
- package/src/lib/dsp.ts +0 -65
- package/src/lib/utils.test.ts +0 -412
- package/src/lib/utils.ts +0 -524
- package/src/vite-env.d.ts +0 -7
- package/temp/build/lint/_eslint-5eVG3S6w.json +0 -30
- package/temp/test/jest/haste-map-b055a9550e6d9f9b43d8ad29b1607278-49d19aee56a0732eca9c014a51272338-8710993d07b75a801b0956e67ffc46fa +0 -0
- package/tests/dsp-client.test.ts +0 -95
- package/tests/dsp.test.ts +0 -119
- package/tests/mocks/create-export-artifacts.ts +0 -16
- package/tests/mocks/tagging-pdp-tag.ts +0 -13
- package/tests/mocks/well-known-configuration.ts +0 -15
- package/tests/setup-msw.ts +0 -35
- package/tsconfig.json +0 -32
- package/update-protos.sh +0 -63
- package/vitest.config.ts +0 -32
|
@@ -1,173 +0,0 @@
|
|
|
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
|
-
// @generated by protoc-gen-es v2.3.0 with parameter "target=ts"
|
|
8
|
-
// @generated from file web-admin/v1/config.proto (package webadmin.v1, syntax proto3)
|
|
9
|
-
/* eslint-disable */
|
|
10
|
-
|
|
11
|
-
import type {
|
|
12
|
-
GenFile,
|
|
13
|
-
GenMessage,
|
|
14
|
-
GenService,
|
|
15
|
-
} from '@bufbuild/protobuf/codegenv1';
|
|
16
|
-
import {
|
|
17
|
-
fileDesc,
|
|
18
|
-
messageDesc,
|
|
19
|
-
serviceDesc,
|
|
20
|
-
} from '@bufbuild/protobuf/codegenv1';
|
|
21
|
-
import type { Timestamp } from '@bufbuild/protobuf/wkt';
|
|
22
|
-
import { file_google_protobuf_timestamp } from '@bufbuild/protobuf/wkt';
|
|
23
|
-
import type { Message } from '@bufbuild/protobuf';
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Describes the file web-admin/v1/config.proto.
|
|
27
|
-
*/
|
|
28
|
-
export const file_web_admin_v1_config: GenFile =
|
|
29
|
-
/*@__PURE__*/
|
|
30
|
-
fileDesc(
|
|
31
|
-
'Chl3ZWItYWRtaW4vdjEvY29uZmlnLnByb3RvEgt3ZWJhZG1pbi52MSInCgpDb25maWdJdGVtEgoKAmlkGAEgASgJEg0KBXZhbHVlGAIgASgMIhYKFExpc3RBbGxDb25maWdSZXF1ZXN0IkEKFUxpc3RBbGxDb25maWdSZXNwb25zZRIoCgdjb25maWdzGAEgAygLMhcud2ViYWRtaW4udjEuQ29uZmlnSXRlbSJNChdIYXNDb25maWdDaGFuZ2VzUmVxdWVzdBIyCg5sYXN0X2xvYWRlZF9hdBgBIAEoCzIaLmdvb2dsZS5wcm90b2J1Zi5UaW1lc3RhbXAiLwoYSGFzQ29uZmlnQ2hhbmdlc1Jlc3BvbnNlEhMKC2hhc19jaGFuZ2VzGAEgASgIMswBCg1Db25maWdTZXJ2aWNlElgKDUxpc3RBbGxDb25maWcSIS53ZWJhZG1pbi52MS5MaXN0QWxsQ29uZmlnUmVxdWVzdBoiLndlYmFkbWluLnYxLkxpc3RBbGxDb25maWdSZXNwb25zZSIAEmEKEEhhc0NvbmZpZ0NoYW5nZXMSJC53ZWJhZG1pbi52MS5IYXNDb25maWdDaGFuZ2VzUmVxdWVzdBolLndlYmFkbWluLnYxLkhhc0NvbmZpZ0NoYW5nZXNSZXNwb25zZSIAQr0BCg9jb20ud2ViYWRtaW4udjFCC0NvbmZpZ1Byb3RvUAFaUGdpdGh1Yi5jb20vdmlydHJ1LWNvcnAvZGF0YS1zZWN1cml0eS1wbGF0Zm9ybS9zZGsvdjIvZ2VuL3dlYi1hZG1pbi92MTt3ZWJhZG1pbnYxogIDV1hYqgILV2ViYWRtaW4uVjHKAgtXZWJhZG1pblxWMeICF1dlYmFkbWluXFYxXEdQQk1ldGFkYXRh6gIMV2ViYWRtaW46OlYxYgZwcm90bzM',
|
|
32
|
-
[file_google_protobuf_timestamp]
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* A single configuration item.
|
|
37
|
-
*
|
|
38
|
-
* @generated from message webadmin.v1.ConfigItem
|
|
39
|
-
*/
|
|
40
|
-
export type ConfigItem = Message<'webadmin.v1.ConfigItem'> & {
|
|
41
|
-
/**
|
|
42
|
-
* The dot-separated key for the config value (e.g. auth.enabled).
|
|
43
|
-
*
|
|
44
|
-
* @generated from field: string id = 1;
|
|
45
|
-
*/
|
|
46
|
-
id: string;
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* JSONB representation of the configuration value, returned as bytes.
|
|
50
|
-
*
|
|
51
|
-
* @generated from field: bytes value = 2;
|
|
52
|
-
*/
|
|
53
|
-
value: Uint8Array;
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Describes the message webadmin.v1.ConfigItem.
|
|
58
|
-
* Use `create(ConfigItemSchema)` to create a new message.
|
|
59
|
-
*/
|
|
60
|
-
export const ConfigItemSchema: GenMessage<ConfigItem> =
|
|
61
|
-
/*@__PURE__*/
|
|
62
|
-
messageDesc(file_web_admin_v1_config, 0);
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Request for ListAllConfig.
|
|
66
|
-
*
|
|
67
|
-
* @generated from message webadmin.v1.ListAllConfigRequest
|
|
68
|
-
*/
|
|
69
|
-
export type ListAllConfigRequest =
|
|
70
|
-
Message<'webadmin.v1.ListAllConfigRequest'> & {};
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Describes the message webadmin.v1.ListAllConfigRequest.
|
|
74
|
-
* Use `create(ListAllConfigRequestSchema)` to create a new message.
|
|
75
|
-
*/
|
|
76
|
-
export const ListAllConfigRequestSchema: GenMessage<ListAllConfigRequest> =
|
|
77
|
-
/*@__PURE__*/
|
|
78
|
-
messageDesc(file_web_admin_v1_config, 1);
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Response for ListAllConfig.
|
|
82
|
-
*
|
|
83
|
-
* @generated from message webadmin.v1.ListAllConfigResponse
|
|
84
|
-
*/
|
|
85
|
-
export type ListAllConfigResponse =
|
|
86
|
-
Message<'webadmin.v1.ListAllConfigResponse'> & {
|
|
87
|
-
/**
|
|
88
|
-
* @generated from field: repeated webadmin.v1.ConfigItem configs = 1;
|
|
89
|
-
*/
|
|
90
|
-
configs: ConfigItem[];
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Describes the message webadmin.v1.ListAllConfigResponse.
|
|
95
|
-
* Use `create(ListAllConfigResponseSchema)` to create a new message.
|
|
96
|
-
*/
|
|
97
|
-
export const ListAllConfigResponseSchema: GenMessage<ListAllConfigResponse> =
|
|
98
|
-
/*@__PURE__*/
|
|
99
|
-
messageDesc(file_web_admin_v1_config, 2);
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Request for HasConfigChanges.
|
|
103
|
-
*
|
|
104
|
-
* @generated from message webadmin.v1.HasConfigChangesRequest
|
|
105
|
-
*/
|
|
106
|
-
export type HasConfigChangesRequest =
|
|
107
|
-
Message<'webadmin.v1.HasConfigChangesRequest'> & {
|
|
108
|
-
/**
|
|
109
|
-
* The timestamp to check against. The service will return true if any
|
|
110
|
-
* config has an `updated_at` value greater than this.
|
|
111
|
-
*
|
|
112
|
-
* @generated from field: google.protobuf.Timestamp last_loaded_at = 1;
|
|
113
|
-
*/
|
|
114
|
-
lastLoadedAt?: Timestamp;
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Describes the message webadmin.v1.HasConfigChangesRequest.
|
|
119
|
-
* Use `create(HasConfigChangesRequestSchema)` to create a new message.
|
|
120
|
-
*/
|
|
121
|
-
export const HasConfigChangesRequestSchema: GenMessage<HasConfigChangesRequest> =
|
|
122
|
-
/*@__PURE__*/
|
|
123
|
-
messageDesc(file_web_admin_v1_config, 3);
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Response for HasConfigChanges.
|
|
127
|
-
*
|
|
128
|
-
* @generated from message webadmin.v1.HasConfigChangesResponse
|
|
129
|
-
*/
|
|
130
|
-
export type HasConfigChangesResponse =
|
|
131
|
-
Message<'webadmin.v1.HasConfigChangesResponse'> & {
|
|
132
|
-
/**
|
|
133
|
-
* @generated from field: bool has_changes = 1;
|
|
134
|
-
*/
|
|
135
|
-
hasChanges: boolean;
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* Describes the message webadmin.v1.HasConfigChangesResponse.
|
|
140
|
-
* Use `create(HasConfigChangesResponseSchema)` to create a new message.
|
|
141
|
-
*/
|
|
142
|
-
export const HasConfigChangesResponseSchema: GenMessage<HasConfigChangesResponse> =
|
|
143
|
-
/*@__PURE__*/
|
|
144
|
-
messageDesc(file_web_admin_v1_config, 4);
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* The ConfigService provides an interface for managing and retrieving
|
|
148
|
-
* platform configuration values stored in the database.
|
|
149
|
-
*
|
|
150
|
-
* @generated from service webadmin.v1.ConfigService
|
|
151
|
-
*/
|
|
152
|
-
export const ConfigService: GenService<{
|
|
153
|
-
/**
|
|
154
|
-
* ListAllConfig retrieves all configuration key-value pairs.
|
|
155
|
-
*
|
|
156
|
-
* @generated from rpc webadmin.v1.ConfigService.ListAllConfig
|
|
157
|
-
*/
|
|
158
|
-
listAllConfig: {
|
|
159
|
-
methodKind: 'unary';
|
|
160
|
-
input: typeof ListAllConfigRequestSchema;
|
|
161
|
-
output: typeof ListAllConfigResponseSchema;
|
|
162
|
-
};
|
|
163
|
-
/**
|
|
164
|
-
* HasConfigChanges checks if any configuration was updated after a given timestamp.
|
|
165
|
-
*
|
|
166
|
-
* @generated from rpc webadmin.v1.ConfigService.HasConfigChanges
|
|
167
|
-
*/
|
|
168
|
-
hasConfigChanges: {
|
|
169
|
-
methodKind: 'unary';
|
|
170
|
-
input: typeof HasConfigChangesRequestSchema;
|
|
171
|
-
output: typeof HasConfigChangesResponseSchema;
|
|
172
|
-
};
|
|
173
|
-
}> = /*@__PURE__*/ serviceDesc(file_web_admin_v1_config, 0);
|
package/src/index.ts
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
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
|
-
/**
|
|
8
|
-
* Exports Connect RPC and Connect Web RPC
|
|
9
|
-
*/
|
|
10
|
-
export {
|
|
11
|
-
platformConnect as dspConnect,
|
|
12
|
-
platformConnectWeb as dspConnectWeb,
|
|
13
|
-
} from '@opentdf/sdk/platform';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Exports the platform client
|
|
17
|
-
*/
|
|
18
|
-
export {
|
|
19
|
-
type DSPClientServicesV1 as DSPServicesV1,
|
|
20
|
-
type DSPClientServicesV2 as DSPServicesV2,
|
|
21
|
-
type DSPClientOptions,
|
|
22
|
-
DSPClient,
|
|
23
|
-
} from './lib/client';
|
|
24
|
-
export { PlatformClient } from '@opentdf/sdk/platform';
|
|
25
|
-
export {
|
|
26
|
-
createAuthInterceptor,
|
|
27
|
-
type Interceptor,
|
|
28
|
-
createAuthProvider,
|
|
29
|
-
createOpenTDFClient,
|
|
30
|
-
getObligations,
|
|
31
|
-
getUserEntitlements,
|
|
32
|
-
flattenObligations,
|
|
33
|
-
getTrustedCertificates,
|
|
34
|
-
validateJWSCertificateChain,
|
|
35
|
-
type JWSValidationResult,
|
|
36
|
-
type ObligationFeatureMap,
|
|
37
|
-
type SupportedObligations,
|
|
38
|
-
type GetUserEntitlementsResponse,
|
|
39
|
-
} from './lib/utils';
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Exports the DSP wrapper of OpenTDF
|
|
43
|
-
*/
|
|
44
|
-
export { DSP, createDSP } from './lib/dsp';
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Exports components of OpenTDF
|
|
48
|
-
*/
|
|
49
|
-
|
|
50
|
-
export {
|
|
51
|
-
version,
|
|
52
|
-
clientType,
|
|
53
|
-
tdfSpecVersion,
|
|
54
|
-
type DecoratedStream,
|
|
55
|
-
type CreateZTDFOptions,
|
|
56
|
-
} from '@opentdf/sdk';
|
|
57
|
-
|
|
58
|
-
// export AuthProvider during transition period
|
|
59
|
-
// TODO: remove this export once the SDK is updated to deprecate the AuthProvider
|
|
60
|
-
export { AuthProviders, type AuthProvider } from '@opentdf/sdk';
|
|
61
|
-
|
|
62
|
-
export * as singlecontainer from '@opentdf/sdk/singlecontainer';
|
package/src/lib/client.ts
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
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
|
-
// export client service definitions
|
|
8
|
-
|
|
9
|
-
// export Connect RPC framework
|
|
10
|
-
import type { AuthProvider } from '@opentdf/sdk';
|
|
11
|
-
import {
|
|
12
|
-
type Client,
|
|
13
|
-
createClient,
|
|
14
|
-
type Interceptor,
|
|
15
|
-
} from '@connectrpc/connect';
|
|
16
|
-
import { createConnectTransport } from '@connectrpc/connect-web';
|
|
17
|
-
import { ConfigService } from '../gen/config/v1/config_pb';
|
|
18
|
-
import { PolicyArtifactService } from '../gen/policyimportexport/v1/policy_import_export_pb';
|
|
19
|
-
import { SharedService } from '../gen/shared/v1/shared_pb';
|
|
20
|
-
import { TaggingPDPService } from '../gen/tagging/pdp/v2/tagging_pb';
|
|
21
|
-
import { VersionService } from '../gen/version/v1/version_pb';
|
|
22
|
-
import { CertificateService } from '../gen/virtru/policy/certificates/v1/certificates_pb';
|
|
23
|
-
import { createAuthInterceptor } from './utils';
|
|
24
|
-
|
|
25
|
-
export interface DSPClientServicesV1 {
|
|
26
|
-
configService: Client<typeof ConfigService>;
|
|
27
|
-
policyArtifactService: Client<typeof PolicyArtifactService>;
|
|
28
|
-
sharedService: Client<typeof SharedService>;
|
|
29
|
-
versionService: Client<typeof VersionService>;
|
|
30
|
-
certificateService: Client<typeof CertificateService>;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export interface DSPClientServicesV2 {
|
|
34
|
-
taggingPDPService: Client<typeof TaggingPDPService>;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export interface DSPClientOptions {
|
|
38
|
-
// Base URL of the DSP
|
|
39
|
-
platformUrl: string;
|
|
40
|
-
// List of interceptors to apply to rpc requests
|
|
41
|
-
interceptors?: Interceptor[];
|
|
42
|
-
// Auth provider for request signing
|
|
43
|
-
authProvider?: AuthProvider;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* A client for interacting with the DSP using the Connect RPC framework.
|
|
48
|
-
*
|
|
49
|
-
* This client supports custom interceptors, which can be used to add
|
|
50
|
-
* authentication headers or other custom logic to outgoing requests.
|
|
51
|
-
*
|
|
52
|
-
*/
|
|
53
|
-
export class DSPClient {
|
|
54
|
-
readonly v1: DSPClientServicesV1;
|
|
55
|
-
readonly v2: DSPClientServicesV2;
|
|
56
|
-
|
|
57
|
-
constructor(options: DSPClientOptions) {
|
|
58
|
-
const interceptors: Interceptor[] = [];
|
|
59
|
-
|
|
60
|
-
if (!options.platformUrl) {
|
|
61
|
-
throw new Error('platformUrl is required for DSP client');
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
if (options.authProvider) {
|
|
65
|
-
const authInterceptor = createAuthInterceptor(options.authProvider);
|
|
66
|
-
interceptors.push(authInterceptor);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
if (options.interceptors?.length) {
|
|
70
|
-
interceptors.push(...options.interceptors);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const transport = createConnectTransport({
|
|
74
|
-
baseUrl: options.platformUrl,
|
|
75
|
-
interceptors,
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
this.v1 = {
|
|
79
|
-
configService: createClient(ConfigService, transport),
|
|
80
|
-
policyArtifactService: createClient(PolicyArtifactService, transport),
|
|
81
|
-
sharedService: createClient(SharedService, transport),
|
|
82
|
-
versionService: createClient(VersionService, transport),
|
|
83
|
-
certificateService: createClient(CertificateService, transport),
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
this.v2 = {
|
|
87
|
-
taggingPDPService: createClient(TaggingPDPService, transport),
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
}
|
package/src/lib/consts.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
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
|
-
export const MAX_CERTS = 10; // reasonable upper bound for chain depth
|
|
8
|
-
export const MAX_CERT_BYTES = 64 * 1024; // 64KB per certificate
|
package/src/lib/dsp.ts
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
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
|
-
import { OpenTDF, type OpenTDFOptions } from '@opentdf/sdk';
|
|
8
|
-
import { PlatformClient, type PlatformServices } from '@opentdf/sdk/platform';
|
|
9
|
-
import {
|
|
10
|
-
DSPClient,
|
|
11
|
-
type DSPClientServicesV1,
|
|
12
|
-
type DSPClientServicesV2,
|
|
13
|
-
} from './client';
|
|
14
|
-
import type { Interceptor } from '@connectrpc/connect';
|
|
15
|
-
|
|
16
|
-
export type DSPServicesV1 = DSPClientServicesV1 & PlatformServices;
|
|
17
|
-
export type DSPServicesV2 = DSPClientServicesV2;
|
|
18
|
-
|
|
19
|
-
export interface DSPOptions extends OpenTDFOptions {
|
|
20
|
-
// This is the URL of the DSP server that the client will connect to.
|
|
21
|
-
// PlatformUrl is required for DSP client
|
|
22
|
-
platformUrl: string;
|
|
23
|
-
// List interceptors to apply to rpc requests
|
|
24
|
-
interceptors?: Interceptor[];
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export class DSP extends OpenTDF {
|
|
28
|
-
readonly services: {
|
|
29
|
-
v1: DSPServicesV1;
|
|
30
|
-
v2: DSPServicesV2;
|
|
31
|
-
};
|
|
32
|
-
constructor(options: DSPOptions) {
|
|
33
|
-
super(options);
|
|
34
|
-
|
|
35
|
-
if (!options.platformUrl) {
|
|
36
|
-
throw new Error('platformUrl is required for DSP client');
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const dspClient = new DSPClient({
|
|
40
|
-
platformUrl: options.platformUrl,
|
|
41
|
-
interceptors: options.interceptors,
|
|
42
|
-
authProvider: options.authProvider,
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
const platformClient = new PlatformClient({
|
|
46
|
-
platformUrl: options.platformUrl,
|
|
47
|
-
interceptors: options.interceptors,
|
|
48
|
-
authProvider: options.authProvider,
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
this.services = {
|
|
52
|
-
v1: {
|
|
53
|
-
...platformClient.v1,
|
|
54
|
-
...dspClient.v1,
|
|
55
|
-
},
|
|
56
|
-
v2: {
|
|
57
|
-
...dspClient.v2,
|
|
58
|
-
},
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export function createDSP(options: DSPOptions): DSP {
|
|
64
|
-
return new DSP(options);
|
|
65
|
-
}
|