API for LOGIN / LOGOUT PLAYER - IPNS 5001 access control -

This commit is contained in:
fred 2023-02-23 18:46:55 +01:00
parent eb8ab6433b
commit e31f00d0e4
2 changed files with 41 additions and 4 deletions

View File

@ -363,6 +363,32 @@ echo "" > ~/.zen/tmp/.ipfsgw.bad.twt # TODO move in 20h12.sh
exit 0
fi
##############################################
# LOGIN
##############################################
if [[ $APPNAME == "login" ]]; then
## REMOVE PLAYER IPNS KEY FROM STATION
PLAYER=${WHAT}
if [[ -d ~/.zen/game/players/${PLAYER}/ipfs ]]; then
ipfs key import ${PLAYER} -f pem-pkcs8-cleartext ~/.zen/tmp/coucou/${MOATS}.${G1PUB}.ipns.key
REP="LOGIN OK"
else
REP="ERROR UNKNOW ${PLAYER}"
fi
echo ${REP}
echo "$HTTPCORS ${REP}"| nc -l -p ${PORT} -q 1 > /dev/null 2>&1 &
end=`date +%s`
echo $APPNAME "(☉_☉ ) Execution time was "`expr $end - $start` seconds.
exit 0
fi
##############################################
# LOGOUT
@ -376,7 +402,7 @@ echo "" > ~/.zen/tmp/.ipfsgw.bad.twt # TODO move in 20h12.sh
ipfs key rm ${G1PUB} > /dev/null 2>&1
ipfs key rm ${PLAYER} > /dev/null 2>&1
REP="OK"
REP="LOGOUT OK"
else
@ -398,7 +424,7 @@ echo "" > ~/.zen/tmp/.ipfsgw.bad.twt # TODO move in 20h12.sh
## RESPONDING
## END RESPONDING
[[ ! -s ~/.zen/tmp/coucou/${MOATS}.index.redirect ]] && echo "$HTTPCORS PORT=$1 THAT=$2 AND=$3 THIS=$4 APPNAME=$5 WHAT=$6 OBJ=$7 VAL=$8 MOATS=$9" > ~/.zen/tmp/coucou/${MOATS}.index.redirect
cat ~/.zen/tmp/coucou/${MOATS}.index.redirect | nc -l -p ${PORT} -q 1 > ~/.zen/tmp/coucou/${MOATS}.official.swallow &
echo "HTTP 1.1 PROTOCOL DOCUMENT READY"

View File

@ -114,14 +114,25 @@ GET /?salt=${SALT}&pepper=${PEPPER}&g1pub=${URLENCODEDURL}&email=${PLAYER}
### LOGOUT PLAYER (remove IPNS keys from Station)
```http
GET /?salt=${SALT}&pepper=${PEPPER}&g1pub=${PLAYER}
GET /?salt=${SALT}&pepper=${PEPPER}&logout=${PLAYER}
```
| Parameter | Type | Description |
| :-------- | :------- | :-------------------------------- |
| `salt` | `string` | **Required**. Your passphrase one token |
| `pepper` | `string` | **Required**. Your passphrase two token |
| `g1pub` | `string` | **Required**. Your email one token |
| `logout` | `string` | **Required**. Your email one token |
### LOGIN PLAYER (Activate IPNS keys on Station)
```http
GET /?salt=${SALT}&pepper=${PEPPER}&login=${PLAYER}
```
| Parameter | Type | Description |
| :-------- | :------- | :-------------------------------- |
| `salt` | `string` | **Required**. Your passphrase one token |
| `pepper` | `string` | **Required**. Your passphrase two token |
| `login` | `string` | **Required**. Your email one token |
### Lire Messagerie Gchange