Giter Club home page Giter Club logo

laravel-passes's People

Contributors

chiiya avatar dependabot[bot] avatar github-actions[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

laravel-passes's Issues

Invalid certificate file error

I have created a certificate file by exporting it with its private key from Apple Keychain, as directed in the requirements file, but I'm getting an error when the PassFactory tries to sign the pass:

Invalid certificate file: "certificates/certificates.p12"

I found that if I try to read it with openssl, I get this error:

openssl pkcs12 -info -in certificates/certificates.p12
Enter Import Password:
MAC: sha1, Iteration 1
MAC length: 20, salt length: 8
PKCS7 Encrypted data: pbeWithSHA1And40BitRC2-CBC, Iteration 2048
Error outputting keys and certificates
806075EE01000000:error:0308010C:digital envelope routines:inner_evp_generic_fetch:unsupported:crypto/evp/evp_fetch.c:341:Global default library context, Algorithm (RC2-40-CBC : 0), Properties ()

Searching on that reveals that this is apparently due to an old format for the p12 file, and to read it in the openssl binary I needed to add -legacy to the command line, after which it seems to show the contents of the file correctly. So now I'm suspecting that PHP may have a similar problem reading it, but I don't know how to do the equivalent of setting the legacy flag in PHP. Any ideas?

Setting a google pass' state to INACTIVE (State::INACTIVE) triggers a validatation error

$object = $objectRepository->get($objectId);

$object->state = State::INACTIVE;

$objectRepository->update($object); // Validation error: `Chiiya\Passes\Google\Passes\GenericObject->state`: The value is invalid. Should be one of .STATE_UNSPECIFIED, ACTIVE, COMPLETED, EXPIRED, INACTIVE

Apparently when a google pass' state is set to 'INACTIVE', the API returns the state legacy value 'inactive'. It seems that then the State method mapLegacyValues is applied. Due to the order of the values, the substring 'active' is replaced first, so 'inactive' becomes 'inACTIVE', which triggers the validation error.

In the mapLegacyValues State method I would use preg_replace:
preg_replace(['/^active$/', '/^completed$/', '/^expired$/', '/^inactive$/'], [self::ACTIVE, self::COMPLETED, self::EXPIRED, self::INACTIVE], $value);
instead of:
str_replace(['active', 'completed', 'expired', 'inactive'], [self::ACTIVE, self::COMPLETED, self::EXPIRED, self::INACTIVE], $value);
Or change the order of the replace values, such as:
str_replace(['inactive', 'active', 'completed', 'expired'], [self::INACTIVE, self::ACTIVE, self::COMPLETED, self::EXPIRED], $value);

DateTime->date: The field is required.

I use the following code to create a validTimeInterval in an EventTicketObject

validTimeInterval: new TimeInterval(
		start: new DateTime(date: Carbon::now()),
		end: new DateTime(Carbon::now()->addMonth())
	),

However the following error message appears

PHP Fatal error:  Uncaught Spatie\DataTransferObject\Exceptions\ValidationException: Validation errors:
	 - `Chiiya\Passes\Google\Components\Common\DateTime->date`: The field is required. in /var/www/GoogleWalletDemo/vendor/spatie/data-transfer-object/src/Reflection/DataTransferObjectClass.php:63
Stack trace:
#0 /var/www/GoogleWalletDemo/vendor/spatie/data-transfer-object/src/DataTransferObject.php(38): Spatie\DataTransferObject\Reflection\DataTransferObjectClass->validate()
#1 /var/www/GoogleWalletDemo/src/google_event.php(91): Spatie\DataTransferObject\DataTransferObject->__construct()
#2 {main}
  thrown in /var/www/GoogleWalletDemo/vendor/spatie/data-transfer-object/src/Reflection/DataTransferObjectClass.php on line 63

Dependency on obsolete spatie/data-transfer-object package

This package has a dependency on the spatie/data-transfer-object package, which is no longer maintained.

They recommend that you switch to their spatie/laravel-data package instead, though I've not spotted a migration advice (so I asked). Alternatively, they suggest using cuyz/valinor for handling strongly-typed DTOs.

The dependency is actually in your passes package, but when I created an issue in there, it created one in this repo instead because of the settings in here. Is that intentional?

Apple pass is generated, but invalid

I have the following test pass

use Chiiya\Passes\Apple\Components\Image;
use Chiiya\Passes\Apple\Enumerators\ImageType;
use Chiiya\Passes\Apple\PassFactory;

$pass = new \Chiiya\Passes\Apple\Passes\GenericPass(
    description: '15% off purchases',
    organizationName: 'organization',
    passTypeIdentifier: 'pass.identifier,
    serialNumber: '1',
    teamIdentifier: 'organization id',
);

$pass
    ->addImage(new Image('logo.png', ImageType::ICON))
    ->addImage(new Image('logo.png', ImageType::ICON, 2))
;
$factory = new PassFactory();
$factory->setCertificate(__DIR__ . "/Certificates55.p12");
$factory->setPassword('password');
$factory->setWwdr(__DIR__ . "/aww.pem");
$factory->setOutput(__DIR__);
$file = $factory->create($pass, 'filename');

this creates the pass file successfully, but i am unable to use/import them in my app. If i use the example passes that Apple provides https://developer.apple.com/services-account/download?path=/iOS/Wallet_Support_Materials/WalletCompanionFiles.zip, my app loads it just fine.

Am I missing something?

Unable to generate a skinny JWT for existing Google Loyalty Object

Hi,

This could be a misguided question, so please feel free to correct anything daft.

  • I've been able to successfully generate a LoyaltyClass, LoyaltyObject, and JWT for the object.
  • On a new LoyaltyObject, the JWT size is less than 1800, it works at the client-end / webpage.
  • I can find the LoyaltyObject, by querying the LoyaltyObjectRepository.
  • I can make an update() call on the LoyaltyObject.
  • However... I cannot find a way to generate a skinny JWT, e.g. the LoyaltyObject with only an 'id' set

If I currently search the LoyaltyObjectRepository and get the LoyaltyObject, it is 3800+ chars, after a create a JWT for the object.

Thanks in advance for any ideas...

Generate passes dynamically, without disk storage

This is a question (which would go into discussions, but the discussions tab is not enabled).

Looking at the code in passes, it seems that the pkpass files are always generated and saved on disk. The passes I generate are typically short-lived, and I don't need to cache them or generally keep them lying around, so I'm looking to generate passes dynamically and deliver them directly to the client without hitting disk.

Is there a built-in way to do this, or do I have to generate the pass on disk, send it to the client, then delete it?

I know that some PHP functions in zip or openssl might only work on disk files, which is fine, I just need to know if that's the case.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.