> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nami.cloud/llms.txt
> Use this file to discover all available pages before exploring further.

# Storage Authentication

> Authentication for Nami Cloud Storage Service

## Authentication

Nami Cloud Storage uses AWS Signature Version 4 for request authentication, making it compatible with standard S3 clients and SDKs.

### Credentials

You need two credentials to authenticate requests:

* Access Key ID
* Secret Access Key

These credentials can be obtained from the Nami Cloud Dashboard.

### Authentication Header

Each request must include an Authorization header with the following format:

```bash theme={null}
Authorization: AWS4-HMAC-SHA256 
    Credential=${AccessKeyID}/${date}/${region}/s3/aws4_request,
    SignedHeaders=${headers},
    Signature=${signature}
```

### Example

```bash theme={null}
Authorization: AWS4-HMAC-SHA256 
    Credential=AKIAIOSFODNN7EXAMPLE/20231028/us-east-1/s3/aws4_request,
    SignedHeaders=host;x-amz-content-sha256;x-amz-date,
    Signature=fe5f80f77d5fa3beca038a248ff027d0445342fe2855ddc963176630326f1024
```

### Using with SDK

Most S3 SDKs handle authentication automatically. Here are examples in different languages:

<CodeGroup>
  ```python Python theme={null}
  import boto3

  s3_client = boto3.client('s3',
      endpoint_url='https://storage.nami.cloud',
      aws_access_key_id='YOUR_ACCESS_KEY',
      aws_secret_access_key='YOUR_SECRET_KEY'
  )
  ```

  ```javascript Node.js theme={null}
  import { S3Client } from "@aws-sdk/client-s3";

  const client = new S3Client({
    endpoint: "https://storage.nami.cloud",
    credentials: {
      accessKeyId: "YOUR_ACCESS_KEY",
      secretAccessKey: "YOUR_SECRET_KEY",
    },
  });
  ```

  ```go Golang theme={null}
  import (
      "github.com/aws/aws-sdk-go/aws"
      "github.com/aws/aws-sdk-go/aws/credentials"
      "github.com/aws/aws-sdk-go/aws/session"
      "github.com/aws/aws-sdk-go/service/s3"
  )

  sess := session.Must(session.NewSession(&aws.Config{
      Endpoint:    aws.String("https://storage.nami.cloud"),
      Region:      aws.String("us-east-1"),
      Credentials: credentials.NewStaticCredentials("YOUR_ACCESS_KEY", "YOUR_SECRET_KEY", ""),
  }))

  s3Client := s3.New(sess)
  ```

  ```rust Rust theme={null}
  use aws_sdk_s3::{Client, Config};
  use aws_config::credentials::StaticCredentialsProvider;
  use aws_types::region::Region;

  let credentials = StaticCredentialsProvider::new(
      "YOUR_ACCESS_KEY".to_string(),
      "YOUR_SECRET_KEY".to_string(),
      None,
  );

  let config = Config::builder()
      .endpoint_url("https://storage.nami.cloud")
      .region(Region::new("us-east-1"))
      .credentials_provider(credentials)
      .build();

  let client = Client::from_conf(config);
  ```
</CodeGroup>

### Security Best Practices

1. **Credential Protection**
   * Never commit credentials to source control
   * Rotate credentials regularly
   * Use environment variables or secure credential stores

2. **Access Control**
   * Follow the principle of least privilege
   * Use bucket policies and IAM roles when possible
   * Regularly audit access patterns

3. **HTTPS**
   * Always use HTTPS for API requests
   * Verify SSL/TLS certificates
   * Keep client libraries updated
