useECDSAKeyRefresh

Hook for refreshing ECDSA keyshare.

Import

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

Usage

const { 
  isLoading, 
  keyshare, 
  error,
  keyRefresh,
  asyncKeyRefresh
} = useECDSAKeyRefresh();

keyRefresh({
  userToken,
  partyKey,
  keyshare
})

Returns

isLoading: boolean

  • Indicates if the keyshare refresh is in progress.

keyshare: ECDSAP1KeyshareV2 | undefined

  • The refreshed keyshare.

  • The old keyshare would be replaced with the new keyshare. With the same keyId.

  • The old keyshare would be invalidated.

error: DuoSDKError | undefined | unknow

  • The error object if the keyshare refresh fails.

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

  • userToken: string

    • The user JWT token.

  • partyKey: ECDSAP1PartyKeys

    • The party key object.

  • keyshare: ECDSAP1KeyshareV2

    • The keyshare to be refreshed.

  • The function to refresh the keyshare.

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

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

Last updated