sharenet/frontend/test_spf_parsing.js
continuist dc050d5e34
Some checks failed
Podman Rootless Demo / test-backend (push) Has been skipped
Podman Rootless Demo / test-frontend (push) Has been skipped
Podman Rootless Demo / build-backend (push) Failing after 1s
Podman Rootless Demo / deploy-prod (push) Has been skipped
Podman Rootless Demo / build-frontend (push) Has been skipped
Add self-sovereign passports
2025-10-20 21:15:11 -04:00

25 lines
No EOL
802 B
JavaScript

const fs = require('fs');
const path = require('path');
// Read the SPF file
const spfPath = path.join(process.env.HOME, 'sharenet_passport_creator', 'Test.spf');
const spfData = fs.readFileSync(spfPath);
console.log('SPF file info:');
console.log(' Size:', spfData.length, 'bytes');
console.log(' First 32 bytes (hex):', spfData.slice(0, 32).toString('hex'));
// Try to parse as CBOR to see the structure
const cbor = require('cbor');
try {
const parsed = cbor.decode(spfData);
console.log('\nCBOR structure:');
console.log(JSON.stringify(parsed, null, 2));
} catch (error) {
console.log('\nFailed to parse as CBOR:', error.message);
// Try to see if it's a different format
console.log('\nFirst few bytes as text:');
console.log(spfData.slice(0, 100).toString());
}