feat(libSceNpAuth): implement offline auth requests #3604
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3604"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by itsbo5 on 2026-10-11T14:09:50Z.
What
Implement
sceNpAuthCreateRequest,sceNpAuthGetIdTokenV3, andsceNpAuthWaitAsyncoffline stubs inlibSceNpAuth. Add guest test covering sequential request ID generation, parameter validation, and offline signed-out returns. Document unverified request tracking behavior inTechnicalDebt.md.Tested
Verified guest tests in
core/libs/tests/GuestNpAuth.cpp.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T14:10:15Z.
Progress report (
27873b0→62d1275)📈 System libraries: 87.15% (+0.08%, +3 implemented functions)
✅ 3 implemented
sceNpAuthCreateRequestsceNpAuthGetIdTokenV3sceNpAuthWaitAsyncImported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T14:12:57Z.
Review: CHANGES_REQUESTED
Thanks for the PR. The offline behaviour (incrementing request ids,
SCE_NP_ERROR_SIGNED_OUTfor tokens) matches shadPS4/KytyPS5. A few things before it can merge:What,Tested,Checklist), which is whyconventionsfails. Please fill it in, including what you ran.CreateRequest(distinct ids),GetIdTokenV3(nullparam/id_token→INVALID_ARGUMENT, otherwiseSIGNED_OUT) andWaitAsync.core/libs/prx/libSceNpAuth/Export.cpp:25-57: the diff re-indents untouched functions (DeleteRequest,GetAuthorizationCodeV3,PollAsync) and the file now mixes 1- and 4-space indentation. Please match the file's style and keep only the changed lines.Export.cpp:54:WaitAsyncaccepts anyreq_idand a nullresult. shadPS4 returnsINVALID_ARGUMENTfor a nullresultandREQUEST_NOT_FOUNDfor an unknown id. Either do the same or add a line indocs/dev/TechnicalDebt.md("Unknown function info") saying ids are not tracked andreq_idis not validated (same forPoll/Delete).Imported from boykopovar/AnyPS5. Originally posted by itsbo5 on 2026-10-11T14:40:36Z.
updated
Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-11T15:20:09Z.
Independent pre-review on Linux (full CI runs only happen on manual trigger, so recording one): CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release,
BUILD_TESTING=ON.tools/check_conventions.py --base origin/mainpasses.Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-11T15:50:18Z.
Tested together with the Ces branch for Teardown (PPSA15246): with this PR the title no longer throws at
sceNpAuthGetIdTokenV3and goes on to the graphics start-up (details in #3701).One point to check against the reference: shadPS4's
GetIdToken(np_auth.cpp) distinguishes the request kind when signed out. For an async request (created withsceNpAuthCreateAsyncRequest) the call returnsORBIS_OKand stores the signed-out error in the request result, whichsceNpAuthPollAsync/sceNpAuthWaitAsyncreturn later; only for a synchronous request does the call itself returnSCE_NP_ERROR_SIGNED_OUT. This PR returns signed-out fromsceNpAuthGetIdTokenV3for every request id and does not record the kind of the request. Teardown did not trip over it in a 60 s run, and I have not checked which request kind it uses, so this is a note on fidelity, not a failure.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by itsbo5 on 2026-10-11T16:18:53Z.
Thanks for testing with Teardown and verifying the graphics startup progress!
Regarding the request kinds: the Technical Debt entry currently documents that request IDs are atomic counters and are not tracked offline. As titles exercise more of the asynchronous auth flow, we can follow up with full request state tracking (distinguishing sync vs async) in a dedicated PR.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T16:29:41Z.
Review: CHANGES_REQUESTED
Thanks, the offline path is a good start and the new
guest_np_authtest fails without the change. One thing before it can merge:core/libs/prx/libSceNpAuth/Export.cpp:43-44(sceNpAuthGetIdTokenV3) returnsSCE_NP_ERROR_SIGNED_OUTfor every request id. As @xXPBSXx pointed out, shadPS4 (np_auth.cpp,GetIdTokenwithCreateNpAuthRequest(async)) treats the two request kinds differently: for a request fromsceNpAuthCreateAsyncRequestthe call returns OK and the signed-out error is stored in the request, then returned bysceNpAuthPollAsync/sceNpAuthWaitAsync; only a request fromsceNpAuthCreateRequestgets the error from the call itself. Right nowmainthrows here, so returning a plausible result that differs for async requests is the case we avoid (exact or throw).What would fix it: keep a small mutex-protected table
req_id -> {async, result}filled by the twoCreate*functions;GetIdTokenV3/GetAuthorizationCodeV3return OK and storeSCE_NP_ERROR_SIGNED_OUTfor async requests,Poll/Waitreturn the stored result, and add test rows for both kinds. Unknown ids need either a reference or a line under "Unknown function info" (shadPS4 returnsREQUEST_NOT_FOUND, but it is PS4).docs/dev/TechnicalDebt.md:70entry, which currently says requests are not tracked.Checked: build and ctest of the PR merged onto
main, and the negative run of the test. Note that shadPS4 is a PS4 reference; if you have anything from PS5, cite it.Imported from boykopovar/AnyPS5. Originally posted by itsbo5 on 2026-10-11T17:07:16Z.
Updated to track requests following shadPS4 (
np_auth.cpp):asyncvssync) and results.sceNpAuthGetIdTokenV3andsceNpAuthGetAuthorizationCodeV3now return0for async requests while deferringSCE_NP_ERROR_SIGNED_OUTtoPollAsync/WaitAsync, and returnSCE_NP_ERROR_SIGNED_OUTdirectly for synchronous requests.SCE_NP_ERROR_REQUEST_NOT_FOUND(0x80550014), documented underUnknown function infoindocs/dev/TechnicalDebt.md.GuestNpAuthwith test rows for both request kinds, unknown IDs, and deleted IDs.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T17:45:28Z.
Review: CHANGES_REQUESTED
Thanks for the update; the sync/async table is what was needed. Checked: build and ctest of the PR merged onto
main(guest_np_authpasses). Remaining points, all against the same shadPS4np_auth.cppthe TechnicalDebt line cites:core/libs/prx/libSceNpAuth/Export.cpp:11:0x80550014is the genericORBIS_NP_ERROR_REQUEST_NOT_FOUND. shadPS4's auth functions returnORBIS_NP_AUTH_ERROR_REQUEST_NOT_FOUND=0x80550306(np_error.h). Please use that in the code, the test (GuestNpAuth.cpp:26) anddocs/dev/TechnicalDebt.md:70, whose "follow shadPS4" is otherwise not true.Export.cpp:90-95and:82-86(WaitAsync/PollAsync): shadPS4 returnsORBIS_NP_AUTH_ERROR_INVALID_ID(0x80550307) when the request is not async, or when it is async butGetIdToken/GetAuthorizationCodehas not been called on it yet (stateReady). Here a sync request (and an unprocessed async one) returns OK with the stored result. Please track that state (e.g. aprocessedflag set by the Get* calls) and update the test rows (GuestNpAuth.cpp:72-76currently pin the sync case as OK).GetIdTokenV3/GetAuthorizationCodeV3ran on a request, shadPS4 returnsINVALID_ARGUMENTon a second call (stateComplete). If you don't model that, list it under the TechnicalDebt entry.Imported from boykopovar/AnyPS5. Originally posted by itsbo5 on 2026-10-11T17:57:03Z.
updated
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-11T22:50:26Z.
Rebase needed: merged into current
main(bb48d60fc), this PR conflicts incore/libs/CMakeLists.txt(itsguest_np_auth_testsblock sits next to a block added onmain;TechnicalDebt.mdconflicts too).Test from Teardown (PPSA15246), Windows, 60 s runs: with this PR the title passes
sceNpAuthGetIdTokenV3and goes on to savedata and graphics start-up (details in #3701); without it the call throws.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-12T05:39:23Z.
Review notes, comparing the code with the shadPS4 source this PR's TechnicalDebt entry cites (
np_auth.cppandnp_error.h, read at currentmain). I did not run these; they are differences between this diff and that reference, not console measurements.SCE_NP_ERROR_INVALID_ARGUMENTon repeated calls "follows shadPS4". In shadPS4GetIdToken/GetAuthorizationCodereturnORBIS_NP_AUTH_ERROR_INVALID_ARGUMENT(0x80550301) for a nullparamor output pointer, for a request that is alreadyComplete, andsceNpAuthWaitAsyncdoes so for a nullresult. This diff returnsSCE_NP_ERROR_INVALID_ARGUMENT(0x80550003) in all of those places (sceNpAuthGetIdTokenV3,sceNpAuthGetAuthorizationCodeV3,sceNpAuthWaitAsync), andcore/libs/tests/GuestNpAuth.cpppinsinvalidArgument = 0x80550003. Either use0x80550301or say in the entry that it deliberately differs.ORBIS_NP_AUTH_ERROR_INVALID_SIZE(0x80550302) whenparam->sizeis not the structure size, before the request lookup. This diff reads neitherparamfield, so a wrongsizeis accepted. The structure layouts are not in this PR, so adding it needs them; if that is the reason, the entry should list it as not checked.sceNpAuthAbortRequestis unchanged and ignores state. In shadPS4 it returnsORBIS_NP_AUTH_ERROR_REQUEST_NOT_FOUNDfor an unknown id and marks a not-yet-processed request aborted, so the nextGet*returnsORBIS_NP_AUTH_ERROR_ABORTED(0x80550304). Here it still returns 0 for any id, and the test callssceNpAuthAbortRequest(asyncReq)on a request that has completed. Not required for PPSA15246, but the entry describes request tracking as following shadPS4.g_requestsonly shrinks insceNpAuthDeleteRequest; a title that creates requests without deleting them grows it without limit (shadPS4 hasORBIS_NP_AUTH_ERROR_REQUEST_MAX,0x80550305). Minor.Also: the branch conflicts with
main(docs/dev/TechnicalDebt.md andcore/libs/CMakeLists.txtare the likely places) and needs a rebase.For context, PPSA15246 stops at
sceNpAuthGetIdTokenV3 not implementedonmain, so the PR is what that title needs; the points above are about matching the cited reference.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-12T08:23:44Z.
Conflicts with main in
core/libs/CMakeLists.txtanddocs/dev/TechnicalDebt.md; please rebase. One more from the same shadPS4 source: its auth functions returnORBIS_NP_AUTH_ERROR_INVALID_ARGUMENT(0x80550301) for null pointers and for a secondGet*call, not0x80550003(Export.cpp:9,GuestNpAuth.cpp:24). The three points from the last review are done.Imported from boykopovar/AnyPS5. Originally posted by Mouad-Scriptz-0 on 2026-10-12T08:58:04Z.
#4218 overlapped this PR with a simpler signed-out model for
sceNpAuthCreateRequest,sceNpAuthGetIdTokenV3andsceNpAuthWaitAsync; it is now cut down tosceNpAuthGetAuthorizedAppCodeonly (a stub from #4118 that Minecraft PPSA17221 calls after its sign-in dialog), so the request model stays here. Minecraft reaches its menu with the signed-out answers to the same three calls, in case that helps as a second title for this PR.Imported from boykopovar/AnyPS5. Originally posted by Pacuka on 2026-10-12T16:18:33Z.
Data point from Minecraft (PPSA17221), Linux / RX 6650 XT (RADV), on main
d592d54e1+ #4215 #4218 #454 #3633: opening Settings from the main menu aborts withsceNpAuthCreateRequest not implemented(called from the game, throughlibSceNpAuth.prx). With this PR applied, Settings opens and the game continues. The merge into current main conflicted only indocs/dev/TechnicalDebt.mdand in the test registration incore/libs/CMakeLists.txt;Export.cppmerged cleanly next to #4218.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-12T20:37:25Z.
Review: APPROVED
Thanks, and thanks @xXPBSXx, @oneandonlydean and @Pacuka for the review and the Teardown/Minecraft runs. Checked: build and ctest of the rebased branch (87/87 in
core/libs), andguest_np_authfails without the change. I rebased ontomain(the debt entries now live indocs/dev/debt/) and added these on top, so merging:Export.cpp: invalid-argument errors now useORBIS_NP_AUTH_ERROR_INVALID_ARGUMENT(0x80550301), as in shadPS4np_error.h, in the code, the test and the debt entry.sceNpAuthAbortRequestfollows shadPS4: unknown id returnsREQUEST_NOT_FOUND, an abort before processing makes the nextGet*returnORBIS_NP_AUTH_ERROR_ABORTED(0x80550304), an abort after completion is ignored. Test rows added.docs/dev/debt/libSceNpAuth.md: entry moved there and extended with what is not modelled (INVALID_SIZEchecks,REQUEST_MAX).