Skip to content

Commit 6baf2b2

Browse files
authored
Merge pull request #1157 from dm3-org/lukso-poc
Lukso poc
2 parents 5da0caf + 7b445cb commit 6baf2b2

File tree

95 files changed

+7827
-181
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+7827
-181
lines changed

.github/workflows/deploy.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ jobs:
6565
echo "ENCRYPTION_PUBLIC_KEY=${{ secrets.ENCRYPTION_PUBLIC_KEY }}" >> ./.env
6666
echo "ENCRYPTION_PRIVATE_KEY=${{ secrets.ENCRYPTION_PRIVATE_KEY }}" >> ./.env
6767
echo "RPC=${{ secrets.RPC }}" >> ./.env
68+
echo "LUKSO_RPC=${{ secrets.LUKSO_RPC }}" >> ./.env
6869
echo "URL=${{ vars.HOST_DOMAIN }}" >> ./.env
6970
echo "CERT_MAIL=${{ vars.CERT_MAIL }}" >> ./.env
7071
echo "DATABASE_URL=${{ secrets.DATABASE_URL }}" >> ./.env

docker/DockerfileBuild

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ FROM --platform=linux/amd64 node:22-alpine3.18 as build
22
WORKDIR /build
33
COPY . .
44
# we need coreutils for proper ls command
5-
RUN apk add --update coreutils python3 make g++ curl bash gawk jq\
5+
RUN apk add --update coreutils python3 make g++ curl bash gawk jq git\
66
&& rm -rf /var/cache/apk/*
77

88
## Build libraries

docker/docker-compose.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ services:
3131
ENCRYPTION_PRIVATE_KEY: ${ENCRYPTION_PRIVATE_KEY}
3232
DISABLE_SESSION_CHECK: ${DISABLE_SESSION_CHECK}
3333
RPC: ${RPC}
34+
LUKSO_RPC: ${LUKSO_RPC}
3435
PORT: 8081
3536
LOG_LEVEL: 'debug'
3637
DATABASE_URL: ${DATABASE_URL}
@@ -58,6 +59,7 @@ services:
5859
ENCRYPTION_PUBLIC_KEY: ${ENCRYPTION_PUBLIC_KEY}
5960
ENCRYPTION_PRIVATE_KEY: ${ENCRYPTION_PRIVATE_KEY}
6061
RPC: ${RPC}
62+
LUKSO_RPC: ${LUKSO_RPC}
6163
PORT: 8083
6264
LOG_LEVEL: 'debug'
6365
volumes:
@@ -88,6 +90,7 @@ services:
8890
DATABASE_URL: postgresql://postgres:example@offchain-resolver-db:5432
8991
PORT: 8082
9092
RPC: ${RPC}
93+
LUKSO_RPC: ${LUKSO_RPC}
9194
RESOLVER_SUPPORTED_ADDR_ENS_SUBDOMAINS: ${RESOLVER_SUPPORTED_ADDR_ENS_SUBDOMAINS}
9295
RESOLVER_SUPPORTED_NAME_ENS_SUBDOMAINS: ${RESOLVER_SUPPORTED_NAME_ENS_SUBDOMAINS}
9396
LOG_LEVEL: 'debug'

docker/resolutions.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"@dm3-org/dm3-lib-shared": "file:/library_archives/lib-shared.tgz",
1111
"@dm3-org/dm3-lib-storage": "file:/library_archives/lib-storage.tgz",
1212
"@dm3-org/dm3-lib-test-helper": "file:/library_archives/lib-test-helper.tgz",
13+
"@dm3-org/dm3-lib-smart-account": "file:/library_archives/lib-smart-account.tgz",
1314
"@dm3-org/dm3-messenger-widget": "file:/library_archives/messenger-widget.tgz"
1415
}
1516
}

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@
1313
"packages/lib/storage",
1414
"packages/lib/delivery-api",
1515
"packages/lib/test-helper",
16+
"packages/lib/smart-account",
1617
"packages/lib/offchain-resolver-api",
1718
"packages/backend",
1819
"packages/integration-tests",
1920
"packages/offchain-resolver",
2021
"packages/messenger-widget",
22+
"packages/js-sdk",
2123
"packages/messenger-demo",
2224
"packages/next-messenger-demo",
2325
"packages/messenger-web",

packages/backend/src/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
getServerSecret,
66
logError,
77
logRequest,
8+
getLuksoProvider,
89
} from '@dm3-org/dm3-lib-server-side';
910
import { logInfo } from '@dm3-org/dm3-lib-shared';
1011
import bodyParser from 'body-parser';
@@ -30,14 +31,15 @@ app.use(bodyParser.json());
3031
(async () => {
3132
const db = await getDatabase();
3233
const web3Provider = await getCachedWebProvider(process.env);
34+
const luksoProvider = await getLuksoProvider(process.env);
3335
const serverSecret = getServerSecret(process.env);
3436

3537
app.use(logRequest);
3638

3739
app.get('/hello', (req, res) => {
3840
return res.status(200).send('Hello DM3');
3941
});
40-
app.use('/profile', Profile(db, web3Provider, serverSecret));
42+
app.use('/profile', Profile(db, web3Provider, luksoProvider, serverSecret));
4143
app.use('/storage', Storage(db, web3Provider, serverSecret));
4244
app.use('/auth', Authenticate(db, serverSecret, web3Provider));
4345
app.use(logError);

packages/backend/src/profile/profile.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,11 @@ const setUpApp = async (
2929
db: IBackendDatabase,
3030
web3Provider: ethers.providers.JsonRpcProvider,
3131
serverSecret: string = 'my-secret',
32+
luksoProvider: ethers.providers.JsonRpcProvider = {} as ethers.providers.JsonRpcProvider,
3233
) => {
3334
app.use(bodyParser.json());
3435
const server = http.createServer(app);
35-
app.use(profile(db, web3Provider, serverSecret));
36+
app.use(profile(db, web3Provider, luksoProvider, serverSecret));
3637
};
3738

3839
const createDbMock = async () => {

packages/backend/src/profile/profile.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
import { generateAuthJWT } from '@dm3-org/dm3-lib-server-side';
2-
import { getUserProfile } from '@dm3-org/dm3-lib-profile';
2+
import {
3+
getUserProfile,
4+
ProfileValidator,
5+
SignedUserProfile,
6+
} from '@dm3-org/dm3-lib-profile';
37

48
import {
59
checkUserProfile,
@@ -14,6 +18,7 @@ import { IBackendDatabase } from '../persistence/getDatabase';
1418
export default (
1519
db: IBackendDatabase,
1620
web3Provider: ethers.providers.JsonRpcProvider,
21+
luksoProvider: ethers.providers.JsonRpcProvider,
1722
serverSecret: string,
1823
) => {
1924
const router = express.Router();
@@ -60,6 +65,7 @@ export default (
6065
if (
6166
!(await checkUserProfile(
6267
web3Provider,
68+
luksoProvider,
6369
req.body, // as SignedUserProfile,
6470
normalizeEnsName(ensName),
6571
))

packages/backend/src/profile/submitUserProfile.ts

Lines changed: 0 additions & 36 deletions
This file was deleted.

packages/delivery-service/src/index.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
Authenticate,
44
errorHandler,
55
getCachedWebProvider,
6+
getLuksoProvider,
67
getServerSecret,
78
logError,
89
logRequest,
@@ -22,13 +23,13 @@ import { startCleanUpPendingMessagesJob } from './cleanup/cleanUpPendingMessages
2223
import { getDeliveryServiceProperties } from './config/getDeliveryServiceProperties';
2324
import Delivery from './delivery';
2425
import { onConnection } from './messaging';
26+
import Metrics from './metrics';
2527
import Notifications from './notifications';
2628
import { IDatabase, getDatabase } from './persistence/getDatabase';
2729
import { Profile } from './profile/profile';
2830
import RpcProxy from './rpc/rpc-proxy';
29-
import { WebSocketManager } from './ws/WebSocketManager';
3031
import { socketAuth } from './socketAuth';
31-
import Metrics from './metrics';
32+
import { WebSocketManager } from './ws/WebSocketManager';
3233

3334
const app = express();
3435
app.use(express.json({ limit: '50mb' }));
@@ -96,6 +97,7 @@ app.use(bodyParser.json());
9697
// load environment
9798
const deliveryServiceProperties = getDeliveryServiceProperties();
9899
const web3Provider = await getCachedWebProvider(process.env);
100+
const luksoProvider = await getLuksoProvider(process.env);
99101

100102
const db = getDbWithAddressResolvedGetAccount(
101103
await getDatabase(),
@@ -142,7 +144,7 @@ app.use(bodyParser.json());
142144

143145
app.use('/metrics', Metrics(db, deliveryServiceProperties));
144146
app.use('/auth', Authenticate(db, serverSecret, web3Provider));
145-
app.use('/profile', Profile(db, web3Provider, serverSecret));
147+
app.use('/profile', Profile(db, web3Provider, luksoProvider, serverSecret));
146148
app.use('/delivery', Delivery(web3Provider, db, serverSecret));
147149
app.use(
148150
'/notifications',

0 commit comments

Comments
 (0)