useAuth
Function: useAuth()
useAuth():
object
Custom hook for handling authentication with the Haven1 SDK.
Returns
object
An object containing authentication methods.
nonce
nonce:
UseMutationResult
<undefined
|FetchResponse
<{parameters
: {cookie
:undefined
;header
:undefined
;path
:undefined
;query
:undefined
; };requestBody
:undefined
;responses
: {200
: {content
: {application/json
: {data
: {nonce
:string
; };status
:"success"
; };multipart/form-data
: {data
: {nonce
:string
; };status
:"success"
; };text/plain
: {data
: {nonce
:string
; };status
:"success"
; }; };headers
: {}; }; }; },undefined
|FetchOptions
<{parameters
: {cookie
:undefined
;header
:undefined
;path
:undefined
;query
:undefined
; };requestBody
:undefined
;responses
: {200
: {content
: {application/json
: {data
: ...;status
: ...; };multipart/form-data
: {data
: ...;status
: ...; };text/plain
: {data
: ...;status
: ...; }; };headers
: {}; }; }; }>, `${string}/${string}`>,Error
,void
,unknown
>
Mutation for fetching a nonce.
signOut
signOut:
UseMutationResult
<undefined
|FetchResponse
<{parameters
: {cookie
:undefined
;header
:undefined
;path
:undefined
;query
:undefined
; };requestBody
:undefined
;responses
: {200
: {content
: {application/json
: {data
:null
;status
:"success"
; };multipart/form-data
: {data
:null
;status
:"success"
; };text/plain
: {data
:null
;status
:"success"
; }; };headers
: {}; }; }; },undefined
|FetchOptions
<{parameters
: {cookie
:undefined
;header
:undefined
;path
:undefined
;query
:undefined
; };requestBody
:undefined
;responses
: {200
: {content
: {application/json
: {data
: ...;status
: ...; };multipart/form-data
: {data
: ...;status
: ...; };text/plain
: {data
: ...;status
: ...; }; };headers
: {}; }; }; }>, `${string}/${string}`>,Error
,void
,unknown
>
Mutation for signing out.
validate
validate:
UseQueryResult
<undefined
|FetchResponse
<{parameters
: {cookie
:undefined
;header
:undefined
;path
: {token
:string
; };query
:undefined
; };requestBody
:undefined
;responses
: {200
: {content
: {application/json
: {data
: {address
: ...;isSignedIn
: ...; } | {isSignedIn
: ...; };status
:"success"
; };multipart/form-data
: {data
: {address
: ...;isSignedIn
: ...; } | {isSignedIn
: ...; };status
:"success"
; };text/plain
: {data
: {address
: ...;isSignedIn
: ...; } | {isSignedIn
: ...; };status
:"success"
; }; };headers
: {}; }; }; }, {params
: {path
: {token
:string
; }; }; }, `${string}/${string}`>,Error
>
Query for validating an authentication token.
verify
verify:
UseMutationResult
<undefined
|FetchResponse
<{parameters
: {cookie
:undefined
;header
:undefined
;path
:undefined
;query
:undefined
; };requestBody
: {content
: {application/json
: {message
:string
;signature
:string
; };multipart/form-data
: {message
:string
;signature
:string
; };text/plain
: {message
:string
;signature
:string
; }; }; };responses
: {200
: {content
: {application/json
: {data
:null
;status
:"success"
; };multipart/form-data
: {data
:null
;status
:"success"
; };text/plain
: {data
:null
;status
:"success"
; }; };headers
: {}; };400
: {content
: {application/json
: {data
:Record
<string
,never
>;status
:"fail"
; };multipart/form-data
: {data
:Record
<string
,never
>;status
:"fail"
; };text/plain
: {data
:Record
<string
,never
>;status
:"fail"
; }; };headers
: {}; };401
: {content
: {application/json
: {data
: {error
:string
; };status
:"fail"
; };multipart/form-data
: {data
: {error
:string
; };status
:"fail"
; };text/plain
: {data
: {error
:string
; };status
:"fail"
; }; };headers
: {}; };500
: {content
: {application/json
: {message
:string
[];status
:"error"
; };multipart/form-data
: {message
:string
[];status
:"error"
; };text/plain
: {message
:string
[];status
:"error"
; }; };headers
: {}; }; }; }, {body
: {message
:string
;signature
:string
; }; }, `${string}/${string}`>,Error
,VerifyAuthParams
,unknown
>
Mutation for verifying a message and signature.
Defined in
Last updated