New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@automata-network/2fa-guru-sdk

Package Overview
Dependencies
Maintainers
3
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@automata-network/2fa-guru-sdk - npm Package Compare versions

Comparing version 1.0.17 to 1.0.18

22

dist/2fa-guru.d.ts

@@ -18,3 +18,2 @@ import { JsonRpcProvider } from '@ethersproject/providers';

check2faMethod: string;
deadline: number;
gasLimit: number;

@@ -26,4 +25,5 @@ constructor(_provider: JsonRpcProvider, _authenticatorContract: string, _apiServer: string);

* @param connectedWallet - address of connected wallet
* @param deadline - deadline for which signature is valid till
*/
signupFor2fa: (chainId: number, connectedWallet: string) => Promise<ApiResponse>;
signupFor2fa: (chainId: number, connectedWallet: string, deadline: number) => Promise<ApiResponse>;
/**

@@ -41,4 +41,5 @@ * Uses the six digit verification code to store the wallet-secret pair in the geode.

* @param targetWallet - address of your primary wallet
* @param deadline - deadline for which signature is valid till
*/
reset2fa: (chainId: number, connectedWallet: string, targetWallet: string) => Promise<ApiResponse>;
reset2fa: (chainId: number, connectedWallet: string, targetWallet: string, deadline: number) => Promise<ApiResponse>;
/**

@@ -58,4 +59,5 @@ * Uses the six digit verification code to reset the wallet-secret pair in the geode.

* @param userNonce - current nonce of wallet
* @param deadline - deadline for which signature is valid till
*/
addRecoveryWallet: (verificationCode: string, chainId: number, connectedWallet: string, targetWallet: string, userNonce: string) => Promise<ApiResponse>;
addRecoveryWallet: (verificationCode: string, chainId: number, connectedWallet: string, targetWallet: string, userNonce: string, deadline: number) => Promise<ApiResponse>;
/**

@@ -65,4 +67,5 @@ * Disable the 2fa for your connected primary wallet. There will be a cooldown period before disabling the 2fa.

* @param connectedWallet - address of your connected primary wallet
* @param deadline - deadline for which signature is valid till
*/
disable2fa: (chainId: number, connectedWallet: string) => Promise<ApiResponse>;
disable2fa: (chainId: number, connectedWallet: string, deadline: number) => Promise<ApiResponse>;
/**

@@ -72,4 +75,5 @@ * Cancels the cooldown period before disabling of 2fa.

* @param connectedWallet - address of your connected primary wallet
* @param deadline - deadline for which signature is valid till
*/
cancel2faCooldown: (chainId: number, connectedWallet: string) => Promise<ApiResponse>;
cancel2faCooldown: (chainId: number, connectedWallet: string, deadline: number) => Promise<ApiResponse>;
/**

@@ -83,4 +87,5 @@ * Returns a signature for contract calls from geode if verification code is valid

* @param encodedFunction - an encoded string that is made up of the contract methods and its parameters
* @param deadline - deadline for which signature is valid till
*/
check2fa: (chainId: number, connectedWallet: string, verificationCode: string, userNonce: string, targetContract: string, encodedFunction: string) => Promise<ApiResponse>;
check2fa: (chainId: number, connectedWallet: string, verificationCode: string, userNonce: string, targetContract: string, encodedFunction: string, deadline: number) => Promise<ApiResponse>;
/**

@@ -90,6 +95,7 @@ * Execute a low lvl call to the blockchain. Used with the signature generated from check2fa()

* @param encodedFunction - an encoded string that is made up of the contract methods and its parameters
* @param deadline - deadline for which signature is valid till
* @param signature - signature generated by geode
* @param targetContract - target contract to execute the call on
*/
executeTxnCall: (connectedWallet: string, encodedFunction: string, signature: string, targetContract: string) => Promise<ApiResponse>;
executeTxnCall: (connectedWallet: string, encodedFunction: string, deadline: number, signature: string, targetContract: string) => Promise<ApiResponse>;
/**

@@ -96,0 +102,0 @@ * Check at what timestamp 2fa will be disabled for the wallet

@@ -53,5 +53,6 @@ "use strict";

* @param connectedWallet - address of connected wallet
* @param deadline - deadline for which signature is valid till
*/
this.signupFor2fa = function (chainId, connectedWallet) {
return (0, utils_1.callServerMethod)(_this.apiServer, _this.createSecretMethod, chainId, connectedWallet, connectedWallet, _this.deadline);
this.signupFor2fa = function (chainId, connectedWallet, deadline) {
return (0, utils_1.callServerMethod)(_this.apiServer, _this.createSecretMethod, chainId, connectedWallet, connectedWallet, deadline);
};

@@ -105,5 +106,6 @@ /**

* @param targetWallet - address of your primary wallet
* @param deadline - deadline for which signature is valid till
*/
this.reset2fa = function (chainId, connectedWallet, targetWallet) {
return (0, utils_1.callServerMethod)(_this.apiServer, _this.reset2faMethod, chainId, connectedWallet, targetWallet, _this.deadline);
this.reset2fa = function (chainId, connectedWallet, targetWallet, deadline) {
return (0, utils_1.callServerMethod)(_this.apiServer, _this.reset2faMethod, chainId, connectedWallet, targetWallet, deadline);
};

@@ -156,4 +158,5 @@ /**

* @param userNonce - current nonce of wallet
* @param deadline - deadline for which signature is valid till
*/
this.addRecoveryWallet = function (verificationCode, chainId, connectedWallet, targetWallet, userNonce) { return __awaiter(_this, void 0, void 0, function () {
this.addRecoveryWallet = function (verificationCode, chainId, connectedWallet, targetWallet, userNonce, deadline) { return __awaiter(_this, void 0, void 0, function () {
var ifaceTwoFA, encodedAddRecoveryTxn, reqParams, reqOptions, jsonResponse, parsedJsonResponse;

@@ -172,3 +175,3 @@ return __generator(this, function (_a) {

data: encodedAddRecoveryTxn,
deadline: ethers_1.BigNumber.from(this.deadline).toHexString(),
deadline: ethers_1.BigNumber.from(deadline).toHexString(),
};

@@ -186,3 +189,3 @@ reqOptions = (0, eip712_1.buildRequest)(this.setRecoveryWalletMethod, reqParams);

if (parsedJsonResponse.result.signature) {
return [2 /*return*/, this.executeTxnCall(connectedWallet, encodedAddRecoveryTxn, parsedJsonResponse.result.signature, this.authenticatorContract)];
return [2 /*return*/, this.executeTxnCall(connectedWallet, encodedAddRecoveryTxn, deadline, parsedJsonResponse.result.signature, this.authenticatorContract)];
}

@@ -203,6 +206,7 @@ else {

* @param connectedWallet - address of your connected primary wallet
* @param deadline - deadline for which signature is valid till
*/
this.disable2fa = function (chainId, connectedWallet) { return __awaiter(_this, void 0, void 0, function () {
this.disable2fa = function (chainId, connectedWallet, deadline) { return __awaiter(_this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, (0, utils_1.callServerMethod)(this.apiServer, this.disable2faMethod, chainId, connectedWallet, connectedWallet, this.deadline)];
return [2 /*return*/, (0, utils_1.callServerMethod)(this.apiServer, this.disable2faMethod, chainId, connectedWallet, connectedWallet, deadline)];
});

@@ -214,6 +218,7 @@ }); };

* @param connectedWallet - address of your connected primary wallet
* @param deadline - deadline for which signature is valid till
*/
this.cancel2faCooldown = function (chainId, connectedWallet) { return __awaiter(_this, void 0, void 0, function () {
this.cancel2faCooldown = function (chainId, connectedWallet, deadline) { return __awaiter(_this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, (0, utils_1.callServerMethod)(this.apiServer, this.cancelCooldownMethod, chainId, connectedWallet, connectedWallet, this.deadline)];
return [2 /*return*/, (0, utils_1.callServerMethod)(this.apiServer, this.cancelCooldownMethod, chainId, connectedWallet, connectedWallet, deadline)];
});

@@ -229,4 +234,5 @@ }); };

* @param encodedFunction - an encoded string that is made up of the contract methods and its parameters
* @param deadline - deadline for which signature is valid till
*/
this.check2fa = function (chainId, connectedWallet, verificationCode, userNonce, targetContract, encodedFunction) { return __awaiter(_this, void 0, void 0, function () {
this.check2fa = function (chainId, connectedWallet, verificationCode, userNonce, targetContract, encodedFunction, deadline) { return __awaiter(_this, void 0, void 0, function () {
var reqParams, reqOptions, jsonResponse, parsedJsonResponse;

@@ -243,3 +249,3 @@ return __generator(this, function (_a) {

data: encodedFunction,
deadline: ethers_1.BigNumber.from(this.deadline).toHexString(),
deadline: ethers_1.BigNumber.from(deadline).toHexString(),
};

@@ -271,6 +277,7 @@ reqOptions = (0, eip712_1.buildRequest)(this.check2faMethod, reqParams);

* @param encodedFunction - an encoded string that is made up of the contract methods and its parameters
* @param deadline - deadline for which signature is valid till
* @param signature - signature generated by geode
* @param targetContract - target contract to execute the call on
*/
this.executeTxnCall = function (connectedWallet, encodedFunction, signature, targetContract) { return __awaiter(_this, void 0, void 0, function () {
this.executeTxnCall = function (connectedWallet, encodedFunction, deadline, signature, targetContract) { return __awaiter(_this, void 0, void 0, function () {
var signer, gasPrice, nonce, packedData, tx, txnResult, txnHash, txnReceipt;

@@ -290,3 +297,3 @@ return __generator(this, function (_a) {

nonce = _a.sent();
packedData = ethers_1.ethers.utils.solidityPack(['bytes', 'uint256', 'bytes'], [encodedFunction, this.deadline, signature]);
packedData = ethers_1.ethers.utils.solidityPack(['bytes', 'uint256', 'bytes'], [encodedFunction, deadline, signature]);
tx = {

@@ -307,6 +314,6 @@ to: targetContract,

if (txnReceipt.status === 1) {
return [2 /*return*/, { success: true, error: null, txnHash: txnHash }];
return [2 /*return*/, { success: true, error: null, txnHash: txnHash, txnReceipt: txnReceipt }];
}
else {
return [2 /*return*/, { success: false, error: 'Your transaction has failed.', txnHash: txnHash }];
return [2 /*return*/, { success: false, error: 'Your transaction has failed.', txnHash: txnHash, txnReceipt: txnReceipt }];
}

@@ -371,4 +378,2 @@ return [2 /*return*/];

this.check2faMethod = '/v0/2fa_check';
var currentDate = new Date();
this.deadline = Math.round(currentDate.setDate(currentDate.getDate() + 1) / 1000);
this.gasLimit = 200000;

@@ -375,0 +380,0 @@ this.authContractInstance = new ethers_1.ethers.Contract(this.authenticatorContract, TwoFactorAuthentication_json_1.default, this.provider);

{
"name": "@automata-network/2fa-guru-sdk",
"version": "1.0.17",
"version": "1.0.18",
"main": "./dist/index.js",

@@ -5,0 +5,0 @@ "description": "A SDK for easy integration with 2FA Guru",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc