Remove library files into crdt-meta.

This commit is contained in:
Spencer Ofwiti
2021-04-28 09:11:39 +00:00
parent e6d57d3bbb
commit 1bc29588a1
32 changed files with 133 additions and 1416 deletions

View File

@@ -3,10 +3,11 @@ const path = require('path');
const http = require('http');
const cic = require('cic-client-meta');
const crdt = require('crdt-meta');
//const conf = JSON.parse(fs.readFileSync('./cic.conf'));
const config = new cic.Config('./config');
const config = new crdt.Config('./config');
config.process();
console.log(config);
@@ -41,7 +42,7 @@ function sendit(uid, envelope) {
}
function doOne(keystore, filePath) {
const signer = new cic.PGPSigner(keystore);
const signer = new crdt.PGPSigner(keystore);
const parts = path.basename(filePath).split('.');
const ethereum_address = path.basename(parts[0]);
@@ -51,7 +52,7 @@ function doOne(keystore, filePath) {
//console.log(o);
fs.unlinkSync(filePath);
const s = new cic.Syncable(uid, o);
const s = new crdt.Syncable(uid, o);
s.setSigner(signer);
s.onwrap = (env) => {
sendit(uid, env);
@@ -65,7 +66,7 @@ const publicKeyPath = path.join(config.get('PGP_EXPORTS_DIR'), config.get('PGP_P
pk = fs.readFileSync(privateKeyPath);
pubk = fs.readFileSync(publicKeyPath);
new cic.PGPKeyStore(
new crdt.PGPKeyStore(
config.get('PGP_PASSPHRASE'),
pk,
pubk,

View File

@@ -4,10 +4,11 @@ const http = require('http');
const cic = require('cic-client-meta');
const vcfp = require('vcard-parser');
const crdt = require('crdt-meta');
//const conf = JSON.parse(fs.readFileSync('./cic.conf'));
const config = new cic.Config('./config');
const config = new crdt.Config('./config');
config.process();
console.log(config);
@@ -42,7 +43,7 @@ function sendit(uid, envelope) {
}
function doOne(keystore, filePath, address) {
const signer = new cic.PGPSigner(keystore);
const signer = new crdt.PGPSigner(keystore);
const j = JSON.parse(fs.readFileSync(filePath).toString());
const b = Buffer.from(j['vcard'], 'base64');
@@ -51,9 +52,8 @@ function doOne(keystore, filePath, address) {
const phone = o.tel[0].value;
cic.Phone.toKey(phone).then((uid) => {
const o = fs.readFileSync(filePath, 'utf-8');
const s = new cic.Syncable(uid, o);
const s = new crdt.Syncable(uid, address);
s.setSigner(signer);
s.onwrap = (env) => {
sendit(uid, env);
@@ -67,7 +67,7 @@ const publicKeyPath = path.join(config.get('PGP_EXPORTS_DIR'), config.get('PGP_P
pk = fs.readFileSync(privateKeyPath);
pubk = fs.readFileSync(publicKeyPath);
new cic.PGPKeyStore(
new crdt.PGPKeyStore(
config.get('PGP_PASSPHRASE'),
pk,
pubk,
@@ -123,7 +123,7 @@ function importMetaPhone(keystore) {
if (batchCount == batchSize) {
console.debug('reached batch size, breathing');
batchCount=0;
setTimeout(importMeta, batchDelay, keystore);
setTimeout(importMetaPhone, batchDelay, keystore);
return;
}
}