@mosip/react-inji-verify-sdk 0.12.0-beta.1 → 0.13.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,8 +4,7 @@ export type OpenID4VPError = {
4
4
  code?: string;
5
5
  details?: unknown;
6
6
  };
7
- export type VerificationStatus = "success" | "invalid" | "expired";
8
- type vpResultStatus = "SUCCESS" | "FAILED";
7
+ export type VerificationStatus = "valid" | "invalid" | "expired";
9
8
  export interface VerificationResult {
10
9
  /**
11
10
 
@@ -18,10 +17,7 @@ export interface VerificationResult {
18
17
  */
19
18
  vcStatus: VerificationStatus;
20
19
  }
21
- export interface VerificationResults {
22
- vcResults: VerificationResult[];
23
- vpResultStatus: vpResultStatus;
24
- }
20
+ export type VerificationResults = VerificationResult[];
25
21
  export interface QrData {
26
22
  transactionId: string;
27
23
  requestId: string;
@@ -74,7 +70,7 @@ type ExclusiveCallbacks =
74
70
  * Provides the verification result data.
75
71
  */
76
72
  | {
77
- onVPProcessed: (vpResult: VerificationResults) => void;
73
+ onVPProcessed: (VPResult: VerificationResults) => void;
78
74
  onVPReceived?: never;
79
75
  };
80
76
  interface InputDescriptor {
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import { QRCodeVerificationProps } from "../../components/qrcode-verification/QRCodeVerification.types";
3
+ import "./QRCodeVerification.css";
4
+ declare const QRCodeVerification: React.FC<QRCodeVerificationProps>;
5
+ export default QRCodeVerification;
@@ -0,0 +1,104 @@
1
+ /// <reference types="react" />
2
+ type ExclusiveCallbacks =
3
+ /**
4
+ * Callback triggered when the verification presentation (VP) is received.
5
+ * Provides the associated transaction ID.
6
+ */
7
+ {
8
+ onVCReceived: (txnId: string) => void;
9
+ onVCProcessed?: never;
10
+ }
11
+ /**
12
+ * Callback triggered when the VP is successfully processed.
13
+ * Provides the verification result data.
14
+ */
15
+ | {
16
+ onVCProcessed: (vpResult: VerificationResults) => void;
17
+ onVCReceived?: never;
18
+ };
19
+ export type QRCodeVerificationProps = ExclusiveCallbacks & {
20
+ /**
21
+ * React element that triggers the verification process (e.g., a button).
22
+ * If not provided, the component may automatically start the process.
23
+ */
24
+ triggerElement?: React.ReactNode;
25
+ /**
26
+ * The backend service URL where the verification request will be sent.
27
+ * This is a required field.
28
+ */
29
+ verifyServiceUrl: string;
30
+ /**
31
+ * Callback triggered when an error occurs during the verification process.
32
+ * This is a required field to ensure proper error handling.
33
+ */
34
+ onError: (error: Error) => void;
35
+ /**
36
+ * Upload button config.
37
+ */
38
+ uploadButtonId?: string;
39
+ uploadButtonStyle?: string;
40
+ /**
41
+ * Enable camera zoom (mobile).
42
+ */
43
+ enableZoom?: boolean;
44
+ /**
45
+ * Enable upload functionality.
46
+ * Defaults to true.
47
+ */
48
+ isEnableUpload?: boolean;
49
+ /**
50
+ * Enable scan functionality.
51
+ * Defaults to true.
52
+ */
53
+ isEnableScan?: boolean;
54
+ };
55
+ interface VerificationResult {
56
+ /**
57
+ * Verified credential data (structure depends on implementation).
58
+ */
59
+ vc: unknown;
60
+ /**
61
+ * The status of the verification (e.g., "valid", "invalid", "expired").
62
+ */
63
+ vcStatus: VcStatus;
64
+ }
65
+ export type VerificationResults = VerificationResult[];
66
+ export type VcStatus = "SUCCESS" | "INVALID" | "EXPIRED";
67
+ export type scanResult = {
68
+ data: any;
69
+ error: Error | null;
70
+ };
71
+ export interface QrData {
72
+ /**
73
+ * Unique transaction identifier.
74
+ */
75
+ transactionId: string;
76
+ /**
77
+ * Request identifier associated with the verification.
78
+ */
79
+ requestId: string;
80
+ /**
81
+ * Authorization details required for verification.
82
+ */
83
+ authorizationDetails: {
84
+ responseType: string;
85
+ clientId: string;
86
+ presentationDefinition: Record<string, unknown>;
87
+ presentationDefinitionUri?: string;
88
+ responseUri: string;
89
+ nonce: string;
90
+ iat: number;
91
+ };
92
+ /**
93
+ * Expiration timestamp of the QR code.
94
+ */
95
+ expiresAt: number;
96
+ }
97
+ export interface vpRequestBody {
98
+ clientId: string;
99
+ nonce: string;
100
+ transactionId?: string;
101
+ presentationDefinitionId?: string;
102
+ presentationDefinition?: Record<string, unknown>;
103
+ }
104
+ export {};
package/dist/index.d.ts CHANGED
@@ -1 +1,2 @@
1
1
  export { default as OpenID4VPVerification } from '././components/openid4vp-verification/OpenID4VPVerification';
2
+ export { default as QRCodeVerification } from '././components/qrcode-verification/QRCodeVerification';