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