Off-Chain Signature Mechanism (OSM)

The off-chain signature mechanism aims to provide a secure way for signing transactions without using browser wallet.

Flow

The Off-chain Signature Mechanism is aiming to abstract the interactions between the user and any blockchain in order to achieve better accessibility of the technology, better UX, and security.
Instead of having the user sign blockchain transactions with Metamask or another wallet provider, the SkillWallet tie together the NFT ID and the mobile phone of the user.
When the SkillWallet mobile app is downloaded, it generates a public/private key pair that is used for secure authentication. The public key gets associated with this tokenID on-chain.
After the SW is activated and tied to the mobile app, the user can use it to sign transactions and verify their identity, by signing with their private key and verifying with the Chainlink EA.
Every contract that implements ISWActionExecutor can take advantage of the OSM.
interface ISWActionExecutor {
event ActonExecuted(
address indexed contractAddress,
uint256 indexed action
);
function execute(
Types.Action action,
address caller,
uint256[] memory intParams,
string[] memory stringParams,
address[] memory addressParams
) external;
}
How it works is that the user scans a QR code, that has encoded action, parameters, and a nonce. The mobile app signs the payload and sends it via HTTP to a backend proxy server that has the only purpose to call the Off-chain signature mechanism contract for verifying the signature. The OSM contract calls the Chainlink External Adapter, it verifies the signature and returns true/false results to the contract. The callback of the chainlink external adapter, calls the execute function from the contract that corresponds to the action.
OSM overview
The OSM is highly abstracted, customizable, and reusable and it can very easily be integrated into external smart contracts. It is built to be integratable in any contracts and to be used for any actions. In order not to put limitations on the parameters sent, the function accepts arrays with int, string, and address parameters.
The entire action flow

Integrate into your contract

  1. 1.
npm i skill-wallet
2. Import the ISWActionExecutor.sol in your contract
import skill-wallet/contracts/main/ISWActionExecutor.sol
3. Inherit the interface and implement the execute function
contract MyContract is ISWActionExecutor {
// here goes your contract
function execute(
Types.Action action,
address caller,
uint[] memory intParams,
string[] memory stringParams,
address[] memory addressParams
) public override {
require(msg.sender == skillWalletAddress, "Only SW can call execute!");
require(uint(action) >= 1 && uint(action) <= 2, "Invalid action!");
// validate your parameters
if(action == 1 {
// call your function represented by this action
// with the according parameters
this.myFirstAction(caller, intParams[0], stringParams[0]);
} else if(action == 2) {
// call your function represented by this action
// with the according parameters
this.mySecondAction(caller, stringParams[0]);
}
}
}
4. Contact the SkillWallet team to define your actions and your contract address in the SkillWallet contract
5. Use our web component for generating the QR codes with encoded actions and parameters. (TBD)