Variable: PrismDIDContext

typescript
1
const PrismDIDContext: Context<undefined | { create: (alias) => Promise<DID>; isPublished: (did) => Promise<boolean>; prismDID: null | DID; }>

Defined in: packages/identus-react/src/context/index.ts:58

React context for managing Prism DID operations and state.

Prism DIDs are long-lived, blockchain-anchored identifiers that provide persistent, verifiable identity on the Cardano network. This context manages the creation and state of Prism DIDs within the application.

Example

tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import { PrismDIDContext } from '@trust0/identus-react/context';
import { useContext } from 'react';
function PrismDIDManager() {
const context = useContext(PrismDIDContext);
if (!context) {
throw new Error('PrismDIDManager must be used within PrismDIDProvider');
}
const { prismDID, create } = context;
const handleCreateDID = async () => {
await create('my-main-identity');
};
return (
<div>
{prismDID ? (
<p>Prism DID: {prismDID.toString()}</p>
) : (
<button onClick={handleCreateDID}>Create Prism DID</button>
)}
</div>
);
}