Variable: IssuerContext

typescript
1
const IssuerContext: Context<undefined | AgentContextType & object>

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

React context for credential issuance operations.

Provides functionality for creating and issuing verifiable credentials to holders. Includes support for out-of-band credential offers and direct credential issuance.

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
27
28
29
30
31
32
33
34
35
36
37
import { IssuerContext } from '@trust0/identus-react/context';
import { useContext } from 'react';
import SDK from '@hyperledger/identus-sdk';
function CredentialIssuer() {
const context = useContext(IssuerContext);
if (!context) {
throw new Error('CredentialIssuer must be used within IssuerProvider');
}
const { createOOBOffer, issueCredential, state } = context;
const createDriversLicenseOffer = async () => {
const offer = await createOOBOffer(
SDK.Domain.CredentialType.JWT,
'drivers-license-123',
{
name: 'John Doe',
licenseNumber: 'DL123456',
expirationDate: '2025-12-31'
}
);
// Share offer with holder
console.log('Credential offer:', offer);
};
return (
<div>
<p>Issuer State: {state}</p>
<button onClick={createDriversLicenseOffer}>
Create Driver's License Offer
</button>
</div>
);
}