@cooperation/vc-storage 1.0.23 → 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.
@@ -18,7 +18,8 @@ export class ResumeVC {
18
18
  suite,
19
19
  documentLoader: customDocumentLoader,
20
20
  });
21
- console.log('Signed VC:', signedVC);
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,31 +32,96 @@ export class ResumeVC {
31
32
  }
32
33
  generateUnsignedCredential({ formData, issuerDid }) {
33
34
  const unsignedResumeVC = {
34
- '@context': [
35
- 'https://www.w3.org/2018/credentials/v1',
36
- 'https://schema.hropenstandards.org/4.4/context.jsonld',
37
- inlineResumeContext['@context'], // Inline context
38
- ],
39
- id: `urn:uuid:${uuidv4()}`, // Generate a unique UUID
40
- 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'],
41
38
  issuer: issuerDid,
42
- issuanceDate: new Date().toISOString(), // Current date/time in ISO format
39
+ issuanceDate: new Date().toISOString(),
43
40
  credentialSubject: {
44
41
  type: 'Resume',
45
42
  person: {
46
43
  name: {
47
- formattedName: formData.formattedName || '',
44
+ formattedName: formData.name || '',
45
+ },
46
+ primaryLanguage: 'en',
47
+ contact: {
48
+ fullName: formData.contact.fullName || '',
49
+ email: formData.contact.email || '',
50
+ phone: formData.contact.phone || '',
51
+ location: {
52
+ street: formData.contact.location.street || '',
53
+ city: formData.contact.location.city || '',
54
+ state: formData.contact.location.state || '',
55
+ country: formData.contact.location.country || '',
56
+ postalCode: formData.contact.location.postalCode || '',
57
+ },
58
+ socialLinks: {
59
+ linkedin: formData.contact.socialLinks.linkedin || '',
60
+ github: formData.contact.socialLinks.github || '',
61
+ portfolio: formData.contact.socialLinks.portfolio || '',
62
+ twitter: formData.contact.socialLinks.twitter || '',
63
+ },
48
64
  },
49
- primaryLanguage: formData.primaryLanguage || 'en',
50
65
  },
51
66
  narrative: {
52
- text: formData.narrative || 'Narrative text goes here',
67
+ text: formData.summary || '',
53
68
  },
54
- employmentHistory: formData.employmentHistory || [],
55
- skills: formData.skills || [],
56
- educationAndLearning: formData.educationAndLearning || {},
69
+ employmentHistory: formData.experience.items.map((exp) => ({
70
+ id: exp.id ? `urn:uuid${exp.id}` : `urn:uuid:${uuidv4()}`, // Ensure each entry has an ID
71
+ organization: {
72
+ tradeName: exp.company || '',
73
+ },
74
+ title: exp.title || '',
75
+ description: exp.description || '',
76
+ startDate: exp.startDate || '',
77
+ endDate: exp.endDate || '',
78
+ stillEmployed: exp.stillEmployed || false,
79
+ verificationStatus: exp.verificationStatus || 'unverified',
80
+ credentialLink: exp.credentialLink || null,
81
+ verifiedCredentials: exp.verifiedCredentials || [],
82
+ })),
83
+ educationAndLearning: formData.education.items.map((edu) => ({
84
+ id: edu.id ? `urn:uuid${edu.id}` : `urn:uuid:${uuidv4()}`,
85
+ institution: edu.institution || '',
86
+ degree: edu.degree || '',
87
+ fieldOfStudy: edu.fieldOfStudy || '',
88
+ startDate: edu.startDate || '',
89
+ endDate: edu.endDate || '',
90
+ verificationStatus: edu.verificationStatus || 'unverified',
91
+ credentialLink: edu.credentialLink || null,
92
+ verifiedCredentials: edu.verifiedCredentials || [],
93
+ })),
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 || [],
100
+ })),
101
+ certifications: formData.certifications.items.map((cert) => ({
102
+ id: cert.id ? `urn:uuid:${cert.id}` : `urn:uuid:${uuidv4()}`,
103
+ name: cert.name || '',
104
+ issuer: cert.issuer || '',
105
+ date: cert.date || '',
106
+ url: cert.url || '',
107
+ verificationStatus: cert.verificationStatus || 'unverified',
108
+ credentialLink: cert.credentialLink || null,
109
+ verifiedCredentials: cert.verifiedCredentials || [],
110
+ })),
111
+ projects: formData.projects.items.map((proj) => ({
112
+ id: proj.id ? `urn:uuid${proj.id}` : `urn:uuid:${uuidv4()}`,
113
+ name: proj.name || '',
114
+ description: proj.description || '',
115
+ url: proj.url || '',
116
+ startDate: proj.startDate || '',
117
+ endDate: proj.endDate || '',
118
+ verificationStatus: proj.verificationStatus || 'unverified',
119
+ credentialLink: proj.credentialLink || null,
120
+ verifiedCredentials: proj.verifiedCredentials || [],
121
+ })),
57
122
  },
58
123
  };
124
+ console.log('🚀 ~ ResumeVC ~ generateUnsignedCredential ~ unsignedResumeVC:', JSON.stringify(unsignedResumeVC));
59
125
  return unsignedResumeVC;
60
126
  }
61
127
  generateKeyPair = async (address) => {
@@ -6,23 +6,97 @@ export declare const inlineResumeContext: {
6
6
  primaryLanguage: string;
7
7
  narrative: string;
8
8
  text: string;
9
+ contact: string;
10
+ email: string;
11
+ phone: string;
12
+ location: string;
13
+ street: string;
14
+ city: string;
15
+ state: string;
16
+ country: string;
17
+ postalCode: string;
18
+ socialLinks: {
19
+ '@id': string;
20
+ '@container': string;
21
+ };
22
+ linkedin: string;
23
+ github: string;
24
+ portfolio: string;
25
+ twitter: string;
26
+ experience: {
27
+ '@id': string;
28
+ '@container': string;
29
+ };
9
30
  employmentHistory: {
10
31
  '@id': string;
11
32
  '@container': string;
12
33
  };
13
34
  company: string;
14
35
  position: string;
36
+ description: string;
37
+ startDate: string;
38
+ endDate: string;
39
+ stillEmployed: string;
15
40
  duration: string;
16
41
  skills: {
17
42
  '@id': string;
18
43
  '@container': string;
19
44
  };
20
- educationAndLearning: string;
45
+ educationAndLearning: {
46
+ '@id': string;
47
+ '@container': string;
48
+ };
21
49
  degree: string;
50
+ fieldOfStudy: string;
22
51
  institution: string;
23
52
  year: string;
24
- issuanceDate: string;
53
+ awards: {
54
+ '@id': string;
55
+ '@container': string;
56
+ };
57
+ title: string;
25
58
  issuer: string;
59
+ date: string;
60
+ publications: {
61
+ '@id': string;
62
+ '@container': string;
63
+ };
64
+ publisher: string;
65
+ url: string;
66
+ certifications: {
67
+ '@id': string;
68
+ '@container': string;
69
+ };
70
+ professionalAffiliations: {
71
+ '@id': string;
72
+ '@container': string;
73
+ };
74
+ organization: string;
75
+ role: string;
76
+ volunteerWork: {
77
+ '@id': string;
78
+ '@container': string;
79
+ };
80
+ hobbiesAndInterests: {
81
+ '@id': string;
82
+ '@container': string;
83
+ };
84
+ languages: {
85
+ '@id': string;
86
+ '@container': string;
87
+ };
88
+ language: string;
89
+ proficiency: string;
90
+ testimonials: {
91
+ '@id': string;
92
+ '@container': string;
93
+ };
94
+ author: string;
95
+ projects: {
96
+ '@id': string;
97
+ '@container': string;
98
+ };
99
+ issuanceDate: string;
26
100
  credentialSubject: string;
27
101
  person: string;
28
102
  Resume: string;
@@ -1,31 +1,121 @@
1
1
  export const inlineResumeContext = {
2
2
  '@context': {
3
3
  '@vocab': 'https://schema.hropenstandards.org/4.4/',
4
+ // Basic details
4
5
  name: 'https://schema.org/name',
5
6
  formattedName: 'https://schema.org/formattedName',
6
7
  primaryLanguage: 'https://schema.org/primaryLanguage',
8
+ // Narrative
7
9
  narrative: 'https://schema.org/narrative',
8
10
  text: 'https://schema.org/text',
11
+ // Contact Information
12
+ contact: 'https://schema.org/ContactPoint',
13
+ email: 'https://schema.org/email',
14
+ phone: 'https://schema.org/telephone',
15
+ location: 'https://schema.org/address',
16
+ street: 'https://schema.org/streetAddress',
17
+ city: 'https://schema.org/addressLocality',
18
+ state: 'https://schema.org/addressRegion',
19
+ country: 'https://schema.org/addressCountry',
20
+ postalCode: 'https://schema.org/postalCode',
21
+ socialLinks: {
22
+ '@id': 'https://schema.org/URL',
23
+ '@container': '@set',
24
+ },
25
+ linkedin: 'https://schema.org/sameAs',
26
+ github: 'https://schema.org/sameAs',
27
+ portfolio: 'https://schema.org/url',
28
+ twitter: 'https://schema.org/sameAs',
29
+ // Experience & Employment History
30
+ experience: {
31
+ '@id': 'https://schema.org/WorkExperience',
32
+ '@container': '@list',
33
+ },
9
34
  employmentHistory: {
10
35
  '@id': 'https://schema.org/employmentHistory',
11
- '@container': '@list', // Specify list container
36
+ '@container': '@list',
12
37
  },
13
- company: 'https://schema.org/company',
38
+ company: 'https://schema.org/worksFor',
14
39
  position: 'https://schema.org/jobTitle',
40
+ description: 'https://schema.org/description',
41
+ startDate: 'https://schema.org/startDate',
42
+ endDate: 'https://schema.org/endDate',
43
+ stillEmployed: 'https://schema.org/Boolean',
15
44
  duration: 'https://schema.org/temporalCoverage',
45
+ // Skills
16
46
  skills: {
17
47
  '@id': 'https://schema.org/skills',
18
- '@container': '@list', // Specify list container
48
+ '@container': '@list',
19
49
  },
20
- educationAndLearning: 'https://schema.org/educationAndLearning',
21
- degree: 'https://schema.org/degree',
22
- institution: 'https://schema.org/institution',
50
+ // Education
51
+ educationAndLearning: {
52
+ '@id': 'https://schema.org/EducationalOccupationalProgram',
53
+ '@container': '@list',
54
+ },
55
+ degree: 'https://schema.org/educationalCredentialAwarded',
56
+ fieldOfStudy: 'https://schema.org/studyField',
57
+ institution: 'https://schema.org/educationalInstitution',
23
58
  year: 'https://schema.org/year',
24
- issuanceDate: 'https://schema.org/issuanceDate',
59
+ // Awards
60
+ awards: {
61
+ '@id': 'https://schema.org/Achievement',
62
+ '@container': '@list',
63
+ },
64
+ title: 'https://schema.org/name',
25
65
  issuer: 'https://schema.org/issuer',
66
+ date: 'https://schema.org/dateReceived',
67
+ // Publications
68
+ publications: {
69
+ '@id': 'https://schema.org/CreativeWork',
70
+ '@container': '@list',
71
+ },
72
+ publisher: 'https://schema.org/publisher',
73
+ url: 'https://schema.org/url',
74
+ // Certifications
75
+ certifications: {
76
+ '@id': 'https://schema.org/EducationalOccupationalCredential',
77
+ '@container': '@list',
78
+ },
79
+ // Professional Affiliations
80
+ professionalAffiliations: {
81
+ '@id': 'https://schema.org/OrganizationRole',
82
+ '@container': '@list',
83
+ },
84
+ organization: 'https://schema.org/memberOf',
85
+ role: 'https://schema.org/jobTitle',
86
+ // Volunteer Work
87
+ volunteerWork: {
88
+ '@id': 'https://schema.org/VolunteerRole',
89
+ '@container': '@list',
90
+ },
91
+ // Hobbies and Interests
92
+ hobbiesAndInterests: {
93
+ '@id': 'https://schema.org/knowsAbout',
94
+ '@container': '@set',
95
+ },
96
+ // Languages
97
+ languages: {
98
+ '@id': 'https://schema.org/knowsLanguage',
99
+ '@container': '@list',
100
+ },
101
+ language: 'https://schema.org/inLanguage',
102
+ proficiency: 'https://schema.org/proficiencyLevel',
103
+ // Testimonials
104
+ testimonials: {
105
+ '@id': 'https://schema.org/Review',
106
+ '@container': '@list',
107
+ },
108
+ author: 'https://schema.org/author',
109
+ // Projects
110
+ projects: {
111
+ '@id': 'https://schema.org/Project',
112
+ '@container': '@list',
113
+ },
114
+ // Issuance Information
115
+ issuanceDate: 'https://schema.org/issuanceDate',
26
116
  credentialSubject: 'https://schema.org/credentialSubject',
27
- person: 'https://schema.org/Person', // Added person
28
- Resume: 'https://schema.hropenstandards.org/4.4#Resume', // Map Resume to an absolute IRI
117
+ person: 'https://schema.org/Person', // Map to Person schema
118
+ Resume: 'https://schema.hropenstandards.org/4.4#Resume',
29
119
  },
30
120
  };
31
121
  let localOBContext = {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cooperation/vc-storage",
3
3
  "type": "module",
4
- "version": "1.0.23",
4
+ "version": "1.0.25",
5
5
  "description": "Sign and store your verifiable credentials.",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/types/index.d.ts",