this is an example of gcp service account. Clearly, service account has a private key and a certificate.
So GCP uses public-key cryptography (+ certificate to validate wheather public key is falsificated) to authenticate the service account.
function showFields(target) { | |
for (var f in target) { | |
console.log(`${f}: ${target[f]}`); | |
} | |
} |
package main | |
import ( | |
"encoding/json" | |
"fmt" | |
"github.com/stellar/go/clients/horizonclient" | |
"github.com/stellar/go/protocols/horizon/operations" | |
) |
const functions = require('firebase-functions'); | |
const rp = require('request-promise'); | |
const projectId = process.env.GCP_PROJECT; | |
const region = 'us-central1'; | |
// GCF の List API を利用するためのサービスアカウント | |
// service account をリポジトリに含めたくない場合は下記のように機密データを取得する | |
// 設定方法: https://github.com/firebase/firebase-tools/issues/406#issuecomment-353017349 | |
const serviceAccount = functions.config().list.cert; |
package main | |
import ( | |
"firebase.google.com/go" | |
"cloud.google.com/go/firestore" | |
"context" | |
"log" | |
"fmt" | |
) |
package main | |
import ( | |
"firebase.google.com/go" | |
"cloud.google.com/go/firestore" | |
"context" | |
"log" | |
"math/rand" | |
"fmt" | |
) |
// jayson-promise-test | |
const jayson = require(`jayson/promise`); | |
const client = jayson.client.https(`http://url`); | |
client.request(`sendrawtransaction`, [`02000000000101e704a7202bd63642b45234d1d132fcd72112789a1caa08c3b6843d7d2e94b211010000001716001421aa1728d096147222c201519a8710fd1bc2f416ffffffff01405489000000000017a91400853f1aefada64964a3f602846d263f5f3630a98702483045022100dc5051daf71e46c4e297e66c4b71f8d2fb3359dc209f24ca598677215318867502203b131875c948dd996a0575b0600e3b702d29de9ac7853c388319e20babe2d7b00121038bf0cde309b16f3513725515f077178e8ff8b89269543555057edc28b16179cd00000000`]) | |
.then((res)=>{console.log(JSON.stringify(res))}) | |
.catch((err)=> { | |
console.log(JSON.stringify(err)); | |
console.log(String(err)); | |
if(String(err).startsWith(‘Error: ’)){ | |
const str = String(err).slice(7); |
function sleep(millisec) { | |
return new Promise((resolve, reject) => { | |
setTimeout(() => { | |
resolve(); | |
}, millisec); | |
}); | |
} |
dogrun | |
01 gcpとfirebaseのfunctionの使い分け | |
・function自体は同じ、違いは開発者のデプロイ方法の違い | |
02 functionでpythonサポートの予定はあるか | |
頑張るが今の所ない。 | |
03 firebaseとgcpの壁 | |
・モバイルならfirebase、クラウドならgcp、functionsは中間 | |
・schedulerをfirebaseに持て来るよていはある |