@toruslabs/base-controllers
Advanced tools
Comparing version 4.10.1 to 4.11.0
@@ -25,2 +25,3 @@ import type { JRPCEngineEndCallback, JRPCEngineNextCallback, JRPCRequest, JRPCResponse } from "@toruslabs/openlogin-jrpc"; | ||
}; | ||
web3AuthClientId?: string; | ||
} | ||
@@ -27,0 +28,0 @@ export interface STATUS_NOTIFICATION_DATA { |
@@ -58,2 +58,3 @@ import BaseController from "../BaseController"; | ||
idToken?: string; | ||
web3AuthClientId?: string; | ||
}): Promise<void>; | ||
@@ -91,3 +92,3 @@ setCrashReport(isEnabled: boolean): Promise<boolean>; | ||
getDappList(): Promise<DiscoverDapp[]>; | ||
protected init(address: string, userInfo: UserInfo, jwtToken?: string, metadata?: Record<string, unknown>, type?: ACCOUNT_TYPE): Promise<void>; | ||
protected init(address: string, userInfo: UserInfo, jwtToken?: string, metadata?: Record<string, unknown>, type?: ACCOUNT_TYPE, generateNewToken?: boolean): Promise<void>; | ||
protected updateState(preferences?: Partial<P>, address?: string): P; | ||
@@ -94,0 +95,0 @@ protected headers(address?: string): { |
@@ -68,2 +68,3 @@ import { BaseConfig, BaseState, IController, UserInfo } from "../interfaces"; | ||
idToken?: string; | ||
web3auth_client_id?: string; | ||
} | ||
@@ -70,0 +71,0 @@ export interface UserPayload { |
{ | ||
"name": "@toruslabs/base-controllers", | ||
"version": "4.10.1", | ||
"version": "4.11.0", | ||
"homepage": "https://github.com/torusresearch/controllers#readme", | ||
@@ -25,3 +25,3 @@ "license": "ISC", | ||
"@toruslabs/broadcast-channel": "^9.0.1", | ||
"@toruslabs/http-helpers": "^5.0.0", | ||
"@toruslabs/http-helpers": "^6.0.0", | ||
"@toruslabs/openlogin-jrpc": "^6.1.0", | ||
@@ -66,3 +66,3 @@ "async-mutex": "^0.4.0", | ||
}, | ||
"gitHead": "eedc319d29c069f37fce6f52065502b72f37a8c4" | ||
"gitHead": "ece0fb5e61005a05f63eb85dd6a76a0c6e108089" | ||
} |
@@ -25,2 +25,3 @@ import type { JRPCEngineEndCallback, JRPCEngineNextCallback, JRPCRequest, JRPCResponse } from "@toruslabs/openlogin-jrpc"; | ||
}; | ||
web3AuthClientId?: string; | ||
} | ||
@@ -27,0 +28,0 @@ |
@@ -174,4 +174,5 @@ import { get, patch, post, remove } from "@toruslabs/http-helpers"; | ||
idToken?: string; | ||
web3AuthClientId?: string; | ||
}): Promise<void> { | ||
const { verifierId, verifier, options, address, idToken } = params; | ||
const { verifierId, verifier, options, address, idToken, web3AuthClientId } = params; | ||
if (!options.rehydrate) { | ||
@@ -190,2 +191,3 @@ const browser = bowser.getParser(window.navigator.userAgent); | ||
idToken, | ||
web3auth_client_id: web3AuthClientId, | ||
}; | ||
@@ -391,10 +393,14 @@ await post<{ success: boolean }>(`${this.config.api}/user/recordLogin`, recordLoginPayload, this.headers(address), { useAPIKey: true }); | ||
metadata: Record<string, unknown> = {}, | ||
type?: ACCOUNT_TYPE | ||
type?: ACCOUNT_TYPE, | ||
generateNewToken?: boolean // generate new token that includes more information e.g. AA address | ||
): Promise<void> { | ||
let response = { token: jwtToken }; | ||
if (this.getAddressState(address)) return; | ||
if (!jwtToken) { | ||
const messageToSign = await this.getMessageForSigning(address); | ||
if (!messageToSign.startsWith(this.config.signInPrefix)) throw new Error("Cannot sign on invalid message"); | ||
const signedMessage = await this.signAuthMessage(address, messageToSign); | ||
if (!jwtToken || generateNewToken) { | ||
let signedMessage; | ||
if (!jwtToken) { | ||
const messageToSign = await this.getMessageForSigning(address); | ||
if (!messageToSign.startsWith(this.config.signInPrefix)) throw new Error("Cannot sign on invalid message"); | ||
signedMessage = await this.signAuthMessage(address, messageToSign); | ||
} | ||
response = await post( | ||
@@ -405,2 +411,3 @@ `${this.config.api}/auth/verify`, | ||
signed_message: signedMessage, | ||
id_token: generateNewToken ? jwtToken : undefined, | ||
verifier: userInfo.aggregateVerifier || userInfo.verifier, | ||
@@ -407,0 +414,0 @@ verifier_id: userInfo.verifierId, |
@@ -78,2 +78,3 @@ import { BaseConfig, BaseState, IController, UserInfo } from "../interfaces"; | ||
idToken?: string; | ||
web3auth_client_id?: string; | ||
} | ||
@@ -80,0 +81,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3849571
12129
6
- Removed@toruslabs/http-helpers@5.0.0(transitive)