@sphereon/ssi-sdk.kms-rest-client 0.36.1-feature.SSISDK.70.integrate.digidentity.57 → 0.36.1-feature.SSISDK.78.41
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 +20 -85
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +52 -31
- package/dist/index.d.ts +52 -31
- package/dist/index.js +20 -85
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/agent/KmsRestClient.ts +42 -55
- package/src/models/SignatureAlgorithm.ts +0 -3
- package/src/types/IKmsRestClient.ts +60 -43
package/dist/index.cjs
CHANGED
|
@@ -1996,9 +1996,6 @@ var SignatureAlgorithm = {
|
|
|
1996
1996
|
HmacSha256: "HMAC_SHA256",
|
|
1997
1997
|
HmacSha384: "HMAC_SHA384",
|
|
1998
1998
|
HmacSha512: "HMAC_SHA512",
|
|
1999
|
-
RsaSha256: "RSA_SHA256",
|
|
2000
|
-
RsaSha384: "RSA_SHA384",
|
|
2001
|
-
RsaSha512: "RSA_SHA512",
|
|
2002
1999
|
RsaSsaPssSha256Mgf1: "RSA_SSA_PSS_SHA256_MGF1",
|
|
2003
2000
|
RsaSsaPssSha384Mgf1: "RSA_SSA_PSS_SHA384_MGF1",
|
|
2004
2001
|
RsaSsaPssSha512Mgf1: "RSA_SSA_PSS_SHA512_MGF1"
|
|
@@ -3641,11 +3638,7 @@ var KmsRestClient = class _KmsRestClient {
|
|
|
3641
3638
|
const baseUrl = this.assertedAgentBaseUrl(args.baseUrl);
|
|
3642
3639
|
const url = _KmsRestClient.urlWithBase(`/resolvers/${args.resolverId}`, baseUrl);
|
|
3643
3640
|
const response = await (0, import_cross_fetch.fetch)(url, {
|
|
3644
|
-
method: "GET"
|
|
3645
|
-
headers: await this.createHeaders({
|
|
3646
|
-
tenantId: args.tenantId,
|
|
3647
|
-
userId: args.userId
|
|
3648
|
-
})
|
|
3641
|
+
method: "GET"
|
|
3649
3642
|
});
|
|
3650
3643
|
logger.debug(`get resolver response: ${response}`);
|
|
3651
3644
|
if (!response.ok) {
|
|
@@ -3658,11 +3651,7 @@ var KmsRestClient = class _KmsRestClient {
|
|
|
3658
3651
|
const baseUrl = this.assertedAgentBaseUrl(args?.baseUrl);
|
|
3659
3652
|
const url = _KmsRestClient.urlWithBase("/resolvers", baseUrl);
|
|
3660
3653
|
const response = await (0, import_cross_fetch.fetch)(url, {
|
|
3661
|
-
method: "GET"
|
|
3662
|
-
headers: await this.createHeaders({
|
|
3663
|
-
tenantId: args?.tenantId,
|
|
3664
|
-
userId: args?.userId
|
|
3665
|
-
})
|
|
3654
|
+
method: "GET"
|
|
3666
3655
|
});
|
|
3667
3656
|
logger.debug(`list resolvers response: ${response}`);
|
|
3668
3657
|
if (!response.ok) {
|
|
@@ -3683,9 +3672,7 @@ var KmsRestClient = class _KmsRestClient {
|
|
|
3683
3672
|
const response = await (0, import_cross_fetch.fetch)(url, {
|
|
3684
3673
|
method: "POST",
|
|
3685
3674
|
headers: await this.createHeaders({
|
|
3686
|
-
|
|
3687
|
-
tenantId: args.tenantId,
|
|
3688
|
-
userId: args.userId
|
|
3675
|
+
"Content-Type": "application/json"
|
|
3689
3676
|
}),
|
|
3690
3677
|
body: JSON.stringify(ResolvePublicKeyToJSONTyped(body))
|
|
3691
3678
|
});
|
|
@@ -3698,7 +3685,7 @@ var KmsRestClient = class _KmsRestClient {
|
|
|
3698
3685
|
/** {@inheritDoc IKmsRestClient.kmsCreateRawSignature} */
|
|
3699
3686
|
async kmsClientCreateRawSignature(args) {
|
|
3700
3687
|
const baseUrl = this.assertedAgentBaseUrl(args.baseUrl);
|
|
3701
|
-
const url = _KmsRestClient.urlWithBase(`/signatures/raw
|
|
3688
|
+
const url = _KmsRestClient.urlWithBase(`/signatures/raw`, baseUrl);
|
|
3702
3689
|
const body = {
|
|
3703
3690
|
keyInfo: args.keyInfo,
|
|
3704
3691
|
input: args.input
|
|
@@ -3706,9 +3693,7 @@ var KmsRestClient = class _KmsRestClient {
|
|
|
3706
3693
|
const response = await (0, import_cross_fetch.fetch)(url, {
|
|
3707
3694
|
method: "POST",
|
|
3708
3695
|
headers: await this.createHeaders({
|
|
3709
|
-
|
|
3710
|
-
tenantId: args.tenantId,
|
|
3711
|
-
userId: args.userId
|
|
3696
|
+
"Content-Type": "application/json"
|
|
3712
3697
|
}),
|
|
3713
3698
|
body: JSON.stringify(CreateRawSignatureToJSONTyped(body))
|
|
3714
3699
|
});
|
|
@@ -3730,9 +3715,7 @@ var KmsRestClient = class _KmsRestClient {
|
|
|
3730
3715
|
const response = await (0, import_cross_fetch.fetch)(url, {
|
|
3731
3716
|
method: "POST",
|
|
3732
3717
|
headers: await this.createHeaders({
|
|
3733
|
-
|
|
3734
|
-
tenantId: args.tenantId,
|
|
3735
|
-
userId: args.userId
|
|
3718
|
+
"Content-Type": "application/json"
|
|
3736
3719
|
}),
|
|
3737
3720
|
body: JSON.stringify(VerifyRawSignatureToJSONTyped(body))
|
|
3738
3721
|
});
|
|
@@ -3747,11 +3730,7 @@ var KmsRestClient = class _KmsRestClient {
|
|
|
3747
3730
|
const baseUrl = this.assertedAgentBaseUrl(args.baseUrl);
|
|
3748
3731
|
const url = _KmsRestClient.urlWithBase(`/keys/${args.aliasOrKid}`, baseUrl);
|
|
3749
3732
|
const response = await (0, import_cross_fetch.fetch)(url, {
|
|
3750
|
-
method: "GET"
|
|
3751
|
-
headers: await this.createHeaders({
|
|
3752
|
-
tenantId: args.tenantId,
|
|
3753
|
-
userId: args.userId
|
|
3754
|
-
})
|
|
3733
|
+
method: "GET"
|
|
3755
3734
|
});
|
|
3756
3735
|
logger.debug(`get key response: ${response}`);
|
|
3757
3736
|
if (!response.ok) {
|
|
@@ -3768,11 +3747,7 @@ var KmsRestClient = class _KmsRestClient {
|
|
|
3768
3747
|
}
|
|
3769
3748
|
});
|
|
3770
3749
|
const response = await (0, import_cross_fetch.fetch)(url, {
|
|
3771
|
-
method: "GET"
|
|
3772
|
-
headers: await this.createHeaders({
|
|
3773
|
-
tenantId: args?.tenantId,
|
|
3774
|
-
userId: args?.userId
|
|
3775
|
-
})
|
|
3750
|
+
method: "GET"
|
|
3776
3751
|
});
|
|
3777
3752
|
logger.debug(`list keys response: ${response}`);
|
|
3778
3753
|
if (!response.ok) {
|
|
@@ -3791,9 +3766,7 @@ var KmsRestClient = class _KmsRestClient {
|
|
|
3791
3766
|
const response = await (0, import_cross_fetch.fetch)(url, {
|
|
3792
3767
|
method: "POST",
|
|
3793
3768
|
headers: await this.createHeaders({
|
|
3794
|
-
|
|
3795
|
-
tenantId: args.tenantId,
|
|
3796
|
-
userId: args.userId
|
|
3769
|
+
"Content-Type": "application/json"
|
|
3797
3770
|
}),
|
|
3798
3771
|
body: JSON.stringify(StoreKeyToJSONTyped(body))
|
|
3799
3772
|
});
|
|
@@ -3816,9 +3789,7 @@ var KmsRestClient = class _KmsRestClient {
|
|
|
3816
3789
|
const response = await (0, import_cross_fetch.fetch)(url, {
|
|
3817
3790
|
method: "POST",
|
|
3818
3791
|
headers: await this.createHeaders({
|
|
3819
|
-
|
|
3820
|
-
tenantId: args.tenantId,
|
|
3821
|
-
userId: args.userId
|
|
3792
|
+
"Content-Type": "application/json"
|
|
3822
3793
|
}),
|
|
3823
3794
|
body: JSON.stringify(GenerateKeyGlobalToJSONTyped(body))
|
|
3824
3795
|
});
|
|
@@ -3833,11 +3804,7 @@ var KmsRestClient = class _KmsRestClient {
|
|
|
3833
3804
|
const baseUrl = this.assertedAgentBaseUrl(args.baseUrl);
|
|
3834
3805
|
const url = _KmsRestClient.urlWithBase(`/keys/${args.aliasOrKid}`, baseUrl);
|
|
3835
3806
|
const response = await (0, import_cross_fetch.fetch)(url, {
|
|
3836
|
-
method: "DELETE"
|
|
3837
|
-
headers: await this.createHeaders({
|
|
3838
|
-
tenantId: args.tenantId,
|
|
3839
|
-
userId: args.userId
|
|
3840
|
-
})
|
|
3807
|
+
method: "DELETE"
|
|
3841
3808
|
});
|
|
3842
3809
|
logger.debug(`delete key response: ${response}`);
|
|
3843
3810
|
if (!response.ok) {
|
|
@@ -3850,11 +3817,7 @@ var KmsRestClient = class _KmsRestClient {
|
|
|
3850
3817
|
const baseUrl = this.assertedAgentBaseUrl(args.baseUrl);
|
|
3851
3818
|
const url = _KmsRestClient.urlWithBase(`/providers/${args.providerId}`, baseUrl);
|
|
3852
3819
|
const response = await (0, import_cross_fetch.fetch)(url, {
|
|
3853
|
-
method: "GET"
|
|
3854
|
-
headers: await this.createHeaders({
|
|
3855
|
-
tenantId: args.tenantId,
|
|
3856
|
-
userId: args.userId
|
|
3857
|
-
})
|
|
3820
|
+
method: "GET"
|
|
3858
3821
|
});
|
|
3859
3822
|
logger.debug(`get provider response: ${response}`);
|
|
3860
3823
|
if (!response.ok) {
|
|
@@ -3867,11 +3830,7 @@ var KmsRestClient = class _KmsRestClient {
|
|
|
3867
3830
|
const baseUrl = this.assertedAgentBaseUrl(args?.baseUrl);
|
|
3868
3831
|
const url = _KmsRestClient.urlWithBase("/providers", baseUrl);
|
|
3869
3832
|
const response = await (0, import_cross_fetch.fetch)(url, {
|
|
3870
|
-
method: "GET"
|
|
3871
|
-
headers: await this.createHeaders({
|
|
3872
|
-
tenantId: args?.tenantId,
|
|
3873
|
-
userId: args?.userId
|
|
3874
|
-
})
|
|
3833
|
+
method: "GET"
|
|
3875
3834
|
});
|
|
3876
3835
|
logger.debug(`list providers response: ${response}`);
|
|
3877
3836
|
if (!response.ok) {
|
|
@@ -3884,11 +3843,7 @@ var KmsRestClient = class _KmsRestClient {
|
|
|
3884
3843
|
const baseUrl = this.assertedAgentBaseUrl(args.baseUrl);
|
|
3885
3844
|
const url = _KmsRestClient.urlWithBase(`/providers/${args.providerId}/keys`, baseUrl);
|
|
3886
3845
|
const response = await (0, import_cross_fetch.fetch)(url, {
|
|
3887
|
-
method: "GET"
|
|
3888
|
-
headers: await this.createHeaders({
|
|
3889
|
-
tenantId: args.tenantId,
|
|
3890
|
-
userId: args.userId
|
|
3891
|
-
})
|
|
3846
|
+
method: "GET"
|
|
3892
3847
|
});
|
|
3893
3848
|
logger.debug(`list provider keys response: ${response}`);
|
|
3894
3849
|
if (!response.ok) {
|
|
@@ -3907,9 +3862,7 @@ var KmsRestClient = class _KmsRestClient {
|
|
|
3907
3862
|
const response = await (0, import_cross_fetch.fetch)(url, {
|
|
3908
3863
|
method: "POST",
|
|
3909
3864
|
headers: await this.createHeaders({
|
|
3910
|
-
|
|
3911
|
-
tenantId: args.tenantId,
|
|
3912
|
-
userId: args.userId
|
|
3865
|
+
"Content-Type": "application/json"
|
|
3913
3866
|
}),
|
|
3914
3867
|
body: JSON.stringify(StoreKeyToJSONTyped(body))
|
|
3915
3868
|
});
|
|
@@ -3932,9 +3885,7 @@ var KmsRestClient = class _KmsRestClient {
|
|
|
3932
3885
|
const response = await (0, import_cross_fetch.fetch)(url, {
|
|
3933
3886
|
method: "POST",
|
|
3934
3887
|
headers: await this.createHeaders({
|
|
3935
|
-
|
|
3936
|
-
tenantId: args.tenantId,
|
|
3937
|
-
userId: args.userId
|
|
3888
|
+
"Content-Type": "application/json"
|
|
3938
3889
|
}),
|
|
3939
3890
|
body: JSON.stringify(GenerateKeyToJSONTyped(body))
|
|
3940
3891
|
});
|
|
@@ -3949,11 +3900,7 @@ var KmsRestClient = class _KmsRestClient {
|
|
|
3949
3900
|
const baseUrl = this.assertedAgentBaseUrl(args.baseUrl);
|
|
3950
3901
|
const url = _KmsRestClient.urlWithBase(`/providers/${args.providerId}/keys/${args.aliasOrKid}`, baseUrl);
|
|
3951
3902
|
const response = await (0, import_cross_fetch.fetch)(url, {
|
|
3952
|
-
method: "GET"
|
|
3953
|
-
headers: await this.createHeaders({
|
|
3954
|
-
tenantId: args.tenantId,
|
|
3955
|
-
userId: args.userId
|
|
3956
|
-
})
|
|
3903
|
+
method: "GET"
|
|
3957
3904
|
});
|
|
3958
3905
|
logger.debug(`get provider key response: ${response}`);
|
|
3959
3906
|
if (!response.ok) {
|
|
@@ -3966,11 +3913,7 @@ var KmsRestClient = class _KmsRestClient {
|
|
|
3966
3913
|
const baseUrl = this.assertedAgentBaseUrl(args.baseUrl);
|
|
3967
3914
|
const url = _KmsRestClient.urlWithBase(`providers/${args.providerId}/keys/${args.aliasOrKid}`, baseUrl);
|
|
3968
3915
|
const response = await (0, import_cross_fetch.fetch)(url, {
|
|
3969
|
-
method: "DELETE"
|
|
3970
|
-
headers: await this.createHeaders({
|
|
3971
|
-
tenantId: args.tenantId,
|
|
3972
|
-
userId: args.userId
|
|
3973
|
-
})
|
|
3916
|
+
method: "DELETE"
|
|
3974
3917
|
});
|
|
3975
3918
|
logger.debug(`delete key response: ${response}`);
|
|
3976
3919
|
if (!response.ok) {
|
|
@@ -3986,17 +3929,9 @@ var KmsRestClient = class _KmsRestClient {
|
|
|
3986
3929
|
}
|
|
3987
3930
|
throw new Error("No base url has been provided");
|
|
3988
3931
|
}
|
|
3989
|
-
async createHeaders(
|
|
3932
|
+
async createHeaders(existing) {
|
|
3990
3933
|
const headers = {
|
|
3991
|
-
...
|
|
3992
|
-
"Content-Type": args.contentType
|
|
3993
|
-
} : {},
|
|
3994
|
-
...args?.tenantId ? {
|
|
3995
|
-
"X-Tenant-ID": args.tenantId
|
|
3996
|
-
} : {},
|
|
3997
|
-
...args?.userId ? {
|
|
3998
|
-
"X-User-ID": args.userId
|
|
3999
|
-
} : {},
|
|
3934
|
+
...existing,
|
|
4000
3935
|
Accept: "application/json"
|
|
4001
3936
|
};
|
|
4002
3937
|
if (this.authOpts?.enabled === true) {
|