@sphereon/ssi-sdk.kms-rest-client 0.36.1-feature.SSISDK.82.and.SSISDK.70.37 → 0.36.1-next.39

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