@cooperation/vc-storage 1.0.45 → 1.0.46
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/index.js +0 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/utils/context.d.ts +0 -18
- package/dist/utils/context.js +0 -19
- package/dist/utils/credential.js +16 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
package/dist/types/index.d.ts
CHANGED
|
@@ -148,12 +148,6 @@ export declare const volunteeringCredentialContext: {
|
|
|
148
148
|
evidenceDescription: string;
|
|
149
149
|
};
|
|
150
150
|
};
|
|
151
|
-
export declare const VC_V2_CONTEXT = "https://www.w3.org/ns/credentials/v2";
|
|
152
|
-
export declare const OB_V3_CONTEXT = "https://purl.imsglobal.org/spec/ob/v3p0/context-3.0.3.json";
|
|
153
|
-
export declare const HR_V1_CONTEXT = "https://w3id.org/hr/v1";
|
|
154
|
-
export declare const ED25519_2020_CONTEXT = "https://w3id.org/security/suites/ed25519-2020/v1";
|
|
155
|
-
/** @context array for SkillClaimCredential signing (single source of truth). */
|
|
156
|
-
export declare const skillClaimCredentialContexts: string[];
|
|
157
151
|
/** JSON-LD terms for RecommendationCredential (schema.org + VC v2). */
|
|
158
152
|
export declare const recommendationCredentialContext: {
|
|
159
153
|
'@context': {
|
|
@@ -166,18 +160,6 @@ export declare const recommendationCredentialContext: {
|
|
|
166
160
|
skillsEndorsed: string;
|
|
167
161
|
};
|
|
168
162
|
};
|
|
169
|
-
/** @context array for RecommendationCredential signing (single source of truth). */
|
|
170
|
-
export declare const recommendationCredentialContexts: (string | {
|
|
171
|
-
'@context': {
|
|
172
|
-
recipientName: string;
|
|
173
|
-
howKnow: string;
|
|
174
|
-
recommendationText: string;
|
|
175
|
-
qualifications: string;
|
|
176
|
-
explainAnswer: string;
|
|
177
|
-
portfolio: string;
|
|
178
|
-
skillsEndorsed: string;
|
|
179
|
-
};
|
|
180
|
-
})[];
|
|
181
163
|
export declare const performanceReviewCredentialContext: {
|
|
182
164
|
'@context': {
|
|
183
165
|
'@vocab': string;
|
package/dist/utils/context.js
CHANGED
|
@@ -166,17 +166,6 @@ export const volunteeringCredentialContext = {
|
|
|
166
166
|
evidenceDescription: 'https://schema.org/description'
|
|
167
167
|
}
|
|
168
168
|
};
|
|
169
|
-
export const VC_V2_CONTEXT = 'https://www.w3.org/ns/credentials/v2';
|
|
170
|
-
export const OB_V3_CONTEXT = 'https://purl.imsglobal.org/spec/ob/v3p0/context-3.0.3.json';
|
|
171
|
-
export const HR_V1_CONTEXT = 'https://w3id.org/hr/v1';
|
|
172
|
-
export const ED25519_2020_CONTEXT = 'https://w3id.org/security/suites/ed25519-2020/v1';
|
|
173
|
-
/** @context array for SkillClaimCredential signing (single source of truth). */
|
|
174
|
-
export const skillClaimCredentialContexts = [
|
|
175
|
-
VC_V2_CONTEXT,
|
|
176
|
-
OB_V3_CONTEXT,
|
|
177
|
-
HR_V1_CONTEXT,
|
|
178
|
-
ED25519_2020_CONTEXT,
|
|
179
|
-
];
|
|
180
169
|
/** JSON-LD terms for RecommendationCredential (schema.org + VC v2). */
|
|
181
170
|
export const recommendationCredentialContext = {
|
|
182
171
|
'@context': {
|
|
@@ -189,14 +178,6 @@ export const recommendationCredentialContext = {
|
|
|
189
178
|
skillsEndorsed: 'https://schema.org/skillsEndorsed',
|
|
190
179
|
},
|
|
191
180
|
};
|
|
192
|
-
/** @context array for RecommendationCredential signing (single source of truth). */
|
|
193
|
-
export const recommendationCredentialContexts = [
|
|
194
|
-
VC_V2_CONTEXT,
|
|
195
|
-
OB_V3_CONTEXT,
|
|
196
|
-
HR_V1_CONTEXT,
|
|
197
|
-
recommendationCredentialContext,
|
|
198
|
-
ED25519_2020_CONTEXT,
|
|
199
|
-
];
|
|
200
181
|
// 3. Performance Review Credential Context
|
|
201
182
|
export const performanceReviewCredentialContext = {
|
|
202
183
|
'@context': {
|
package/dist/utils/credential.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Ed25519VerificationKey2020 } from '@digitalcredentials/ed25519-verification-key-2020';
|
|
2
2
|
import { v4 as uuidv4 } from 'uuid';
|
|
3
3
|
import CryptoJS from 'crypto-js';
|
|
4
|
-
import { employmentCredentialContext, volunteeringCredentialContext, performanceReviewCredentialContext,
|
|
4
|
+
import { employmentCredentialContext, volunteeringCredentialContext, performanceReviewCredentialContext, recommendationCredentialContext, } from './context.js';
|
|
5
5
|
/**
|
|
6
6
|
* Utility function to generate a hashed ID for a credential.
|
|
7
7
|
* Excludes the `id` field when hashing.
|
|
@@ -128,7 +128,13 @@ export function generateUnsignedVC({ formData, issuerDid }) {
|
|
|
128
128
|
*/
|
|
129
129
|
export function generateUnsignedRecommendation({ vcId, recommendation, issuerDid, evidence = [], }) {
|
|
130
130
|
const unsignedRecommendation = {
|
|
131
|
-
'@context':
|
|
131
|
+
'@context': [
|
|
132
|
+
'https://www.w3.org/ns/credentials/v2',
|
|
133
|
+
'https://purl.imsglobal.org/spec/ob/v3p0/context-3.0.3.json',
|
|
134
|
+
'https://w3id.org/hr/v1',
|
|
135
|
+
recommendationCredentialContext,
|
|
136
|
+
'https://w3id.org/security/suites/ed25519-2020/v1',
|
|
137
|
+
],
|
|
132
138
|
id: `urn:uuid:${uuidv4()}`,
|
|
133
139
|
type: ['VerifiableCredential', 'https://schema.org/RecommendationCredential'],
|
|
134
140
|
issuer: { id: issuerDid, type: ['Profile'] },
|
|
@@ -264,7 +270,12 @@ export function generateUnsignedPerformanceReview({ formData, issuerDid }) {
|
|
|
264
270
|
*/
|
|
265
271
|
export function generateUnsignedSkillClaim({ formData, issuerDid, }) {
|
|
266
272
|
const unsignedCredential = {
|
|
267
|
-
'@context':
|
|
273
|
+
'@context': [
|
|
274
|
+
'https://www.w3.org/ns/credentials/v2',
|
|
275
|
+
'https://purl.imsglobal.org/spec/ob/v3p0/context-3.0.3.json',
|
|
276
|
+
'https://w3id.org/hr/v1',
|
|
277
|
+
'https://w3id.org/security/suites/ed25519-2020/v1',
|
|
278
|
+
],
|
|
268
279
|
id: `urn:uuid:${uuidv4()}`,
|
|
269
280
|
type: ['VerifiableCredential', 'SkillClaimCredential'],
|
|
270
281
|
issuer: issuerDid,
|
|
@@ -281,6 +292,8 @@ export function generateUnsignedSkillClaim({ formData, issuerDid, }) {
|
|
|
281
292
|
durationPerformed: s.durationPerformed,
|
|
282
293
|
narrative: s.narrative,
|
|
283
294
|
image: s.image,
|
|
295
|
+
source: s.source,
|
|
296
|
+
frameworkMatch: s.frameworkMatch,
|
|
284
297
|
})),
|
|
285
298
|
},
|
|
286
299
|
evidence: formData.evidence?.length ? formData.evidence.map((e) => ({
|