Skip to content

Instantly share code, notes, and snippets.

View AdamJLemmon's full-sized avatar

Adam J Lemmon AdamJLemmon

View GitHub Profile
// Dependencies
const axios = require('axios')
// Environment Variables
const API_URL = process.env.API_URL || 'https://api.dev.trybe.id'
const VCX_API_KEY = process.env.VCX_API_KEY || '42d34daf-29fc-4703-b52c-82c69f4e1a58'
const ORG_ID = process.env.ORG_ID || '6011d47451f4814d408f8b1e'
/**
* Complete flow to issue a HealthCerts Verifiable Credential
const jwe = {
"protected":"eyJhbGciOiJBMjU2S1ciLCJlbmMiOiJBMjU2Q0JDLUhTNTEyIn0",
"iv":"tqo2BqyC0fioY9f7jadL2w",
"ciphertext":"Skw56_62vJIas4uayJvsVMqUiiZ_K4qoY68ordY4Knn-zB_l7HmRcg4GCcgxD44SR5s6NrrOv3kcRkVQHziZoY8U_gKLmJS-ar_i_hlhtDlbdctCQAWSQ6uPcGx9Ix4NuB1k41fozZ3HznpJEUHXMNDfdF06fY5W76Nb77rAAXRieMcrHbkEGKuPoCnh1zYNxEVLso_wTOX9RWwSJhNNciaxf9VmkMUzBS4jMTMamAGvPGpPGW1gnITcRwMfQN7UUsQTc7aHXfnmXl5CMr5fp1UJWLz0LVZReu67m8vYrLFdr_ZTfFIe_sJdfzxqJdHiPFB_7DEU_XCaI7yLwill5JBi9yWmcwTklLnsbv_ETA2Zjyadfh9eyGYY2OdIOal4rbi3N3opx-6GhSqAgTcm4AMRLO2pr7737OdMS7AmeIi1JcATxxw6iUzBFviaJm9YOZZeAkt63DrMmuyTBytI6RVTyBozI-82e5_U1Y1LpMpDO50aoFj2GPmzJ_0UuLicp9gptrV94XSbeM447yhfNo3bMlIPseztqzTJyTvDLznd7JKKf3eLACOrOYrivistqrhnaNU4aHTLUyMgiBqzSRlSQwaBV9BwJB8QU00mIULJ83z9_oJGi5J4tL7i7aTuPH5AryJ6qZML5zjg-UK43-A008MzI1SpU1EKxqCTpi9clXx_RMU-QMXmBVlcU2eZtN731ICLYwxVzBIcfRwBlxBuLKjx5dyf6RvuI76s2oVDieBkkfaf_qK16YMq-KY-chyl6YOZ51g-1JhV3unZ9DWVCeIC02FTnaPrYFI4TnqwZeRfyPz7y0I0I9HoZJSu-DY1nw4Wdan3TVOipxoFLXft9GGO2sGE3Y9z7lbZLyjqGtFuV0_56ZzAXsvm
{
"@context":[
"https://www.w3.org/2018/credentials/v1",
{
"HealthPassportBundleCredentialV1":{
"@id":"https://schema.affinity-project.org/HealthPassportBundleCredentialV1",
"@context":{
"@version":1.1,
"@protected":true
}
/**
* Standards Referenced:
* JSON Web Encryption (JWE) https://tools.ietf.org/html/rfc7516
* JSON Object Signing and Encryption (JOSE) https://www.iana.org/assignments/jose/jose.xhtml
*/
const crypto = require('crypto')
const base64url = require('base64url')
// The location of the document within some third party service that will host these documents
const DOCUMENT_URL = 'https://example.com/docs/VRdqHY1xwB'
{
'@context': {
"url": {
"@id": "https://schema.org/URL",
"@type": "@id"
},
"imageUrl": {
"@id": "https://schema.org/URL",
"@type": "@id"
},
const axios = require('axios');
const short = require('short-uuid');
const key_endpoint = 'https://api.dev.trybe.id/credentials/key';
const issuer_vc_endpoint = 'https://api.dev.trybe.id/credentials/issue';
const prove_presentation_endpoint = 'https://api.dev.trybe.id/presentations/prove';
const verify_credential_endpoint = 'https://api.dev.trybe.id/credentials/verify';
const verify_presentation_endpoint = 'https://api.dev.trybe.id/presentations/verify';
// Definition of the credential
@AdamJLemmon
AdamJLemmon / apiProvider.js
Last active May 4, 2023 14:02
Usage of the C.TI API Provider.
// Dependencies
const axios = require('axios');
// Environment Variables
const API_URL = process.env.API_URL || 'https://api.cti.convergence.tech';
const APP_URL = process.env.APP_URL || 'https://cti.convergence.tech';
const VCX_API_KEY = process.env.VCX_API_KEY || 'YOUR API KEY';
const ORG_ID = process.env.ORG_ID || 'YOUR ORG ID';
const CRED_DEF_ID = process.env.CRED_DEF_ID || 'YOUR CREDENTIAL DEFINITION ID';
const ethers = require('ethers');
const { v4 } = require('uuid');
const generatePOPProof = async () => {
const nonce = v4();
const wallet = ethers.Wallet.createRandom();
const verificationMethod = wallet.address;
const signature = await wallet.signMessage(nonce);
return { nonce, verificationMethod, signature };
}
apt install unzip
wget https://releases.hashicorp.com/consul/1.7.2/consul_1.7.2_linux_amd64.zip
unzip consul_1.7.2_linux_amd64.zip
mv consul /usr/bin
consul help
{
"@context": {
"@version": 1.1,
"@protected": true,
"id": "@id",
"type": "@type",
"VerifiableCredential": {
"@id": "https://www.w3.org/2018/credentials#VerifiableCredential",