@etherspot/remote-signer
Version:
Etherspot Permissioned Signer SDK - signs the UserOp with SessionKey and sends it to the Bundler
31 lines (29 loc) • 1.16 kB
JavaScript
import {
isSessionKeyLiveOnChain
} from "./chunk-M2QU7VOG.mjs";
import {
getSessionKey
} from "./chunk-YBGMLW7N.mjs";
// src/sdk/session-keys/validate-session-key.ts
var isAValidSessionKey = async (publicClient, sesssionKeyValidatorAddress, etherspotWalletAddress, chainId, apiKey, sessionKey) => {
const sessionKeyResponse = await getSessionKey(etherspotWalletAddress, chainId, apiKey, sessionKey);
if (!sessionKeyResponse || !sessionKeyResponse.sessionKey || sessionKeyResponse.sessionKey == "") {
console.log(`Sessionkey: ${sessionKey} not found for etherspotWalletAddress: ${etherspotWalletAddress} and apiKey: ${apiKey} on chainId: ${chainId}`);
return false;
}
const isLiveOnChain = await isSessionKeyLiveOnChain(
etherspotWalletAddress,
publicClient,
sesssionKeyValidatorAddress,
sessionKeyResponse.sessionKey
);
if (!isLiveOnChain) {
console.warn(`Sessionkey: ${sessionKey} is not live for etherspotWalletAddress: ${etherspotWalletAddress} and apiKey: ${apiKey} on chainId: ${chainId}`);
return false;
}
return true;
};
export {
isAValidSessionKey
};
//# sourceMappingURL=chunk-3CLTAXSX.mjs.map