mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-02 17:31:39 +00:00
Feat/add networks (#1303)
* No commit suggestions generated * No commit suggestions generated * No commit suggestions generated
This commit is contained in:
@@ -1,191 +0,0 @@
|
||||
---
|
||||
title: "Migrating from Centralized to Decentralized Authentication"
|
||||
description: "A comprehensive guide to migrating from centralized 8787 endpoints to decentralized OIDC authentication with WebAuthn"
|
||||
sidebarTitle: "Decentralized Authentication"
|
||||
icon: "key"
|
||||
---
|
||||
|
||||
# Migrating from Centralized to Decentralized Authentication
|
||||
|
||||
## Overview
|
||||
|
||||
Sonr is transitioning from a centralized authentication model using 8787 endpoints to a fully decentralized, privacy-preserving authentication system leveraging OpenID Connect (OIDC), Self-Issued OpenID Provider (SIOP), and WebAuthn technologies.
|
||||
|
||||
### Key Improvements
|
||||
|
||||
- **Decentralization**: Move from centralized identity management to self-sovereign identity
|
||||
- **WebAuthn Integration**: Hardware-backed, phishing-resistance authentication
|
||||
- **Gasless Onboarding**: Zero-cost user registration and transactions
|
||||
- **Automatic Vault Creation**: Seamless user experience with instant identity setup
|
||||
- **Enhanced Privacy**: DID-based authentication with verifiable presentations
|
||||
|
||||
## Architecture Comparison
|
||||
|
||||
### Old Architecture: Centralized 8787 Endpoints
|
||||
|
||||
- Centralized authentication server
|
||||
- Fixed credential storage
|
||||
- Limited authentication methods
|
||||
- Higher security risks
|
||||
|
||||
### New Architecture: Decentralized OIDC Provider
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
A[User Device] --> B{WebAuthn Registration}
|
||||
B --> |Credential Generation| C[Blockchain Bridge]
|
||||
C --> |Broadcast Credential| D[Sonr Blockchain]
|
||||
D --> |Create DID| E[User's Decentralized Identity]
|
||||
E --> |SIOP Flow| F[OIDC Provider]
|
||||
F --> |Verifiable Presentation| G[Service Provider]
|
||||
```
|
||||
|
||||
## Migration Steps
|
||||
|
||||
### 1. Prerequisites
|
||||
|
||||
- Go 1.24.1+
|
||||
- Cosmos SDK v0.50.14
|
||||
- WebAuthn-compatible browser/device
|
||||
- Updated Sonr SDK
|
||||
|
||||
### 2. Configuration Changes
|
||||
|
||||
#### Environment Variables
|
||||
|
||||
<CodeGroup>
|
||||
```bash title="Old Configuration"
|
||||
# Centralized auth endpoints
|
||||
AUTH_ENDPOINT=https://8787.sonr.io/auth
|
||||
AUTH_CLIENT_ID=legacy-client-id
|
||||
```
|
||||
|
||||
```bash title="New Configuration"
|
||||
# Decentralized OIDC configuration
|
||||
OIDC_PROVIDER_URL=https://oidc.sonr.network
|
||||
WEBAUTHN_ORIGIN=https://your-app.com
|
||||
DID_RESOLVER_URL=https://did.sonr.network
|
||||
```
|
||||
|
||||
</CodeGroup>
|
||||
|
||||
### 3. Endpoint Migration
|
||||
|
||||
| Old Endpoint | New Endpoint | Changes |
|
||||
| ---------------- | -------------------- | ----------------------- |
|
||||
| `/auth/login` | `/oidc/authorize` | OIDC authorization flow |
|
||||
| `/auth/register` | `/webauthn/register` | WebAuthn registration |
|
||||
| `/auth/token` | `/oidc/token` | Token issuance via SIOP |
|
||||
|
||||
### 4. API Changes
|
||||
|
||||
#### Request Format
|
||||
|
||||
<CodeGroup>
|
||||
```json title="Legacy Request"
|
||||
{
|
||||
"username": "user@example.com",
|
||||
"password": "legacy-password"
|
||||
}
|
||||
```
|
||||
|
||||
```json title="New WebAuthn Request"
|
||||
{
|
||||
"challenge": "base64-encoded-challenge",
|
||||
"attestation": {
|
||||
"type": "public-key",
|
||||
"id": "credential-id",
|
||||
"rawId": "base64-encoded-raw-credential",
|
||||
"response": {
|
||||
"clientDataJSON": "...",
|
||||
"attestationObject": "..."
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
</CodeGroup>
|
||||
|
||||
### 5. WebAuthn Integration
|
||||
|
||||
#### Registration Flow
|
||||
|
||||
1. Generate registration challenge
|
||||
2. Create WebAuthn credential
|
||||
3. Broadcast credential to blockchain
|
||||
4. Automatically create user vault
|
||||
5. Issue decentralized identifier (DID)
|
||||
|
||||
#### Code Example
|
||||
|
||||
```go title="WebAuthn Registration Handler"
|
||||
func (s *Server) HandleWebAuthnRegistration(w http.ResponseWriter, r *http.Request) {
|
||||
// 1. Validate WebAuthn attestation
|
||||
credential, err := s.webAuthnService.VerifyRegistration(attestationData)
|
||||
|
||||
// 2. Broadcast to blockchain
|
||||
didDoc, err := s.blockchainBridge.CreateDID(credential)
|
||||
|
||||
// 3. Create user vault
|
||||
vault, err := s.vaultService.CreateVault(didDoc)
|
||||
|
||||
// 4. Issue OIDC token
|
||||
token := s.oidcService.IssueToken(didDoc)
|
||||
}
|
||||
```
|
||||
|
||||
### 6. SIOP (Self-Issued OpenID Provider)
|
||||
|
||||
#### Key Concepts
|
||||
|
||||
- Verifiable Presentations
|
||||
- Decentralized Identifiers (DIDs)
|
||||
- User-controlled authentication
|
||||
|
||||
### 7. Error Handling
|
||||
|
||||
#### Migration Errors
|
||||
|
||||
| Error Code | Description | Mitigation |
|
||||
| ------------------------ | ---------------------- | -------------------- |
|
||||
| `AUTH_LEGACY_DEPRECATED` | Legacy auth method | Upgrade client |
|
||||
| `WEBAUTHN_UNSUPPORTED` | Device incompatibility | Use alternative auth |
|
||||
| `DID_RESOLUTION_FAILED` | Identity verification | Retry registration |
|
||||
|
||||
### 8. Testing Migration
|
||||
|
||||
```bash
|
||||
# Validate WebAuthn registration
|
||||
sonr webauthn test-registration
|
||||
|
||||
# Verify OIDC provider
|
||||
sonr oidc validate-provider
|
||||
|
||||
# Check DID resolution
|
||||
sonr did resolve did:sonr:example
|
||||
```
|
||||
|
||||
### 9. Breaking Changes
|
||||
|
||||
- Legacy password authentication removed
|
||||
- Token format changed to JWT with DID claims
|
||||
- New client libraries required
|
||||
- WebAuthn mandatory for registration
|
||||
|
||||
## Rollback Procedure
|
||||
|
||||
If issues arise:
|
||||
|
||||
1. Maintain legacy user mappings
|
||||
2. Provide fallback authentication
|
||||
3. Gradual, opt-in migration
|
||||
|
||||
## Conclusion
|
||||
|
||||
This migration represents a significant leap in authentication security and user privacy. By adopting WebAuthn, SIOP, and blockchain-backed identities, we're creating a more robust, user-controlled authentication ecosystem.
|
||||
|
||||
## Support
|
||||
|
||||
- [Sonr Developer Docs](/docs)
|
||||
- [WebAuthn Specification](https://www.w3.org/TR/webauthn-2/)
|
||||
- [OIDC Community](https://openid.net/developers/specs/)
|
||||
@@ -1,129 +0,0 @@
|
||||
---
|
||||
title: "DID Generation and Management"
|
||||
description: "Learn how to generate and manage Decentralized Identifiers (DIDs) using advanced crypto interfaces"
|
||||
sidebarTitle: "Identity Generation"
|
||||
icon: "signature"
|
||||
---
|
||||
|
||||
# DID Generation Patterns
|
||||
|
||||
The Sonr project provides a robust and flexible DID (Decentralized Identifier) generation system supporting multiple key types and cryptographic methods.
|
||||
|
||||
## Supported Key Types
|
||||
|
||||
The `didkey.go` interface supports the following key types:
|
||||
|
||||
- RSA Public Keys
|
||||
- Ed25519 Public Keys
|
||||
- Secp256k1 Public Keys
|
||||
|
||||
## Basic DID Generation
|
||||
|
||||
### Creating a DID from a Public Key
|
||||
|
||||
```go
|
||||
import (
|
||||
"github.com/libp2p/go-libp2p/core/crypto"
|
||||
"github.com/sonr-io/crypto/keys"
|
||||
)
|
||||
|
||||
// Generate a new key pair
|
||||
privateKey, publicKey, err := crypto.GenerateKeyPair(crypto.Ed25519, -1)
|
||||
|
||||
// Create a DID
|
||||
did, err := keys.NewDID(publicKey)
|
||||
```
|
||||
|
||||
### Parsing an Existing DID
|
||||
|
||||
```go
|
||||
// Parse a DID string
|
||||
did, err := keys.Parse("did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGTsyDFWYviJr4")
|
||||
```
|
||||
|
||||
## Advanced DID Operations
|
||||
|
||||
### Address Derivation
|
||||
|
||||
```go
|
||||
// Get a blockchain-compatible address from a DID
|
||||
address, err := did.Address()
|
||||
```
|
||||
|
||||
### Compressed Public Key Retrieval
|
||||
|
||||
```go
|
||||
// Get a compressed public key (for Secp256k1)
|
||||
compressedPubKey, err := did.CompressedPubKey()
|
||||
```
|
||||
|
||||
## MPC Enclave DID Generation
|
||||
|
||||
For MPC (Multi-Party Computation) enclaves, use a specialized method:
|
||||
|
||||
```go
|
||||
// Create a DID from MPC enclave public key bytes
|
||||
did, err := keys.NewFromMPCPubKey(enclavePublicKeyBytes)
|
||||
```
|
||||
|
||||
## DID Validation
|
||||
|
||||
```go
|
||||
// Validate a DID format
|
||||
err := keys.ValidateFormat("did:key:example123")
|
||||
```
|
||||
|
||||
## Multicodec Support
|
||||
|
||||
The library supports various multicodec prefixes for different key types:
|
||||
|
||||
- RSA: `0x1205`
|
||||
- Ed25519: `0xed`
|
||||
- Secp256k1: `0xe7`
|
||||
|
||||
## Security Considerations
|
||||
|
||||
- Always generate keys using cryptographically secure methods
|
||||
- Validate DIDs before using them in critical operations
|
||||
- Use the appropriate key type for your security requirements
|
||||
|
||||
## Example: Complete DID Workflow
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/libp2p/go-libp2p/core/crypto"
|
||||
"github.com/sonr-io/crypto/keys"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Generate a new key pair
|
||||
privateKey, publicKey, err := crypto.GenerateKeyPair(crypto.Ed25519, -1)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
// Create a DID
|
||||
did, err := keys.NewDID(publicKey)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
// Get the DID string
|
||||
didString := did.String()
|
||||
fmt.Println("Generated DID:", didString)
|
||||
|
||||
// Derive blockchain address
|
||||
address, err := did.Address()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
fmt.Println("Blockchain Address:", address)
|
||||
}
|
||||
```
|
||||
|
||||
## Compatibility and Interoperability
|
||||
|
||||
The Sonr DID implementation follows the W3C DID specification, ensuring broad compatibility with other decentralized identity systems.
|
||||
@@ -1,155 +0,0 @@
|
||||
---
|
||||
title: "DWN Plugin Architecture"
|
||||
description: "Deep dive into the Decentralized Web Node (DWN) plugin system and integration"
|
||||
sidebarTitle: "WASM Architecture"
|
||||
icon: "puzzle"
|
||||
---
|
||||
|
||||
# DWN Plugin Architecture
|
||||
|
||||
The Sonr project implements a flexible and secure plugin system for Decentralized Web Nodes (DWN), enabling modular and extensible functionality.
|
||||
|
||||
## Overview
|
||||
|
||||
The plugin architecture is designed to:
|
||||
|
||||
- Support dynamic loading of WebAssembly (WASM) plugins
|
||||
- Provide a standardized interface for plugin interactions
|
||||
- Enable secure, isolated execution of plugins
|
||||
|
||||
## Core Components
|
||||
|
||||
### Plugin Manager
|
||||
|
||||
The `PluginManager` manages plugin lifecycle and interactions:
|
||||
|
||||
```go
|
||||
type PluginManager struct {
|
||||
plugins map[string]Plugin
|
||||
actors map[string]Actor
|
||||
}
|
||||
|
||||
type Plugin interface {
|
||||
Initialize(config map[string]any) error
|
||||
Execute(method string, payload []byte) ([]byte, error)
|
||||
Close() error
|
||||
}
|
||||
```
|
||||
|
||||
### Plugin Configuration
|
||||
|
||||
Plugins are configured through a structured configuration:
|
||||
|
||||
```go
|
||||
type PluginConfig struct {
|
||||
ID string // Unique plugin identifier
|
||||
Type string // Plugin type (e.g., "motor", "crypto")
|
||||
Path string // WASM module path
|
||||
Environment map[string]any // Plugin-specific environment variables
|
||||
}
|
||||
```
|
||||
|
||||
## Loading and Initializing Plugins
|
||||
|
||||
### Basic Plugin Loading
|
||||
|
||||
```go
|
||||
func (pm *PluginManager) LoadPlugin(config PluginConfig) error {
|
||||
// Load WASM module
|
||||
module, err := extism.Load(config.Path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Initialize plugin
|
||||
plugin := &WASMPlugin{
|
||||
module: module,
|
||||
config: config,
|
||||
}
|
||||
|
||||
// Store in plugin registry
|
||||
pm.plugins[config.ID] = plugin
|
||||
}
|
||||
```
|
||||
|
||||
### Actor-Based Plugin Management
|
||||
|
||||
```go
|
||||
func (pm *PluginManager) CreateActor(pluginID string) (*Actor, error) {
|
||||
plugin, exists := pm.plugins[pluginID]
|
||||
if !exists {
|
||||
return nil, errors.New("plugin not found")
|
||||
}
|
||||
|
||||
actor := NewActor(plugin)
|
||||
pm.actors[actor.ID] = actor
|
||||
|
||||
return actor, nil
|
||||
}
|
||||
```
|
||||
|
||||
## Plugin Execution Workflow
|
||||
|
||||
1. Plugin is loaded from WASM module
|
||||
2. Configuration is applied
|
||||
3. Plugin is initialized
|
||||
4. Specific methods can be invoked through a standardized interface
|
||||
|
||||
### Example Plugin Execution
|
||||
|
||||
```go
|
||||
func ExecutePluginMethod(pluginID, method string, payload []byte) ([]byte, error) {
|
||||
plugin := pluginManager.plugins[pluginID]
|
||||
return plugin.Execute(method, payload)
|
||||
}
|
||||
```
|
||||
|
||||
## Configuration and Environment
|
||||
|
||||
### Plugin Environment Variables
|
||||
|
||||
```json
|
||||
{
|
||||
"motor_plugin": {
|
||||
"enclave_config": { ... },
|
||||
"chain_id": "sonr-testnet-1",
|
||||
"log_level": "debug"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Error Handling and Logging
|
||||
|
||||
```go
|
||||
type PluginError struct {
|
||||
Code string
|
||||
Message string
|
||||
Details map[string]any
|
||||
}
|
||||
```
|
||||
|
||||
## Security Considerations
|
||||
|
||||
- WASM plugins run in an isolated sandbox
|
||||
- Limited access to system resources
|
||||
- Runtime restrictions prevent malicious behavior
|
||||
- Cryptographic verification of plugin modules
|
||||
|
||||
## Plugin Types
|
||||
|
||||
1. **Crypto Plugins**: Cryptographic operations
|
||||
2. **Motor Plugins**: MPC and token management
|
||||
3. **DID Plugins**: Decentralized Identity operations
|
||||
4. **Custom Plugins**: Application-specific extensions
|
||||
|
||||
## Best Practices
|
||||
|
||||
- Keep plugins small and focused
|
||||
- Use standardized interfaces
|
||||
- Implement comprehensive error handling
|
||||
- Validate all plugin inputs
|
||||
- Monitor plugin performance
|
||||
|
||||
## Advanced Configuration
|
||||
|
||||
For advanced plugin configuration and deployment, refer to the [PDK Configuration Guide](/blockchain/modules/dwn/configuration).
|
||||
@@ -1,31 +0,0 @@
|
||||
---
|
||||
title: Delegated Proof of Stake (DPoS)
|
||||
description: A decentralized, secure, and efficient consensus mechanism.
|
||||
---
|
||||
|
||||
Sonr leverages a Delegated Proof of Stake (DPoS) mechanism to optimize network security and user participation. DPoS imposes an opportunity cost for malicious behavior through slashing, but it also presents challenges that must be addressed for a sustainable design.
|
||||
|
||||
## Challenges in Staking Mechanisms
|
||||
|
||||
- **Token Value**: The token must have intrinsic value to incentivize staking.
|
||||
- **Wealth Concentration**: Staking can give an outsized advantage to wealthy users.
|
||||
- **Coordination Problems**: Staking mechanisms can be gamed by coordinated actors.
|
||||
|
||||
## Sonr's Approach to DPoS
|
||||
|
||||
We have designed our staking mechanism to address these challenges and create a sustainable and equitable system:
|
||||
|
||||
<CardGroup>
|
||||
<Card title="Low Barrier to Entry">
|
||||
The upfront capital required to stake is designed to not significantly
|
||||
discourage participation.
|
||||
</Card>
|
||||
<Card title="Slashing for Malice">
|
||||
If a stakeholder group makes decisions that materially harm the network,
|
||||
their stake is slashed.
|
||||
</Card>
|
||||
<Card title="Incentivizing Positive Growth">
|
||||
Stakeholders can make decisions that positively impact the future network
|
||||
health and token price, promoting long-term growth.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
@@ -1,29 +0,0 @@
|
||||
---
|
||||
title: Network Architecture
|
||||
description: A detailed look at Sonr's three-tier system design.
|
||||
---
|
||||
|
||||
Our incorporation of embedded light nodes signifies a strategic move towards enhancing network robustness and efficiency. These nodes operate with a reduced resource footprint, ensuring a widespread and seamless network distribution. They form the bedrock of the infrastructure, interfacing directly with a series of validators. These validators are pivotal in maintaining the integrity and trustworthiness of the network, each playing an instrumental role in processing transactions and securing the network's protocol.
|
||||
|
||||
## Blockchain Services
|
||||
|
||||
Blockchain Services are instrumental in ensuring seamless interoperability and data exchange across the network.
|
||||
|
||||
<CardGroup>
|
||||
<Card title="IBC Relayer">
|
||||
The IBC Relayer stands at the forefront of inter-blockchain communication,
|
||||
enabling different blockchain protocols to transfer and share information
|
||||
effectively.
|
||||
</Card>
|
||||
<Card title="IPFS/Libp2p Routing">
|
||||
IPFS/Libp2p Routing underpins the decentralized routing of information,
|
||||
ensuring resilient and scalable data distribution across the network.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
## Interoperability Protocols
|
||||
|
||||
The overarching network architecture is designed with interoperability at its core, integrating protocols such as Matrix and Pinecone to facilitate communication and data exchange across disparate systems.
|
||||
|
||||
- **Matrix Protocol**: A new paradigm in secure, decentralized communication.
|
||||
- **Pinecone Routing**: A novel approach to establishing network pathways, enhancing the efficiency and reliability of data transmission.
|
||||
@@ -1,238 +0,0 @@
|
||||
---
|
||||
title: "WebAuthn Integration"
|
||||
description: "Comprehensive guide to Sonr's WebAuthn/FIDO2 implementation for passwordless authentication"
|
||||
icon: "key"
|
||||
sidebarTitle: "WebAuthn Integration"
|
||||
---
|
||||
|
||||
<Note>
|
||||
This documentation covers the WebAuthn implementation in the Sonr blockchain,
|
||||
providing a secure, passwordless authentication mechanism through
|
||||
W3C-compliant WebAuthn protocols.
|
||||
</Note>
|
||||
|
||||
## Overview
|
||||
|
||||
Sonr's WebAuthn implementation enables gasless onboarding and secure transaction authorization without requiring users to hold tokens initially. This document provides a comprehensive guide to understanding and using our WebAuthn client.
|
||||
|
||||
## Architecture
|
||||
|
||||
<Frame>
|
||||
<img
|
||||
src="https://cdn.sonr.io/diagrams/passkey-jwt.png"
|
||||
alt="WebAuthn Architecture Diagram"
|
||||
/>
|
||||
</Frame>
|
||||
|
||||
The WebAuthn implementation is structured across three primary layers:
|
||||
|
||||
1. **Client Layer** (`client/auth/webauthn.go`)
|
||||
|
||||
- WebAuthnClient interface
|
||||
- Registration and Authentication flows
|
||||
- DID integration
|
||||
|
||||
2. **Internal WebAuthn Package** (`internal/webauthn/`)
|
||||
|
||||
- COSE key parsing
|
||||
- CBOR encoding/decoding
|
||||
- Attestation verification
|
||||
- Signature verification (ES256/RS256)
|
||||
|
||||
3. **DID Module Layer** (`x/did/keeper/`)
|
||||
- WebAuthn controller verifier
|
||||
- Credential storage in DID documents
|
||||
- Challenge generation and validation
|
||||
|
||||
## API Reference
|
||||
|
||||
### WebAuthnClient Interface
|
||||
|
||||
<CodeGroup>
|
||||
```go
|
||||
type WebAuthnClient interface {
|
||||
// Registration Operations
|
||||
BeginRegistration(ctx context.Context, opts *RegistrationOptions) (*RegistrationChallenge, error)
|
||||
CompleteRegistration(ctx context.Context, challenge *RegistrationChallenge, response *AuthenticatorAttestationResponse) (*WebAuthnCredential, error)
|
||||
|
||||
// Authentication Operations
|
||||
BeginAuthentication(ctx context.Context, opts *AuthenticationOptions) (*AuthenticationChallenge, error)
|
||||
CompleteAuthentication(ctx context.Context, challenge *AuthenticationChallenge, response *AuthenticatorAssertionResponse, credentialID string) (*AuthenticationResult, error)
|
||||
|
||||
// Credential Management Methods...
|
||||
}
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
## Usage Examples
|
||||
|
||||
### Registration Flow
|
||||
|
||||
<CodeGroup>
|
||||
```go Registration Example
|
||||
func registerWebAuthn() error {
|
||||
client := auth.NewWebAuthnClient()
|
||||
ctx := context.Background()
|
||||
|
||||
// Begin registration
|
||||
regOpts := &auth.RegistrationOptions{
|
||||
UserID: "user123",
|
||||
Username: "alice@example.com",
|
||||
DisplayName: "Alice Smith",
|
||||
UserVerification: "preferred",
|
||||
}
|
||||
|
||||
challenge, err := client.BeginRegistration(ctx, regOpts)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Complete registration
|
||||
response := &auth.AuthenticatorAttestationResponse{
|
||||
ClientDataJSON: clientDataJSON,
|
||||
AttestationObject: attestationObject,
|
||||
}
|
||||
|
||||
credential, err := client.CompleteRegistration(ctx, challenge, response)
|
||||
return err
|
||||
}
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
### Authentication Flow
|
||||
|
||||
<CodeGroup>
|
||||
```go Authentication Example
|
||||
func authenticateWebAuthn(credentialID string) error {
|
||||
client := auth.NewWebAuthnClient()
|
||||
ctx := context.Background()
|
||||
|
||||
// Begin authentication
|
||||
authOpts := &auth.AuthenticationOptions{
|
||||
UserVerification: "required",
|
||||
AllowedCredentials: []*auth.CredentialDescriptor{
|
||||
{
|
||||
Type: "public-key",
|
||||
ID: []byte(credentialID),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
challenge, err := client.BeginAuthentication(ctx, authOpts)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Complete authentication
|
||||
response := &auth.AuthenticatorAssertionResponse{
|
||||
ClientDataJSON: clientDataJSON,
|
||||
AuthenticatorData: authenticatorData,
|
||||
Signature: signature,
|
||||
UserHandle: userHandle,
|
||||
}
|
||||
|
||||
result, err := client.CompleteAuthentication(ctx, challenge, response, credentialID)
|
||||
return err
|
||||
}
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
## Security Considerations
|
||||
|
||||
### Supported Algorithms
|
||||
|
||||
<Tabs>
|
||||
<Tab title="ES256">ECDSA with P-256 curve and SHA-256</Tab>
|
||||
<Tab title="RS256">RSASSA-PKCS1-v1_5 with SHA-256</Tab>
|
||||
</Tabs>
|
||||
|
||||
### Attestation Formats
|
||||
|
||||
<Callout type="info">
|
||||
1. **none**: No attestation (development/testing) 2. **packed**:
|
||||
Self-attestation or certificate chain 3. **fido-u2f**: Legacy U2F
|
||||
authenticators 4. **android-safetynet**: Android device attestation
|
||||
</Callout>
|
||||
|
||||
### Security Features
|
||||
|
||||
- **Challenge uniqueness**: Each challenge is unique and time-bound
|
||||
- **Origin validation**: Ensures requests come from trusted origins
|
||||
- **User verification**: Requires biometric or PIN when configured
|
||||
- **Counter tracking**: Detects cloned credentials
|
||||
- **Credential isolation**: Each DID has separate credential namespace
|
||||
|
||||
## Configuration
|
||||
|
||||
### Chain Parameters
|
||||
|
||||
<CodeGroup>
|
||||
```json Configuration Example
|
||||
{
|
||||
"webauthn": {
|
||||
"rp_id": "sonr.io",
|
||||
"rp_name": "Sonr Network",
|
||||
"timeout": 60000,
|
||||
"user_verification": "preferred",
|
||||
"attestation": "none",
|
||||
"allowed_origins": [
|
||||
"https://sonr.io",
|
||||
"https://app.sonr.io"
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
<Accordion title="Common WebAuthn Issues">
|
||||
- **"Invalid attestation format"**: Ensure authenticator supports the
|
||||
configured format - **"Challenge mismatch"**: Verify challenge hasn't expired
|
||||
- **"Origin validation failed"**: Check allowed origins list - **"User
|
||||
verification required"**: Ensure authenticator supports verification
|
||||
</Accordion>
|
||||
|
||||
## Contributing
|
||||
|
||||
### Development Setup
|
||||
|
||||
<CodeGroup>
|
||||
```bash Setup Commands
|
||||
# Clone repository
|
||||
git clone https://github.com/sonr-io/sonr.git
|
||||
|
||||
# Install dependencies
|
||||
|
||||
make install
|
||||
|
||||
# Run WebAuthn tests
|
||||
|
||||
make test-webauthn
|
||||
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
## References
|
||||
|
||||
<Card
|
||||
title="WebAuthn Specifications"
|
||||
icon="link"
|
||||
href="https://www.w3.org/TR/webauthn/"
|
||||
>
|
||||
Official W3C WebAuthn Specification
|
||||
</Card>
|
||||
|
||||
<Card
|
||||
title="FIDO2 CTAP"
|
||||
icon="lock"
|
||||
href="https://fidoalliance.org/specs/fido-v2.0/"
|
||||
>
|
||||
FIDO2 Client to Authenticator Protocol
|
||||
</Card>
|
||||
|
||||
## License
|
||||
|
||||
Copyright 2024 Sonr Inc. Licensed under the Apache License, Version 2.0.
|
||||
```
|
||||
|
||||
@@ -1,305 +0,0 @@
|
||||
---
|
||||
title: Distribution
|
||||
description: SNR token distribution model, allocation strategy, and economic distribution mechanisms
|
||||
sidebarTitle: "Supply & Distribution"
|
||||
icon: "chart-pie"
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
The SNR token distribution is designed to balance immediate network needs with long-term sustainability, ensuring fair allocation across stakeholders while maintaining sufficient reserves for ecosystem growth.
|
||||
|
||||
**Total Supply: 1,000,000,000 SNR**
|
||||
|
||||
<Note>
|
||||
Token distribution follows a carefully planned vesting schedule to prevent
|
||||
market manipulation and ensure aligned incentives across all participants.
|
||||
</Note>
|
||||
|
||||
## Supply Dynamics
|
||||
|
||||
### Circulating Supply Factors
|
||||
|
||||
The circulating token supply depends on several key factors:
|
||||
|
||||
<CardGroup>
|
||||
<Card title="Initial Circulation">
|
||||
200M SNR at genesis (20% of total supply)
|
||||
</Card>
|
||||
<Card title="Minted Tokens">
|
||||
New tokens created through inflation for rewards and subsidies
|
||||
</Card>
|
||||
<Card title="Vesting Releases">
|
||||
Scheduled releases from locked allocations over time
|
||||
</Card>
|
||||
<Card title="Staked Tokens">
|
||||
Tokens locked in staking reducing effective circulation
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
### Token Velocity
|
||||
|
||||
Token velocity measures how frequently tokens change hands and directly impacts token value:
|
||||
|
||||
```math
|
||||
\text{Token Value} = \frac{\text{Economic Activity}}{\text{Circulating Supply} \times \text{Velocity}}
|
||||
```
|
||||
|
||||
## Allocation Strategy
|
||||
|
||||
### Core Allocations
|
||||
|
||||
The token distribution prioritizes long-term network health through strategic allocations:
|
||||
|
||||
1. **Community & Ecosystem** (35% - 350M SNR)
|
||||
- Airdrop Program: 100M SNR (10%)
|
||||
- Testnet Incentives: 50M SNR (5%)
|
||||
- Staking Rewards Pool: 100M SNR (10%)
|
||||
- Ecosystem Grants: 100M SNR (10%)
|
||||
|
||||
2. **Team & Advisors** (20% - 200M SNR)
|
||||
- Team Allocation: 150M SNR (15%)
|
||||
- Advisors: 50M SNR (5%)
|
||||
|
||||
3. **Investors** (25% - 250M SNR)
|
||||
- Seed Round: 75M SNR (7.5%)
|
||||
- Series A: 100M SNR (10%)
|
||||
- Strategic Round: 75M SNR (7.5%)
|
||||
|
||||
4. **Foundation Treasury** (15% - 150M SNR)
|
||||
- Operations: 75M SNR (7.5%)
|
||||
- Reserve Fund: 75M SNR (7.5%)
|
||||
|
||||
5. **Validator Incentives** (5% - 50M SNR)
|
||||
- Genesis Validators: 30M SNR (3%)
|
||||
- Delegation Program: 20M SNR (2%)
|
||||
|
||||
### Vesting Schedules
|
||||
|
||||
<Warning>
|
||||
All non-circulating allocations follow strict vesting schedules to ensure
|
||||
gradual market entry and prevent supply shocks.
|
||||
</Warning>
|
||||
|
||||
#### Team Vesting
|
||||
|
||||
- **Team**: 12-month cliff, 48-month linear vest
|
||||
- **Advisors**: 6-month cliff, 24-month linear vest
|
||||
- No transfers until cliff periods expire
|
||||
|
||||
#### Investor Vesting
|
||||
|
||||
- **Seed Round**: 6-month cliff, 36-month linear vest
|
||||
- **Series A**: 3-month cliff, 24-month linear vest
|
||||
- **Strategic Round**: 25% immediate, remainder over 18 months
|
||||
|
||||
#### Community Vesting
|
||||
|
||||
- **Airdrop**: 25% immediate, 75% over 12 months
|
||||
- **Testnet**: Distribution over 6-month testnet period
|
||||
- **Ecosystem Grants**: Project milestone-based releases
|
||||
|
||||
#### Foundation Vesting
|
||||
|
||||
- **Operations**: 10% at genesis, 90% over 5 years
|
||||
- **Reserve Fund**: Minimum 3 years lockup, governance approval required
|
||||
|
||||
## Inflation Mechanism
|
||||
|
||||
### Reward Distribution
|
||||
|
||||
The network implements controlled inflation to incentivize participation:
|
||||
|
||||
<CardGroup>
|
||||
<Card title="Validator Rewards">
|
||||
Block rewards for consensus participation distributed pro-rata to stake
|
||||
</Card>
|
||||
<Card title="Highway Services">
|
||||
Compensation for off-chain computation, storage, and routing services
|
||||
</Card>
|
||||
<Card title="Governance Rewards">
|
||||
Incentives for proposal creation and voting participation
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
### Inflation Schedule
|
||||
|
||||
**Year 1**: 15% inflation (aggressive growth)
|
||||
- Focus on network bootstrapping
|
||||
- High rewards for early adopters
|
||||
|
||||
**Year 2**: 12% inflation (continued expansion)
|
||||
- Stabilization period begins
|
||||
- Balanced growth incentives
|
||||
|
||||
**Year 3**: 9% inflation (stabilization)
|
||||
- Network maturation
|
||||
- Sustainable reward levels
|
||||
|
||||
**Year 4+**: 7% inflation (long-term sustainability)
|
||||
- Minimal dilution
|
||||
- Self-sustaining economics
|
||||
|
||||
## Economic Safeguards
|
||||
|
||||
### Anti-Manipulation Measures
|
||||
|
||||
1. **Vesting Cliffs**: Prevent immediate dumps from large holders
|
||||
2. **Staking Lockups**: Reduce liquid supply through validator requirements
|
||||
3. **Governance Delays**: Time-locked treasury withdrawals
|
||||
4. **Slashing Penalties**: Discourage malicious validator behavior
|
||||
|
||||
### Supply Controls
|
||||
|
||||
The network implements several mechanisms to manage token supply:
|
||||
|
||||
- **Fee Burning**: 50% of transaction fees burned (deflationary)
|
||||
- **Treasury Management**: Governance-controlled minting caps
|
||||
- **Dynamic Rewards**: Adjustment based on network participation
|
||||
- **Lock Incentives**: Higher rewards for longer staking periods
|
||||
|
||||
### Centralization Risks
|
||||
|
||||
- No single entity controls >20% at genesis
|
||||
- Team tokens have longest vesting (4 years)
|
||||
- Foundation treasury requires governance approval
|
||||
- Validator set caps prevent concentration
|
||||
|
||||
### Market Stability
|
||||
|
||||
- Staggered vesting prevents supply shocks
|
||||
- Fee burning provides deflationary pressure
|
||||
- Utility demand from identity services
|
||||
- Cross-chain value capture mechanisms
|
||||
|
||||
## Token Utility & Value Accrual
|
||||
|
||||
### Primary Utilities
|
||||
|
||||
<CardGroup>
|
||||
<Card title="Network Security">
|
||||
Staking for validation and delegation
|
||||
</Card>
|
||||
<Card title="Governance">
|
||||
Voting on protocol upgrades and parameters
|
||||
</Card>
|
||||
<Card title="Transaction Fees">
|
||||
Gas payments for network operations
|
||||
</Card>
|
||||
<Card title="Identity Services">
|
||||
Premium features and API access
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
### Value Accrual Mechanisms
|
||||
|
||||
1. **Fee Burning**: 50% of transaction fees burned (deflationary)
|
||||
2. **Staking Yield**: 7-15% APR depending on network participation
|
||||
3. **Identity Revenue**: Enterprise licensing fees distributed to stakers
|
||||
4. **Cross-chain Value**: IBC transfer fees and bridge operations
|
||||
|
||||
### Staking Targets
|
||||
|
||||
- **Target staking ratio**: 65%
|
||||
- **Validator set**: 50-100 active validators
|
||||
- **Minimum stake**: 1M SNR (0.1% of supply)
|
||||
- **Delegation minimum**: 1 SNR (accessible to all)
|
||||
|
||||
### Vesting Schedule Overview
|
||||
|
||||
| Category | Immediate | 6 Months | 12 Months | 24 Months | 36 Months | 48 Months |
|
||||
|----------|-----------|----------|-----------|-----------|-----------|-----------|
|
||||
| Airdrop | 25% | 50% | 75% | 100% | - | - |
|
||||
| Team | 0% | 0% | 12.5% | 37.5% | 62.5% | 100% |
|
||||
| Seed Investors | 0% | 0% | 16.7% | 50% | 83.3% | 100% |
|
||||
| Series A | 0% | 25% | 50% | 100% | - | - |
|
||||
| Foundation | 10% | 28% | 46% | 64% | 82% | 100% |
|
||||
|
||||
<Check>
|
||||
The distribution model prioritizes network security, ecosystem growth, and
|
||||
fair participant rewards while maintaining economic sustainability.
|
||||
</Check>
|
||||
|
||||
## Distribution Timeline
|
||||
|
||||
### Pre-Launch (Months -6 to 0)
|
||||
|
||||
- Team allocation locked
|
||||
- Investor funds raised
|
||||
- Testnet incentives distributed
|
||||
- Airdrop snapshot taken
|
||||
|
||||
### Genesis (Month 0)
|
||||
|
||||
- 200M SNR circulating supply
|
||||
- Genesis validators receive allocation
|
||||
- Foundation treasury initialized
|
||||
- Staking rewards begin
|
||||
|
||||
### Year 1 (Months 1-12)
|
||||
|
||||
- Airdrop vesting releases 75M SNR
|
||||
- Team cliff expires, vesting begins
|
||||
- Series A completes vesting
|
||||
- Ecosystem grants distributed
|
||||
|
||||
### Year 2-3 (Months 13-36)
|
||||
|
||||
- Seed round completes vesting
|
||||
- Team reaches 62.5% vested
|
||||
- Foundation operations fully unlocked
|
||||
- Validator program matured
|
||||
|
||||
## Economic Incentives
|
||||
|
||||
### Genesis Validator Program
|
||||
|
||||
- **Genesis Validators**: 30M SNR (3%)
|
||||
- 50 validators × 600,000 SNR each
|
||||
- 24 months minimum staking lockup
|
||||
- 99%+ uptime and governance participation required
|
||||
|
||||
### Delegation Program
|
||||
|
||||
- **Foundation Delegations**: 20M SNR (2%)
|
||||
- 6-month renewable terms
|
||||
- Performance-based allocation
|
||||
- Support for high-performing validators
|
||||
|
||||
### Maturity Phase (Year 3+)
|
||||
|
||||
- Stabilized inflation rate
|
||||
- Self-sustaining economics
|
||||
- Community-driven allocation
|
||||
|
||||
## Success Metrics
|
||||
|
||||
### Year 1 Targets
|
||||
|
||||
- 50% of supply staked
|
||||
- 50+ active validators
|
||||
- 100k+ active addresses
|
||||
- $10M+ in identity service revenue
|
||||
|
||||
### Year 3 Targets
|
||||
|
||||
- 65% of supply staked
|
||||
- 75+ active validators
|
||||
- 1M+ active addresses
|
||||
- $100M+ total value locked
|
||||
|
||||
### Long-term Vision (5+ years)
|
||||
|
||||
- Self-sustaining network economics
|
||||
- Deflationary token model
|
||||
- Industry-standard identity infrastructure
|
||||
- Billion-dollar ecosystem value
|
||||
|
||||
## Transparency Commitments
|
||||
|
||||
All token distributions are:
|
||||
|
||||
- Publicly verifiable on-chain
|
||||
- Subject to regular audits
|
||||
- Reported in quarterly updates
|
||||
- Governed by smart contracts
|
||||
@@ -1,98 +0,0 @@
|
||||
---
|
||||
title: "Governance"
|
||||
sidebarTitle: "Protocol Governance"
|
||||
description: "Governance is the process of making decisions on behalf of a group of people or organization"
|
||||
icon: "landmark"
|
||||
---
|
||||
|
||||
The Demand is rooted from participation in the governance process, determining upgrades to the protocol or allocation of resources, and supply is the result of the tokens eligible to participate in the governance process.
|
||||
On Sonr we will be leveraging a **delegate stake** mechanism in order to **optimize buy-in** for users in the network. It imposes an **excess opportunity cost** if **slashing** is implemented.
|
||||
|
||||
**Seven elements of economic design for governance**
|
||||
|
||||
1. Scope of Decisions
|
||||
2. Stakeholders
|
||||
3. Policy Research & Development
|
||||
4. Proposal Process
|
||||
5. Information Distribution Systems
|
||||
6. Decision Making Procedures
|
||||
7. Implementation & Property Rights
|
||||
|
||||
## Yearly Governance Cycle
|
||||
|
||||
- Two General Elections for proposals yearly
|
||||
- Proposals need at least 20% of all validator approval to move into general election
|
||||
- 51% of General Vote required for proposal to pass
|
||||
- Emergency Voting sessions can be called if requested by 51% of Governance Participants
|
||||
|
||||
### ☀️ Summer Cycle
|
||||
|
||||
| | Start Date | End Date |
|
||||
| ----------------------------- | ---------- | -------- |
|
||||
| Validator Vetting | 5/17 | 5/31 |
|
||||
| Proposals Posted | 6/1 | |
|
||||
| General Election of Proposals | 6/2 | 6/15 |
|
||||
| Results Posted | 6/16 | |
|
||||
|
||||
### ❄️ Winter Cycle
|
||||
|
||||
| | Start Date | End Date |
|
||||
| ----------------------------- | ---------- | -------- |
|
||||
| Validator Vetting | 11/17 | 11/31 |
|
||||
| Proposals Posted | 12/1 | |
|
||||
| General Election of Proposals | 12/2 | 12/15 |
|
||||
| Results Posted | 12/16 | |
|
||||
|
||||
## First Rollout Phase
|
||||
|
||||
These are the measures the core Sonr team will be undertaking prior and during test-net deployment.
|
||||
|
||||
### Establish Community
|
||||
|
||||
Build a loyal community of token holders that represent our platforms stakeholder groups.
|
||||
|
||||
- All of our existing token holders (this includes our founder and early investors) will be staking their Sonr Token in order to be incentivized to hold tokens and participate in voting
|
||||
- We will be actively networking with DeFi projects, blockchain service providers, and etc. in order to participate
|
||||
|
||||
### Build Dashboards
|
||||
|
||||
We are under the process of creating a [dashboard](https://sonrscan.io) in order to provide key metrics to our stakeholders
|
||||
|
||||
- **Technology**: Pricing, total fees paid, total storage used, uptime
|
||||
- **Governance**: Identities, proposal outcomes, community participation
|
||||
|
||||
### Polling System
|
||||
|
||||
Our initial polling system will be token weighted and not enforceable, in order to build engagement.
|
||||
|
||||
- Users will submit qualitative updates to the system and have them up/downvoted
|
||||
- The core team will then assess the submissions and select viable community suggestions into upgrades
|
||||
- Along side this, our team will locate and commission the development of a proposal for any technical upgrades without enforceable code proposals
|
||||
- We will be able to provide clarity, external security, and in applicable cases the economic evaluation from the impacts of proposals to the community.
|
||||
|
||||
## Second Rollout Phase
|
||||
|
||||
Phase 2 will be underway in the months prior to main-net deployment, along with an extensive security audit.
|
||||
|
||||
### On-Chain Execution
|
||||
|
||||
We will be introducing an on-chain, executable code-based governance system in stages with majority rule voting.
|
||||
|
||||
**Stage 1:** Grants Program
|
||||
|
||||
- Incorporate community voting for grant recipient selection
|
||||
- Allow users to submit proposals for grant allocation
|
||||
|
||||
**Stage 2:** Subsidies and Rewards
|
||||
|
||||
- Proposals to update subsidies and rewards can be submitted by Core Sonr Team or third parties
|
||||
- Core Team will be responsible for considering funding security, and economic audits for proposals
|
||||
|
||||
**Stage 3:** Technical Upgrades
|
||||
|
||||
- These include pricing, security, and bug fixes
|
||||
- Proposals will be spearheaded by the Sonr Team and/or its delegates
|
||||
|
||||
### Maintenance
|
||||
|
||||
When on-chain governance has come to fruition, the core Sonr team will be also maintaining the polling-based system with subsidized development to minimize barrier to entry. This will be incorporating governance within the Motor Nebula Widget itself.
|
||||
@@ -1,24 +0,0 @@
|
||||
---
|
||||
title: "Rewards"
|
||||
sidebarTitle: "Network Rewards"
|
||||
description: "Incentivizing the Sonr Ecosystem"
|
||||
icon: "gem"
|
||||
---
|
||||
|
||||
In order to maximize buy-in and network availability for the Sonr ecosystem, we will be implementing an empirical Token Rewards mechanism. Rewards are a way to create inflation in order to dilute the token value, resulting in an affordable onboarding and operational experience for the end user. The goal behind Sonr Token rewards is to subsidize Highway based computation, in order to promote value creation and platform growth.
|
||||
|
||||
### Governance Participation
|
||||
|
||||
At the time of Main-net launch, phase one of the Sonr governance rollout will be implemented and will result in a set of rewards for participants.
|
||||
|
||||
**Submission of Proposals**
|
||||
|
||||
Users will be incentivized to submit blockchain improvement or grant proposals to be reviewed by voting participants. In order to prevent game from low quality and out of scope proposals, a clear-cut submission and evaluation process will be put into place on a public facing FAQ website.
|
||||
|
||||
- Proposers are required to stake before submission — _“Application Fee”_
|
||||
|
||||
**Proposal Voting**
|
||||
|
||||
In order to prevent innovation from halting on the Sonr ecosystem, we incentivize all staked users to participate in the polling process for community submitted proposals. Users are then rewarded for good-faith participation in voting, while also sustaining momentum.
|
||||
|
||||
- Existing Stakeholders are rewarded for good-faith participation in voting
|
||||
@@ -1,40 +0,0 @@
|
||||
---
|
||||
title: "Staking"
|
||||
sidebarTitle: "Staking Functions"
|
||||
description: "Understand the staking mechanism on Sonr"
|
||||
icon: "vault"
|
||||
---
|
||||
|
||||
The clear path for the underlying application for staking is utilizing a Delegated Proof of Stake (DPoS) validation mechanism. Down the line Sonr will provide IPFS storage nodes, and governance participation in the staking model.
|
||||
|
||||
<Tip>
|
||||
Demand = Obtain rewards, goods, or services through staking or locking up the token.
|
||||
Supply = Tokens staked or locked up.
|
||||
|
||||
</Tip>
|
||||
|
||||
On Sonr we will be leveraging a **delegate stake** mechanism in order to **optimize buy-in** for users in the network. It imposes an **excess opportunity cost** if **slashing** is implemented.
|
||||
|
||||
With this being said, there are some challenges in implementing staking:
|
||||
|
||||
- The token must already have value
|
||||
- Allocating power or influence via staking gives major edge to wealthy users
|
||||
- They are frequently subject to gaming and coordination problems
|
||||
|
||||
However there is substantial benefit in incorporating a staking mechanism, with the following criteria met we can create a sustainable design:
|
||||
|
||||
1. The upfront capital required to stake should not significantly discourage them to stake
|
||||
2. If a stakeholder group is making decisions that materially harm the network, they would be punished via slashing the stake.
|
||||
3. Stakeholders can make decisions that positively impact the future network health and token price, therefore holding stake can promote positive Sonr growth
|
||||
|
||||
### Validator Nodes for Cosmos ASB
|
||||
|
||||
Sonr is a Cosmos powered blockchain which is powered by a TenderMint validation mechanism. The default consensus for TenderMint is DPoS and works with our current ABCI implementation for Transaction Verification. DPoS is a twist on Proof of Stake consensus that relies upon a group of delegates to validate blocks on behalf of all nodes in the network . Witnesses are elected by stakeholders at a rate of one vote per share per witness . Coin age is irrelevant. All coins that are mature will add the same staking weight (usually 1 in the wallet hover display) Results in stable, consistent interest only for active wallets and only with small inputs.
|
||||
|
||||
### IPFS Storage Nodes (excluding FileCoin)
|
||||
|
||||
When deploying standalone highway nodes, requiring minimum stake would be an additional method to enforce availability requirements. By having a stake we can ensure that the user deploying a node has a base level of buy-in within the ecosystem.
|
||||
|
||||
### Governance Participants
|
||||
|
||||
We will be incorporating a similar strategy to AlgoRand in our governance rollout. This is covered more extensively in the [Governance](https://www.notion.so/Governance-af1251b1b7aa41fab16c53dd9fe6ef63) section.
|
||||
@@ -1,201 +0,0 @@
|
||||
---
|
||||
title: Utility
|
||||
description: Use cases and utility functions of the SNR token including staking, governance, and network operations
|
||||
sidebarTitle: "Network Utility"
|
||||
icon: "cog"
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
The SNR token serves as the native utility token of the Sonr network, enabling various functions from transaction processing to governance participation. Its multi-faceted utility design ensures sustained demand and value accrual.
|
||||
|
||||
<Note>
|
||||
The SNR token's utility is designed to grow with the network, adding new use
|
||||
cases as the ecosystem expands while maintaining core functions for network
|
||||
security and operations.
|
||||
</Note>
|
||||
|
||||
## Core Utilities
|
||||
|
||||
### 1. Means of Payment
|
||||
|
||||
The primary utility of SNR is facilitating transactions across the Sonr blockchain for user account management and application operations.
|
||||
|
||||
<CardGroup>
|
||||
<Card title="Transaction Fees">
|
||||
All on-chain operations require SNR for gas fees and computational resources
|
||||
</Card>
|
||||
<Card title="Service Payments">
|
||||
Payment for Highway services, storage, and off-chain computation
|
||||
</Card>
|
||||
<Card title="Application Fees">
|
||||
Developers pay SNR to register and update applications on the network
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
### 2. Staking Mechanisms
|
||||
|
||||
SNR tokens enable network security and participation through various staking options:
|
||||
|
||||
#### Validator Staking
|
||||
|
||||
- **Minimum Stake**: Required SNR deposit to run a validator node
|
||||
- **Delegated Staking**: Users can delegate SNR to validators for rewards
|
||||
- **Slashing Protection**: Validators must maintain good behavior or risk stake loss
|
||||
|
||||
#### Service Node Staking
|
||||
|
||||
- **Highway Nodes**: Stake required for running Highway service nodes
|
||||
- **IPFS Storage**: Minimum stake for operating storage infrastructure
|
||||
- **Availability Guarantee**: Staking ensures node uptime and reliability
|
||||
|
||||
<Warning>
|
||||
Staking locks tokens for a specified period, reducing circulating supply while
|
||||
earning rewards for network participation.
|
||||
</Warning>
|
||||
|
||||
### 3. Governance Participation
|
||||
|
||||
SNR tokens grant voting power in the decentralized governance system:
|
||||
|
||||
<CardGroup>
|
||||
<Card title="Proposal Creation">
|
||||
Stake SNR to submit governance proposals with anti-spam mechanisms
|
||||
</Card>
|
||||
<Card title="Voting Rights">
|
||||
One token equals one vote in governance decisions
|
||||
</Card>
|
||||
<Card title="Participation Rewards">
|
||||
Earn SNR for active governance participation and quality proposals
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
## Module-Specific Operations
|
||||
|
||||
### Service Module (x/svc)
|
||||
|
||||
SNR tokens are required for service operations within the decentralized service marketplace:
|
||||
|
||||
- **Service Registration**: Pay SNR registration fees to claim unique TLD domains (e.g., `music.sonr`, `defi.sonr`)
|
||||
- **Capability Requests**: SNR deposits for requesting root capabilities via MPC signing
|
||||
- **Service Updates**: Fees for modifying service metadata or requesting additional permissions
|
||||
- **TLD Management**: Economic safeguards prevent domain squatting through registration fees
|
||||
|
||||
<Note>
|
||||
Service registration fees are burned or sent to the community pool based on
|
||||
governance parameters, creating deflationary pressure.
|
||||
</Note>
|
||||
|
||||
### DWN Module (x/dwn)
|
||||
|
||||
The DWN module enables revolutionary gasless onboarding while using SNR for advanced operations:
|
||||
|
||||
- **Gasless Vault Claiming**: Initial `MsgClaimVault` transactions require no SNR fees
|
||||
- **Vault Configuration**: SNR fees for updating vault settings and WASM runtime upgrades
|
||||
- **MPC Operations**: Transaction fees for multi-party computation within secure enclaves
|
||||
- **Cross-Chain Operations**: SNR payments for bridging assets and multi-chain vault management
|
||||
|
||||
### UCAN Module (x/ucan)
|
||||
|
||||
Authorization operations require SNR for security and spam prevention:
|
||||
|
||||
- **Root Capability Issuance**: SNR fees for initiating MPC threshold signing requests
|
||||
- **Revocation Processing**: Transaction fees for on-chain capability revocations
|
||||
- **Delegation Chain Verification**: Computational costs for validating complex authorization chains
|
||||
- **MPC Signing Participation**: Validator rewards for participating in multi-party computation
|
||||
|
||||
### DID Module (x/did)
|
||||
|
||||
Identity operations use SNR for registration and management:
|
||||
|
||||
- **DID Registration**: Fees for creating new decentralized identifiers
|
||||
- **Authentication Linking**: SNR costs for adding WebAuthn credentials or other auth methods
|
||||
- **Assertion Management**: Fees for linking/unlinking identity claims and verifications
|
||||
- **Transaction Execution**: SNR payments for UCAN-authorized transactions on behalf of DIDs
|
||||
|
||||
## Economic Mechanisms
|
||||
|
||||
### Demand Drivers
|
||||
|
||||
The token's value is driven by multiple demand sources:
|
||||
|
||||
```math
|
||||
\text{Demand} = \text{Transaction Volume} + \text{Staking Locked} + \text{Governance Participation}
|
||||
```
|
||||
|
||||
<CardGroup>
|
||||
<Card title="Network Growth">
|
||||
More users and applications increase transaction demand
|
||||
</Card>
|
||||
<Card title="Staking Returns">
|
||||
Attractive yields encourage long-term token locking
|
||||
</Card>
|
||||
<Card title="Utility Expansion">
|
||||
New features and services create additional use cases
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
### Supply Dynamics
|
||||
|
||||
Effective supply is reduced through:
|
||||
|
||||
- **Staking Lockups**: Validators and delegators lock tokens
|
||||
- **Governance Stakes**: Proposal creation requires token deposits
|
||||
- **Service Collateral**: Service providers stake SNR for TLD registration
|
||||
- **Fee Burns**: Partial fee burning reduces total supply
|
||||
|
||||
## Developer Incentives
|
||||
|
||||
### Service Development
|
||||
|
||||
- **Service Registration Subsidies**: Reduced TLD domain costs for verified developers
|
||||
- **Root Capability Grants**: Free MPC signing for approved service capabilities
|
||||
- **Revenue Sharing**: Earn portion of service interaction fees through UCAN delegation
|
||||
- **Integration Support**: Subsidized vault interaction costs for new services
|
||||
|
||||
### Infrastructure Provision
|
||||
|
||||
- **Validator Operations**: SNR staking rewards for consensus participation and MPC signing
|
||||
- **MPC Node Operations**: Additional rewards for multi-party computation services
|
||||
- **IPFS Storage**: Compensation for decentralized vault configuration storage
|
||||
- **UCAN Verification**: Fees for running delegation chain validation services
|
||||
|
||||
<Check>
|
||||
The SNR token creates a sustainable economic model where users, developers,
|
||||
and infrastructure providers all benefit from network growth.
|
||||
</Check>
|
||||
|
||||
## Future Utilities
|
||||
|
||||
### Enhanced Module Features
|
||||
|
||||
- **Advanced UCAN Features**: Zero-knowledge capability proofs and cross-chain validation
|
||||
- **Vault Upgrades**: Seamless WASM runtime updates and social recovery mechanisms
|
||||
- **Service Marketplace**: Categorized service discovery with reputation systems
|
||||
- **Multi-sig Services**: Shared service ownership through DAO governance
|
||||
|
||||
### Cross-Chain Integration
|
||||
|
||||
- **IBC UCAN Verification**: Cross-chain capability validation fees
|
||||
- **Multi-Chain Vault Operations**: Enhanced cross-chain asset management
|
||||
- **Bridge Service Registration**: Specialized TLD domains for bridge operators
|
||||
- **Interchain DID Resolution**: Cross-chain identity verification services
|
||||
|
||||
### Privacy and Security Enhancements
|
||||
|
||||
- **Privacy-Preserving MPC**: Enhanced secure multi-party computation features
|
||||
- **Conditional Revocations**: Time or event-based capability revocations
|
||||
- **Hardware Vault Support**: Integration with dedicated secure hardware
|
||||
- **AI-Powered Workflows**: Natural language vault command processing
|
||||
|
||||
## Utility Summary
|
||||
|
||||
The SNR token's utility encompasses:
|
||||
|
||||
1. **Essential Operations**: Core network functions and transactions
|
||||
2. **Security Provision**: Staking for network consensus and safety
|
||||
3. **Governance Rights**: Democratic participation in protocol decisions
|
||||
4. **Economic Incentives**: Rewards for valuable contributions
|
||||
5. **Access Control**: Gateway to premium features and services
|
||||
|
||||
This comprehensive utility design ensures the SNR token remains central to the Sonr ecosystem's growth and sustainability.
|
||||
@@ -1,235 +0,0 @@
|
||||
---
|
||||
title: Values
|
||||
description: Value proposition and economic principles underlying the SNR token and its role in the ecosystem
|
||||
sidebarTitle: "Core Values"
|
||||
icon: "heart"
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
The SNR token's value derives from fundamental economic principles, network utility, and carefully designed tokenomics. Understanding these value drivers helps participants make informed decisions about their involvement in the Sonr ecosystem.
|
||||
|
||||
<Note>
|
||||
Token value = Fundamental Value + Token-Specific Non-Fundamentals +
|
||||
Market/Industry Non-Fundamentals
|
||||
</Note>
|
||||
|
||||
## Fundamental Value Drivers
|
||||
|
||||
### Economic Activity
|
||||
|
||||
The core value proposition stems from actual network usage across Sonr's core modules:
|
||||
|
||||
```math
|
||||
\text{Fundamental Value} = \frac{\text{Economic Activity}}{\text{Circulating Supply} \times \text{Velocity}}
|
||||
```
|
||||
|
||||
<CardGroup>
|
||||
<Card title="Service Registration">
|
||||
TLD domain fees and capability requests through the Service module
|
||||
</Card>
|
||||
<Card title="Identity Operations">
|
||||
DID registration, authentication linking, and assertion management
|
||||
</Card>
|
||||
<Card title="Authorization Services">
|
||||
UCAN issuance, revocation processing, and MPC signing operations
|
||||
</Card>
|
||||
<Card title="Vault Operations">
|
||||
DWN configuration updates and cross-chain management beyond gasless claiming
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
### Network Effects
|
||||
|
||||
Value increases exponentially with network growth:
|
||||
|
||||
1. **User Growth**: More vault claims and DID registrations increase identity network value
|
||||
2. **Service Adoption**: More TLD registrations create a valuable service namespace
|
||||
3. **Developer Integration**: Services leveraging UCAN authorization expand utility
|
||||
4. **Validator Participation**: MPC signing nodes improve security and capability issuance
|
||||
|
||||
## Property Rights
|
||||
|
||||
The SNR token grants specific rights that create intrinsic value:
|
||||
|
||||
### Governance Rights
|
||||
|
||||
- **Protocol Decisions**: Vote on network upgrades and parameters
|
||||
- **Treasury Management**: Control community fund allocation
|
||||
- **Economic Policy**: Influence inflation and reward distribution
|
||||
|
||||
### Economic Rights
|
||||
|
||||
- **Staking Rewards**: Earn returns for securing the network
|
||||
- **Fee Sharing**: Participate in protocol revenue distribution
|
||||
- **Priority Access**: Enhanced service levels for token holders
|
||||
|
||||
### Network Access
|
||||
|
||||
- **Service Registration**: Required for claiming TLD domains and registering services
|
||||
- **Identity Management**: Essential for DID operations and authentication linking
|
||||
- **Capability Authorization**: Needed for UCAN issuance and delegation chain verification
|
||||
- **Vault Configuration**: Access to advanced vault features beyond gasless claiming
|
||||
|
||||
<Check>
|
||||
The combination of governance, economic, and access rights creates a
|
||||
comprehensive value proposition for SNR holders.
|
||||
</Check>
|
||||
|
||||
## Value Accrual Mechanisms
|
||||
|
||||
### Supply Reduction
|
||||
|
||||
Multiple mechanisms reduce effective token supply:
|
||||
|
||||
<CardGroup>
|
||||
<Card title="Staking Lockups">
|
||||
Validators and delegators lock tokens for rewards
|
||||
</Card>
|
||||
<Card title="Fee Burning">
|
||||
Portion of transaction fees permanently removed
|
||||
</Card>
|
||||
<Card title="Governance Deposits">Tokens locked for proposal creation</Card>
|
||||
<Card title="Service Registration">
|
||||
TLD domain registration fees create deflationary pressure
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
### Demand Growth
|
||||
|
||||
Sustainable demand drivers include:
|
||||
|
||||
1. **Organic Growth**: Natural increase in users and transactions
|
||||
2. **New Use Cases**: Expanding utility through development
|
||||
3. **Partnership Integration**: External protocols adopting SNR
|
||||
4. **Premium Features**: Advanced services requiring SNR payment
|
||||
|
||||
## Economic Sustainability
|
||||
|
||||
### Revenue Model
|
||||
|
||||
The network generates sustainable revenue through module-specific operations:
|
||||
|
||||
- **Service Module**: TLD domain registration fees and capability request deposits
|
||||
- **DID Module**: Identity registration, authentication linking, and assertion management fees
|
||||
- **UCAN Module**: Root capability issuance and revocation processing fees
|
||||
- **DWN Module**: Advanced vault configuration and cross-chain operation fees
|
||||
- **Validator Operations**: MPC signing participation and consensus rewards
|
||||
|
||||
### Cost Structure
|
||||
|
||||
Efficient operations maintain profitability:
|
||||
|
||||
- **MPC Infrastructure**: Multi-party computation hardware and coordination costs
|
||||
- **Module Development**: Ongoing improvements to Service, DID, UCAN, and DWN modules
|
||||
- **Security Audits**: WASM runtime, capability verification, and cryptographic audits
|
||||
- **Gasless Subsidies**: Network-funded vault claiming to remove onboarding barriers
|
||||
|
||||
## Market Dynamics
|
||||
|
||||
### Price Discovery
|
||||
|
||||
Token price reflects multiple factors:
|
||||
|
||||
<Warning>
|
||||
While fundamental value provides a baseline, market sentiment and external
|
||||
factors significantly influence short-term price movements.
|
||||
</Warning>
|
||||
|
||||
### Non-Fundamental Factors
|
||||
|
||||
#### Token-Specific
|
||||
|
||||
- Marketing campaigns and viral growth
|
||||
- Exchange listings and liquidity
|
||||
- Partnership announcements
|
||||
- Technical milestones
|
||||
|
||||
#### Market-Wide
|
||||
|
||||
- Cryptocurrency market cycles
|
||||
- Regulatory developments
|
||||
- Macroeconomic conditions
|
||||
- Technology trends
|
||||
|
||||
## Value Propositions
|
||||
|
||||
### For Users
|
||||
|
||||
1. **Digital Sovereignty**: Control your DID and vault without intermediaries
|
||||
2. **Gasless Onboarding**: Free vault claiming removes barriers to entry
|
||||
3. **Seamless Authentication**: WebAuthn integration with hardware-backed security
|
||||
4. **UCAN Authorization**: Granular, revocable permissions replace dangerous unlimited approvals
|
||||
|
||||
### For Developers
|
||||
|
||||
1. **Service Registration**: Claim unique TLD domains for decentralized services
|
||||
2. **UCAN Integration**: Built-in authorization system with capability delegation
|
||||
3. **Identity Infrastructure**: Native DID support with WebAuthn authentication
|
||||
4. **Revenue Models**: Earn through UCAN-mediated service interactions and fee sharing
|
||||
|
||||
### For Validators
|
||||
|
||||
1. **MPC Signing Rewards**: Additional compensation for multi-party computation participation
|
||||
2. **Capability Issuance**: Central role in root UCAN creation through threshold signing
|
||||
3. **Network Security**: Staking rewards for consensus participation and vault protection
|
||||
4. **Governance Influence**: Vote on protocol parameters and module improvements
|
||||
|
||||
### For Investors
|
||||
|
||||
1. **Module Expansion**: Growing utility across Service, DID, UCAN, and DWN modules
|
||||
2. **Deflationary Pressure**: Service registration fees and transaction burns reduce supply
|
||||
3. **Identity Network Effects**: Value compounds as more DIDs and services join the ecosystem
|
||||
4. **Technical Innovation**: Cutting-edge MPC, WASM, and WebAuthn integration
|
||||
|
||||
## Comparative Advantages
|
||||
|
||||
### vs. Traditional Systems
|
||||
|
||||
- **No Intermediaries**: Direct value transfer
|
||||
- **Global Access**: Permissionless participation
|
||||
- **Transparency**: On-chain verification
|
||||
- **User Control**: Self-sovereign identity
|
||||
|
||||
### vs. Other Blockchains
|
||||
|
||||
- **Native Authorization**: Built-in UCAN capability system replaces external auth
|
||||
- **Gasless Onboarding**: Free vault claiming removes crypto barriers
|
||||
- **MPC Security**: Multi-party computation eliminates single points of failure
|
||||
- **WebAuthn Integration**: Hardware-backed authentication without seed phrase management
|
||||
|
||||
## Long-Term Value Thesis
|
||||
|
||||
### Sustainable Growth
|
||||
|
||||
The SNR token's value proposition centers on:
|
||||
|
||||
1. **Real Utility**: Actual usage drives demand
|
||||
2. **Network Effects**: Growth compounds value
|
||||
3. **Economic Alignment**: All participants benefit
|
||||
4. **Technical Innovation**: Continuous improvement
|
||||
|
||||
### Value Metrics
|
||||
|
||||
Key indicators of fundamental value:
|
||||
|
||||
<CardGroup>
|
||||
<Card title="Vault Claims">
|
||||
Growing number of gasless vault registrations
|
||||
</Card>
|
||||
<Card title="Service Registrations">
|
||||
TLD domain claims and capability requests
|
||||
</Card>
|
||||
<Card title="UCAN Issuance">
|
||||
Authorization activity and delegation chains
|
||||
</Card>
|
||||
<Card title="MPC Participation">
|
||||
Validator involvement in threshold signing
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
<Note>
|
||||
The SNR token represents ownership in a new paradigm of user-controlled
|
||||
internet infrastructure, with value derived from real utility, network
|
||||
effects, and sustainable economics.
|
||||
</Note>
|
||||
@@ -1,173 +0,0 @@
|
||||
---
|
||||
title: "@sonr.io/ui"
|
||||
sidebarTitle: "@sonr.io/ui"
|
||||
description: "A package for Sonr's centralized shadcn/ui component library"
|
||||
icon: "palette"
|
||||
---
|
||||
|
||||
# @sonr.io/ui
|
||||
|
||||
## Overview
|
||||
|
||||
The `@sonr.io/ui` package serves as our centralized shadcn/ui component library, providing a consistent and accessible design system across Sonr's ecosystem. Leveraging the power of shadcn/ui, we've created a fully customizable and type-safe component library with a primary color of `#17c2ff`.
|
||||
|
||||
<Callout type="info">
|
||||
Our UI package is built to provide maximum flexibility while maintaining
|
||||
strict design consistency.
|
||||
</Callout>
|
||||
|
||||
## Component Migration Strategy
|
||||
|
||||
### Before: Custom Button Component
|
||||
|
||||
Previously, our Button component relied on manual variant classes and custom implementations:
|
||||
|
||||
```tsx
|
||||
// Old Implementation
|
||||
const Button = ({ variant, className, ...props }) => {
|
||||
const variantClasses = {
|
||||
primary: "bg-blue-500 text-white",
|
||||
secondary: "bg-gray-200 text-black",
|
||||
// Multiple manual variant definitions
|
||||
};
|
||||
|
||||
return (
|
||||
<button className={`${variantClasses[variant]} ${className}`} {...props} />
|
||||
);
|
||||
};
|
||||
```
|
||||
|
||||
### After: Shadcn Button Implementation
|
||||
|
||||
Our new implementation uses `cva` (class-variance-authority) and the `cn` utility for robust variant management:
|
||||
|
||||
```tsx
|
||||
// New Implementation
|
||||
import { buttonVariants } from "@sonr.io/ui/components/ui/button";
|
||||
import { cn } from "@sonr.io/ui/lib/utils";
|
||||
|
||||
const Button = ({
|
||||
variant = "default",
|
||||
size = "default",
|
||||
className,
|
||||
...props
|
||||
}) => {
|
||||
return (
|
||||
<button
|
||||
className={cn(buttonVariants({ variant, size }), className)}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
};
|
||||
```
|
||||
|
||||
<Callout type="success">
|
||||
Key Improvements: - Type-safe variant management - Enhanced accessibility -
|
||||
Consistent theming - Reduced bundle size
|
||||
</Callout>
|
||||
|
||||
## Theme Configuration
|
||||
|
||||
### Color System
|
||||
|
||||
Our primary theme color is `#17c2ff`, defined in HSL format for maximum flexibility:
|
||||
|
||||
```css
|
||||
:root {
|
||||
--primary-h: 200; /* Hue */
|
||||
--primary-s: 100%; /* Saturation */
|
||||
--primary-l: 59%; /* Lightness */
|
||||
--primary: hsl(var(--primary-h), var(--primary-s), var(--primary-l));
|
||||
}
|
||||
```
|
||||
|
||||
### CSS Variables Structure
|
||||
|
||||
```css
|
||||
:root {
|
||||
--background: 0 0% 100%;
|
||||
--foreground: 240 10% 3.9%;
|
||||
--primary: 200 100% 59%;
|
||||
--primary-foreground: 210 40% 98%;
|
||||
--secondary: 220 14.3% 95.9%;
|
||||
--secondary-foreground: 220.9 39.3% 11%;
|
||||
/* Additional theme variables */
|
||||
}
|
||||
```
|
||||
|
||||
## Usage Guide
|
||||
|
||||
### Importing Components
|
||||
|
||||
Import components directly from the `@sonr.io/ui` package:
|
||||
|
||||
```tsx
|
||||
import { Button } from "@sonr.io/ui/components/ui/button";
|
||||
import { Input } from "@sonr.io/ui/components/ui/input";
|
||||
```
|
||||
|
||||
### Adding New Components
|
||||
|
||||
Use the shadcn CLI within the `packages/ui` directory:
|
||||
|
||||
```bash
|
||||
# Navigate to packages/ui
|
||||
cd packages/ui
|
||||
|
||||
# Add a new component
|
||||
npx shadcn-ui@latest add button
|
||||
```
|
||||
|
||||
<Callout type="warning">
|
||||
Always add components from the `packages/ui` directory to maintain our
|
||||
centralized component management.
|
||||
</Callout>
|
||||
|
||||
## Architecture Patterns
|
||||
|
||||
### Monorepo Structure
|
||||
|
||||
```
|
||||
sonr/
|
||||
├── packages/
|
||||
│ └── ui/
|
||||
│ ├── components/
|
||||
│ │ └── ui/
|
||||
│ │ ├── button.tsx
|
||||
│ │ ├── input.tsx
|
||||
│ │ └── ...
|
||||
│ ├── lib/
|
||||
│ │ └── utils.ts
|
||||
│ └── styles/
|
||||
│ └── globals.css
|
||||
```
|
||||
|
||||
### Key Principles
|
||||
|
||||
- **Single Source of Truth**: All UI components live in `packages/ui`
|
||||
- **No Local `components.json`**: Centralized configuration
|
||||
- **Turbo-powered Build Pipeline**: Efficient component compilation
|
||||
|
||||
## Global Styles Integration
|
||||
|
||||
In your application's main entry point:
|
||||
|
||||
```tsx
|
||||
import "@sonr.io/ui/styles/globals.css";
|
||||
|
||||
function MyApp({ Component, pageProps }) {
|
||||
return <Component {...pageProps} />;
|
||||
}
|
||||
```
|
||||
|
||||
## Best Practices
|
||||
|
||||
1. Always use the centralized components from `@sonr.io/ui`
|
||||
2. Prefer `cn()` utility for dynamic className composition
|
||||
3. Leverage TypeScript for type-safe component usage
|
||||
4. Use CSS variables for theming consistency
|
||||
|
||||
<Callout type="tip">
|
||||
Remember: Our UI library is designed to be both flexible and consistent. When
|
||||
in doubt, refer to the components in `@sonr.io/ui`.
|
||||
</Callout>
|
||||
@@ -1,173 +0,0 @@
|
||||
---
|
||||
title: "@sonr.io/ui"
|
||||
sidebarTitle: "@sonr.io/ui"
|
||||
description: "A package for Sonr's centralized shadcn/ui component library"
|
||||
icon: "palette"
|
||||
---
|
||||
|
||||
# @sonr.io/ui
|
||||
|
||||
## Overview
|
||||
|
||||
The `@sonr.io/ui` package serves as our centralized shadcn/ui component library, providing a consistent and accessible design system across Sonr's ecosystem. Leveraging the power of shadcn/ui, we've created a fully customizable and type-safe component library with a primary color of `#17c2ff`.
|
||||
|
||||
<Callout type="info">
|
||||
Our UI package is built to provide maximum flexibility while maintaining
|
||||
strict design consistency.
|
||||
</Callout>
|
||||
|
||||
## Component Migration Strategy
|
||||
|
||||
### Before: Custom Button Component
|
||||
|
||||
Previously, our Button component relied on manual variant classes and custom implementations:
|
||||
|
||||
```tsx
|
||||
// Old Implementation
|
||||
const Button = ({ variant, className, ...props }) => {
|
||||
const variantClasses = {
|
||||
primary: "bg-blue-500 text-white",
|
||||
secondary: "bg-gray-200 text-black",
|
||||
// Multiple manual variant definitions
|
||||
};
|
||||
|
||||
return (
|
||||
<button className={`${variantClasses[variant]} ${className}`} {...props} />
|
||||
);
|
||||
};
|
||||
```
|
||||
|
||||
### After: Shadcn Button Implementation
|
||||
|
||||
Our new implementation uses `cva` (class-variance-authority) and the `cn` utility for robust variant management:
|
||||
|
||||
```tsx
|
||||
// New Implementation
|
||||
import { buttonVariants } from "@sonr.io/ui/components/ui/button";
|
||||
import { cn } from "@sonr.io/ui/lib/utils";
|
||||
|
||||
const Button = ({
|
||||
variant = "default",
|
||||
size = "default",
|
||||
className,
|
||||
...props
|
||||
}) => {
|
||||
return (
|
||||
<button
|
||||
className={cn(buttonVariants({ variant, size }), className)}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
};
|
||||
```
|
||||
|
||||
<Callout type="success">
|
||||
Key Improvements: - Type-safe variant management - Enhanced accessibility -
|
||||
Consistent theming - Reduced bundle size
|
||||
</Callout>
|
||||
|
||||
## Theme Configuration
|
||||
|
||||
### Color System
|
||||
|
||||
Our primary theme color is `#17c2ff`, defined in HSL format for maximum flexibility:
|
||||
|
||||
```css
|
||||
:root {
|
||||
--primary-h: 200; /* Hue */
|
||||
--primary-s: 100%; /* Saturation */
|
||||
--primary-l: 59%; /* Lightness */
|
||||
--primary: hsl(var(--primary-h), var(--primary-s), var(--primary-l));
|
||||
}
|
||||
```
|
||||
|
||||
### CSS Variables Structure
|
||||
|
||||
```css
|
||||
:root {
|
||||
--background: 0 0% 100%;
|
||||
--foreground: 240 10% 3.9%;
|
||||
--primary: 200 100% 59%;
|
||||
--primary-foreground: 210 40% 98%;
|
||||
--secondary: 220 14.3% 95.9%;
|
||||
--secondary-foreground: 220.9 39.3% 11%;
|
||||
/* Additional theme variables */
|
||||
}
|
||||
```
|
||||
|
||||
## Usage Guide
|
||||
|
||||
### Importing Components
|
||||
|
||||
Import components directly from the `@sonr.io/ui` package:
|
||||
|
||||
```tsx
|
||||
import { Button } from "@sonr.io/ui/components/ui/button";
|
||||
import { Input } from "@sonr.io/ui/components/ui/input";
|
||||
```
|
||||
|
||||
### Adding New Components
|
||||
|
||||
Use the shadcn CLI within the `packages/ui` directory:
|
||||
|
||||
```bash
|
||||
# Navigate to packages/ui
|
||||
cd packages/ui
|
||||
|
||||
# Add a new component
|
||||
npx shadcn-ui@latest add button
|
||||
```
|
||||
|
||||
<Callout type="warning">
|
||||
Always add components from the `packages/ui` directory to maintain our
|
||||
centralized component management.
|
||||
</Callout>
|
||||
|
||||
## Architecture Patterns
|
||||
|
||||
### Monorepo Structure
|
||||
|
||||
```
|
||||
sonr/
|
||||
├── packages/
|
||||
│ └── ui/
|
||||
│ ├── components/
|
||||
│ │ └── ui/
|
||||
│ │ ├── button.tsx
|
||||
│ │ ├── input.tsx
|
||||
│ │ └── ...
|
||||
│ ├── lib/
|
||||
│ │ └── utils.ts
|
||||
│ └── styles/
|
||||
│ └── globals.css
|
||||
```
|
||||
|
||||
### Key Principles
|
||||
|
||||
- **Single Source of Truth**: All UI components live in `packages/ui`
|
||||
- **No Local `components.json`**: Centralized configuration
|
||||
- **Turbo-powered Build Pipeline**: Efficient component compilation
|
||||
|
||||
## Global Styles Integration
|
||||
|
||||
In your application's main entry point:
|
||||
|
||||
```tsx
|
||||
import "@sonr.io/ui/styles/globals.css";
|
||||
|
||||
function MyApp({ Component, pageProps }) {
|
||||
return <Component {...pageProps} />;
|
||||
}
|
||||
```
|
||||
|
||||
## Best Practices
|
||||
|
||||
1. Always use the centralized components from `@sonr.io/ui`
|
||||
2. Prefer `cn()` utility for dynamic className composition
|
||||
3. Leverage TypeScript for type-safe component usage
|
||||
4. Use CSS variables for theming consistency
|
||||
|
||||
<Callout type="tip">
|
||||
Remember: Our UI library is designed to be both flexible and consistent. When
|
||||
in doubt, refer to the components in `@sonr.io/ui`.
|
||||
</Callout>
|
||||
@@ -1,173 +0,0 @@
|
||||
---
|
||||
title: "@sonr.io/ui"
|
||||
sidebarTitle: "@sonr.io/ui"
|
||||
description: "A package for Sonr's centralized shadcn/ui component library"
|
||||
icon: "palette"
|
||||
---
|
||||
|
||||
# @sonr.io/ui
|
||||
|
||||
## Overview
|
||||
|
||||
The `@sonr.io/ui` package serves as our centralized shadcn/ui component library, providing a consistent and accessible design system across Sonr's ecosystem. Leveraging the power of shadcn/ui, we've created a fully customizable and type-safe component library with a primary color of `#17c2ff`.
|
||||
|
||||
<Callout type="info">
|
||||
Our UI package is built to provide maximum flexibility while maintaining
|
||||
strict design consistency.
|
||||
</Callout>
|
||||
|
||||
## Component Migration Strategy
|
||||
|
||||
### Before: Custom Button Component
|
||||
|
||||
Previously, our Button component relied on manual variant classes and custom implementations:
|
||||
|
||||
```tsx
|
||||
// Old Implementation
|
||||
const Button = ({ variant, className, ...props }) => {
|
||||
const variantClasses = {
|
||||
primary: "bg-blue-500 text-white",
|
||||
secondary: "bg-gray-200 text-black",
|
||||
// Multiple manual variant definitions
|
||||
};
|
||||
|
||||
return (
|
||||
<button className={`${variantClasses[variant]} ${className}`} {...props} />
|
||||
);
|
||||
};
|
||||
```
|
||||
|
||||
### After: Shadcn Button Implementation
|
||||
|
||||
Our new implementation uses `cva` (class-variance-authority) and the `cn` utility for robust variant management:
|
||||
|
||||
```tsx
|
||||
// New Implementation
|
||||
import { buttonVariants } from "@sonr.io/ui/components/ui/button";
|
||||
import { cn } from "@sonr.io/ui/lib/utils";
|
||||
|
||||
const Button = ({
|
||||
variant = "default",
|
||||
size = "default",
|
||||
className,
|
||||
...props
|
||||
}) => {
|
||||
return (
|
||||
<button
|
||||
className={cn(buttonVariants({ variant, size }), className)}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
};
|
||||
```
|
||||
|
||||
<Callout type="success">
|
||||
Key Improvements: - Type-safe variant management - Enhanced accessibility -
|
||||
Consistent theming - Reduced bundle size
|
||||
</Callout>
|
||||
|
||||
## Theme Configuration
|
||||
|
||||
### Color System
|
||||
|
||||
Our primary theme color is `#17c2ff`, defined in HSL format for maximum flexibility:
|
||||
|
||||
```css
|
||||
:root {
|
||||
--primary-h: 200; /* Hue */
|
||||
--primary-s: 100%; /* Saturation */
|
||||
--primary-l: 59%; /* Lightness */
|
||||
--primary: hsl(var(--primary-h), var(--primary-s), var(--primary-l));
|
||||
}
|
||||
```
|
||||
|
||||
### CSS Variables Structure
|
||||
|
||||
```css
|
||||
:root {
|
||||
--background: 0 0% 100%;
|
||||
--foreground: 240 10% 3.9%;
|
||||
--primary: 200 100% 59%;
|
||||
--primary-foreground: 210 40% 98%;
|
||||
--secondary: 220 14.3% 95.9%;
|
||||
--secondary-foreground: 220.9 39.3% 11%;
|
||||
/* Additional theme variables */
|
||||
}
|
||||
```
|
||||
|
||||
## Usage Guide
|
||||
|
||||
### Importing Components
|
||||
|
||||
Import components directly from the `@sonr.io/ui` package:
|
||||
|
||||
```tsx
|
||||
import { Button } from "@sonr.io/ui/components/ui/button";
|
||||
import { Input } from "@sonr.io/ui/components/ui/input";
|
||||
```
|
||||
|
||||
### Adding New Components
|
||||
|
||||
Use the shadcn CLI within the `packages/ui` directory:
|
||||
|
||||
```bash
|
||||
# Navigate to packages/ui
|
||||
cd packages/ui
|
||||
|
||||
# Add a new component
|
||||
npx shadcn-ui@latest add button
|
||||
```
|
||||
|
||||
<Callout type="warning">
|
||||
Always add components from the `packages/ui` directory to maintain our
|
||||
centralized component management.
|
||||
</Callout>
|
||||
|
||||
## Architecture Patterns
|
||||
|
||||
### Monorepo Structure
|
||||
|
||||
```
|
||||
sonr/
|
||||
├── packages/
|
||||
│ └── ui/
|
||||
│ ├── components/
|
||||
│ │ └── ui/
|
||||
│ │ ├── button.tsx
|
||||
│ │ ├── input.tsx
|
||||
│ │ └── ...
|
||||
│ ├── lib/
|
||||
│ │ └── utils.ts
|
||||
│ └── styles/
|
||||
│ └── globals.css
|
||||
```
|
||||
|
||||
### Key Principles
|
||||
|
||||
- **Single Source of Truth**: All UI components live in `packages/ui`
|
||||
- **No Local `components.json`**: Centralized configuration
|
||||
- **Turbo-powered Build Pipeline**: Efficient component compilation
|
||||
|
||||
## Global Styles Integration
|
||||
|
||||
In your application's main entry point:
|
||||
|
||||
```tsx
|
||||
import "@sonr.io/ui/styles/globals.css";
|
||||
|
||||
function MyApp({ Component, pageProps }) {
|
||||
return <Component {...pageProps} />;
|
||||
}
|
||||
```
|
||||
|
||||
## Best Practices
|
||||
|
||||
1. Always use the centralized components from `@sonr.io/ui`
|
||||
2. Prefer `cn()` utility for dynamic className composition
|
||||
3. Leverage TypeScript for type-safe component usage
|
||||
4. Use CSS variables for theming consistency
|
||||
|
||||
<Callout type="tip">
|
||||
Remember: Our UI library is designed to be both flexible and consistent. When
|
||||
in doubt, refer to the components in `@sonr.io/ui`.
|
||||
</Callout>
|
||||
@@ -1,173 +0,0 @@
|
||||
---
|
||||
title: "@sonr.io/ui"
|
||||
sidebarTitle: "@sonr.io/ui"
|
||||
description: "A package for Sonr's centralized shadcn/ui component library"
|
||||
icon: "palette"
|
||||
---
|
||||
|
||||
# @sonr.io/ui
|
||||
|
||||
## Overview
|
||||
|
||||
The `@sonr.io/ui` package serves as our centralized shadcn/ui component library, providing a consistent and accessible design system across Sonr's ecosystem. Leveraging the power of shadcn/ui, we've created a fully customizable and type-safe component library with a primary color of `#17c2ff`.
|
||||
|
||||
<Callout type="info">
|
||||
Our UI package is built to provide maximum flexibility while maintaining
|
||||
strict design consistency.
|
||||
</Callout>
|
||||
|
||||
## Component Migration Strategy
|
||||
|
||||
### Before: Custom Button Component
|
||||
|
||||
Previously, our Button component relied on manual variant classes and custom implementations:
|
||||
|
||||
```tsx
|
||||
// Old Implementation
|
||||
const Button = ({ variant, className, ...props }) => {
|
||||
const variantClasses = {
|
||||
primary: "bg-blue-500 text-white",
|
||||
secondary: "bg-gray-200 text-black",
|
||||
// Multiple manual variant definitions
|
||||
};
|
||||
|
||||
return (
|
||||
<button className={`${variantClasses[variant]} ${className}`} {...props} />
|
||||
);
|
||||
};
|
||||
```
|
||||
|
||||
### After: Shadcn Button Implementation
|
||||
|
||||
Our new implementation uses `cva` (class-variance-authority) and the `cn` utility for robust variant management:
|
||||
|
||||
```tsx
|
||||
// New Implementation
|
||||
import { buttonVariants } from "@sonr.io/ui/components/ui/button";
|
||||
import { cn } from "@sonr.io/ui/lib/utils";
|
||||
|
||||
const Button = ({
|
||||
variant = "default",
|
||||
size = "default",
|
||||
className,
|
||||
...props
|
||||
}) => {
|
||||
return (
|
||||
<button
|
||||
className={cn(buttonVariants({ variant, size }), className)}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
};
|
||||
```
|
||||
|
||||
<Callout type="success">
|
||||
Key Improvements: - Type-safe variant management - Enhanced accessibility -
|
||||
Consistent theming - Reduced bundle size
|
||||
</Callout>
|
||||
|
||||
## Theme Configuration
|
||||
|
||||
### Color System
|
||||
|
||||
Our primary theme color is `#17c2ff`, defined in HSL format for maximum flexibility:
|
||||
|
||||
```css
|
||||
:root {
|
||||
--primary-h: 200; /* Hue */
|
||||
--primary-s: 100%; /* Saturation */
|
||||
--primary-l: 59%; /* Lightness */
|
||||
--primary: hsl(var(--primary-h), var(--primary-s), var(--primary-l));
|
||||
}
|
||||
```
|
||||
|
||||
### CSS Variables Structure
|
||||
|
||||
```css
|
||||
:root {
|
||||
--background: 0 0% 100%;
|
||||
--foreground: 240 10% 3.9%;
|
||||
--primary: 200 100% 59%;
|
||||
--primary-foreground: 210 40% 98%;
|
||||
--secondary: 220 14.3% 95.9%;
|
||||
--secondary-foreground: 220.9 39.3% 11%;
|
||||
/* Additional theme variables */
|
||||
}
|
||||
```
|
||||
|
||||
## Usage Guide
|
||||
|
||||
### Importing Components
|
||||
|
||||
Import components directly from the `@sonr.io/ui` package:
|
||||
|
||||
```tsx
|
||||
import { Button } from "@sonr.io/ui/components/ui/button";
|
||||
import { Input } from "@sonr.io/ui/components/ui/input";
|
||||
```
|
||||
|
||||
### Adding New Components
|
||||
|
||||
Use the shadcn CLI within the `packages/ui` directory:
|
||||
|
||||
```bash
|
||||
# Navigate to packages/ui
|
||||
cd packages/ui
|
||||
|
||||
# Add a new component
|
||||
npx shadcn-ui@latest add button
|
||||
```
|
||||
|
||||
<Callout type="warning">
|
||||
Always add components from the `packages/ui` directory to maintain our
|
||||
centralized component management.
|
||||
</Callout>
|
||||
|
||||
## Architecture Patterns
|
||||
|
||||
### Monorepo Structure
|
||||
|
||||
```
|
||||
sonr/
|
||||
├── packages/
|
||||
│ └── ui/
|
||||
│ ├── components/
|
||||
│ │ └── ui/
|
||||
│ │ ├── button.tsx
|
||||
│ │ ├── input.tsx
|
||||
│ │ └── ...
|
||||
│ ├── lib/
|
||||
│ │ └── utils.ts
|
||||
│ └── styles/
|
||||
│ └── globals.css
|
||||
```
|
||||
|
||||
### Key Principles
|
||||
|
||||
- **Single Source of Truth**: All UI components live in `packages/ui`
|
||||
- **No Local `components.json`**: Centralized configuration
|
||||
- **Turbo-powered Build Pipeline**: Efficient component compilation
|
||||
|
||||
## Global Styles Integration
|
||||
|
||||
In your application's main entry point:
|
||||
|
||||
```tsx
|
||||
import "@sonr.io/ui/styles/globals.css";
|
||||
|
||||
function MyApp({ Component, pageProps }) {
|
||||
return <Component {...pageProps} />;
|
||||
}
|
||||
```
|
||||
|
||||
## Best Practices
|
||||
|
||||
1. Always use the centralized components from `@sonr.io/ui`
|
||||
2. Prefer `cn()` utility for dynamic className composition
|
||||
3. Leverage TypeScript for type-safe component usage
|
||||
4. Use CSS variables for theming consistency
|
||||
|
||||
<Callout type="tip">
|
||||
Remember: Our UI library is designed to be both flexible and consistent. When
|
||||
in doubt, refer to the components in `@sonr.io/ui`.
|
||||
</Callout>
|
||||
@@ -1,173 +0,0 @@
|
||||
---
|
||||
title: "@sonr.io/ui"
|
||||
sidebarTitle: "@sonr.io/ui"
|
||||
description: "A package for Sonr's centralized shadcn/ui component library"
|
||||
icon: "palette"
|
||||
---
|
||||
|
||||
# @sonr.io/ui
|
||||
|
||||
## Overview
|
||||
|
||||
The `@sonr.io/ui` package serves as our centralized shadcn/ui component library, providing a consistent and accessible design system across Sonr's ecosystem. Leveraging the power of shadcn/ui, we've created a fully customizable and type-safe component library with a primary color of `#17c2ff`.
|
||||
|
||||
<Callout type="info">
|
||||
Our UI package is built to provide maximum flexibility while maintaining
|
||||
strict design consistency.
|
||||
</Callout>
|
||||
|
||||
## Component Migration Strategy
|
||||
|
||||
### Before: Custom Button Component
|
||||
|
||||
Previously, our Button component relied on manual variant classes and custom implementations:
|
||||
|
||||
```tsx
|
||||
// Old Implementation
|
||||
const Button = ({ variant, className, ...props }) => {
|
||||
const variantClasses = {
|
||||
primary: "bg-blue-500 text-white",
|
||||
secondary: "bg-gray-200 text-black",
|
||||
// Multiple manual variant definitions
|
||||
};
|
||||
|
||||
return (
|
||||
<button className={`${variantClasses[variant]} ${className}`} {...props} />
|
||||
);
|
||||
};
|
||||
```
|
||||
|
||||
### After: Shadcn Button Implementation
|
||||
|
||||
Our new implementation uses `cva` (class-variance-authority) and the `cn` utility for robust variant management:
|
||||
|
||||
```tsx
|
||||
// New Implementation
|
||||
import { buttonVariants } from "@sonr.io/ui/components/ui/button";
|
||||
import { cn } from "@sonr.io/ui/lib/utils";
|
||||
|
||||
const Button = ({
|
||||
variant = "default",
|
||||
size = "default",
|
||||
className,
|
||||
...props
|
||||
}) => {
|
||||
return (
|
||||
<button
|
||||
className={cn(buttonVariants({ variant, size }), className)}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
};
|
||||
```
|
||||
|
||||
<Callout type="success">
|
||||
Key Improvements: - Type-safe variant management - Enhanced accessibility -
|
||||
Consistent theming - Reduced bundle size
|
||||
</Callout>
|
||||
|
||||
## Theme Configuration
|
||||
|
||||
### Color System
|
||||
|
||||
Our primary theme color is `#17c2ff`, defined in HSL format for maximum flexibility:
|
||||
|
||||
```css
|
||||
:root {
|
||||
--primary-h: 200; /* Hue */
|
||||
--primary-s: 100%; /* Saturation */
|
||||
--primary-l: 59%; /* Lightness */
|
||||
--primary: hsl(var(--primary-h), var(--primary-s), var(--primary-l));
|
||||
}
|
||||
```
|
||||
|
||||
### CSS Variables Structure
|
||||
|
||||
```css
|
||||
:root {
|
||||
--background: 0 0% 100%;
|
||||
--foreground: 240 10% 3.9%;
|
||||
--primary: 200 100% 59%;
|
||||
--primary-foreground: 210 40% 98%;
|
||||
--secondary: 220 14.3% 95.9%;
|
||||
--secondary-foreground: 220.9 39.3% 11%;
|
||||
/* Additional theme variables */
|
||||
}
|
||||
```
|
||||
|
||||
## Usage Guide
|
||||
|
||||
### Importing Components
|
||||
|
||||
Import components directly from the `@sonr.io/ui` package:
|
||||
|
||||
```tsx
|
||||
import { Button } from "@sonr.io/ui/components/ui/button";
|
||||
import { Input } from "@sonr.io/ui/components/ui/input";
|
||||
```
|
||||
|
||||
### Adding New Components
|
||||
|
||||
Use the shadcn CLI within the `packages/ui` directory:
|
||||
|
||||
```bash
|
||||
# Navigate to packages/ui
|
||||
cd packages/ui
|
||||
|
||||
# Add a new component
|
||||
npx shadcn-ui@latest add button
|
||||
```
|
||||
|
||||
<Callout type="warning">
|
||||
Always add components from the `packages/ui` directory to maintain our
|
||||
centralized component management.
|
||||
</Callout>
|
||||
|
||||
## Architecture Patterns
|
||||
|
||||
### Monorepo Structure
|
||||
|
||||
```
|
||||
sonr/
|
||||
├── packages/
|
||||
│ └── ui/
|
||||
│ ├── components/
|
||||
│ │ └── ui/
|
||||
│ │ ├── button.tsx
|
||||
│ │ ├── input.tsx
|
||||
│ │ └── ...
|
||||
│ ├── lib/
|
||||
│ │ └── utils.ts
|
||||
│ └── styles/
|
||||
│ └── globals.css
|
||||
```
|
||||
|
||||
### Key Principles
|
||||
|
||||
- **Single Source of Truth**: All UI components live in `packages/ui`
|
||||
- **No Local `components.json`**: Centralized configuration
|
||||
- **Turbo-powered Build Pipeline**: Efficient component compilation
|
||||
|
||||
## Global Styles Integration
|
||||
|
||||
In your application's main entry point:
|
||||
|
||||
```tsx
|
||||
import "@sonr.io/ui/styles/globals.css";
|
||||
|
||||
function MyApp({ Component, pageProps }) {
|
||||
return <Component {...pageProps} />;
|
||||
}
|
||||
```
|
||||
|
||||
## Best Practices
|
||||
|
||||
1. Always use the centralized components from `@sonr.io/ui`
|
||||
2. Prefer `cn()` utility for dynamic className composition
|
||||
3. Leverage TypeScript for type-safe component usage
|
||||
4. Use CSS variables for theming consistency
|
||||
|
||||
<Callout type="tip">
|
||||
Remember: Our UI library is designed to be both flexible and consistent. When
|
||||
in doubt, refer to the components in `@sonr.io/ui`.
|
||||
</Callout>
|
||||
@@ -1,447 +0,0 @@
|
||||
---
|
||||
title: "MPC Vault System Security Audit Report"
|
||||
sidebarTitle: "Executive Summary"
|
||||
description: "Comprehensive security audit findings and recommendations for the MPC vault system"
|
||||
icon: "clipboard-check"
|
||||
---
|
||||
|
||||
<Warning>
|
||||
This audit report contains critical security findings that require immediate
|
||||
attention before production deployment.
|
||||
</Warning>
|
||||
|
||||
**Date:** August 5, 2025
|
||||
**Auditor:** Claude (Senior Security Auditor)
|
||||
**Scope:** Comprehensive security assessment of the MPC vault system for wallet operations
|
||||
**Version:** Sonr v0.10.15
|
||||
|
||||
## Executive Summary
|
||||
|
||||
This security audit evaluates the Multi-Party Computation (MPC) vault system implemented in Sonr's blockchain platform. The audit covers the current architecture, recent security improvements, wallet operation security, threat analysis, and production readiness assessment.
|
||||
|
||||
### Key Findings Overview
|
||||
|
||||
- **Critical Issues:** 3 identified
|
||||
- **High Risk Issues:** 4 identified
|
||||
- **Medium Risk Issues:** 6 identified
|
||||
- **Low Risk Issues:** 8 identified
|
||||
|
||||
<Info>
|
||||
**Overall Security Posture:** MODERATE RISK - Suitable for testnet deployment
|
||||
with immediate remediation of critical issues required before mainnet
|
||||
deployment with user funds.
|
||||
</Info>
|
||||
|
||||
## 1. Current Architecture Analysis
|
||||
|
||||
### 1.1 System Components
|
||||
|
||||
The vault system consists of four primary components:
|
||||
|
||||
<AccordionGroup>
|
||||
<Accordion title="Vault Client (internal/vault/vault.go)" icon="code">
|
||||
**Purpose:** High-level interface for vault operations using WebAssembly enclaves
|
||||
|
||||
**Security Features:**
|
||||
- Input validation framework with regex patterns
|
||||
- Secure error handling with sanitized messages
|
||||
- WASM plugin integrity verification via SHA256 hashing
|
||||
- Restricted host and filesystem access for WASM plugins
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="WASM Plugin (cmd/vault/main.go)" icon="cube">
|
||||
**Purpose:** WebAssembly-based secure execution environment for MPC operations
|
||||
**Security Features:** - Sandboxed execution environment - Rate limiting (60
|
||||
operations/minute per vault) - Resource constraints (max 100 vaults per
|
||||
instance) - Ownership-based access control - Configurable IPFS endpoints and
|
||||
timeouts
|
||||
</Accordion>
|
||||
|
||||
<Accordion
|
||||
title="DWN Keeper Integration (x/dwn/keeper/keeper.go)"
|
||||
icon="database"
|
||||
>
|
||||
**Purpose:** Blockchain state management and vault lifecycle operations
|
||||
**Security Features:** - Vault state persistence with enclave data separation
|
||||
- Integration with DID-based authentication - Service registration
|
||||
verification
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="MPC Enclave (crypto/mpc/enclave.go)" icon="lock">
|
||||
**Purpose:** Multi-party computation cryptographic operations
|
||||
|
||||
**Security Features:**
|
||||
- AES-GCM encryption for data at rest
|
||||
- ECDSA signing with SHA3-256 hashing
|
||||
- Key derivation and rotation capabilities
|
||||
</Accordion>
|
||||
</AccordionGroup>
|
||||
|
||||
## 2. Security Fixes Analysis
|
||||
|
||||
### 2.1 Recently Implemented Security Improvements
|
||||
|
||||
Based on code analysis and git history, the following security enhancements have been implemented:
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card title="WASM Sandbox Restrictions" icon="check-circle" color="#16a34a">
|
||||
✅ **EFFECTIVE**
|
||||
|
||||
- Restricted allowed hosts to local IPFS endpoints only
|
||||
- Limited file system access to `/tmp/vault-wasm` directory
|
||||
- Well-implemented defense against WASM plugin abuse
|
||||
</Card>
|
||||
|
||||
<Card title="Input Validation Framework" icon="check-circle" color="#16a34a">
|
||||
✅ **EFFECTIVE** - Vault ID validation with alphanumeric constraints - CID
|
||||
validation with Base58 format checking - Password validation with UTF-8 and
|
||||
size constraints - Comprehensive validation prevents injection attacks
|
||||
</Card>
|
||||
|
||||
<Card title="Error Message Sanitization" icon="check-circle" color="#16a34a">
|
||||
✅ **EFFECTIVE** - SecureError type with public/internal error separation -
|
||||
Structured error codes prevent information leakage - Prevents sensitive
|
||||
information disclosure
|
||||
</Card>
|
||||
|
||||
<Card
|
||||
title="Rate Limiting and Resource Constraints"
|
||||
icon="check-circle"
|
||||
color="#16a34a"
|
||||
>
|
||||
✅ **EFFECTIVE** - 60 ops/minute per vault, max 100 vaults per instance -
|
||||
Protection against resource exhaustion attacks - Well-implemented DoS
|
||||
protection
|
||||
</Card>
|
||||
|
||||
<Card
|
||||
title="Plugin Integrity Verification"
|
||||
icon="exclamation-triangle"
|
||||
color="#f59e0b"
|
||||
>
|
||||
⚠️ **PARTIALLY EFFECTIVE** - Optional SHA256 hash verification - Defaults to
|
||||
empty hash (backward compatibility) - Good foundation but needs enforcement in
|
||||
production
|
||||
</Card>
|
||||
|
||||
<Card title="Access Control Implementation" icon="exclamation-triangle" color="#f59e0b">
|
||||
⚠️ **NEEDS IMPROVEMENT**
|
||||
|
||||
- Owner-based access with pseudo-authentication
|
||||
- Uses vault ID as owner ID (placeholder implementation)
|
||||
- Insufficient for production use
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
## 3. Wallet Operation Security Assessment
|
||||
|
||||
<AccordionGroup>
|
||||
<Accordion title="Vault Generation and Key Derivation" defaultOpen>
|
||||
- **Strength:** Uses secure MPC protocol for key generation
|
||||
- **Weakness:** No entropy source verification
|
||||
- **Risk Level:** Medium
|
||||
- **CVSS Score:** 5.3 (AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N)
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Transaction Signing (Cosmos, EVM)">
|
||||
- **Strength:** Proper ECDSA implementation with SHA3-256 - **Weakness:**
|
||||
Missing signature malleability protection - **Risk Level:** Medium - **CVSS
|
||||
Score:** 4.8 (AV:N/AC:L/PR:H/UI:R/S:C/C:L/I:L/A:N)
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Message Signing and Verification">
|
||||
- **Strength:** Standard ECDSA verification process - **Weakness:** No
|
||||
timestamp validation for replay protection - **Risk Level:** Medium - **CVSS
|
||||
Score:** 5.4 (AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N)
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Key Rotation and Vault Management">
|
||||
- **Strength:** MPC refresh protocol for key rotation - **Weakness:** No
|
||||
automated rotation enforcement - **Risk Level:** Low - **CVSS Score:** 3.7
|
||||
(AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:L)
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="IPFS Storage and Retrieval">
|
||||
- **Strength:** AES-GCM encryption for data at rest
|
||||
- **Weakness:** No integrity verification after retrieval
|
||||
- **Risk Level:** High
|
||||
- **CVSS Score:** 7.5 (AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N)
|
||||
</Accordion>
|
||||
</AccordionGroup>
|
||||
|
||||
## 4. Threat Analysis by Risk Level
|
||||
|
||||
### 4.1 CRITICAL Vulnerabilities (Immediate Action Required)
|
||||
|
||||
<Warning>
|
||||
These vulnerabilities require immediate remediation before any production
|
||||
deployment.
|
||||
</Warning>
|
||||
|
||||
<AccordionGroup>
|
||||
<Accordion title="CRITICAL-001: Weak Authentication System" icon="shield-x">
|
||||
- **Location:** `cmd/vault/main.go:647-676`
|
||||
- **Issue:** Pseudo-authentication using vault ID as owner ID
|
||||
- **Impact:** Complete vault takeover by any user knowing vault ID
|
||||
- **CVSS Score:** 9.8 (AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H)
|
||||
- **Remediation:** Implement proper JWT/OAuth2 authentication with cryptographic proofs
|
||||
</Accordion>
|
||||
|
||||
<Accordion
|
||||
title="CRITICAL-002: Missing WASM Integrity Enforcement"
|
||||
icon="shield-x"
|
||||
>
|
||||
- **Location:** `internal/vault/vault.go:138` - **Issue:** WASM hash
|
||||
verification disabled by default (empty ExpectedSHA256) - **Impact:**
|
||||
Malicious WASM plugin execution - **CVSS Score:** 9.1
|
||||
(AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:N) - **Remediation:** Enforce mandatory
|
||||
WASM integrity checks in production
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="CRITICAL-003: Hardcoded Default Passwords" icon="shield-x">
|
||||
- **Location:** `x/dwn/keeper/keeper.go:404`
|
||||
- **Issue:** Default password generation based on predictable values
|
||||
- **Impact:** Vault encryption key compromise
|
||||
- **CVSS Score:** 8.8 (AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H)
|
||||
- **Remediation:** Implement secure password derivation or user-provided passwords
|
||||
</Accordion>
|
||||
</AccordionGroup>
|
||||
|
||||
### 4.2 HIGH Risk Vulnerabilities
|
||||
|
||||
<AccordionGroup>
|
||||
<Accordion title="HIGH-001: No Encrypted Data Integrity Verification" icon="alert-triangle">
|
||||
- **Location:** `crypto/mpc/enclave.go:51-68`
|
||||
- **Issue:** No HMAC or authenticated encryption verification after IPFS retrieval
|
||||
- **Impact:** Data tampering attacks on stored vault data
|
||||
- **CVSS Score:** 7.5 (AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N)
|
||||
</Accordion>
|
||||
|
||||
<Accordion
|
||||
title="HIGH-002: Missing Signature Malleability Protection"
|
||||
icon="alert-triangle"
|
||||
>
|
||||
- **Location:** `crypto/mpc/enclave.go:111-121` - **Issue:** ECDSA signatures
|
||||
vulnerable to malleability attacks - **Impact:** Transaction replay with
|
||||
modified signatures - **CVSS Score:** 7.4
|
||||
(AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N)
|
||||
</Accordion>
|
||||
|
||||
<Accordion
|
||||
title="HIGH-003: Insufficient Input Sanitization for IPFS Operations"
|
||||
icon="alert-triangle"
|
||||
>
|
||||
- **Location:** `cmd/vault/main.go:321-392` - **Issue:** Direct CID usage
|
||||
without additional validation - **Impact:** IPFS injection attacks or resource
|
||||
exhaustion - **CVSS Score:** 7.1 (AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H)
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="HIGH-004: Race Conditions in Concurrent Vault Access" icon="alert-triangle">
|
||||
- **Location:** `cmd/vault/main.go:505-568`
|
||||
- **Issue:** Inadequate synchronization for concurrent vault operations
|
||||
- **Impact:** Data corruption or inconsistent vault state
|
||||
- **CVSS Score:** 6.8 (AV:N/AC:H/PR:H/UI:N/S:U/C:H/I:H/A:H)
|
||||
</Accordion>
|
||||
</AccordionGroup>
|
||||
|
||||
### 4.3 MEDIUM Risk Vulnerabilities
|
||||
|
||||
<AccordionGroup>
|
||||
<Accordion title="MEDIUM-001: Weak Key Derivation for Encryption">
|
||||
- **Location:** `crypto/mpc/enclave.go:78`
|
||||
- **CVSS Score:** 5.9 (AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N)
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="MEDIUM-002: Missing Request Replay Protection">
|
||||
- **Location:** Various signing functions - **CVSS Score:** 5.4
|
||||
(AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N)
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="MEDIUM-003: Insufficient Error Context in Logs">
|
||||
- **Location:** Throughout codebase - **CVSS Score:** 4.3
|
||||
(AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:L)
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="MEDIUM-004: No Key Rotation Enforcement">
|
||||
- **Location:** `cmd/vault/main.go:986-988` - **CVSS Score:** 4.2
|
||||
(AV:N/AC:L/PR:H/UI:N/S:U/C:L/I:L/A:N)
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="MEDIUM-005: WebAuthn Implementation Placeholder">
|
||||
- **Location:** `cmd/vault/main.go:947-954` - **CVSS Score:** 5.8
|
||||
(AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N)
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="MEDIUM-006: Insufficient Resource Cleanup">
|
||||
- **Location:** `cmd/vault/main.go:976-983`
|
||||
- **CVSS Score:** 4.9 (AV:L/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:L)
|
||||
</Accordion>
|
||||
</AccordionGroup>
|
||||
|
||||
### 4.4 LOW Risk Issues
|
||||
|
||||
<Accordion title="Low Risk Issues Summary">
|
||||
- LOW-001: Predictable Enclave ID Generation - LOW-002: Missing Rate Limit
|
||||
Bypass Protection - LOW-003: Insufficient Logging for Security Events -
|
||||
LOW-004: No Vault Backup/Recovery Mechanism - LOW-005: Missing Health Check
|
||||
Attestation Validation - LOW-006: Hardcoded Configuration Values - LOW-007: No
|
||||
Circuit Breaker for IPFS Operations - LOW-008: Missing Input Length Validation
|
||||
Edge Cases
|
||||
</Accordion>
|
||||
|
||||
## 5. Production Readiness Assessment
|
||||
|
||||
<CardGroup cols={3}>
|
||||
<Card title="Testnet Deployment" icon="exclamation-triangle" color="#f59e0b">
|
||||
⚠️ **CONDITIONAL APPROVAL**
|
||||
|
||||
Suitable with immediate critical fixes:
|
||||
- Fix CRITICAL-001 (Authentication)
|
||||
- Fix CRITICAL-002 (WASM Integrity)
|
||||
- Fix CRITICAL-003 (Default Passwords)
|
||||
|
||||
**Timeline:** 2-3 weeks with dedicated security effort
|
||||
</Card>
|
||||
|
||||
<Card title="Mainnet with User Funds" icon="x-circle" color="#dc2626">
|
||||
❌ **NOT RECOMMENDED** Requires comprehensive security hardening: - All
|
||||
CRITICAL and HIGH issues resolved - External security audit by certified firm
|
||||
- Bug bounty program - Comprehensive monitoring and alerting **Timeline:** 3-4
|
||||
months minimum
|
||||
</Card>
|
||||
|
||||
<Card title="Enterprise/Institutional Use" icon="x-circle" color="#dc2626">
|
||||
❌ **NOT RECOMMENDED**
|
||||
|
||||
Requires enterprise-grade security controls:
|
||||
- SOC 2 Type II compliance
|
||||
- Multi-signature authorization workflows
|
||||
- Hardware Security Module (HSM) integration
|
||||
- Advanced threat detection and response
|
||||
|
||||
**Timeline:** 6-8 months minimum
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
## 6. Remediation Recommendations
|
||||
|
||||
### 6.1 Immediate Actions (0-2 weeks)
|
||||
|
||||
<Steps>
|
||||
<Step title="Implement Proper Authentication System">
|
||||
- Replace pseudo-authentication with JWT/OAuth2
|
||||
- Add cryptographic proof of vault ownership
|
||||
- Implement session management with timeout
|
||||
</Step>
|
||||
|
||||
<Step title="Enforce WASM Integrity Verification">
|
||||
- Remove backward compatibility for empty hashes - Implement automatic hash
|
||||
verification - Add WASM signature verification
|
||||
</Step>
|
||||
|
||||
<Step title="Replace Hardcoded Password Generation">
|
||||
- Implement secure key derivation functions (PBKDF2/Argon2)
|
||||
- Add user-provided password support
|
||||
- Implement password strength requirements
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
### 6.2 Short-term Actions (2-8 weeks)
|
||||
|
||||
<Steps>
|
||||
<Step title="Add Data Integrity Verification">
|
||||
- Implement HMAC for IPFS stored data
|
||||
- Add checksum verification after retrieval
|
||||
- Implement authenticated encryption (AES-GCM with additional data)
|
||||
</Step>
|
||||
|
||||
<Step title="Implement Signature Malleability Protection">
|
||||
- Use deterministic ECDSA (RFC 6979) - Add signature canonicalization -
|
||||
Implement proper nonce generation
|
||||
</Step>
|
||||
|
||||
<Step title="Enhance WebAuthn Integration">
|
||||
- Complete WebAuthn assertion verification
|
||||
- Add biometric authentication support
|
||||
- Implement proper challenge-response flow
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
## 7. Implementation Timeline
|
||||
|
||||
<AccordionGroup>
|
||||
<Accordion title="Phase 1: Critical Security Fixes (2-3 weeks)" defaultOpen>
|
||||
- Authentication system implementation
|
||||
- WASM integrity enforcement
|
||||
- Password security enhancement
|
||||
- Basic monitoring setup
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Phase 2: High-Risk Remediation (4-6 weeks)">
|
||||
- Data integrity verification - Signature security improvements - Input
|
||||
validation enhancements - Concurrent access protection
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Phase 3: Production Hardening (8-12 weeks)">
|
||||
- Comprehensive monitoring implementation - Advanced security controls -
|
||||
Performance optimization - External security audit preparation
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Phase 4: Enterprise Readiness (6-8 months)">
|
||||
- Compliance framework implementation
|
||||
- Advanced threat protection
|
||||
- HSM integration
|
||||
- Comprehensive testing and validation
|
||||
</Accordion>
|
||||
</AccordionGroup>
|
||||
|
||||
## 8. Compliance and Standards Assessment
|
||||
|
||||
### 8.1 Current Compliance Status
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card title="OWASP Top 10" icon="x-circle" color="#dc2626">
|
||||
❌ Multiple violations identified
|
||||
</Card>
|
||||
<Card title="NIST Cybersecurity Framework" icon="x-circle" color="#dc2626">
|
||||
❌ Partial implementation
|
||||
</Card>
|
||||
<Card title="ISO 27001" icon="x-circle" color="#dc2626">
|
||||
❌ Insufficient security controls
|
||||
</Card>
|
||||
<Card title="SOC 2" icon="x-circle" color="#dc2626">
|
||||
❌ Not compliant
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
### 8.2 Recommended Standards Implementation
|
||||
|
||||
1. Implement OWASP secure coding practices
|
||||
2. Adopt NIST cybersecurity framework controls
|
||||
3. Prepare for SOC 2 Type II audit
|
||||
4. Consider ISO 27001 certification for enterprise use
|
||||
|
||||
## 9. Conclusion
|
||||
|
||||
The Sonr MPC vault system demonstrates good architectural principles and has implemented several important security improvements. However, critical vulnerabilities prevent immediate production deployment with user funds.
|
||||
|
||||
<Note>
|
||||
The system is suitable for testnet deployment with immediate remediation of
|
||||
the three critical issues identified. A comprehensive security hardening
|
||||
effort over 3-4 months is required before mainnet deployment with user funds
|
||||
is recommended.
|
||||
</Note>
|
||||
|
||||
<Warning>
|
||||
**Immediate Priority:** Address the three critical vulnerabilities before any
|
||||
production deployment.
|
||||
</Warning>
|
||||
|
||||
**Recommendation:** Engage a certified security firm for external audit before mainnet launch.
|
||||
|
||||
---
|
||||
|
||||
**Report Prepared By:** Claude (Senior Security Auditor)
|
||||
**Date:** August 5, 2025
|
||||
**Classification:** Confidential - Internal Use Only
|
||||
|
||||
@@ -1,352 +0,0 @@
|
||||
---
|
||||
title: "Security Compliance Checklist"
|
||||
sidebarTitle: "Compliance Checklist"
|
||||
description: "Comprehensive security compliance checklist for MPC vault system production readiness"
|
||||
icon: "list-check"
|
||||
---
|
||||
|
||||
## MPC Vault System Production Readiness
|
||||
|
||||
**Version:** 1.0
|
||||
**Date:** August 5, 2025
|
||||
**Owner:** Security Team
|
||||
**Review Cycle:** Monthly
|
||||
|
||||
<Warning>
|
||||
This checklist must be completed before production deployment. Critical
|
||||
security requirements are mandatory for testnet deployment.
|
||||
</Warning>
|
||||
|
||||
## Critical Security Requirements (0% Complete)
|
||||
|
||||
<AccordionGroup>
|
||||
<Accordion title="UCAN-Based Vault Authorization" icon="shield-keyhole" defaultOpen>
|
||||
<CardGroup cols={2}>
|
||||
<Card title="Authentication" icon="key">
|
||||
- [ ] **UCAN Token Validation** - Replace pseudo-authentication with proper UCAN token verification
|
||||
- [ ] **Vault Capability Verification** - Implement vault operation authorization using UCAN capabilities
|
||||
- [ ] **Delegation Chain Validation** - Verify complete UCAN delegation chains for vault access
|
||||
</Card>
|
||||
<Card title="Access Control" icon="lock">
|
||||
- [ ] **Capability-Based Access Control** - Use UCAN capabilities for fine-grained vault permissions
|
||||
- [ ] **Cryptographic Proof of Ownership** - Validate UCAN signatures for vault ownership verification
|
||||
- [ ] **UCAN Expiration Handling** - Implement automatic capability expiration and renewal
|
||||
</Card>
|
||||
</CardGroup>
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Traditional Authentication Support" icon="fingerprint">
|
||||
- [ ] **WebAuthn Integration** - Multi-factor authentication for
|
||||
biometric/hardware key support - [ ] **Session Management** - Secure session
|
||||
handling with configurable timeouts for web interfaces - [ ] **API Rate
|
||||
Limiting** - Per-user and per-capability rate limiting beyond current
|
||||
per-vault limits - [ ] **Emergency Access Controls** - Fallback authentication
|
||||
mechanisms for capability recovery
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Cryptographic Security" icon="shield-check">
|
||||
<Steps>
|
||||
<Step title="WASM Security">
|
||||
- [ ] **WASM Integrity Enforcement** - Mandatory SHA256 hash verification
|
||||
for all plugins - [ ] **Code Signing** - Digital signature verification
|
||||
for WASM modules
|
||||
</Step>
|
||||
<Step title="Key Management">
|
||||
- [ ] **Secure Password Handling** - Replace hardcoded passwords with
|
||||
user-provided secrets - [ ] **Key Derivation Functions** - Implement
|
||||
Argon2id for password-based key derivation
|
||||
</Step>
|
||||
<Step title="Signature Security">
|
||||
- [ ] **Signature Canonicalization** - Prevent ECDSA signature
|
||||
malleability attacks - [ ] **Deterministic ECDSA** - Use RFC 6979 for
|
||||
secure nonce generation
|
||||
</Step>
|
||||
</Steps>
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Data Integrity & Encryption" icon="database">
|
||||
- [ ] **HMAC Data Integrity** - Add integrity verification for all encrypted data
|
||||
- [ ] **Authenticated Encryption** - Use AES-GCM with proper additional data
|
||||
- [ ] **Salt Storage** - Secure salt management for key derivation
|
||||
- [ ] **Key Rotation** - Automated and enforced key rotation policies
|
||||
- [ ] **Secure Memory Handling** - Proper zeroization of sensitive data in memory
|
||||
</Accordion>
|
||||
</AccordionGroup>
|
||||
|
||||
## High Priority Security Requirements (15% Complete)
|
||||
|
||||
<AccordionGroup>
|
||||
<Accordion title="Input Validation & Sanitization" icon="filter">
|
||||
<CardGroup cols={2}>
|
||||
<Card title="Implemented ✅" icon="check-circle" color="#16a34a">
|
||||
- [x] **Vault ID Validation** - Regex-based validation implemented ✅
|
||||
- [x] **CID Format Validation** - IPFS CID format checking ✅
|
||||
- [x] **Password Length Validation** - Basic length constraints ✅
|
||||
</Card>
|
||||
<Card title="Pending" icon="clock" color="#f59e0b">
|
||||
- [ ] **Advanced Input Sanitization** - Comprehensive injection attack prevention
|
||||
- [ ] **Schema Validation** - JSON schema validation for all API inputs
|
||||
- [ ] **File Upload Security** - Secure handling of WASM plugin uploads
|
||||
</Card>
|
||||
</CardGroup>
|
||||
</Accordion>
|
||||
|
||||
<Accordion
|
||||
title="Error Handling & Information Disclosure"
|
||||
icon="alert-triangle"
|
||||
>
|
||||
<CardGroup cols={2}>
|
||||
<Card title="Implemented ✅" icon="check-circle" color="#16a34a">
|
||||
- [x] **Error Message Sanitization** - SecureError implementation ✅ - [x]
|
||||
**Structured Error Codes** - Consistent error code system ✅
|
||||
</Card>
|
||||
<Card title="Pending" icon="clock" color="#f59e0b">
|
||||
- [ ] **Security Event Logging** - Comprehensive audit trail for security
|
||||
events - [ ] **Sensitive Data Masking** - Ensure no secrets in logs or
|
||||
error messages - [ ] **Error Rate Monitoring** - Automated detection of
|
||||
unusual error patterns
|
||||
</Card>
|
||||
</CardGroup>
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Network Security" icon="network">
|
||||
<CardGroup cols={2}>
|
||||
<Card title="Implemented ✅" icon="check-circle" color="#16a34a">
|
||||
- [x] **WASM Sandbox Restrictions** - Limited network access for plugins ✅
|
||||
- [x] **IPFS Endpoint Configuration** - Configurable but restricted IPFS access ✅
|
||||
</Card>
|
||||
<Card title="Pending" icon="clock" color="#f59e0b">
|
||||
- [ ] **TLS/SSL Configuration** - Proper certificate management and validation
|
||||
- [ ] **Network Segmentation** - Isolated network zones for vault operations
|
||||
- [ ] **Firewall Rules** - Restrictive network access policies
|
||||
</Card>
|
||||
</CardGroup>
|
||||
</Accordion>
|
||||
</AccordionGroup>
|
||||
|
||||
## Medium Priority Security Requirements (25% Complete)
|
||||
|
||||
<AccordionGroup>
|
||||
<Accordion title="Monitoring & Alerting" icon="activity">
|
||||
<CardGroup cols={2}>
|
||||
<Card title="Implemented ✅" icon="check-circle" color="#16a34a">
|
||||
- [x] **Basic Rate Limiting** - Per-vault operation limits ✅
|
||||
- [x] **Resource Constraints** - Maximum vault limits per instance ✅
|
||||
</Card>
|
||||
<Card title="Pending" icon="clock" color="#f59e0b">
|
||||
- [ ] **Real-time Threat Detection** - Automated anomaly detection
|
||||
- [ ] **Security Information and Event Management (SIEM)** - Centralized log analysis
|
||||
- [ ] **Intrusion Detection System (IDS)** - Network-based threat detection
|
||||
- [ ] **Performance Monitoring** - Resource usage and performance metrics
|
||||
</Card>
|
||||
</CardGroup>
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Backup & Recovery" icon="hard-drive">
|
||||
- [ ] **Encrypted Backup System** - Secure vault data backup procedures - [ ]
|
||||
**Disaster Recovery Plan** - Documented recovery procedures - [ ] **Data
|
||||
Retention Policies** - Compliant data lifecycle management - [ ] **Backup
|
||||
Integrity Verification** - Regular backup validation procedures - [ ]
|
||||
**Point-in-time Recovery** - Granular recovery capabilities
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Compliance & Governance" icon="clipboard-check">
|
||||
- [ ] **Data Privacy Controls** - GDPR/CCPA compliance measures
|
||||
- [ ] **Audit Trail Integrity** - Immutable audit logging
|
||||
- [ ] **Compliance Reporting** - Automated compliance status reporting
|
||||
- [ ] **Risk Assessment Framework** - Regular security risk evaluations
|
||||
- [ ] **Security Policy Documentation** - Comprehensive security procedures
|
||||
</Accordion>
|
||||
</AccordionGroup>
|
||||
|
||||
## Infrastructure Security Requirements (0% Complete)
|
||||
|
||||
<AccordionGroup>
|
||||
<Accordion title="Container & Orchestration Security" icon="container">
|
||||
- [ ] **Container Image Scanning** - Vulnerability scanning for all images
|
||||
- [ ] **Pod Security Policies** - Kubernetes security context enforcement
|
||||
- [ ] **Network Policies** - Micro-segmentation for container communication
|
||||
- [ ] **Secret Management** - Secure handling of API keys and certificates
|
||||
- [ ] **Resource Quotas** - Prevent resource exhaustion attacks
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Database Security" icon="database">
|
||||
- [ ] **Encryption at Rest** - Database-level encryption implementation - [ ]
|
||||
**Connection Security** - TLS encryption for all database connections - [ ]
|
||||
**Access Control** - Database user privilege management - [ ] **Query
|
||||
Monitoring** - SQL injection and anomaly detection - [ ] **Backup Encryption**
|
||||
- Encrypted database backup procedures
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="IPFS Security" icon="folder-tree">
|
||||
- [ ] **Content Addressing Verification** - Validate IPFS content integrity
|
||||
- [ ] **Pinning Strategy** - Secure content persistence policies
|
||||
- [ ] **Access Control** - Restrict IPFS node access and operations
|
||||
- [ ] **Network Security** - Secure IPFS node communication
|
||||
- [ ] **Content Filtering** - Prevent malicious content storage
|
||||
</Accordion>
|
||||
</AccordionGroup>
|
||||
|
||||
## Testing & Validation Requirements (10% Complete)
|
||||
|
||||
<AccordionGroup>
|
||||
<Accordion title="Security Testing" icon="bug">
|
||||
<CardGroup cols={2}>
|
||||
<Card title="Implemented ✅" icon="check-circle" color="#16a34a">
|
||||
- [x] **Unit Tests** - Basic functionality testing ✅
|
||||
</Card>
|
||||
<Card title="Pending" icon="clock" color="#f59e0b">
|
||||
- [ ] **Security Unit Tests** - Dedicated security-focused test cases
|
||||
- [ ] **Integration Security Testing** - End-to-end security validation
|
||||
- [ ] **Penetration Testing** - Third-party security assessment
|
||||
- [ ] **Vulnerability Scanning** - Automated security scanning
|
||||
- [ ] **Fuzzing** - Input validation robustness testing
|
||||
</Card>
|
||||
</CardGroup>
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Performance & Load Testing" icon="zap">
|
||||
- [ ] **Load Testing** - Performance under high concurrent load - [ ] **Stress
|
||||
Testing** - System behavior under extreme conditions - [ ] **Security Load
|
||||
Testing** - Security controls under load - [ ] **Failover Testing** - System
|
||||
resilience validation - [ ] **Capacity Planning** - Resource requirements
|
||||
assessment
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Compliance Testing" icon="certificate">
|
||||
- [ ] **OWASP Top 10 Validation** - Verify protection against common vulnerabilities
|
||||
- [ ] **NIST Framework Assessment** - Cybersecurity framework compliance
|
||||
- [ ] **Industry Standards Testing** - Blockchain-specific security standards
|
||||
- [ ] **Regulatory Compliance Testing** - Financial services compliance validation
|
||||
</Accordion>
|
||||
</AccordionGroup>
|
||||
|
||||
## Operational Security Requirements (5% Complete)
|
||||
|
||||
<AccordionGroup>
|
||||
<Accordion title="Incident Response" icon="siren">
|
||||
- [ ] **Security Incident Response Plan** - Documented procedures for security incidents
|
||||
- [ ] **Incident Detection Systems** - Automated incident detection and alerting
|
||||
- [ ] **Forensic Capabilities** - Digital forensics tools and procedures
|
||||
- [ ] **Communication Procedures** - Stakeholder notification processes
|
||||
- [ ] **Recovery Procedures** - System restoration and continuity planning
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Security Operations" icon="shield">
|
||||
- [ ] **Security Operations Center (SOC)** - 24/7 security monitoring - [ ]
|
||||
**Threat Intelligence** - External threat intelligence integration - [ ]
|
||||
**Vulnerability Management** - Regular vulnerability assessment and patching -
|
||||
[ ] **Security Training** - Developer and operations team security training -
|
||||
[ ] **Security Awareness Program** - Organization-wide security awareness
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Change Management" icon="git-branch">
|
||||
- [ ] **Secure Development Lifecycle** - Security integrated into development process
|
||||
- [ ] **Code Review Process** - Security-focused code review procedures
|
||||
- [ ] **Deployment Security** - Secure deployment pipelines and procedures
|
||||
- [ ] **Configuration Management** - Secure configuration baseline management
|
||||
- [ ] **Patch Management** - Timely security update procedures
|
||||
</Accordion>
|
||||
</AccordionGroup>
|
||||
|
||||
## Deployment Readiness Gates
|
||||
|
||||
<CardGroup cols={3}>
|
||||
<Card title="Testnet Deployment Prerequisites" icon="test-tube" color="#f59e0b">
|
||||
<Warning>Required for testnet deployment</Warning>
|
||||
|
||||
- [ ] All CRITICAL vulnerabilities resolved (CRITICAL-001, CRITICAL-002, CRITICAL-003)
|
||||
- [ ] UCAN-based vault authorization system implemented and tested
|
||||
- [ ] WASM integrity verification enforced
|
||||
- [ ] Secure password/key derivation implemented
|
||||
- [ ] Basic monitoring and alerting configured
|
||||
- [ ] UCAN capability validation for all vault operations
|
||||
- [ ] Delegation chain verification system operational
|
||||
</Card>
|
||||
|
||||
<Card title="Mainnet Beta Prerequisites" icon="flask" color="#3b82f6">
|
||||
<Info>Required for mainnet beta</Info>- [ ] All CRITICAL and HIGH
|
||||
vulnerabilities resolved - [ ] External security audit completed with
|
||||
satisfactory results - [ ] Comprehensive monitoring and alerting system
|
||||
deployed - [ ] Incident response procedures tested and validated - [ ] Bug
|
||||
bounty program launched and initial issues resolved
|
||||
</Card>
|
||||
|
||||
<Card title="Production Mainnet Prerequisites" icon="check-circle" color="#16a34a">
|
||||
<Note>Required for full production</Note>
|
||||
|
||||
- [ ] All CRITICAL, HIGH, and MEDIUM vulnerabilities resolved
|
||||
- [ ] SOC 2 Type II audit completed (for institutional use)
|
||||
- [ ] Comprehensive security testing completed
|
||||
- [ ] Hardware Security Module (HSM) integration (for enterprise)
|
||||
- [ ] Disaster recovery and business continuity plans tested
|
||||
- [ ] Regulatory compliance validation completed
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
## Review and Approval Process
|
||||
|
||||
### Security Review Board
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card title="Review Board Members" icon="users">
|
||||
- **Chief Security Officer** - Overall security strategy approval
|
||||
- **Lead Security Engineer** - Technical security implementation review
|
||||
- **Compliance Officer** - Regulatory and compliance validation
|
||||
- **DevOps Lead** - Infrastructure security validation
|
||||
- **Product Manager** - Business impact and user experience review
|
||||
</Card>
|
||||
|
||||
<Card title="Approval Checkpoints" icon="checkpoint">
|
||||
1. **Critical Fix Review** - After resolving all critical vulnerabilities
|
||||
2. **Security Architecture Review** - Complete system security design validation
|
||||
3. **Penetration Test Review** - External security assessment results
|
||||
4. **Compliance Review** - Regulatory and standards compliance validation
|
||||
5. **Production Readiness Review** - Final deployment approval
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
### Documentation Requirements
|
||||
|
||||
<Steps>
|
||||
<Step title="Architecture Documentation">
|
||||
- [ ] Security architecture documentation updated
|
||||
- [ ] Threat model documentation complete
|
||||
</Step>
|
||||
|
||||
<Step title="Operational Documentation">
|
||||
- [ ] Incident response runbooks validated - [ ] User security guidelines
|
||||
published
|
||||
</Step>
|
||||
|
||||
<Step title="Compliance Documentation">
|
||||
- [ ] Compliance certification documentation complete
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
## Success Metrics
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card title="Security KPIs" icon="target">
|
||||
- **Zero Critical Vulnerabilities** - No unresolved critical security issues
|
||||
- **Less than 5% High Risk Issues** - Minimal high-risk vulnerabilities remaining
|
||||
- **99.9% Uptime** - High availability with security controls active
|
||||
- **Less than 1s Authentication Latency** - Performance impact of security controls
|
||||
- **Zero Data Breaches** - No unauthorized access to vault data
|
||||
</Card>
|
||||
|
||||
<Card title="Compliance Metrics" icon="chart-bar">
|
||||
- **100% Critical Control Coverage** - All critical security controls implemented
|
||||
- **<30 Day Vulnerability Resolution** - Rapid security issue resolution
|
||||
- **100% Security Event Monitoring** - Complete visibility into security events
|
||||
- **<15 Minute Incident Detection** - Rapid threat detection capability
|
||||
- **100% Audit Trail Coverage** - Complete audit logging for all operations
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
---
|
||||
|
||||
**Next Review Date:** September 5, 2025
|
||||
**Document Owner:** Security Team
|
||||
**Approval Status:** Draft - Pending Security Review Board Approval
|
||||
|
||||
@@ -1,120 +0,0 @@
|
||||
---
|
||||
title: "Cryptographic Security Enhancements"
|
||||
description: "Comprehensive overview of cryptographic security enhancements in the Sonr blockchain"
|
||||
sidebarTitle: "Cryptography Usage"
|
||||
icon: "lock"
|
||||
---
|
||||
|
||||
import { Callout } from "mintlify/components";
|
||||
import { CodeBlock } from "mintlify/components";
|
||||
import { Tabs, Tab } from "mintlify/components";
|
||||
|
||||
# Cryptographic Security Enhancements
|
||||
|
||||
<Callout type="info">
|
||||
This document details the comprehensive cryptographic security enhancements
|
||||
implemented in the Sonr blockchain to address critical vulnerabilities and
|
||||
strengthen the overall security posture.
|
||||
</Callout>
|
||||
|
||||
## Table of Contents
|
||||
|
||||
1. [WASM Plugin Security](#wasm-plugin-security)
|
||||
2. [Password Security](#password-security)
|
||||
3. [ECDSA Signature Security](#ecdsa-signature-security)
|
||||
4. [Key Derivation](#key-derivation)
|
||||
5. [Security Testing](#security-testing)
|
||||
6. [Migration Guide](#migration-guide)
|
||||
|
||||
## WASM Plugin Security
|
||||
|
||||
### SHA256 Hash Verification
|
||||
|
||||
<Callout type="warning">
|
||||
All WASM plugins are now verified using SHA256 hashes before execution to
|
||||
prevent tampering and ensure integrity.
|
||||
</Callout>
|
||||
|
||||
**Implementation**: `crypto/wasm/verifier.go`
|
||||
|
||||
<CodeBlock language="go">
|
||||
{`// Usage example
|
||||
verifier := wasm.NewHashVerifier()
|
||||
hash := verifier.ComputeHash(wasmBytes)
|
||||
verifier.AddTrustedHash("motr.wasm", hash)
|
||||
|
||||
// Verify before execution
|
||||
err := verifier.VerifyHash("motr.wasm", wasmBytes)
|
||||
if err != nil {
|
||||
// Plugin verification failed - do not execute
|
||||
}`}
|
||||
|
||||
</CodeBlock>
|
||||
|
||||
**Features**:
|
||||
|
||||
- Automatic hash computation on plugin load
|
||||
- Hash chain verification for secure updates
|
||||
- Trusted hash whitelist management
|
||||
- Maximum size enforcement (10MB default)
|
||||
|
||||
### Ed25519 Code Signing
|
||||
|
||||
<Callout type="warning">
|
||||
WASM plugins must be signed with Ed25519 signatures to ensure authenticity and
|
||||
prevent unauthorized modifications.
|
||||
</Callout>
|
||||
|
||||
**Implementation**: `crypto/wasm/signer.go`
|
||||
|
||||
<CodeBlock language="go">
|
||||
{`// Sign a plugin
|
||||
signer := wasm.NewSigner(privateKey, publicKey)
|
||||
signature, err := signer.SignModule(wasmBytes, "motr.wasm", "v1.0.0")
|
||||
|
||||
// Verify signature
|
||||
manifest := &wasm.SignatureManifest{
|
||||
ModuleHash: hash,
|
||||
Signatures: []wasm.SignatureEntry{\*signature},
|
||||
TrustedKeys: trustedKeys,
|
||||
}
|
||||
err = signer.VerifyWithManifest(wasmBytes, manifest)`}
|
||||
|
||||
</CodeBlock>
|
||||
|
||||
### Remaining sections follow the same pattern, using MDX components to enhance readability
|
||||
|
||||
## Security Considerations
|
||||
|
||||
<Callout type="warning">
|
||||
### Best Practices 1. **Always validate passwords** before use 2. **Never
|
||||
store passwords in plaintext** or logs 3. **Use deterministic ECDSA** for all
|
||||
signatures 4. **Canonicalize all signatures** before storage 5. **Verify WASM
|
||||
plugins** before execution
|
||||
</Callout>
|
||||
|
||||
## Support
|
||||
|
||||
<Callout type="info">
|
||||
For questions or issues related to cryptographic security: 1. Check the test
|
||||
suites for usage examples 2. Review the security test scenarios 3. Open an
|
||||
issue on GitHub with the `security` label 4. Contact the security team for
|
||||
sensitive issues
|
||||
</Callout>
|
||||
|
||||
## Changelog
|
||||
|
||||
### Version 0.10.34
|
||||
|
||||
- Added WASM hash verification (`crypto/wasm/verifier.go`)
|
||||
- Added Ed25519 code signing (`crypto/wasm/signer.go`)
|
||||
- Replaced hardcoded passwords with secure validation (`crypto/password/validator.go`)
|
||||
- Implemented Argon2id key derivation (`crypto/argon2/kdf.go`)
|
||||
- Added RFC 6979 deterministic ECDSA (`crypto/ecdsa/deterministic.go`)
|
||||
- Implemented signature canonicalization (`crypto/ecdsa/canonical.go`)
|
||||
- Added comprehensive security test suite (`crypto/security_test.go`)
|
||||
|
||||
---
|
||||
|
||||
_Last Updated: 2024_
|
||||
_Security Contact: security@sonr.io_
|
||||
@@ -1,202 +0,0 @@
|
||||
---
|
||||
title: "Vulnerability Remediation Report"
|
||||
description: "Comprehensive report documenting the resolution of critical security vulnerabilities in the Sonr blockchain"
|
||||
sidebarTitle: "Vulnerability Remediation"
|
||||
icon: "bug-off"
|
||||
---
|
||||
|
||||
import { Callout } from 'mintlify/components'
|
||||
import { CodeBlock } from 'mintlify/components'
|
||||
import { Tabs, Tab } from 'mintlify/components'
|
||||
|
||||
# Vulnerability Remediation Report
|
||||
|
||||
<Callout type="info">
|
||||
This report documents the critical security vulnerabilities identified in the Sonr blockchain cryptographic implementation and the comprehensive remediation measures implemented to address them.
|
||||
</Callout>
|
||||
|
||||
## Vulnerabilities Addressed
|
||||
|
||||
### 1. WASM Plugin Tampering (Critical)
|
||||
|
||||
<Callout type="warning">
|
||||
**CVE Category**: CWE-494 (Download of Code Without Integrity Check)
|
||||
|
||||
**Impact**: Remote code execution, data exfiltration, system compromise
|
||||
</Callout>
|
||||
|
||||
**Remediation**:
|
||||
- Implemented SHA256 hash verification (`crypto/wasm/verifier.go`)
|
||||
- Added Ed25519 digital signatures (`crypto/wasm/signer.go`)
|
||||
- Created hash chain for secure updates
|
||||
- Enforced maximum plugin size limits
|
||||
|
||||
**Status**: ✅ RESOLVED
|
||||
|
||||
### 2. Hardcoded Password Generation (Critical)
|
||||
|
||||
<Callout type="warning">
|
||||
**CVE Category**: CWE-798 (Use of Hard-coded Credentials)
|
||||
|
||||
**Impact**: Unauthorized vault access, credential theft, data breach
|
||||
</Callout>
|
||||
|
||||
**Vulnerable Code (Removed)**:
|
||||
<CodeBlock language="go">
|
||||
{`password := fmt.Sprintf("vault-password-%s-%s", did, owner)`}
|
||||
</CodeBlock>
|
||||
|
||||
**Remediation**:
|
||||
- Removed all hardcoded password generation
|
||||
- Implemented secure password validation (`crypto/password/validator.go`)
|
||||
- Added entropy requirements (minimum 50 bits)
|
||||
- Integrated Argon2id for key derivation
|
||||
|
||||
**Status**: ✅ RESOLVED
|
||||
|
||||
### 3. ECDSA Nonce Reuse Vulnerability (High)
|
||||
|
||||
<Callout type="warning">
|
||||
**CVE Category**: CWE-330 (Use of Insufficiently Random Values)
|
||||
|
||||
**Impact**: Private key extraction, signature forgery, account compromise
|
||||
</Callout>
|
||||
|
||||
**Remediation**:
|
||||
- Implemented RFC 6979 deterministic ECDSA (`crypto/ecdsa/deterministic.go`)
|
||||
- Eliminated dependency on random number generation
|
||||
- Added comprehensive test coverage
|
||||
|
||||
**Status**: ✅ RESOLVED
|
||||
|
||||
### 4. Signature Malleability (High)
|
||||
|
||||
<Callout type="warning">
|
||||
**CVE Category**: CWE-347 (Improper Verification of Cryptographic Signature)
|
||||
|
||||
**Impact**: Transaction replay, double-spending, consensus issues
|
||||
</Callout>
|
||||
|
||||
**Remediation**:
|
||||
- Implemented signature canonicalization (`crypto/ecdsa/canonical.go`)
|
||||
- Enforced s ≤ N/2 requirement
|
||||
- Added automatic canonicalization and validation
|
||||
|
||||
**Status**: ✅ RESOLVED
|
||||
|
||||
### 5. Weak Password Storage (High)
|
||||
|
||||
<Callout type="warning">
|
||||
**CVE Category**: CWE-916 (Use of Password Hash With Insufficient Computational Effort)
|
||||
|
||||
**Impact**: Password cracking, unauthorized access, account takeover
|
||||
</Callout>
|
||||
|
||||
**Remediation**:
|
||||
- Implemented Argon2id with secure defaults (`crypto/argon2/kdf.go`)
|
||||
- Added configurable security profiles
|
||||
- Enforced minimum memory requirements (64MB default)
|
||||
- Implemented PHC format for standardized storage
|
||||
|
||||
**Status**: ✅ RESOLVED
|
||||
|
||||
### 6. Timing Attack Vulnerabilities (Medium)
|
||||
|
||||
<Callout type="warning">
|
||||
**CVE Category**: CWE-208 (Observable Timing Discrepancy)
|
||||
|
||||
**Impact**: Information disclosure, side-channel attacks
|
||||
</Callout>
|
||||
|
||||
**Remediation**:
|
||||
- Implemented constant-time comparison functions
|
||||
- Used `crypto/subtle.ConstantTimeCompare`
|
||||
- Added timing attack resistance tests
|
||||
|
||||
**Status**: ✅ RESOLVED
|
||||
|
||||
## Verification Methods
|
||||
|
||||
### Automated Testing
|
||||
|
||||
<Callout type="info">
|
||||
All remediations include comprehensive test suites.
|
||||
</Callout>
|
||||
|
||||
<CodeBlock language="bash">
|
||||
{`# Run security tests
|
||||
go test ./crypto/security_test.go -v
|
||||
|
||||
# Run individual component tests
|
||||
go test ./crypto/argon2 -v
|
||||
go test ./crypto/ecdsa -v
|
||||
go test ./crypto/wasm -v
|
||||
|
||||
# Run benchmarks
|
||||
go test -bench=. ./crypto/...`}
|
||||
</CodeBlock>
|
||||
|
||||
## Security Metrics
|
||||
|
||||
<Callout type="warning">
|
||||
### Before Remediation
|
||||
|
||||
| Metric | Value | Risk Level |
|
||||
|--------|-------|------------|
|
||||
| Hardcoded Passwords | Yes | Critical |
|
||||
| WASM Verification | None | Critical |
|
||||
| Nonce Generation | Random | High |
|
||||
| Signature Format | Non-canonical | High |
|
||||
| Password Hashing | Basic | High |
|
||||
| Timing Resistance | No | Medium |
|
||||
|
||||
### After Remediation
|
||||
|
||||
| Metric | Value | Risk Level |
|
||||
|--------|-------|------------|
|
||||
| Hardcoded Passwords | Eliminated | None |
|
||||
| WASM Verification | SHA256 + Ed25519 | None |
|
||||
| Nonce Generation | RFC 6979 Deterministic | None |
|
||||
| Signature Format | Canonical (s ≤ N/2) | None |
|
||||
| Password Hashing | Argon2id | None |
|
||||
| Timing Resistance | Constant-time | None |
|
||||
</Callout>
|
||||
|
||||
## Recommendations
|
||||
|
||||
<Callout type="info">
|
||||
### Immediate Actions
|
||||
|
||||
1. ✅ **Deploy remediations** to all environments
|
||||
2. ✅ **Update documentation** for developers
|
||||
3. ✅ **Train team** on new security requirements
|
||||
4. ✅ **Audit existing deployments** for compliance
|
||||
</Callout>
|
||||
|
||||
## Conclusion
|
||||
|
||||
<Callout type="success">
|
||||
All identified cryptographic vulnerabilities have been successfully remediated through comprehensive security enhancements:
|
||||
|
||||
- **6 critical/high vulnerabilities resolved**
|
||||
- **7 new security modules implemented**
|
||||
- **200+ security tests added**
|
||||
- **100% backward compatibility maintained**
|
||||
- **Zero security debt remaining**
|
||||
|
||||
The Sonr blockchain now implements industry-leading cryptographic security practices that protect against current and emerging threats.
|
||||
</Callout>
|
||||
|
||||
## Contact
|
||||
|
||||
For security-related inquiries:
|
||||
- Security Team: security@sonr.io
|
||||
- Bug Bounty Program: https://sonr.io/security/bug-bounty
|
||||
- Security Advisories: https://github.com/sonr-io/sonr/security/advisories
|
||||
|
||||
---
|
||||
|
||||
*Report Date: 2024*
|
||||
*Classification: Public*
|
||||
*Version: 1.0*
|
||||
EOF < /dev/null
|
||||
Reference in New Issue
Block a user