@cooperation/vc-storage 1.0.31 → 1.0.32
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/CredentialEngine.js +1 -1
- package/dist/tests/email.test.js +2 -1
- package/dist/types/models/CredentialEngine.d.ts +1 -1
- package/dist/types/utils/decodedSeed.d.ts +1 -1
- package/dist/utils/decodedSeed.js +1 -2
- package/package.json +1 -1
- package/dist/tests/testEmailVC.js +0 -29
- package/dist/types/tests/testEmailVC.d.ts +0 -1
@@ -254,7 +254,7 @@ export class CredentialEngine {
|
|
254
254
|
}
|
255
255
|
// Use deterministic keys from environment seed
|
256
256
|
const { getDidFromEnvSeed } = await import('../utils/decodedSeed');
|
257
|
-
const result = await getDidFromEnvSeed();
|
257
|
+
const result = await getDidFromEnvSeed(encodedSeed);
|
258
258
|
keyPair = result.keyPair;
|
259
259
|
didDocument = result.didDocument;
|
260
260
|
console.log('Using DID from environment seed:', didDocument.id);
|
package/dist/tests/email.test.js
CHANGED
@@ -11,8 +11,9 @@ async function testEmailVC() {
|
|
11
11
|
const testEmail = 'test@example.com';
|
12
12
|
console.log('Starting email VC generation test...');
|
13
13
|
console.log('Test email:', testEmail);
|
14
|
+
const encodedSeed = 'your encoded seed'; // Replace with your actual encoded seed
|
14
15
|
// Generate and sign the email VC
|
15
|
-
const result = await engine.generateAndSignEmailVC(testEmail);
|
16
|
+
const result = await engine.generateAndSignEmailVC(testEmail, encodedSeed);
|
16
17
|
console.log('\nTest Results:');
|
17
18
|
console.log('-------------');
|
18
19
|
console.log('File ID:', result.fileId);
|
@@ -83,7 +83,7 @@ export declare class CredentialEngine {
|
|
83
83
|
* @param {string} email - The email address to create the VC for
|
84
84
|
* @returns {Promise<{signedVC: any, fileId: string}>} The signed VC and its Google Drive file ID
|
85
85
|
*/
|
86
|
-
generateAndSignEmailVC(email: string): Promise<{
|
86
|
+
generateAndSignEmailVC(email: string, encodedSeed: string): Promise<{
|
87
87
|
signedVC: any;
|
88
88
|
fileId: string;
|
89
89
|
}>;
|
@@ -26,9 +26,8 @@ export async function decodeSeed(encodedSeed) {
|
|
26
26
|
throw error;
|
27
27
|
}
|
28
28
|
}
|
29
|
-
export const getDidFromEnvSeed = async () => {
|
29
|
+
export const getDidFromEnvSeed = async (encodedSeed) => {
|
30
30
|
// Get seed from environment variable
|
31
|
-
const encodedSeed = process.env.SEED;
|
32
31
|
if (!encodedSeed) {
|
33
32
|
throw new Error('SEED environment variable not set');
|
34
33
|
}
|
package/package.json
CHANGED
@@ -1,29 +0,0 @@
|
|
1
|
-
import { CredentialEngine } from '../models/CredentialEngine.js';
|
2
|
-
import { GoogleDriveStorage } from '../models/GoogleDriveStorage.js';
|
3
|
-
async function testEmailVC() {
|
4
|
-
try {
|
5
|
-
// Initialize storage and engine
|
6
|
-
const storage = new GoogleDriveStorage('YOUR_ACCESS_TOKEN'); // Replace with actual access token
|
7
|
-
const engine = new CredentialEngine(storage);
|
8
|
-
// Test email
|
9
|
-
const testEmail = 'test@example.com';
|
10
|
-
console.log('Starting email VC generation test...');
|
11
|
-
console.log('Test email:', testEmail);
|
12
|
-
// Generate and sign the email VC
|
13
|
-
const result = await engine.generateAndSignEmailVC(testEmail);
|
14
|
-
console.log('\nTest Results:');
|
15
|
-
console.log('-------------');
|
16
|
-
console.log('File ID:', result.fileId);
|
17
|
-
console.log('Signed VC:', JSON.stringify(result.signedVC, null, 2));
|
18
|
-
// Test retrieving the VC from storage
|
19
|
-
console.log('\nRetrieving VC from storage...');
|
20
|
-
const retrievedVC = await storage.retrieve(result.fileId);
|
21
|
-
console.log('Retrieved VC:', retrievedVC ? 'Success' : 'Failed');
|
22
|
-
console.log('\nTest completed successfully!');
|
23
|
-
}
|
24
|
-
catch (error) {
|
25
|
-
console.error('Test failed:', error);
|
26
|
-
}
|
27
|
-
}
|
28
|
-
// Run the test
|
29
|
-
testEmailVC().catch(console.error);
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|