@opentdf/sdk 0.3.2-beta.2292 → 0.3.2-beta.2435
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/dist/cjs/src/access/access-fetch.js +155 -0
- package/dist/cjs/src/access/access-rpc.js +83 -0
- package/dist/cjs/src/access.js +33 -141
- package/dist/cjs/src/auth/oidc.js +2 -2
- package/dist/cjs/src/nanotdf/Client.js +6 -8
- package/dist/cjs/src/nanotdf/models/Header.js +2 -2
- package/dist/cjs/src/platform/authorization/authorization_pb.js +138 -0
- package/dist/cjs/src/platform/buf/validate/validate_pb.js +410 -0
- package/dist/cjs/src/platform/common/common_pb.js +79 -0
- package/dist/cjs/src/platform/entityresolution/entity_resolution_pb.js +49 -0
- package/dist/cjs/src/platform/google/api/annotations_pb.js +30 -0
- package/dist/cjs/src/platform/google/api/http_pb.js +37 -0
- package/dist/cjs/src/platform/kas/kas_pb.js +96 -0
- package/dist/cjs/src/platform/policy/actions/actions_pb.js +70 -0
- package/dist/cjs/src/platform/policy/attributes/attributes_pb.js +240 -0
- package/dist/cjs/src/platform/policy/kasregistry/key_access_server_registry_pb.js +236 -0
- package/dist/cjs/src/platform/policy/keymanagement/key_management_pb.js +70 -0
- package/dist/cjs/src/platform/policy/namespaces/namespaces_pb.js +121 -0
- package/dist/cjs/src/platform/policy/objects_pb.js +395 -0
- package/dist/cjs/src/platform/policy/registeredresources/registered_resources_pb.js +132 -0
- package/dist/cjs/src/platform/policy/resourcemapping/resource_mapping_pb.js +139 -0
- package/dist/cjs/src/platform/policy/selectors_pb.js +67 -0
- package/dist/cjs/src/platform/policy/subjectmapping/subject_mapping_pb.js +146 -0
- package/dist/cjs/src/platform/policy/unsafe/unsafe_pb.js +124 -0
- package/dist/cjs/src/platform/protoc-gen-openapiv2/options/annotations_pb.js +68 -0
- package/dist/cjs/src/platform/protoc-gen-openapiv2/options/openapiv2_pb.js +307 -0
- package/dist/cjs/src/platform/wellknownconfiguration/wellknown_configuration_pb.js +33 -0
- package/dist/cjs/src/platform.js +140 -0
- package/dist/cjs/src/policy/api.js +21 -38
- package/dist/cjs/src/policy/attributes.js +4 -1
- package/dist/cjs/src/policy/granter.js +9 -9
- package/dist/cjs/src/utils.js +31 -1
- package/dist/cjs/tdf3/src/client/index.js +5 -7
- package/dist/cjs/tdf3/src/tdf.js +4 -11
- package/dist/types/src/access/access-fetch.d.ts +21 -0
- package/dist/types/src/access/access-fetch.d.ts.map +1 -0
- package/dist/types/src/access/access-rpc.d.ts +14 -0
- package/dist/types/src/access/access-rpc.d.ts.map +1 -0
- package/dist/types/src/access.d.ts +3 -7
- package/dist/types/src/access.d.ts.map +1 -1
- package/dist/types/src/nanotdf/Client.d.ts.map +1 -1
- package/dist/types/src/platform/authorization/authorization_pb.d.ts +609 -0
- package/dist/types/src/platform/authorization/authorization_pb.d.ts.map +1 -0
- package/dist/types/src/platform/buf/validate/validate_pb.d.ts +4466 -0
- package/dist/types/src/platform/buf/validate/validate_pb.d.ts.map +1 -0
- package/dist/types/src/platform/common/common_pb.d.ts +112 -0
- package/dist/types/src/platform/common/common_pb.d.ts.map +1 -0
- package/dist/types/src/platform/entityresolution/entity_resolution_pb.d.ts +199 -0
- package/dist/types/src/platform/entityresolution/entity_resolution_pb.d.ts.map +1 -0
- package/dist/types/src/platform/google/api/annotations_pb.d.ts +14 -0
- package/dist/types/src/platform/google/api/annotations_pb.d.ts.map +1 -0
- package/dist/types/src/platform/google/api/http_pb.d.ts +441 -0
- package/dist/types/src/platform/google/api/http_pb.d.ts.map +1 -0
- package/dist/types/src/platform/kas/kas_pb.d.ts +404 -0
- package/dist/types/src/platform/kas/kas_pb.d.ts.map +1 -0
- package/dist/types/src/platform/policy/actions/actions_pb.d.ts +265 -0
- package/dist/types/src/platform/policy/actions/actions_pb.d.ts.map +1 -0
- package/dist/types/src/platform/policy/attributes/attributes_pb.d.ts +1022 -0
- package/dist/types/src/platform/policy/attributes/attributes_pb.d.ts.map +1 -0
- package/dist/types/src/platform/policy/kasregistry/key_access_server_registry_pb.d.ts +1306 -0
- package/dist/types/src/platform/policy/kasregistry/key_access_server_registry_pb.d.ts.map +1 -0
- package/dist/types/src/platform/policy/keymanagement/key_management_pb.d.ts +269 -0
- package/dist/types/src/platform/policy/keymanagement/key_management_pb.d.ts.map +1 -0
- package/dist/types/src/platform/policy/namespaces/namespaces_pb.d.ts +448 -0
- package/dist/types/src/platform/policy/namespaces/namespaces_pb.d.ts.map +1 -0
- package/dist/types/src/platform/policy/objects_pb.d.ts +1112 -0
- package/dist/types/src/platform/policy/objects_pb.d.ts.map +1 -0
- package/dist/types/src/platform/policy/registeredresources/registered_resources_pb.d.ts +539 -0
- package/dist/types/src/platform/policy/registeredresources/registered_resources_pb.d.ts.map +1 -0
- package/dist/types/src/platform/policy/resourcemapping/resource_mapping_pb.d.ts +558 -0
- package/dist/types/src/platform/policy/resourcemapping/resource_mapping_pb.d.ts.map +1 -0
- package/dist/types/src/platform/policy/selectors_pb.d.ts +221 -0
- package/dist/types/src/platform/policy/selectors_pb.d.ts.map +1 -0
- package/dist/types/src/platform/policy/subjectmapping/subject_mapping_pb.d.ts +582 -0
- package/dist/types/src/platform/policy/subjectmapping/subject_mapping_pb.d.ts.map +1 -0
- package/dist/types/src/platform/policy/unsafe/unsafe_pb.d.ts +513 -0
- package/dist/types/src/platform/policy/unsafe/unsafe_pb.d.ts.map +1 -0
- package/dist/types/src/platform/protoc-gen-openapiv2/options/annotations_pb.d.ts +62 -0
- package/dist/types/src/platform/protoc-gen-openapiv2/options/annotations_pb.d.ts.map +1 -0
- package/dist/types/src/platform/protoc-gen-openapiv2/options/openapiv2_pb.d.ts +1441 -0
- package/dist/types/src/platform/protoc-gen-openapiv2/options/openapiv2_pb.d.ts.map +1 -0
- package/dist/types/src/platform/wellknownconfiguration/wellknown_configuration_pb.d.ts +59 -0
- package/dist/types/src/platform/wellknownconfiguration/wellknown_configuration_pb.d.ts.map +1 -0
- package/dist/types/src/platform.d.ts +64 -0
- package/dist/types/src/platform.d.ts.map +1 -0
- package/dist/types/src/policy/api.d.ts +1 -1
- package/dist/types/src/policy/api.d.ts.map +1 -1
- package/dist/types/src/policy/attributes.d.ts +10 -87
- package/dist/types/src/policy/attributes.d.ts.map +1 -1
- package/dist/types/src/policy/granter.d.ts.map +1 -1
- package/dist/types/src/utils.d.ts +10 -0
- package/dist/types/src/utils.d.ts.map +1 -1
- package/dist/types/tdf3/src/client/index.d.ts.map +1 -1
- package/dist/types/tdf3/src/tdf.d.ts.map +1 -1
- package/dist/web/src/access/access-fetch.js +150 -0
- package/dist/web/src/access/access-rpc.js +78 -0
- package/dist/web/src/access.js +35 -144
- package/dist/web/src/auth/oidc.js +2 -2
- package/dist/web/src/nanotdf/Client.js +6 -8
- package/dist/web/src/nanotdf/models/Header.js +2 -2
- package/dist/web/src/platform/authorization/authorization_pb.js +135 -0
- package/dist/web/src/platform/buf/validate/validate_pb.js +407 -0
- package/dist/web/src/platform/common/common_pb.js +76 -0
- package/dist/web/src/platform/entityresolution/entity_resolution_pb.js +46 -0
- package/dist/web/src/platform/google/api/annotations_pb.js +27 -0
- package/dist/web/src/platform/google/api/http_pb.js +34 -0
- package/dist/web/src/platform/kas/kas_pb.js +93 -0
- package/dist/web/src/platform/policy/actions/actions_pb.js +67 -0
- package/dist/web/src/platform/policy/attributes/attributes_pb.js +237 -0
- package/dist/web/src/platform/policy/kasregistry/key_access_server_registry_pb.js +233 -0
- package/dist/web/src/platform/policy/keymanagement/key_management_pb.js +67 -0
- package/dist/web/src/platform/policy/namespaces/namespaces_pb.js +118 -0
- package/dist/web/src/platform/policy/objects_pb.js +392 -0
- package/dist/web/src/platform/policy/registeredresources/registered_resources_pb.js +129 -0
- package/dist/web/src/platform/policy/resourcemapping/resource_mapping_pb.js +136 -0
- package/dist/web/src/platform/policy/selectors_pb.js +64 -0
- package/dist/web/src/platform/policy/subjectmapping/subject_mapping_pb.js +143 -0
- package/dist/web/src/platform/policy/unsafe/unsafe_pb.js +121 -0
- package/dist/web/src/platform/protoc-gen-openapiv2/options/annotations_pb.js +65 -0
- package/dist/web/src/platform/protoc-gen-openapiv2/options/openapiv2_pb.js +304 -0
- package/dist/web/src/platform/wellknownconfiguration/wellknown_configuration_pb.js +30 -0
- package/dist/web/src/platform.js +103 -0
- package/dist/web/src/policy/api.js +23 -40
- package/dist/web/src/policy/attributes.js +3 -2
- package/dist/web/src/policy/granter.js +9 -9
- package/dist/web/src/utils.js +29 -1
- package/dist/web/tdf3/src/client/index.js +6 -8
- package/dist/web/tdf3/src/tdf.js +4 -11
- package/package.json +12 -1
- package/src/access/access-fetch.ts +202 -0
- package/src/access/access-rpc.ts +107 -0
- package/src/access.ts +54 -175
- package/src/auth/oidc.ts +1 -1
- package/src/nanotdf/Client.ts +6 -12
- package/src/nanotdf/models/Header.ts +1 -1
- package/src/platform/authorization/authorization_pb.ts +689 -0
- package/src/platform/buf/validate/validate_pb.ts +4626 -0
- package/src/platform/common/common_pb.ts +135 -0
- package/src/platform/entityresolution/entity_resolution_pb.ts +233 -0
- package/src/platform/google/api/annotations_pb.ts +39 -0
- package/src/platform/google/api/http_pb.ts +474 -0
- package/src/platform/kas/kas_pb.ts +484 -0
- package/src/platform/policy/actions/actions_pb.ts +312 -0
- package/src/platform/policy/attributes/attributes_pb.ts +1181 -0
- package/src/platform/policy/kasregistry/key_access_server_registry_pb.ts +1482 -0
- package/src/platform/policy/keymanagement/key_management_pb.ts +316 -0
- package/src/platform/policy/namespaces/namespaces_pb.ts +528 -0
- package/src/platform/policy/objects_pb.ts +1319 -0
- package/src/platform/policy/registeredresources/registered_resources_pb.ts +623 -0
- package/src/platform/policy/resourcemapping/resource_mapping_pb.ts +658 -0
- package/src/platform/policy/selectors_pb.ts +277 -0
- package/src/platform/policy/subjectmapping/subject_mapping_pb.ts +687 -0
- package/src/platform/policy/unsafe/unsafe_pb.ts +593 -0
- package/src/platform/protoc-gen-openapiv2/options/annotations_pb.ts +83 -0
- package/src/platform/protoc-gen-openapiv2/options/openapiv2_pb.ts +1615 -0
- package/src/platform/wellknownconfiguration/wellknown_configuration_pb.ts +78 -0
- package/src/platform.ts +139 -0
- package/src/policy/api.ts +29 -42
- package/src/policy/attributes.ts +12 -108
- package/src/policy/granter.ts +7 -8
- package/src/utils.ts +30 -0
- package/tdf3/src/client/index.ts +11 -6
- package/tdf3/src/tdf.ts +4 -12
- package/src/platform/authorization/authorization_connect.d.ts +0 -44
- package/src/platform/authorization/authorization_connect.js +0 -44
- package/src/platform/authorization/authorization_pb.d.ts +0 -707
- package/src/platform/authorization/authorization_pb.js +0 -372
- package/src/platform/common/common_pb.d.ts +0 -129
- package/src/platform/common/common_pb.js +0 -58
- package/src/platform/entityresolution/entity_resolution_connect.d.ts +0 -35
- package/src/platform/entityresolution/entity_resolution_connect.js +0 -35
- package/src/platform/entityresolution/entity_resolution_pb.d.ts +0 -242
- package/src/platform/entityresolution/entity_resolution_pb.js +0 -139
- package/src/platform/kas/kas_connect.d.ts +0 -59
- package/src/platform/kas/kas_connect.js +0 -59
- package/src/platform/kas/kas_pb.d.ts +0 -200
- package/src/platform/kas/kas_pb.js +0 -84
- package/src/platform/policy/attributes/attributes_connect.d.ts +0 -168
- package/src/platform/policy/attributes/attributes_connect.js +0 -168
- package/src/platform/policy/attributes/attributes_pb.d.ts +0 -929
- package/src/platform/policy/attributes/attributes_pb.js +0 -363
- package/src/platform/policy/kasregistry/key_access_server_registry_connect.d.ts +0 -62
- package/src/platform/policy/kasregistry/key_access_server_registry_connect.js +0 -62
- package/src/platform/policy/kasregistry/key_access_server_registry_pb.d.ts +0 -283
- package/src/platform/policy/kasregistry/key_access_server_registry_pb.js +0 -113
- package/src/platform/policy/namespaces/namespaces_connect.d.ts +0 -62
- package/src/platform/policy/namespaces/namespaces_connect.js +0 -62
- package/src/platform/policy/namespaces/namespaces_pb.d.ts +0 -270
- package/src/platform/policy/namespaces/namespaces_pb.js +0 -110
- package/src/platform/policy/objects_pb.d.ts +0 -725
- package/src/platform/policy/objects_pb.js +0 -288
- package/src/platform/policy/resourcemapping/resource_mapping_connect.d.ts +0 -259
- package/src/platform/policy/resourcemapping/resource_mapping_connect.js +0 -259
- package/src/platform/policy/resourcemapping/resource_mapping_pb.d.ts +0 -314
- package/src/platform/policy/resourcemapping/resource_mapping_pb.js +0 -142
- package/src/platform/policy/selectors_pb.d.ts +0 -269
- package/src/platform/policy/selectors_pb.js +0 -110
- package/src/platform/policy/subjectmapping/subject_mapping_connect.d.ts +0 -118
- package/src/platform/policy/subjectmapping/subject_mapping_connect.js +0 -118
- package/src/platform/policy/subjectmapping/subject_mapping_pb.d.ts +0 -672
- package/src/platform/policy/subjectmapping/subject_mapping_pb.js +0 -260
- package/src/platform/wellknownconfiguration/wellknown_configuration_connect.d.ts +0 -26
- package/src/platform/wellknownconfiguration/wellknown_configuration_connect.js +0 -26
- package/src/platform/wellknownconfiguration/wellknown_configuration_pb.d.ts +0 -75
- package/src/platform/wellknownconfiguration/wellknown_configuration_pb.js +0 -35
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// @generated by protoc-gen-es v2.2.5 with parameter "target=ts,import_extension=.js"
|
|
2
|
+
// @generated from file wellknownconfiguration/wellknown_configuration.proto (package wellknownconfiguration, syntax proto3)
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
|
|
5
|
+
import type { GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv1";
|
|
6
|
+
import { fileDesc, messageDesc, serviceDesc } from "@bufbuild/protobuf/codegenv1";
|
|
7
|
+
import { file_google_api_annotations } from "../google/api/annotations_pb.js";
|
|
8
|
+
import { file_google_protobuf_struct } from "@bufbuild/protobuf/wkt";
|
|
9
|
+
import type { JsonObject, Message } from "@bufbuild/protobuf";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Describes the file wellknownconfiguration/wellknown_configuration.proto.
|
|
13
|
+
*/
|
|
14
|
+
export const file_wellknownconfiguration_wellknown_configuration: GenFile = /*@__PURE__*/
|
|
15
|
+
fileDesc("CjR3ZWxsa25vd25jb25maWd1cmF0aW9uL3dlbGxrbm93bl9jb25maWd1cmF0aW9uLnByb3RvEhZ3ZWxsa25vd25jb25maWd1cmF0aW9uIrMBCg9XZWxsS25vd25Db25maWcSUQoNY29uZmlndXJhdGlvbhgBIAMoCzI6LndlbGxrbm93bmNvbmZpZ3VyYXRpb24uV2VsbEtub3duQ29uZmlnLkNvbmZpZ3VyYXRpb25FbnRyeRpNChJDb25maWd1cmF0aW9uRW50cnkSCwoDa2V5GAEgASgJEiYKBXZhbHVlGAIgASgLMhcuZ29vZ2xlLnByb3RvYnVmLlN0cnVjdDoCOAEiIgogR2V0V2VsbEtub3duQ29uZmlndXJhdGlvblJlcXVlc3QiUwohR2V0V2VsbEtub3duQ29uZmlndXJhdGlvblJlc3BvbnNlEi4KDWNvbmZpZ3VyYXRpb24YASABKAsyFy5nb29nbGUucHJvdG9idWYuU3RydWN0MtQBChBXZWxsS25vd25TZXJ2aWNlEr8BChlHZXRXZWxsS25vd25Db25maWd1cmF0aW9uEjgud2VsbGtub3duY29uZmlndXJhdGlvbi5HZXRXZWxsS25vd25Db25maWd1cmF0aW9uUmVxdWVzdBo5LndlbGxrbm93bmNvbmZpZ3VyYXRpb24uR2V0V2VsbEtub3duQ29uZmlndXJhdGlvblJlc3BvbnNlIi2QAgGC0+STAiQSIi8ud2VsbC1rbm93bi9vcGVudGRmLWNvbmZpZ3VyYXRpb25iBnByb3RvMw", [file_google_api_annotations, file_google_protobuf_struct]);
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @generated from message wellknownconfiguration.WellKnownConfig
|
|
19
|
+
*/
|
|
20
|
+
export type WellKnownConfig = Message<"wellknownconfiguration.WellKnownConfig"> & {
|
|
21
|
+
/**
|
|
22
|
+
* @generated from field: map<string, google.protobuf.Struct> configuration = 1;
|
|
23
|
+
*/
|
|
24
|
+
configuration: { [key: string]: JsonObject };
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Describes the message wellknownconfiguration.WellKnownConfig.
|
|
29
|
+
* Use `create(WellKnownConfigSchema)` to create a new message.
|
|
30
|
+
*/
|
|
31
|
+
export const WellKnownConfigSchema: GenMessage<WellKnownConfig> = /*@__PURE__*/
|
|
32
|
+
messageDesc(file_wellknownconfiguration_wellknown_configuration, 0);
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @generated from message wellknownconfiguration.GetWellKnownConfigurationRequest
|
|
36
|
+
*/
|
|
37
|
+
export type GetWellKnownConfigurationRequest = Message<"wellknownconfiguration.GetWellKnownConfigurationRequest"> & {
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Describes the message wellknownconfiguration.GetWellKnownConfigurationRequest.
|
|
42
|
+
* Use `create(GetWellKnownConfigurationRequestSchema)` to create a new message.
|
|
43
|
+
*/
|
|
44
|
+
export const GetWellKnownConfigurationRequestSchema: GenMessage<GetWellKnownConfigurationRequest> = /*@__PURE__*/
|
|
45
|
+
messageDesc(file_wellknownconfiguration_wellknown_configuration, 1);
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @generated from message wellknownconfiguration.GetWellKnownConfigurationResponse
|
|
49
|
+
*/
|
|
50
|
+
export type GetWellKnownConfigurationResponse = Message<"wellknownconfiguration.GetWellKnownConfigurationResponse"> & {
|
|
51
|
+
/**
|
|
52
|
+
* @generated from field: google.protobuf.Struct configuration = 1;
|
|
53
|
+
*/
|
|
54
|
+
configuration?: JsonObject;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Describes the message wellknownconfiguration.GetWellKnownConfigurationResponse.
|
|
59
|
+
* Use `create(GetWellKnownConfigurationResponseSchema)` to create a new message.
|
|
60
|
+
*/
|
|
61
|
+
export const GetWellKnownConfigurationResponseSchema: GenMessage<GetWellKnownConfigurationResponse> = /*@__PURE__*/
|
|
62
|
+
messageDesc(file_wellknownconfiguration_wellknown_configuration, 2);
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* @generated from service wellknownconfiguration.WellKnownService
|
|
66
|
+
*/
|
|
67
|
+
export const WellKnownService: GenService<{
|
|
68
|
+
/**
|
|
69
|
+
* @generated from rpc wellknownconfiguration.WellKnownService.GetWellKnownConfiguration
|
|
70
|
+
*/
|
|
71
|
+
getWellKnownConfiguration: {
|
|
72
|
+
methodKind: "unary";
|
|
73
|
+
input: typeof GetWellKnownConfigurationRequestSchema;
|
|
74
|
+
output: typeof GetWellKnownConfigurationResponseSchema;
|
|
75
|
+
},
|
|
76
|
+
}> = /*@__PURE__*/
|
|
77
|
+
serviceDesc(file_wellknownconfiguration_wellknown_configuration, 0);
|
|
78
|
+
|
package/src/platform.ts
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
// export client service definitions
|
|
2
|
+
export * as authorization from './platform/authorization/authorization_pb.js';
|
|
3
|
+
export * as common from './platform/common/common_pb.js';
|
|
4
|
+
export * as entityResolution from './platform/entityresolution/entity_resolution_pb.js';
|
|
5
|
+
export * as kas from './platform/kas/kas_pb.js';
|
|
6
|
+
export * as policyActions from './platform/policy/actions/actions_pb.js';
|
|
7
|
+
export * as policyAttributes from './platform/policy/attributes/attributes_pb.js';
|
|
8
|
+
export * as policyKasRegistry from './platform/policy/kasregistry/key_access_server_registry_pb.js';
|
|
9
|
+
export * as policyNamespaces from './platform/policy/namespaces/namespaces_pb.js';
|
|
10
|
+
export * as policyObjects from './platform/policy/objects_pb.js';
|
|
11
|
+
export * as policyRegisteredResources from './platform/policy/registeredresources/registered_resources_pb.js';
|
|
12
|
+
export * as policyResourceMapping from './platform/policy/resourcemapping/resource_mapping_pb.js';
|
|
13
|
+
export * as policySelectors from './platform/policy/selectors_pb.js';
|
|
14
|
+
export * as policySubjectMapping from './platform/policy/subjectmapping/subject_mapping_pb.js';
|
|
15
|
+
export * as policyUnsafe from './platform/policy/unsafe/unsafe_pb.js';
|
|
16
|
+
export * as wellknown from './platform/wellknownconfiguration/wellknown_configuration_pb.js';
|
|
17
|
+
|
|
18
|
+
// export Connect RPC framework
|
|
19
|
+
export * as platformConnectWeb from '@connectrpc/connect-web';
|
|
20
|
+
export * as platformConnect from '@connectrpc/connect';
|
|
21
|
+
|
|
22
|
+
import { createConnectTransport } from '@connectrpc/connect-web';
|
|
23
|
+
import { AuthProvider } from '../tdf3/index.js';
|
|
24
|
+
|
|
25
|
+
import { Client, createClient, Interceptor } from '@connectrpc/connect';
|
|
26
|
+
import { WellKnownService } from './platform/wellknownconfiguration/wellknown_configuration_pb.js';
|
|
27
|
+
import { AuthorizationService } from './platform/authorization/authorization_pb.js';
|
|
28
|
+
import { EntityResolutionService } from './platform/entityresolution/entity_resolution_pb.js';
|
|
29
|
+
import { AccessService } from './platform/kas/kas_pb.js';
|
|
30
|
+
import { ActionService } from './platform/policy/actions/actions_pb.js';
|
|
31
|
+
import { AttributesService } from './platform/policy/attributes/attributes_pb.js';
|
|
32
|
+
import { KeyAccessServerRegistryService } from './platform/policy/kasregistry/key_access_server_registry_pb.js';
|
|
33
|
+
import { NamespaceService } from './platform/policy/namespaces/namespaces_pb.js';
|
|
34
|
+
import { ResourceMappingService } from './platform/policy/resourcemapping/resource_mapping_pb.js';
|
|
35
|
+
import { SubjectMappingService } from './platform/policy/subjectmapping/subject_mapping_pb.js';
|
|
36
|
+
import { UnsafeService } from './platform/policy/unsafe/unsafe_pb.js';
|
|
37
|
+
|
|
38
|
+
export interface PlatformServices {
|
|
39
|
+
authorization: Client<typeof AuthorizationService>;
|
|
40
|
+
entityResolution: Client<typeof EntityResolutionService>;
|
|
41
|
+
access: Client<typeof AccessService>;
|
|
42
|
+
action: Client<typeof ActionService>;
|
|
43
|
+
attributes: Client<typeof AttributesService>;
|
|
44
|
+
keyAccessServerRegistry: Client<typeof KeyAccessServerRegistryService>;
|
|
45
|
+
namespace: Client<typeof NamespaceService>;
|
|
46
|
+
resourceMapping: Client<typeof ResourceMappingService>;
|
|
47
|
+
subjectMapping: Client<typeof SubjectMappingService>;
|
|
48
|
+
unsafe: Client<typeof UnsafeService>;
|
|
49
|
+
wellknown: Client<typeof WellKnownService>;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface PlatformClientOptions {
|
|
53
|
+
// Optional authentication provider for generating auth interceptor.
|
|
54
|
+
authProvider?: AuthProvider;
|
|
55
|
+
// Array of custom interceptors to apply to rpc requests.
|
|
56
|
+
interceptors?: Interceptor[];
|
|
57
|
+
// Base URL of the platform API.
|
|
58
|
+
platformUrl: string;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* A client for interacting with the Platform using the Connect RPC framework.
|
|
63
|
+
*
|
|
64
|
+
* This client provides access to various services offered by the Platform, such as
|
|
65
|
+
* authorization, entity resolution, key access, policy management, and more. It uses
|
|
66
|
+
* the Connect RPC framework to communicate with the platform's API endpoints.
|
|
67
|
+
*
|
|
68
|
+
* This client supports authentication via an `AuthProvider` or custom interceptors, which can
|
|
69
|
+
* be used to add authentication headers or other custom logic to outgoing requests.
|
|
70
|
+
*
|
|
71
|
+
*/
|
|
72
|
+
export class PlatformClient {
|
|
73
|
+
readonly v1: PlatformServices;
|
|
74
|
+
|
|
75
|
+
constructor(options: PlatformClientOptions) {
|
|
76
|
+
const interceptors: Interceptor[] = [];
|
|
77
|
+
|
|
78
|
+
if (options.authProvider) {
|
|
79
|
+
const authInterceptor = createAuthInterceptor(options.authProvider);
|
|
80
|
+
interceptors.push(authInterceptor);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (options.interceptors?.length) {
|
|
84
|
+
interceptors.push(...options.interceptors);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const transport = createConnectTransport({
|
|
88
|
+
baseUrl: options.platformUrl,
|
|
89
|
+
interceptors,
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
this.v1 = {
|
|
93
|
+
authorization: createClient(AuthorizationService, transport),
|
|
94
|
+
entityResolution: createClient(EntityResolutionService, transport),
|
|
95
|
+
access: createClient(AccessService, transport),
|
|
96
|
+
action: createClient(ActionService, transport),
|
|
97
|
+
attributes: createClient(AttributesService, transport),
|
|
98
|
+
keyAccessServerRegistry: createClient(KeyAccessServerRegistryService, transport),
|
|
99
|
+
namespace: createClient(NamespaceService, transport),
|
|
100
|
+
resourceMapping: createClient(ResourceMappingService, transport),
|
|
101
|
+
subjectMapping: createClient(SubjectMappingService, transport),
|
|
102
|
+
unsafe: createClient(UnsafeService, transport),
|
|
103
|
+
wellknown: createClient(WellKnownService, transport),
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Creates an interceptor that adds authentication headers to outgoing requests.
|
|
110
|
+
*
|
|
111
|
+
* This function uses the provided `AuthProvider` to generate authentication credentials
|
|
112
|
+
* for each request. The `AuthProvider` is expected to implement a `withCreds` method
|
|
113
|
+
* that returns an object containing authentication headers. These headers are then
|
|
114
|
+
* added to the request before it is sent to the server.
|
|
115
|
+
*
|
|
116
|
+
* @param authProvider - An instance of `AuthProvider` used to generate authentication credentials.
|
|
117
|
+
* @returns An `Interceptor` function that modifies requests to include authentication headers.
|
|
118
|
+
*/
|
|
119
|
+
function createAuthInterceptor(authProvider: AuthProvider): Interceptor {
|
|
120
|
+
const authInterceptor: Interceptor = (next) => async (req) => {
|
|
121
|
+
const url = new URL(req.url);
|
|
122
|
+
const pathOnly = url.pathname;
|
|
123
|
+
// Signs only the path of the url in the request
|
|
124
|
+
const token = await authProvider.withCreds({
|
|
125
|
+
url: pathOnly,
|
|
126
|
+
method: 'POST',
|
|
127
|
+
headers: {
|
|
128
|
+
'Content-Type': 'application/json',
|
|
129
|
+
},
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
Object.entries(token.headers).forEach(([key, value]) => {
|
|
133
|
+
req.header.set(key, value);
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
return await next(req);
|
|
137
|
+
};
|
|
138
|
+
return authInterceptor;
|
|
139
|
+
}
|
package/src/policy/api.ts
CHANGED
|
@@ -1,61 +1,48 @@
|
|
|
1
|
-
import { NetworkError
|
|
1
|
+
import { NetworkError } from '../errors.js';
|
|
2
2
|
import { AuthProvider } from '../auth/auth.js';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { extractRpcErrorMessage, getPlatformUrlFromKasEndpoint } from '../utils.js';
|
|
4
|
+
import { PlatformClient } from '../platform.js';
|
|
5
|
+
import { Value } from './attributes.js';
|
|
6
|
+
import { GetAttributeValuesByFqnsResponse } from '../platform/policy/attributes/attributes_pb.js';
|
|
5
7
|
|
|
8
|
+
// TODO KAS: go over web-sdk and remove policyEndpoint that is only defined to be used here
|
|
6
9
|
export async function attributeFQNsAsValues(
|
|
7
|
-
|
|
10
|
+
platformUrl: string,
|
|
8
11
|
authProvider: AuthProvider,
|
|
9
12
|
...fqns: string[]
|
|
10
13
|
): Promise<Value[]> {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
avs.append('fqns', fqn);
|
|
14
|
-
}
|
|
15
|
-
avs.append('withValue.withKeyAccessGrants', 'true');
|
|
16
|
-
avs.append('withValue.withAttribute.withKeyAccessGrants', 'true');
|
|
17
|
-
const uNoSlash = rstrip(kasUrl, '/');
|
|
18
|
-
const uNoKas = uNoSlash.endsWith('/kas') ? uNoSlash.slice(0, -4) : uNoSlash;
|
|
19
|
-
const url = `${uNoKas}/attributes/*/fqn?${avs}`;
|
|
20
|
-
const req = await authProvider.withCreds({
|
|
21
|
-
url,
|
|
22
|
-
headers: {},
|
|
23
|
-
method: 'GET',
|
|
24
|
-
});
|
|
25
|
-
let response: Response;
|
|
26
|
-
try {
|
|
27
|
-
response = await fetch(req.url, {
|
|
28
|
-
mode: 'cors',
|
|
29
|
-
credentials: 'same-origin',
|
|
30
|
-
headers: req.headers,
|
|
31
|
-
redirect: 'follow',
|
|
32
|
-
referrerPolicy: 'no-referrer',
|
|
33
|
-
});
|
|
34
|
-
} catch (e) {
|
|
35
|
-
throw new NetworkError(`network error [${req.method} ${req.url}]`, e);
|
|
36
|
-
}
|
|
14
|
+
platformUrl = getPlatformUrlFromKasEndpoint(platformUrl);
|
|
15
|
+
const platform = new PlatformClient({ authProvider, platformUrl });
|
|
37
16
|
|
|
38
|
-
|
|
39
|
-
throw new ServiceError(`${req.method} ${req.url} => ${response.status} ${response.statusText}`);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
let resp: GetAttributeValuesByFqnsResponse;
|
|
17
|
+
let response: GetAttributeValuesByFqnsResponse;
|
|
43
18
|
try {
|
|
44
|
-
|
|
19
|
+
response = await platform.v1.attributes.getAttributeValuesByFqns({
|
|
20
|
+
fqns,
|
|
21
|
+
withValue: {
|
|
22
|
+
withKeyAccessGrants: true,
|
|
23
|
+
withAttribute: {
|
|
24
|
+
withKeyAccessGrants: true,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
});
|
|
45
28
|
} catch (e) {
|
|
46
|
-
throw new
|
|
29
|
+
throw new NetworkError(
|
|
30
|
+
`[${platformUrl}] [GetAttributeValuesByFqns] ${extractRpcErrorMessage(e)}`
|
|
31
|
+
);
|
|
47
32
|
}
|
|
48
33
|
|
|
49
34
|
const values: Value[] = [];
|
|
50
|
-
for (const [fqn, av] of Object.entries(
|
|
51
|
-
|
|
35
|
+
for (const [fqn, av] of Object.entries(response.fqnAttributeValues)) {
|
|
36
|
+
const value = av.value;
|
|
37
|
+
if (!value) {
|
|
52
38
|
console.log(`Missing value definition for [${fqn}]; is this a valid attribute?`);
|
|
53
39
|
continue;
|
|
54
40
|
}
|
|
55
|
-
if (av.attribute && !
|
|
56
|
-
|
|
41
|
+
if (value && av.attribute && !value?.attribute) {
|
|
42
|
+
value.attribute = av.attribute;
|
|
57
43
|
}
|
|
58
|
-
|
|
44
|
+
|
|
45
|
+
values.push(value);
|
|
59
46
|
}
|
|
60
47
|
return values;
|
|
61
48
|
}
|
package/src/policy/attributes.ts
CHANGED
|
@@ -1,117 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* created_at set by server (entity who created will recorded in an audit event)
|
|
4
|
-
* Format: date-time
|
|
5
|
-
*/
|
|
6
|
-
createdAt?: string;
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* updated_at set by server (entity who updated will recorded in an audit event)
|
|
10
|
-
* Format: date-time
|
|
11
|
-
*/
|
|
12
|
-
updatedAt?: string;
|
|
13
|
-
|
|
14
|
-
/** optional short description */
|
|
15
|
-
labels?: Record<string, string>;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export type KasPublicKeyAlgorithm =
|
|
19
|
-
| 'KAS_PUBLIC_KEY_ALG_ENUM_UNSPECIFIED'
|
|
20
|
-
| 'KAS_PUBLIC_KEY_ALG_ENUM_RSA_2048'
|
|
21
|
-
| 'KAS_PUBLIC_KEY_ALG_ENUM_EC_SECP256R1';
|
|
22
|
-
|
|
23
|
-
export type KasPublicKey = {
|
|
24
|
-
/** x509 ASN.1 content in PEM envelope, usually */
|
|
25
|
-
pem: string;
|
|
26
|
-
/** A unique string identifier for this key */
|
|
27
|
-
kid: string;
|
|
28
|
-
/**
|
|
29
|
-
* @description A known algorithm type with any additional parameters encoded.
|
|
30
|
-
* To start, these may be `rsa:2048` for encrypting ZTDF files and
|
|
31
|
-
* `ec:secp256r1` for nanoTDF, but more formats may be added as needed.
|
|
32
|
-
*/
|
|
33
|
-
alg: KasPublicKeyAlgorithm;
|
|
34
|
-
};
|
|
1
|
+
import { GetAttributeValuesByFqnsResponse } from '../platform/policy/attributes/attributes_pb.js';
|
|
2
|
+
import { AttributeRuleTypeEnum } from '../platform/policy/objects_pb.js';
|
|
35
3
|
|
|
4
|
+
export type KasPublicKey = Value['kasKeys'][number];
|
|
5
|
+
export type Value = NonNullable<
|
|
6
|
+
GetAttributeValuesByFqnsResponse['fqnAttributeValues'][string]['value']
|
|
7
|
+
>;
|
|
36
8
|
export type KasPublicKeySet = {
|
|
37
9
|
keys: KasPublicKey[];
|
|
38
10
|
};
|
|
39
11
|
|
|
40
|
-
export type
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
/** public key with additional information. Current preferred version */
|
|
46
|
-
cached?: KasPublicKeySet;
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
export type KeyAccessServer = {
|
|
50
|
-
id?: string;
|
|
51
|
-
/** Address of a KAS instance */
|
|
52
|
-
uri: string;
|
|
53
|
-
publicKey?: PublicKey;
|
|
54
|
-
metadata?: Metadata;
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
export type Namespace = {
|
|
58
|
-
/** uuid */
|
|
59
|
-
id?: string;
|
|
60
|
-
/** used to partition Attribute Definitions, support by namespace AuthN and enable federation */
|
|
61
|
-
name?: string;
|
|
62
|
-
fqn: string;
|
|
63
|
-
/** active by default until explicitly deactivated */
|
|
64
|
-
active?: boolean;
|
|
65
|
-
metadata?: Metadata;
|
|
66
|
-
grants?: KeyAccessServer[];
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
export type AttributeRuleType =
|
|
70
|
-
| 'ATTRIBUTE_RULE_TYPE_ENUM_UNSPECIFIED'
|
|
71
|
-
| 'ATTRIBUTE_RULE_TYPE_ENUM_ALL_OF'
|
|
72
|
-
| 'ATTRIBUTE_RULE_TYPE_ENUM_ANY_OF'
|
|
73
|
-
| 'ATTRIBUTE_RULE_TYPE_ENUM_HIERARCHY';
|
|
74
|
-
|
|
75
|
-
export type Attribute = {
|
|
76
|
-
/** UUID */
|
|
77
|
-
id?: string;
|
|
78
|
-
namespace?: Namespace;
|
|
79
|
-
/** attribute name */
|
|
80
|
-
name?: string;
|
|
81
|
-
/** attribute rule enum */
|
|
82
|
-
rule?: AttributeRuleType;
|
|
83
|
-
values?: Value[];
|
|
84
|
-
grants?: KeyAccessServer[];
|
|
85
|
-
fqn: string;
|
|
86
|
-
/** active by default until explicitly deactivated */
|
|
87
|
-
active?: boolean;
|
|
88
|
-
/** Common metadata */
|
|
89
|
-
metadata?: Metadata;
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
// This is not currently needed by the client, but may be returned.
|
|
93
|
-
// Setting it to unknown to allow it to be ignored for now.
|
|
94
|
-
export type SubjectMapping = unknown;
|
|
95
|
-
|
|
96
|
-
export type Value = {
|
|
97
|
-
id?: string;
|
|
98
|
-
attribute?: Attribute;
|
|
99
|
-
value?: string;
|
|
100
|
-
/** list of key access servers */
|
|
101
|
-
grants?: KeyAccessServer[];
|
|
102
|
-
fqn: string;
|
|
103
|
-
/** active by default until explicitly deactivated */
|
|
104
|
-
active?: boolean;
|
|
105
|
-
subjectMappings?: SubjectMapping[];
|
|
106
|
-
/** Common metadata */
|
|
107
|
-
metadata?: Metadata;
|
|
108
|
-
};
|
|
109
|
-
|
|
12
|
+
export type Metadata = Value['metadata'];
|
|
13
|
+
export type KeyAccessServer = Value['grants'][number];
|
|
14
|
+
export type Attribute = Value['attribute'];
|
|
15
|
+
export type SubjectMapping = Value['subjectMappings'][number];
|
|
16
|
+
export type Namespace = NonNullable<Value['attribute']>['namespace'];
|
|
110
17
|
export type AttributeAndValue = {
|
|
111
18
|
attribute: Attribute;
|
|
112
19
|
value: Value;
|
|
113
20
|
};
|
|
114
|
-
|
|
115
|
-
export type GetAttributeValuesByFqnsResponse = {
|
|
116
|
-
fqnAttributeValues: Record<string, AttributeAndValue>;
|
|
117
|
-
};
|
|
21
|
+
export { AttributeRuleTypeEnum as AttributeRuleType };
|
package/src/policy/granter.ts
CHANGED
|
@@ -36,17 +36,16 @@ type ComplexBooleanClause = {
|
|
|
36
36
|
};
|
|
37
37
|
|
|
38
38
|
export function booleanOperatorFor(rule?: AttributeRuleType): BooleanOperator {
|
|
39
|
-
if (!rule) {
|
|
40
|
-
return 'allOf';
|
|
41
|
-
}
|
|
42
39
|
switch (rule) {
|
|
43
|
-
case
|
|
44
|
-
case
|
|
40
|
+
case AttributeRuleType.UNSPECIFIED:
|
|
41
|
+
case AttributeRuleType.ALL_OF:
|
|
45
42
|
return 'allOf';
|
|
46
|
-
case
|
|
43
|
+
case AttributeRuleType.ANY_OF:
|
|
47
44
|
return 'anyOf';
|
|
48
|
-
case
|
|
45
|
+
case AttributeRuleType.HIERARCHY:
|
|
49
46
|
return 'hierarchy';
|
|
47
|
+
default:
|
|
48
|
+
return 'allOf';
|
|
50
49
|
}
|
|
51
50
|
}
|
|
52
51
|
|
|
@@ -114,7 +113,7 @@ export function plan(dataAttrs: Value[]): KeySplitStep[] {
|
|
|
114
113
|
});
|
|
115
114
|
}
|
|
116
115
|
}
|
|
117
|
-
const op = booleanOperatorFor(attrClause.def
|
|
116
|
+
const op = booleanOperatorFor(attrClause.def?.rule);
|
|
118
117
|
kcs.push({
|
|
119
118
|
op,
|
|
120
119
|
children: ccv,
|
package/src/utils.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { exportSPKI, importX509 } from 'jose';
|
|
|
3
3
|
import { base64 } from './encodings/index.js';
|
|
4
4
|
import { pemCertToCrypto, pemPublicToCrypto } from './nanotdf-crypto/pemPublicToCrypto.js';
|
|
5
5
|
import { ConfigurationError } from './errors.js';
|
|
6
|
+
import { ConnectError } from '@connectrpc/connect';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Check to see if the given URL is 'secure'. This assumes:
|
|
@@ -139,3 +140,32 @@ export async function extractPemFromKeyString(keyString: string): Promise<string
|
|
|
139
140
|
|
|
140
141
|
return pem;
|
|
141
142
|
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Extracts the error message from an RPC catch error.
|
|
146
|
+
*/
|
|
147
|
+
export function extractRpcErrorMessage(error: unknown): string {
|
|
148
|
+
if (error instanceof ConnectError || error instanceof Error) {
|
|
149
|
+
return error.message;
|
|
150
|
+
}
|
|
151
|
+
return 'Unknown network error occurred';
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Converts a KAS endpoint URL to a platform URL.
|
|
156
|
+
* If the KAS endpoint ends with '/kas', it returns the host url
|
|
157
|
+
* Otherwise, it returns the original KAS endpoint.
|
|
158
|
+
*/
|
|
159
|
+
export function getPlatformUrlFromKasEndpoint(endpoint: string): string {
|
|
160
|
+
let result = endpoint || '';
|
|
161
|
+
if (result.endsWith('/')) {
|
|
162
|
+
result = rstrip(result, '/');
|
|
163
|
+
}
|
|
164
|
+
if (result.endsWith('/v2/rewrap')) {
|
|
165
|
+
result = result.slice(0, -10);
|
|
166
|
+
}
|
|
167
|
+
if (result.endsWith('/kas')) {
|
|
168
|
+
result = result.slice(0, -4);
|
|
169
|
+
}
|
|
170
|
+
return result;
|
|
171
|
+
}
|
package/tdf3/src/client/index.ts
CHANGED
|
@@ -19,7 +19,12 @@ import { OIDCRefreshTokenProvider } from '../../../src/auth/oidc-refreshtoken-pr
|
|
|
19
19
|
import { OIDCExternalJwtProvider } from '../../../src/auth/oidc-externaljwt-provider.js';
|
|
20
20
|
import { CryptoService } from '../crypto/declarations.js';
|
|
21
21
|
import { type AuthProvider, HttpRequest, withHeaders } from '../../../src/auth/auth.js';
|
|
22
|
-
import {
|
|
22
|
+
import {
|
|
23
|
+
getPlatformUrlFromKasEndpoint,
|
|
24
|
+
pemToCryptoPublicKey,
|
|
25
|
+
rstrip,
|
|
26
|
+
validateSecureUrl,
|
|
27
|
+
} from '../../../src/utils.js';
|
|
23
28
|
|
|
24
29
|
import {
|
|
25
30
|
type EncryptParams,
|
|
@@ -299,14 +304,13 @@ export class Client {
|
|
|
299
304
|
if (!validateSecureUrl(this.kasEndpoint)) {
|
|
300
305
|
throw new ConfigurationError(`Invalid KAS endpoint [${this.kasEndpoint}]`);
|
|
301
306
|
}
|
|
307
|
+
|
|
302
308
|
if (config.platformUrl) {
|
|
303
309
|
this.platformUrl = config.platformUrl;
|
|
304
310
|
}
|
|
305
311
|
|
|
306
312
|
if (clientConfig.policyEndpoint) {
|
|
307
|
-
this.policyEndpoint =
|
|
308
|
-
} else if (this.kasEndpoint.endsWith('/kas')) {
|
|
309
|
-
this.policyEndpoint = this.kasEndpoint.slice(0, -4);
|
|
313
|
+
this.policyEndpoint = getPlatformUrlFromKasEndpoint(clientConfig.policyEndpoint);
|
|
310
314
|
}
|
|
311
315
|
|
|
312
316
|
const kasOrigin = new URL(this.kasEndpoint).origin;
|
|
@@ -439,8 +443,9 @@ export class Client {
|
|
|
439
443
|
const detailedPlan = plan(avs);
|
|
440
444
|
splitPlan = detailedPlan.map((kat) => {
|
|
441
445
|
const { kas, sid } = kat;
|
|
442
|
-
|
|
443
|
-
|
|
446
|
+
const pubKey = kas.publicKey?.publicKey;
|
|
447
|
+
if (pubKey?.case === 'cached' && pubKey.value.keys && !(kas.uri in this.kasKeys)) {
|
|
448
|
+
const keys = pubKey.value.keys;
|
|
444
449
|
if (keys?.length) {
|
|
445
450
|
this.kasKeys[kas.uri] = keys.map((key) => resolveKasInfo(key.pem, kas.uri, key.kid));
|
|
446
451
|
}
|
package/tdf3/src/tdf.ts
CHANGED
|
@@ -766,9 +766,8 @@ async function unwrapKey({
|
|
|
766
766
|
|
|
767
767
|
const { entityWrappedKey, metadata, sessionPublicKey } = await fetchWrappedKey(
|
|
768
768
|
url,
|
|
769
|
-
|
|
770
|
-
authProvider
|
|
771
|
-
'0.0.1'
|
|
769
|
+
signedRequestToken,
|
|
770
|
+
authProvider
|
|
772
771
|
);
|
|
773
772
|
|
|
774
773
|
if (wrappingKeyAlgorithm === 'ec:secp256r1') {
|
|
@@ -778,7 +777,7 @@ async function unwrapKey({
|
|
|
778
777
|
hkdfSalt: await ztdfSalt,
|
|
779
778
|
hkdfHash: 'SHA-256',
|
|
780
779
|
});
|
|
781
|
-
const wrappedKeyAndNonce =
|
|
780
|
+
const wrappedKeyAndNonce = entityWrappedKey;
|
|
782
781
|
const iv = wrappedKeyAndNonce.slice(0, 12);
|
|
783
782
|
const wrappedKey = wrappedKeyAndNonce.slice(12);
|
|
784
783
|
|
|
@@ -789,7 +788,7 @@ async function unwrapKey({
|
|
|
789
788
|
metadata,
|
|
790
789
|
};
|
|
791
790
|
}
|
|
792
|
-
const key = Binary.
|
|
791
|
+
const key = Binary.fromArrayBuffer(entityWrappedKey);
|
|
793
792
|
const decryptedKeyBinary = await cryptoService.decryptWithPrivateKey(
|
|
794
793
|
key,
|
|
795
794
|
ephemeralEncryptionKeys.privateKey
|
|
@@ -991,13 +990,6 @@ export async function readStream(cfg: DecryptConfiguration) {
|
|
|
991
990
|
return decryptStreamFrom(cfg, overview);
|
|
992
991
|
}
|
|
993
992
|
|
|
994
|
-
// TODO: potentially might need fixing here
|
|
995
|
-
// By the time this function is called the allow list will be already set.
|
|
996
|
-
// Verify that this function is not exported in the sdk and only exported for internal use
|
|
997
|
-
// Verify this during tests and PR
|
|
998
|
-
// Remove this comment before merging!
|
|
999
|
-
// https://www.youtube.com/watch?v=NGrLb6W5YOM
|
|
1000
|
-
// Don't leave me here all by myself!
|
|
1001
993
|
export async function decryptStreamFrom(
|
|
1002
994
|
cfg: DecryptConfiguration,
|
|
1003
995
|
{ manifest, zipReader, centralDirectory }: InspectedTDFOverview
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
// @generated by protoc-gen-connect-es v1.4.0 with parameter "target=js+dts,import_extension=none"
|
|
2
|
-
// @generated from file authorization/authorization.proto (package authorization, syntax proto3)
|
|
3
|
-
/* eslint-disable */
|
|
4
|
-
// @ts-nocheck
|
|
5
|
-
|
|
6
|
-
import { GetDecisionsByTokenRequest, GetDecisionsByTokenResponse, GetDecisionsRequest, GetDecisionsResponse, GetEntitlementsRequest, GetEntitlementsResponse } from "./authorization_pb";
|
|
7
|
-
import { MethodKind } from "@bufbuild/protobuf";
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* @generated from service authorization.AuthorizationService
|
|
11
|
-
*/
|
|
12
|
-
export declare const AuthorizationService: {
|
|
13
|
-
readonly typeName: "authorization.AuthorizationService",
|
|
14
|
-
readonly methods: {
|
|
15
|
-
/**
|
|
16
|
-
* @generated from rpc authorization.AuthorizationService.GetDecisions
|
|
17
|
-
*/
|
|
18
|
-
readonly getDecisions: {
|
|
19
|
-
readonly name: "GetDecisions",
|
|
20
|
-
readonly I: typeof GetDecisionsRequest,
|
|
21
|
-
readonly O: typeof GetDecisionsResponse,
|
|
22
|
-
readonly kind: MethodKind.Unary,
|
|
23
|
-
},
|
|
24
|
-
/**
|
|
25
|
-
* @generated from rpc authorization.AuthorizationService.GetDecisionsByToken
|
|
26
|
-
*/
|
|
27
|
-
readonly getDecisionsByToken: {
|
|
28
|
-
readonly name: "GetDecisionsByToken",
|
|
29
|
-
readonly I: typeof GetDecisionsByTokenRequest,
|
|
30
|
-
readonly O: typeof GetDecisionsByTokenResponse,
|
|
31
|
-
readonly kind: MethodKind.Unary,
|
|
32
|
-
},
|
|
33
|
-
/**
|
|
34
|
-
* @generated from rpc authorization.AuthorizationService.GetEntitlements
|
|
35
|
-
*/
|
|
36
|
-
readonly getEntitlements: {
|
|
37
|
-
readonly name: "GetEntitlements",
|
|
38
|
-
readonly I: typeof GetEntitlementsRequest,
|
|
39
|
-
readonly O: typeof GetEntitlementsResponse,
|
|
40
|
-
readonly kind: MethodKind.Unary,
|
|
41
|
-
},
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
|