Fix depenndency import.

This commit is contained in:
Spencer Ofwiti 2021-04-15 11:12:20 +03:00
parent 2f8531c195
commit 395080340b
3 changed files with 14 additions and 14 deletions

View File

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

View File

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

View File

@ -29,9 +29,9 @@
} }
}, },
"@types/node": { "@types/node": {
"version": "14.14.37", "version": "14.14.39",
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.37.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.39.tgz",
"integrity": "sha512-XYmBiy+ohOR4Lh5jE379fV2IU+6Jn4g5qASinhitfyO71b/sCo6MKsMLF5tc7Zf2CE8hViVQyYSobJNke8OvUw==" "integrity": "sha512-Qipn7rfTxGEDqZiezH+wxqWYR8vcXq5LRpZrETD19Gs4o8LbklbmqotSUsMU+s5G3PJwMRDfNEYoxrcBwIxOuw=="
}, },
"@types/pbkdf2": { "@types/pbkdf2": {
"version": "3.1.0", "version": "3.1.0",