mirror of
https://github.com/nextcloud/passman.git
synced 2025-09-06 13:04:37 +08:00
Fix markdown syntax / reformatting of api.md
Signed-off-by: Samuel Barabas <samuel@owee.de>
This commit is contained in:
parent
9aa31e8819
commit
330545dc51
1 changed files with 109 additions and 89 deletions
44
docs/api.md
44
docs/api.md
|
@ -9,27 +9,34 @@ Passman offers a api for extensions.
|
|||
- [Update credential](#update-credential-patch)
|
||||
- [Decrypting Credentials / challenge password ](#decrypting-credentials--challenge-password)
|
||||
|
||||
|
||||
## Authentication
|
||||
|
||||
All apps must authenticate.
|
||||
For example in JS it would be:
|
||||
|
||||
```
|
||||
var encodedLogin ="MyUsername:MyPassword";
|
||||
var request = new XMLHttpRequest({"mozAnon": true});
|
||||
request.setRequestHeader("Authorization", "Basic " + encodedLogin);
|
||||
request.setRequestHeader("Content-Type", "application/json");
|
||||
```
|
||||
|
||||
An other option is logging in via HTTP Basic auth.
|
||||
In this case an example would be:
|
||||
`https://MyUsername:Mypassword@nextcloudinstance.com`
|
||||
|
||||
Connectivity via http is possible, but you *MUST* warn that their login credentials are send in plaintext.
|
||||
The credentials from passman are still send encrypted if http is used.
|
||||
The credentials from Passman are still send encrypted if http is used.
|
||||
|
||||
|
||||
### Get vaults [GET]
|
||||
|
||||
`/apps/passman/api/v2/vaults`
|
||||
|
||||
This will return a list of vaults.
|
||||
A vault consists of the following properties:
|
||||
|
||||
```
|
||||
{
|
||||
"vault_id": 17,
|
||||
|
@ -41,20 +48,24 @@ A vault consists of the following properties:
|
|||
"challenge_password": "eyJpdiI6IkFEWExocDFsRWFZSEZhc0cxY2NzUnciLCJ2IjoxLCJpdGVyIjoxMDAwLCJrcyI6MjU2LCJ0cyI6NjQsIm1vZGUiOiJjY20iLCJhZGF0YSI6IiIsImNpcGhlciI6ImFlcyIsInNhbHQiOiJFVmdZLzIxNmI0USIsImN0IjoiU3d5QUkzdVFqenh1cStwaCJ9"
|
||||
}
|
||||
```
|
||||
|
||||
Short description of the fields:
|
||||
- `vault_id` -Id of the vault, only used within queries
|
||||
- `vault_guid` - The guid of the vault, use this when making requests
|
||||
- `name` - The name of the vault
|
||||
- `created` - Timestamp when the vault was created
|
||||
- `public_sharing_key` - The public sharing key
|
||||
- `last_access` - Timestamp when the vault was last accessed
|
||||
- `vault_id` - Id of the vault, only used within queries.
|
||||
- `vault_guid` - The guid of the vault, use this when making requests.
|
||||
- `name` - The name of the vault.
|
||||
- `created` - Timestamp when the vault was created.
|
||||
- `public_sharing_key` - The public sharing key.
|
||||
- `last_access` - Timestamp when the vault was last accessed.
|
||||
- `challenge_password` - Encrypted challenge password, you can use this to check if the user provided a correct password.
|
||||
|
||||
|
||||
### Get vault [GET]
|
||||
|
||||
`/apps/passman/api/v2/vaults/{vault_guid}`
|
||||
|
||||
To request the credentials.
|
||||
This will return the requested vault and it's credentials
|
||||
This will return the requested vault and it's credentials:
|
||||
|
||||
```$xslt
|
||||
created: 1484175865
|
||||
credentials: [{}, {}, ....]
|
||||
|
@ -67,11 +78,16 @@ sharing_keys_generated:1484175865
|
|||
vault_id: 17
|
||||
vault_settings: null
|
||||
```
|
||||
|
||||
To see how a credential is build up (which fields), see [create new credential](#Create new credential).
|
||||
|
||||
|
||||
### Create new credential [POST]
|
||||
|
||||
`/api/v2/credentials`
|
||||
|
||||
Fields:
|
||||
|
||||
```$xslt
|
||||
var credential = {
|
||||
'vault_id': int,
|
||||
|
@ -108,23 +124,28 @@ var credential = {
|
|||
'hidden': false
|
||||
};
|
||||
```
|
||||
|
||||
There are a few special fields here.
|
||||
|
||||
- `custom_fields`
|
||||
- Those fields are added by the user `secret` indicates if the value should be hidden
|
||||
- Those fields are added by the user `secret` indicates if the value should be hidden.
|
||||
|
||||
When posting to the endpoint the following fields are required:
|
||||
- `label`
|
||||
- `vault_id`
|
||||
|
||||
|
||||
### Update credential [PATCH]
|
||||
|
||||
`/api/v2/credentials/{credential_guid}`
|
||||
See [create new credential](#Create new credential).
|
||||
|
||||
|
||||
|
||||
### Decrypting Credentials / challenge password
|
||||
For the client side encryption we use [sjcl](https://github.com/bitwiseshiftleft/sjcl)
|
||||
|
||||
For the client side encryption we use [sjcl](https://github.com/bitwiseshiftleft/sjcl).
|
||||
To decrypt (and test if a valid key is given):
|
||||
|
||||
```$xslt
|
||||
var encryption_config = {
|
||||
adata: "",
|
||||
|
@ -154,4 +175,3 @@ The following fields are encrypted:
|
|||
- `tags`
|
||||
- `url`
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue