Skip to content

Commit

Permalink
feat: added messageType on the credo core
Browse files Browse the repository at this point in the history
Signed-off-by: KulkarniShashank <[email protected]>
Signed-off-by: Krishna Waske <[email protected]>
  • Loading branch information
KulkarniShashank authored and GHkrishna committed Sep 13, 2024
1 parent c9b54da commit 9cf20fc
Show file tree
Hide file tree
Showing 10 changed files with 1,754 additions and 828 deletions.
87 changes: 61 additions & 26 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,77 @@

# ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update -y && apt-get install -y \
software-properties-common \
apt-transport-https \
curl \
# Only needed to build indy-sdk
build-essential
# RUN apt-get update -y && apt-get install -y \
# software-properties-common \
# apt-transport-https \
# curl \
# # Only needed to build indy-sdk
# build-essential

# nodejs
# RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash
# RUN /bin/bash -c "source /root/.nvm/nvm.sh && nvm install 18 && nvm use 18"

RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
# RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash -

# # yarn
# RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
# echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list

# install depdencies
RUN apt-get update -y && apt-get install -y --allow-unauthenticated \
nodejs
# # install depdencies
# RUN apt-get update -y && apt-get install -y --allow-unauthenticated \
# nodejs

# # install depdencies
# RUN apt-get update -y && apt-get install -y --allow-unauthenticated \
# nodejs

# # Install yarn seperately due to `no-install-recommends` to skip nodejs install
# RUN apt-get install -y --no-install-recommends yarn

# RUN yarn global add patch-package
# # AFJ specifc setup
# WORKDIR /www

# COPY bin ./bin
# COPY package.json ./package.json
# COPY patches ./patches

# RUN yarn install --production

# COPY build ./build
# # COPY libindy_vdr.so /usr/lib/
# # COPY libindy_vdr.so /usr/local/lib/

# Install yarn seperately due to `no-install-recommends` to skip nodejs install
RUN apt-get install -y --no-install-recommends yarn
# ENTRYPOINT [ "./bin/afj-rest.js", "start" ]


# Stage 1: Builder stage
FROM node:18.19.0 AS builder

WORKDIR /app

# Copy package.json and yarn.lock files
COPY package.json yarn.lock ./

# Install dependencies
RUN yarn install --frozen-lockfile

# Copy the rest of the application code
COPY . .

RUN yarn global add patch-package
# AFJ specifc setup
WORKDIR /www

COPY bin ./bin
COPY package.json ./package.json
COPY patches ./patches
# Build the application
RUN yarn build

# Stage 2: Production stage
FROM node:18.19.0-slim

RUN yarn install --production
WORKDIR /app

COPY build ./build
# COPY libindy_vdr.so /usr/lib/
# COPY libindy_vdr.so /usr/local/lib/
# Copy built files and node_modules from the builder stage
COPY --from=builder /app/build ./build
COPY --from=builder /app/bin ./bin
COPY --from=builder /app/package.json ./
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/patches ./patches

ENTRYPOINT [ "./bin/afj-rest.js", "start" ]
# Set entry point
ENTRYPOINT ["node", "./bin/afj-rest.js", "start"]
23 changes: 12 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,18 @@
"validate": "yarn lint && yarn check-types && yarn check-format"
},
"dependencies": {
"@ayanworks/credo-polygon-w3c-module": "0.0.2-alpha.3",
"@credo-ts/anoncreds": "0.5.0",
"@credo-ts/askar": "0.5.0",
"@credo-ts/core": "0.5.0",
"@credo-ts/indy-vdr": "0.5.0",
"@credo-ts/node": "0.5.0",
"@ayanworks/credo-polygon-w3c-module": "0.0.2-alpha.8",
"@credo-ts/anoncreds": "0.5.3",
"@credo-ts/askar": "0.5.3",
"@credo-ts/core": "0.5.3",
"@credo-ts/indy-vdr": "0.5.3",
"@credo-ts/node": "0.5.3",
"@credo-ts/push-notifications": "^0.7.0",
"@credo-ts/question-answer": "0.5.0",
"@credo-ts/tenants": "0.5.0",
"@hyperledger/anoncreds-nodejs": "0.2.1",
"@hyperledger/aries-askar-nodejs": "0.2.0",
"@hyperledger/indy-vdr-nodejs": "0.2.0",
"@credo-ts/question-answer": "0.5.3",
"@credo-ts/tenants": "0.5.3",
"@hyperledger/anoncreds-nodejs": "0.2.2",
"@hyperledger/aries-askar-nodejs": "0.2.1",
"@hyperledger/indy-vdr-nodejs": "0.2.2",
"@tsoa/runtime": "^6.0.0",
"@types/node-fetch": "^2.6.4",
"@types/ref-struct-di": "^1.1.9",
Expand All @@ -58,6 +58,7 @@
"cors": "^2.8.5",
"express": "^4.18.1",
"express-rate-limit": "^7.1.5",
"joi": "^17.12.3",
"jsonwebtoken": "^9.0.2",
"node-fetch": "^2.6.7",
"patch-package": "^8.0.0",
Expand Down
3 changes: 1 addition & 2 deletions samples/cliConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@
"autoAcceptMediationRequests": false,
"adminPort": 4001,
"tenancy": true,
"schemaFileServerURL": "https://schema.credebl.id/schemas/",
"didRegistryContractAddress": "0x1adeA199dCf07E17232415Cb232442BE52517Add",
"didRegistryContractAddress": "0xC1c392DC1073a86821B4ae37f1F0faCDcFFf45bF",
"schemaManagerContractAddress": "0x289c7Bd4C7d38cC54bff370d6f9f01b74Df51b11",
"rpcUrl": "https://rpc-amoy.polygon.technology",
"fileServerUrl": "https://schema.credebl.id/",
Expand Down
6 changes: 3 additions & 3 deletions src/cliAgent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,11 @@ const getModules = (networkConfig: [IndyVdrPoolConfig, ...IndyVdrPoolConfig[]])

questionAnswer: new QuestionAnswerModule(),
polygon: new PolygonModule({
didContractAddress: '0x12513116875BB3E4F098Ce74624739Ee51bAf023',
schemaManagerContractAddress: '0x552992e9f14b15bBd76488cD4c38c89B80259f37',
didContractAddress: '0xC1c392DC1073a86821B4ae37f1F0faCDcFFf45bF',
schemaManagerContractAddress: '0x289c7Bd4C7d38cC54bff370d6f9f01b74Df51b11',
fileServerToken:
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJBeWFuV29ya3MiLCJpZCI6ImNhZDI3ZjhjLTMyNWYtNDRmZC04ZmZkLWExNGNhZTY3NTMyMSJ9.I3IR7abjWbfStnxzn1BhxhV0OEzt1x3mULjDdUcgWHk',
rpcUrl: 'https://polygon-mumbai.infura.io/v3/0579d305568d404e996e49695e9272a3',
rpcUrl: 'https://rpc-amoy.polygon.technology',
serverUrl: 'https://schema.credebl.id',
}),
}
Expand Down
4 changes: 3 additions & 1 deletion src/controllers/multi-tenancy/MultiTenancyController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ import {
getBls12381G2Key2020,
getEd25519VerificationKey2018,
injectable,
createPeerDidDocumentFromServices,
PeerDidNumAlgo,
} from '@credo-ts/core'
import { QuestionAnswerRole, QuestionAnswerState } from '@credo-ts/question-answer'
import axios from 'axios'
Expand Down Expand Up @@ -1429,7 +1431,7 @@ export class MultiTenancyController extends Controller {
}),
outOfBandRecord: outOfBandRecord.toJSON(),
outOfBandRecordId: outOfBandRecord.id,
recipientKey: createOfferOptions?.recipientKey ? {} : { recipientKey: routing.recipientKey.publicKeyBase58 },
invitationDid: createOfferOptions?.invitationDid ? '' : invitationDid,
}
})
return createOfferOobRecord
Expand Down
11 changes: 9 additions & 2 deletions src/controllers/outofband/OutOfBandController.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import type { OutOfBandInvitationProps, OutOfBandRecordWithInvitationProps } from '../examples'
import type { AgentMessageType, RecipientKeyOption } from '../types'
import type { ConnectionRecordProps, CreateLegacyInvitationConfig, Routing } from '@credo-ts/core'
import type { AgentMessageType, RecipientKeyOption, CreateInvitationOptions } from '../types'
import type {
ConnectionRecordProps,
CreateLegacyInvitationConfig,
PeerDidNumAlgo2CreateOptions,
Routing,
} from '@credo-ts/core'

import {
AgentMessage,
Expand All @@ -10,6 +15,8 @@ import {
RecordNotFoundError,
Key,
KeyType,
createPeerDidDocumentFromServices,
PeerDidNumAlgo,
} from '@credo-ts/core'
import { injectable } from 'tsyringe'

Expand Down
2 changes: 1 addition & 1 deletion src/controllers/proofs/ProofController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type {
Routing,
} from '@credo-ts/core'

import { Agent, HandshakeProtocol, Key, KeyType, RecordNotFoundError } from '@credo-ts/core'
import { Agent, Key, KeyType, RecordNotFoundError } from '@credo-ts/core'
import { injectable } from 'tsyringe'

import { ProofRecordExample, RecordId } from '../examples'
Expand Down
Loading

0 comments on commit 9cf20fc

Please sign in to comment.