From 66344ea9b932929598b3c87c275da73e50fd89ff Mon Sep 17 00:00:00 2001 From: "Jason C. Leach" Date: Wed, 17 Jul 2024 17:40:22 -0700 Subject: [PATCH] feat: add traction functions (#1) * feat: add traction functions --------- Signed-off-by: Jason C. Leach --- package.json | 12 +- src/logger.ts | 64 +++++++ src/traction.ts | 464 ++++++++++++++++++++++++++++++++++++++++++++++++ yarn.lock | 292 ++++++++++++++++++++++-------- 4 files changed, 754 insertions(+), 78 deletions(-) create mode 100644 src/logger.ts create mode 100644 src/traction.ts diff --git a/package.json b/package.json index 8c9517f..8ef7115 100644 --- a/package.json +++ b/package.json @@ -10,9 +10,14 @@ "@hyperledger/aries-askar-nodejs": "0.2.1", "@hyperledger/indy-vdr-nodejs": "0.2.2", "axios": "^1.7.2", + "dotenv": "^16.4.5", "jimp": "^0.22.12", + "jsonwebtoken": "^9.0.2", + "moment-timezone": "^0.5.45", + "node-gyp": "^10.2.0", "pino": "^8.21.0", - "qrcode": "^1.5.3" + "qrcode": "^1.5.3", + "qrcode-terminal": "^0.12.0" }, "packageManager": "yarn@4.3.1", "devDependencies": { @@ -23,12 +28,15 @@ "@types/babel__core": "^7", "@types/babel__preset-env": "^7", "@types/jest": "^29.5.12", + "@types/jsonwebtoken": "^9", "@types/node": "^18.18.14", "@types/qrcode": "^1.5.5", + "@types/qrcode-terminal": "^0", "babel-jest": "^29.7.0", "jest": "^29.7.0", "ts-jest": "^29.2.2", "ts-node": "^10.9.2", "typescript": "^5.5.3" - } + }, + "version": "0.0.0" } diff --git a/src/logger.ts b/src/logger.ts new file mode 100644 index 0000000..b559db7 --- /dev/null +++ b/src/logger.ts @@ -0,0 +1,64 @@ +import pino, { Logger } from "pino"; +import { LogLevel, BaseLogger } from "@credo-ts/core"; +export { LogLevel } from "@credo-ts/core"; + +export const pertTransport = pino.transport({ + targets: [ + { + level: "trace", + target: "pino/file", + options: { + destination: "./log.perf.ndjson", + autoEnd: true, + }, + }, + ], +}); + +export const loggerTransport = pino.transport({ + targets: [ + { + level: "trace", + target: "pino/file", + options: { + destination: "./log.ndjson", + autoEnd: true, + }, + }, + ], +}); + +export const logger = pino( + { level: "trace", timestamp: pino.stdTimeFunctions.isoTime }, + loggerTransport +); + +export class PinoLogger extends BaseLogger { + logger: Logger; + constructor(logger: Logger, logLevel: LogLevel) { + super(logLevel); + this.logger = logger; + } + test(message: string, data?: Record | undefined): void { + this.logger.debug(data || {}, message); + } + trace(message: string, data?: Record | undefined): void { + this.logger.trace(data || {}, message); + } + debug(message: string, data?: Record | undefined): void { + this.logger.debug(data || {}, message); + } + info(message: string, data?: Record | undefined): void { + this.logger.info(data || {}, message); + } + warn(message: string, data?: Record | undefined): void { + this.logger.warn(data || {}, message); + } + error(message: string, data?: Record | undefined): void { + this.logger.error(data || {}, message); + } + fatal(message: string, data?: Record | undefined): void { + //console.dir(data) + this.logger.fatal(data || {}, message); + } +} diff --git a/src/traction.ts b/src/traction.ts new file mode 100644 index 0000000..31063b6 --- /dev/null +++ b/src/traction.ts @@ -0,0 +1,464 @@ +import axios from "axios"; +import * as jwt from "jsonwebtoken"; +import * as dotenv from "dotenv"; +import * as moment from "moment-timezone"; +import { LogLevel, logger as pinoLogger, PinoLogger } from "./logger"; + +dotenv.config(); + +let bearerToken: string | null = null; +const logger = new PinoLogger(pinoLogger, LogLevel.trace); + +export const isTokenExpired = (token: string): boolean => { + try { + const decoded = jwt.decode(token, { complete: true, json: true }) as any; + if (decoded && decoded.payload && decoded.payload.exp) { + const exp = moment.unix(decoded.payload.exp).utc(); + if (exp.isBefore(moment.utc())) { + return true; + } + return false; + } + return true; + } catch (e) { + logger.error(`An error occurred: ${e}`); + return true; + } +}; + +export const fetchBearerToken = async (): Promise => { + if (bearerToken && !isTokenExpired(bearerToken)) { + logger.info("Found existing unexpired bearer token, returning it"); + return bearerToken; + } + + const baseUrl = process.env.TRACTION_BASE_URL; + const tenantId = process.env.TRACTION_TENANT_ID; + const apiKey = process.env.TRACTION_TENANT_API_KEY; + const endpoint = `multitenancy/tenant/${tenantId}/token`; + const url = new URL(endpoint, baseUrl).toString(); + const headers = { + "Content-Type": "application/json", + accept: "application/json", + }; + const data = { api_key: apiKey }; + + logger.info(`Requesting bearer token for walletId ${tenantId}`); + + try { + const response = await axios.post(url, data, { headers }); + if (response.status === 200) { + logger.info("Token fetched successfully"); + bearerToken = response.data.token; + if (!bearerToken) { + logger.error("Token doesn't exist in response data"); + } + return bearerToken; + } else { + logger.error(`Error fetching token: ${response.status}`); + logger.error(`Text content for error: ${response.data}`); + } + } catch (error) { + logger.error(`Error fetching token: ${error}`); + } + return null; +}; + +export const getConnection = async (connId: string): Promise => { + const baseUrl = process.env.TRACTION_BASE_URL; + const endpoint = `/connections/${connId}`; + const url = new URL(endpoint, baseUrl).toString(); + + const token = await fetchBearerToken(); + if (!token) return null; + + const headers = { + "Content-Type": "application/json", + accept: "application/json", + Authorization: `Bearer ${token}`, + }; + + logger.info(`Fetching connection ${connId}`); + + try { + const response = await axios.get(url, { headers }); + if (response.status === 200) { + logger.info("Connection fetched successfully"); + return response.data; + } else { + logger.error(`Error fetching connection message: ${response.status}`); + logger.error(`Text content for error: ${response.data}`); + } + } catch (error) { + logger.error(`Error fetching connection: ${error}`); + } + + return null; +}; + +export const sendDrpcResponse = async ( + connId: string, + threadId: string, + response: any +) => { + const endpoint = `/drpc/${connId}/response`; + const message = { response, thread_id: threadId }; + logger.info( + `Sending response to ${connId}, message = ${JSON.stringify(message)}` + ); + + await sendGenericMessage(connId, endpoint, message); +}; + +export const sendDrpcRequest = async (connId: string, request: any) => { + const endpoint = `/drpc/${connId}/request`; + const message = { request }; + await sendGenericMessage(connId, endpoint, message); +}; + +export const sendGenericMessage = async ( + connId: string, + endpoint: string, + message: any +) => { + const baseUrl = process.env.TRACTION_BASE_URL; + const url = new URL(endpoint, baseUrl).toString(); + + const token = await fetchBearerToken(); + if (!token) return; + + const headers = { + "Content-Type": "application/json", + accept: "application/json", + Authorization: `Bearer ${token}`, + }; + + logger.info(`Sending message to ${connId}, message = ${endpoint}`); + + try { + const response = await axios.post(url, message, { headers }); + if (response.status === 200) { + logger.info("Message sent successfully"); + } else { + logger.error( + `Error sending message: ${response.status} ${response.data}` + ); + } + } catch (error) { + logger.error(`Error sending message: ${error}`); + } +}; + +export const offerCredential = async (offer: any) => { + logger.info("issue_attestation_credential"); + + const baseUrl = process.env.TRACTION_BASE_URL; + const endpoint = "/issue-credential/send-offer"; + const url = new URL(endpoint, baseUrl).toString(); + + const token = await fetchBearerToken(); + if (!token) return; + + const headers = { + "Content-Type": "application/json", + accept: "application/json", + Authorization: `Bearer ${token}`, + }; + + logger.info( + `Sending offer to ${offer["connection_id"]}, offer = ${JSON.stringify( + offer + )}` + ); + + try { + const response = await axios.post(url, offer, { headers }); + if (response.status === 200) { + logger.info("Offer sent successfully"); + } else { + logger.error(`Error sending offer: ${response.status}`); + logger.error(`Text content for error: ${response.data}`); + } + } catch (error) { + logger.error(`Error sending offer: ${error}`); + } +}; + +export const getSchema = async (schemaId: string): Promise => { + logger.info("get_schema"); + + const baseUrl = process.env.TRACTION_BASE_URL; + const endpoint = "/schemas/created"; + const url = new URL(endpoint, baseUrl).toString(); + + const token = await fetchBearerToken(); + if (!token) return null; + + const headers = { + "Content-Type": "application/json", + accept: "application/json", + Authorization: `Bearer ${token}`, + }; + + try { + const response = await axios.get(url, { + headers, + params: { schema_id: schemaId }, + }); + if (response.status === 200) { + logger.info("Schema queried successfully"); + return response.data; + } else { + logger.error(`Error querying schema: ${response.status}`); + logger.error(`Text content for error: ${response.data}`); + } + } catch (error) { + logger.error(`Error querying schema: ${error}`); + } + + return null; +}; + +export const getCredDef = async (schemaId: string): Promise => { + logger.info("get_cred_def"); + + const baseUrl = process.env.TRACTION_BASE_URL; + const endpoint = "/credential-definitions/created"; + const url = new URL(endpoint, baseUrl).toString(); + + const token = await fetchBearerToken(); + if (!token) return null; + + const headers = { + "Content-Type": "application/json", + accept: "application/json", + Authorization: `Bearer ${token}`, + }; + + try { + const response = await axios.get(url, { + headers, + params: { schema_id: schemaId }, + }); + if (response.status === 200) { + logger.info("Cred def queried successfully"); + return response.data; + } else { + logger.error(`Error querying cred def: ${response.status}`); + logger.error(`Text content for error: ${response.data}`); + } + } catch (error) { + logger.error(`Error querying cred def: ${error}`); + } + + return null; +}; + +export const createSchema = async ( + schemaName: string, + schemaVersion: string, + attributes: string[] +): Promise => { + logger.info("create_schema"); + + const baseUrl = process.env.TRACTION_BASE_URL; + const endpoint = "/schemas"; + const url = new URL(endpoint, baseUrl).toString(); + + const token = await fetchBearerToken(); + if (!token) return null; + + const headers = { + "Content-Type": "application/json", + accept: "application/json", + Authorization: `Bearer ${token}`, + }; + + const schema = { + schema_name: schemaName, + schema_version: schemaVersion, + attributes: attributes, + }; + + try { + const response = await axios.post(url, schema, { headers }); + if (response.status === 200) { + logger.info("Schema created successfully"); + return response.data; + } else { + logger.error(`Error creating schema: ${response.status}`); + logger.error(`Text content for error: ${response.data}`); + } + } catch (error) { + logger.error(`Error creating schema: ${error}`); + } + + return null; +}; + +export const createCredDef = async ( + schemaId: string, + tag: string, + revocationRegistrySize: number = 0 +): Promise => { + logger.info("create_cred_def"); + + const baseUrl = process.env.TRACTION_BASE_URL; + const endpoint = "/credential-definitions"; + const url = new URL(endpoint, baseUrl).toString(); + + const token = await fetchBearerToken(); + if (!token) return null; + + const headers = { + "Content-Type": "application/json", + accept: "application/json", + Authorization: `Bearer ${token}`, + }; + + const payload: any = { + schema_id: schemaId, + tag: tag, + support_revocation: revocationRegistrySize > 0, + }; + + if (revocationRegistrySize > 0) { + payload.revocation_registry_size = revocationRegistrySize; + } + + try { + const response = await axios.post(url, payload, { headers }); + if (response.status === 200) { + logger.info("Request sent successfully"); + return response.data; + } else { + logger.error(`Error creating request: ${response.status}`); + logger.error(`Text content for error: ${response.data}`); + } + } catch (error) { + logger.error(`Error creating request: ${error}`); + } + + return null; +}; + +export const createPresentationRequest = async ( + presentationData: any +): Promise => { + logger.info("create_presentation_request"); + + const baseUrl = process.env.TRACTION_BASE_URL; + const endpoint = "/present-proof-2.0/create-request"; + const url = new URL(endpoint, baseUrl).toString(); + + const token = await fetchBearerToken(); + if (!token) return null; + + const headers = { + "Content-Type": "application/json", + accept: "application/json", + Authorization: `Bearer ${token}`, + }; + + logger.info( + `Creating presentation request = ${JSON.stringify(presentationData)}` + ); + + try { + const response = await axios.post(url, presentationData, { headers }); + if (response.status === 200) { + logger.info("Request creation successfully"); + return response.data; + } else { + logger.error(`Error creating request: ${response.status}`); + logger.error(`Text content for error: ${response.data}`); + } + } catch (error) { + logger.error(`Error creating request: ${error}`); + } + + return null; +}; + +export const sendPresentationRequest = async (request: any): Promise => { + logger.info("send_presentation_request"); + + const baseUrl = process.env.TRACTION_BASE_URL; + const endpoint = "/present-proof-2.0/send-request"; + const url = new URL(endpoint, baseUrl).toString(); + + const token = await fetchBearerToken(); + if (!token) return null; + + const headers = { + "Content-Type": "application/json", + accept: "application/json", + Authorization: `Bearer ${token}`, + }; + + logger.info(`Sending presentation request = ${JSON.stringify(request)}`); + + try { + const response = await axios.post(url, request, { headers }); + if (response.status === 200) { + logger.info("Request sent successfully"); + return response.data; + } else { + logger.error(`Error sending request: ${response.status}`); + logger.error(`Text content for error: ${response.data}`); + } + } catch (error) { + logger.error(`Error sending request: ${error}`); + } + + return null; +}; + +export const createOobInvitation = async ( + label: string, + goalCode?: string, + attachments?: [] +): Promise => { + logger.info("create_oob_invitation"); + + const baseUrl = process.env.TRACTION_BASE_URL; + const endpoint = "/out-of-band/create-invitation"; + const url = new URL(endpoint, baseUrl).toString(); + + const token = await fetchBearerToken(); + if (!token) return null; + + const headers = { + "Content-Type": "application/json", + accept: "application/json", + Authorization: `Bearer ${token}`, + }; + + // logger.info(`Sending presentation request = ${JSON.stringify(request)}`); + + const request = { + attachments, + label: label, + goal_code: goalCode, + use_public_did: false, + handshake_protocols: ["https://didcomm.org/connections/1.0"], + //handshake_protocols:['https://didcomm.org/connections/1.0', 'https://didcomm.org/didexchange/1.0'], + }; + + logger.info(`Sending presentation request = ${JSON.stringify(request)}`); + + try { + const response = await axios.post(url, request, { + headers, + }); + if (response.status === 200) { + logger.info("Request sent successfully"); + return response.data; + } else { + logger.error(`Error sending request: ${response.status}`); + logger.error(`Text content for error: ${response.data}`); + } + } catch (error) { + logger.error(`Error sending request: ${error}`); + } +}; diff --git a/yarn.lock b/yarn.lock index fb96541..2a28658 100644 --- a/yarn.lock +++ b/yarn.lock @@ -63,44 +63,44 @@ __metadata: linkType: hard "@babel/compat-data@npm:^7.22.6, @babel/compat-data@npm:^7.24.8": - version: 7.24.8 - resolution: "@babel/compat-data@npm:7.24.8" - checksum: 10c0/7f465e9d8e44c5b516eeb3001362a3cd9a6df51dd90d3ac9868e1e7fa631ac57fc781cec6700110d4f555ba37fe59c4a71927b445106fe0062e79e79ffe11091 + version: 7.24.9 + resolution: "@babel/compat-data@npm:7.24.9" + checksum: 10c0/95a69c9ed00ae78b4921f33403e9b35518e6139a0c46af763c65dea160720cb57c6cc23f7d30249091a0248335b0e39de5c8dfa8e7877c830e44561e0bdc1254 languageName: node linkType: hard "@babel/core@npm:^7.11.6, @babel/core@npm:^7.12.3, @babel/core@npm:^7.14.6, @babel/core@npm:^7.23.9, @babel/core@npm:^7.24.8": - version: 7.24.8 - resolution: "@babel/core@npm:7.24.8" + version: 7.24.9 + resolution: "@babel/core@npm:7.24.9" dependencies: "@ampproject/remapping": "npm:^2.2.0" "@babel/code-frame": "npm:^7.24.7" - "@babel/generator": "npm:^7.24.8" + "@babel/generator": "npm:^7.24.9" "@babel/helper-compilation-targets": "npm:^7.24.8" - "@babel/helper-module-transforms": "npm:^7.24.8" + "@babel/helper-module-transforms": "npm:^7.24.9" "@babel/helpers": "npm:^7.24.8" "@babel/parser": "npm:^7.24.8" "@babel/template": "npm:^7.24.7" "@babel/traverse": "npm:^7.24.8" - "@babel/types": "npm:^7.24.8" + "@babel/types": "npm:^7.24.9" convert-source-map: "npm:^2.0.0" debug: "npm:^4.1.0" gensync: "npm:^1.0.0-beta.2" json5: "npm:^2.2.3" semver: "npm:^6.3.1" - checksum: 10c0/5e21b40cc69746deda3fe3d6540351d9cb0d1ad5aea055b7c319db26071ff5789fd9580d1aa47b114f07631e8e2109f4e71696ca11d7c7e60d157767022c1bd2 + checksum: 10c0/e104ec6efbf099f55184933e9ab078eb5821c792ddfef3e9c6561986ec4ff103f5c11e3d7d6e5e8929e50e2c58db1cc80e5b6f14b530335b6622095ec4b4124c languageName: node linkType: hard -"@babel/generator@npm:^7.24.8, @babel/generator@npm:^7.7.2": - version: 7.24.8 - resolution: "@babel/generator@npm:7.24.8" +"@babel/generator@npm:^7.24.8, @babel/generator@npm:^7.24.9, @babel/generator@npm:^7.7.2": + version: 7.24.9 + resolution: "@babel/generator@npm:7.24.9" dependencies: - "@babel/types": "npm:^7.24.8" + "@babel/types": "npm:^7.24.9" "@jridgewell/gen-mapping": "npm:^0.3.5" "@jridgewell/trace-mapping": "npm:^0.3.25" jsesc: "npm:^2.5.1" - checksum: 10c0/e8a278e75a895f13a7b17dd79abe1e894fe82a5ed3abb127c33c14c66773d69993762521c094c6c364723f8f7375683b0d4a96097781175a29407baedf67b769 + checksum: 10c0/cd1f7edce7717462546c349e15289d1267a3ed627c6f6583fbf51e78eacacc6500ec2f0024f08f1cc7138989e575635b931acf4549f9e728017a22176a9ea6b6 languageName: node linkType: hard @@ -231,9 +231,9 @@ __metadata: languageName: node linkType: hard -"@babel/helper-module-transforms@npm:^7.24.7, @babel/helper-module-transforms@npm:^7.24.8": - version: 7.24.8 - resolution: "@babel/helper-module-transforms@npm:7.24.8" +"@babel/helper-module-transforms@npm:^7.24.7, @babel/helper-module-transforms@npm:^7.24.8, @babel/helper-module-transforms@npm:^7.24.9": + version: 7.24.9 + resolution: "@babel/helper-module-transforms@npm:7.24.9" dependencies: "@babel/helper-environment-visitor": "npm:^7.24.7" "@babel/helper-module-imports": "npm:^7.24.7" @@ -242,7 +242,7 @@ __metadata: "@babel/helper-validator-identifier": "npm:^7.24.7" peerDependencies: "@babel/core": ^7.0.0 - checksum: 10c0/b76496d5045af55be9de60e59e65e56a43033f01ccc746b26b7af911c358668c206b688ce70a23ab31ec04f9728f3a38e8d01073c85244115ab62f271a7fa3d1 + checksum: 10c0/e27bca43bc113731ee4f2b33a4c5bf9c7eebf4d64487b814c305cbd5feb272c29fcd3d79634ba03131ade171e5972bc7ede8dbc83ba0deb02f1e62d318c87770 languageName: node linkType: hard @@ -1439,14 +1439,14 @@ __metadata: languageName: node linkType: hard -"@babel/types@npm:^7.0.0, @babel/types@npm:^7.20.7, @babel/types@npm:^7.24.7, @babel/types@npm:^7.24.8, @babel/types@npm:^7.3.3, @babel/types@npm:^7.4.4, @babel/types@npm:^7.8.3": - version: 7.24.8 - resolution: "@babel/types@npm:7.24.8" +"@babel/types@npm:^7.0.0, @babel/types@npm:^7.20.7, @babel/types@npm:^7.24.7, @babel/types@npm:^7.24.8, @babel/types@npm:^7.24.9, @babel/types@npm:^7.3.3, @babel/types@npm:^7.4.4, @babel/types@npm:^7.8.3": + version: 7.24.9 + resolution: "@babel/types@npm:7.24.9" dependencies: "@babel/helper-string-parser": "npm:^7.24.8" "@babel/helper-validator-identifier": "npm:^7.24.7" to-fast-properties: "npm:^2.0.0" - checksum: 10c0/2d7bf561ae993e794cb052c5a81d3a6d1877da13e1e2eb2a59ae75a8fb1c965b618fb3e4abd42548f5f9a4587d3a149185a32d6c4c4ea82195da7dd86f2da0f1 + checksum: 10c0/4970b3481cab39c5c3fdb7c28c834df5c7049f3c7f43baeafe121bb05270ebf0da7c65b097abf314877f213baa591109c82204f30d66cdd46c22ece4a2f32415 languageName: node linkType: hard @@ -3273,6 +3273,15 @@ __metadata: languageName: node linkType: hard +"@types/jsonwebtoken@npm:^9": + version: 9.0.6 + resolution: "@types/jsonwebtoken@npm:9.0.6" + dependencies: + "@types/node": "npm:*" + checksum: 10c0/9c29e3896e5fb6056e54d87514643e59e0cfb966ae25171a107776270195bba955f0373e98c8ed6450c145b18984f5df9cf0fcac360f382cec3c7c4d3510b202 + languageName: node + linkType: hard + "@types/mime@npm:^1": version: 1.3.5 resolution: "@types/mime@npm:1.3.5" @@ -3312,6 +3321,13 @@ __metadata: languageName: node linkType: hard +"@types/qrcode-terminal@npm:^0": + version: 0.12.2 + resolution: "@types/qrcode-terminal@npm:0.12.2" + checksum: 10c0/9d8d75f76ed2f75faaa2007850d884ce71ad25e05d8683a2b42e6b6cb6568d0d87a3ebb427e174fd77ab4264de40923806785fde2d97d81fce393f127d88931f + languageName: node + linkType: hard + "@types/qrcode@npm:^1.5.5": version: 1.5.5 resolution: "@types/qrcode@npm:1.5.5" @@ -3378,11 +3394,11 @@ __metadata: linkType: hard "@types/ws@npm:^8.5.4": - version: 8.5.10 - resolution: "@types/ws@npm:8.5.10" + version: 8.5.11 + resolution: "@types/ws@npm:8.5.11" dependencies: "@types/node": "npm:*" - checksum: 10c0/e9af279b984c4a04ab53295a40aa95c3e9685f04888df5c6920860d1dd073fcc57c7bd33578a04b285b2c655a0b52258d34bee0a20569dca8defb8393e1e5d29 + checksum: 10c0/50bd2e1a12659fa024a97d7e8c267fbf2a2c2251f1edf2057aa7dfc99682f5c025a188df9e27414675c78d3b189346a3567e1e4c218ad79a9d2b0f1f2b860c3a languageName: node linkType: hard @@ -3403,21 +3419,21 @@ __metadata: linkType: hard "@unimodules/core@npm:*": - version: 7.2.0 - resolution: "@unimodules/core@npm:7.2.0" + version: 7.1.2 + resolution: "@unimodules/core@npm:7.1.2" dependencies: - expo-modules-core: "npm:~0.4.0" - checksum: 10c0/c1289887e4d438542575b9eaccf568a21c61dee2f24afebe9cb09c2efd9394450012e5379f6a91c694c695dcfd6c1059d9df0d8a6a5dff30191fc6fac4369c17 + compare-versions: "npm:^3.4.0" + checksum: 10c0/2aeeb27e4be6c0c22ac1c8adc8d0e81675d6ed587d63c097f1669db9352b8a678784e4f9f6b35f5d2d78d626c6843e3cc2c9bb429ea6c571bd39ca4c9d64d194 languageName: node linkType: hard "@unimodules/react-native-adapter@npm:*": - version: 6.5.0 - resolution: "@unimodules/react-native-adapter@npm:6.5.0" + version: 6.3.9 + resolution: "@unimodules/react-native-adapter@npm:6.3.9" dependencies: - expo-modules-autolinking: "npm:^0.3.2" - expo-modules-core: "npm:~0.4.0" - checksum: 10c0/d98d060cd3282eb8c4153d2f3a682b7e72154f0739a9e788b680d964503fa96f4346a2cf0ca1888323a51ad688b61ee39ac86eaf821c0a79dad0b9f84c0affdb + expo-modules-autolinking: "npm:^0.0.3" + invariant: "npm:^2.2.4" + checksum: 10c0/d7bc26c09383f07723fe0ef0d6831daded80e211b20962577d376e3c32eab0d409219d8b806ceb3257f3258511c069bb994b1997ea85175c849647658100fe9f languageName: node linkType: hard @@ -3491,14 +3507,21 @@ __metadata: "@types/babel__core": "npm:^7" "@types/babel__preset-env": "npm:^7" "@types/jest": "npm:^29.5.12" + "@types/jsonwebtoken": "npm:^9" "@types/node": "npm:^18.18.14" "@types/qrcode": "npm:^1.5.5" + "@types/qrcode-terminal": "npm:^0" axios: "npm:^1.7.2" babel-jest: "npm:^29.7.0" + dotenv: "npm:^16.4.5" jest: "npm:^29.7.0" jimp: "npm:^0.22.12" + jsonwebtoken: "npm:^9.0.2" + moment-timezone: "npm:^0.5.45" + node-gyp: "npm:^10.2.0" pino: "npm:^8.21.0" qrcode: "npm:^1.5.3" + qrcode-terminal: "npm:^0.12.0" ts-jest: "npm:^29.2.2" ts-node: "npm:^10.9.2" typescript: "npm:^5.5.3" @@ -3548,14 +3571,14 @@ __metadata: linkType: hard "ajv@npm:^8.0.0, ajv@npm:^8.12.0": - version: 8.16.0 - resolution: "ajv@npm:8.16.0" + version: 8.17.1 + resolution: "ajv@npm:8.17.1" dependencies: fast-deep-equal: "npm:^3.1.3" + fast-uri: "npm:^3.0.1" json-schema-traverse: "npm:^1.0.0" require-from-string: "npm:^2.0.2" - uri-js: "npm:^4.4.1" - checksum: 10c0/6fc38aa8fd4fbfaa7096ac049e48c0cb440db36b76fef2d7d5b7d92b102735670d055d412d19176c08c9d48eaa9d06661b67e59f04943dc71ab1551e0484f88c + checksum: 10c0/ec3ba10a573c6b60f94639ffc53526275917a2df6810e4ab5a6b959d87459f9ef3f00d5e7865b82677cb7d21590355b34da14d1d0b9c32d75f95a187e76fff35 languageName: node linkType: hard @@ -4102,6 +4125,13 @@ __metadata: languageName: node linkType: hard +"buffer-equal-constant-time@npm:1.0.1": + version: 1.0.1 + resolution: "buffer-equal-constant-time@npm:1.0.1" + checksum: 10c0/fb2294e64d23c573d0dd1f1e7a466c3e978fe94a4e0f8183937912ca374619773bef8e2aceb854129d2efecbbc515bbd0cc78d2734a3e3031edb0888531bbc8e + languageName: node + linkType: hard + "buffer-equal@npm:0.0.1": version: 0.0.1 resolution: "buffer-equal@npm:0.0.1" @@ -4198,9 +4228,9 @@ __metadata: linkType: hard "caniuse-lite@npm:^1.0.30001640": - version: 1.0.30001641 - resolution: "caniuse-lite@npm:1.0.30001641" - checksum: 10c0/a065b641cfcc84b36955ee909bfd7313ad103d6a299f0fd261e0e4160e8f1cec79d685c5a9f11097a77687cf47154eddb8133163f2a34bcb8d73c45033a014d2 + version: 1.0.30001642 + resolution: "caniuse-lite@npm:1.0.30001642" + checksum: 10c0/7366878ecdd482392a741c66fd2b39816b70573d66f64b1f8e5916835faf7a15f116368290170f4d7c4e823ec78eea9b6c0f63bee763a511cc7990afa429d63b languageName: node linkType: hard @@ -4797,6 +4827,13 @@ __metadata: languageName: node linkType: hard +"dotenv@npm:^16.4.5": + version: 16.4.5 + resolution: "dotenv@npm:16.4.5" + checksum: 10c0/48d92870076832af0418b13acd6e5a5a3e83bb00df690d9812e94b24aff62b88ade955ac99a05501305b8dc8f1b0ee7638b18493deb6fe93d680e5220936292f + languageName: node + linkType: hard + "eastasianwidth@npm:^0.2.0": version: 0.2.0 resolution: "eastasianwidth@npm:0.2.0" @@ -4804,6 +4841,15 @@ __metadata: languageName: node linkType: hard +"ecdsa-sig-formatter@npm:1.0.11": + version: 1.0.11 + resolution: "ecdsa-sig-formatter@npm:1.0.11" + dependencies: + safe-buffer: "npm:^5.0.1" + checksum: 10c0/ebfbf19d4b8be938f4dd4a83b8788385da353d63307ede301a9252f9f7f88672e76f2191618fd8edfc2f24679236064176fab0b78131b161ee73daa37125408c + languageName: node + linkType: hard + "ed25519-signature-2018-context@npm:^1.1.0": version: 1.1.0 resolution: "ed25519-signature-2018-context@npm:1.1.0" @@ -4837,9 +4883,9 @@ __metadata: linkType: hard "electron-to-chromium@npm:^1.4.820": - version: 1.4.825 - resolution: "electron-to-chromium@npm:1.4.825" - checksum: 10c0/3970c961136175b821e005cc674291cb5698a29337c76319bd564d127b052caaa69a9e339ef3758e891b47eba1e852adede904bcf738d50eace4ebdaf963ac38 + version: 1.4.827 + resolution: "electron-to-chromium@npm:1.4.827" + checksum: 10c0/e37719d8f13da78eb2bc68184cdf73d167ecf413abc28afef2b0a5c55866293752fda980d83a5f42b5780781bde418b24c12e1c38f2662d25ed1c2f71880bc24 languageName: node linkType: hard @@ -5221,9 +5267,9 @@ __metadata: languageName: node linkType: hard -"expo-modules-autolinking@npm:^0.3.2": - version: 0.3.4 - resolution: "expo-modules-autolinking@npm:0.3.4" +"expo-modules-autolinking@npm:^0.0.3": + version: 0.0.3 + resolution: "expo-modules-autolinking@npm:0.0.3" dependencies: chalk: "npm:^4.1.0" commander: "npm:^7.2.0" @@ -5232,17 +5278,7 @@ __metadata: fs-extra: "npm:^9.1.0" bin: expo-modules-autolinking: bin/expo-modules-autolinking.js - checksum: 10c0/fdcf1c7755cc50d51a22ef015480174bd721135aa227fa6c2febc1f7ac7453d3dea9ee2204a6fccd34cf8751d4e026400d917644f09eaffc25a0d87f791cc1d0 - languageName: node - linkType: hard - -"expo-modules-core@npm:~0.4.0": - version: 0.4.10 - resolution: "expo-modules-core@npm:0.4.10" - dependencies: - compare-versions: "npm:^3.4.0" - invariant: "npm:^2.2.4" - checksum: 10c0/dfcc1a76ae103a4906698a539af8c8a37d9ec771b5c93c154754b614e7aeff0a72ab2bb639e646d915b81fb76300295c1cac0b20a36df62a25b1daef93561498 + checksum: 10c0/4f62bac8193d81e7939a6e7dccc07309a99440ed6d2f642ed7a262a8ae8a5906f6477c5ef486d59b7deaab4e73468532356185b3e56dbe90f4c057500cd7f2f6 languageName: node linkType: hard @@ -5360,6 +5396,13 @@ __metadata: languageName: node linkType: hard +"fast-uri@npm:^3.0.1": + version: 3.0.1 + resolution: "fast-uri@npm:3.0.1" + checksum: 10c0/3cd46d6006083b14ca61ffe9a05b8eef75ef87e9574b6f68f2e17ecf4daa7aaadeff44e3f0f7a0ef4e0f7e7c20fc07beec49ff14dc72d0b500f00386592f2d10 + languageName: node + linkType: hard + "fastq@npm:^1.6.0": version: 1.17.1 resolution: "fastq@npm:1.17.1" @@ -7052,6 +7095,45 @@ __metadata: languageName: node linkType: hard +"jsonwebtoken@npm:^9.0.2": + version: 9.0.2 + resolution: "jsonwebtoken@npm:9.0.2" + dependencies: + jws: "npm:^3.2.2" + lodash.includes: "npm:^4.3.0" + lodash.isboolean: "npm:^3.0.3" + lodash.isinteger: "npm:^4.0.4" + lodash.isnumber: "npm:^3.0.3" + lodash.isplainobject: "npm:^4.0.6" + lodash.isstring: "npm:^4.0.1" + lodash.once: "npm:^4.0.0" + ms: "npm:^2.1.1" + semver: "npm:^7.5.4" + checksum: 10c0/d287a29814895e866db2e5a0209ce730cbc158441a0e5a70d5e940eb0d28ab7498c6bf45029cc8b479639bca94056e9a7f254e2cdb92a2f5750c7f358657a131 + languageName: node + linkType: hard + +"jwa@npm:^1.4.1": + version: 1.4.1 + resolution: "jwa@npm:1.4.1" + dependencies: + buffer-equal-constant-time: "npm:1.0.1" + ecdsa-sig-formatter: "npm:1.0.11" + safe-buffer: "npm:^5.0.1" + checksum: 10c0/5c533540bf38702e73cf14765805a94027c66a0aa8b16bc3e89d8d905e61a4ce2791e87e21be97d1293a5ee9d4f3e5e47737e671768265ca4f25706db551d5e9 + languageName: node + linkType: hard + +"jws@npm:^3.2.2": + version: 3.2.2 + resolution: "jws@npm:3.2.2" + dependencies: + jwa: "npm:^1.4.1" + safe-buffer: "npm:^5.0.1" + checksum: 10c0/e770704533d92df358adad7d1261fdecad4d7b66fa153ba80d047e03ca0f1f73007ce5ed3fbc04d2eba09ba6e7e6e645f351e08e5ab51614df1b0aa4f384dfff + languageName: node + linkType: hard + "jwt-decode@npm:^3.1.2": version: 3.1.2 resolution: "jwt-decode@npm:3.1.2" @@ -7193,6 +7275,48 @@ __metadata: languageName: node linkType: hard +"lodash.includes@npm:^4.3.0": + version: 4.3.0 + resolution: "lodash.includes@npm:4.3.0" + checksum: 10c0/7ca498b9b75bf602d04e48c0adb842dfc7d90f77bcb2a91a2b2be34a723ad24bc1c8b3683ec6b2552a90f216c723cdea530ddb11a3320e08fa38265703978f4b + languageName: node + linkType: hard + +"lodash.isboolean@npm:^3.0.3": + version: 3.0.3 + resolution: "lodash.isboolean@npm:3.0.3" + checksum: 10c0/0aac604c1ef7e72f9a6b798e5b676606042401dd58e49f051df3cc1e3adb497b3d7695635a5cbec4ae5f66456b951fdabe7d6b387055f13267cde521f10ec7f7 + languageName: node + linkType: hard + +"lodash.isinteger@npm:^4.0.4": + version: 4.0.4 + resolution: "lodash.isinteger@npm:4.0.4" + checksum: 10c0/4c3e023a2373bf65bf366d3b8605b97ec830bca702a926939bcaa53f8e02789b6a176e7f166b082f9365bfec4121bfeb52e86e9040cb8d450e64c858583f61b7 + languageName: node + linkType: hard + +"lodash.isnumber@npm:^3.0.3": + version: 3.0.3 + resolution: "lodash.isnumber@npm:3.0.3" + checksum: 10c0/2d01530513a1ee4f72dd79528444db4e6360588adcb0e2ff663db2b3f642d4bb3d687051ae1115751ca9082db4fdef675160071226ca6bbf5f0c123dbf0aa12d + languageName: node + linkType: hard + +"lodash.isplainobject@npm:^4.0.6": + version: 4.0.6 + resolution: "lodash.isplainobject@npm:4.0.6" + checksum: 10c0/afd70b5c450d1e09f32a737bed06ff85b873ecd3d3d3400458725283e3f2e0bb6bf48e67dbe7a309eb371a822b16a26cca4a63c8c52db3fc7dc9d5f9dd324cbb + languageName: node + linkType: hard + +"lodash.isstring@npm:^4.0.1": + version: 4.0.1 + resolution: "lodash.isstring@npm:4.0.1" + checksum: 10c0/09eaf980a283f9eef58ef95b30ec7fee61df4d6bf4aba3b5f096869cc58f24c9da17900febc8ffd67819b4e29de29793190e88dc96983db92d84c95fa85d1c92 + languageName: node + linkType: hard + "lodash.memoize@npm:4.x": version: 4.1.2 resolution: "lodash.memoize@npm:4.1.2" @@ -7214,6 +7338,13 @@ __metadata: languageName: node linkType: hard +"lodash.once@npm:^4.0.0": + version: 4.1.1 + resolution: "lodash.once@npm:4.1.1" + checksum: 10c0/46a9a0a66c45dd812fcc016e46605d85ad599fe87d71a02f6736220554b52ffbe82e79a483ad40f52a8a95755b0d1077fba259da8bfb6694a7abbf4a48f1fc04 + languageName: node + linkType: hard + "loose-envify@npm:^1.0.0": version: 1.4.0 resolution: "loose-envify@npm:1.4.0" @@ -7549,6 +7680,22 @@ __metadata: languageName: node linkType: hard +"moment-timezone@npm:^0.5.45": + version: 0.5.45 + resolution: "moment-timezone@npm:0.5.45" + dependencies: + moment: "npm:^2.29.4" + checksum: 10c0/7497f23c4b8c875dbf07c03f9a1253f79edaeedc29d5732e36bfd3c5577e25aed1924fbd84cbb713ce1920dbe822be0e21bd487851a7d13907226f289a5e568b + languageName: node + linkType: hard + +"moment@npm:^2.29.4": + version: 2.30.1 + resolution: "moment@npm:2.30.1" + checksum: 10c0/865e4279418c6de666fca7786607705fd0189d8a7b7624e2e56be99290ac846f90878a6f602e34b4e0455c549b85385b1baf9966845962b313699e7cb847543a + languageName: node + linkType: hard + "ms@npm:2.0.0": version: 2.0.0 resolution: "ms@npm:2.0.0" @@ -7706,7 +7853,7 @@ __metadata: languageName: node linkType: hard -"node-gyp@npm:latest": +"node-gyp@npm:^10.2.0, node-gyp@npm:latest": version: 10.2.0 resolution: "node-gyp@npm:10.2.0" dependencies: @@ -8280,13 +8427,6 @@ __metadata: languageName: node linkType: hard -"punycode@npm:^2.1.0": - version: 2.3.1 - resolution: "punycode@npm:2.3.1" - checksum: 10c0/14f76a8206bc3464f794fb2e3d3cc665ae416c01893ad7a02b23766eb07159144ee612ad67af5e84fa4479ccfe67678c4feb126b0485651b302babf66f04f9e9 - languageName: node - linkType: hard - "pure-rand@npm:^6.0.0": version: 6.1.0 resolution: "pure-rand@npm:6.1.0" @@ -8310,6 +8450,15 @@ __metadata: languageName: node linkType: hard +"qrcode-terminal@npm:^0.12.0": + version: 0.12.0 + resolution: "qrcode-terminal@npm:0.12.0" + bin: + qrcode-terminal: ./bin/qrcode-terminal.js + checksum: 10c0/1d8996a743d6c95e22056bd45fe958c306213adc97d7ef8cf1e03bc1aeeb6f27180a747ec3d761141921351eb1e3ca688f7b673ab54cdae9fa358dffaa49563c + languageName: node + linkType: hard + "qrcode@npm:^1.5.3": version: 1.5.3 resolution: "qrcode@npm:1.5.3" @@ -8738,7 +8887,7 @@ __metadata: languageName: node linkType: hard -"safe-buffer@npm:5.2.1, safe-buffer@npm:~5.2.0": +"safe-buffer@npm:5.2.1, safe-buffer@npm:^5.0.1, safe-buffer@npm:~5.2.0": version: 5.2.1 resolution: "safe-buffer@npm:5.2.1" checksum: 10c0/6501914237c0a86e9675d4e51d89ca3c21ffd6a31642efeba25ad65720bce6921c9e7e974e5be91a786b25aa058b5303285d3c15dbabf983a919f5f630d349f3 @@ -9842,15 +9991,6 @@ __metadata: languageName: node linkType: hard -"uri-js@npm:^4.4.1": - version: 4.4.1 - resolution: "uri-js@npm:4.4.1" - dependencies: - punycode: "npm:^2.1.0" - checksum: 10c0/4ef57b45aa820d7ac6496e9208559986c665e49447cb072744c13b66925a362d96dd5a46c4530a6b8e203e5db5fe849369444440cb22ecfc26c679359e5dfa3c - languageName: node - linkType: hard - "utif2@npm:^4.0.1": version: 4.1.0 resolution: "utif2@npm:4.1.0"