@keyringnetwork/keyring-connect-sdk 1.1.0 → 1.1.2
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/constants/datasources.json +64 -115
- package/dist/main.js +2 -1
- package/dist/types.d.ts +2 -0
- package/package.json +7 -7
- package/readme.md +66 -10
|
@@ -11,42 +11,27 @@
|
|
|
11
11
|
"claims": [
|
|
12
12
|
{
|
|
13
13
|
"entity_type": "individual",
|
|
14
|
-
"id": "
|
|
14
|
+
"id": "binance_kyc_level",
|
|
15
15
|
"label": "KYC Level >= INTERMEDIATE",
|
|
16
|
-
"rule_id": "
|
|
16
|
+
"rule_id": "binance_kyc_level"
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
19
|
"entity_type": "individual",
|
|
20
|
-
"id": "
|
|
20
|
+
"id": "binance_kyc_not_in_fatf_tlsn-binance-kyc",
|
|
21
21
|
"label": "User POA Country not on FATF",
|
|
22
|
-
"rule_id": "
|
|
22
|
+
"rule_id": "binance_kyc_not_in_fatf_tlsn-binance-kyc"
|
|
23
23
|
},
|
|
24
24
|
{
|
|
25
25
|
"entity_type": "individual",
|
|
26
|
-
"id": "
|
|
26
|
+
"id": "binance_kyc_account_type",
|
|
27
27
|
"label": "User Account Type",
|
|
28
|
-
"rule_id": "
|
|
28
|
+
"rule_id": "binance_kyc_account_type"
|
|
29
29
|
}
|
|
30
30
|
],
|
|
31
31
|
"endpoint": {
|
|
32
32
|
"body": null,
|
|
33
33
|
"data_bounds": null,
|
|
34
34
|
"disclosable_fields": [
|
|
35
|
-
{
|
|
36
|
-
"label": "first name",
|
|
37
|
-
"path": "data.fillInfo.firstName",
|
|
38
|
-
"key": "first_name"
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
"label": "last name",
|
|
42
|
-
"path": "data.fillInfo.lastName",
|
|
43
|
-
"key": "last_name"
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
"label": "dob",
|
|
47
|
-
"path": "data.fillInfo.dob",
|
|
48
|
-
"key": "dob"
|
|
49
|
-
},
|
|
50
35
|
{
|
|
51
36
|
"label": "kyc level",
|
|
52
37
|
"path": "data.passKycLevel",
|
|
@@ -55,7 +40,7 @@
|
|
|
55
40
|
{
|
|
56
41
|
"label": "country of primary address",
|
|
57
42
|
"path": "data.fillInfo.residenceCountry",
|
|
58
|
-
"key": "
|
|
43
|
+
"key": "country"
|
|
59
44
|
},
|
|
60
45
|
{
|
|
61
46
|
"label": "account type",
|
|
@@ -82,21 +67,21 @@
|
|
|
82
67
|
"claims": [
|
|
83
68
|
{
|
|
84
69
|
"entity_type": "business",
|
|
85
|
-
"id": "
|
|
70
|
+
"id": "binance_kyb_verified",
|
|
86
71
|
"label": "KYB Verified",
|
|
87
|
-
"rule_id": "
|
|
72
|
+
"rule_id": "binance_kyb_verified"
|
|
88
73
|
},
|
|
89
74
|
{
|
|
90
75
|
"entity_type": "business",
|
|
91
|
-
"id": "
|
|
76
|
+
"id": "binance_kyb_not_in_fatf_tlsn-binance-kyb",
|
|
92
77
|
"label": "Business POA Country not on FATF",
|
|
93
|
-
"rule_id": "
|
|
78
|
+
"rule_id": "binance_kyb_not_in_fatf_tlsn-binance-kyb"
|
|
94
79
|
},
|
|
95
80
|
{
|
|
96
81
|
"entity_type": "business",
|
|
97
|
-
"id": "
|
|
82
|
+
"id": "binance_kyb_account_type",
|
|
98
83
|
"label": "Business Account Type",
|
|
99
|
-
"rule_id": "
|
|
84
|
+
"rule_id": "binance_kyb_account_type"
|
|
100
85
|
}
|
|
101
86
|
],
|
|
102
87
|
"endpoint": {
|
|
@@ -106,22 +91,12 @@
|
|
|
106
91
|
{
|
|
107
92
|
"label": "kyb status",
|
|
108
93
|
"path": "data.kycStatus",
|
|
109
|
-
"key": "
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
"label": "company name",
|
|
113
|
-
"path": "data.fillInfo.companyName",
|
|
114
|
-
"key": "company_name"
|
|
94
|
+
"key": "kyc_status"
|
|
115
95
|
},
|
|
116
96
|
{
|
|
117
97
|
"label": "country of primary address",
|
|
118
98
|
"path": "data.fillInfo.residenceCountry",
|
|
119
|
-
"key": "
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
"label": "kyb message detail",
|
|
123
|
-
"path": "data.frontDisplayLevelMsg",
|
|
124
|
-
"key": "kyb_message_detail"
|
|
99
|
+
"key": "country"
|
|
125
100
|
},
|
|
126
101
|
{
|
|
127
102
|
"label": "account type",
|
|
@@ -164,27 +139,27 @@
|
|
|
164
139
|
"claims": [
|
|
165
140
|
{
|
|
166
141
|
"entity_type": "business",
|
|
167
|
-
"id": "
|
|
142
|
+
"id": "kraken_kyb_not_in_fatf_tlsn-kraken-kyb",
|
|
168
143
|
"label": "KYB Tier 4 (Full KYB)",
|
|
169
|
-
"rule_id": "
|
|
144
|
+
"rule_id": "kraken_kyb_not_in_fatf_tlsn-kraken-kyb"
|
|
170
145
|
},
|
|
171
146
|
{
|
|
172
147
|
"entity_type": "business",
|
|
173
|
-
"id": "
|
|
148
|
+
"id": "kraken_kyb_not_in_fatf_tlsn-kraken-kyb",
|
|
174
149
|
"label": "Business Country not on FATF",
|
|
175
|
-
"rule_id": "
|
|
150
|
+
"rule_id": "kraken_kyb_not_in_fatf_tlsn-kraken-kyb"
|
|
176
151
|
},
|
|
177
152
|
{
|
|
178
153
|
"entity_type": "business",
|
|
179
|
-
"id": "
|
|
154
|
+
"id": "kraken_kyb_account_type",
|
|
180
155
|
"label": "Pro Business Account Type",
|
|
181
|
-
"rule_id": "
|
|
156
|
+
"rule_id": "kraken_kyb_account_type"
|
|
182
157
|
},
|
|
183
158
|
{
|
|
184
159
|
"entity_type": "business",
|
|
185
|
-
"id": "
|
|
160
|
+
"id": "kraken_kyb_verified_address",
|
|
186
161
|
"label": "Verified Address",
|
|
187
|
-
"rule_id": "
|
|
162
|
+
"rule_id": "kraken_kyb_verified_address"
|
|
188
163
|
}
|
|
189
164
|
],
|
|
190
165
|
"endpoint": {
|
|
@@ -200,12 +175,7 @@
|
|
|
200
175
|
"key": "user_kyc"
|
|
201
176
|
},
|
|
202
177
|
{
|
|
203
|
-
"label": "
|
|
204
|
-
"path": "result.first_name",
|
|
205
|
-
"key": "first_name"
|
|
206
|
-
},
|
|
207
|
-
{
|
|
208
|
-
"label": "country",
|
|
178
|
+
"label": "country of primary address",
|
|
209
179
|
"path": "result.country",
|
|
210
180
|
"key": "country"
|
|
211
181
|
},
|
|
@@ -240,21 +210,21 @@
|
|
|
240
210
|
"claims": [
|
|
241
211
|
{
|
|
242
212
|
"entity_type": "individual",
|
|
243
|
-
"id": "
|
|
213
|
+
"id": "kraken_kyc_tier",
|
|
244
214
|
"label": "KYB Tier 3+ (Verified ID)",
|
|
245
|
-
"rule_id": "
|
|
215
|
+
"rule_id": "kraken_kyc_tier"
|
|
246
216
|
},
|
|
247
217
|
{
|
|
248
218
|
"entity_type": "individual",
|
|
249
|
-
"id": "
|
|
219
|
+
"id": "kraken_kyc_not_in_fatf_tlsn-kraken-kyc",
|
|
250
220
|
"label": "Country not on FATF",
|
|
251
|
-
"rule_id": "
|
|
221
|
+
"rule_id": "kraken_kyc_not_in_fatf_tlsn-kraken-kyc"
|
|
252
222
|
},
|
|
253
223
|
{
|
|
254
224
|
"entity_type": "individual",
|
|
255
|
-
"id": "
|
|
225
|
+
"id": "kraken_kyc_account_type",
|
|
256
226
|
"label": "Retail Account Type",
|
|
257
|
-
"rule_id": "
|
|
227
|
+
"rule_id": "kraken_kyc_account_type"
|
|
258
228
|
}
|
|
259
229
|
],
|
|
260
230
|
"endpoint": {
|
|
@@ -270,12 +240,7 @@
|
|
|
270
240
|
"key": "user_kyc"
|
|
271
241
|
},
|
|
272
242
|
{
|
|
273
|
-
"label": "
|
|
274
|
-
"path": "result.first_name",
|
|
275
|
-
"key": "first_name"
|
|
276
|
-
},
|
|
277
|
-
{
|
|
278
|
-
"label": "country",
|
|
243
|
+
"label": "country of primary address",
|
|
279
244
|
"path": "result.country",
|
|
280
245
|
"key": "country"
|
|
281
246
|
},
|
|
@@ -328,19 +293,19 @@
|
|
|
328
293
|
"entity_type": "individual",
|
|
329
294
|
"id": "75eebf24-5dfe-4b3d-b651-f21fff1786c4",
|
|
330
295
|
"label": "KYC Verified",
|
|
331
|
-
"rule_id": "
|
|
296
|
+
"rule_id": "binance_us_kyc_verified"
|
|
332
297
|
},
|
|
333
298
|
{
|
|
334
299
|
"entity_type": "individual",
|
|
335
300
|
"id": "18e9f113-5110-4abb-b6e9-da07dcfeb41f",
|
|
336
301
|
"label": "User POA Country not on FATF",
|
|
337
|
-
"rule_id": "
|
|
302
|
+
"rule_id": "binance_us_kyc_not_in_fatf_tlsn-binance-us-kyc"
|
|
338
303
|
},
|
|
339
304
|
{
|
|
340
305
|
"entity_type": "individual",
|
|
341
306
|
"id": "2a5d69a3-1ead-4be6-9112-760b6432c3d8",
|
|
342
307
|
"label": "Individual Account Type",
|
|
343
|
-
"rule_id": "
|
|
308
|
+
"rule_id": "binance_us_kyc_account_type"
|
|
344
309
|
}
|
|
345
310
|
],
|
|
346
311
|
"endpoint": {
|
|
@@ -351,7 +316,7 @@
|
|
|
351
316
|
},
|
|
352
317
|
"disclosable_fields": [
|
|
353
318
|
{
|
|
354
|
-
"label": "country",
|
|
319
|
+
"label": "country of primary address",
|
|
355
320
|
"path": "data.userDetails.country",
|
|
356
321
|
"key": "country"
|
|
357
322
|
},
|
|
@@ -387,19 +352,19 @@
|
|
|
387
352
|
"entity_type": "business",
|
|
388
353
|
"id": "26db829e-ded2-4046-9626-7a1867d5be06",
|
|
389
354
|
"label": "KYB Verified",
|
|
390
|
-
"rule_id": "
|
|
355
|
+
"rule_id": "binance_us_kyb_verified"
|
|
391
356
|
},
|
|
392
357
|
{
|
|
393
358
|
"entity_type": "business",
|
|
394
359
|
"id": "81d4d669-f626-4dfb-9966-c783d2f3dddb",
|
|
395
360
|
"label": "Business POA Country not on FATF",
|
|
396
|
-
"rule_id": "
|
|
361
|
+
"rule_id": "binance_us_kyb_not_in_fatf_tlsn-binance-us-kyb"
|
|
397
362
|
},
|
|
398
363
|
{
|
|
399
364
|
"entity_type": "business",
|
|
400
365
|
"id": "a99d0cf5-ee75-4ddf-b3e2-aabb794450f2",
|
|
401
366
|
"label": "Business Account Type",
|
|
402
|
-
"rule_id": "
|
|
367
|
+
"rule_id": "binance_us_kyb_account_type"
|
|
403
368
|
}
|
|
404
369
|
],
|
|
405
370
|
"endpoint": {
|
|
@@ -412,7 +377,7 @@
|
|
|
412
377
|
{
|
|
413
378
|
"label": "country of primary address",
|
|
414
379
|
"path": "data.userDetails.country",
|
|
415
|
-
"key": "
|
|
380
|
+
"key": "country"
|
|
416
381
|
},
|
|
417
382
|
{
|
|
418
383
|
"label": "kyc level",
|
|
@@ -457,7 +422,14 @@
|
|
|
457
422
|
"name": "Fidelity",
|
|
458
423
|
"proof_sources": [
|
|
459
424
|
{
|
|
460
|
-
"claims": [
|
|
425
|
+
"claims": [
|
|
426
|
+
{
|
|
427
|
+
"entity_type": "individual",
|
|
428
|
+
"id": "fidelity_kyc_verified",
|
|
429
|
+
"label": "KYC Verified",
|
|
430
|
+
"rule_id": "fidelity_kyc_verified"
|
|
431
|
+
}
|
|
432
|
+
],
|
|
461
433
|
"endpoint": {
|
|
462
434
|
"body": "{\"dpIdCache\":null}",
|
|
463
435
|
"data_bounds": {
|
|
@@ -465,11 +437,6 @@
|
|
|
465
437
|
"max_sent_data": 5000
|
|
466
438
|
},
|
|
467
439
|
"disclosable_fields": [
|
|
468
|
-
{
|
|
469
|
-
"label": "full name",
|
|
470
|
-
"path": "customer.name",
|
|
471
|
-
"key": "full_name"
|
|
472
|
-
},
|
|
473
440
|
{
|
|
474
441
|
"label": "mailing address",
|
|
475
442
|
"path": "customer.addresses.mailing",
|
|
@@ -494,7 +461,7 @@
|
|
|
494
461
|
],
|
|
495
462
|
"url": "https://digital.fidelity.com/ftgw/digital/profile/api/personal/info"
|
|
496
463
|
},
|
|
497
|
-
"id": "tlsn-fidelity-
|
|
464
|
+
"id": "tlsn-fidelity-kyc",
|
|
498
465
|
"label": "Profile information from Fidelity"
|
|
499
466
|
}
|
|
500
467
|
],
|
|
@@ -517,15 +484,15 @@
|
|
|
517
484
|
"claims": [
|
|
518
485
|
{
|
|
519
486
|
"entity_type": "individual",
|
|
520
|
-
"id": "
|
|
487
|
+
"id": "coinbase_kyc_verified",
|
|
521
488
|
"label": "KYC Verified",
|
|
522
|
-
"rule_id": "
|
|
489
|
+
"rule_id": "coinbase_kyc_verified"
|
|
523
490
|
},
|
|
524
491
|
{
|
|
525
492
|
"entity_type": "individual",
|
|
526
|
-
"id": "
|
|
493
|
+
"id": "coinbase_kyc_not_in_fatf_tlsn-coinbase-kyc",
|
|
527
494
|
"label": "Coinbase Residence country is not on FATF BList",
|
|
528
|
-
"rule_id": "
|
|
495
|
+
"rule_id": "coinbase_kyc_not_in_fatf_tlsn-coinbase-kyc"
|
|
529
496
|
}
|
|
530
497
|
],
|
|
531
498
|
"endpoint": {
|
|
@@ -533,12 +500,12 @@
|
|
|
533
500
|
"data_bounds": null,
|
|
534
501
|
"disclosable_fields": [
|
|
535
502
|
{
|
|
536
|
-
"label": "
|
|
503
|
+
"label": "no remaining kyc requirements",
|
|
537
504
|
"path": "data.viewer.userProperties.nextRequirement",
|
|
538
505
|
"key": "next_requirement"
|
|
539
506
|
},
|
|
540
507
|
{
|
|
541
|
-
"label": "country",
|
|
508
|
+
"label": "country of primary address",
|
|
542
509
|
"path": "data.viewer.userProperties.country.code",
|
|
543
510
|
"key": "country"
|
|
544
511
|
}
|
|
@@ -557,7 +524,7 @@
|
|
|
557
524
|
"label": "User information from Coinbase"
|
|
558
525
|
}
|
|
559
526
|
],
|
|
560
|
-
"target_url": "https://www.coinbase.com/graphql/query?&operationName=userQuery
|
|
527
|
+
"target_url": "https://www.coinbase.com/graphql/query?&operationName=userQuery&*",
|
|
561
528
|
"user_actions": [
|
|
562
529
|
"Login",
|
|
563
530
|
"Navigate to your profile page",
|
|
@@ -576,27 +543,9 @@
|
|
|
576
543
|
"claims": [
|
|
577
544
|
{
|
|
578
545
|
"entity_type": "individual",
|
|
579
|
-
"id": "
|
|
580
|
-
"label": "
|
|
581
|
-
"rule_id": "
|
|
582
|
-
},
|
|
583
|
-
{
|
|
584
|
-
"entity_type": "individual",
|
|
585
|
-
"id": "revolut-kyc-user-state",
|
|
586
|
-
"label": "User State",
|
|
587
|
-
"rule_id": "revolut-kyc-user-state"
|
|
588
|
-
},
|
|
589
|
-
{
|
|
590
|
-
"entity_type": "individual",
|
|
591
|
-
"id": "revolut-kyc-user-under-review",
|
|
592
|
-
"label": "Under Review",
|
|
593
|
-
"rule_id": "revolut-kyc-user-under-review"
|
|
594
|
-
},
|
|
595
|
-
{
|
|
596
|
-
"entity_type": "individual",
|
|
597
|
-
"id": "revolut-kyc-user-kyc",
|
|
598
|
-
"label": "User KYC",
|
|
599
|
-
"rule_id": "revolut-kyc-user-kyc"
|
|
546
|
+
"id": "revolut_kyc_verified",
|
|
547
|
+
"label": "KYC Verified",
|
|
548
|
+
"rule_id": "revolut_kyc_verified"
|
|
600
549
|
}
|
|
601
550
|
],
|
|
602
551
|
"endpoint": {
|
|
@@ -607,22 +556,22 @@
|
|
|
607
556
|
},
|
|
608
557
|
"disclosable_fields": [
|
|
609
558
|
{
|
|
610
|
-
"label": "country address",
|
|
559
|
+
"label": "country of primary address",
|
|
611
560
|
"path": "user.address.country",
|
|
612
|
-
"key": "
|
|
561
|
+
"key": "country"
|
|
613
562
|
},
|
|
614
563
|
{
|
|
615
564
|
"label": "user status",
|
|
616
565
|
"path": "user.state",
|
|
617
|
-
"key": "
|
|
566
|
+
"key": "user_state"
|
|
618
567
|
},
|
|
619
568
|
{
|
|
620
|
-
"label": "kyc
|
|
569
|
+
"label": "user kyc",
|
|
621
570
|
"path": "user.kyc",
|
|
622
|
-
"key": "
|
|
571
|
+
"key": "user_kyc"
|
|
623
572
|
},
|
|
624
573
|
{
|
|
625
|
-
"label": "under review",
|
|
574
|
+
"label": "account under review",
|
|
626
575
|
"path": "user.underReview",
|
|
627
576
|
"key": "under_review"
|
|
628
577
|
}
|
package/dist/main.js
CHANGED
|
@@ -124,7 +124,7 @@ class KeyringConnect {
|
|
|
124
124
|
return validatedConfig;
|
|
125
125
|
}
|
|
126
126
|
static convertToLaunchConfig(config) {
|
|
127
|
-
var _a, _b;
|
|
127
|
+
var _a, _b, _c;
|
|
128
128
|
const launchConfig = {
|
|
129
129
|
client: {
|
|
130
130
|
client_name: config.name,
|
|
@@ -146,6 +146,7 @@ class KeyringConnect {
|
|
|
146
146
|
proof_config: config.proof_config,
|
|
147
147
|
session_info: {
|
|
148
148
|
access_token: (_b = config.krn_config) === null || _b === void 0 ? void 0 : _b.keyring_access_token,
|
|
149
|
+
refresh_token: (_c = config.krn_config) === null || _c === void 0 ? void 0 : _c.keyring_refresh_token,
|
|
149
150
|
},
|
|
150
151
|
};
|
|
151
152
|
return launchConfig;
|
package/dist/types.d.ts
CHANGED
|
@@ -42,6 +42,7 @@ export type ExtensionSDKConfig = {
|
|
|
42
42
|
keyring_api_url?: string;
|
|
43
43
|
analytics_api_url?: string;
|
|
44
44
|
keyring_access_token?: string;
|
|
45
|
+
keyring_refresh_token?: string;
|
|
45
46
|
entity_id?: string;
|
|
46
47
|
isolate_proving?: boolean;
|
|
47
48
|
notaryUrl?: string;
|
|
@@ -71,6 +72,7 @@ export type ExtensionLaunchConfig = {
|
|
|
71
72
|
};
|
|
72
73
|
session_info?: {
|
|
73
74
|
access_token?: string;
|
|
75
|
+
refresh_token?: string;
|
|
74
76
|
};
|
|
75
77
|
};
|
|
76
78
|
export type ExtensionStatus = "idle" | "mounted" | "proving" | "prove_success" | "error";
|
package/package.json
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@keyringnetwork/keyring-connect-sdk",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "An SDK for interacting with Keyring Connect browser extension",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "rm -rf dist && pnpm get:datasources && tsc",
|
|
9
|
+
"dev": "pnpm get:datasources && tsc --watch",
|
|
10
|
+
"build_and_publish": "pnpm build && npm publish",
|
|
11
|
+
"get:datasources": "node ../../scripts/parseDatasource.js -o src/constants/datasources.json"
|
|
12
|
+
},
|
|
7
13
|
"files": [
|
|
8
14
|
"dist"
|
|
9
15
|
],
|
|
@@ -16,11 +22,5 @@
|
|
|
16
22
|
},
|
|
17
23
|
"dependencies": {
|
|
18
24
|
"jwt-decode": "^4.0.0"
|
|
19
|
-
},
|
|
20
|
-
"scripts": {
|
|
21
|
-
"build": "rm -rf dist && pnpm get:datasources && tsc",
|
|
22
|
-
"dev": "pnpm get:datasources && tsc --watch",
|
|
23
|
-
"build_and_publish": "pnpm build && npm publish",
|
|
24
|
-
"get:datasources": "node ../../scripts/parseDatasource.js -o src/constants/datasources.json"
|
|
25
25
|
}
|
|
26
26
|
}
|
package/readme.md
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
# Keyring Connect SDK
|
|
2
2
|
|
|
3
|
-
A TypeScript
|
|
3
|
+
A TypeScript SDK for integrating with the Keyring Connect browser extension. This SDK enables seamless interaction with the Keyring Connect extension for user verification and attestation.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
npm install @keyringnetwork/keyring-connect-sdk
|
|
9
|
+
yarn add @keyringnetwork/keyring-connect-sdk
|
|
10
|
+
pnpm install @keyringnetwork/keyring-connect-sdk
|
|
9
11
|
```
|
|
10
12
|
|
|
11
13
|
## Features
|
|
12
14
|
|
|
15
|
+
- Check if the extension is installed
|
|
13
16
|
- Launch Keyring Connect with custom client configuration
|
|
17
|
+
- Redirect the user back to the app where they left off after extension installation
|
|
14
18
|
- Monitor extension status and user state
|
|
15
19
|
- Full TypeScript support with comprehensive type definitions
|
|
16
20
|
|
|
@@ -19,23 +23,31 @@ npm install @keyringnetwork/keyring-connect-sdk
|
|
|
19
23
|
### Initialize
|
|
20
24
|
|
|
21
25
|
```typescript
|
|
22
|
-
import { KeyringConnect } from
|
|
26
|
+
import { KeyringConnect } from "@keyringnetwork/keyring-connect-sdk";
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Check if the extension is installed
|
|
30
|
+
|
|
31
|
+
```typescript
|
|
32
|
+
const isInstalled = await KeyringConnect.isKeyringConnectInstalled();
|
|
23
33
|
```
|
|
24
34
|
|
|
25
35
|
### Launch Keyring Connect
|
|
26
36
|
|
|
27
37
|
```typescript
|
|
28
38
|
const extensionConfig = {
|
|
29
|
-
name:
|
|
30
|
-
app_url:
|
|
31
|
-
logo_url:
|
|
39
|
+
name: "My App",
|
|
40
|
+
app_url: "https://myapp.com",
|
|
41
|
+
logo_url: "https://myapp.com/logo.png",
|
|
32
42
|
policy_id: 123,
|
|
33
43
|
};
|
|
34
44
|
|
|
45
|
+
// This method handles both launching the extension if installed
|
|
46
|
+
// or redirecting to the Chrome Web Store if not installed
|
|
35
47
|
try {
|
|
36
48
|
await KeyringConnect.launchExtension(extensionConfig);
|
|
37
49
|
} catch (error) {
|
|
38
|
-
console.error(
|
|
50
|
+
console.error("Failed to launch Keyring Connect:", error);
|
|
39
51
|
}
|
|
40
52
|
```
|
|
41
53
|
|
|
@@ -43,7 +55,7 @@ try {
|
|
|
43
55
|
|
|
44
56
|
```typescript
|
|
45
57
|
export interface ExtensionState {
|
|
46
|
-
status:
|
|
58
|
+
status: "idle" | "mounted" | "proving" | "prove_success" | "error";
|
|
47
59
|
manifest?: any;
|
|
48
60
|
error?: string; // error message, only if status is 'error'
|
|
49
61
|
user?: User;
|
|
@@ -52,11 +64,55 @@ export interface ExtensionState {
|
|
|
52
64
|
const extensionState = await KeyringConnect.getExtensionState();
|
|
53
65
|
```
|
|
54
66
|
|
|
55
|
-
|
|
67
|
+
### Integration Example
|
|
56
68
|
|
|
57
|
-
|
|
69
|
+
```typescript
|
|
70
|
+
import { useEffect, useState } from "react";
|
|
71
|
+
import {
|
|
72
|
+
ExtensionSDKConfig,
|
|
73
|
+
KeyringConnect,
|
|
74
|
+
} from "@keyringnetwork/keyring-connect-sdk";
|
|
75
|
+
|
|
76
|
+
function KeyringConnectButton() {
|
|
77
|
+
const [isInstalled, setIsInstalled] = useState<boolean | undefined>(
|
|
78
|
+
undefined
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
// Check if extension is installed
|
|
82
|
+
useEffect(() => {
|
|
83
|
+
const checkExtension = async () => {
|
|
84
|
+
const isInstalled = await KeyringConnect.isKeyringConnectInstalled();
|
|
85
|
+
setIsInstalled(isInstalled);
|
|
86
|
+
};
|
|
87
|
+
checkExtension();
|
|
88
|
+
}, []);
|
|
89
|
+
|
|
90
|
+
// Configure your app
|
|
91
|
+
const config: ExtensionSDKConfig = {
|
|
92
|
+
app_url: window.location.origin,
|
|
93
|
+
name: "My App",
|
|
94
|
+
logo_url: "https://myapp.com/logo.png",
|
|
95
|
+
policy_id: 7,
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
// Launch the extension (handles both installed and not installed cases)
|
|
99
|
+
const launchExtension = () => {
|
|
100
|
+
KeyringConnect.launchExtension(config);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
if (isInstalled === undefined) {
|
|
104
|
+
return <button disabled>Checking extension...</button>;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return (
|
|
108
|
+
<button onClick={launchExtension}>
|
|
109
|
+
{isInstalled ? "Launch Extension" : "Install Extension"}
|
|
110
|
+
</button>
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
```
|
|
58
114
|
|
|
59
|
-
|
|
115
|
+
## API Reference
|
|
60
116
|
|
|
61
117
|
#### Core Types Overview
|
|
62
118
|
|