@verified-network/verified-custody 0.1.9 → 0.2.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/README.md +412 -68
- package/dist/index.d.mts +165 -0
- package/dist/index.d.ts +165 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +3 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +30 -38
- package/dist/main.js +0 -2
- package/dist/main.js.LICENSE.txt +0 -190
package/README.md
CHANGED
|
@@ -1,93 +1,437 @@
|
|
|
1
1
|
# Verified Custody
|
|
2
2
|
|
|
3
|
-
This react module allows users to create
|
|
3
|
+
Verified Custody is a react submodule for Custody of digital assets. This react module allows users to create Blockchain wallets using PHONE NUMBER/EMAIL and save the secured version on the wallet keys on-chain. It provides extra layer of security by utilizing Co-Signers protocol where users can add up to 5 other users/non-users as their trusted Co-Signers, these custodians serve as signers that can help recover your account keys and sign transactions.
|
|
4
|
+
|
|
5
|
+
### Installation:
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
npm install @verified-network/verified-custody
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```jsx
|
|
12
|
+
import React from "react";
|
|
13
|
+
|
|
14
|
+
import { VerifiedCustody } from "@verified-network/verified-custody";
|
|
15
|
+
|
|
16
|
+
function App() {
|
|
17
|
+
return (
|
|
18
|
+
<div>
|
|
19
|
+
<VerifiedCustody />
|
|
20
|
+
</div>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
```
|
|
4
24
|
|
|
5
25
|
### Build:
|
|
26
|
+
|
|
27
|
+
- This module is built with typescript and work for both javascript and typescript react/vite projects.
|
|
6
28
|
- All the components of the module is compiled and available under the dist/ directory.
|
|
7
29
|
|
|
30
|
+
The react module exports react components and helper functions which will be useful when changing UI based on a user's state or any business logic
|
|
8
31
|
|
|
9
|
-
|
|
10
|
-
``` npm install @verified-network/verified-custody```
|
|
32
|
+
\***\*< VerifiedCustody />\*\*** component is the completed workflow of the custody module, it handles full workflow for new and existing users in steps; it consists of:
|
|
11
33
|
|
|
12
|
-
|
|
13
|
-
The react module exports some constants and helper functions which will be useful when changing UI based on a user's state or any business logic
|
|
34
|
+
# First Time Users
|
|
14
35
|
|
|
15
|
-
|
|
36
|
+
\***\*< FTUPage />\*\*** component which handles full workflow for First Time Users. This consists of:
|
|
16
37
|
|
|
17
|
-
|
|
38
|
+
\***\*< ContactPage />\*\*** component which is the starting point for all users, where they are required to input their phone number or email. And they receive an OTP(one time password).
|
|
18
39
|
|
|
19
|
-
|
|
40
|
+
\***\*< OTPPage />\*\*** component which is where new/existing users verify and resend OTP.
|
|
20
41
|
|
|
21
|
-
|
|
42
|
+
\***\*< CreatePinPage />\*\*** component which is where all users either;
|
|
22
43
|
|
|
23
|
-
|
|
44
|
+
1. create 4 digit pin to secure their account.
|
|
45
|
+
2. Input their existing pin and get redirected to another page.
|
|
46
|
+
In this component new users accounts are created as they had verified their Phone number/Email from previous components.
|
|
24
47
|
|
|
48
|
+
\***\*< AddCoSignersPage />\*\*** component which is where all new users gets to add coSigners to their account and decide the rule of signing. Users can add up to 5 Co-signers with 2 as minimum required signers.
|
|
25
49
|
|
|
50
|
+
# Returning Users
|
|
26
51
|
|
|
52
|
+
\***\*< EnterPinPage />\*\*** component which is where existing/returning users gets to input their account pin to perform various actions like;
|
|
27
53
|
|
|
54
|
+
1. connect their account/wallet to an application.
|
|
55
|
+
2. Accept/Reject Co-signers invitation.
|
|
56
|
+
3. Recover their lost account/wallet keys
|
|
57
|
+
4. Sign account recovery transaction for users
|
|
58
|
+
5. Sign regular transactions. e.t.c
|
|
28
59
|
|
|
29
|
-
|
|
60
|
+
## Usage:
|
|
30
61
|
|
|
31
|
-
|
|
62
|
+
Note: To implement this module in your project there are some important component props required.
|
|
32
63
|
|
|
33
|
-
|
|
34
|
-
- To Accept and Decline Cosigner Request
|
|
35
|
-
- To Sign Transactions
|
|
64
|
+
# Components Props Type:
|
|
36
65
|
|
|
37
|
-
|
|
66
|
+
```jsx
|
|
67
|
+
export interface VerifiedCustodyProps {
|
|
68
|
+
action?: VerifiedWalletAction;
|
|
69
|
+
actionText?: string;
|
|
70
|
+
origin?: string;
|
|
71
|
+
title?: string;
|
|
72
|
+
chainId?: number;
|
|
73
|
+
vaultData?: VerifiedWalletVault;
|
|
74
|
+
txData?: VerifiedWalletTx;
|
|
75
|
+
reqVaultData?: VerifiedWalletVault;
|
|
76
|
+
delayPageElement?: React.JSX.Element;
|
|
77
|
+
delayPageStyle?: React.CSSProperties;
|
|
78
|
+
helperFunctions?: VerifiedCustodyHelpers;
|
|
79
|
+
}
|
|
38
80
|
|
|
39
|
-
|
|
81
|
+
export type VerifiedWalletAction =
|
|
82
|
+
| "connect_wallet"
|
|
83
|
+
| "getPk"
|
|
84
|
+
| "invitation"
|
|
85
|
+
| "signRecovery"
|
|
86
|
+
| "completeRecovery";
|
|
87
|
+
|
|
88
|
+
export type VerifiedWalletVault = {
|
|
89
|
+
vaultId: string,
|
|
90
|
+
hashedVaultId?: string,
|
|
91
|
+
hashedVaultPin?: string,
|
|
92
|
+
CoSignerId?: string,
|
|
93
|
+
vId?: string,
|
|
94
|
+
vPh?: string,
|
|
95
|
+
cId?: string,
|
|
96
|
+
address?: string,
|
|
97
|
+
channel?: "sms" | "email",
|
|
98
|
+
pk?: string,
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
export type VerifiedWalletTx = {
|
|
102
|
+
id: string,
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export interface VerifiedCustodyHelpers {
|
|
106
|
+
sendCoSignerInvitation: (
|
|
107
|
+
channel: "sms" | "email",
|
|
108
|
+
cosigerId: string,
|
|
109
|
+
cretorId: string,
|
|
110
|
+
hashedCretorPin: string
|
|
111
|
+
) => Promise<boolean>;
|
|
112
|
+
|
|
113
|
+
sendCreatorConfirmation: (
|
|
114
|
+
channel: "sms" | "email",
|
|
115
|
+
cretorId: string,
|
|
116
|
+
cosigersList: [],
|
|
117
|
+
requiredSigners: number
|
|
118
|
+
) => Promise<boolean>;
|
|
119
|
+
|
|
120
|
+
sendCreatorInitiation: (
|
|
121
|
+
channel: "sms" | "email",
|
|
122
|
+
cretorId: string,
|
|
123
|
+
hashedCretorPin: string,
|
|
124
|
+
txId: number,
|
|
125
|
+
requiredSigners: number
|
|
126
|
+
) => Promise<boolean>;
|
|
127
|
+
|
|
128
|
+
sendCreatorSigned: (
|
|
129
|
+
channel: "sms" | "email",
|
|
130
|
+
cretorId: string,
|
|
131
|
+
coSignerId: string
|
|
132
|
+
) => Promise<boolean>;
|
|
133
|
+
|
|
134
|
+
sendCreatorCompleted: (
|
|
135
|
+
channel: "sms" | "email",
|
|
136
|
+
cretorId: string,
|
|
137
|
+
txId: number
|
|
138
|
+
) => Promise<boolean>;
|
|
139
|
+
|
|
140
|
+
sendCreatorAcceptance: (
|
|
141
|
+
channel: "sms" | "email",
|
|
142
|
+
creatorId: string,
|
|
143
|
+
coSignerId: string
|
|
144
|
+
) => Promise<boolean>;
|
|
145
|
+
|
|
146
|
+
sendCreatorRejection: (
|
|
147
|
+
channel: "sms" | "email",
|
|
148
|
+
creatorId: string,
|
|
149
|
+
coSignerId: string
|
|
150
|
+
) => Promise<boolean>;
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
1. action: which can be either "connect_wallet" or "getPk" or "invitation" or "signRecovery" or "completeRecovery". if action is not passed in the props it will create account for new users or login for an existing users.
|
|
155
|
+
2. helperFunctions:
|
|
156
|
+
For Example: sendCoSignerInvitation: this is required to send messages to cosigners using their email or phone number. it must take 4 parameters: ` jsx
|
|
157
|
+
channel: "sms" | "email",
|
|
158
|
+
cosigerId: string, //email or phone number of the cosigner added. note: phone number must be ``+${countryPhoneCode}${10DigitsPhoneNumber} `` for example: +10987654321 where 1 is the countryCode and 0987654321 is the phone number.
|
|
159
|
+
cretorId: string, //email or phone number of the account creator. note: phone number must be ``+${countryPhoneCode}${10DigitsPhoneNumber} `` for example: +10987654321 where 1 is the countryCode and 0987654321 is the phone number.
|
|
160
|
+
hashedCretorPin: string `
|
|
161
|
+
and return `true or false` true when message sends without error and false incase of any error.
|
|
162
|
+
|
|
163
|
+
Check the code Below for better explaination of how all helper functions work.
|
|
164
|
+
|
|
165
|
+
### Full workflow with one component(handle First time users, existing user and all type of actions)
|
|
166
|
+
|
|
167
|
+
```jsx
|
|
168
|
+
import React from 'react';
|
|
169
|
+
|
|
170
|
+
import { VerifiedCustody} from '@verified-network/verified-custody';
|
|
171
|
+
|
|
172
|
+
function App(){
|
|
173
|
+
|
|
174
|
+
const myCustomSendCoSignerInvitation = async(
|
|
175
|
+
channel: "sms" | "email",
|
|
176
|
+
cosigerId: string,
|
|
177
|
+
cretorId: string,
|
|
178
|
+
hashedCretorPin: string
|
|
179
|
+
) => Promise<boolean> {
|
|
180
|
+
try {
|
|
181
|
+
//sends email/messages depending on the channel
|
|
182
|
+
if(channel === "sms") {
|
|
183
|
+
//send message to cosigerId phone number using creatorId and hashedCretorPin in message
|
|
184
|
+
return true
|
|
185
|
+
}else if(channel === "email") {
|
|
186
|
+
//send message to cosigerId email using creatorId and hashedCretorPin in message
|
|
187
|
+
return true
|
|
188
|
+
}else {
|
|
189
|
+
return false
|
|
190
|
+
}
|
|
191
|
+
}catch(err) {
|
|
192
|
+
//handles error
|
|
193
|
+
return false
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
const myCustomSendCreatorConfirmation = async(
|
|
198
|
+
channel: "sms" | "email",
|
|
199
|
+
cretorId: string,
|
|
200
|
+
cosigersList: [],
|
|
201
|
+
requiredSigners: number
|
|
202
|
+
) => Promise<boolean> {
|
|
203
|
+
try {
|
|
204
|
+
//sends email/messages depending on the channel
|
|
205
|
+
if(channel === "sms") {
|
|
206
|
+
//send message to cretorId phone number showing creator his coSigners list and rule of signer using requiredSigners and totalNumber of coSignersList
|
|
207
|
+
return true
|
|
208
|
+
}else if(channel === "email") {
|
|
209
|
+
//send message to cretorId email showing creator his coSigners list and rule of signer using requiredSigners and totalNumber of coSignersList
|
|
210
|
+
return true
|
|
211
|
+
}else {
|
|
212
|
+
return false
|
|
213
|
+
}
|
|
214
|
+
}catch(err) {
|
|
215
|
+
//handles error
|
|
216
|
+
return false
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// no action/ create account for new user or login existing user.
|
|
221
|
+
return (
|
|
222
|
+
<div>
|
|
223
|
+
<VerifiedCustody helperFunctions={
|
|
224
|
+
sendCoSignerInvitation: myCustomSendCoSignerInvitation,
|
|
225
|
+
sendCreatorConfirmation: myCustomSendCreatorConfirmation,
|
|
226
|
+
sendCreatorInitiation: myCustomsendCreatorInitiation,
|
|
227
|
+
sendCreatorSigned: myCustomSendCreatorSigned,
|
|
228
|
+
sendCreatorCompleted: myCustomSendCreatorCompleted,
|
|
229
|
+
sendCreatorAcceptance: myCustomSendCreatorAcceptance,
|
|
230
|
+
sendCreatorRejection: myCustomSendCreatorRejection
|
|
231
|
+
} />
|
|
232
|
+
</div>
|
|
233
|
+
);
|
|
234
|
+
|
|
235
|
+
// connect existing user account
|
|
236
|
+
return (
|
|
237
|
+
<div>
|
|
238
|
+
<VerifiedCustody action="connect_wallet" actionText="CustomActionTextToDisplay like: Connect Your Account" origin="websiteToConnectToUrl" title="websiteToConnectToTitle" helperFunctions={
|
|
239
|
+
sendCoSignerInvitation: myCustomSendCoSignerInvitation,
|
|
240
|
+
sendCreatorConfirmation: myCustomSendCreatorConfirmation,
|
|
241
|
+
sendCreatorInitiation: myCustomsendCreatorInitiation,
|
|
242
|
+
sendCreatorSigned: myCustomSendCreatorSigned,
|
|
243
|
+
sendCreatorCompleted: myCustomSendCreatorCompleted,
|
|
244
|
+
sendCreatorAcceptance: myCustomSendCreatorAcceptance,
|
|
245
|
+
sendCreatorRejection: myCustomSendCreatorRejection
|
|
246
|
+
} />
|
|
247
|
+
</div>
|
|
248
|
+
);
|
|
249
|
+
|
|
250
|
+
//accept or reject coSigner invitation
|
|
251
|
+
return (
|
|
252
|
+
<div>
|
|
253
|
+
<VerifiedCustody action="invitation" origin="websiteUrl" title="websiteTitle" helperFunctions={
|
|
254
|
+
sendCoSignerInvitation: myCustomSendCoSignerInvitation,
|
|
255
|
+
sendCreatorConfirmation: myCustomSendCreatorConfirmation,
|
|
256
|
+
sendCreatorInitiation: myCustomsendCreatorInitiation,
|
|
257
|
+
sendCreatorSigned: myCustomSendCreatorSigned,
|
|
258
|
+
sendCreatorCompleted: myCustomSendCreatorCompleted,
|
|
259
|
+
sendCreatorAcceptance: myCustomSendCreatorAcceptance,
|
|
260
|
+
sendCreatorRejection: myCustomSendCreatorRejection
|
|
261
|
+
} />
|
|
262
|
+
</div>
|
|
263
|
+
);
|
|
264
|
+
|
|
265
|
+
//sign account recovery for an existing account as their cosigner
|
|
266
|
+
return (
|
|
267
|
+
<div>
|
|
268
|
+
<VerifiedCustody action="signRecovery" origin="websiteUrl" title="websiteTitle" helperFunctions={
|
|
269
|
+
sendCoSignerInvitation: myCustomSendCoSignerInvitation,
|
|
270
|
+
sendCreatorConfirmation: myCustomSendCreatorConfirmation,
|
|
271
|
+
sendCreatorInitiation: myCustomsendCreatorInitiation,
|
|
272
|
+
sendCreatorSigned: myCustomSendCreatorSigned,
|
|
273
|
+
sendCreatorCompleted: myCustomSendCreatorCompleted,
|
|
274
|
+
sendCreatorAcceptance: myCustomSendCreatorAcceptance,
|
|
275
|
+
sendCreatorRejection: myCustomSendCreatorRejection
|
|
276
|
+
} />
|
|
277
|
+
</div>
|
|
278
|
+
);
|
|
279
|
+
|
|
280
|
+
//complete account recovery for an existing account
|
|
281
|
+
return (
|
|
282
|
+
<div>
|
|
283
|
+
<VerifiedCustody action="completeRecovery" origin="websiteUrl" title="websiteTitle" helperFunctions={
|
|
284
|
+
sendCoSignerInvitation: myCustomSendCoSignerInvitation,
|
|
285
|
+
sendCreatorConfirmation: myCustomSendCreatorConfirmation,
|
|
286
|
+
sendCreatorInitiation: myCustomsendCreatorInitiation,
|
|
287
|
+
sendCreatorSigned: myCustomSendCreatorSigned,
|
|
288
|
+
sendCreatorCompleted: myCustomSendCreatorCompleted,
|
|
289
|
+
sendCreatorAcceptance: myCustomSendCreatorAcceptance,
|
|
290
|
+
sendCreatorRejection: myCustomSendCreatorRejection
|
|
291
|
+
} />
|
|
292
|
+
</div>
|
|
293
|
+
);
|
|
294
|
+
}
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
### First time users
|
|
298
|
+
|
|
299
|
+
```jsx
|
|
300
|
+
import React from 'react';
|
|
301
|
+
|
|
302
|
+
import { FTUPage} from '@verified-network/verified-custody';
|
|
303
|
+
|
|
304
|
+
function App(){
|
|
305
|
+
|
|
306
|
+
const myCustomSendCoSignerInvitation = async(
|
|
307
|
+
channel: "sms" | "email",
|
|
308
|
+
cosigerId: string,
|
|
309
|
+
cretorId: string,
|
|
310
|
+
hashedCretorPin: string
|
|
311
|
+
) => Promise<boolean> {
|
|
312
|
+
try {
|
|
313
|
+
//sends email/messages depending on the channel
|
|
314
|
+
if(channel === "sms") {
|
|
315
|
+
//send message to cosigerId phone number using creatorId and hashedCretorPin in message
|
|
316
|
+
return true
|
|
317
|
+
}else if(channel === "email") {
|
|
318
|
+
//send message to cosigerId email using creatorId and hashedCretorPin in message
|
|
319
|
+
return true
|
|
320
|
+
}else {
|
|
321
|
+
return false
|
|
322
|
+
}
|
|
323
|
+
}catch(err) {
|
|
324
|
+
//handles error
|
|
325
|
+
return false
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
const myCustomSendCreatorConfirmation = async(
|
|
330
|
+
channel: "sms" | "email",
|
|
331
|
+
cretorId: string,
|
|
332
|
+
cosigersList: [],
|
|
333
|
+
requiredSigners: number
|
|
334
|
+
) => Promise<boolean> {
|
|
335
|
+
try {
|
|
336
|
+
//sends email/messages depending on the channel
|
|
337
|
+
if(channel === "sms") {
|
|
338
|
+
//send message to cretorId phone number showing creator his coSigners list and rule of signer using requiredSigners and totalNumber of coSignersList
|
|
339
|
+
return true
|
|
340
|
+
}else if(channel === "email") {
|
|
341
|
+
//send message to cretorId email showing creator his coSigners list and rule of signer using requiredSigners and totalNumber of coSignersList
|
|
342
|
+
return true
|
|
343
|
+
}else {
|
|
344
|
+
return false
|
|
345
|
+
}
|
|
346
|
+
}catch(err) {
|
|
347
|
+
//handles error
|
|
348
|
+
return false
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
return (
|
|
353
|
+
<div>
|
|
354
|
+
<FTUPage helperFunctions={
|
|
355
|
+
sendCoSignerInvitation: myCustomSendCoSignerInvitation,
|
|
356
|
+
sendCreatorConfirmation: myCustomSendCreatorConfirmation,
|
|
357
|
+
sendCreatorInitiation: myCustomsendCreatorInitiation,
|
|
358
|
+
sendCreatorSigned: myCustomSendCreatorSigned,
|
|
359
|
+
sendCreatorCompleted: myCustomSendCreatorCompleted,
|
|
360
|
+
sendCreatorAcceptance: myCustomSendCreatorAcceptance,
|
|
361
|
+
sendCreatorRejection: myCustomSendCreatorRejection
|
|
362
|
+
} />
|
|
363
|
+
</div>
|
|
364
|
+
);
|
|
365
|
+
}
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
### Existing/Returning Users
|
|
369
|
+
|
|
370
|
+
```jsx
|
|
371
|
+
import React from 'react';
|
|
372
|
+
|
|
373
|
+
import { EnterPinPage} from '@verified-network/verified-custody';
|
|
374
|
+
|
|
375
|
+
function App(){
|
|
40
376
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
</>
|
|
64
|
-
)
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
### Handling cosigner requests:
|
|
68
|
-
|
|
69
|
-
<StartCustody
|
|
70
|
-
startPoint={{
|
|
71
|
-
component: "StartCosigner", // currently supports all forms of signing
|
|
72
|
-
args: { creator, txId, transactionType, id },
|
|
73
|
-
}}
|
|
74
|
-
/>
|
|
75
|
-
|
|
76
|
-
*transactionType* determines the type of signing request.
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
### Recovering a private key:
|
|
81
|
-
|
|
82
|
-
This **< GetPrivateKey />** component, will let you to retreive the private key once all your cosigners signoff your recovery code request.
|
|
83
|
-
|
|
84
|
-
return (
|
|
85
|
-
<GetPrivateKey
|
|
86
|
-
setupProps={{
|
|
87
|
-
chainId: 84532,
|
|
88
|
-
}}
|
|
89
|
-
signingInfo={{ creator, txId, transactionType, user }}
|
|
90
|
-
/>
|
|
91
|
-
)
|
|
377
|
+
const myCustomSendCoSignerInvitation = async(
|
|
378
|
+
channel: "sms" | "email",
|
|
379
|
+
cosigerId: string,
|
|
380
|
+
cretorId: string,
|
|
381
|
+
hashedCretorPin: string
|
|
382
|
+
) => Promise<boolean> {
|
|
383
|
+
try {
|
|
384
|
+
//sends email/messages depending on the channel
|
|
385
|
+
if(channel === "sms") {
|
|
386
|
+
//send message to cosigerId phone number using creatorId and hashedCretorPin in message
|
|
387
|
+
return true
|
|
388
|
+
}else if(channel === "email") {
|
|
389
|
+
//send message to cosigerId email using creatorId and hashedCretorPin in message
|
|
390
|
+
return true
|
|
391
|
+
}else {
|
|
392
|
+
return false
|
|
393
|
+
}
|
|
394
|
+
}catch(err) {
|
|
395
|
+
//handles error
|
|
396
|
+
return false
|
|
397
|
+
}
|
|
398
|
+
}
|
|
92
399
|
|
|
400
|
+
const myCustomSendCreatorConfirmation = async(
|
|
401
|
+
channel: "sms" | "email",
|
|
402
|
+
cretorId: string,
|
|
403
|
+
cosigersList: [],
|
|
404
|
+
requiredSigners: number
|
|
405
|
+
) => Promise<boolean> {
|
|
406
|
+
try {
|
|
407
|
+
//sends email/messages depending on the channel
|
|
408
|
+
if(channel === "sms") {
|
|
409
|
+
//send message to cretorId phone number showing creator his coSigners list and rule of signer using requiredSigners and totalNumber of coSignersList
|
|
410
|
+
return true
|
|
411
|
+
}else if(channel === "email") {
|
|
412
|
+
//send message to cretorId email showing creator his coSigners list and rule of signer using requiredSigners and totalNumber of coSignersList
|
|
413
|
+
return true
|
|
414
|
+
}else {
|
|
415
|
+
return false
|
|
416
|
+
}
|
|
417
|
+
}catch(err) {
|
|
418
|
+
//handles error
|
|
419
|
+
return false
|
|
420
|
+
}
|
|
421
|
+
}
|
|
93
422
|
|
|
423
|
+
return (
|
|
424
|
+
<div>
|
|
425
|
+
<EnterPinPage helperFunctions={
|
|
426
|
+
sendCoSignerInvitation: myCustomSendCoSignerInvitation,
|
|
427
|
+
sendCreatorConfirmation: myCustomSendCreatorConfirmation,
|
|
428
|
+
sendCreatorInitiation: myCustomsendCreatorInitiation,
|
|
429
|
+
sendCreatorSigned: myCustomSendCreatorSigned,
|
|
430
|
+
sendCreatorCompleted: myCustomSendCreatorCompleted,
|
|
431
|
+
sendCreatorAcceptance: myCustomSendCreatorAcceptance,
|
|
432
|
+
sendCreatorRejection: myCustomSendCreatorRejection
|
|
433
|
+
} />
|
|
434
|
+
</div>
|
|
435
|
+
);
|
|
436
|
+
}
|
|
437
|
+
```
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import React$1 from 'react';
|
|
2
|
+
|
|
3
|
+
type VerifiedWalletAction = "connect_wallet" | "getPk" | "invitation" | "signRecovery" | "completeRecovery";
|
|
4
|
+
type VerifiedWalletVault = {
|
|
5
|
+
vaultId: string;
|
|
6
|
+
hashedVaultId?: string;
|
|
7
|
+
hashedVaultPin?: string;
|
|
8
|
+
CoSignerId?: string;
|
|
9
|
+
vId?: string;
|
|
10
|
+
vPh?: string;
|
|
11
|
+
cId?: string;
|
|
12
|
+
address?: string;
|
|
13
|
+
channel?: "sms" | "email";
|
|
14
|
+
pk?: string;
|
|
15
|
+
};
|
|
16
|
+
type VerifiedWalletTx = {
|
|
17
|
+
id: string;
|
|
18
|
+
};
|
|
19
|
+
interface VerifiedCustodyProps {
|
|
20
|
+
action?: VerifiedWalletAction;
|
|
21
|
+
actionText?: string;
|
|
22
|
+
origin?: string;
|
|
23
|
+
title?: string;
|
|
24
|
+
chainId?: number;
|
|
25
|
+
vaultData?: VerifiedWalletVault;
|
|
26
|
+
txData?: VerifiedWalletTx;
|
|
27
|
+
reqVaultData?: VerifiedWalletVault;
|
|
28
|
+
delayPageElement?: React.JSX.Element;
|
|
29
|
+
delayPageStyle?: React.CSSProperties;
|
|
30
|
+
helperFunctions?: VerifiedCustodyHelpers;
|
|
31
|
+
}
|
|
32
|
+
interface VerifiedCustodyHelpers {
|
|
33
|
+
sendCoSignerInvitation: (channel: "sms" | "email", cosigerId: string, cretorId: string, hashedCretorPin: string) => Promise<boolean>;
|
|
34
|
+
sendCreatorConfirmation: (channel: "sms" | "email", cretorId: string, cosigersList: [], requiredSigners: number) => Promise<boolean>;
|
|
35
|
+
sendCreatorInitiation: (channel: "sms" | "email", cretorId: string, hashedCretorPin: string, txId: number, requiredSigners: number) => Promise<boolean>;
|
|
36
|
+
sendCreatorSigned: (channel: "sms" | "email", cretorId: string, coSignerId: string) => Promise<boolean>;
|
|
37
|
+
sendCreatorCompleted: (channel: "sms" | "email", cretorId: string, txId: number) => Promise<boolean>;
|
|
38
|
+
sendCreatorAcceptance: (channel: "sms" | "email", creatorId: string, coSignerId: string) => Promise<boolean>;
|
|
39
|
+
sendCreatorRejection: (channel: "sms" | "email", creatorId: string, coSignerId: string) => Promise<boolean>;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
declare const VerifiedCustody: (props: VerifiedCustodyProps) => React$1.JSX.Element;
|
|
43
|
+
|
|
44
|
+
declare const FTUPage: (props: {
|
|
45
|
+
fontsLoaded?: boolean;
|
|
46
|
+
popupView?: boolean;
|
|
47
|
+
action?: string;
|
|
48
|
+
vaultData?: any;
|
|
49
|
+
txData?: any;
|
|
50
|
+
chainId?: number;
|
|
51
|
+
defaultCountry?: {
|
|
52
|
+
area: string;
|
|
53
|
+
flag: string;
|
|
54
|
+
name: string;
|
|
55
|
+
};
|
|
56
|
+
showLogoPage?: boolean;
|
|
57
|
+
logoPageElement?: React$1.JSX.Element;
|
|
58
|
+
logoTimeoutTime?: number;
|
|
59
|
+
showStartupPage?: boolean;
|
|
60
|
+
startupPageElement?: React$1.JSX.Element;
|
|
61
|
+
setisOnboard?: (isOnboard: boolean) => void;
|
|
62
|
+
helperFunctions?: VerifiedCustodyHelpers;
|
|
63
|
+
}) => React$1.JSX.Element;
|
|
64
|
+
|
|
65
|
+
declare const EnterPinPage: (props: {
|
|
66
|
+
fontsLoaded?: boolean;
|
|
67
|
+
setisOnboard: (isOnboard: boolean) => void;
|
|
68
|
+
vaultId: string;
|
|
69
|
+
hashedVaultId: string;
|
|
70
|
+
encrptedPk: string;
|
|
71
|
+
vaultAddress: string;
|
|
72
|
+
vaultChannel: "sms" | "email";
|
|
73
|
+
actionText?: string;
|
|
74
|
+
title?: string;
|
|
75
|
+
origin?: string;
|
|
76
|
+
chainId?: number;
|
|
77
|
+
newChainId?: number;
|
|
78
|
+
action?: string;
|
|
79
|
+
reqVaultData?: any;
|
|
80
|
+
reqTxData?: any;
|
|
81
|
+
setIsLoading: (isLoading: boolean) => void;
|
|
82
|
+
helperFunctions?: VerifiedCustodyHelpers;
|
|
83
|
+
}) => React$1.JSX.Element;
|
|
84
|
+
|
|
85
|
+
declare const CreatePinPage: (props: {
|
|
86
|
+
setStep: (step: string) => void;
|
|
87
|
+
setIsLoading: (isLoading: boolean) => void;
|
|
88
|
+
setShowSuccessBtn: (showSuccessBtn: boolean) => void;
|
|
89
|
+
setSuccessBtnText: (successBtnText: string) => void;
|
|
90
|
+
setSuccessBtnNeutText: (successBtnNeutText: string) => void;
|
|
91
|
+
setSuccessBtnFunc: (successBtnFunc: any) => void;
|
|
92
|
+
setSuccessBtnNeutFunc: (successBtnNeutFunc: any) => void;
|
|
93
|
+
setActionHeaderText: (actionHeaderText: string) => void;
|
|
94
|
+
setActionFooterText: (actionFooterText: string) => void;
|
|
95
|
+
userNumberFmt: string;
|
|
96
|
+
userEmail: string;
|
|
97
|
+
selectedCountry: {
|
|
98
|
+
name: string;
|
|
99
|
+
area: string;
|
|
100
|
+
flag: string;
|
|
101
|
+
};
|
|
102
|
+
action?: string;
|
|
103
|
+
vaultData?: any;
|
|
104
|
+
txData?: any;
|
|
105
|
+
helperFunctions?: VerifiedCustodyHelpers;
|
|
106
|
+
}) => React$1.JSX.Element;
|
|
107
|
+
|
|
108
|
+
declare const ContactPage: (props: {
|
|
109
|
+
setStep: (step: string) => void;
|
|
110
|
+
setIsLoading: (isLoading: boolean) => void;
|
|
111
|
+
setUserNumberFmt: (number: string) => void;
|
|
112
|
+
userNumberFmt: string;
|
|
113
|
+
setUserEmail: (email: string) => void;
|
|
114
|
+
userEmail: string;
|
|
115
|
+
setSelectedCountry: (country: {
|
|
116
|
+
name: string;
|
|
117
|
+
area: string;
|
|
118
|
+
flag: string;
|
|
119
|
+
}) => void;
|
|
120
|
+
selectedCountry: {
|
|
121
|
+
name: string;
|
|
122
|
+
area: string;
|
|
123
|
+
flag: string;
|
|
124
|
+
};
|
|
125
|
+
allCountries: any;
|
|
126
|
+
}) => React$1.JSX.Element;
|
|
127
|
+
|
|
128
|
+
declare const OTPPage: (props: {
|
|
129
|
+
setStep: (step: string) => void;
|
|
130
|
+
setIsLoading: (isLoading: boolean) => void;
|
|
131
|
+
setUserNumberFmt: (number: string) => void;
|
|
132
|
+
setUserEmail: (email: string) => void;
|
|
133
|
+
selectedCountry: {
|
|
134
|
+
name: string;
|
|
135
|
+
area: string;
|
|
136
|
+
flag: string;
|
|
137
|
+
};
|
|
138
|
+
userNumberFmt: string;
|
|
139
|
+
userEmail: string;
|
|
140
|
+
}) => React$1.JSX.Element;
|
|
141
|
+
|
|
142
|
+
declare const AddCosignersPage: (props: {
|
|
143
|
+
setStep: (step: string) => void;
|
|
144
|
+
setIsLoading: (isLoading: boolean) => void;
|
|
145
|
+
userNumberFmt: string;
|
|
146
|
+
userEmail: string;
|
|
147
|
+
selectedCountry: {
|
|
148
|
+
name: string;
|
|
149
|
+
area: string;
|
|
150
|
+
flag: string;
|
|
151
|
+
};
|
|
152
|
+
allCountries: any;
|
|
153
|
+
defaultCountry?: {
|
|
154
|
+
area: string;
|
|
155
|
+
flag: string;
|
|
156
|
+
name: string;
|
|
157
|
+
};
|
|
158
|
+
helperFunctions?: VerifiedCustodyHelpers;
|
|
159
|
+
}) => React$1.JSX.Element;
|
|
160
|
+
|
|
161
|
+
declare const hashTheString: (text: string) => string;
|
|
162
|
+
declare const encryptString: (text: string, secretKey: string) => string;
|
|
163
|
+
declare const decryptString: (encryptedText: string, secretKey: string) => string;
|
|
164
|
+
|
|
165
|
+
export { AddCosignersPage as AddCoSignersPage, ContactPage, CreatePinPage, EnterPinPage, FTUPage, OTPPage, VerifiedCustody, decryptString, encryptString, hashTheString };
|