Skip to content

Commit 52c9244

Browse files
committed
added required files for flutter package
1 parent f915994 commit 52c9244

3 files changed

Lines changed: 218 additions & 0 deletions

File tree

packages/fula_client/CHANGELOG.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [0.1.0] - 2024-01-09
9+
10+
### Added
11+
12+
- Initial release of fula_client Flutter SDK
13+
- Client-side encryption with AES-256-GCM
14+
- Metadata privacy with configurable obfuscation modes
15+
- Secure file sharing with capability-based tokens
16+
- Key rotation support
17+
- Flat namespace API for file system-like access
18+
- Android support via FFI
19+
- Web support via WASM
20+
- Multipart upload support for large files
21+
22+
### Security
23+
24+
- HPKE (Hybrid Public Key Encryption) for key exchange
25+
- BLAKE3 for fast, secure hashing
26+
- X25519 for elliptic curve Diffie-Hellman
27+
28+
## [Unreleased]
29+
30+
### Planned
31+
32+
- iOS support
33+
- Desktop support (Windows, macOS, Linux)
34+
- Offline-first sync capabilities
35+
- Background upload/download

packages/fula_client/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Functionland
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

packages/fula_client/README.md

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
# fula_client
2+
3+
A Flutter SDK for [Fula](https://fx.land) decentralized storage with client-side encryption, metadata privacy, and secure file sharing.
4+
5+
## Features
6+
7+
- **Client-side encryption** - AES-256-GCM encryption, data never leaves your device unencrypted
8+
- **Metadata privacy** - File names and sizes are obfuscated from the server
9+
- **Secure sharing** - Share files with capability-based access tokens
10+
- **Key rotation** - Rotate encryption keys without re-uploading data
11+
- **Cross-platform** - Works on Android (FFI) and Web (WASM)
12+
13+
## Installation
14+
15+
```yaml
16+
dependencies:
17+
fula_client: ^0.1.0
18+
```
19+
20+
Or run:
21+
22+
```bash
23+
flutter pub add fula_client
24+
```
25+
26+
## Quick Start
27+
28+
```dart
29+
import 'package:fula_client/fula_client.dart';
30+
import 'dart:convert';
31+
import 'dart:typed_data';
32+
33+
Future<void> main() async {
34+
// Create encrypted client
35+
final config = FulaConfig(
36+
endpoint: 'http://localhost:9000',
37+
accessToken: 'your-jwt-token',
38+
);
39+
40+
final encConfig = EncryptionConfig(
41+
enableMetadataPrivacy: true,
42+
obfuscationMode: ObfuscationMode.deterministic,
43+
);
44+
45+
final client = await createEncryptedClient(config, encConfig);
46+
47+
// Upload encrypted file
48+
final data = utf8.encode('Secret document content');
49+
await putFlat(
50+
client,
51+
'my-bucket',
52+
'/documents/secret.txt',
53+
Uint8List.fromList(data),
54+
'text/plain',
55+
);
56+
57+
// Download and decrypt
58+
final decrypted = await getFlat(client, 'my-bucket', '/documents/secret.txt');
59+
print('Content: ${utf8.decode(decrypted)}');
60+
61+
// List files (shows original names, not obfuscated)
62+
final files = await listDecrypted(client, 'my-bucket', ListOptions());
63+
for (final file in files) {
64+
print('${file.originalKey} - ${file.size} bytes');
65+
}
66+
}
67+
```
68+
69+
## Platform Setup
70+
71+
### Android
72+
73+
Add to `android/app/build.gradle`:
74+
75+
```gradle
76+
android {
77+
defaultConfig {
78+
ndk {
79+
abiFilters 'arm64-v8a', 'armeabi-v7a', 'x86_64'
80+
}
81+
}
82+
}
83+
```
84+
85+
### Web
86+
87+
Ensure your web server serves WASM files with the correct MIME type:
88+
```
89+
application/wasm
90+
```
91+
92+
## API Overview
93+
94+
### Client Creation
95+
96+
- `createClient(config)` - Create basic client
97+
- `createEncryptedClient(config, encConfig)` - Create client with encryption
98+
99+
### Bucket Operations
100+
101+
- `createBucket(client, name)` - Create a bucket
102+
- `listBuckets(client)` - List all buckets
103+
- `deleteBucket(client, name)` - Delete a bucket
104+
105+
### Object Operations
106+
107+
- `putObject(client, bucket, key, data)` - Upload object
108+
- `getObject(client, bucket, key)` - Download object
109+
- `deleteObject(client, bucket, key)` - Delete object
110+
- `listObjects(client, bucket, options)` - List objects
111+
112+
### Encrypted Operations
113+
114+
- `putEncrypted(client, bucket, key, data)` - Upload with encryption
115+
- `getDecrypted(client, bucket, key)` - Download and decrypt
116+
- `listDecrypted(client, bucket, options)` - List with decrypted metadata
117+
118+
### Flat Namespace (File System API)
119+
120+
- `putFlat(client, bucket, path, data, contentType)` - Upload by path
121+
- `getFlat(client, bucket, path)` - Download by path
122+
- `deleteFlat(client, bucket, path)` - Delete by path
123+
- `listDirectory(client, bucket, path)` - List directory contents
124+
125+
### Secure Sharing
126+
127+
- `createShareToken(client, key, mode, expiry)` - Create share token
128+
- `acceptShare(tokenJson)` - Accept a share
129+
- `getWithShare(client, bucket, key, share)` - Access shared file
130+
131+
### Key Management
132+
133+
- `exportSecretKey(client)` - Export encryption key for backup
134+
- `createRotationManager(client)` - Create key rotation manager
135+
- `rotateBucket(client, bucket, manager)` - Rotate all keys in bucket
136+
137+
## Documentation
138+
139+
- [Full API Documentation](https://functionland.github.io/fula-api/)
140+
- [Flutter Integration Guide](https://github.com/functionland/fula-api/blob/main/docs/flutter-integration.md)
141+
- [Security Model](https://github.com/functionland/fula-api/blob/main/docs/THREAT_MODEL.md)
142+
143+
## JavaScript / Web
144+
145+
For JavaScript/TypeScript web applications, use the npm package:
146+
147+
```bash
148+
npm install @functionland/fula-client
149+
```
150+
151+
## License
152+
153+
MIT License - see [LICENSE](LICENSE) for details.
154+
155+
## Contributing
156+
157+
Contributions are welcome! Please see our [Contributing Guide](https://github.com/functionland/fula-api/blob/main/CONTRIBUTING.md).
158+
159+
## Support
160+
161+
- [GitHub Issues](https://github.com/functionland/fula-api/issues)
162+
- [Documentation](https://functionland.github.io/fula-api/)

0 commit comments

Comments
 (0)