> For the complete documentation index, see [llms.txt](https://secur3.gitbook.io/secur3/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://secur3.gitbook.io/secur3/technical/technical-details.md).

# Technical Details

Our contract code is open sourced, to view click link below:

<https://github.com/secur3xyz/contracts>

SECUR3 2FA protocol is built in a decentralised and permissionless form on Ethereum blockchain. It uses “clone factory pattern” approach to generate new SECUR3 Vault for user. Once SECUR3 Vault is created, it can not be accessed by any user except owner. The owner can also never be changed once set to reduce security risk.&#x20;

Going deeper, it contains 2 contracts : Secur3Factory, Secur3

## Secur3Factory

Secur3Factory contract implements factory pattern and has a method which helps in creating unique/one per address Secur3 Secur3 Vault \\.

**Imports**: Secur3.sol&#x20;

Please find details on public methods:&#x20;

**createTwoFactor**: This method can be called by any address once per lifetime to set the dedicated Secur3 Vault . It will create an instance of Secur3 Secur3 Vault and map it against the user.

**Inputs**&#x20;

* **\_encryptedPassword**: This encrypted password is stored in Secur3 contract which will be referred to while transferring assets from Secur3 Vault to the contract.

## **Secur3**

Secur3 is the Secur3 Vault contract which is created onetime during initialisation for every user. It contains methods to withdraw assets and update one-time-password.

**Imports**: IERC20, IERC721, ERC721Holder, IERC1155,ERC1155Holder, Ownable (with reduced scope i.e. removing transferOwnership, renounceOwnership methods)&#x20;

**Init**: This method can be called only once per lifetime during time of creation. It passes the relevant information as default constructor gets created by factory pattern.&#x20;

**Input**:&#x20;

* **Owner address** - address of the owner of the Secur3 Vault . Once set, it will never be changed.&#x20;
* **Encryptedpassword** - encrypted one time password to be stored for future transfer of assets from Secur3 Secur3 Vault .&#x20;

**receive**: Method to enable contract to receive Ether&#x20;

**transferERC20AssetsToWallet**: Method to transfer ERC20 tokens back to owner address.&#x20;

**Input**:&#x20;

* **Oldpassword** - which was set previously&#x20;
* **newEncryptedPassword** - new encrypted password for future transfer from Secur3 to owner&#x20;
* **ListOfERC20Assets** - a List of ERC20 assets to be withdrawn back to owner wallet

**transferERC721AssetsToWallet**: Method to transfer ERC721 token back to owner address. (Note: We can withdraw one NFT at a time in current codebase)&#x20;

**Inputs**&#x20;

* **Oldpassword** - which was set previously&#x20;
* **newEncryptedPassword** - new encrypted password for future transfer from Secur3 to owner&#x20;
* **ERC721 address** - address of ERC721 contract whose NFT to be withdrawn&#x20;
* **Token ID** - ID of the token which we want to withdraw from the Secur3 Vault

**transferERC1155AssetsToWallet**: Method to transfer ERC1155 token back to owner address. (Note: We can withdraw one NFT at a time in current codebase)&#x20;

**Inputs**:&#x20;

* **Oldpassword** - which was set previously&#x20;
* **newEncryptedPassword** - new encrypted password for future transfer from Secur3 to owner&#x20;
* **ERC1155 address** - address of ERC1155 contract whose NFT to be withdrawn&#x20;
* **Token ID** - ID of the token which we want to withdraw from the Secur3 Vault&#x20;

**transferNativeAssetToWallet** : Method to transfer Ether back to the owner address&#x20;

**Inputs**:&#x20;

* **Oldpassword** - which was set previously&#x20;
* **newEncryptedPassword** - new encrypted password for future transfer from Secur3 to owner&#x20;

**updatePassword**: To change the existing one time password.

**Inputs**:&#x20;

* **Oldpassword** - which was set previously&#x20;
* **newEncryptedPassword** - new encrypted password for future transfer from Secur3 to owner
