fix(iam): align cross-app proofs and add native IAM target launch

This commit is contained in:
2026-10-29 18:49:32 +08:00
parent dcb0db8275
commit 7cbc679287
25 changed files with 837 additions and 99 deletions
@@ -12,6 +12,14 @@ final class IamV2Flow
Db::name('iam_v2_flow')->insert(['flow_key' => hash('sha256', $kind . ':' . $secret), 'kind' => $kind,
'payload' => json_encode($payload, JSON_THROW_ON_ERROR), 'expires_at' => time() + $ttl, 'consumed' => 0]);
}
public static function peek(string $kind, string $secret, string $sid): array
{
$row = Db::name('iam_v2_flow')->where('flow_key', hash('sha256', $kind . ':' . $secret))->find();
if (!$row || $row['expires_at'] <= time() || (int) $row['consumed'] !== 0) { throw new RuntimeException('TRANSACTION_EXPIRED'); }
$p = json_decode($row['payload'], true, 32, JSON_THROW_ON_ERROR);
if (($p['sessionId'] ?? '') !== $sid) { throw new RuntimeException('ACCOUNT_MISMATCH'); }
return $p;
}
public static function take(string $kind, string $secret, string $sid): array
{
return Db::transaction(function () use ($kind, $secret, $sid) {