@cooperation/vc-storage 1.0.33 → 1.0.40
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/README.md +1 -1
- package/app.config.js +1 -0
- package/dist/index.js +3 -1
- package/dist/models/CredentialEngine.js +35 -24
- package/dist/models/GoogleDriveStorage.js +121 -273
- package/dist/models/Resume.js +16 -4
- package/dist/models/WASStorage.js +71 -0
- package/dist/scripts/test-was.js +61 -0
- package/dist/types/index.d.ts +3 -1
- package/dist/types/models/CredentialEngine.d.ts +7 -4
- package/dist/types/models/GoogleDriveStorage.d.ts +31 -55
- package/dist/types/models/Resume.d.ts +3 -2
- package/dist/types/models/WASStorage.d.ts +30 -0
- package/dist/types/scripts/test-was.d.ts +1 -0
- package/dist/types/utils/context.d.ts +73 -0
- package/dist/types/utils/createWASSpace.d.ts +9 -0
- package/dist/types/utils/credential.d.ts +171 -1
- package/dist/types/utils/getOrCreateAppDID.d.ts +11 -0
- package/dist/types/utils/google.d.ts +1 -1
- package/dist/utils/context.js +76 -0
- package/dist/utils/createWASSpace.js +27 -0
- package/dist/utils/credential.js +96 -0
- package/dist/utils/getOrCreateAppDID.js +22 -0
- package/dist/utils/google.js +1 -1
- package/package.json +6 -3
- package/dist/types/utils/presentation.d.ts +0 -10
- package/dist/utils/presentation.js +0 -45
@@ -0,0 +1,71 @@
|
|
1
|
+
import { StorageClient } from '@wallet.storage/fetch-client';
|
2
|
+
import { WAS_BASE_URL } from '../../app.config.js';
|
3
|
+
export class LCWStorage {
|
4
|
+
static storageClient;
|
5
|
+
signer;
|
6
|
+
zcap;
|
7
|
+
spaceId;
|
8
|
+
constructor({ signer, zcap, spaceId }) {
|
9
|
+
this.signer = signer;
|
10
|
+
this.zcap = zcap;
|
11
|
+
this.spaceId = spaceId;
|
12
|
+
}
|
13
|
+
getStorageClient() {
|
14
|
+
if (!LCWStorage.storageClient) {
|
15
|
+
LCWStorage.storageClient = new StorageClient(new URL(WAS_BASE_URL));
|
16
|
+
}
|
17
|
+
return LCWStorage.storageClient;
|
18
|
+
}
|
19
|
+
getResource(key) {
|
20
|
+
const space = this.getStorageClient().space({
|
21
|
+
signer: this.signer,
|
22
|
+
id: this.spaceId,
|
23
|
+
});
|
24
|
+
return space.resource(key);
|
25
|
+
}
|
26
|
+
async add(key, value) {
|
27
|
+
const resource = this.getResource(key);
|
28
|
+
const blob = new Blob([JSON.stringify(value)], {
|
29
|
+
type: 'application/json',
|
30
|
+
});
|
31
|
+
const res = await resource.put(blob, {
|
32
|
+
signer: this.signer,
|
33
|
+
});
|
34
|
+
if (!res.ok) {
|
35
|
+
throw new Error(`Failed to add resource. Status: ${res.status}`);
|
36
|
+
}
|
37
|
+
return res;
|
38
|
+
}
|
39
|
+
async read(key) {
|
40
|
+
const resource = this.getResource(key);
|
41
|
+
const res = await resource.get({ signer: this.signer });
|
42
|
+
if (!res.ok) {
|
43
|
+
if (res.status === 404)
|
44
|
+
return null;
|
45
|
+
throw new Error(`Failed to read resource. Status: ${res.status}`);
|
46
|
+
}
|
47
|
+
return await res.json();
|
48
|
+
}
|
49
|
+
async update(key, value) {
|
50
|
+
return this.add(key, value); // Overwrite = update
|
51
|
+
}
|
52
|
+
async delete(key) {
|
53
|
+
const resource = this.getResource(key);
|
54
|
+
const res = await resource.delete({ signer: this.signer });
|
55
|
+
if (!res.ok && res.status !== 404) {
|
56
|
+
throw new Error(`Failed to delete resource. Status: ${res.status}`);
|
57
|
+
}
|
58
|
+
return true;
|
59
|
+
}
|
60
|
+
async list() {
|
61
|
+
// const space = this.getStorageClient().space({
|
62
|
+
// signer: this.signer,
|
63
|
+
// id: this.spaceId as `urn:uuid:${string}`,
|
64
|
+
// });
|
65
|
+
// const res = await space.resources().list({ signer: this.signer });
|
66
|
+
// if (!res.ok) {
|
67
|
+
// throw new Error(`Failed to list resources. Status: ${res.status}`);
|
68
|
+
// }
|
69
|
+
// return await res.json(); // Should contain list of resource IDs or summaries
|
70
|
+
}
|
71
|
+
}
|
@@ -0,0 +1,61 @@
|
|
1
|
+
import { Ed25519Signer } from '@did.coop/did-key-ed25519';
|
2
|
+
import { v4 as uuidv4 } from 'uuid';
|
3
|
+
import { LCWStorage } from '../models/WASStorage.js';
|
4
|
+
import { StorageClient } from '@wallet.storage/fetch-client';
|
5
|
+
import { WAS_BASE_URL } from '../../app.config.js';
|
6
|
+
async function main() {
|
7
|
+
const appDidSigner = await Ed25519Signer.generate();
|
8
|
+
console.log('Signer:', appDidSigner);
|
9
|
+
const spaceUUID = uuidv4();
|
10
|
+
const spaceId = `urn:uuid:${spaceUUID}`;
|
11
|
+
console.log('Space ID:', spaceId);
|
12
|
+
const storage = new StorageClient(new URL(WAS_BASE_URL));
|
13
|
+
const space = storage.space({
|
14
|
+
signer: appDidSigner,
|
15
|
+
id: spaceId,
|
16
|
+
});
|
17
|
+
const spaceObject = {
|
18
|
+
id: spaceId,
|
19
|
+
controller: appDidSigner.id.split('#')[0],
|
20
|
+
};
|
21
|
+
console.log('Creating space with object:', spaceObject);
|
22
|
+
const spaceObjectBlob = new Blob([JSON.stringify(spaceObject)], { type: 'application/json' });
|
23
|
+
// Create the space
|
24
|
+
const response = await space.put(spaceObjectBlob, {
|
25
|
+
signer: appDidSigner,
|
26
|
+
});
|
27
|
+
console.log('🚀 ~ main ~ response:', response);
|
28
|
+
console.log('Space PUT response:', {
|
29
|
+
status: response.status,
|
30
|
+
ok: response.ok,
|
31
|
+
});
|
32
|
+
if (!response.ok) {
|
33
|
+
throw new Error(`Failed to initialize space. Status: ${response.status}`);
|
34
|
+
}
|
35
|
+
// Store the signer for future connections
|
36
|
+
const signerJson = await appDidSigner.toJSON();
|
37
|
+
console.log('Signer JSON:', signerJson);
|
38
|
+
const lcwStorage = new LCWStorage({ signer: appDidSigner, zcap: {}, spaceId });
|
39
|
+
const res = await lcwStorage.add('test', { test: 'test' });
|
40
|
+
if (res.ok) {
|
41
|
+
console.log('Record added successfully');
|
42
|
+
}
|
43
|
+
else {
|
44
|
+
console.error('Failed to add record');
|
45
|
+
}
|
46
|
+
const res2 = await lcwStorage.read('test');
|
47
|
+
if (res2) {
|
48
|
+
console.log('Record read successfully');
|
49
|
+
}
|
50
|
+
else {
|
51
|
+
console.error('Failed to read record');
|
52
|
+
}
|
53
|
+
const res3 = await lcwStorage.update('test', { test: 'test2' });
|
54
|
+
if (res3.ok) {
|
55
|
+
console.log('Record updated successfully');
|
56
|
+
}
|
57
|
+
else {
|
58
|
+
console.error('Failed to update record');
|
59
|
+
}
|
60
|
+
}
|
61
|
+
main();
|
package/dist/types/index.d.ts
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
export * from './models/GoogleDriveStorage.js';
|
2
2
|
export * from './models/CredentialEngine.js';
|
3
3
|
export * from './utils/google.js';
|
4
|
-
export * from './utils/presentation.js';
|
5
4
|
export * from './models/Resume.js';
|
6
5
|
export * from './models/ResumeVC.js';
|
6
|
+
export * from './models/WASStorage.js';
|
7
|
+
export * from './utils/createWASSpace.js';
|
8
|
+
export * from './utils/getOrCreateAppDID.js';
|
@@ -1,8 +1,8 @@
|
|
1
|
-
import { DidDocument, KeyPair, FormDataI, RecommendationFormDataI, VerifiableCredential } from '../../types/credential.js';
|
1
|
+
import { DidDocument, KeyPair, FormDataI, RecommendationFormDataI, VerifiableCredential, EmploymentFormDataI, PerformanceReviewFormDataI, VolunteeringFormDataI } from '../../types/credential.js';
|
2
2
|
import { GoogleDriveStorage } from './GoogleDriveStorage.js';
|
3
3
|
interface SignPropsI {
|
4
|
-
data: FormDataI | RecommendationFormDataI;
|
5
|
-
type: 'VC' | 'RECOMMENDATION';
|
4
|
+
data: FormDataI | RecommendationFormDataI | EmploymentFormDataI | VolunteeringFormDataI | PerformanceReviewFormDataI;
|
5
|
+
type: 'VC' | 'RECOMMENDATION' | 'EMPLOYMENT' | 'VOLUNTEERING' | 'PERFORMANCE_REVIEW';
|
6
6
|
keyPair: KeyPair;
|
7
7
|
issuerId: string;
|
8
8
|
vcFileId?: string;
|
@@ -50,7 +50,7 @@ export declare class CredentialEngine {
|
|
50
50
|
}>;
|
51
51
|
/**
|
52
52
|
* Sign a Verifiable Credential (VC)
|
53
|
-
* @param {'VC' | 'RECOMMENDATION'} type - The signature type.
|
53
|
+
* @param {'VC' | 'RECOMMENDATION' | 'EMPLOYMENT' | 'VOLUNTEERING' | 'PERFORMANCE_REVIEW'} type - The signature type.
|
54
54
|
* @param {string} issuerId - The ID of the issuer [currently we put it as the did id]
|
55
55
|
* @param {KeyPair} keyPair - The key pair to use for signing.
|
56
56
|
* @param {FormDataI | RecommendationFormDataI} formData - The form data to include in the VC.
|
@@ -59,6 +59,9 @@ export declare class CredentialEngine {
|
|
59
59
|
* @throws Will throw an error if VC signing fails.
|
60
60
|
*/
|
61
61
|
signVC({ data, type, keyPair, issuerId, vcFileId }: SignPropsI): Promise<any>;
|
62
|
+
signEmploymentCredential(data: EmploymentFormDataI, keyPair: KeyPair, issuerId: string): Promise<any>;
|
63
|
+
signVolunteeringCredential(data: VolunteeringFormDataI, keyPair: KeyPair, issuerId: string): Promise<any>;
|
64
|
+
signPerformanceReviewCredential(data: PerformanceReviewFormDataI, keyPair: KeyPair, issuerId: string): Promise<any>;
|
62
65
|
/**
|
63
66
|
* Verify a Verifiable Credential (VC)
|
64
67
|
* @param {object} credential - The Verifiable Credential to verify.
|
@@ -3,70 +3,64 @@ type FileType = 'KEYPAIRs' | 'VCs' | 'SESSIONs' | 'DIDs' | 'RECOMMENDATIONs' | '
|
|
3
3
|
* @class GoogleDriveStorage
|
4
4
|
* @description Class to interact with Google Drive API
|
5
5
|
* @param accessToken - Access token to authenticate with Google Drive API
|
6
|
-
* @method
|
7
|
-
* @method save - Save data to Google Drive
|
8
|
-
* @method addCommentToFile - Add a comment to a file in Google Drive
|
9
|
-
* @method addCommenterRoleToFile - Add commenter role to a file in Google Drive
|
6
|
+
* @method saveFile - Save a file to Google Drive
|
10
7
|
* @method retrieve - Retrieve a file from Google Drive
|
11
|
-
* @method
|
12
|
-
* @method
|
13
|
-
* @method
|
14
|
-
* @method
|
8
|
+
* @method createFolder - Create a new folder in Google Drive
|
9
|
+
* @method getOrCreateMediaFolder - Get the ID of the MEDIAs folder
|
10
|
+
* @method uploadBinaryFile - Upload a binary file to Google Drive
|
11
|
+
* @method updateFileData - Update the data of a file
|
12
|
+
* @method updateRelationsFile - Update the relations file
|
15
13
|
* @method delete - Delete a file from Google Drive
|
14
|
+
* @method checkEmailExists - Check if an email VC exists and return its content
|
15
|
+
* @method findFolders - Find folders in Google Drive
|
16
|
+
* @method findFolderFiles - Find files in a folder
|
16
17
|
*/
|
17
18
|
export declare class GoogleDriveStorage {
|
18
19
|
private accessToken;
|
19
|
-
folderCache: any;
|
20
|
-
private fileIdsCache;
|
21
|
-
private updateFileIdsJson;
|
20
|
+
static folderCache: any;
|
21
|
+
private static fileIdsCache;
|
22
22
|
constructor(accessToken: string);
|
23
|
+
private updateFileIdsJson;
|
23
24
|
private fetcher;
|
24
25
|
private getFileContent;
|
25
26
|
private searchFiles;
|
27
|
+
private getOrCreateMediaFolder;
|
28
|
+
findFolderFiles(folderId: string): Promise<any[]>;
|
26
29
|
createFolder({ folderName, parentFolderId }: {
|
27
30
|
folderName: string;
|
28
31
|
parentFolderId: string;
|
29
32
|
}): Promise<any>;
|
30
|
-
|
33
|
+
/**
|
34
|
+
* Get the ID of the MEDIAs folder (public wrapper for getOrCreateMediaFolder)
|
35
|
+
* @returns The folder ID for the MEDIAs folder
|
36
|
+
*/
|
37
|
+
getMediaFolderId(): Promise<string>;
|
31
38
|
uploadBinaryFile({ file }: {
|
32
39
|
file: File;
|
33
40
|
}): Promise<any>;
|
34
|
-
saveFile({ data, folderId }: {
|
41
|
+
saveFile({ data, folderId, fileId }: {
|
35
42
|
data: any;
|
36
|
-
folderId
|
43
|
+
folderId?: string;
|
44
|
+
fileId?: string;
|
37
45
|
}): Promise<any>;
|
38
|
-
/**
|
39
|
-
* Get file from google drive by id
|
40
|
-
* @param id
|
41
|
-
* @returns file content
|
42
|
-
*/
|
43
46
|
retrieve(id: string): Promise<{
|
44
47
|
data: any;
|
45
48
|
id: string;
|
46
49
|
} | null>;
|
47
|
-
/**
|
48
|
-
* Get folder by folderId, if folderId == null you will have them all
|
49
|
-
* @param folderId [Optional]
|
50
|
-
* @returns
|
51
|
-
*/
|
52
50
|
findFolders(folderId?: string): Promise<any[]>;
|
53
|
-
/**
|
54
|
-
* Get all files content for the specified type ('KEYPAIRs' | 'VCs' | 'SESSIONs' | 'DIDs' | 'RECOMMENDATIONs')
|
55
|
-
* @param type
|
56
|
-
* @returns
|
57
|
-
*/
|
58
51
|
getAllFilesByType(type: FileType): Promise<any[]>;
|
52
|
+
updateFileData(fileId: string, data: {
|
53
|
+
fileName: string;
|
54
|
+
}): Promise<any>;
|
59
55
|
/**
|
60
|
-
* Update the
|
56
|
+
* Update the content of an existing file in Google Drive
|
61
57
|
* @param fileId - The ID of the file to update
|
62
|
-
* @param
|
63
|
-
* @returns The updated file metadata
|
58
|
+
* @param data - The new content for the file
|
59
|
+
* @returns The updated file metadata
|
64
60
|
*/
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
updateFileData(fileId: string, data: {
|
69
|
-
fileName: string;
|
61
|
+
updateFileContent({ fileId, data }: {
|
62
|
+
fileId: string;
|
63
|
+
data: any;
|
70
64
|
}): Promise<any>;
|
71
65
|
getFileParents(fileId: string): Promise<any>;
|
72
66
|
updateRelationsFile({ relationsFileId, recommendationFileId }: {
|
@@ -76,25 +70,7 @@ export declare class GoogleDriveStorage {
|
|
76
70
|
createRelationsFile({ vcFolderId }: {
|
77
71
|
vcFolderId: string;
|
78
72
|
}): Promise<any>;
|
79
|
-
updateResumeRelation({ authorFolderId, draftFileId, signedFileId, }: {
|
80
|
-
authorFolderId: string;
|
81
|
-
draftFileId: string;
|
82
|
-
signedFileId: string;
|
83
|
-
}): Promise<any>;
|
84
|
-
/**
|
85
|
-
* Delete file by id
|
86
|
-
* @param id
|
87
|
-
* @returns
|
88
|
-
*/
|
89
73
|
delete(id: string): Promise<any>;
|
90
|
-
update(fileId: string, data: any): Promise<any>;
|
91
|
-
getFileIdsFromAppDataFolder(): Promise<any>;
|
92
|
-
getAllFilesData(): Promise<any>;
|
93
|
-
/**
|
94
|
-
* Check if an email VC exists and return its content
|
95
|
-
* @param email - The email address to check
|
96
|
-
* @returns {Promise<{data: any, id: string} | null>} - The email VC content and ID if exists, null otherwise
|
97
|
-
*/
|
98
74
|
checkEmailExists(email: string): Promise<{
|
99
75
|
data: any;
|
100
76
|
id: string;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { GoogleDriveStorage } from './GoogleDriveStorage
|
1
|
+
import { GoogleDriveStorage } from './GoogleDriveStorage';
|
2
2
|
export declare const resumeFolderTypes: {
|
3
3
|
root: string;
|
4
4
|
nonSigned: string;
|
@@ -14,9 +14,10 @@ export declare class StorageHandler {
|
|
14
14
|
}
|
15
15
|
export declare class Resume extends StorageHandler {
|
16
16
|
constructor(storage: GoogleDriveStorage);
|
17
|
-
saveResume({ resume, type }: {
|
17
|
+
saveResume({ resume, type, id }: {
|
18
18
|
resume: any;
|
19
19
|
type: 'sign' | 'unsigned';
|
20
|
+
id?: string;
|
20
21
|
}): Promise<any>;
|
21
22
|
find(): Promise<{
|
22
23
|
signed: any[];
|
@@ -0,0 +1,30 @@
|
|
1
|
+
export declare class LCWStorage {
|
2
|
+
private static storageClient;
|
3
|
+
private signer;
|
4
|
+
private zcap;
|
5
|
+
private spaceId;
|
6
|
+
constructor({ signer, zcap, spaceId }: {
|
7
|
+
signer: any;
|
8
|
+
zcap: any;
|
9
|
+
spaceId: string;
|
10
|
+
});
|
11
|
+
private getStorageClient;
|
12
|
+
private getResource;
|
13
|
+
add(key: string, value: any): Promise<{
|
14
|
+
ok: boolean;
|
15
|
+
headers: [string, string][];
|
16
|
+
status: number;
|
17
|
+
blob(): Promise<import("buffer").Blob>;
|
18
|
+
json(): Promise<unknown>;
|
19
|
+
}>;
|
20
|
+
read(key: string): Promise<unknown>;
|
21
|
+
update(key: string, value: any): Promise<{
|
22
|
+
ok: boolean;
|
23
|
+
headers: [string, string][];
|
24
|
+
status: number;
|
25
|
+
blob(): Promise<import("buffer").Blob>;
|
26
|
+
json(): Promise<unknown>;
|
27
|
+
}>;
|
28
|
+
delete(key: string): Promise<boolean>;
|
29
|
+
list(): Promise<void>;
|
30
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export {};
|
@@ -104,6 +104,79 @@ export declare const inlineResumeContext: {
|
|
104
104
|
Resume: string;
|
105
105
|
};
|
106
106
|
};
|
107
|
+
export declare const employmentCredentialContext: {
|
108
|
+
'@context': {
|
109
|
+
'@vocab': string;
|
110
|
+
fullName: string;
|
111
|
+
persons: string;
|
112
|
+
credentialName: string;
|
113
|
+
credentialDuration: string;
|
114
|
+
credentialDescription: string;
|
115
|
+
portfolio: {
|
116
|
+
'@id': string;
|
117
|
+
'@container': string;
|
118
|
+
};
|
119
|
+
name: string;
|
120
|
+
url: string;
|
121
|
+
evidenceLink: string;
|
122
|
+
evidenceDescription: string;
|
123
|
+
company: string;
|
124
|
+
role: string;
|
125
|
+
};
|
126
|
+
};
|
127
|
+
export declare const volunteeringCredentialContext: {
|
128
|
+
'@context': {
|
129
|
+
'@vocab': string;
|
130
|
+
fullName: string;
|
131
|
+
persons: string;
|
132
|
+
volunteerWork: string;
|
133
|
+
volunteerOrg: string;
|
134
|
+
volunteerDescription: string;
|
135
|
+
skillsGained: {
|
136
|
+
'@id': string;
|
137
|
+
'@container': string;
|
138
|
+
};
|
139
|
+
duration: string;
|
140
|
+
volunteerDates: string;
|
141
|
+
portfolio: {
|
142
|
+
'@id': string;
|
143
|
+
'@container': string;
|
144
|
+
};
|
145
|
+
name: string;
|
146
|
+
url: string;
|
147
|
+
evidenceLink: string;
|
148
|
+
evidenceDescription: string;
|
149
|
+
};
|
150
|
+
};
|
151
|
+
export declare const performanceReviewCredentialContext: {
|
152
|
+
'@context': {
|
153
|
+
'@vocab': string;
|
154
|
+
fullName: string;
|
155
|
+
persons: string;
|
156
|
+
employeeName: string;
|
157
|
+
employeeJobTitle: string;
|
158
|
+
company: string;
|
159
|
+
role: string;
|
160
|
+
reviewStartDate: string;
|
161
|
+
reviewEndDate: string;
|
162
|
+
reviewDuration: string;
|
163
|
+
jobKnowledgeRating: string;
|
164
|
+
teamworkRating: string;
|
165
|
+
initiativeRating: string;
|
166
|
+
communicationRating: string;
|
167
|
+
overallRating: string;
|
168
|
+
reviewComments: string;
|
169
|
+
goalsNext: string;
|
170
|
+
portfolio: {
|
171
|
+
'@id': string;
|
172
|
+
'@container': string;
|
173
|
+
};
|
174
|
+
name: string;
|
175
|
+
url: string;
|
176
|
+
evidenceLink: string;
|
177
|
+
evidenceDescription: string;
|
178
|
+
};
|
179
|
+
};
|
107
180
|
declare const localOBContext: {
|
108
181
|
'@context': {
|
109
182
|
'@protected': boolean;
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { Ed25519Signer } from '@did.coop/did-key-ed25519';
|
2
|
+
/**
|
3
|
+
* Create a new WAS space
|
4
|
+
* @returns {Promise<{ signer: InstanceType<typeof Ed25519Signer>; spaceId: `urn:uuid:${string}` }>}
|
5
|
+
*/
|
6
|
+
export declare function createSpace(): Promise<{
|
7
|
+
signer: InstanceType<typeof Ed25519Signer>;
|
8
|
+
spaceId: `urn:uuid:${string}`;
|
9
|
+
}>;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { KeyPair, DidDocument, FormDataI, RecommendationCredential, Credential, RecommendationFormDataI, VerifiableCredential } from '../../types
|
1
|
+
import { KeyPair, DidDocument, FormDataI, RecommendationCredential, Credential, RecommendationFormDataI, VerifiableCredential, EmploymentFormDataI, VolunteeringFormDataI, PerformanceReviewFormDataI } from '../../types';
|
2
2
|
/**
|
3
3
|
* Create a DID document using the provided key pair.
|
4
4
|
* @param {KeyPair} keyPair - The key pair used to create the DID document.
|
@@ -34,6 +34,176 @@ export declare function generateUnsignedRecommendation({ vcId, recommendation, i
|
|
34
34
|
recommendation: RecommendationFormDataI;
|
35
35
|
issuerDid: string;
|
36
36
|
}): RecommendationCredential;
|
37
|
+
/**
|
38
|
+
* Generate an unsigned Employment Credential.
|
39
|
+
*/
|
40
|
+
export declare function generateUnsignedEmployment({ formData, issuerDid }: {
|
41
|
+
formData: EmploymentFormDataI;
|
42
|
+
issuerDid: string;
|
43
|
+
}): {
|
44
|
+
'@context': (string | {
|
45
|
+
'@vocab': string;
|
46
|
+
fullName: string;
|
47
|
+
persons: string;
|
48
|
+
credentialName: string;
|
49
|
+
credentialDuration: string;
|
50
|
+
credentialDescription: string;
|
51
|
+
portfolio: {
|
52
|
+
'@id': string;
|
53
|
+
'@container': string;
|
54
|
+
};
|
55
|
+
name: string;
|
56
|
+
url: string;
|
57
|
+
evidenceLink: string;
|
58
|
+
evidenceDescription: string;
|
59
|
+
company: string;
|
60
|
+
role: string;
|
61
|
+
})[];
|
62
|
+
id: string;
|
63
|
+
type: string[];
|
64
|
+
issuer: {
|
65
|
+
id: string;
|
66
|
+
type: string[];
|
67
|
+
};
|
68
|
+
issuanceDate: string;
|
69
|
+
credentialSubject: {
|
70
|
+
type: string[];
|
71
|
+
fullName: string;
|
72
|
+
persons: string;
|
73
|
+
credentialName: string;
|
74
|
+
credentialDuration: string;
|
75
|
+
credentialDescription: string;
|
76
|
+
portfolio: {
|
77
|
+
name: string;
|
78
|
+
url: string;
|
79
|
+
}[];
|
80
|
+
evidenceLink: string;
|
81
|
+
evidenceDescription: string;
|
82
|
+
company: string;
|
83
|
+
role: string;
|
84
|
+
};
|
85
|
+
};
|
86
|
+
/**
|
87
|
+
* Generate an unsigned Volunteering Credential.
|
88
|
+
*/
|
89
|
+
export declare function generateUnsignedVolunteering({ formData, issuerDid }: {
|
90
|
+
formData: VolunteeringFormDataI;
|
91
|
+
issuerDid: string;
|
92
|
+
}): {
|
93
|
+
'@context': (string | {
|
94
|
+
'@vocab': string;
|
95
|
+
fullName: string;
|
96
|
+
persons: string;
|
97
|
+
volunteerWork: string;
|
98
|
+
volunteerOrg: string;
|
99
|
+
volunteerDescription: string;
|
100
|
+
skillsGained: {
|
101
|
+
'@id': string;
|
102
|
+
'@container': string;
|
103
|
+
};
|
104
|
+
duration: string;
|
105
|
+
volunteerDates: string;
|
106
|
+
portfolio: {
|
107
|
+
'@id': string;
|
108
|
+
'@container': string;
|
109
|
+
};
|
110
|
+
name: string;
|
111
|
+
url: string;
|
112
|
+
evidenceLink: string;
|
113
|
+
evidenceDescription: string;
|
114
|
+
})[];
|
115
|
+
id: string;
|
116
|
+
type: string[];
|
117
|
+
issuer: {
|
118
|
+
id: string;
|
119
|
+
type: string[];
|
120
|
+
};
|
121
|
+
issuanceDate: string;
|
122
|
+
credentialSubject: {
|
123
|
+
type: string[];
|
124
|
+
fullName: string;
|
125
|
+
persons: string;
|
126
|
+
volunteerWork: string;
|
127
|
+
volunteerOrg: string;
|
128
|
+
volunteerDescription: string;
|
129
|
+
skillsGained: string[];
|
130
|
+
duration: string;
|
131
|
+
volunteerDates: string;
|
132
|
+
portfolio: {
|
133
|
+
name: string;
|
134
|
+
url: string;
|
135
|
+
}[];
|
136
|
+
evidenceLink: string;
|
137
|
+
evidenceDescription: string;
|
138
|
+
};
|
139
|
+
};
|
140
|
+
/**
|
141
|
+
* Generate an unsigned Performance Review Credential.
|
142
|
+
*/
|
143
|
+
export declare function generateUnsignedPerformanceReview({ formData, issuerDid }: {
|
144
|
+
formData: PerformanceReviewFormDataI;
|
145
|
+
issuerDid: string;
|
146
|
+
}): {
|
147
|
+
'@context': (string | {
|
148
|
+
'@vocab': string;
|
149
|
+
fullName: string;
|
150
|
+
persons: string;
|
151
|
+
employeeName: string;
|
152
|
+
employeeJobTitle: string;
|
153
|
+
company: string;
|
154
|
+
role: string;
|
155
|
+
reviewStartDate: string;
|
156
|
+
reviewEndDate: string;
|
157
|
+
reviewDuration: string;
|
158
|
+
jobKnowledgeRating: string;
|
159
|
+
teamworkRating: string;
|
160
|
+
initiativeRating: string;
|
161
|
+
communicationRating: string;
|
162
|
+
overallRating: string;
|
163
|
+
reviewComments: string;
|
164
|
+
goalsNext: string;
|
165
|
+
portfolio: {
|
166
|
+
'@id': string;
|
167
|
+
'@container': string;
|
168
|
+
};
|
169
|
+
name: string;
|
170
|
+
url: string;
|
171
|
+
evidenceLink: string;
|
172
|
+
evidenceDescription: string;
|
173
|
+
})[];
|
174
|
+
id: string;
|
175
|
+
type: string[];
|
176
|
+
issuer: {
|
177
|
+
id: string;
|
178
|
+
type: string[];
|
179
|
+
};
|
180
|
+
issuanceDate: string;
|
181
|
+
credentialSubject: {
|
182
|
+
type: string[];
|
183
|
+
fullName: string;
|
184
|
+
persons: string;
|
185
|
+
employeeName: string;
|
186
|
+
employeeJobTitle: string;
|
187
|
+
company: string;
|
188
|
+
role: string;
|
189
|
+
reviewStartDate: string;
|
190
|
+
reviewEndDate: string;
|
191
|
+
reviewDuration: string;
|
192
|
+
jobKnowledgeRating: string;
|
193
|
+
teamworkRating: string;
|
194
|
+
initiativeRating: string;
|
195
|
+
communicationRating: string;
|
196
|
+
overallRating: string;
|
197
|
+
reviewComments: string;
|
198
|
+
goalsNext: string;
|
199
|
+
portfolio: {
|
200
|
+
name: string;
|
201
|
+
url: string;
|
202
|
+
}[];
|
203
|
+
evidenceLink: string;
|
204
|
+
evidenceDescription: string;
|
205
|
+
};
|
206
|
+
};
|
37
207
|
/**
|
38
208
|
* Extracts the keypair from a Verifiable Credential
|
39
209
|
* @param {Object} credential - The signed Verifiable Credential
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { Ed25519VerificationKey2020 } from '@digitalbazaar/ed25519-verification-key-2020';
|
2
|
+
export interface AppInstanceKeyPair {
|
3
|
+
controller: string;
|
4
|
+
id: string;
|
5
|
+
publicKeyMultibase: string;
|
6
|
+
privateKeyMultibase: string;
|
7
|
+
}
|
8
|
+
export declare function getOrCreateAppInstanceDid(): Promise<{
|
9
|
+
did: string;
|
10
|
+
keyPair: Ed25519VerificationKey2020;
|
11
|
+
}>;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { GoogleDriveStorage } from '../models/GoogleDriveStorage
|
1
|
+
import { GoogleDriveStorage } from '../models/GoogleDriveStorage';
|
2
2
|
export type FileType = 'VC' | 'DID' | 'SESSION' | 'RECOMMENDATION' | 'KEYPAIR';
|
3
3
|
interface SaveToGooglePropsI {
|
4
4
|
storage: GoogleDriveStorage;
|