@openfort/openfort-js 0.8.0 → 0.8.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/dist/index.cjs +21 -1
- package/dist/index.js +21 -1
- 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.1';
|
|
3211
3211
|
|
|
3212
3212
|
var Event;
|
|
3213
3213
|
(function (Event) {
|
|
@@ -6258,8 +6258,12 @@ class Openfort {
|
|
|
6258
6258
|
* @returns An AuthResponse object containing authentication details.
|
|
6259
6259
|
*/
|
|
6260
6260
|
async logInWithEmailPassword({ email, password, ecosystemGame }) {
|
|
6261
|
+
const previousAuth = Authentication.fromStorage(this.storage);
|
|
6261
6262
|
this.storage.remove(StorageKeys.AUTHENTICATION);
|
|
6262
6263
|
const result = await this.authManager.loginEmailPassword(email, password, ecosystemGame);
|
|
6264
|
+
if (previousAuth && previousAuth.player !== result.player.id) {
|
|
6265
|
+
this.logout();
|
|
6266
|
+
}
|
|
6263
6267
|
new Authentication('jwt', result.token, result.player.id, result.refreshToken).save(this.storage);
|
|
6264
6268
|
return result;
|
|
6265
6269
|
}
|
|
@@ -6273,8 +6277,12 @@ class Openfort {
|
|
|
6273
6277
|
* @returns An AuthResponse object containing authentication details.
|
|
6274
6278
|
*/
|
|
6275
6279
|
async signUpWithEmailPassword({ email, password, ecosystemGame }) {
|
|
6280
|
+
const previousAuth = Authentication.fromStorage(this.storage);
|
|
6276
6281
|
this.storage.remove(StorageKeys.AUTHENTICATION);
|
|
6277
6282
|
const result = await this.authManager.signupEmailPassword(email, password, ecosystemGame);
|
|
6283
|
+
if (previousAuth && previousAuth.player !== result.player.id) {
|
|
6284
|
+
this.logout();
|
|
6285
|
+
}
|
|
6278
6286
|
new Authentication('jwt', result.token, result.player.id, result.refreshToken).save(this.storage);
|
|
6279
6287
|
return result;
|
|
6280
6288
|
}
|
|
@@ -6378,7 +6386,11 @@ class Openfort {
|
|
|
6378
6386
|
* @returns An AuthResponse object.
|
|
6379
6387
|
*/
|
|
6380
6388
|
async poolOAuth(key) {
|
|
6389
|
+
const previousAuth = Authentication.fromStorage(this.storage);
|
|
6381
6390
|
const response = await this.authManager.poolOAuth(key);
|
|
6391
|
+
if (previousAuth && previousAuth.player !== response.player.id) {
|
|
6392
|
+
this.logout();
|
|
6393
|
+
}
|
|
6382
6394
|
new Authentication('jwt', response.token, response.player.id, response.refreshToken).save(this.storage);
|
|
6383
6395
|
return response;
|
|
6384
6396
|
}
|
|
@@ -6392,8 +6404,12 @@ class Openfort {
|
|
|
6392
6404
|
* @returns An AuthPlayerResponse object.
|
|
6393
6405
|
*/
|
|
6394
6406
|
async authenticateWithThirdPartyProvider({ provider, token, tokenType, ecosystemGame, }) {
|
|
6407
|
+
const previousAuth = Authentication.fromStorage(this.storage);
|
|
6395
6408
|
this.storage.remove(StorageKeys.AUTHENTICATION);
|
|
6396
6409
|
const result = await this.authManager.authenticateThirdParty(provider, token, tokenType, ecosystemGame);
|
|
6410
|
+
if (previousAuth && previousAuth.player !== result.id) {
|
|
6411
|
+
this.logout();
|
|
6412
|
+
}
|
|
6397
6413
|
new Authentication('third_party', token, result.id, null, provider, tokenType).save(this.storage);
|
|
6398
6414
|
const signer = SignerManager.fromStorage();
|
|
6399
6415
|
try {
|
|
@@ -6427,8 +6443,12 @@ class Openfort {
|
|
|
6427
6443
|
* @returns An AuthResponse object.
|
|
6428
6444
|
*/
|
|
6429
6445
|
async authenticateWithSIWE({ signature, message, walletClientType, connectorType, }) {
|
|
6446
|
+
const previousAuth = Authentication.fromStorage(this.storage);
|
|
6430
6447
|
this.storage.remove(StorageKeys.AUTHENTICATION);
|
|
6431
6448
|
const result = await this.authManager.authenticateSIWE(signature, message, walletClientType, connectorType);
|
|
6449
|
+
if (previousAuth && previousAuth.player !== result.player.id) {
|
|
6450
|
+
this.logout();
|
|
6451
|
+
}
|
|
6432
6452
|
new Authentication('jwt', result.token, result.player.id, result.refreshToken).save(this.storage);
|
|
6433
6453
|
return result;
|
|
6434
6454
|
}
|
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.1';
|
|
3188
3188
|
|
|
3189
3189
|
var Event;
|
|
3190
3190
|
(function (Event) {
|
|
@@ -6235,8 +6235,12 @@ class Openfort {
|
|
|
6235
6235
|
* @returns An AuthResponse object containing authentication details.
|
|
6236
6236
|
*/
|
|
6237
6237
|
async logInWithEmailPassword({ email, password, ecosystemGame }) {
|
|
6238
|
+
const previousAuth = Authentication.fromStorage(this.storage);
|
|
6238
6239
|
this.storage.remove(StorageKeys.AUTHENTICATION);
|
|
6239
6240
|
const result = await this.authManager.loginEmailPassword(email, password, ecosystemGame);
|
|
6241
|
+
if (previousAuth && previousAuth.player !== result.player.id) {
|
|
6242
|
+
this.logout();
|
|
6243
|
+
}
|
|
6240
6244
|
new Authentication('jwt', result.token, result.player.id, result.refreshToken).save(this.storage);
|
|
6241
6245
|
return result;
|
|
6242
6246
|
}
|
|
@@ -6250,8 +6254,12 @@ class Openfort {
|
|
|
6250
6254
|
* @returns An AuthResponse object containing authentication details.
|
|
6251
6255
|
*/
|
|
6252
6256
|
async signUpWithEmailPassword({ email, password, ecosystemGame }) {
|
|
6257
|
+
const previousAuth = Authentication.fromStorage(this.storage);
|
|
6253
6258
|
this.storage.remove(StorageKeys.AUTHENTICATION);
|
|
6254
6259
|
const result = await this.authManager.signupEmailPassword(email, password, ecosystemGame);
|
|
6260
|
+
if (previousAuth && previousAuth.player !== result.player.id) {
|
|
6261
|
+
this.logout();
|
|
6262
|
+
}
|
|
6255
6263
|
new Authentication('jwt', result.token, result.player.id, result.refreshToken).save(this.storage);
|
|
6256
6264
|
return result;
|
|
6257
6265
|
}
|
|
@@ -6355,7 +6363,11 @@ class Openfort {
|
|
|
6355
6363
|
* @returns An AuthResponse object.
|
|
6356
6364
|
*/
|
|
6357
6365
|
async poolOAuth(key) {
|
|
6366
|
+
const previousAuth = Authentication.fromStorage(this.storage);
|
|
6358
6367
|
const response = await this.authManager.poolOAuth(key);
|
|
6368
|
+
if (previousAuth && previousAuth.player !== response.player.id) {
|
|
6369
|
+
this.logout();
|
|
6370
|
+
}
|
|
6359
6371
|
new Authentication('jwt', response.token, response.player.id, response.refreshToken).save(this.storage);
|
|
6360
6372
|
return response;
|
|
6361
6373
|
}
|
|
@@ -6369,8 +6381,12 @@ class Openfort {
|
|
|
6369
6381
|
* @returns An AuthPlayerResponse object.
|
|
6370
6382
|
*/
|
|
6371
6383
|
async authenticateWithThirdPartyProvider({ provider, token, tokenType, ecosystemGame, }) {
|
|
6384
|
+
const previousAuth = Authentication.fromStorage(this.storage);
|
|
6372
6385
|
this.storage.remove(StorageKeys.AUTHENTICATION);
|
|
6373
6386
|
const result = await this.authManager.authenticateThirdParty(provider, token, tokenType, ecosystemGame);
|
|
6387
|
+
if (previousAuth && previousAuth.player !== result.id) {
|
|
6388
|
+
this.logout();
|
|
6389
|
+
}
|
|
6374
6390
|
new Authentication('third_party', token, result.id, null, provider, tokenType).save(this.storage);
|
|
6375
6391
|
const signer = SignerManager.fromStorage();
|
|
6376
6392
|
try {
|
|
@@ -6404,8 +6420,12 @@ class Openfort {
|
|
|
6404
6420
|
* @returns An AuthResponse object.
|
|
6405
6421
|
*/
|
|
6406
6422
|
async authenticateWithSIWE({ signature, message, walletClientType, connectorType, }) {
|
|
6423
|
+
const previousAuth = Authentication.fromStorage(this.storage);
|
|
6407
6424
|
this.storage.remove(StorageKeys.AUTHENTICATION);
|
|
6408
6425
|
const result = await this.authManager.authenticateSIWE(signature, message, walletClientType, connectorType);
|
|
6426
|
+
if (previousAuth && previousAuth.player !== result.player.id) {
|
|
6427
|
+
this.logout();
|
|
6428
|
+
}
|
|
6409
6429
|
new Authentication('jwt', result.token, result.player.id, result.refreshToken).save(this.storage);
|
|
6410
6430
|
return result;
|
|
6411
6431
|
}
|
package/package.json
CHANGED