Skip to content

Commit 3e1edcf

Browse files
committed
chore: bring in session helper to node client
1 parent 9ad04d0 commit 3e1edcf

File tree

3 files changed

+7
-73
lines changed

3 files changed

+7
-73
lines changed

packages/auth-browser/src/lib/session.ts

Lines changed: 0 additions & 37 deletions
This file was deleted.

packages/constants/src/lib/constants/constants.ts

Lines changed: 5 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1208,9 +1208,6 @@ export const LIT_NETWORKS: { [key in LIT_NETWORK_VALUES]: string[] } = {
12081208
custom: [],
12091209
};
12101210

1211-
// ========== Lit Sessions ==========
1212-
export const LIT_SESSION_KEY_URI = 'lit:session:';
1213-
12141211
// ========== Lit Auth Methods ==========
12151212

12161213
export const AUTH_METHOD_TYPE_IDS = {
@@ -1274,24 +1271,6 @@ export type AUTH_METHOD_SCOPE_TYPE = keyof typeof AUTH_METHOD_SCOPE;
12741271
export type AUTH_METHOD_SCOPE_VALUES =
12751272
(typeof AUTH_METHOD_SCOPE)[keyof typeof AUTH_METHOD_SCOPE];
12761273

1277-
// ========== Supported Provider Types ==========
1278-
export const PROVIDER_TYPE = {
1279-
Discord: 'discord',
1280-
Google: 'google',
1281-
EthWallet: 'ethwallet',
1282-
WebAuthn: 'webauthn',
1283-
Apple: 'apple',
1284-
StytchOtp: 'stytchOtp',
1285-
StytchEmailFactorOtp: 'stytchEmailFactorOtp',
1286-
StytchSmsFactorOtp: 'stytchSmsFactorOtp',
1287-
StytchWhatsAppFactorOtp: 'stytchWhatsAppFactorOtp',
1288-
StytchTotpFactor: 'stytchTotpFactor',
1289-
} as const;
1290-
1291-
export type PROVIDER_TYPE_TYPE = keyof typeof PROVIDER_TYPE;
1292-
export type PROVIDER_TYPE_VALUES =
1293-
(typeof PROVIDER_TYPE)[keyof typeof PROVIDER_TYPE];
1294-
12951274
// ========== Supported Staking States ==========
12961275
export const STAKING_STATES = {
12971276
Active: 0,
@@ -1303,20 +1282,9 @@ export const STAKING_STATES = {
13031282
} as const;
13041283

13051284
export type STAKING_STATES_TYPE = keyof typeof STAKING_STATES;
1285+
13061286
export type STAKING_STATES_VALUES =
13071287
(typeof STAKING_STATES)[keyof typeof STAKING_STATES];
1308-
1309-
// ========== Relay Auth Status ==========
1310-
export const RELAY_AUTH_STATUS = {
1311-
InProgress: 'InProgress',
1312-
Succeeded: 'Succeeded',
1313-
Failed: 'Failed',
1314-
} as const;
1315-
1316-
export type RELAY_AUTH_STATUS_TYPE = keyof typeof RELAY_AUTH_STATUS;
1317-
export type RELAY_AUTH_STATUS_VALUES =
1318-
(typeof RELAY_AUTH_STATUS)[keyof typeof RELAY_AUTH_STATUS];
1319-
13201288
/**
13211289
* Prefixes used for identifying various LIT resources.
13221290
*
@@ -1415,6 +1383,10 @@ export const LOG_LEVEL = {
14151383
export type LOG_LEVEL_TYPE = keyof typeof LOG_LEVEL;
14161384
export type LOG_LEVEL_VALUES = (typeof LOG_LEVEL)[keyof typeof LOG_LEVEL];
14171385

1386+
/**
1387+
* This is useful when the node is not able to connect to the IPFS gateway,
1388+
* so the sdk can fallback to these gateways.
1389+
*/
14181390
export const FALLBACK_IPFS_GATEWAYS = [
14191391
'https://flk-ipfs.io/ipfs/',
14201392
'https://litprotocol.mypinata.cloud/ipfs/',

packages/lit-node-client-nodejs/src/lib/lit-node-client-nodejs.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import {
2424
LIT_CURVE,
2525
LIT_CURVE_TYPE,
2626
LIT_ENDPOINT,
27-
LIT_SESSION_KEY_URI,
2827
LitNodeClientNotReadyError,
2928
LOCAL_STORAGE_KEYS,
3029
ParamNullError,
@@ -1321,7 +1320,7 @@ export class LitNodeClientNodeJs extends LitCore implements ILitNodeClient {
13211320
// Try to get it from local storage, if not generates one~
13221321
const sessionKey: SessionKeyPair =
13231322
params.sessionKey ?? this.getSessionKey();
1324-
const sessionKeyUri = LIT_SESSION_KEY_URI + sessionKey.publicKey;
1323+
const sessionKeyUri = this.getSessionKeyUri(sessionKey.publicKey);
13251324

13261325
log(
13271326
`[signSessionKey] sessionKeyUri is not found in params, generating a new one`,
@@ -1919,7 +1918,7 @@ export class LitNodeClientNodeJs extends LitCore implements ILitNodeClient {
19191918
* @returns { string } the session key uri
19201919
*/
19211920
getSessionKeyUri = (publicKey: string): string => {
1922-
return LIT_SESSION_KEY_URI + publicKey;
1921+
return 'lit:session:' + publicKey;
19231922
};
19241923

19251924
/**

0 commit comments

Comments
 (0)