@openfort/openfort-js 0.7.20 → 0.7.22
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/index.cjs +29 -10
- package/dist/index.js +29 -10
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -5178,7 +5178,7 @@ class AuthManager {
|
|
|
5178
5178
|
}
|
|
5179
5179
|
}
|
|
5180
5180
|
|
|
5181
|
-
const VERSION = '0.7.
|
|
5181
|
+
const VERSION = '0.7.22';
|
|
5182
5182
|
|
|
5183
5183
|
var Event;
|
|
5184
5184
|
(function (Event) {
|
|
@@ -5199,6 +5199,7 @@ var Event;
|
|
|
5199
5199
|
})(Event || (Event = {}));
|
|
5200
5200
|
const NOT_CONFIGURED_ERROR = 'not-configured-error';
|
|
5201
5201
|
const MISSING_USER_ENTROPY_ERROR = 'missing-user-entropy-error';
|
|
5202
|
+
const MISSING_PROJECT_ENTROPY_ERROR = 'missing-project-entropy-error';
|
|
5202
5203
|
const INCORRECT_USER_ENTROPY_ERROR = 'incorrect-user-entropy-error';
|
|
5203
5204
|
class GetCurrentDeviceRequest {
|
|
5204
5205
|
uuid;
|
|
@@ -5358,7 +5359,6 @@ const sessionKeyStorageKey = 'openfort.session_key';
|
|
|
5358
5359
|
const signerTypeStorageKey = 'openfort.signer_type';
|
|
5359
5360
|
const chainIDStorageKey = 'openfort.chain_id';
|
|
5360
5361
|
const jwksStorageKey = 'openfort.jwk';
|
|
5361
|
-
const deviceIDStorageKey = 'openfort.device_id';
|
|
5362
5362
|
const accountTypeStorageKey = 'openfort.account_type';
|
|
5363
5363
|
const shieldAuthTypeStorageKey = 'openfort.shield_auth_type';
|
|
5364
5364
|
const shieldAuthTokenStorageKey = 'openfort.shield_auth_token';
|
|
@@ -5538,17 +5538,12 @@ class InstanceManager {
|
|
|
5538
5538
|
}
|
|
5539
5539
|
setDeviceID(deviceID) {
|
|
5540
5540
|
this.deviceID = deviceID;
|
|
5541
|
-
this.persistentStorage.save(deviceIDStorageKey, deviceID);
|
|
5542
5541
|
}
|
|
5543
5542
|
getDeviceID() {
|
|
5544
|
-
if (!this.deviceID) {
|
|
5545
|
-
this.deviceID = this.persistentStorage.get(deviceIDStorageKey);
|
|
5546
|
-
}
|
|
5547
5543
|
return this.deviceID;
|
|
5548
5544
|
}
|
|
5549
5545
|
removeDeviceID() {
|
|
5550
5546
|
this.deviceID = null;
|
|
5551
|
-
this.persistentStorage.remove(deviceIDStorageKey);
|
|
5552
5547
|
}
|
|
5553
5548
|
setChainID(chainId) {
|
|
5554
5549
|
this.chainId = chainId;
|
|
@@ -5851,6 +5846,11 @@ class MissingRecoveryPasswordError extends Error {
|
|
|
5851
5846
|
super('This embedded signer requires a password to be recovered');
|
|
5852
5847
|
}
|
|
5853
5848
|
}
|
|
5849
|
+
class MissingProjectEntropyError extends Error {
|
|
5850
|
+
constructor() {
|
|
5851
|
+
super('MissingProjectEntropyError');
|
|
5852
|
+
}
|
|
5853
|
+
}
|
|
5854
5854
|
class WrongRecoveryPasswordError extends Error {
|
|
5855
5855
|
constructor() {
|
|
5856
5856
|
super('Wrong recovery password for this embedded signer');
|
|
@@ -5960,6 +5960,9 @@ class IframeManager {
|
|
|
5960
5960
|
else if (response.error === MISSING_USER_ENTROPY_ERROR) {
|
|
5961
5961
|
reject(new MissingRecoveryPasswordError());
|
|
5962
5962
|
}
|
|
5963
|
+
else if (response.error === MISSING_PROJECT_ENTROPY_ERROR) {
|
|
5964
|
+
reject(new MissingProjectEntropyError());
|
|
5965
|
+
}
|
|
5963
5966
|
else if (response.error === INCORRECT_USER_ENTROPY_ERROR) {
|
|
5964
5967
|
reject(new WrongRecoveryPasswordError());
|
|
5965
5968
|
}
|
|
@@ -6230,7 +6233,7 @@ class Openfort {
|
|
|
6230
6233
|
this.instanceManager.setSignerType(SignerType.EMBEDDED);
|
|
6231
6234
|
}
|
|
6232
6235
|
catch (e) {
|
|
6233
|
-
if (e instanceof MissingRecoveryPasswordError) {
|
|
6236
|
+
if (e instanceof MissingRecoveryPasswordError || e instanceof MissingProjectEntropyError) {
|
|
6234
6237
|
await this.flushSigner();
|
|
6235
6238
|
throw e;
|
|
6236
6239
|
}
|
|
@@ -6393,7 +6396,15 @@ class Openfort {
|
|
|
6393
6396
|
});
|
|
6394
6397
|
this.instanceManager.setPlayerID(result.id);
|
|
6395
6398
|
if (this.signer && this.signer.useCredentials()) {
|
|
6396
|
-
|
|
6399
|
+
try {
|
|
6400
|
+
await this.signer.updateAuthentication();
|
|
6401
|
+
}
|
|
6402
|
+
catch (e) {
|
|
6403
|
+
if (e instanceof MissingRecoveryPasswordError || e instanceof MissingProjectEntropyError) {
|
|
6404
|
+
await this.flushSigner();
|
|
6405
|
+
}
|
|
6406
|
+
throw e;
|
|
6407
|
+
}
|
|
6397
6408
|
}
|
|
6398
6409
|
return result;
|
|
6399
6410
|
}
|
|
@@ -6651,7 +6662,15 @@ class Openfort {
|
|
|
6651
6662
|
const auth = await this.authManager.validateCredentials(forceRefresh);
|
|
6652
6663
|
this.storeCredentials(auth);
|
|
6653
6664
|
if (this.signer && this.signer.useCredentials()) {
|
|
6654
|
-
|
|
6665
|
+
try {
|
|
6666
|
+
await this.signer.updateAuthentication();
|
|
6667
|
+
}
|
|
6668
|
+
catch (e) {
|
|
6669
|
+
if (e instanceof MissingRecoveryPasswordError || e instanceof MissingProjectEntropyError) {
|
|
6670
|
+
await this.flushSigner();
|
|
6671
|
+
}
|
|
6672
|
+
throw e;
|
|
6673
|
+
}
|
|
6655
6674
|
}
|
|
6656
6675
|
}
|
|
6657
6676
|
}
|
package/dist/index.js
CHANGED
|
@@ -5155,7 +5155,7 @@ class AuthManager {
|
|
|
5155
5155
|
}
|
|
5156
5156
|
}
|
|
5157
5157
|
|
|
5158
|
-
const VERSION = '0.7.
|
|
5158
|
+
const VERSION = '0.7.22';
|
|
5159
5159
|
|
|
5160
5160
|
var Event;
|
|
5161
5161
|
(function (Event) {
|
|
@@ -5176,6 +5176,7 @@ var Event;
|
|
|
5176
5176
|
})(Event || (Event = {}));
|
|
5177
5177
|
const NOT_CONFIGURED_ERROR = 'not-configured-error';
|
|
5178
5178
|
const MISSING_USER_ENTROPY_ERROR = 'missing-user-entropy-error';
|
|
5179
|
+
const MISSING_PROJECT_ENTROPY_ERROR = 'missing-project-entropy-error';
|
|
5179
5180
|
const INCORRECT_USER_ENTROPY_ERROR = 'incorrect-user-entropy-error';
|
|
5180
5181
|
class GetCurrentDeviceRequest {
|
|
5181
5182
|
uuid;
|
|
@@ -5335,7 +5336,6 @@ const sessionKeyStorageKey = 'openfort.session_key';
|
|
|
5335
5336
|
const signerTypeStorageKey = 'openfort.signer_type';
|
|
5336
5337
|
const chainIDStorageKey = 'openfort.chain_id';
|
|
5337
5338
|
const jwksStorageKey = 'openfort.jwk';
|
|
5338
|
-
const deviceIDStorageKey = 'openfort.device_id';
|
|
5339
5339
|
const accountTypeStorageKey = 'openfort.account_type';
|
|
5340
5340
|
const shieldAuthTypeStorageKey = 'openfort.shield_auth_type';
|
|
5341
5341
|
const shieldAuthTokenStorageKey = 'openfort.shield_auth_token';
|
|
@@ -5515,17 +5515,12 @@ class InstanceManager {
|
|
|
5515
5515
|
}
|
|
5516
5516
|
setDeviceID(deviceID) {
|
|
5517
5517
|
this.deviceID = deviceID;
|
|
5518
|
-
this.persistentStorage.save(deviceIDStorageKey, deviceID);
|
|
5519
5518
|
}
|
|
5520
5519
|
getDeviceID() {
|
|
5521
|
-
if (!this.deviceID) {
|
|
5522
|
-
this.deviceID = this.persistentStorage.get(deviceIDStorageKey);
|
|
5523
|
-
}
|
|
5524
5520
|
return this.deviceID;
|
|
5525
5521
|
}
|
|
5526
5522
|
removeDeviceID() {
|
|
5527
5523
|
this.deviceID = null;
|
|
5528
|
-
this.persistentStorage.remove(deviceIDStorageKey);
|
|
5529
5524
|
}
|
|
5530
5525
|
setChainID(chainId) {
|
|
5531
5526
|
this.chainId = chainId;
|
|
@@ -5828,6 +5823,11 @@ class MissingRecoveryPasswordError extends Error {
|
|
|
5828
5823
|
super('This embedded signer requires a password to be recovered');
|
|
5829
5824
|
}
|
|
5830
5825
|
}
|
|
5826
|
+
class MissingProjectEntropyError extends Error {
|
|
5827
|
+
constructor() {
|
|
5828
|
+
super('MissingProjectEntropyError');
|
|
5829
|
+
}
|
|
5830
|
+
}
|
|
5831
5831
|
class WrongRecoveryPasswordError extends Error {
|
|
5832
5832
|
constructor() {
|
|
5833
5833
|
super('Wrong recovery password for this embedded signer');
|
|
@@ -5937,6 +5937,9 @@ class IframeManager {
|
|
|
5937
5937
|
else if (response.error === MISSING_USER_ENTROPY_ERROR) {
|
|
5938
5938
|
reject(new MissingRecoveryPasswordError());
|
|
5939
5939
|
}
|
|
5940
|
+
else if (response.error === MISSING_PROJECT_ENTROPY_ERROR) {
|
|
5941
|
+
reject(new MissingProjectEntropyError());
|
|
5942
|
+
}
|
|
5940
5943
|
else if (response.error === INCORRECT_USER_ENTROPY_ERROR) {
|
|
5941
5944
|
reject(new WrongRecoveryPasswordError());
|
|
5942
5945
|
}
|
|
@@ -6207,7 +6210,7 @@ class Openfort {
|
|
|
6207
6210
|
this.instanceManager.setSignerType(SignerType.EMBEDDED);
|
|
6208
6211
|
}
|
|
6209
6212
|
catch (e) {
|
|
6210
|
-
if (e instanceof MissingRecoveryPasswordError) {
|
|
6213
|
+
if (e instanceof MissingRecoveryPasswordError || e instanceof MissingProjectEntropyError) {
|
|
6211
6214
|
await this.flushSigner();
|
|
6212
6215
|
throw e;
|
|
6213
6216
|
}
|
|
@@ -6370,7 +6373,15 @@ class Openfort {
|
|
|
6370
6373
|
});
|
|
6371
6374
|
this.instanceManager.setPlayerID(result.id);
|
|
6372
6375
|
if (this.signer && this.signer.useCredentials()) {
|
|
6373
|
-
|
|
6376
|
+
try {
|
|
6377
|
+
await this.signer.updateAuthentication();
|
|
6378
|
+
}
|
|
6379
|
+
catch (e) {
|
|
6380
|
+
if (e instanceof MissingRecoveryPasswordError || e instanceof MissingProjectEntropyError) {
|
|
6381
|
+
await this.flushSigner();
|
|
6382
|
+
}
|
|
6383
|
+
throw e;
|
|
6384
|
+
}
|
|
6374
6385
|
}
|
|
6375
6386
|
return result;
|
|
6376
6387
|
}
|
|
@@ -6628,7 +6639,15 @@ class Openfort {
|
|
|
6628
6639
|
const auth = await this.authManager.validateCredentials(forceRefresh);
|
|
6629
6640
|
this.storeCredentials(auth);
|
|
6630
6641
|
if (this.signer && this.signer.useCredentials()) {
|
|
6631
|
-
|
|
6642
|
+
try {
|
|
6643
|
+
await this.signer.updateAuthentication();
|
|
6644
|
+
}
|
|
6645
|
+
catch (e) {
|
|
6646
|
+
if (e instanceof MissingRecoveryPasswordError || e instanceof MissingProjectEntropyError) {
|
|
6647
|
+
await this.flushSigner();
|
|
6648
|
+
}
|
|
6649
|
+
throw e;
|
|
6650
|
+
}
|
|
6632
6651
|
}
|
|
6633
6652
|
}
|
|
6634
6653
|
}
|
package/package.json
CHANGED