Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add serverTimeOffset props in constructor args #331

Merged
merged 1 commit into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/handlers/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,12 @@ export interface CustomAuthArgs {
*/
web3AuthClientId: string;

/**
* Time difference (in seconds) between server and client
* @defaultValue 0
*/
serverTimeOffset?: number;

sentry?: Sentry;
}

Expand Down
4 changes: 3 additions & 1 deletion src/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class CustomAuth {
enableOneKey = false,
web3AuthClientId,
metadataUrl = "https://metadata.tor.us",
serverTimeOffset = 0,
}: CustomAuthArgs) {
if (!web3AuthClientId) throw new Error("Please provide a valid web3AuthClientId in constructor");
if (!network) throw new Error("Please provide a valid network in constructor");
Expand All @@ -81,8 +82,9 @@ class CustomAuth {
};
const torus = new Torus({
network,
clientId: web3AuthClientId,
enableOneKey,
serverTimeOffset,
clientId: web3AuthClientId,
legacyMetadataHost: metadataUrl,
});
Torus.setAPIKey(apiKey);
Expand Down