Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @PrivaraXYZ/maintainers
35 changes: 35 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
name: Bug Report
about: Report a bug to help us improve
title: ''
labels: bug
assignees: ''
---

## Description

<!-- A clear description of the bug -->

## Steps to Reproduce

1.
2.
3.

## Expected Behavior

<!-- What you expected to happen -->

## Actual Behavior

<!-- What actually happened -->

## Environment

- SDK Version:
- Node.js Version:
- OS:

## Additional Context

<!-- Any other context, logs, or screenshots -->
23 changes: 23 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: Feature Request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''
---

## Problem

<!-- What problem does this feature solve? -->

## Proposed Solution

<!-- How should this feature work? -->

## Alternatives Considered

<!-- Any alternative solutions or workarounds? -->

## Additional Context

<!-- Any other context or screenshots -->
18 changes: 18 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## Description

<!-- Brief description of what this PR does -->

## Type of Change

- [ ] Bug fix
- [ ] New feature
- [ ] Refactoring
- [ ] Documentation
- [ ] Other (describe)

## Checklist

- [ ] Tests pass (`pnpm test`)
- [ ] Lint passes (`pnpm lint`)
- [ ] Type check passes (`pnpm typecheck`)
- [ ] Commit messages follow [Conventional Commits](https://www.conventionalcommits.org/)
23 changes: 23 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: CI

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 18
cache: pnpm
- run: pnpm install --frozen-lockfile
- run: pnpm lint
- run: pnpm typecheck
- run: pnpm test
- run: pnpm build
28 changes: 28 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Publish

on:
push:
tags: ['v*']

jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 18
cache: pnpm
registry-url: https://registry.npmjs.org
- run: pnpm install --frozen-lockfile
- run: pnpm lint
- run: pnpm typecheck
- run: pnpm test
- run: pnpm build
- run: pnpm publish --no-git-checks --provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [0.1.0] - 2026-03-07

### Added

- OAuth M2M authentication with auto-refresh (client_credentials grant)
- Invoice management (create, get, list with auto-pagination)
- Withdrawal management (create, get, list with cursor-based auto-pagination)
- Balance retrieval
- Transaction reporting
- Blockchain module for on-chain invoice operations via ZeroDev smart accounts
- Error hierarchy with typed exceptions (validation, auth, rate-limit, not-found, conflict)
- Exponential backoff retry with jitter for 429/5xx
- Request/response interceptors
- Idempotency key support
- Dual ESM/CJS build with TypeScript declarations

[Unreleased]: https://github.com/PrivaraXYZ/privara-sdk/compare/v0.1.0...HEAD
[0.1.0]: https://github.com/PrivaraXYZ/privara-sdk/releases/tag/v0.1.0
66 changes: 66 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Contributing

Thank you for your interest in contributing!

## Development Setup

### Prerequisites

- Node.js 18+
- pnpm

### Installation

```bash
git clone https://github.com/PrivaraXYZ/privara-sdk.git
cd privara-sdk
pnpm install
```

### Running Tests

```bash
pnpm test # Unit tests
pnpm test:coverage # Tests with coverage
pnpm typecheck # Type checking
pnpm build # Build ESM + CJS
```

## Code Style

- [Biome](https://biomejs.dev/) for linting and formatting
- Minimal comments — code should be self-documenting
- Use `snake_case` for API types (matches wire format)
- Prefer explicit types over `any`

## Commit Messages

We use [Conventional Commits](https://www.conventionalcommits.org/):

- `feat:` — New feature
- `fix:` — Bug fix
- `docs:` — Documentation
- `test:` — Tests
- `refactor:` — Code refactoring
- `chore:` — Build/config changes

## Pull Request Process

1. Fork the repository
2. Create feature branch (`git checkout -b feat/amazing-feature`)
3. Commit changes (`git commit -m 'feat: add amazing feature'`)
4. Push to branch (`git push origin feat/amazing-feature`)
5. Open Pull Request

### PR Checklist

- [ ] Tests pass (`pnpm test`)
- [ ] Lint passes (`pnpm lint`)
- [ ] Type check passes (`pnpm typecheck`)
- [ ] No new warnings
- [ ] Documentation updated if needed
- [ ] Follows existing code patterns

## Questions?

Open an issue or start a discussion.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 PrivaraXYZ

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
41 changes: 41 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Security Policy

## Supported Versions

| Version | Supported |
| ------- | --------- |
| 0.x.x | ✅ |

## Reporting a Vulnerability

We take security vulnerabilities seriously. If you discover a security issue, please report it responsibly.

### How to Report

Please report security vulnerabilities through GitHub's Security Advisories:

**[Report a vulnerability](https://github.com/PrivaraXYZ/privara-sdk/security/advisories/new)**

### What to Include

When reporting a vulnerability, please include:

- A clear description of the vulnerability
- Steps to reproduce the issue
- Potential impact assessment
- Any suggested fixes (optional)

### Response Timeline

- **Initial Response**: Within 48 hours
- **Status Update**: Within 5 business days
- **Resolution Target**: Depends on severity

## Security Best Practices

When using this SDK:

1. Always use HTTPS for the Privara API URL
2. Use secrets management for client credentials
3. Keep dependencies up to date
4. Never log or expose OAuth tokens
9 changes: 9 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,5 +96,14 @@
"lint-staged": {
"*.{ts,json}": "biome check --write --no-errors-on-unmatched"
},
"repository": {
"type": "git",
"url": "https://github.com/PrivaraXYZ/privara-sdk.git"
},
"homepage": "https://github.com/PrivaraXYZ/privara-sdk#readme",
"bugs": {
"url": "https://github.com/PrivaraXYZ/privara-sdk/issues"
},
"packageManager": "pnpm@10.30.3",
"license": "MIT"
}
4 changes: 3 additions & 1 deletion src/core/idempotency.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { randomUUID } from 'node:crypto';

export function generateIdempotencyKey(): string {
return crypto.randomUUID();
return randomUUID();
}