This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const axios = require("axios"); | |
const registration = { | |
"audience": "https://vii.mattr.global", | |
"url": "https://auth.mattr.global/oauth/token", | |
"tenant_subdomain": "YOUR_TENANT_SUBDOMAIN", | |
"client_id": "YOUR_CLIENT_ID", | |
"client_secret": "YOUR_CLIENT_SECRET" | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const bs58 = require('bs58'); | |
const MULTICODEC_ED25519_PUB_HEADER = new Uint8Array([ 0xed, 0x01 ]); | |
const MULTIBASE_BASE58BTC_HEADER = 'z'; | |
const ed25519Fingerprint = ({ | |
base64PubKey, | |
}) => { | |
const base64PubKeyBuffer = Buffer.from(base64PubKey, 'base64'); | |
const uint8PubKey = Uint8Array.from(base64PubKeyBuffer); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const axios = require('axios'); | |
const { | |
uuid, | |
} = require('short-uuid'); | |
const open = require('open'); | |
const base64url = require('base64url'); | |
const bs58 = require('bs58'); | |
const didKeyDriver = require('did-method-key') | |
.driver(); | |
const forge = require('node-forge'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (org.settings && org.settings.mobileWalletEnabled) { | |
const login_hint = uuid(); | |
const credentialId = cert.id; | |
const loginHint = { | |
credentialId, | |
login_hint, | |
credentialType: OIDC_DEFAULT_CREDENTIAL_TYPE, | |
expiry: Date.now() + OIDC_DOES_NOT_EXPIRE_TTL, // no expiry for now... | |
purpose: OIDC_LOGIN_HINT_CREDENTIAL_ISSUANCE_PURPOSE, | |
multiUse: true, // allow these to be picked up mutliple times for now |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JWE_ALG: 'A256KW', | |
JWE_ENC: 'A256CBC-HS512', | |
ENCRYPTION_ALGORITHM: "AES-CBC", | |
IV_LENGTH: 16, | |
KEY_LENGTH: 32, | |
W3C_RSA_ALGORITHM: { | |
name: "RSASSA-PKCS1-v1_5", | |
modulusLength: 2048, | |
publicExponent: new Uint8Array([1, 0, 1]), | |
hash: { name: "SHA-256" }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const axios = require('axios'); | |
const VCX_API_KEY = process.env.VCX_API_KEY; | |
const ORG_ID = process.env.ORG_ID; | |
const issueCredential = async () => { | |
const url = `https://api.trybe.id/provider/issueCredentials`; | |
const headers = { | |
'vcx-api-key': VCX_API_KEY | |
}; | |
const credentialToIssue = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs') | |
const FormData = require('form-data') | |
const axios = require('axios') | |
const orgId = process.env.ORG_ID | |
const apiURl = process.env.API_URL || 'https://api.staging.trybe.id' | |
const readCsv = async ({ path }) => { | |
return new Promise((resolve, reject) => { | |
fs.readFile(path, async (err, data) => { | |
if (err) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sha3 import keccak_256 | |
import sys | |
import time | |
def mine_block(difficulty): | |
target = 2**256 // difficulty | |
# Pad the number to 32 bytes, 64 hex, withe leading 0x | |
print('New block target:', '{0:#0{1}x}'.format(target, 66)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Dependencies | |
const axios = require('axios') | |
const jp = require('jsonpath') | |
// Environment Variables | |
const API_URL = process.env.API_URL || 'http://localhost:3002' | |
const VCX_API_KEY = process.env.VCX_API_KEY || '42d34daf-29fc-4703-b52c-82c69f4e1a58' | |
const ORG_ID = process.env.ORG_ID || '60160d896915b96d1f50c9c2' | |
// API authZ |
NewerOlder