Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

xdcnetwork-mobilesdk

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xdcnetwork-mobilesdk

test

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Overview

The XDC Mobile SDK is a key component of the XDC Wallet Protocol that allows developers to retake control of the user experience by eliminating the reliance for end-users to complete complex blockchain operations through third party apps. By utilizing the SDK, developers gain access to the necessary tools that enable them to create familiar and native mobile UX while leveraging the benefits of blockchain technology.

The XDC Mobile SDK makes it easy to create web3 mobile apps by: Simplifying self-custody: Create performative EOAs (Externally Owned Accounts) under the hood, stored on the user's device, and secured by native OS technology.

Supported blockchains and tokens

  • XDC
  • More coming soon

Supported languages

  • React Native
  • Expo
  • More coming soon

Installation

Install with npm

 npm install xdcnetwork-mobilesdk

Install required dependencies:

 npm install --save react-native-keychain

 npm install --save react-native-get-random-values

 //for IOS
 npx pod-install

Get Started

Create a crypto account

Generate an EOA on-device at device + application level.

import { createAccount } from 'xdcnetwork-mobilesdk';

const newAccount = await createAccount();

Get the public address

Get the public address of the EOA generated by the SDK.

import { getAccount } from 'xdcnetwork-mobilesdk';

const account = await getAccount();

Displaying seed phrases

Display the seed phrase to users to enable users to import their crypto account an external wallet app.

import { getAccountPhrase } from 'xdcnetwork-mobilesdk';

const mnemonic = await getAccountPhrase();

How it Works

Creation

The account generation process uses the BIP39 mnemonic generation to create a hierarchical-deterministic (HD) wallet. This mnemonic is used to extract a private key from the BIP32 path "m/44'/60'/0'/0/0" which is the Ethereum default path.

This generation process uses the same methodologies as ethers js, with a couple of key differences:

  • The generation of the mnemonic and the extraction of the private key are both done in native code, with C being used on the iOS side and Kotlin on the Android side.
  • The private key from our NativeModule is passed over to the JavaScript side to instantiate an ethers js wallet using the private key.

The above approach bypasses the performance issues that occur when performing big int math in javascript within a React Native app. The generated ethers js wallet does not have access to the mnemonic, it is not able to create a second wallet with a different path.

Persistence

On device only

Private keys are generated at the app + device level, and if the user uninstalls and reinstalls the application on the same device, the same private key will be used. However, if the user reinstalls the app on a different device, a new private key will be generated.

Cloud recovery enabled

Developers who opt in to utilize iOS or Google's cloud recovery will generate a private key at the device + cloud account level. Users are able to utilize the same crypto account on multiple devices as long as they are logged into their cloud account on their device.

Encryption & Storage

Private key storage makes use of hardware encryption and low level OS key storage technology on device.

Keywords

FAQs

Package last updated on 05 Oct 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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