This commit is contained in:
Naden
2026-04-25 05:11:15 +07:00
parent 8beaae7547
commit 964ff3a547
3 changed files with 243 additions and 4 deletions

View File

@@ -0,0 +1,238 @@
{
"info": {
"_postman_id": "kta-digital-api",
"name": "KTA Digital API",
"description": "Koleksi API untuk Project KTA Digital (Personel & Auth)",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Auth",
"item": [
{
"name": "Login Admin",
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "urlencoded",
"urlencoded": [
{
"key": "username",
"value": "dhivaadmin",
"type": "text"
},
{
"key": "password",
"value": "dhivaadmin",
"type": "text"
}
]
},
"url": {
"raw": "{{baseUrl}}/auth",
"host": [
"{{baseUrl}}"
],
"path": [
"auth"
]
},
"description": "Login sebagai dhivaadmin. Response akan berisi Authorization & ClientSecret."
},
"response": []
},
{
"name": "Login User (NRP)",
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "urlencoded",
"urlencoded": [
{
"key": "username",
"value": "83121540",
"type": "text"
},
{
"key": "password",
"value": "83121540",
"type": "text"
}
]
},
"url": {
"raw": "{{baseUrl}}/auth",
"host": [
"{{baseUrl}}"
],
"path": [
"auth"
]
}
},
"response": []
}
]
},
{
"name": "Personel",
"item": [
{
"name": "Get Profil (Plain NRP)",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/personel/profil?nrp=83121540",
"host": [
"{{baseUrl}}"
],
"path": [
"personel",
"profil"
],
"query": [
{
"key": "nrp",
"value": "83121540"
}
]
}
},
"response": []
},
{
"name": "Get Profil (Encrypted NRP)",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/personel/profil?nrp=ENCRYPTED_STRING_HERE",
"host": [
"{{baseUrl}}"
],
"path": [
"personel",
"profil"
],
"query": [
{
"key": "nrp",
"value": "ENCRYPTED_STRING_HERE",
"description": "Ganti dengan hasil dari generate-link"
}
]
}
},
"response": []
},
{
"name": "Get DRH (Riwayat Hidup)",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{baseUrl}}/personel/drh?nrp=83121540&otp=4444",
"host": [
"{{baseUrl}}"
],
"path": [
"personel",
"drh"
],
"query": [
{
"key": "nrp",
"value": "83121540"
},
{
"key": "otp",
"value": "4444"
}
]
}
},
"response": []
},
{
"name": "Generate Encrypted Link",
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "{{token}}",
"type": "text"
},
{
"key": "ClientSecret",
"value": "{{clientSecret}}",
"type": "text"
}
],
"body": {
"mode": "urlencoded",
"urlencoded": [
{
"key": "nrp",
"value": "83121540",
"type": "text"
}
]
},
"url": {
"raw": "{{baseUrl}}/personel/generate-link",
"host": [
"{{baseUrl}}"
],
"path": [
"personel",
"generate-link"
]
}
},
"response": []
}
]
}
],
"event": [
{
"listen": "prerequest",
"script": {
"type": "text/javascript",
"exec": [
""
]
}
},
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
""
]
}
}
],
"variable": [
{
"key": "baseUrl",
"value": "http://localhost:8080",
"type": "string"
},
{
"key": "token",
"value": "PASTE_TOKEN_HERE",
"type": "string"
},
{
"key": "clientSecret",
"value": "PASTE_CLIENT_SECRET_HERE",
"type": "string"
}
]
}

View File

@@ -29,12 +29,12 @@ class PersonelController extends BaseController
$nrp = $inputNrp; $nrp = $inputNrp;
if (!is_numeric($inputNrp)) { if (!is_numeric($inputNrp)) {
try { try {
$nrp = DhivaAES::base64url_decode($inputNrp); $decrypted = DhivaAES::base64url_decode($inputNrp);
if (!$nrp) { if ($decrypted !== false && !empty($decrypted)) {
$nrp = $inputNrp; // Fallback to original if decryption fails $nrp = $decrypted;
} }
} catch (\Exception $e) { } catch (\Exception $e) {
$nrp = $inputNrp; // Keep original if crash
} }
} }

View File

@@ -12,6 +12,7 @@
"require": { "require": {
"php": "^7.4 || ^8.0", "php": "^7.4 || ^8.0",
"codeigniter4/framework": "^4.0", "codeigniter4/framework": "^4.0",
"firebase/php-jwt": "^7.0",
"guzzlehttp/guzzle": "^7.10", "guzzlehttp/guzzle": "^7.10",
"mobiledetect/mobiledetectlib": "^4.8", "mobiledetect/mobiledetectlib": "^4.8",
"ramsey/uuid": "^4.9", "ramsey/uuid": "^4.9",