|
# API Document
|
|
# API Document
|
|
1. Create a new account
|
|
## Create a new account
|
|
|
|
|
|
* URL: `account/new`
|
|
* URL: `account/new`
|
|
|
|
|
... | @@ -18,7 +18,7 @@ |
... | @@ -18,7 +18,7 @@ |
|
| serial | char(32) | the serial of the new account |
|
|
| serial | char(32) | the serial of the new account |
|
|
| username | string | the username of the new account |
|
|
| username | string | the username of the new account |
|
|
|
|
|
|
2. Authenticate (Install) a new machine
|
|
## Authenticate (Install) a new machine
|
|
|
|
|
|
* URL: `machine/new`
|
|
* URL: `machine/new`
|
|
|
|
|
... | @@ -38,10 +38,50 @@ |
... | @@ -38,10 +38,50 @@ |
|
| pri_key | base64 string | RSA private key |
|
|
| pri_key | base64 string | RSA private key |
|
|
| machine_id | int | ID of the machine |
|
|
| machine_id | int | ID of the machine |
|
|
|
|
|
|
3. Revoke the authentication of a machine
|
|
## Revoke the authentication of a machine
|
|
|
|
|
|
|
|
* URL: `machine/revoke`
|
|
|
|
|
|
|
|
* Request
|
|
|
|
|
|
| Parameter | Type | Description |
|
|
| Parameter | Type | Description |
|
|
| ----- | ----- | ----- |
|
|
| ----- | ----- | ----- |
|
|
| username | string | username |
|
|
| username | string | username |
|
|
| password | string | password |
|
|
| password | string | password |
|
|
| machine_id | int | ID of the machine to revoke | |
|
| machine_id | int | ID of the machine to revoke |
|
|
\ No newline at end of file |
|
|
|
|
|
## Authenticate an existed machine
|
|
|
|
|
|
|
|
* URL: `machine/auth`
|
|
|
|
|
|
|
|
#### Step 0
|
|
|
|
|
|
|
|
* Request
|
|
|
|
|
|
|
|
| Parameter | Type | Description |
|
|
|
|
| ----- | ----- | ----- |
|
|
|
|
| serial | string | serial of user |
|
|
|
|
| pub_key | base64 string | public key on the machine |
|
|
|
|
|
|
|
|
* Response
|
|
|
|
|
|
|
|
| Parameter | Type | Description |
|
|
|
|
| ----- | ----- | ----- |
|
|
|
|
| encrypted | string | encrypted text for the client to decrypt |
|
|
|
|
| auth_id | int | authentication sequence ID |
|
|
|
|
|
|
|
|
#### Step 1
|
|
|
|
|
|
|
|
* Request
|
|
|
|
|
|
|
|
| Parameter | Type | Description |
|
|
|
|
| ----- | ----- | ----- |
|
|
|
|
| decrypted | string | decrypted text from the client |
|
|
|
|
| auth_id | int | authentication sequence ID |
|
|
|
|
|
|
|
|
* Response
|
|
|
|
|
|
|
|
| Parameter | Type | Description |
|
|
|
|
| ----- | ----- | ----- |
|
|
|
|
| nfc_pass | base64 string | password of the NFC |
|
|
|
|
| auth_id | int | authentication sequence ID | |