@polkadot/extension-base 0.57.1 → 0.58.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/background/handlers/Extension.d.ts +1 -0
- package/background/handlers/Extension.js +12 -0
- package/background/handlers/State.js +9 -2
- package/background/types.d.ts +1 -0
- package/cjs/background/handlers/Extension.d.ts +1 -0
- package/cjs/background/handlers/Extension.js +12 -0
- package/cjs/background/handlers/State.js +9 -2
- package/cjs/background/types.d.ts +1 -0
- package/cjs/packageInfo.js +1 -1
- package/package.json +14 -14
- package/packageInfo.js +1 -1
|
@@ -42,6 +42,7 @@ export default class Extension {
|
|
|
42
42
|
private derivationCreate;
|
|
43
43
|
private removeAuthorization;
|
|
44
44
|
private rejectAuthRequest;
|
|
45
|
+
private cancelAuthRequest;
|
|
45
46
|
private updateCurrentTabs;
|
|
46
47
|
private getConnectedTabsUrl;
|
|
47
48
|
handle<TMessageType extends MessageTypes>(id: string, type: TMessageType, request: RequestTypes[TMessageType], port?: chrome.runtime.Port): Promise<ResponseType<TMessageType>>;
|
|
@@ -374,12 +374,22 @@ export default class Extension {
|
|
|
374
374
|
const remAuth = await this.__internal__state.removeAuthorization(url);
|
|
375
375
|
return { list: remAuth };
|
|
376
376
|
}
|
|
377
|
+
// Reject the authorization request and add the URL to the authorized list with no keys.
|
|
378
|
+
// The site will not prompt for re-authorization on future visits.
|
|
377
379
|
rejectAuthRequest(id) {
|
|
378
380
|
const queued = this.__internal__state.getAuthRequest(id);
|
|
379
381
|
assert(queued, 'Unable to find request');
|
|
380
382
|
const { reject } = queued;
|
|
381
383
|
reject(new Error('Rejected'));
|
|
382
384
|
}
|
|
385
|
+
// Cancel the authorization request and do not add the URL to the authorized list.
|
|
386
|
+
// The site will prompt for authorization on future visits.
|
|
387
|
+
cancelAuthRequest(id) {
|
|
388
|
+
const queued = this.__internal__state.getAuthRequest(id);
|
|
389
|
+
assert(queued, 'Unable to find request');
|
|
390
|
+
const { reject } = queued;
|
|
391
|
+
reject(new Error('Cancelled'));
|
|
392
|
+
}
|
|
383
393
|
updateCurrentTabs({ urls }) {
|
|
384
394
|
this.__internal__state.updateCurrentTabsUrl(urls);
|
|
385
395
|
}
|
|
@@ -398,6 +408,8 @@ export default class Extension {
|
|
|
398
408
|
return this.removeAuthorization(request);
|
|
399
409
|
case 'pri(authorize.reject)':
|
|
400
410
|
return this.rejectAuthRequest(request);
|
|
411
|
+
case 'pri(authorize.cancel)':
|
|
412
|
+
return this.cancelAuthRequest(request);
|
|
401
413
|
case 'pri(authorize.requests)':
|
|
402
414
|
return port && this.authorizeSubscribe(id, port);
|
|
403
415
|
case 'pri(authorize.update)':
|
|
@@ -170,8 +170,15 @@ export default class State {
|
|
|
170
170
|
return {
|
|
171
171
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
172
172
|
reject: async (error) => {
|
|
173
|
-
|
|
174
|
-
|
|
173
|
+
if (error.message === 'Cancelled') {
|
|
174
|
+
delete this.__internal__authRequests[id];
|
|
175
|
+
this.updateIconAuth(true);
|
|
176
|
+
reject(new Error('Connection request was cancelled by the user.'));
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
await complete();
|
|
180
|
+
reject(new Error('Connection request was rejected by the user.'));
|
|
181
|
+
}
|
|
175
182
|
},
|
|
176
183
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
177
184
|
resolve: async ({ authorizedAccounts, result }) => {
|
package/background/types.d.ts
CHANGED
|
@@ -78,6 +78,7 @@ export interface RequestSignatures {
|
|
|
78
78
|
'pri(authorize.requests)': [RequestAuthorizeSubscribe, boolean, AuthorizeRequest[]];
|
|
79
79
|
'pri(authorize.remove)': [string, ResponseAuthorizeList];
|
|
80
80
|
'pri(authorize.reject)': [string, void];
|
|
81
|
+
'pri(authorize.cancel)': [string, void];
|
|
81
82
|
'pri(authorize.update)': [RequestUpdateAuthorizedAccounts, void];
|
|
82
83
|
'pri(activeTabsUrl.update)': [RequestActiveTabsUrlUpdate, void];
|
|
83
84
|
'pri(connectedTabsUrl.get)': [null, ConnectedTabsUrlResponse];
|
|
@@ -42,6 +42,7 @@ export default class Extension {
|
|
|
42
42
|
private derivationCreate;
|
|
43
43
|
private removeAuthorization;
|
|
44
44
|
private rejectAuthRequest;
|
|
45
|
+
private cancelAuthRequest;
|
|
45
46
|
private updateCurrentTabs;
|
|
46
47
|
private getConnectedTabsUrl;
|
|
47
48
|
handle<TMessageType extends MessageTypes>(id: string, type: TMessageType, request: RequestTypes[TMessageType], port?: chrome.runtime.Port): Promise<ResponseType<TMessageType>>;
|
|
@@ -376,12 +376,22 @@ class Extension {
|
|
|
376
376
|
const remAuth = await this.__internal__state.removeAuthorization(url);
|
|
377
377
|
return { list: remAuth };
|
|
378
378
|
}
|
|
379
|
+
// Reject the authorization request and add the URL to the authorized list with no keys.
|
|
380
|
+
// The site will not prompt for re-authorization on future visits.
|
|
379
381
|
rejectAuthRequest(id) {
|
|
380
382
|
const queued = this.__internal__state.getAuthRequest(id);
|
|
381
383
|
(0, util_1.assert)(queued, 'Unable to find request');
|
|
382
384
|
const { reject } = queued;
|
|
383
385
|
reject(new Error('Rejected'));
|
|
384
386
|
}
|
|
387
|
+
// Cancel the authorization request and do not add the URL to the authorized list.
|
|
388
|
+
// The site will prompt for authorization on future visits.
|
|
389
|
+
cancelAuthRequest(id) {
|
|
390
|
+
const queued = this.__internal__state.getAuthRequest(id);
|
|
391
|
+
(0, util_1.assert)(queued, 'Unable to find request');
|
|
392
|
+
const { reject } = queued;
|
|
393
|
+
reject(new Error('Cancelled'));
|
|
394
|
+
}
|
|
385
395
|
updateCurrentTabs({ urls }) {
|
|
386
396
|
this.__internal__state.updateCurrentTabsUrl(urls);
|
|
387
397
|
}
|
|
@@ -400,6 +410,8 @@ class Extension {
|
|
|
400
410
|
return this.removeAuthorization(request);
|
|
401
411
|
case 'pri(authorize.reject)':
|
|
402
412
|
return this.rejectAuthRequest(request);
|
|
413
|
+
case 'pri(authorize.cancel)':
|
|
414
|
+
return this.cancelAuthRequest(request);
|
|
403
415
|
case 'pri(authorize.requests)':
|
|
404
416
|
return port && this.authorizeSubscribe(id, port);
|
|
405
417
|
case 'pri(authorize.update)':
|
|
@@ -173,8 +173,15 @@ class State {
|
|
|
173
173
|
return {
|
|
174
174
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
175
175
|
reject: async (error) => {
|
|
176
|
-
|
|
177
|
-
|
|
176
|
+
if (error.message === 'Cancelled') {
|
|
177
|
+
delete this.__internal__authRequests[id];
|
|
178
|
+
this.updateIconAuth(true);
|
|
179
|
+
reject(new Error('Connection request was cancelled by the user.'));
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
await complete();
|
|
183
|
+
reject(new Error('Connection request was rejected by the user.'));
|
|
184
|
+
}
|
|
178
185
|
},
|
|
179
186
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
180
187
|
resolve: async ({ authorizedAccounts, result }) => {
|
|
@@ -78,6 +78,7 @@ export interface RequestSignatures {
|
|
|
78
78
|
'pri(authorize.requests)': [RequestAuthorizeSubscribe, boolean, AuthorizeRequest[]];
|
|
79
79
|
'pri(authorize.remove)': [string, ResponseAuthorizeList];
|
|
80
80
|
'pri(authorize.reject)': [string, void];
|
|
81
|
+
'pri(authorize.cancel)': [string, void];
|
|
81
82
|
'pri(authorize.update)': [RequestUpdateAuthorizedAccounts, void];
|
|
82
83
|
'pri(activeTabsUrl.update)': [RequestActiveTabsUrlUpdate, void];
|
|
83
84
|
'pri(connectedTabsUrl.get)': [null, ConnectedTabsUrlResponse];
|
package/cjs/packageInfo.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.packageInfo = void 0;
|
|
4
|
-
exports.packageInfo = { name: '@polkadot/extension-base', path: typeof __dirname === 'string' ? __dirname : 'auto', type: 'cjs', version: '0.
|
|
4
|
+
exports.packageInfo = { name: '@polkadot/extension-base', path: typeof __dirname === 'string' ? __dirname : 'auto', type: 'cjs', version: '0.58.1' };
|
package/package.json
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"./cjs/packageDetect.js"
|
|
19
19
|
],
|
|
20
20
|
"type": "module",
|
|
21
|
-
"version": "0.
|
|
21
|
+
"version": "0.58.1",
|
|
22
22
|
"main": "./cjs/index.js",
|
|
23
23
|
"module": "./index.js",
|
|
24
24
|
"types": "./index.d.ts",
|
|
@@ -479,19 +479,19 @@
|
|
|
479
479
|
}
|
|
480
480
|
},
|
|
481
481
|
"dependencies": {
|
|
482
|
-
"@polkadot/api": "^15.
|
|
483
|
-
"@polkadot/extension-chains": "0.
|
|
484
|
-
"@polkadot/extension-dapp": "0.
|
|
485
|
-
"@polkadot/extension-inject": "0.
|
|
486
|
-
"@polkadot/keyring": "^13.
|
|
487
|
-
"@polkadot/networks": "^13.
|
|
488
|
-
"@polkadot/phishing": "^0.
|
|
489
|
-
"@polkadot/rpc-provider": "^15.
|
|
490
|
-
"@polkadot/types": "^15.
|
|
491
|
-
"@polkadot/ui-keyring": "^3.
|
|
492
|
-
"@polkadot/ui-settings": "^3.
|
|
493
|
-
"@polkadot/util": "^13.
|
|
494
|
-
"@polkadot/util-crypto": "^13.
|
|
482
|
+
"@polkadot/api": "^15.2.1",
|
|
483
|
+
"@polkadot/extension-chains": "0.58.1",
|
|
484
|
+
"@polkadot/extension-dapp": "0.58.1",
|
|
485
|
+
"@polkadot/extension-inject": "0.58.1",
|
|
486
|
+
"@polkadot/keyring": "^13.3.1",
|
|
487
|
+
"@polkadot/networks": "^13.3.1",
|
|
488
|
+
"@polkadot/phishing": "^0.25.1",
|
|
489
|
+
"@polkadot/rpc-provider": "^15.2.1",
|
|
490
|
+
"@polkadot/types": "^15.2.1",
|
|
491
|
+
"@polkadot/ui-keyring": "^3.12.1",
|
|
492
|
+
"@polkadot/ui-settings": "^3.12.1",
|
|
493
|
+
"@polkadot/util": "^13.3.1",
|
|
494
|
+
"@polkadot/util-crypto": "^13.3.1",
|
|
495
495
|
"eventemitter3": "^5.0.1",
|
|
496
496
|
"rxjs": "^7.8.1",
|
|
497
497
|
"tslib": "^2.8.1"
|
package/packageInfo.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const packageInfo = { name: '@polkadot/extension-base', path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto', type: 'esm', version: '0.
|
|
1
|
+
export const packageInfo = { name: '@polkadot/extension-base', path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto', type: 'esm', version: '0.58.1' };
|