@openfort/openfort-js 0.8.3 → 0.8.4
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 +9 -2
- package/dist/index.js +9 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3207,7 +3207,7 @@ class KeyPair extends signingKey.SigningKey {
|
|
|
3207
3207
|
}
|
|
3208
3208
|
}
|
|
3209
3209
|
|
|
3210
|
-
const VERSION = '0.8.
|
|
3210
|
+
const VERSION = '0.8.4';
|
|
3211
3211
|
|
|
3212
3212
|
var Event;
|
|
3213
3213
|
(function (Event) {
|
|
@@ -6105,10 +6105,13 @@ class Openfort {
|
|
|
6105
6105
|
* Logs the user out by flushing the signer and removing credentials.
|
|
6106
6106
|
*/
|
|
6107
6107
|
async logout() {
|
|
6108
|
-
|
|
6108
|
+
const signer = SignerManager.fromStorage();
|
|
6109
6109
|
this.storage.remove(StorageKeys.AUTHENTICATION);
|
|
6110
6110
|
this.storage.remove(StorageKeys.SIGNER);
|
|
6111
6111
|
this.storage.remove(StorageKeys.ACCOUNT);
|
|
6112
|
+
if (signer) {
|
|
6113
|
+
await signer.logout();
|
|
6114
|
+
}
|
|
6112
6115
|
}
|
|
6113
6116
|
/**
|
|
6114
6117
|
* Returns an Ethereum provider using the configured signer.
|
|
@@ -6404,10 +6407,14 @@ class Openfort {
|
|
|
6404
6407
|
async authenticateWithThirdPartyProvider({ provider, token, tokenType, ecosystemGame, }) {
|
|
6405
6408
|
const previousAuth = Authentication.fromStorage(this.storage);
|
|
6406
6409
|
const result = await this.authManager.authenticateThirdParty(provider, token, tokenType, ecosystemGame);
|
|
6410
|
+
let loggedOut = false;
|
|
6407
6411
|
if (previousAuth && previousAuth.player !== result.id) {
|
|
6408
6412
|
this.logout();
|
|
6413
|
+
loggedOut = true;
|
|
6409
6414
|
}
|
|
6410
6415
|
new Authentication('third_party', token, result.id, null, provider, tokenType).save(this.storage);
|
|
6416
|
+
if (loggedOut)
|
|
6417
|
+
return result;
|
|
6411
6418
|
const signer = SignerManager.fromStorage();
|
|
6412
6419
|
try {
|
|
6413
6420
|
await signer?.updateAuthentication();
|
package/dist/index.js
CHANGED
|
@@ -3184,7 +3184,7 @@ class KeyPair extends SigningKey {
|
|
|
3184
3184
|
}
|
|
3185
3185
|
}
|
|
3186
3186
|
|
|
3187
|
-
const VERSION = '0.8.
|
|
3187
|
+
const VERSION = '0.8.4';
|
|
3188
3188
|
|
|
3189
3189
|
var Event;
|
|
3190
3190
|
(function (Event) {
|
|
@@ -6082,10 +6082,13 @@ class Openfort {
|
|
|
6082
6082
|
* Logs the user out by flushing the signer and removing credentials.
|
|
6083
6083
|
*/
|
|
6084
6084
|
async logout() {
|
|
6085
|
-
|
|
6085
|
+
const signer = SignerManager.fromStorage();
|
|
6086
6086
|
this.storage.remove(StorageKeys.AUTHENTICATION);
|
|
6087
6087
|
this.storage.remove(StorageKeys.SIGNER);
|
|
6088
6088
|
this.storage.remove(StorageKeys.ACCOUNT);
|
|
6089
|
+
if (signer) {
|
|
6090
|
+
await signer.logout();
|
|
6091
|
+
}
|
|
6089
6092
|
}
|
|
6090
6093
|
/**
|
|
6091
6094
|
* Returns an Ethereum provider using the configured signer.
|
|
@@ -6381,10 +6384,14 @@ class Openfort {
|
|
|
6381
6384
|
async authenticateWithThirdPartyProvider({ provider, token, tokenType, ecosystemGame, }) {
|
|
6382
6385
|
const previousAuth = Authentication.fromStorage(this.storage);
|
|
6383
6386
|
const result = await this.authManager.authenticateThirdParty(provider, token, tokenType, ecosystemGame);
|
|
6387
|
+
let loggedOut = false;
|
|
6384
6388
|
if (previousAuth && previousAuth.player !== result.id) {
|
|
6385
6389
|
this.logout();
|
|
6390
|
+
loggedOut = true;
|
|
6386
6391
|
}
|
|
6387
6392
|
new Authentication('third_party', token, result.id, null, provider, tokenType).save(this.storage);
|
|
6393
|
+
if (loggedOut)
|
|
6394
|
+
return result;
|
|
6388
6395
|
const signer = SignerManager.fromStorage();
|
|
6389
6396
|
try {
|
|
6390
6397
|
await signer?.updateAuthentication();
|
package/package.json
CHANGED