-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #87 from credebl/notification-patch
feat: added messageType on the credo core
- Loading branch information
Showing
4 changed files
with
120 additions
and
32 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,80 @@ | ||
FROM ubuntu:20.04 | ||
# FROM ubuntu:20.04 | ||
|
||
ENV DEBIAN_FRONTEND noninteractive | ||
# 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" | ||
# # 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 | ||
# # 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 yarn seperately due to `no-install-recommends` to skip nodejs install | ||
RUN apt-get install -y --no-install-recommends yarn | ||
# # 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/ | ||
|
||
# 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 | ||
|
||
WORKDIR /app | ||
|
||
# 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 | ||
|
||
RUN yarn install --production | ||
# Set entry point | ||
ENTRYPOINT ["node", "./bin/afj-rest.js", "start"] | ||
|
||
COPY build ./build | ||
# COPY libindy_vdr.so /usr/lib/ | ||
# COPY libindy_vdr.so /usr/local/lib/ | ||
|
||
ENTRYPOINT [ "./bin/afj-rest.js", "start" ] |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
diff --git a/node_modules/@credo-ts/core/build/agent/EnvelopeService.js b/node_modules/@credo-ts/core/build/agent/EnvelopeService.js | ||
index 12261a9..0238d59 100644 | ||
--- a/node_modules/@credo-ts/core/build/agent/EnvelopeService.js | ||
+++ b/node_modules/@credo-ts/core/build/agent/EnvelopeService.js | ||
@@ -32,12 +32,14 @@ let EnvelopeService = class EnvelopeService { | ||
let encryptedMessage = await agentContext.wallet.pack(message, recipientKeysBase58, senderKeyBase58 !== null && senderKeyBase58 !== void 0 ? senderKeyBase58 : undefined); | ||
// If the message has routing keys (mediator) pack for each mediator | ||
for (const routingKeyBase58 of routingKeysBase58) { | ||
+ console.log(`message['@type']`, JSON.stringify(message['@type'])) | ||
const forwardMessage = new messages_1.ForwardMessage({ | ||
// Forward to first recipient key | ||
to: recipientKeysBase58[0], | ||
message: encryptedMessage, | ||
}); | ||
recipientKeysBase58 = [routingKeyBase58]; | ||
+ forwardMessage["messageType"] = message['@type']; | ||
this.logger.debug('Forward message created', forwardMessage); | ||
const forwardJson = forwardMessage.toJSON({ | ||
useDidSovPrefixWhereAllowed: agentContext.config.useDidSovPrefixWhereAllowed, | ||
diff --git a/node_modules/@credo-ts/core/build/modules/routing/messages/ForwardMessage.d.ts b/node_modules/@credo-ts/core/build/modules/routing/messages/ForwardMessage.d.ts | ||
index 4f8577b..396f78a 100644 | ||
--- a/node_modules/@credo-ts/core/build/modules/routing/messages/ForwardMessage.d.ts | ||
+++ b/node_modules/@credo-ts/core/build/modules/routing/messages/ForwardMessage.d.ts | ||
@@ -3,6 +3,7 @@ import { EncryptedMessage } from '../../../types'; | ||
export interface ForwardMessageOptions { | ||
id?: string; | ||
to: string; | ||
+ messageType: string; | ||
message: EncryptedMessage; | ||
} | ||
/** | ||
@@ -19,5 +20,6 @@ export declare class ForwardMessage extends AgentMessage { | ||
readonly type: string; | ||
static readonly type: import("../../../utils/messageType").ParsedMessageType; | ||
to: string; | ||
+ messageType: string; | ||
message: EncryptedMessage; | ||
} | ||
diff --git a/node_modules/@credo-ts/core/build/types.d.ts b/node_modules/@credo-ts/core/build/types.d.ts | ||
index e0384d9..0a669fb 100644 | ||
--- a/node_modules/@credo-ts/core/build/types.d.ts | ||
+++ b/node_modules/@credo-ts/core/build/types.d.ts | ||
@@ -81,6 +81,7 @@ export interface PlaintextMessage { | ||
thid?: string; | ||
pthid?: string; | ||
}; | ||
+ messageType: string; | ||
[key: string]: unknown; | ||
} | ||
export interface OutboundPackage { |
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