@cooperation/vc-storage 1.0.24 → 1.0.25
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/models/ResumeVC.js +29 -66
- package/package.json +1 -1
package/dist/models/ResumeVC.js
CHANGED
@@ -18,7 +18,8 @@ export class ResumeVC {
|
|
18
18
|
suite,
|
19
19
|
documentLoader: customDocumentLoader,
|
20
20
|
});
|
21
|
-
console.log('
|
21
|
+
console.log('🚀 ~ ResumeVC ~ sign ~ signedVC:', JSON.stringify(signedVC));
|
22
|
+
console.log('Signed VC:', JSON.stringify(signedVC));
|
22
23
|
}
|
23
24
|
catch (error) {
|
24
25
|
console.error('Error signing VC:', error.message);
|
@@ -31,14 +32,11 @@ export class ResumeVC {
|
|
31
32
|
}
|
32
33
|
generateUnsignedCredential({ formData, issuerDid }) {
|
33
34
|
const unsignedResumeVC = {
|
34
|
-
'@context': [
|
35
|
-
|
36
|
-
|
37
|
-
],
|
38
|
-
id: `urn:uuid:${uuidv4()}`, // Generate a unique UUID
|
39
|
-
type: ['VerifiableCredential', 'LERRSCredential'], // LER-RS compliant credential type
|
35
|
+
'@context': ['https://www.w3.org/2018/credentials/v1', inlineResumeContext['@context']],
|
36
|
+
id: `urn:uuid:${uuidv4()}`,
|
37
|
+
type: ['VerifiableCredential', 'LERRSCredential'],
|
40
38
|
issuer: issuerDid,
|
41
|
-
issuanceDate: new Date().toISOString(),
|
39
|
+
issuanceDate: new Date().toISOString(),
|
42
40
|
credentialSubject: {
|
43
41
|
type: 'Resume',
|
44
42
|
person: {
|
@@ -68,8 +66,8 @@ export class ResumeVC {
|
|
68
66
|
narrative: {
|
69
67
|
text: formData.summary || '',
|
70
68
|
},
|
71
|
-
// Employment History
|
72
69
|
employmentHistory: formData.experience.items.map((exp) => ({
|
70
|
+
id: exp.id ? `urn:uuid${exp.id}` : `urn:uuid:${uuidv4()}`, // Ensure each entry has an ID
|
73
71
|
organization: {
|
74
72
|
tradeName: exp.company || '',
|
75
73
|
},
|
@@ -78,87 +76,52 @@ export class ResumeVC {
|
|
78
76
|
startDate: exp.startDate || '',
|
79
77
|
endDate: exp.endDate || '',
|
80
78
|
stillEmployed: exp.stillEmployed || false,
|
79
|
+
verificationStatus: exp.verificationStatus || 'unverified',
|
80
|
+
credentialLink: exp.credentialLink || null,
|
81
|
+
verifiedCredentials: exp.verifiedCredentials || [],
|
81
82
|
})),
|
82
|
-
// Duplicated Experience (Raw)
|
83
|
-
experience: formData.experience.items.map((exp) => ({
|
84
|
-
company: exp.company || '',
|
85
|
-
title: exp.title || '',
|
86
|
-
description: exp.description || '',
|
87
|
-
startDate: exp.startDate || '',
|
88
|
-
endDate: exp.endDate || '',
|
89
|
-
stillEmployed: exp.stillEmployed || false,
|
90
|
-
})),
|
91
|
-
// Skills
|
92
|
-
skills: formData.skills.items.map((skill) => ({
|
93
|
-
name: skill.name || '',
|
94
|
-
})),
|
95
|
-
// Education
|
96
83
|
educationAndLearning: formData.education.items.map((edu) => ({
|
84
|
+
id: edu.id ? `urn:uuid${edu.id}` : `urn:uuid:${uuidv4()}`,
|
97
85
|
institution: edu.institution || '',
|
98
86
|
degree: edu.degree || '',
|
99
87
|
fieldOfStudy: edu.fieldOfStudy || '',
|
100
88
|
startDate: edu.startDate || '',
|
101
89
|
endDate: edu.endDate || '',
|
90
|
+
verificationStatus: edu.verificationStatus || 'unverified',
|
91
|
+
credentialLink: edu.credentialLink || null,
|
92
|
+
verifiedCredentials: edu.verifiedCredentials || [],
|
102
93
|
})),
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
})),
|
110
|
-
// Publications
|
111
|
-
publications: formData.publications.items.map((pub) => ({
|
112
|
-
title: pub.title || '',
|
113
|
-
publisher: pub.publisher || '',
|
114
|
-
date: pub.date || '',
|
115
|
-
url: pub.url || '',
|
94
|
+
skills: formData.skills.items.map((skill) => ({
|
95
|
+
id: skill.id ? `urn:uuid${skill.id}` : `urn:uuid:${uuidv4()}`,
|
96
|
+
name: skill.name || '',
|
97
|
+
verificationStatus: skill.verificationStatus || 'unverified',
|
98
|
+
credentialLink: skill.credentialLink || null,
|
99
|
+
verifiedCredentials: skill.verifiedCredentials || [],
|
116
100
|
})),
|
117
|
-
// Certifications
|
118
101
|
certifications: formData.certifications.items.map((cert) => ({
|
102
|
+
id: cert.id ? `urn:uuid:${cert.id}` : `urn:uuid:${uuidv4()}`,
|
119
103
|
name: cert.name || '',
|
120
104
|
issuer: cert.issuer || '',
|
121
105
|
date: cert.date || '',
|
122
106
|
url: cert.url || '',
|
107
|
+
verificationStatus: cert.verificationStatus || 'unverified',
|
108
|
+
credentialLink: cert.credentialLink || null,
|
109
|
+
verifiedCredentials: cert.verifiedCredentials || [],
|
123
110
|
})),
|
124
|
-
// Professional Affiliations
|
125
|
-
professionalAffiliations: formData.professionalAffiliations.items.map((aff) => ({
|
126
|
-
organization: aff.organization || '',
|
127
|
-
role: aff.role || '',
|
128
|
-
startDate: aff.startDate || '',
|
129
|
-
endDate: aff.endDate || '',
|
130
|
-
})),
|
131
|
-
// Volunteer Work
|
132
|
-
volunteerWork: formData.volunteerWork.items.map((vol) => ({
|
133
|
-
organization: vol.organization || '',
|
134
|
-
role: vol.role || '',
|
135
|
-
description: vol.description || '',
|
136
|
-
startDate: vol.startDate || '',
|
137
|
-
endDate: vol.endDate || '',
|
138
|
-
})),
|
139
|
-
// Hobbies and Interests
|
140
|
-
hobbiesAndInterests: formData.hobbiesAndInterests || [],
|
141
|
-
// Languages
|
142
|
-
languages: formData.languages.items.map((lang) => ({
|
143
|
-
language: lang.language || '',
|
144
|
-
proficiency: lang.proficiency || '',
|
145
|
-
})),
|
146
|
-
// Testimonials
|
147
|
-
testimonials: formData.testimonials.items.map((testi) => ({
|
148
|
-
author: testi.author || '',
|
149
|
-
text: testi.text || '',
|
150
|
-
date: testi.date || '',
|
151
|
-
})),
|
152
|
-
// Projects
|
153
111
|
projects: formData.projects.items.map((proj) => ({
|
112
|
+
id: proj.id ? `urn:uuid${proj.id}` : `urn:uuid:${uuidv4()}`,
|
154
113
|
name: proj.name || '',
|
155
114
|
description: proj.description || '',
|
156
115
|
url: proj.url || '',
|
157
116
|
startDate: proj.startDate || '',
|
158
117
|
endDate: proj.endDate || '',
|
118
|
+
verificationStatus: proj.verificationStatus || 'unverified',
|
119
|
+
credentialLink: proj.credentialLink || null,
|
120
|
+
verifiedCredentials: proj.verifiedCredentials || [],
|
159
121
|
})),
|
160
122
|
},
|
161
123
|
};
|
124
|
+
console.log('🚀 ~ ResumeVC ~ generateUnsignedCredential ~ unsignedResumeVC:', JSON.stringify(unsignedResumeVC));
|
162
125
|
return unsignedResumeVC;
|
163
126
|
}
|
164
127
|
generateKeyPair = async (address) => {
|