turing-wallet-provider 1.0.13 → 1.0.15
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/README.md +29 -1
- package/dist/types/providerTypes.d.ts +0 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -88,7 +88,7 @@ const wallet = useTuringsWallet();
|
|
|
88
88
|
try{
|
|
89
89
|
const { address, pubKey, sig, message } = await wallet.signMessage({ message: "hello world", encoding: "base64" });//encoding可为utf-8,base64,hex
|
|
90
90
|
}catch(error){
|
|
91
|
-
console.log(
|
|
91
|
+
console.log(error);
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
//本地验证签名
|
|
@@ -98,6 +98,34 @@ const msg_buf = Buffer.from(message,encoding);
|
|
|
98
98
|
const true/false = tbc.Message.verify(msg_buf,address,sig);
|
|
99
99
|
```
|
|
100
100
|
|
|
101
|
+
### encrypt
|
|
102
|
+
|
|
103
|
+
```tsx
|
|
104
|
+
const wallet = useTuringsWallet();
|
|
105
|
+
try{
|
|
106
|
+
const encryptedMessage = await wallet.encrypt(message);
|
|
107
|
+
if(encryptedMessage){
|
|
108
|
+
console.log(encryptedMessage)
|
|
109
|
+
}
|
|
110
|
+
}catch(error){
|
|
111
|
+
console.log(error);
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### decrypt
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
const wallet = useTuringsWallet();
|
|
119
|
+
try{
|
|
120
|
+
const decryptedMessage = await wallet.decrypt(message);
|
|
121
|
+
if(decryptedMessage){
|
|
122
|
+
console.log(decryptedMessage)
|
|
123
|
+
}
|
|
124
|
+
}catch(error){
|
|
125
|
+
console.log(error);
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
101
129
|
### sendTransaction
|
|
102
130
|
|
|
103
131
|
```tsx
|
|
@@ -53,13 +53,10 @@ export type SendTransactionResponse = {
|
|
|
53
53
|
|
|
54
54
|
export type Encrypt = {
|
|
55
55
|
message: string;
|
|
56
|
-
pubKey: string;
|
|
57
|
-
encoding?: 'utf8' | 'hex' | 'base64';
|
|
58
56
|
};
|
|
59
57
|
|
|
60
58
|
export type Decrypt = {
|
|
61
59
|
message: string;
|
|
62
|
-
encoding?: 'utf8' | 'hex' | 'base64';
|
|
63
60
|
};
|
|
64
61
|
|
|
65
62
|
export type EncryptResponse = {
|