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