Skip to content

Sunset phpseclib - Migrated the SDK from the legacy gree/jose implementation to web-token/jwt-framework. - #139

Merged
grmeyer-hw-dev merged 12 commits into
masterfrom
bugfix/migrate_to_jwt_jose
Oct 27, 2026
Merged

grmeyer-hw-dev merged 12 commits into
masterfrom
bugfix/migrate_to_jwt_jose

Conversation

@grmeyer-hw-dev

@grmeyer-hw-dev grmeyer-hw-dev commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

Changes include:

  • Added native JWK/JWS/JWE handling.
  • Preserved RS256, RSA-OAEP-256, and A256CBC-HS512 support.
  • Removed the Composer-time JOSE patch and obsolete source files.
  • Raised the minimum PHP version to 8.1.
  • Updated CI to test PHP 8.1–8.4.
  • Updated documentation generation to PHP 8.4.
  • Updated README prerequisites.

Test

  1. Create account on Sandbox

2 ) Setup script to add account with encrypt user using PHP 8.5

// crendetiaL

$encryptionData = [
    'clientPrivateKeySetLocation' => '/work/client-private-jwkset.json',
    'hyperwalletKeySetLocation' => '/work/hw-sandbox-jwkset.json'
];
$history = [];
$stack = HandlerStack::create();
$stack->push(Middleware::history($history));
$clientOptions = ['handler' => $stack];
$client = new Hyperwallet($username, $password, $programToken, 'https://api.sandbox.hyperwallet.com', $encryptionData, $clientOptions);
$user = new \Hyperwallet\Model\User();
$user->setProgramToken($programToken)
    ->setClientUserId(uniqid())
    ->setProfileType(\Hyperwallet\Model\User::PROFILE_TYPE_INDIVIDUAL)
    ->setFirstName('John')
    ->setLastName('Gotham')
    ->setEmail('testmail-' . uniqid() . '@hyperwallet.com')
    ->setAddressLine1('123 Main Street')
    ->setCity('Austin')
    ->setStateProvince('TX')
    ->setCountry('US')
    ->setPostalCode('78701');
try {
    $result = $client->createUser($user);
    echo "SUCCESS\n";
} catch (\Throwable $e) {
    echo "EXCEPTION: " . get_class($e) . ": " . $e->getMessage() . "\n";
}
foreach ($history as $t) {
    $req = $t['request'];
    $res = $t['response'];
    echo "=== REQUEST ===\n";
    echo $req->getMethod() . ' ' . $req->getUri() . "\n";
    foreach ($req->getHeaders() as $name => $values) {
        if (strtolower($name) === 'authorization') { echo "$name: [redacted]\n"; continue; }
        echo "$name: " . implode(', ', $values) . "\n";
    }
    echo "\nBody (encrypted JWE, full):\n" . (string)$req->getBody() . "\n\n";
    echo "=== RESPONSE ===\n";
    echo "Status: " . $res->getStatusCode() . "\n";
    foreach ($res->getHeaders() as $name => $values) {
        if (strtolower($name) === 'set-cookie') { continue; }
        echo "$name: " . implode(', ', $values) . "\n";
    }
    echo "\nBody (encrypted JWE, full):\n" . (string)$res->getBody() . "\n\n";
    echo "=== DECRYPTED RESPONSE ===\n";
    $encryption = new \Hyperwallet\Util\HyperwalletEncryption('/work/client-private-jwkset.json', '/work/hw-sandbox-jwkset.json');
    $decrypted = $encryption->decrypt((string)$res->getBody());
    echo json_encode($decrypted, JSON_PRETTY_PRINT) . "\n";
}

Request

Request:
POST https://api.sandbox.hyperwallet.com/rest/v4/users
Content-Type: application/jose+json
Accept: application/jose+json
Authorization: Basic [redacted]
User-Agent: Hyperwallet PHP SDK v2.2.7
Content-Length: 1667

Body (encrypted JWE, full):
eyJhbGciOiJSU0EtT0FFUC0yNTYiLCJlbmMiOiJBMjU2Q0JDLUhTNTEyIiwia2lkIjoiMjAxOF9lbmNfcnNhX1JTQS1PQUVQLTI1NiJ9.O5GrI3EC8rzZ_XZLmUypQ_vc4NhtJo2ywj5wBLHO-19mNj4SCTfCifKInu8TwEQGeHNGodrPKh_ofrBQdDaD8t-Ipt8zLNwbLAMvlAV1Khta9Wref10387dK-XK64FpbaCNMAd4AvrSL6iWZmCplSOLBzWphKsvkSm7sdqpAcWl7tICArMcNg0AtfzOFaCjQkkn92G6HWoOgI9DQqGzBJ2N9NcwPvoBVWOd6Kpzl9iKBnX1ixWgnElcXbeY2Jy60FsQBWoTH9K3lR92NtrcOTgNjgloJzSbU8S6zX22yT9p_1iEtJ7KpZTsUbY4zHAyUeSAVsS9UUTmWj_AbATa9jQ.KdYWgikhfd18fUFUaU3JXg.KZO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I63n-7qs5NZ9Gfn7jECUMpDA2YPvuE4lzmos6dJ9q0NRFRjfMDKKZEHbDWW0DLDboGCm.CLaElgcJW4UeO6DWivir2OjsyEABJO9miliJDwYgKbA

Response

HTTP/1.1 201 Created
content-type: application/jose+json
jwt-signing-algorithm: RS256
jwt-encryption-algorithm: RSA-OAEP-256
jwt-cek-algorithm: A256CBC-HS512
location: https://api.sandbox.hyperwallet.com/rest/v4/users
Content-Length: 2561
Body (encrypted JWE, full):
eyJraWQiOiJjbGllbnRfZW5jX3JzYV9SU0EtT0FFUC0yNTYiLCJjdHkiOiJKV1QiLCJlbmMiOiJBMjU2Q0JDLUhTNTEyIiwiYWxnIjoiUlNBL...

Preserved RS256, RSA-OAEP-256, and A256CBC-HS512 support.
Removed the Composer-time JOSE patch and obsolete source files.
Raised the minimum PHP version to 8.1.
Updated CI to test PHP 8.1–8.4.
Updated documentation generation to PHP 8.4.
Updated README prerequisites.
Preserved RS256, RSA-OAEP-256, and A256CBC-HS512 support.
Removed the Composer-time JOSE patch and obsolete source files.
Raised the minimum PHP version to 8.1.
Updated CI to test PHP 8.1–8.4.
Updated documentation generation to PHP 8.4.
Updated README prerequisites.
Preserved RS256, RSA-OAEP-256, and A256CBC-HS512 support.
Removed the Composer-time JOSE patch and obsolete source files.
Raised the minimum PHP version to 8.1.
Updated CI to test PHP 8.1–8.4.
Updated documentation generation to PHP 8.4.
Updated README prerequisites.
@coveralls

coveralls commented Oct 2, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 98.215% (+0.4%) from 97.816% — bugfix/migrate_to_jwt_jose into master

@grmeyer-hw-dev grmeyer-hw-dev changed the title Migrated the SDK from the legacy gree/jose implementation to web-token/jwt-framework. Sunset phpseclib - Migrated the SDK from the legacy gree/jose implementation to web-token/jwt-framework. Oct 2, 2026
@grmeyer-hw-dev
grmeyer-hw-dev merged commit 701c2fe into master Oct 27, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants