@keyringnetwork/keyring-connect-sdk 1.1.4 → 2.0.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.
@@ -546,6 +546,24 @@
546
546
  "id": "revolut_kyc_verified",
547
547
  "label": "KYC Verified",
548
548
  "rule_id": "revolut_kyc_verified"
549
+ },
550
+ {
551
+ "entity_type": "individual",
552
+ "id": "revolut_kyc_not_under_review",
553
+ "label": "KYC Not Under Review",
554
+ "rule_id": "revolut_kyc_not_under_review"
555
+ },
556
+ {
557
+ "entity_type": "individual",
558
+ "id": "revolut_kyc_user_status_active",
559
+ "label": "KYC User Status Active",
560
+ "rule_id": "revolut_kyc_user_status_active"
561
+ },
562
+ {
563
+ "entity_type": "individual",
564
+ "id": "revolut_kyc_not_in_fatf_tlsn-revolut-kyc",
565
+ "label": "Revolut Residence Country not on FATF",
566
+ "rule_id": "revolut_kyc_not_in_fatf_tlsn-revolut-kyc"
549
567
  }
550
568
  ],
551
569
  "endpoint": {
@@ -595,5 +613,50 @@
595
613
  "Navigate to your profile page",
596
614
  "The verification process will start automatically"
597
615
  ]
616
+ },
617
+ {
618
+ "id": "tlsn-keyring-connect",
619
+ "image": "https://uploads-ssl.webflow.com/65df8e71bab45b70f5433fba/664359927ac82d0c110ff6be_Keyring%20Icon%20Square.svg",
620
+ "label": "keyring-connect",
621
+ "link": "https://app.keyringdev.network",
622
+ "login_url": "https://app.keyringdev.network/login",
623
+ "name": "Keyring Connect",
624
+ "proof_sources": [
625
+ {
626
+ "claims": [
627
+ {
628
+ "entity_type": "individual",
629
+ "id": "keyring_connect_kyc",
630
+ "label": "KYC from Keyring Connect",
631
+ "rule_id": "keyring_connect_kyc"
632
+ }
633
+ ],
634
+ "endpoint": {
635
+ "body": null,
636
+ "data_bounds": null,
637
+ "disclosable_fields": [
638
+ {
639
+ "label": "user id",
640
+ "path": "id",
641
+ "key": "user_id"
642
+ }
643
+ ],
644
+ "headers": [
645
+ "user-agent",
646
+ "authorization"
647
+ ],
648
+ "method": "GET",
649
+ "required_cookies": null,
650
+ "url": "https://main.api.keyring-backend.krndev.net/api/v1/onboarding/users/me"
651
+ },
652
+ "id": "tlsn-keyring-connect-kyc",
653
+ "label": "KYC from Keyring Connect"
654
+ }
655
+ ],
656
+ "target_url": null,
657
+ "user_actions": [
658
+ "Make sure you have logged in",
659
+ "Navigate to the marketplace"
660
+ ]
598
661
  }
599
662
  ]
package/dist/main.d.ts CHANGED
@@ -18,6 +18,7 @@ export declare class KeyringConnect {
18
18
  */
19
19
  static getExtensionState(): Promise<ExtensionState>;
20
20
  private static validateClientConfig;
21
+ private static validateCredentialConfig;
21
22
  private static validateProofConfig;
22
23
  private static validateDatasource;
23
24
  private static validateConfigData;
package/dist/main.js CHANGED
@@ -89,6 +89,22 @@ class KeyringConnect {
89
89
  throw new Error("Policy ID is required");
90
90
  }
91
91
  }
92
+ static validateCredentialConfig(config) {
93
+ if (!config.credential_config) {
94
+ return config;
95
+ }
96
+ if (!config.credential_config.chain_id) {
97
+ throw new Error("Chain ID is required");
98
+ }
99
+ if (!config.credential_config.wallet_address) {
100
+ throw new Error("Wallet address is required");
101
+ }
102
+ const validChainIds = Object.keys(types_1.CHAIN_IDS[types_1.CHAIN_FAMILY.EVM]).map((key) => types_1.CHAIN_IDS[types_1.CHAIN_FAMILY.EVM][key]);
103
+ if (!validChainIds.includes(config.credential_config.chain_id)) {
104
+ throw new Error("Invalid chain ID");
105
+ }
106
+ return config;
107
+ }
92
108
  static validateProofConfig(config) {
93
109
  var _a;
94
110
  if ((_a = config.proof_config) === null || _a === void 0 ? void 0 : _a.datasource) {
@@ -121,6 +137,7 @@ class KeyringConnect {
121
137
  const validatedConfig = this.validateDatasource(config);
122
138
  this.validateClientConfig(validatedConfig);
123
139
  this.validateProofConfig(validatedConfig);
140
+ this.validateCredentialConfig(validatedConfig);
124
141
  return validatedConfig;
125
142
  }
126
143
  static convertToLaunchConfig(config) {
@@ -132,15 +149,15 @@ class KeyringConnect {
132
149
  client_logo_url: config.logo_url,
133
150
  client_policy_id: config.policy_id,
134
151
  client_entity_id: (_a = config.krn_config) === null || _a === void 0 ? void 0 : _a.entity_id,
152
+ isolate_proving: !!config.credential_config,
153
+ credential_config: config.credential_config,
135
154
  },
136
155
  krn_config: config.krn_config
137
156
  ? {
138
157
  keyring_api_url: config.krn_config.keyring_api_url,
139
158
  keyring_user_app_url: config.krn_config.keyring_user_app_url,
140
159
  analytics_api_url: config.krn_config.analytics_api_url,
141
- isolate_proving: config.krn_config.isolate_proving,
142
160
  notaryUrl: config.krn_config.notaryUrl,
143
- notaryWebsocketUrl: config.krn_config.notaryWebsocketUrl,
144
161
  websocketProxyUrl: config.krn_config.websocketProxyUrl,
145
162
  }
146
163
  : undefined,
package/dist/types.d.ts CHANGED
@@ -26,6 +26,13 @@ export type ExtensionSDKConfig = {
26
26
  * The policy ID of the client.
27
27
  */
28
28
  policy_id: number;
29
+ /**
30
+ * If configured, will skip wallet interaction and on-chain credential creation and return calldata instead.
31
+ */
32
+ credential_config?: {
33
+ chain_id: SupportedChainId;
34
+ wallet_address: string;
35
+ };
29
36
  /**
30
37
  * Additional configuration to customize the extension's verification process.
31
38
  * @note should be used with caution as strict validation is applied to the proof config.
@@ -44,12 +51,32 @@ export type ExtensionSDKConfig = {
44
51
  analytics_api_url?: string;
45
52
  keyring_access_token?: string;
46
53
  entity_id?: string;
47
- isolate_proving?: boolean;
48
54
  notaryUrl?: string;
49
- notaryWebsocketUrl?: string;
50
55
  websocketProxyUrl?: string;
51
56
  };
52
57
  };
58
+ export declare enum CHAIN_FAMILY {
59
+ EVM = "EVM",
60
+ SOLANA = "SOLANA"
61
+ }
62
+ export declare const CHAIN_IDS: {
63
+ readonly EVM: {
64
+ readonly MAINNET: 1;
65
+ readonly OPTIMISM: 10;
66
+ readonly SEPOLIA: 11155111;
67
+ readonly ARBITRUM: 42161;
68
+ readonly BASE: 8453;
69
+ readonly ZKSYNC: 324;
70
+ readonly AVALANCHE: 43114;
71
+ readonly POLYGON: 137;
72
+ readonly HOLESKY: 17000;
73
+ };
74
+ readonly SOLANA: {
75
+ readonly MAINNET: 1915121141;
76
+ };
77
+ };
78
+ export type EVMChainId = (typeof CHAIN_IDS)[typeof CHAIN_FAMILY.EVM][keyof (typeof CHAIN_IDS)[typeof CHAIN_FAMILY.EVM]];
79
+ export type SupportedChainId = EVMChainId;
53
80
  export type ExtensionLaunchConfig = {
54
81
  client: {
55
82
  client_name: string;
@@ -57,6 +84,11 @@ export type ExtensionLaunchConfig = {
57
84
  client_logo_url: string;
58
85
  client_policy_id: number;
59
86
  client_entity_id?: string;
87
+ isolate_proving?: boolean;
88
+ credential_config?: {
89
+ chain_id: SupportedChainId;
90
+ wallet_address: string;
91
+ };
60
92
  };
61
93
  proof_config?: {
62
94
  datasource?: DataSource;
@@ -66,9 +98,7 @@ export type ExtensionLaunchConfig = {
66
98
  keyring_api_url?: string;
67
99
  keyring_user_app_url?: string;
68
100
  analytics_api_url?: string;
69
- isolate_proving?: boolean;
70
101
  notaryUrl?: string;
71
- notaryWebsocketUrl?: string;
72
102
  websocketProxyUrl?: string;
73
103
  };
74
104
  session_info?: {
@@ -106,6 +136,7 @@ export interface ExtensionState {
106
136
  error?: string;
107
137
  user?: User;
108
138
  tlsn_proof?: string;
139
+ credentialData?: CredentialData;
109
140
  }
110
141
  export interface DataSource {
111
142
  id: string;
@@ -148,3 +179,13 @@ export interface DisclosableField {
148
179
  path: string;
149
180
  key: string;
150
181
  }
182
+ export interface CredentialData {
183
+ trader: `0x${string}`;
184
+ policyId: number;
185
+ chainId: number;
186
+ validUntil: number;
187
+ cost: number;
188
+ key: string;
189
+ signature: string;
190
+ backdoor: string;
191
+ }
package/dist/types.js CHANGED
@@ -1,9 +1,31 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EVENT_ACTIONS = void 0;
3
+ exports.CHAIN_IDS = exports.CHAIN_FAMILY = exports.EVENT_ACTIONS = void 0;
4
4
  var EVENT_ACTIONS;
5
5
  (function (EVENT_ACTIONS) {
6
6
  EVENT_ACTIONS["LAUNCH_KEYRING_CONNECT"] = "LAUNCH_KEYRING_CONNECT";
7
7
  EVENT_ACTIONS["GET_STATUS"] = "GET_STATUS";
8
8
  EVENT_ACTIONS["KEYRING_CONNECT_STATUS"] = "KEYRING_CONNECT_STATUS";
9
9
  })(EVENT_ACTIONS || (exports.EVENT_ACTIONS = EVENT_ACTIONS = {}));
10
+ var CHAIN_FAMILY;
11
+ (function (CHAIN_FAMILY) {
12
+ CHAIN_FAMILY["EVM"] = "EVM";
13
+ CHAIN_FAMILY["SOLANA"] = "SOLANA";
14
+ })(CHAIN_FAMILY || (exports.CHAIN_FAMILY = CHAIN_FAMILY = {}));
15
+ // Define chain IDs by family
16
+ exports.CHAIN_IDS = {
17
+ [CHAIN_FAMILY.EVM]: {
18
+ MAINNET: 1,
19
+ OPTIMISM: 10,
20
+ SEPOLIA: 11155111,
21
+ ARBITRUM: 42161,
22
+ BASE: 8453,
23
+ ZKSYNC: 324,
24
+ AVALANCHE: 43114,
25
+ POLYGON: 137,
26
+ HOLESKY: 17000,
27
+ },
28
+ [CHAIN_FAMILY.SOLANA]: {
29
+ MAINNET: 1915121141,
30
+ },
31
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keyringnetwork/keyring-connect-sdk",
3
- "version": "1.1.4",
3
+ "version": "2.0.1",
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",
@@ -20,7 +20,5 @@
20
20
  "ts-node": "^10.9.2",
21
21
  "typescript": "^5.6.3"
22
22
  },
23
- "dependencies": {
24
- "jwt-decode": "^4.0.0"
25
- }
26
- }
23
+ "dependencies": {}
24
+ }
package/readme.md CHANGED
@@ -17,6 +17,7 @@ pnpm install @keyringnetwork/keyring-connect-sdk
17
17
  - Redirect the user back to the app where they left off after extension installation
18
18
  - Monitor extension status and user state
19
19
  - Full TypeScript support with comprehensive type definitions
20
+ - Support for isolated proving mode (verification without credential creation)
20
21
 
21
22
  ## Usage
22
23