useEdDSASignGen

Hook for generating EdDSA signature.


Import

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

Usage

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

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

Returns

isLoading: boolean

  • Indicates if the signature generation is in progress.

signature: string | undefined

  • The generated signature.

  • The signature is a base64 encoded string.

error: EdDSATssError | undefined | unknow

  • The error object if the signature generation fails.

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

  • userToken: string

    • The user JWT token.

  • partyKey: EdDSAP1PartyKeys

    • The party key object.

  • keyshare: EdDSAP1Keyshare

    • 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: EdDSAP1PartyKeys, keyshare: EdDSAP1Keyshare, hexMessageHash: string }) => Promise<string>

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