Skip to content

kryptogo/kg-mobile-wallet-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KryptoGO Mobile Wallet SDK

GitHub

Overview

KryptoGO Mobile Wallet SDK allows native apps to integrate KryptoGO wallet functionality.

Table of Contents

Features

  • Quick Integration and Easy Configuration
  • Security and Compliance
  • Technical Support and Community
  • On-chain Asset Data
  • On-chain Transaction Records
  • Asset Transfer
  • Token Swap
  • Password Backup
  • SSS Fragmentation Protection Mechanism
  • Multi-Chain Support

Supported Platforms

  • iOS
  • Android

Prerequisites

  • iOS 14.0+
  • Android 5.0+

Installing KryptoGO Mobile Wallet SDK

  1. Clone the SDK repository:

    git clone https://github.com/kryptogo/kg-mobile-wallet-sdk.git
  2. Place the KG_SDK directory into the root directory of your application.

  3. Follow the specific configuration documents for iOS and Android to complete the setup.

Configure initialization parameters:

Parameter Type Description
clientId String Your application's client ID provided by KryptoGO
clientToken String Your application's user token for authentication

The Format of the shared secret

timestamp:secret

The shared secret is a string which is combined by 2 parts:

  • The first part is the version, timestamp.
  • The second part is the secret.

SDK Methods

Methods to Handle SDK Requests

Method Name Description Parameters Return Value
updateSharedSecret Updates the shared secret used in Shamir's Secret Sharing (SSS) scheme. You need ensure that the sharedSecret is saved in your own database. This is crucial for updating the user's private key fragment stored on the device. sharedSecret: String Bool
requestSharedSecret SDK requests a shared secret (private key fragment) with reason from the app. This is a critical part of the SSS scheme, allowing the SDK to reconstruct the full private key when needed. reason:
• INVALID_DEVICE: user device is not consistent
• NO_LOCAL_SECRET: no local share key
• INVALID_LOCAL_SECRET: local share key is invalid
String
clearSharedSecret Clears the stored shared secret (private key fragment) from your own database. This might be used during account deletion or account reset procedures. version: String Bool
openVerifyPage Opens a verification page, typically used when the SDK needs to verify the user's identity before performing sensitive operations related to SSS. None Bool
closeSdkView Closes the current SDK view. None None

SDK Methods Available to Users

Method Name Description Parameters Return Value Error Code
init An asynchronous method that initializes SDK data and authenticates the KryptoGO wallet account.
*This method should be called first before other methods.
{
clientId: String,
clientToken: String
}
Success: {success: true}
Fail: {
success: false,
reason: INVALID_DEVICE / NO_LOCAL_SECRET / INVALID_LOCAL_SECRET
}
• ARGUMENT_ERROR
• CONFIG_ERROR
• NETWORK_ERROR
• API_ERROR
• WALLET_RESTORATION_ERROR
• UNKNOWN_ERROR
isReady Verifies whether the SDK is fully initialized and ready for use, including the setup of SSS components.
*This method should be called to check before open the SDK view.
None Bool None
checkDevice Performs user device verification to check if the current device is consistent. None Bool • NOT_READY
• NETWORK_ERROR
• API_ERROR
• UNKNOWN_ERROR
isWalletCreated Verifies if a wallet has been created for the current user None Bool • NOT_READY
• UNKNOWN_ERROR
getBalance Retrieves the current balance of the user's wallet. None String • NOT_READY
• NETWORK_ERROR
• API_ERROR
• UNKNOWN_ERROR
refreshSharedSecret Refreshes the shared secret (private key fragment) stored on the device. This might be done periodically for security reasons or when the user wants to update their key shares. secret: String Bool • ARGUMENT_ERROR
• NETWORK_ERROR
• API_ERROR
• SECRET_VERSION_ERROR
• SECRET_BACKUP_ERROR
• WALLET_RESTORATION_ERROR
• UNKNOWN_ERROR
openView Navigates to a specific view within the SDK's interface. Available locations:
• "/receive_address"
• "/send_token/select_token"
• "/swap"
location: String None • ARGUMENT_ERROR
• NOT_READY
• UNKNOWN_ERROR

Error Code

Common

  • INVALID_ARGUMENT: Invalid argument provided to the method.
  • NOT_READY: SDK is not initialized or not ready for operations.
  • NETWORK_ERROR: Network-related error, such as inability to connect to the server or unstable connection.
  • API_ERROR: API request failed, possibly due to server returning an error status code or data format issues.
  • UNKNOWN_ERROR: Unknown error occurred.

Initialization

  • CONFIG_ERROR: SDK initialization configuration error.

Share Secret / Wallet Restoration

  • SECRET_VERSION_ERROR: Shared secret version mismatch or error, leading to refresh or update failure.
  • SECRET_BACKUP_ERROR: Error occurred during the backup process of the shared secret, possibly due to cloud or local backup failure.
  • WALLET_RESTORATION_ERROR: Error occurred during the wallet restoration process.

SDK Flow Overview

The KryptoGO Mobile Wallet SDK interacts with your app through several key flows:

1. SDK Initialization

The app calls init with the clientId and clientToken. The SDK will initiate the configuration and wallet login process. It will return {success: true} when success, or {success: false, reason: reason} with reason or Error when failed. It then checks if the SDK is ready using isReady().

SDK Initialization

2. Check device consistency

The app calls checkDevice() to verify if the current device is consistent. It will return true when success, or Error when failed.

Check Device

3. Check if wallet is created

The app calls isWalletCreated() to check if the wallet is created. It will return true when success, or Error when failed.

Check if wallet is created

4. Get balance

The app calls getBalance() to get the balance of the wallet. It will return the balance of the wallet, or Error when failed.

Get Balance

5. SSS Backup refreshing

The app can call refreshSharedSecret and pass the original backed up secret to request the SDK to refresh SSS key fragments and re-backup. It will return new version of secret when success, or Error when failed.

SSS Backup Refreshing

6. Transaction Verification

Before signing transactions, the SDK calls openVerifyPage with transaction type. If the user successfully verifies in the app, it returns true to the SDK.

Transaction Verification

Security Features

KryptoGO Mobile Wallet SDK employs advanced protection mechanisms:

  • Password Backup
  • SSS Fragmentation Protection Mechanism

Multi-Chain Support

KryptoGO Mobile Wallet SDK supports several blockchain networks:

  • Bitcoin
  • Ethereum
  • Polygon
  • Arbitrum
  • Solana
  • TRON
  • Ronin
  • Oasys

Sample Projects and SDK Files

Android Sample

The Android sample project is located in the examples/android directory. It's a standard Android project built with Gradle. The main application code can be found in app/src/main.

iOS Sample

The iOS sample project is located in the examples/ios directory. It's a standard iOS project managed with Xcode and CocoaPods. Key files include ContentView.swift (main SwiftUI view), KgSDKService.swift (KryptoGO SDK service wrapper), and VerifyPageView.swift and VerifyPageViewController.swift (verification page code).

SDK Files

SDK files are located in the sdk directory, divided into Android and iOS subdirectories. The Android SDK files are in sdk/android/repo, while the iOS SDK files are in sdk/ios/Flutter, containing framework files for Debug, Profile, and Release configurations.

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •