LogoLogo
Duo SDK
  • Introduction
  • Overview
  • Code Stack
  • HOW TO
    • Silent Shard Duo SDK Example
      • Admin
      • Server Node
      • Client Node
        • React-Native
          • Installing Silent Shard Duo RN SDK
          • Quick start
          • Error handling
          • Hooks
            • useECDSAKeyGen
            • useECDSASignGen
            • useECDSAKeyRefresh
          • Functions
            • keyGenECDSA
            • signGenECDSA
            • keyRefreshECDSA
          • Classes
            • ECDSAP1PartyKeys class
            • ECDSAP1KeyshareV2 class
  • ADVANCED SETUP
    • Low Level API
      • Key Generation
      • Sign
      • Key Rotation
    • MPC + Account Abstraction Kits
      • Biconomy Smart Accounts
        • Quick Start
        • Using the CLI version
        • Experience this in a Biconomy x SL powered DApp
      • Stackup Account Abstraction SDK
        • Quick Start
        • Using the CLI version
        • Experience it in a Stackup x SL powered DApp
      • Resources
        • Structure of the repository
        • Integration and Hosting
  • REFERENCE
    • MetaMask Snap
    • Contact Us
Powered by GitBook
On this page
  • Import
  • Usage
  • Returns
  • isLoading: boolean
  • signature: ECDSAP1Signature | undefined
  • error: DuoSDKError | undefined | unknow
  • sign: (params: { userToken: string, partyKey: ECDSAP1PartyKeys, keyshare: ECDSAP1KeyshareV2, hexMessageHash: string }) => void
  • asyncSign: (params: { userToken: string, partyKey: ECDSAP1PartyKeys, keyshare: ECDSAP1KeyshareV2, hexMessageHash: string }) => Promise<ECDSAP1Signature>
  • Types
  • ECDSAP1Signature
  1. HOW TO
  2. Silent Shard Duo SDK Example
  3. Client Node
  4. React-Native
  5. Hooks

useECDSASignGen

Hook for generating ECDSA signature.

Import

import { useECDSASignGen } from '@silencelaboratories/react-native-duo-sdk';

Usage

const { 
  isLoading, 
  signature, 
  error,
  sign,
  asyncSign
} = useECDSASignGen();

sign({
  userToken,
  partyKey,
  keyshare,
  hexMessageHash,
})

Returns

isLoading: boolean

  • Indicates if the signature generation is in progress.

signature: ECDSAP1Signature | undefined

  • The generated signature.

error: DuoSDKError | undefined | unknow

  • The error object if the signature generation fails.

sign: (params: { userToken: string, partyKey: ECDSAP1PartyKeys, keyshare: ECDSAP1KeyshareV2, hexMessageHash: string }) => void

  • userToken: string

    • The user JWT token.

  • partyKey: ECDSAP1PartyKeys

    • The party key object.

  • keyshare: ECDSAP1KeyshareV2

    • The keyshare object to use for signature generation.

  • hexMessageHash: string

    • Hash of a message, obtained by hashing it with a hash function and then encoding the result as a hexadecimal string.

  • The function to generate the signature.

asyncSign: (params: { userToken: string, partyKey: ECDSAP1PartyKeys, keyshare: ECDSAP1KeyshareV2, hexMessageHash: string }) => Promise<ECDSAP1Signature>

  • similar to sign but returns a promise which can be awaited.


Types

ECDSAP1Signature

type ECDSAP1Signature = {
  signature: string; // base64 encoded signature
  recoveryId: number;
};

Last updated 1 year ago