@sphereon/ssi-sdk.qr-code-generator 0.30.1-unstable.4 → 0.30.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.
- package/dist/agent/QrCodeProvider.d.ts +22 -22
- package/dist/agent/QrCodeProvider.js +108 -108
- package/dist/agent/QrCodeProvider.js.map +1 -1
- package/dist/agent/utils/didcomm-oob-message.d.ts +5 -5
- package/dist/agent/utils/didcomm-oob-message.js +16 -16
- package/dist/agent/utils/index.d.ts +2 -2
- package/dist/agent/utils/index.js +21 -21
- package/dist/agent/utils/react-qr.d.ts +6 -6
- package/dist/agent/utils/react-qr.js +62 -62
- package/dist/agent/utils/react-qr.js.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +21 -21
- package/dist/types/IQRCodeGenerator.d.ts +92 -92
- package/dist/types/IQRCodeGenerator.js +22 -22
- package/dist/types/IQRCodeGenerator.js.map +1 -1
- package/package.json +3 -3
- package/src/agent/QrCodeProvider.tsx +126 -126
- package/src/agent/utils/react-qr.tsx +58 -58
- package/src/types/IQRCodeGenerator.ts +126 -126
|
@@ -1,126 +1,126 @@
|
|
|
1
|
-
import { IAgentContext, IPluginMethodMap } from '@veramo/core'
|
|
2
|
-
|
|
3
|
-
export interface IQRCodeGenerator extends IPluginMethodMap {
|
|
4
|
-
qrDIDCommOobInvitationElement(
|
|
5
|
-
args: CreateElementArgs<QRType.DIDCOMM_V2_OOB_INVITATION, DIDCommV2OOBInvitationData>,
|
|
6
|
-
context: IRequiredContext,
|
|
7
|
-
): Promise<JSX.Element>
|
|
8
|
-
|
|
9
|
-
qrDIDCommOobInvitationValue(
|
|
10
|
-
args: CreateValueArgs<QRType.DIDCOMM_V2_OOB_INVITATION, DIDCommV2OOBInvitationData>,
|
|
11
|
-
context: IRequiredContext,
|
|
12
|
-
): Promise<string>
|
|
13
|
-
|
|
14
|
-
qrSIOPv2Element(args: CreateElementArgs<QRType.SIOPV2, SIOPv2DataWithScheme>, context: IRequiredContext): Promise<JSX.Element>
|
|
15
|
-
|
|
16
|
-
qrSIOPv2Value(args: CreateValueArgs<QRType.SIOPV2, SIOPv2DataWithScheme>, context: IRequiredContext): Promise<string>
|
|
17
|
-
|
|
18
|
-
qrURIElement(args: CreateElementArgs<QRType.URI, URIData>, context: IRequiredContext): Promise<JSX.Element>
|
|
19
|
-
|
|
20
|
-
qrOpenID4VCIElement(args: CreateElementArgs<QRType.OpenID4VCI, OpenID4VCIDataWithScheme>, context: IRequiredContext): Promise<JSX.Element>
|
|
21
|
-
qrOpenID4VCIValue(args: CreateValueArgs<QRType.OpenID4VCI, OpenID4VCIDataWithScheme>, context: IRequiredContext): Promise<string>
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export interface CreateValueArgs<T extends QRType, D> {
|
|
25
|
-
onGenerate?: (result: ValueResult<T, D>) => void
|
|
26
|
-
data: QRData<T, D>
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export interface CreateElementArgs<T extends QRType, D> extends CreateValueArgs<T, D> {
|
|
30
|
-
renderingProps: QRRenderingProps
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export interface ValueResult<T extends QRType, D> {
|
|
34
|
-
id: string
|
|
35
|
-
value: string
|
|
36
|
-
data: QRData<T, D>
|
|
37
|
-
renderingProps?: QRRenderingProps
|
|
38
|
-
context?: IRequiredContext
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export enum QRType {
|
|
42
|
-
URI = 'uri',
|
|
43
|
-
SIOPV2 = 'openid-vc',
|
|
44
|
-
DIDCOMM_V2_OOB_INVITATION = 'https://didcomm.org/out-of-band/2.0/invitation',
|
|
45
|
-
OpenID4VCI = 'openid-credential-offer',
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export type SIOPv2Scheme = 'openid' | 'openid-vc' | string
|
|
49
|
-
export interface SIOPv2DataWithScheme {
|
|
50
|
-
scheme?: SIOPv2Scheme
|
|
51
|
-
requestUri: string
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export type OpenID4VCIScheme = 'openid-credential-offer' | 'https' | string
|
|
55
|
-
export interface OpenID4VCIDataWithScheme {
|
|
56
|
-
scheme?: OpenID4VCIScheme
|
|
57
|
-
baseUri?: string
|
|
58
|
-
credentialOfferUri?: string
|
|
59
|
-
credentialOffer?: string
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export interface DIDCommV2OOBInvitationData {
|
|
63
|
-
baseURI: string
|
|
64
|
-
oobInvitation: DIDCommV2OOBInvitation
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* {
|
|
69
|
-
* "type": "https://didcomm.org/out-of-band/2.0/invitation",
|
|
70
|
-
* "id": "599f3638-b563-4937-9487-dfe55099d900",
|
|
71
|
-
* "from": "did:example:verifier",
|
|
72
|
-
* "body": {
|
|
73
|
-
* "goal_code": "streamlined-vp",
|
|
74
|
-
* "accept": ['didcomm/v2']
|
|
75
|
-
* }
|
|
76
|
-
* }
|
|
77
|
-
*/
|
|
78
|
-
export interface DIDCommV2OOBInvitation {
|
|
79
|
-
type: 'https://didcomm.org/out-of-band/2.0/invitation'
|
|
80
|
-
id: string
|
|
81
|
-
from: DID
|
|
82
|
-
|
|
83
|
-
body: Body
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export type URIData = string
|
|
87
|
-
|
|
88
|
-
export type DID = string
|
|
89
|
-
|
|
90
|
-
export interface Body {
|
|
91
|
-
goal_code: GoalCode
|
|
92
|
-
accept: [AcceptMode]
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
export type GoalCode = 'streamlined-vp' | 'streamlined-vc'
|
|
96
|
-
|
|
97
|
-
export type AcceptMode = 'didcomm/v2' | string
|
|
98
|
-
|
|
99
|
-
/*OIDC4VP = 'oidc4vp',
|
|
100
|
-
SIOPV2_WITH_OIDC4VP = 'siopv2+oidc4vp',
|
|
101
|
-
SIOP_V2 = 'siopv2',*/
|
|
102
|
-
|
|
103
|
-
export enum StatusCode {
|
|
104
|
-
OK = 'OK',
|
|
105
|
-
CREATED = 'CREATED',
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
export interface QRData<T extends QRType, D> {
|
|
109
|
-
id: string
|
|
110
|
-
type: T
|
|
111
|
-
object: D
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
export interface QRRenderingProps {
|
|
115
|
-
bgColor?: string
|
|
116
|
-
fgColor?: string
|
|
117
|
-
level?: 'L' | 'M' | 'Q' | 'H'
|
|
118
|
-
size?: number
|
|
119
|
-
title?: string
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
export enum events {
|
|
123
|
-
QR_CODE_CODE_CREATED = 'QrCodeCreated',
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export type IRequiredContext = IAgentContext<Record<string, never>>
|
|
1
|
+
import { IAgentContext, IPluginMethodMap } from '@veramo/core'
|
|
2
|
+
|
|
3
|
+
export interface IQRCodeGenerator extends IPluginMethodMap {
|
|
4
|
+
qrDIDCommOobInvitationElement(
|
|
5
|
+
args: CreateElementArgs<QRType.DIDCOMM_V2_OOB_INVITATION, DIDCommV2OOBInvitationData>,
|
|
6
|
+
context: IRequiredContext,
|
|
7
|
+
): Promise<JSX.Element>
|
|
8
|
+
|
|
9
|
+
qrDIDCommOobInvitationValue(
|
|
10
|
+
args: CreateValueArgs<QRType.DIDCOMM_V2_OOB_INVITATION, DIDCommV2OOBInvitationData>,
|
|
11
|
+
context: IRequiredContext,
|
|
12
|
+
): Promise<string>
|
|
13
|
+
|
|
14
|
+
qrSIOPv2Element(args: CreateElementArgs<QRType.SIOPV2, SIOPv2DataWithScheme>, context: IRequiredContext): Promise<JSX.Element>
|
|
15
|
+
|
|
16
|
+
qrSIOPv2Value(args: CreateValueArgs<QRType.SIOPV2, SIOPv2DataWithScheme>, context: IRequiredContext): Promise<string>
|
|
17
|
+
|
|
18
|
+
qrURIElement(args: CreateElementArgs<QRType.URI, URIData>, context: IRequiredContext): Promise<JSX.Element>
|
|
19
|
+
|
|
20
|
+
qrOpenID4VCIElement(args: CreateElementArgs<QRType.OpenID4VCI, OpenID4VCIDataWithScheme>, context: IRequiredContext): Promise<JSX.Element>
|
|
21
|
+
qrOpenID4VCIValue(args: CreateValueArgs<QRType.OpenID4VCI, OpenID4VCIDataWithScheme>, context: IRequiredContext): Promise<string>
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface CreateValueArgs<T extends QRType, D> {
|
|
25
|
+
onGenerate?: (result: ValueResult<T, D>) => void
|
|
26
|
+
data: QRData<T, D>
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface CreateElementArgs<T extends QRType, D> extends CreateValueArgs<T, D> {
|
|
30
|
+
renderingProps: QRRenderingProps
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface ValueResult<T extends QRType, D> {
|
|
34
|
+
id: string
|
|
35
|
+
value: string
|
|
36
|
+
data: QRData<T, D>
|
|
37
|
+
renderingProps?: QRRenderingProps
|
|
38
|
+
context?: IRequiredContext
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export enum QRType {
|
|
42
|
+
URI = 'uri',
|
|
43
|
+
SIOPV2 = 'openid-vc',
|
|
44
|
+
DIDCOMM_V2_OOB_INVITATION = 'https://didcomm.org/out-of-band/2.0/invitation',
|
|
45
|
+
OpenID4VCI = 'openid-credential-offer',
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export type SIOPv2Scheme = 'openid' | 'openid-vc' | string
|
|
49
|
+
export interface SIOPv2DataWithScheme {
|
|
50
|
+
scheme?: SIOPv2Scheme
|
|
51
|
+
requestUri: string
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export type OpenID4VCIScheme = 'openid-credential-offer' | 'https' | string
|
|
55
|
+
export interface OpenID4VCIDataWithScheme {
|
|
56
|
+
scheme?: OpenID4VCIScheme
|
|
57
|
+
baseUri?: string
|
|
58
|
+
credentialOfferUri?: string
|
|
59
|
+
credentialOffer?: string
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface DIDCommV2OOBInvitationData {
|
|
63
|
+
baseURI: string
|
|
64
|
+
oobInvitation: DIDCommV2OOBInvitation
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* {
|
|
69
|
+
* "type": "https://didcomm.org/out-of-band/2.0/invitation",
|
|
70
|
+
* "id": "599f3638-b563-4937-9487-dfe55099d900",
|
|
71
|
+
* "from": "did:example:verifier",
|
|
72
|
+
* "body": {
|
|
73
|
+
* "goal_code": "streamlined-vp",
|
|
74
|
+
* "accept": ['didcomm/v2']
|
|
75
|
+
* }
|
|
76
|
+
* }
|
|
77
|
+
*/
|
|
78
|
+
export interface DIDCommV2OOBInvitation {
|
|
79
|
+
type: 'https://didcomm.org/out-of-band/2.0/invitation'
|
|
80
|
+
id: string
|
|
81
|
+
from: DID
|
|
82
|
+
|
|
83
|
+
body: Body
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export type URIData = string
|
|
87
|
+
|
|
88
|
+
export type DID = string
|
|
89
|
+
|
|
90
|
+
export interface Body {
|
|
91
|
+
goal_code: GoalCode
|
|
92
|
+
accept: [AcceptMode]
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export type GoalCode = 'streamlined-vp' | 'streamlined-vc'
|
|
96
|
+
|
|
97
|
+
export type AcceptMode = 'didcomm/v2' | string
|
|
98
|
+
|
|
99
|
+
/*OIDC4VP = 'oidc4vp',
|
|
100
|
+
SIOPV2_WITH_OIDC4VP = 'siopv2+oidc4vp',
|
|
101
|
+
SIOP_V2 = 'siopv2',*/
|
|
102
|
+
|
|
103
|
+
export enum StatusCode {
|
|
104
|
+
OK = 'OK',
|
|
105
|
+
CREATED = 'CREATED',
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export interface QRData<T extends QRType, D> {
|
|
109
|
+
id: string
|
|
110
|
+
type: T
|
|
111
|
+
object: D
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export interface QRRenderingProps {
|
|
115
|
+
bgColor?: string
|
|
116
|
+
fgColor?: string
|
|
117
|
+
level?: 'L' | 'M' | 'Q' | 'H'
|
|
118
|
+
size?: number
|
|
119
|
+
title?: string
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export enum events {
|
|
123
|
+
QR_CODE_CODE_CREATED = 'QrCodeCreated',
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export type IRequiredContext = IAgentContext<Record<string, never>>
|