@keyringnetwork/keyring-connect-sdk 1.0.7 → 1.0.9

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.
@@ -0,0 +1,650 @@
1
+ [
2
+ {
3
+ "id": "tlsn-binance",
4
+ "image": "https://main.cdn.krnprod.net/logos/binance.png",
5
+ "label": "binance",
6
+ "link": "https://www.binance.com",
7
+ "login_url": "https://accounts.binance.com/login",
8
+ "name": "Binance",
9
+ "proof_sources": [
10
+ {
11
+ "claims": [
12
+ {
13
+ "entity_type": "individual",
14
+ "id": "109d3384-e2af-4e13-aefe-018aff23e575",
15
+ "label": "KYC Level >= INTERMEDIATE",
16
+ "rule_id": "0x9585e5e99c1d0998cf51549ee4fcb0bb91fcecedcc53d84ef5ef25e6807055ca"
17
+ },
18
+ {
19
+ "entity_type": "individual",
20
+ "id": "782f0aac-2655-4b07-8ec7-1f2215fcf996",
21
+ "label": "User POA Country not on FATF",
22
+ "rule_id": "0xfc2234a1fbb0317498957fd4235d31316f0ff2359ed18f4b3f09f86dda3ed189"
23
+ },
24
+ {
25
+ "entity_type": "individual",
26
+ "id": "782f0aac-2655-4b07-8ec7-1f2215fcf997",
27
+ "label": "User Account Type",
28
+ "rule_id": "0xf1c8b5068f39f13c7bbf5128563be0d7277bb5712e2cada98c8d275170d4c105"
29
+ }
30
+ ],
31
+ "endpoint": {
32
+ "body": null,
33
+ "data_bounds": null,
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
+ {
51
+ "label": "kyc level",
52
+ "path": "data.passKycLevel",
53
+ "key": "kyc_level"
54
+ },
55
+ {
56
+ "label": "country of primary address",
57
+ "path": "data.fillInfo.residenceCountry",
58
+ "key": "country_of_primary_address"
59
+ },
60
+ {
61
+ "label": "account type",
62
+ "path": "data.type",
63
+ "key": "account_type"
64
+ }
65
+ ],
66
+ "headers": [
67
+ "clienttype",
68
+ "csrftoken",
69
+ "cookie",
70
+ "user-agent"
71
+ ],
72
+ "method": "POST",
73
+ "required_cookies": [
74
+ "p20t"
75
+ ],
76
+ "url": "https://www.binance.com/bapi/kyc/v2/private/certificate/user-kyc/current-kyc-status"
77
+ },
78
+ "id": "tlsn-binance-kyc",
79
+ "label": "KYC from Binance"
80
+ },
81
+ {
82
+ "claims": [
83
+ {
84
+ "entity_type": "business",
85
+ "id": "782f0aac-2655-4b07-8ec7-1f2215fcf998",
86
+ "label": "KYB Verified",
87
+ "rule_id": "0xdf536a0462f3a9d7a67f2f1f1885ea6caa8d146dd247cc22590adb2b63932fc5"
88
+ },
89
+ {
90
+ "entity_type": "business",
91
+ "id": "782f0aac-2655-4b07-8ec7-1f2215fcf999",
92
+ "label": "Business POA Country not on FATF",
93
+ "rule_id": "0xb756ee391611a6e9303e673ee3d65cae1f7a308b3be131d99b2f131a3497a936"
94
+ },
95
+ {
96
+ "entity_type": "business",
97
+ "id": "782f0aac-2655-4b07-8ec7-1f2215fd0000",
98
+ "label": "Business Account Type",
99
+ "rule_id": "0xd9f75a927c9af7fdbedd3925ed32611d87900c41822faad7ecf9665e179c63db"
100
+ }
101
+ ],
102
+ "endpoint": {
103
+ "body": null,
104
+ "data_bounds": null,
105
+ "disclosable_fields": [
106
+ {
107
+ "label": "kyb status",
108
+ "path": "data.kycStatus",
109
+ "key": "kyb_status"
110
+ },
111
+ {
112
+ "label": "company name",
113
+ "path": "data.fillInfo.companyName",
114
+ "key": "company_name"
115
+ },
116
+ {
117
+ "label": "country of primary address",
118
+ "path": "data.fillInfo.residenceCountry",
119
+ "key": "country_of_primary_address"
120
+ },
121
+ {
122
+ "label": "kyb message detail",
123
+ "path": "data.frontDisplayLevelMsg",
124
+ "key": "kyb_message_detail"
125
+ },
126
+ {
127
+ "label": "account type",
128
+ "path": "data.type",
129
+ "key": "account_type"
130
+ }
131
+ ],
132
+ "headers": [
133
+ "clienttype",
134
+ "csrftoken",
135
+ "cookie",
136
+ "user-agent"
137
+ ],
138
+ "method": "POST",
139
+ "required_cookies": [
140
+ "p20t"
141
+ ],
142
+ "url": "https://www.binance.com/bapi/kyc/v2/private/certificate/user-kyc/current-kyc-status"
143
+ },
144
+ "id": "tlsn-binance-kyb",
145
+ "label": "KYB from Binance"
146
+ }
147
+ ],
148
+ "target_url": null,
149
+ "user_actions": [
150
+ "Login",
151
+ "Navigate to your Dashboard",
152
+ "The verification process will start automatically"
153
+ ]
154
+ },
155
+ {
156
+ "id": "tlsn-kraken",
157
+ "image": "https://main.cdn.krnprod.net/logos/kraken.jpg",
158
+ "label": "Kraken",
159
+ "link": "https://www.kraken.com",
160
+ "login_url": "https://www.kraken.com/sign-in",
161
+ "name": "Kraken",
162
+ "proof_sources": [
163
+ {
164
+ "claims": [
165
+ {
166
+ "entity_type": "business",
167
+ "id": "241f4b43-8b4f-4760-ac7a-dbb929dd24cf",
168
+ "label": "KYB Tier 4 (Full KYB)",
169
+ "rule_id": "e475888c95ee4a6dbfcaeeab5895f389"
170
+ },
171
+ {
172
+ "entity_type": "business",
173
+ "id": "f9b064c0-b203-4b67-9632-5d6bf3c58940",
174
+ "label": "Business Country not on FATF",
175
+ "rule_id": "06058644a4474d4885349d66f2fe3b61"
176
+ },
177
+ {
178
+ "entity_type": "business",
179
+ "id": "34b778de-2ae1-43fe-afd2-d9d213be0d29",
180
+ "label": "Pro Business Account Type",
181
+ "rule_id": "a272c98c3d014098b250e16965204c9c"
182
+ },
183
+ {
184
+ "entity_type": "business",
185
+ "id": "41549275-a867-4c88-aff2-3c591d16c4cb",
186
+ "label": "Verified Address",
187
+ "rule_id": "a28fd396693d447aa6981c4b67f93bac"
188
+ }
189
+ ],
190
+ "endpoint": {
191
+ "body": null,
192
+ "data_bounds": {
193
+ "max_recv_data": 2500,
194
+ "max_sent_data": 800
195
+ },
196
+ "disclosable_fields": [
197
+ {
198
+ "label": "user kyc",
199
+ "path": "result.access.user_kyc",
200
+ "key": "user_kyc"
201
+ },
202
+ {
203
+ "label": "first name",
204
+ "path": "result.first_name",
205
+ "key": "first_name"
206
+ },
207
+ {
208
+ "label": "country",
209
+ "path": "result.country",
210
+ "key": "country"
211
+ },
212
+ {
213
+ "label": "tier bucket",
214
+ "path": "result.tier_bucket",
215
+ "key": "tier_bucket"
216
+ },
217
+ {
218
+ "label": "tier verified",
219
+ "path": "result.tier_verified",
220
+ "key": "tier_verified"
221
+ }
222
+ ],
223
+ "headers": [
224
+ "accept",
225
+ "accept-language",
226
+ "cookie",
227
+ "referer",
228
+ "user-agent"
229
+ ],
230
+ "method": "GET",
231
+ "required_cookies": [
232
+ "SESSID"
233
+ ],
234
+ "url": "https://iapi.kraken.com/api/internal/account/profile"
235
+ },
236
+ "id": "tlsn-kraken-kyb",
237
+ "label": "Profile information from Kraken"
238
+ },
239
+ {
240
+ "claims": [
241
+ {
242
+ "entity_type": "individual",
243
+ "id": "62d7d554-bf4f-4c27-9d20-0a42e10fd717",
244
+ "label": "KYB Tier 3+ (Verified ID)",
245
+ "rule_id": "f475888c95ee4a6dbfcaeeab5895f390"
246
+ },
247
+ {
248
+ "entity_type": "individual",
249
+ "id": "e3aadb6d-04a9-48be-acde-4ebdacfe14c0",
250
+ "label": "Country not on FATF",
251
+ "rule_id": "16058644a4474d4885349d66f2fe3b62"
252
+ },
253
+ {
254
+ "entity_type": "individual",
255
+ "id": "34079544-ea30-42e0-a4f2-9b43bba0a582",
256
+ "label": "Retail Account Type",
257
+ "rule_id": "c272c98c3d014098b250e16965204c9e"
258
+ }
259
+ ],
260
+ "endpoint": {
261
+ "body": null,
262
+ "data_bounds": {
263
+ "max_recv_data": 2500,
264
+ "max_sent_data": 800
265
+ },
266
+ "disclosable_fields": [
267
+ {
268
+ "label": "user kyc",
269
+ "path": "result.access.user_kyc",
270
+ "key": "user_kyc"
271
+ },
272
+ {
273
+ "label": "first name",
274
+ "path": "result.first_name",
275
+ "key": "first_name"
276
+ },
277
+ {
278
+ "label": "country",
279
+ "path": "result.country",
280
+ "key": "country"
281
+ },
282
+ {
283
+ "label": "tier bucket",
284
+ "path": "result.tier_bucket",
285
+ "key": "tier_bucket"
286
+ },
287
+ {
288
+ "label": "tier verified",
289
+ "path": "result.tier_verified",
290
+ "key": "tier_verified"
291
+ }
292
+ ],
293
+ "headers": [
294
+ "accept",
295
+ "accept-language",
296
+ "cookie",
297
+ "referer",
298
+ "user-agent"
299
+ ],
300
+ "method": "GET",
301
+ "required_cookies": [
302
+ "SESSID"
303
+ ],
304
+ "url": "https://iapi.kraken.com/api/internal/account/profile"
305
+ },
306
+ "id": "tlsn-kraken-kyc",
307
+ "label": "Profile information from Kraken"
308
+ }
309
+ ],
310
+ "target_url": null,
311
+ "user_actions": [
312
+ "Log in",
313
+ "Navigate to your Profile page",
314
+ "The verification process will start automatically"
315
+ ]
316
+ },
317
+ {
318
+ "id": "tlsn-binance-us",
319
+ "image": "https://main.cdn.krnprod.net/logos/binance-us.svg",
320
+ "label": "binance-us",
321
+ "link": "https://www.binance.us",
322
+ "login_url": "https://accounts.binance.us/login",
323
+ "name": "Binance US",
324
+ "proof_sources": [
325
+ {
326
+ "claims": [
327
+ {
328
+ "entity_type": "individual",
329
+ "id": "75eebf24-5dfe-4b3d-b651-f21fff1786c4",
330
+ "label": "KYC Verified",
331
+ "rule_id": "d6f67da1ee70413a98cdf36c273bf7d2"
332
+ },
333
+ {
334
+ "entity_type": "individual",
335
+ "id": "18e9f113-5110-4abb-b6e9-da07dcfeb41f",
336
+ "label": "User POA Country not on FATF",
337
+ "rule_id": "af82a3a40d4f4da3b4bbde107d6c2955"
338
+ },
339
+ {
340
+ "entity_type": "individual",
341
+ "id": "2a5d69a3-1ead-4be6-9112-760b6432c3d8",
342
+ "label": "Individual Account Type",
343
+ "rule_id": "6ee0a58a6caa43bb8f8a769339c50648"
344
+ }
345
+ ],
346
+ "endpoint": {
347
+ "body": null,
348
+ "data_bounds": {
349
+ "max_recv_data": 10000,
350
+ "max_sent_data": 1000
351
+ },
352
+ "disclosable_fields": [
353
+ {
354
+ "label": "country",
355
+ "path": "data.userDetails.country",
356
+ "key": "country"
357
+ },
358
+ {
359
+ "label": "kyc level",
360
+ "path": "data.userKycStatus.kycLevel",
361
+ "key": "kyc_level"
362
+ },
363
+ {
364
+ "label": "kyc type",
365
+ "path": "data.userKycStatus.kycType",
366
+ "key": "kyc_type"
367
+ }
368
+ ],
369
+ "headers": [
370
+ "clienttype",
371
+ "cookie",
372
+ "user-agent",
373
+ "csrftoken"
374
+ ],
375
+ "method": "GET",
376
+ "required_cookies": [
377
+ "p20t"
378
+ ],
379
+ "url": "https://www.binance.us/gateway/entry/private/v1/web-home/user-details"
380
+ },
381
+ "id": "tlsn-binance-us-kyc",
382
+ "label": "KYC from Binance US"
383
+ },
384
+ {
385
+ "claims": [
386
+ {
387
+ "entity_type": "business",
388
+ "id": "26db829e-ded2-4046-9626-7a1867d5be06",
389
+ "label": "KYB Verified",
390
+ "rule_id": "991cbd81da01446b86bb0153d3c45243"
391
+ },
392
+ {
393
+ "entity_type": "business",
394
+ "id": "81d4d669-f626-4dfb-9966-c783d2f3dddb",
395
+ "label": "Business POA Country not on FATF",
396
+ "rule_id": "afe033c3a2ed4094bfedb43b99b35bc9"
397
+ },
398
+ {
399
+ "entity_type": "business",
400
+ "id": "a99d0cf5-ee75-4ddf-b3e2-aabb794450f2",
401
+ "label": "Business Account Type",
402
+ "rule_id": "8f7c1dfa4c7c48bca407817c0312c9f7"
403
+ }
404
+ ],
405
+ "endpoint": {
406
+ "body": null,
407
+ "data_bounds": {
408
+ "max_recv_data": 10000,
409
+ "max_sent_data": 1000
410
+ },
411
+ "disclosable_fields": [
412
+ {
413
+ "label": "country of primary address",
414
+ "path": "data.userDetails.country",
415
+ "key": "country_of_primary_address"
416
+ },
417
+ {
418
+ "label": "kyc level",
419
+ "path": "data.userKycStatus.kycLevel",
420
+ "key": "kyc_level"
421
+ },
422
+ {
423
+ "label": "kyc type",
424
+ "path": "data.userKycStatus.kycType",
425
+ "key": "kyc_type"
426
+ }
427
+ ],
428
+ "headers": [
429
+ "clienttype",
430
+ "cookie",
431
+ "user-agent",
432
+ "csrftoken"
433
+ ],
434
+ "method": "GET",
435
+ "required_cookies": [
436
+ "p20t"
437
+ ],
438
+ "url": "https://www.binance.us/gateway/entry/private/v1/web-home/user-details"
439
+ },
440
+ "id": "tlsn-binance-us-kyb",
441
+ "label": "KYB from Binance US"
442
+ }
443
+ ],
444
+ "target_url": null,
445
+ "user_actions": [
446
+ "Login",
447
+ "Navigate to your dashboard",
448
+ "The verification process will start automatically"
449
+ ]
450
+ },
451
+ {
452
+ "id": "tlsn-fidelity",
453
+ "image": "https://main.cdn.krnprod.net/logos/fidelity.jpg",
454
+ "label": "fidelity",
455
+ "link": "https://www.fidelity.com",
456
+ "login_url": "https://digital.fidelity.com/ftgw/digital/profile",
457
+ "name": "Fidelity",
458
+ "proof_sources": [
459
+ {
460
+ "claims": [],
461
+ "endpoint": {
462
+ "body": "{\"dpIdCache\":null}",
463
+ "data_bounds": {
464
+ "max_recv_data": 10000,
465
+ "max_sent_data": 5000
466
+ },
467
+ "disclosable_fields": [
468
+ {
469
+ "label": "full name",
470
+ "path": "customer.name",
471
+ "key": "full_name"
472
+ },
473
+ {
474
+ "label": "mailing address",
475
+ "path": "customer.addresses.mailing",
476
+ "key": "mailing_address"
477
+ }
478
+ ],
479
+ "headers": [
480
+ "Accept",
481
+ "Content-Type",
482
+ "X-xsrf-token",
483
+ "Cookie",
484
+ "User-Agent"
485
+ ],
486
+ "method": "POST",
487
+ "required_cookies": [
488
+ "ap126386_session",
489
+ "FC",
490
+ "MC",
491
+ "RC",
492
+ "SC",
493
+ "ATC"
494
+ ],
495
+ "url": "https://digital.fidelity.com/ftgw/digital/profile/api/personal/info"
496
+ },
497
+ "id": "tlsn-fidelity-profile",
498
+ "label": "Profile information from Fidelity"
499
+ }
500
+ ],
501
+ "target_url": null,
502
+ "user_actions": [
503
+ "Login",
504
+ "Navigate to your profile page",
505
+ "The verification process will start automatically"
506
+ ]
507
+ },
508
+ {
509
+ "id": "tlsn-coinbase",
510
+ "image": "https://main.cdn.krnprod.net/logos/coinbase.svg",
511
+ "label": "Coinbase",
512
+ "link": "https://www.coinbase.com",
513
+ "login_url": "https://login.coinbase.com/signin",
514
+ "name": "Coinbase",
515
+ "proof_sources": [
516
+ {
517
+ "claims": [
518
+ {
519
+ "entity_type": "individual",
520
+ "id": "9c276689-aa24-4e10-847c-6dd8097dabe0",
521
+ "label": "KYC Verified",
522
+ "rule_id": "ac0ced0317ac4543b9761c6c0f54dade"
523
+ },
524
+ {
525
+ "entity_type": "individual",
526
+ "id": "3bfbc9f3-edde-44b3-8aec-d514058cc0f3",
527
+ "label": "Coinbase Residence country is not on FATF BList",
528
+ "rule_id": "c1313e05ee4f488da18be760b24df34d"
529
+ }
530
+ ],
531
+ "endpoint": {
532
+ "body": null,
533
+ "data_bounds": null,
534
+ "disclosable_fields": [
535
+ {
536
+ "label": "next requirement",
537
+ "path": "data.viewer.userProperties.nextRequirement",
538
+ "key": "next_requirement"
539
+ },
540
+ {
541
+ "label": "country",
542
+ "path": "data.viewer.userProperties.country.code",
543
+ "key": "country"
544
+ }
545
+ ],
546
+ "headers": [
547
+ "Content-Type",
548
+ "Cookie"
549
+ ],
550
+ "method": "GET",
551
+ "required_cookies": [
552
+ "unified-session-manager-cookie"
553
+ ],
554
+ "url": "https://www.coinbase.com/graphql/query?operationName=userQuery&query=query+userQuery%7Bviewer%7BuserProperties%7BnextRequirement+country%7Bcode%7D%7D%7D%7D&variables=%7B%7D"
555
+ },
556
+ "id": "tlsn-coinbase-kyc",
557
+ "label": "User information from Coinbase"
558
+ }
559
+ ],
560
+ "target_url": "https://www.coinbase.com/graphql/query?&operationName=userQuery&extensions=%7B%22persistedQuery%22%3A%7B%22version%22%3A1%2C%22sha256Hash%22%3A%229a1820595fa25fa475a39d59515aafbaba7a37ccf8633185957b7508929426e5%22%7D%7D&variables=%7B%7D",
561
+ "user_actions": [
562
+ "Login",
563
+ "Navigate to your profile page",
564
+ "The verification process will start automatically"
565
+ ]
566
+ },
567
+ {
568
+ "id": "tlsn-revolut",
569
+ "image": "https://main.cdn.krnprod.net/logos/revolut.svg",
570
+ "label": "Revolut",
571
+ "link": "https://www.revolut.com",
572
+ "login_url": "https://sso.revolut.com/signin",
573
+ "name": "Revolut",
574
+ "proof_sources": [
575
+ {
576
+ "claims": [
577
+ {
578
+ "entity_type": "individual",
579
+ "id": "revolut-kyc-not-fatf-blacklist",
580
+ "label": "Not on FATF Blacklist",
581
+ "rule_id": "revolut-kyc-not-fatf-blacklist"
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"
600
+ }
601
+ ],
602
+ "endpoint": {
603
+ "body": null,
604
+ "data_bounds": {
605
+ "max_recv_data": 10000,
606
+ "max_sent_data": 5000
607
+ },
608
+ "disclosable_fields": [
609
+ {
610
+ "label": "country address",
611
+ "path": "user.address.country",
612
+ "key": "country_address"
613
+ },
614
+ {
615
+ "label": "user status",
616
+ "path": "user.state",
617
+ "key": "user_status"
618
+ },
619
+ {
620
+ "label": "kyc verification",
621
+ "path": "user.kyc",
622
+ "key": "kyc_verification"
623
+ },
624
+ {
625
+ "label": "under review",
626
+ "path": "user.underReview",
627
+ "key": "under_review"
628
+ }
629
+ ],
630
+ "headers": [
631
+ "Cookie",
632
+ "User-Agent",
633
+ "x-device-id"
634
+ ],
635
+ "method": "GET",
636
+ "required_cookies": null,
637
+ "url": "https://app.revolut.com/api/retail/user/current"
638
+ },
639
+ "id": "tlsn-revolut-kyc",
640
+ "label": "User information from revolut"
641
+ }
642
+ ],
643
+ "target_url": "https://app.revolut.com/api/retail/user/current/wallet",
644
+ "user_actions": [
645
+ "Login",
646
+ "Navigate to your profile page",
647
+ "The verification process will start automatically"
648
+ ]
649
+ }
650
+ ]
package/dist/main.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ExtensionSDKConfig, ExtensionState } from './types';
1
+ import { ExtensionSDKConfig, ExtensionState } from "./types";
2
2
  /**
3
3
  * Class for interacting with the Keyring Connect browser extension
4
4
  */
@@ -19,5 +19,7 @@ export declare class KeyringConnect {
19
19
  static getExtensionState(): Promise<ExtensionState>;
20
20
  private static validateClientConfig;
21
21
  private static validateProofConfig;
22
+ private static validateDatasource;
23
+ private static validateConfigData;
22
24
  private static convertToLaunchConfig;
23
25
  }
package/dist/main.js CHANGED
@@ -8,9 +8,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
11
14
  Object.defineProperty(exports, "__esModule", { value: true });
12
15
  exports.KeyringConnect = void 0;
13
16
  const jwt_decode_1 = require("jwt-decode");
17
+ const datasources_json_1 = __importDefault(require("./constants/datasources.json"));
14
18
  const types_1 = require("./types");
15
19
  /**
16
20
  * Class for interacting with the Keyring Connect browser extension
@@ -35,9 +39,8 @@ class KeyringConnect {
35
39
  }
36
40
  return;
37
41
  }
38
- this.validateClientConfig(data);
39
- this.validateProofConfig(data);
40
- let launchConfig = this.convertToLaunchConfig(data);
42
+ const validatedConfig = this.validateConfigData(data);
43
+ let launchConfig = this.convertToLaunchConfig(validatedConfig);
41
44
  if ((_a = data.krn_config) === null || _a === void 0 ? void 0 : _a.auth0_id_token) {
42
45
  try {
43
46
  const decodedJwt = (0, jwt_decode_1.jwtDecode)(data.krn_config.auth0_id_token);
@@ -111,6 +114,29 @@ class KeyringConnect {
111
114
  }
112
115
  }
113
116
  }
117
+ static validateDatasource(config) {
118
+ var _a, _b;
119
+ if (!((_a = config.proof_config) === null || _a === void 0 ? void 0 : _a.datasource)) {
120
+ return config;
121
+ }
122
+ const datasource = datasources_json_1.default.find((datasource) => { var _a, _b; return datasource.id === ((_b = (_a = config.proof_config) === null || _a === void 0 ? void 0 : _a.datasource) === null || _b === void 0 ? void 0 : _b.id); });
123
+ const knownDatasources = datasources_json_1.default
124
+ .map((datasource) => datasource.name)
125
+ .join(", ");
126
+ if (!datasource) {
127
+ throw new Error(`Unsupported datasource. Connect to either of the supported datasources: ${knownDatasources}`);
128
+ }
129
+ return Object.assign(Object.assign({}, config), { proof_config: {
130
+ entity_type: (_b = config.proof_config) === null || _b === void 0 ? void 0 : _b.entity_type,
131
+ datasource,
132
+ } });
133
+ }
134
+ static validateConfigData(config) {
135
+ const validatedConfig = this.validateDatasource(config);
136
+ this.validateClientConfig(validatedConfig);
137
+ this.validateProofConfig(validatedConfig);
138
+ return validatedConfig;
139
+ }
114
140
  static convertToLaunchConfig(config) {
115
141
  var _a;
116
142
  const launchConfig = {
package/dist/types.d.ts CHANGED
@@ -3,6 +3,12 @@ export declare enum EVENT_ACTIONS {
3
3
  GET_STATUS = "GET_STATUS",
4
4
  KEYRING_CONNECT_STATUS = "KEYRING_CONNECT_STATUS"
5
5
  }
6
+ export type PartialDataSource = Pick<DataSource, "id"> & Partial<DataSource>;
7
+ export type ValidatedConfig = ExtensionSDKConfig & {
8
+ proof_config: {
9
+ datasource?: DataSource;
10
+ };
11
+ };
6
12
  export type ExtensionSDKConfig = {
7
13
  /**
8
14
  * The name of the client.
@@ -25,7 +31,7 @@ export type ExtensionSDKConfig = {
25
31
  * @note should be used with caution as strict validation is applied to the proof config.
26
32
  */
27
33
  proof_config?: {
28
- datasource: DataSource;
34
+ datasource?: PartialDataSource;
29
35
  entity_type?: string;
30
36
  };
31
37
  /**
@@ -52,7 +58,7 @@ export type ExtensionLaunchConfig = {
52
58
  client_entity_id?: string;
53
59
  };
54
60
  proof_config?: {
55
- datasource: DataSource;
61
+ datasource?: DataSource;
56
62
  entity_type?: string;
57
63
  };
58
64
  krn_config?: {
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "@keyringnetwork/keyring-connect-sdk",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
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
7
  "scripts": {
8
- "build": "rm -rf dist && tsc",
9
- "dev": "tsc --watch",
10
- "publish": "pnpm build && npm publish"
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"
11
12
  },
12
13
  "files": [
13
14
  "dist"