Closed sachin-ngendev closed 1 year ago
Hello, @sachin-ngendev
Give me the example data you want to store inside NFC Pass and I will try to make an example out of it to showcase the option.
Firstly you need to create passkit object with Apple issued public key (base64 format) and payload message.
final nfcPasskit = PasskitNfc(encryptionPublicKey: '', message: 'Some_NFC_MESSAGE');
Secondly, you will need to create passkit for the particular pass:
final passkit = PasskitPass(
formatVersion: 1,
passTypeIdentifier: '', // fill required fields
description: '', // fill required fields
teamIdentifier: '', // fill required fields
organizationName: '', // fill required fields
serialNumber: '', // fill required fields
nfc: nfcPasskit, // provide the nfc class created earlier
);
Then you should be able either to use your own signature keys or generate new ones (in this example I'm using stub generation of the empty signature -> this will not work if you'd like to import generated passkit.
To make it work, take a look on the Signer class (and how to generate signature certificate). Stubs I'm making will look like this:
final directory = Directory('.input'); // directory for temporary files (such as signature/pass.json/manifest.json)
final creators = Creators(directory: directory); // creators helper
final signature = await creators.createEmptySignature(); // create empty stub signature (you should be using class Signer() instead).
With the generated signature, you should be able to create passkit file and manifest with it's checksum using creator utility:
final pkpass = await creators.createPass(passkit);
final manifest = await creators.createManifest({'pass.json': pkpass.readAsBytesSync()});
Finally, passkit can be generated:
final result = await Passkit(directoryName: '_test_').generate(
id: 'some-id',
directory: directory,
passkitPass: passkit,
pkpass: pkpass,
signature: signature,
manifest: manifest,
);
Let me know if that helped you. For the Signer class how-to - take a look on the Signer tests.
can you provide more info about how to add a nfc card to pass that have specific data to open doors that works on rfid