Skip to content

Commit

Permalink
Merge pull request #12 from nation3/aahna-ashina/dw-67/add-templatefo…
Browse files Browse the repository at this point in the history
…rmatversio

feat: add template format versions (#5)
  • Loading branch information
aahna-ashina authored May 26, 2022
2 parents 3691830 + ab72a49 commit 39002bd
Show file tree
Hide file tree
Showing 10 changed files with 114 additions and 3 deletions.
8 changes: 7 additions & 1 deletion server/interfaces/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export interface Pass {
// TODO
id: number
platform: Platform
}

export interface ApplePass extends Pass {
Expand All @@ -9,3 +10,8 @@ export interface ApplePass extends Pass {
export interface GooglePass extends Pass {
// TODO
}

export enum Platform {
Apple,
Google
}
15 changes: 13 additions & 2 deletions server/pages/api/downloadPass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,27 @@ import { ApplePass } from "../../interfaces"
export default function handler(req: NextApiRequest, res: NextApiResponse) {
console.log('/api/downloadPass')

const address = "0xabc..." // TODO
const { address } = req.query
console.log(`address: "${address}"`)

const signature = "0xdef..." // TODO
// Check that the address is valid
// TODO

// Check that the address has a passport NFT
// TODO

const { signature } = req.query
console.log(`signature: "${signature}"`)

// Check that the signature is valid
// TODO

const { platform } = req.query
console.log(`platform: "${platform}"`)

// Check that the platform is valid
// TODO

// Populate the pass template
// TODO

Expand Down
14 changes: 14 additions & 0 deletions server/utils/Passes.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
import { Platform } from "../interfaces"

export class Passes {

/**
* Triggers a download of a pass for a given passport ID and platform (currently Apple or Google).
*/
static downloadPass(passportID: number, platform: Platform) {
console.log('downloadPass')

console.log('passportID:', passportID)
console.log('platform:', platform)

// TODO
}

/**
* Pushes an updated template to all the passes.
*/
Expand Down
Binary file added template-versions/apple/1/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added template-versions/apple/1/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added template-versions/apple/1/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added template-versions/apple/1/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions template-versions/apple/1/pass.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"organizationName": "Nation3",
"passTypeIdentifier": "pass.org.passport.nation3",
"description": "Nation3 passports for Nation3 citizens.",
"teamIdentifier": "6GU2F645A4",
"backgroundColor": "rgb(255,255,255)",
"foregroundColor": "rgb(34, 64, 89)",
"labelColor": "rgb(115, 149, 178)",
"formatVersion": 1,
"storeCard": {
"headerFields": [
{ "value": "not yet :)", "label": "Passport ID", "key": "id" }
],
"primaryFields": [],
"secondaryFields": [
{
"fieldUUID": "526c80c0-c579-11ec-b5fd-e93a006cb46d",
"value": "luisc.eth",
"label": "Holder",
"key": "holder"
}
]
},
"barcodes": [
{
"message": "123456789",
"format": "PKBarcodeFormatQR",
"messageEncoding": "iso-8859-1"
}
]
}
Binary file added template-versions/apple/1/strip.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 49 additions & 0 deletions template-versions/google/1/generic-pass.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"genericType": "GENERIC_TYPE_UNSPECIFIED",
"hexBackgroundColor": "#4285f4",
"logo": {
"sourceUri": {
"uri": "https://storage.googleapis.com/wallet-lab-tools-codelab-artifacts-public/pass_google_logo.jpg"
}
},
"cardTitle": {
"defaultValue": {
"language": "en",
"value": "Google I/O '22 [DEMO ONLY]"
}
},
"subheader": {
"defaultValue": {
"language": "en",
"value": "Attendee"
}
},
"header": {
"defaultValue": {
"language": "en",
"value": "Alex McJacobs"
}
},
"barcode": {
"type": "QR_CODE",
"value": "12345"
},
"heroImage": {
"sourceUri": {
"uri": "https://storage.googleapis.com/wallet-lab-tools-codelab-artifacts-public/google-io-hero-demo-only-2.png"
}
},
"textModulesData": [
{
"header": "POINTS",
"body": "99",
"id": "points"
},
{
"header": "CONTACTS",
"body": "99",
"id": "contacts"
}
]
}

1 comment on commit 39002bd

@vercel
Copy link

@vercel vercel bot commented on 39002bd May 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

mobile-passport – ./

mobile-passport-git-main-nation3.vercel.app
mobile-passport-nation3.vercel.app
mobile-passport.vercel.app

Please sign in to comment.