@coti-io/coti-snap 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,173 @@
1
+ # COTI AES Key Manager Snap
2
+
3
+ A MetaMask Snap for managing AES keys and confidential tokens on the COTI network.
4
+
5
+ ## Features
6
+
7
+ - 🔐 **AES Key Management**: Securely store and manage AES keys in MetaMask
8
+ - 🪙 **Confidential Tokens**: View and manage confidential ERC-20 tokens
9
+ - 🖼️ **NFT Support**: Handle confidential NFTs with metadata
10
+ - 🔄 **Token Operations**: Transfer and deposit tokens
11
+ - 🛡️ **Secure Storage**: Encrypted storage within MetaMask's secure environment
12
+ - 🔗 **COTI Network**: Native support for COTI's confidential blockchain
13
+
14
+ ## Installation
15
+
16
+ ### For Users
17
+
18
+ 1. **Install MetaMask** if you haven't already
19
+ 2. **Visit the companion dapp**: [https://snap.coti.io](https://snap.coti.io)
20
+ 3. **Connect your wallet** and follow the installation prompts
21
+ 4. **Generate your AES key** to start managing confidential tokens
22
+
23
+ ### For Developers
24
+
25
+ ```bash
26
+ # Clone the repository
27
+ git clone https://github.com/coti-io/coti-snap.git
28
+ cd coti-snap
29
+
30
+ # Install dependencies
31
+ yarn install
32
+
33
+ # Build the snap
34
+ yarn workspace @coti-io/coti-snap build
35
+
36
+ # Run tests
37
+ yarn workspace @coti-io/coti-snap test
38
+
39
+ # Start development server
40
+ yarn workspace @coti-io/coti-snap start
41
+ ```
42
+
43
+ ## Usage
44
+
45
+ ### AES Key Management
46
+
47
+ ```typescript
48
+ // Check if user has AES key
49
+ const hasKey = await invokeSnap({ method: 'has-aes-key' });
50
+
51
+ // Get AES key (requires user confirmation)
52
+ const aesKey = await invokeSnap({ method: 'get-aes-key' });
53
+
54
+ // Set AES key
55
+ await invokeSnap({
56
+ method: 'set-aes-key',
57
+ params: { newUserAesKey: 'your-aes-key' }
58
+ });
59
+
60
+ // Delete AES key
61
+ await invokeSnap({ method: 'delete-aes-key' });
62
+ ```
63
+
64
+ ### Encryption/Decryption
65
+
66
+ ```typescript
67
+ // Encrypt data
68
+ const encrypted = await invokeSnap({
69
+ method: 'encrypt',
70
+ params: { value: 'data-to-encrypt' }
71
+ });
72
+
73
+ // Decrypt data
74
+ const decrypted = await invokeSnap({
75
+ method: 'decrypt',
76
+ params: { value: encryptedData }
77
+ });
78
+ ```
79
+
80
+ ## API Reference
81
+
82
+ ### RPC Methods
83
+
84
+ | Method | Description | Parameters |
85
+ |--------|-------------|------------|
86
+ | `has-aes-key` | Check if AES key exists | None |
87
+ | `get-aes-key` | Retrieve AES key | None |
88
+ | `set-aes-key` | Store AES key | `{ newUserAesKey: string }` |
89
+ | `delete-aes-key` | Remove AES key | None |
90
+ | `encrypt` | Encrypt data | `{ value: string }` |
91
+ | `decrypt` | Decrypt data | `{ value: string }` |
92
+ | `connect-to-wallet` | Connect to MetaMask | None |
93
+ | `get-permissions` | Get wallet permissions | None |
94
+
95
+ ### Permissions
96
+
97
+ The snap requires the following permissions:
98
+
99
+ - `snap_dialog`: For user confirmations
100
+ - `snap_manageState`: For secure state storage
101
+ - `endowment:ethereum-provider`: For blockchain interactions
102
+ - `endowment:network-access`: For API calls
103
+ - `endowment:rpc`: For dapp communication
104
+
105
+ ## Security
106
+
107
+ - **AES keys are stored securely** in MetaMask's encrypted storage
108
+ - **All operations require user confirmation** through MetaMask dialogs
109
+ - **State is isolated** per chain and address
110
+ - **No sensitive data is logged** or exposed
111
+
112
+ ## Development
113
+
114
+ ### Project Structure
115
+
116
+ ```
117
+ packages/snap/
118
+ ├── src/
119
+ │ ├── components/ # Snap UI components
120
+ │ ├── config/ # Configuration files
121
+ │ ├── utils/ # Utility functions
122
+ │ ├── test/ # Test files
123
+ │ └── index.tsx # Main snap entry point
124
+ ├── images/ # Snap icons
125
+ ├── snap.manifest.json # Snap manifest
126
+ └── package.json # Package configuration
127
+ ```
128
+
129
+ ### Building
130
+
131
+ ```bash
132
+ # Development build with watch mode
133
+ yarn workspace @coti-io/coti-snap start
134
+
135
+ # Production build
136
+ yarn workspace @coti-io/coti-snap build
137
+
138
+ # Clean build
139
+ yarn workspace @coti-io/coti-snap build:clean
140
+ ```
141
+
142
+ ### Testing
143
+
144
+ ```bash
145
+ # Run all tests
146
+ yarn workspace @coti-io/coti-snap test
147
+
148
+ # Run tests in watch mode
149
+ yarn workspace @coti-io/coti-snap test --watch
150
+ ```
151
+
152
+ ## Contributing
153
+
154
+ 1. Fork the repository
155
+ 2. Create a feature branch
156
+ 3. Make your changes
157
+ 4. Add tests for new functionality
158
+ 5. Ensure all tests pass
159
+ 6. Submit a pull request
160
+
161
+ ## License
162
+
163
+ MIT License - see [LICENSE](../../LICENSE) for details.
164
+
165
+ ## Support
166
+
167
+ - **Documentation**: [https://docs.coti.io](https://docs.coti.io)
168
+ - **Discord**: [COTI Community](https://discord.gg/coti)
169
+ - **GitHub Issues**: [Report bugs here](https://github.com/coti-io/coti-snap/issues)
170
+
171
+ ## Version History
172
+
173
+ - **v1.0.0**: Initial production release with AES key management and confidential token support