Your Little Cargo Registry.
Ktra
is an implementation of the Alternate Registry that is introduced for non-public crates in Rust/Cargo 1.34.
In other words, Ktra
is an all-in-one package of the private cargo registry.
secure-auth
feature.And any feature requests are welcome!
bash
$ cargo install ktra
Ktra
supports both HTTPS protocol and SSH protocol.config.json
and commit then push it to remote repository.bash
$ echo '{"dl":"http://localhost:8000/dl","api":"http://localhost:8000"}' > config.json
$ git add config.json
$ git commit -am "initial commit"
$ git push origin main
.cargo/config.toml
toml
[registries]
ktra = { index = "https://github.com/moriturus/ktra-index.git" }
Ktra
searches ./ktra.toml
as a default configuration file if not specified.ktra -h
for more details.```toml
remote_url
and credential informations.https_username
and https_password
fields.ssh_privkey_path
should be specified.[indexconfig] remoteurl = "https://github.com/moriturus/ktra-index.git" httpsusername = "moriturus" httpspassword = "2mdzctfryqirlqbhys43xsc46rbnr93g"
```
ktra
bash
$ ktra -c /path/to/config.toml
ktra
supports and recommends this authentication way.bash
$ curl -X POST -H 'Content-Type: application/json' -d '{"password":"PASSWORD"}' http://localhost:8000/ktra/api/v1/new_user/alice
{"token":"0N9mgZb3kzxtgGKECFuMkM2RT5xkYhdY"}
$ cargo login --registry=ktra 0N9mgZb3kzxtgGKECFuMkM2RT5xkYhdY
Login token for `ktra` saved
```bash $ cat Cargo.toml [package] name = "my_crate" version = "0.1.0" authors = ["moriturus moriturus@alimensir.com"] edition = "2018" description = "sample crate"
[dependencies] serde = "1.0"
$ cargo publish --registry=ktra ```
```toml [package] name = "myanothercrate" version = "0.1.0" authors = ["moriturus moriturus@alimensir.com"] edition = "2018"
[dependencies] my_crate = { version = "0.1", registry = "ktra" } ```
Ktra Web APIs
are extra web APIs that are not specified in the specification but required to manage users.
Since all APIs send passwords in cleartext, it is highly recommended that you connect the registry from your local network only OR use an HTTPS connection.
Endpoint | /ktra/api/v1/new_user/{user_name} |
Method | POST |
Body | { "password": "PASSWORD" } |
json
{
"token": "TOKEN"
}
Endpoint | /ktra/api/v1/login/{user_name} |
Method | POST |
Body | { "password": "PASSWORD" } |
json
{
"token": "NEW TOKEN"
}
Endpoint | /ktra/api/v1/change_password/{user_name} |
Method | POST |
Body | { "old_password": "OLD PASSWORD", "new_password": "NEW PASSWORD" } |
json
{
"token": "NEW TOKEN"
}
Licensed under either of Apache License, Version 2.0 or MIT license at your option.