feat(security): integrate @push.rocks/smartsecret for keychain-based token storage
Connection tokens are now stored in OS keychain (or encrypted file fallback) instead of plaintext JSON. Existing plaintext tokens auto-migrate on first load.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { assertEquals, assertExists } from 'https://deno.land/std@0.208.0/assert/mod.ts';
|
||||
import { StorageManager } from '../ts/storage/index.ts';
|
||||
import * as smartsecret from '@push.rocks/smartsecret';
|
||||
|
||||
Deno.test('StorageManager memory: set and get', async () => {
|
||||
const sm = new StorageManager({ backend: 'memory' });
|
||||
@@ -114,7 +115,8 @@ Deno.test('StorageManager filesystem: list keys', async () => {
|
||||
Deno.test('ConnectionManager with StorageManager: create and load', async () => {
|
||||
const { ConnectionManager } = await import('../ts/classes/connectionmanager.ts');
|
||||
const sm = new StorageManager({ backend: 'memory' });
|
||||
const cm = new ConnectionManager(sm);
|
||||
const secret = new smartsecret.SmartSecret({ service: 'gitops-test' });
|
||||
const cm = new ConnectionManager(sm, secret);
|
||||
await cm.init();
|
||||
|
||||
// Create a connection
|
||||
@@ -129,7 +131,7 @@ Deno.test('ConnectionManager with StorageManager: create and load', async () =>
|
||||
assertEquals(stored.id, conn.id);
|
||||
|
||||
// Create a new ConnectionManager and verify it loads the connection
|
||||
const cm2 = new ConnectionManager(sm);
|
||||
const cm2 = new ConnectionManager(sm, secret);
|
||||
await cm2.init();
|
||||
const conns = cm2.getConnections();
|
||||
assertEquals(conns.length, 1);
|
||||
|
||||
Reference in New Issue
Block a user