@didcid/keymaster 0.2.0 → 0.3.0
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/keymaster-client.cjs +26 -26
- package/dist/cjs/keymaster.cjs +277 -208
- package/dist/esm/keymaster-client.js +26 -26
- package/dist/esm/keymaster-client.js.map +1 -1
- package/dist/esm/keymaster.js +218 -173
- package/dist/esm/keymaster.js.map +1 -1
- package/dist/types/keymaster-client.d.ts +16 -14
- package/dist/types/keymaster.d.ts +22 -20
- package/dist/types/types.d.ts +26 -25
- package/package.json +2 -2
|
@@ -553,9 +553,9 @@ class KeymasterClient {
|
|
|
553
553
|
throwError(error);
|
|
554
554
|
}
|
|
555
555
|
}
|
|
556
|
-
async bindCredential(
|
|
556
|
+
async bindCredential(subject, options) {
|
|
557
557
|
try {
|
|
558
|
-
const response = await axios.post(`${this.API}/credentials/bind`, {
|
|
558
|
+
const response = await axios.post(`${this.API}/credentials/bind`, { subject, options });
|
|
559
559
|
return response.data.credential;
|
|
560
560
|
}
|
|
561
561
|
catch (error) {
|
|
@@ -825,70 +825,70 @@ class KeymasterClient {
|
|
|
825
825
|
throwError(error);
|
|
826
826
|
}
|
|
827
827
|
}
|
|
828
|
-
async
|
|
828
|
+
async createVault(options = {}) {
|
|
829
829
|
try {
|
|
830
|
-
const response = await axios.post(`${this.API}/
|
|
830
|
+
const response = await axios.post(`${this.API}/vaults`, { options });
|
|
831
831
|
return response.data.did;
|
|
832
832
|
}
|
|
833
833
|
catch (error) {
|
|
834
834
|
throwError(error);
|
|
835
835
|
}
|
|
836
836
|
}
|
|
837
|
-
async
|
|
837
|
+
async getVault(id, options) {
|
|
838
838
|
try {
|
|
839
839
|
if (options) {
|
|
840
840
|
const queryParams = new URLSearchParams(options);
|
|
841
|
-
const response = await axios.get(`${this.API}/
|
|
842
|
-
return response.data.
|
|
841
|
+
const response = await axios.get(`${this.API}/vaults/${id}?${queryParams.toString()}`);
|
|
842
|
+
return response.data.vault;
|
|
843
843
|
}
|
|
844
844
|
else {
|
|
845
|
-
const response = await axios.get(`${this.API}/
|
|
846
|
-
return response.data.
|
|
845
|
+
const response = await axios.get(`${this.API}/vaults/${id}`);
|
|
846
|
+
return response.data.vault;
|
|
847
847
|
}
|
|
848
848
|
}
|
|
849
849
|
catch (error) {
|
|
850
850
|
throwError(error);
|
|
851
851
|
}
|
|
852
852
|
}
|
|
853
|
-
async
|
|
853
|
+
async testVault(id, options) {
|
|
854
854
|
try {
|
|
855
|
-
const response = await axios.post(`${this.API}/
|
|
855
|
+
const response = await axios.post(`${this.API}/vaults/${id}/test`, { options });
|
|
856
856
|
return response.data.test;
|
|
857
857
|
}
|
|
858
858
|
catch (error) {
|
|
859
859
|
throwError(error);
|
|
860
860
|
}
|
|
861
861
|
}
|
|
862
|
-
async
|
|
862
|
+
async addVaultMember(vaultId, memberId) {
|
|
863
863
|
try {
|
|
864
|
-
const response = await axios.post(`${this.API}/
|
|
864
|
+
const response = await axios.post(`${this.API}/vaults/${vaultId}/members`, { memberId });
|
|
865
865
|
return response.data.ok;
|
|
866
866
|
}
|
|
867
867
|
catch (error) {
|
|
868
868
|
throwError(error);
|
|
869
869
|
}
|
|
870
870
|
}
|
|
871
|
-
async
|
|
871
|
+
async removeVaultMember(vaultId, memberId) {
|
|
872
872
|
try {
|
|
873
|
-
const response = await axios.delete(`${this.API}/
|
|
873
|
+
const response = await axios.delete(`${this.API}/vaults/${vaultId}/members/${memberId}`);
|
|
874
874
|
return response.data.ok;
|
|
875
875
|
}
|
|
876
876
|
catch (error) {
|
|
877
877
|
throwError(error);
|
|
878
878
|
}
|
|
879
879
|
}
|
|
880
|
-
async
|
|
880
|
+
async listVaultMembers(vaultId) {
|
|
881
881
|
try {
|
|
882
|
-
const response = await axios.get(`${this.API}/
|
|
882
|
+
const response = await axios.get(`${this.API}/vaults/${vaultId}/members`);
|
|
883
883
|
return response.data.members;
|
|
884
884
|
}
|
|
885
885
|
catch (error) {
|
|
886
886
|
throwError(error);
|
|
887
887
|
}
|
|
888
888
|
}
|
|
889
|
-
async
|
|
889
|
+
async addVaultItem(vaultId, name, buffer) {
|
|
890
890
|
try {
|
|
891
|
-
const response = await axios.post(`${this.API}/
|
|
891
|
+
const response = await axios.post(`${this.API}/vaults/${vaultId}/items`, buffer, {
|
|
892
892
|
headers: {
|
|
893
893
|
// eslint-disable-next-line
|
|
894
894
|
'Content-Type': 'application/octet-stream',
|
|
@@ -901,24 +901,24 @@ class KeymasterClient {
|
|
|
901
901
|
throwError(error);
|
|
902
902
|
}
|
|
903
903
|
}
|
|
904
|
-
async
|
|
904
|
+
async removeVaultItem(vaultId, name) {
|
|
905
905
|
try {
|
|
906
|
-
const response = await axios.delete(`${this.API}/
|
|
906
|
+
const response = await axios.delete(`${this.API}/vaults/${vaultId}/items/${name}`);
|
|
907
907
|
return response.data.ok;
|
|
908
908
|
}
|
|
909
909
|
catch (error) {
|
|
910
910
|
throwError(error);
|
|
911
911
|
}
|
|
912
912
|
}
|
|
913
|
-
async
|
|
913
|
+
async listVaultItems(vaultId, options) {
|
|
914
914
|
try {
|
|
915
915
|
if (options) {
|
|
916
916
|
const queryParams = new URLSearchParams(options);
|
|
917
|
-
const response = await axios.get(`${this.API}/
|
|
917
|
+
const response = await axios.get(`${this.API}/vaults/${vaultId}/items?${queryParams.toString()}`);
|
|
918
918
|
return response.data.items;
|
|
919
919
|
}
|
|
920
920
|
else {
|
|
921
|
-
const response = await axios.get(`${this.API}/
|
|
921
|
+
const response = await axios.get(`${this.API}/vaults/${vaultId}/items`);
|
|
922
922
|
return response.data.items;
|
|
923
923
|
}
|
|
924
924
|
}
|
|
@@ -926,9 +926,9 @@ class KeymasterClient {
|
|
|
926
926
|
throwError(error);
|
|
927
927
|
}
|
|
928
928
|
}
|
|
929
|
-
async
|
|
929
|
+
async getVaultItem(vaultId, name, options) {
|
|
930
930
|
try {
|
|
931
|
-
let url = `${this.API}/
|
|
931
|
+
let url = `${this.API}/vaults/${vaultId}/items/${name}`;
|
|
932
932
|
if (options) {
|
|
933
933
|
const queryParams = new URLSearchParams(options);
|
|
934
934
|
url += `?${queryParams.toString()}`;
|