@didcid/keymaster 0.3.10 → 0.4.1
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/index.cjs +0 -1
- package/dist/cjs/keymaster-client.cjs +83 -2
- package/dist/cjs/keymaster.cjs +1966 -206
- package/dist/cjs/node.cjs +0 -1
- package/dist/esm/cli.js +123 -7
- package/dist/esm/cli.js.map +1 -1
- package/dist/esm/keymaster-client.js +83 -2
- package/dist/esm/keymaster-client.js.map +1 -1
- package/dist/esm/keymaster.js +391 -206
- package/dist/esm/keymaster.js.map +1 -1
- package/dist/types/keymaster-client.d.ts +13 -5
- package/dist/types/keymaster.d.ts +19 -6
- package/dist/types/types.d.ts +25 -17
- package/package.json +4 -12
- package/dist/cjs/encryption.cjs +0 -59
- package/dist/esm/encryption.js +0 -55
- package/dist/esm/encryption.js.map +0 -1
- package/dist/types/encryption.d.ts +0 -10
package/dist/cjs/index.cjs
CHANGED
|
@@ -146,6 +146,15 @@ class KeymasterClient {
|
|
|
146
146
|
throwError(error);
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
|
+
async changePassphrase(newPassphrase) {
|
|
150
|
+
try {
|
|
151
|
+
const response = await axios.post(`${this.API}/wallet/passphrase`, { passphrase: newPassphrase });
|
|
152
|
+
return response.data.ok;
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
throwError(error);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
149
158
|
async listRegistries() {
|
|
150
159
|
try {
|
|
151
160
|
const response = await axios.get(`${this.API}/registries`);
|
|
@@ -679,9 +688,9 @@ class KeymasterClient {
|
|
|
679
688
|
throwError(error);
|
|
680
689
|
}
|
|
681
690
|
}
|
|
682
|
-
async createPoll(
|
|
691
|
+
async createPoll(config, options) {
|
|
683
692
|
try {
|
|
684
|
-
const response = await axios.post(`${this.API}/polls`, { poll, options });
|
|
693
|
+
const response = await axios.post(`${this.API}/polls`, { poll: config, options });
|
|
685
694
|
return response.data.did;
|
|
686
695
|
}
|
|
687
696
|
catch (error) {
|
|
@@ -697,6 +706,24 @@ class KeymasterClient {
|
|
|
697
706
|
throwError(error);
|
|
698
707
|
}
|
|
699
708
|
}
|
|
709
|
+
async testPoll(id) {
|
|
710
|
+
try {
|
|
711
|
+
const response = await axios.get(`${this.API}/polls/${id}/test`);
|
|
712
|
+
return response.data.test;
|
|
713
|
+
}
|
|
714
|
+
catch (error) {
|
|
715
|
+
throwError(error);
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
async listPolls(owner) {
|
|
719
|
+
try {
|
|
720
|
+
const response = await axios.get(`${this.API}/polls`, { params: { owner } });
|
|
721
|
+
return response.data.polls;
|
|
722
|
+
}
|
|
723
|
+
catch (error) {
|
|
724
|
+
throwError(error);
|
|
725
|
+
}
|
|
726
|
+
}
|
|
700
727
|
async viewPoll(pollId) {
|
|
701
728
|
try {
|
|
702
729
|
const response = await axios.get(`${this.API}/polls/${pollId}/view`);
|
|
@@ -715,6 +742,33 @@ class KeymasterClient {
|
|
|
715
742
|
throwError(error);
|
|
716
743
|
}
|
|
717
744
|
}
|
|
745
|
+
async sendPoll(pollId) {
|
|
746
|
+
try {
|
|
747
|
+
const response = await axios.post(`${this.API}/polls/${pollId}/send`);
|
|
748
|
+
return response.data.did;
|
|
749
|
+
}
|
|
750
|
+
catch (error) {
|
|
751
|
+
throwError(error);
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
async sendBallot(ballotDid, pollId) {
|
|
755
|
+
try {
|
|
756
|
+
const response = await axios.post(`${this.API}/polls/ballot/send`, { ballot: ballotDid, poll: pollId });
|
|
757
|
+
return response.data.did;
|
|
758
|
+
}
|
|
759
|
+
catch (error) {
|
|
760
|
+
throwError(error);
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
async viewBallot(ballotDid) {
|
|
764
|
+
try {
|
|
765
|
+
const response = await axios.get(`${this.API}/polls/ballot/${ballotDid}`);
|
|
766
|
+
return response.data.ballot;
|
|
767
|
+
}
|
|
768
|
+
catch (error) {
|
|
769
|
+
throwError(error);
|
|
770
|
+
}
|
|
771
|
+
}
|
|
718
772
|
async updatePoll(ballot) {
|
|
719
773
|
try {
|
|
720
774
|
const response = await axios.put(`${this.API}/polls/update`, { ballot });
|
|
@@ -742,6 +796,33 @@ class KeymasterClient {
|
|
|
742
796
|
throwError(error);
|
|
743
797
|
}
|
|
744
798
|
}
|
|
799
|
+
async addPollVoter(pollId, memberId) {
|
|
800
|
+
try {
|
|
801
|
+
const response = await axios.post(`${this.API}/polls/${pollId}/voters`, { memberId });
|
|
802
|
+
return response.data.ok;
|
|
803
|
+
}
|
|
804
|
+
catch (error) {
|
|
805
|
+
throwError(error);
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
async removePollVoter(pollId, memberId) {
|
|
809
|
+
try {
|
|
810
|
+
const response = await axios.delete(`${this.API}/polls/${pollId}/voters/${memberId}`);
|
|
811
|
+
return response.data.ok;
|
|
812
|
+
}
|
|
813
|
+
catch (error) {
|
|
814
|
+
throwError(error);
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
async listPollVoters(pollId) {
|
|
818
|
+
try {
|
|
819
|
+
const response = await axios.get(`${this.API}/polls/${pollId}/voters`);
|
|
820
|
+
return response.data.voters;
|
|
821
|
+
}
|
|
822
|
+
catch (error) {
|
|
823
|
+
throwError(error);
|
|
824
|
+
}
|
|
825
|
+
}
|
|
745
826
|
async createImage(data, options = {}) {
|
|
746
827
|
try {
|
|
747
828
|
const response = await axios.post(`${this.API}/images`, data, {
|