mirror of
https://github.com/xtr-dev/rondevu-client.git
synced 2025-12-15 21:33:23 +00:00
Implement crypto adapter pattern for platform independence
Adds CryptoAdapter interface with WebCryptoAdapter (browser) and
NodeCryptoAdapter (Node.js 19+) implementations.
Changes:
- Created crypto-adapter.ts interface
- Created web-crypto-adapter.ts for browser environments
- Created node-crypto-adapter.ts for Node.js environments
- Updated RondevuAPI to accept optional CryptoAdapter
- Updated Rondevu class to pass crypto adapter through
- Exported adapters and types in index.ts
- Updated README with platform support documentation
- Bumped version to 0.15.0
This allows the client library to work in both browser and Node.js
environments by providing platform-specific crypto implementations.
Example usage in Node.js:
import { Rondevu, NodeCryptoAdapter } from '@xtr-dev/rondevu-client'
const rondevu = new Rondevu({
apiUrl: 'https://api.ronde.vu',
cryptoAdapter: new NodeCryptoAdapter()
})
🤖 Generated with Claude Code
https://claude.com/claude-code
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -7,6 +7,10 @@ export { Rondevu } from './rondevu.js'
|
||||
export { RondevuAPI } from './api.js'
|
||||
export { RondevuSignaler } from './rondevu-signaler.js'
|
||||
|
||||
// Export crypto adapters
|
||||
export { WebCryptoAdapter } from './web-crypto-adapter.js'
|
||||
export { NodeCryptoAdapter } from './node-crypto-adapter.js'
|
||||
|
||||
// Export types
|
||||
export type {
|
||||
Signaler,
|
||||
@@ -26,3 +30,5 @@ export type { RondevuOptions, PublishServiceOptions } from './rondevu.js'
|
||||
|
||||
export type { PollingConfig } from './rondevu-signaler.js'
|
||||
|
||||
export type { CryptoAdapter } from './crypto-adapter.js'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user