Merge pull request 'bug: adding ccn instead of creating doesn't encrypt key' (#4) from bux-fix/adding-ccn-does-not-encrypt-key into master
Reviewed-on: #4
This commit is contained in:
commit
190e38dfc1
1 changed files with 6 additions and 1 deletions
7
index.ts
7
index.ts
|
@ -36,6 +36,7 @@ import {
|
||||||
isValidJSON,
|
isValidJSON,
|
||||||
parseATagQuery,
|
parseATagQuery,
|
||||||
} from './utils.ts';
|
} from './utils.ts';
|
||||||
|
import { encryptUint8Array, encryptionKey } from './utils/encryption.ts';
|
||||||
import { getEveFilePath } from './utils/files.ts';
|
import { getEveFilePath } from './utils/files.ts';
|
||||||
import { log, setupLogger } from './utils/logs.ts';
|
import { log, setupLogger } from './utils/logs.ts';
|
||||||
import { mixQuery, sql, sqlPartial } from './utils/queries.ts';
|
import { mixQuery, sql, sqlPartial } from './utils/queries.ts';
|
||||||
|
@ -973,7 +974,11 @@ async function handleAddCCN(
|
||||||
|
|
||||||
const ccnPublicKey = nostrTools.getPublicKey(privateKeyBytes);
|
const ccnPublicKey = nostrTools.getPublicKey(privateKeyBytes);
|
||||||
const ccnPrivPath = await getEveFilePath(`ccn_keys/${ccnPublicKey}`);
|
const ccnPrivPath = await getEveFilePath(`ccn_keys/${ccnPublicKey}`);
|
||||||
Deno.writeTextFileSync(ccnPrivPath, encodeBase64(privateKeyBytes));
|
const encryptedPrivateKey = encryptUint8Array(
|
||||||
|
privateKeyBytes,
|
||||||
|
encryptionKey,
|
||||||
|
);
|
||||||
|
Deno.writeTextFileSync(ccnPrivPath, encodeBase64(encryptedPrivateKey));
|
||||||
|
|
||||||
db.run('BEGIN TRANSACTION');
|
db.run('BEGIN TRANSACTION');
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue