useEdDSAKeyRefresh
Hook for refreshing EdDSA keyshares.
Import
import { useEdDSAKeyRefresh } from '@silencelaboratories/react-native-duo-sdk';
Usage
const {
isLoading,
keyshare,
error,
keyRefresh,
asyncKeyRefresh
} = useEdDSAKeyRefresh();
keyRefresh({
userToken,
partyKey,
keyshare
})
Returns
isLoading: boolean
isLoading: boolean
Indicates if the keyshare refresh is in progress.
keyshare: EdDSAP1Keyshare | undefined
keyshare: EdDSAP1Keyshare | 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: EdDSATssError | undefined | unknow
error: EdDSATssError | undefined | unknow
The error object if the keyshare refresh fails.
keyRefresh: (params: { userToken: string, partyKey: EdDSAP1PartyKeys, keyshare: EdDSAP1Keyshare }) => void
keyRefresh: (params: { userToken: string, partyKey: EdDSAP1PartyKeys, keyshare: EdDSAP1Keyshare }) => void
The
keyshare
is the keyshare to be refreshed.The function to refresh the keyshare.
asyncKeyRefresh: (params: { userToken: string, partyKey: EdDSAP1PartyKeys, keyshare: EdDSAP1Keyshare }) => Promise<EdDSAP1Keyshare>
asyncKeyRefresh: (params: { userToken: string, partyKey: EdDSAP1PartyKeys, keyshare: EdDSAP1Keyshare }) => Promise<EdDSAP1Keyshare>
similar to
keyRefresh
but returns a promise which can be awaited.