@sphereon/ssi-sdk.kms-rest-client 0.36.1-feature.SSISDK.44.finish.dcql.1 → 0.36.1-feature.SSISDK.70.integrate.digidentity.10
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/index.cjs +82 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +28 -52
- package/dist/index.d.ts +28 -52
- package/dist/index.js +82 -20
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/agent/KmsRestClient.ts +55 -42
- package/src/types/IKmsRestClient.ts +43 -60
package/dist/index.cjs
CHANGED
|
@@ -3638,7 +3638,11 @@ var KmsRestClient = class _KmsRestClient {
|
|
|
3638
3638
|
const baseUrl = this.assertedAgentBaseUrl(args.baseUrl);
|
|
3639
3639
|
const url = _KmsRestClient.urlWithBase(`/resolvers/${args.resolverId}`, baseUrl);
|
|
3640
3640
|
const response = await (0, import_cross_fetch.fetch)(url, {
|
|
3641
|
-
method: "GET"
|
|
3641
|
+
method: "GET",
|
|
3642
|
+
headers: await this.createHeaders({
|
|
3643
|
+
tenantId: args.tenantId,
|
|
3644
|
+
userId: args.userId
|
|
3645
|
+
})
|
|
3642
3646
|
});
|
|
3643
3647
|
logger.debug(`get resolver response: ${response}`);
|
|
3644
3648
|
if (!response.ok) {
|
|
@@ -3651,7 +3655,11 @@ var KmsRestClient = class _KmsRestClient {
|
|
|
3651
3655
|
const baseUrl = this.assertedAgentBaseUrl(args?.baseUrl);
|
|
3652
3656
|
const url = _KmsRestClient.urlWithBase("/resolvers", baseUrl);
|
|
3653
3657
|
const response = await (0, import_cross_fetch.fetch)(url, {
|
|
3654
|
-
method: "GET"
|
|
3658
|
+
method: "GET",
|
|
3659
|
+
headers: await this.createHeaders({
|
|
3660
|
+
tenantId: args?.tenantId,
|
|
3661
|
+
userId: args?.userId
|
|
3662
|
+
})
|
|
3655
3663
|
});
|
|
3656
3664
|
logger.debug(`list resolvers response: ${response}`);
|
|
3657
3665
|
if (!response.ok) {
|
|
@@ -3672,7 +3680,9 @@ var KmsRestClient = class _KmsRestClient {
|
|
|
3672
3680
|
const response = await (0, import_cross_fetch.fetch)(url, {
|
|
3673
3681
|
method: "POST",
|
|
3674
3682
|
headers: await this.createHeaders({
|
|
3675
|
-
|
|
3683
|
+
contentType: "application/json",
|
|
3684
|
+
tenantId: args.tenantId,
|
|
3685
|
+
userId: args.userId
|
|
3676
3686
|
}),
|
|
3677
3687
|
body: JSON.stringify(ResolvePublicKeyToJSONTyped(body))
|
|
3678
3688
|
});
|
|
@@ -3685,7 +3695,7 @@ var KmsRestClient = class _KmsRestClient {
|
|
|
3685
3695
|
/** {@inheritDoc IKmsRestClient.kmsCreateRawSignature} */
|
|
3686
3696
|
async kmsClientCreateRawSignature(args) {
|
|
3687
3697
|
const baseUrl = this.assertedAgentBaseUrl(args.baseUrl);
|
|
3688
|
-
const url = _KmsRestClient.urlWithBase(`/signatures/raw`, baseUrl);
|
|
3698
|
+
const url = _KmsRestClient.urlWithBase(`/signatures/raw/create`, baseUrl);
|
|
3689
3699
|
const body = {
|
|
3690
3700
|
keyInfo: args.keyInfo,
|
|
3691
3701
|
input: args.input
|
|
@@ -3693,7 +3703,9 @@ var KmsRestClient = class _KmsRestClient {
|
|
|
3693
3703
|
const response = await (0, import_cross_fetch.fetch)(url, {
|
|
3694
3704
|
method: "POST",
|
|
3695
3705
|
headers: await this.createHeaders({
|
|
3696
|
-
|
|
3706
|
+
contentType: "application/json",
|
|
3707
|
+
tenantId: args.tenantId,
|
|
3708
|
+
userId: args.userId
|
|
3697
3709
|
}),
|
|
3698
3710
|
body: JSON.stringify(CreateRawSignatureToJSONTyped(body))
|
|
3699
3711
|
});
|
|
@@ -3715,7 +3727,9 @@ var KmsRestClient = class _KmsRestClient {
|
|
|
3715
3727
|
const response = await (0, import_cross_fetch.fetch)(url, {
|
|
3716
3728
|
method: "POST",
|
|
3717
3729
|
headers: await this.createHeaders({
|
|
3718
|
-
|
|
3730
|
+
contentType: "application/json",
|
|
3731
|
+
tenantId: args.tenantId,
|
|
3732
|
+
userId: args.userId
|
|
3719
3733
|
}),
|
|
3720
3734
|
body: JSON.stringify(VerifyRawSignatureToJSONTyped(body))
|
|
3721
3735
|
});
|
|
@@ -3730,7 +3744,11 @@ var KmsRestClient = class _KmsRestClient {
|
|
|
3730
3744
|
const baseUrl = this.assertedAgentBaseUrl(args.baseUrl);
|
|
3731
3745
|
const url = _KmsRestClient.urlWithBase(`/keys/${args.aliasOrKid}`, baseUrl);
|
|
3732
3746
|
const response = await (0, import_cross_fetch.fetch)(url, {
|
|
3733
|
-
method: "GET"
|
|
3747
|
+
method: "GET",
|
|
3748
|
+
headers: await this.createHeaders({
|
|
3749
|
+
tenantId: args.tenantId,
|
|
3750
|
+
userId: args.userId
|
|
3751
|
+
})
|
|
3734
3752
|
});
|
|
3735
3753
|
logger.debug(`get key response: ${response}`);
|
|
3736
3754
|
if (!response.ok) {
|
|
@@ -3747,7 +3765,11 @@ var KmsRestClient = class _KmsRestClient {
|
|
|
3747
3765
|
}
|
|
3748
3766
|
});
|
|
3749
3767
|
const response = await (0, import_cross_fetch.fetch)(url, {
|
|
3750
|
-
method: "GET"
|
|
3768
|
+
method: "GET",
|
|
3769
|
+
headers: await this.createHeaders({
|
|
3770
|
+
tenantId: args?.tenantId,
|
|
3771
|
+
userId: args?.userId
|
|
3772
|
+
})
|
|
3751
3773
|
});
|
|
3752
3774
|
logger.debug(`list keys response: ${response}`);
|
|
3753
3775
|
if (!response.ok) {
|
|
@@ -3766,7 +3788,9 @@ var KmsRestClient = class _KmsRestClient {
|
|
|
3766
3788
|
const response = await (0, import_cross_fetch.fetch)(url, {
|
|
3767
3789
|
method: "POST",
|
|
3768
3790
|
headers: await this.createHeaders({
|
|
3769
|
-
|
|
3791
|
+
contentType: "application/json",
|
|
3792
|
+
tenantId: args.tenantId,
|
|
3793
|
+
userId: args.userId
|
|
3770
3794
|
}),
|
|
3771
3795
|
body: JSON.stringify(StoreKeyToJSONTyped(body))
|
|
3772
3796
|
});
|
|
@@ -3789,7 +3813,9 @@ var KmsRestClient = class _KmsRestClient {
|
|
|
3789
3813
|
const response = await (0, import_cross_fetch.fetch)(url, {
|
|
3790
3814
|
method: "POST",
|
|
3791
3815
|
headers: await this.createHeaders({
|
|
3792
|
-
|
|
3816
|
+
contentType: "application/json",
|
|
3817
|
+
tenantId: args.tenantId,
|
|
3818
|
+
userId: args.userId
|
|
3793
3819
|
}),
|
|
3794
3820
|
body: JSON.stringify(GenerateKeyGlobalToJSONTyped(body))
|
|
3795
3821
|
});
|
|
@@ -3804,7 +3830,11 @@ var KmsRestClient = class _KmsRestClient {
|
|
|
3804
3830
|
const baseUrl = this.assertedAgentBaseUrl(args.baseUrl);
|
|
3805
3831
|
const url = _KmsRestClient.urlWithBase(`/keys/${args.aliasOrKid}`, baseUrl);
|
|
3806
3832
|
const response = await (0, import_cross_fetch.fetch)(url, {
|
|
3807
|
-
method: "DELETE"
|
|
3833
|
+
method: "DELETE",
|
|
3834
|
+
headers: await this.createHeaders({
|
|
3835
|
+
tenantId: args.tenantId,
|
|
3836
|
+
userId: args.userId
|
|
3837
|
+
})
|
|
3808
3838
|
});
|
|
3809
3839
|
logger.debug(`delete key response: ${response}`);
|
|
3810
3840
|
if (!response.ok) {
|
|
@@ -3817,7 +3847,11 @@ var KmsRestClient = class _KmsRestClient {
|
|
|
3817
3847
|
const baseUrl = this.assertedAgentBaseUrl(args.baseUrl);
|
|
3818
3848
|
const url = _KmsRestClient.urlWithBase(`/providers/${args.providerId}`, baseUrl);
|
|
3819
3849
|
const response = await (0, import_cross_fetch.fetch)(url, {
|
|
3820
|
-
method: "GET"
|
|
3850
|
+
method: "GET",
|
|
3851
|
+
headers: await this.createHeaders({
|
|
3852
|
+
tenantId: args.tenantId,
|
|
3853
|
+
userId: args.userId
|
|
3854
|
+
})
|
|
3821
3855
|
});
|
|
3822
3856
|
logger.debug(`get provider response: ${response}`);
|
|
3823
3857
|
if (!response.ok) {
|
|
@@ -3830,7 +3864,11 @@ var KmsRestClient = class _KmsRestClient {
|
|
|
3830
3864
|
const baseUrl = this.assertedAgentBaseUrl(args?.baseUrl);
|
|
3831
3865
|
const url = _KmsRestClient.urlWithBase("/providers", baseUrl);
|
|
3832
3866
|
const response = await (0, import_cross_fetch.fetch)(url, {
|
|
3833
|
-
method: "GET"
|
|
3867
|
+
method: "GET",
|
|
3868
|
+
headers: await this.createHeaders({
|
|
3869
|
+
tenantId: args?.tenantId,
|
|
3870
|
+
userId: args?.userId
|
|
3871
|
+
})
|
|
3834
3872
|
});
|
|
3835
3873
|
logger.debug(`list providers response: ${response}`);
|
|
3836
3874
|
if (!response.ok) {
|
|
@@ -3843,7 +3881,11 @@ var KmsRestClient = class _KmsRestClient {
|
|
|
3843
3881
|
const baseUrl = this.assertedAgentBaseUrl(args.baseUrl);
|
|
3844
3882
|
const url = _KmsRestClient.urlWithBase(`/providers/${args.providerId}/keys`, baseUrl);
|
|
3845
3883
|
const response = await (0, import_cross_fetch.fetch)(url, {
|
|
3846
|
-
method: "GET"
|
|
3884
|
+
method: "GET",
|
|
3885
|
+
headers: await this.createHeaders({
|
|
3886
|
+
tenantId: args.tenantId,
|
|
3887
|
+
userId: args.userId
|
|
3888
|
+
})
|
|
3847
3889
|
});
|
|
3848
3890
|
logger.debug(`list provider keys response: ${response}`);
|
|
3849
3891
|
if (!response.ok) {
|
|
@@ -3862,7 +3904,9 @@ var KmsRestClient = class _KmsRestClient {
|
|
|
3862
3904
|
const response = await (0, import_cross_fetch.fetch)(url, {
|
|
3863
3905
|
method: "POST",
|
|
3864
3906
|
headers: await this.createHeaders({
|
|
3865
|
-
|
|
3907
|
+
contentType: "application/json",
|
|
3908
|
+
tenantId: args.tenantId,
|
|
3909
|
+
userId: args.userId
|
|
3866
3910
|
}),
|
|
3867
3911
|
body: JSON.stringify(StoreKeyToJSONTyped(body))
|
|
3868
3912
|
});
|
|
@@ -3885,7 +3929,9 @@ var KmsRestClient = class _KmsRestClient {
|
|
|
3885
3929
|
const response = await (0, import_cross_fetch.fetch)(url, {
|
|
3886
3930
|
method: "POST",
|
|
3887
3931
|
headers: await this.createHeaders({
|
|
3888
|
-
|
|
3932
|
+
contentType: "application/json",
|
|
3933
|
+
tenantId: args.tenantId,
|
|
3934
|
+
userId: args.userId
|
|
3889
3935
|
}),
|
|
3890
3936
|
body: JSON.stringify(GenerateKeyToJSONTyped(body))
|
|
3891
3937
|
});
|
|
@@ -3900,7 +3946,11 @@ var KmsRestClient = class _KmsRestClient {
|
|
|
3900
3946
|
const baseUrl = this.assertedAgentBaseUrl(args.baseUrl);
|
|
3901
3947
|
const url = _KmsRestClient.urlWithBase(`/providers/${args.providerId}/keys/${args.aliasOrKid}`, baseUrl);
|
|
3902
3948
|
const response = await (0, import_cross_fetch.fetch)(url, {
|
|
3903
|
-
method: "GET"
|
|
3949
|
+
method: "GET",
|
|
3950
|
+
headers: await this.createHeaders({
|
|
3951
|
+
tenantId: args.tenantId,
|
|
3952
|
+
userId: args.userId
|
|
3953
|
+
})
|
|
3904
3954
|
});
|
|
3905
3955
|
logger.debug(`get provider key response: ${response}`);
|
|
3906
3956
|
if (!response.ok) {
|
|
@@ -3913,7 +3963,11 @@ var KmsRestClient = class _KmsRestClient {
|
|
|
3913
3963
|
const baseUrl = this.assertedAgentBaseUrl(args.baseUrl);
|
|
3914
3964
|
const url = _KmsRestClient.urlWithBase(`providers/${args.providerId}/keys/${args.aliasOrKid}`, baseUrl);
|
|
3915
3965
|
const response = await (0, import_cross_fetch.fetch)(url, {
|
|
3916
|
-
method: "DELETE"
|
|
3966
|
+
method: "DELETE",
|
|
3967
|
+
headers: await this.createHeaders({
|
|
3968
|
+
tenantId: args.tenantId,
|
|
3969
|
+
userId: args.userId
|
|
3970
|
+
})
|
|
3917
3971
|
});
|
|
3918
3972
|
logger.debug(`delete key response: ${response}`);
|
|
3919
3973
|
if (!response.ok) {
|
|
@@ -3929,9 +3983,17 @@ var KmsRestClient = class _KmsRestClient {
|
|
|
3929
3983
|
}
|
|
3930
3984
|
throw new Error("No base url has been provided");
|
|
3931
3985
|
}
|
|
3932
|
-
async createHeaders(
|
|
3986
|
+
async createHeaders(args) {
|
|
3933
3987
|
const headers = {
|
|
3934
|
-
...
|
|
3988
|
+
...args?.contentType ? {
|
|
3989
|
+
"Content-Type": args.contentType
|
|
3990
|
+
} : {},
|
|
3991
|
+
...args?.tenantId ? {
|
|
3992
|
+
"X-Tenant-ID": args.tenantId
|
|
3993
|
+
} : {},
|
|
3994
|
+
...args?.userId ? {
|
|
3995
|
+
"X-User-ID": args.userId
|
|
3996
|
+
} : {},
|
|
3935
3997
|
Accept: "application/json"
|
|
3936
3998
|
};
|
|
3937
3999
|
if (this.authOpts?.enabled === true) {
|