Skip to content

iFrame

General Overview

The iFrame is embedded into the user browser, or into a React Native app. It is component in charge of generating the private key, splitting it into shares, and storing them in their respective storage components; as well as fetching the shares and reconstructing the private key when required.

Operations that use the private key all take place inside the iFrame, so the private key is never exposed to the outside world. The iFrame reconstructs the private key in memory and forgets if after each usage, ensuring that the private key is never stored in the browser and its in-memory lifetime is as short-lived as possible.

The sample provied in the iFrame sample shows how to:

  • log into the auth service to get an access token
  • configure the cold storage
  • create an iFrame instance
  • register a user, generating its private key to split it and store the shares
  • retrieve the shares, reconstruct the private key and sign a message

How It Works

The iFrame is written in React and uses the crypto-js, openfort-js, and shield-js.

Its constructors expects the access token and the URL of the hot storage. The iFrame can be interacted with by using the browser postMessage API, which allows sending messages to the iFrame and receiving messages from it. The cold storage url is configured when calling the methods that require it.

After a successful reconstruction of the private key, if the current device had no local share in the browser storage, the key is split once again into different shares which are then stored in the local and hot storages.

Presented By
Openfort Logo