1+ /*
2+ * Copyright 2022 Google Inc.
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * http://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
16+
17+ const express = require ( 'express' ) ;
18+ const path = require ( 'path' ) ;
19+ const bodyParser = require ( 'body-parser' ) ;
20+ const { GoogleAuth } = require ( 'google-auth-library' ) ;
21+ const jwt = require ( 'jsonwebtoken' ) ;
22+
23+ // TODO: Define Issuer ID
24+ const issuerId = 'ISSUER_ID' ;
25+
26+ // TODO: Define Class ID
27+ const classId = `${ issuerId } .test-class-id` ;
28+
29+ const baseUrl = 'https://walletobjects.googleapis.com/walletobjects/v1' ;
30+
31+ const credentials = require ( process . env . GOOGLE_APPLICATION_CREDENTIALS ) ;
32+
33+ const httpClient = new GoogleAuth ( {
34+ credentials : credentials ,
35+ scopes : 'https://www.googleapis.com/auth/wallet_object.issuer'
36+ } ) ;
37+
38+ async function createPassClass ( req , res ) {
39+ // TODO: Create a Generic pass class
40+ }
41+
42+ async function createPassObject ( req , res ) {
43+ // TODO: Create a new Generic pass for the user
44+ }
45+
46+ const app = express ( ) ;
47+
48+ app . use ( bodyParser . urlencoded ( { extended : true } ) ) ;
49+ app . use ( express . static ( 'public' ) ) ;
50+ app . post ( '/' , async ( req , res ) => {
51+ await createPassClass ( req , res ) ;
52+ await createPassObject ( req , res ) ;
53+ } ) ;
54+ app . listen ( 3000 ) ;
0 commit comments