Function: useCastor()
typescript
1
useCastor(resolvers): Castor
Defined in: packages/identus-react/src/hooks/useCastor.ts:45
Creates and returns a memoized instance of Castor with optional additional resolvers.
Castor is the cryptographic component of the Identus SDK responsible for DID operations, key management, and cryptographic functions. It can be extended with additional DID resolvers.
Parameters
resolvers
ExtraResolver[] = []
Optional array of additional DID resolver constructors to extend Castor functionality
Returns
Castor Context
Example
tsx123456789101112131415161718192021222324import { useCastor } from '@trust0/identus-react/hooks';function DIDManager() {// Basic usage without additional resolversconst castor = useCastor();// Usage with custom resolversconst castorWithResolvers = useCastor([CustomResolver1, CustomResolver2]);const resolveDID = async () => {try {const didDocument = await castor.resolveDID(SDK.Domain.DID.fromString('did:prism:example'));console.log('Resolved DID:', didDocument.toString());} catch (error) {console.error('Failed to resolve DID:', error);}};return (<button onClick={resolveDID}>Resolve DID</button>);}