Skip to content

About

Adamantium packet library

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Adamantium Packet Library

This service stores and serves versioned Adamantium WASM packets. Publishing will be added separately.

Run

cargo run

The default address is 127.0.0.1:3000. Set BIND_ADDRESS to change it and PACKET_LIBRARY_ROOT to select the directory containing the database and storage.

On startup, the service creates:

packets_database.sqlite
Storage/
Deleted/

The packets table contains a numeric packet ID, unique name, author or account, and the current latest version. Packet files are stored as:

Storage/<packet-id>/<major>_<minor>_<patch>.wasm

Download API

GET /api/download/<packet-name>/<version>
GET /api/download/<packet-name>/latest

For example:

GET /api/download/AdamantiumFiles/1.2.3
GET /api/download/AdamantiumFiles/latest

The API accepts canonical three-part versions such as 1.2.3. It resolves the packet name through a parameterized SQLite query and constructs storage paths only from the database ID and parsed numeric version components. Canonical path validation prevents files outside Storage from being served.

Accounts and authentication

Create an account:

POST /api/accounts
Content-Type: application/json

{"username":"ExampleOwner","password":"a-long-private-password"}

Passwords must contain 12 to 1024 bytes. Only an Argon2id password hash and a random salt are stored. The response contains the new account ID:

{"status":"created","id":1}

All modifying packet operations and account deletion use HTTP Basic authentication. Send the account name as the username and the original password. Use HTTPS in every deployed environment so credentials are encrypted in transit.

Delete the authenticated account and all packets it owns:

DELETE /api/accounts/<account-id>
Authorization: Basic <base64(username:password)>

Packet management

Create a packet:

POST /api/packets
Authorization: Basic <base64(username:password)>
Content-Type: application/json

{"owner_id":1,"name":"ExamplePacket"}

The response contains the new packet ID. Names are unique without regard to ASCII letter case.

Upload a version as the raw request body:

POST /api/packets/<packet-id>/versions/1.2.3
Authorization: Basic <base64(username:password)>
Content-Type: application/wasm

<WASM bytes>

The service checks the WASM magic header, limits uploads to 64 MiB, prevents overwriting an existing version and updates latest to the highest semantic version.

Change ownership. The current owner authorizes this request:

PUT /api/packets/<packet-id>/owner
Authorization: Basic <base64(current-owner:password)>
Content-Type: application/json

{"new_owner_id":2}

Delete a packet:

DELETE /api/packets/<packet-id>
Authorization: Basic <base64(owner:password)>

Deletion compresses every stored version into one ZIP file under Deleted/. The deleted_packets table records the original packet ID, owner, deletion time, archive path and expiration time. Archives and their database records are kept for seven days, then removed by an hourly retention worker. Expired records are also removed during startup.

About

Adamantium packet library

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages