Skip to content

Commit

Permalink
fix: add check condition for signer
Browse files Browse the repository at this point in the history
  • Loading branch information
jamalavedra committed May 13, 2024
1 parent 79dd8fa commit 329bb3f
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 12 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openfort/openfort-js",
"version": "0.6.14",
"version": "0.6.15",
"description": "",
"author": "Openfort",
"repository": {
Expand Down
3 changes: 2 additions & 1 deletion src/clients/iframe-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import {
IEventResponse,
LogoutRequest,
LogoutResponse,
OpenfortConfiguration, PingRequest,
OpenfortConfiguration,
PingRequest,
ShieldAuthentication,
SignRequest,
SignResponse,
Expand Down
29 changes: 24 additions & 5 deletions src/clients/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ export enum Event {
GET_CURRENT_DEVICE = "get-current-device",
CURRENT_DEVICE = "current-device",
PING = "ping",
PONG = "pong"}

PONG = "pong",
}

export interface IEvent {
uuid: string;
Expand Down Expand Up @@ -86,7 +86,20 @@ export class ConfigureRequest implements IEventRequest {
thirdPartyProvider?: string;
thirdPartyTokenType?: string;

constructor(uuid: string, chainId: number, recovery: ShieldAuthentication, publishableKey: string, shieldAPIKey: string, accessToken: string, thirdPartyProvider = undefined, thirdPartyTokenType = undefined, encryptionKey = undefined, openfortURL = undefined, shieldURL = undefined, encryptionPart = undefined) {
constructor(
uuid: string,
chainId: number,
recovery: ShieldAuthentication,
publishableKey: string,
shieldAPIKey: string,
accessToken: string,
thirdPartyProvider = undefined,
thirdPartyTokenType = undefined,
encryptionKey = undefined,
openfortURL = undefined,
shieldURL = undefined,
encryptionPart = undefined,
) {
this.uuid = uuid;
this.chainId = chainId;
this.recovery = recovery;
Expand Down Expand Up @@ -119,7 +132,13 @@ export class SignRequest implements IEventRequest {
requireHash?: boolean;
openfortConfiguration?: OpenfortConfiguration;

constructor(uuid: string, message: string | Uint8Array, requireArrayify?:boolean, requireHash?:boolean, openfortConfiguration?: OpenfortConfiguration) {
constructor(
uuid: string,
message: string | Uint8Array,
requireArrayify?: boolean,
requireHash?: boolean,
openfortConfiguration?: OpenfortConfiguration,
) {
this.uuid = uuid;
this.message = message;
this.requireArrayify = requireArrayify;
Expand All @@ -130,7 +149,7 @@ export class SignRequest implements IEventRequest {
export interface IEventResponse extends IEvent {
success: boolean;
action: Event;
version: string
version: string;
}

export interface IErrorResponse extends IEventResponse {
Expand Down
3 changes: 2 additions & 1 deletion src/instanceManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import {
AuthTokenStorageKey,
DeviceIDStorageKey,
IStorage,
JWKStorageKey, PlayerIDStorageKey,
JWKStorageKey,
PlayerIDStorageKey,
PublishableKeyStorageKey,
RefreshTokenStorageKey,
SessionKeyStorageKey,
Expand Down
4 changes: 3 additions & 1 deletion src/openfort.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,9 @@ export default class Openfort {
const result = await OpenfortAuth.AuthenticateThirdParty(this._publishableKey, provider, token, tokenType);
this._instanceManager.setAccessToken({token, thirdPartyProvider: provider, thirdPartyTokenType: tokenType});
this._instanceManager.setPlayerID(result.id);
await this._signer.updateAuthentication();
if (this._signer && this._signer.useCredentials()) {
await this._signer.updateAuthentication();
}
return result;
}

Expand Down
2 changes: 1 addition & 1 deletion src/version.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export const VERSION = "0.6.14";
export const VERSION = "0.6.15";
export const PACKAGE = "@openfort/openfort-js";

0 comments on commit 329bb3f

Please sign in to comment.