mcard-js
Version:
A JavaScript implementation of MCard - A data model for persistently storing content with cryptographic hashing and timestamping
35 lines (29 loc) • 726 B
JavaScript
// Service for MCard storage operations
class McardStorageService {
constructor(engine) {
this.engine = engine;
}
async saveMcards(mcards) {
if (!this.engine) {
throw new Error('Storage engine not initialized');
}
try {
return await this.engine.saveMcards(mcards);
} catch (error) {
console.error('Error saving mcards:', error);
throw error;
}
}
async loadMcards() {
if (!this.engine) {
throw new Error('Storage engine not initialized');
}
try {
return await this.engine.loadMcards();
} catch (error) {
console.error('Error loading mcards:', error);
throw error;
}
}
}
export default McardStorageService;