1.0.2 • Published 8 months ago

@rattawitdev/shared-state v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

@rattawitdev/shared-state

A secure shared state management library with encryption support for web applications.

Features

  • Secure state management with AES encryption
  • TypeScript support
  • LocalStorage-based persistence
  • Event-based state updates
  • Sensitive data clearing

Installation

npm install @rattawitdev/shared-state

Usage

import { getState, updateState, subscribe, clearSensitiveData } from '@rattawitdev/shared-state';

// Get current state
const state = getState();

// Update state
updateState({
  user: {
    id: '123',
    name: 'John Doe'
  }
});

// Subscribe to state changes
const unsubscribe = subscribe((newState) => {
  console.log('State changed:', newState);
});

// Clear sensitive data
clearSensitiveData();

Configuration

Set the encryption key using the SHARED_STATE_ENCRYPTION_KEY environment variable:

export SHARED_STATE_ENCRYPTION_KEY=your-secure-key-here

Development

# Install dependencies
npm install

# Build the package
npm run build

# Run tests
npm test

License

MIT

1.0.2

8 months ago

1.0.1

8 months ago

1.0.0

8 months ago