Skip to content

Commit

Permalink
Merge pull request #331 from torusresearch/feat/server-time-offset
Browse files Browse the repository at this point in the history
Add serverTimeOffset props in constructor args
  • Loading branch information
chaitanyapotti authored Apr 9, 2024
2 parents 4e1341d + e0b2c5d commit 03eabd0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
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

0 comments on commit 03eabd0

Please sign in to comment.