Skip to content

Commit a72df01

Browse files
committed
fix: offchain resolver sign
1 parent b367477 commit a72df01

File tree

11 files changed

+26
-23
lines changed

11 files changed

+26
-23
lines changed

.github/workflows/deploy.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ jobs:
5656
rsync -avz -e 'ssh -i ./ssh-key' ./docker/docker-compose.yml app@${{ secrets.STAGING_HOST }}:/home/app/dm3
5757
- name: Prepare docker
5858
run: |
59+
ssh -i ./ssh-key app@${{ secrets.STAGING_HOST }} "\
60+
cd dm3 && docker compose down"
5961
ssh -i ./ssh-key root@${{ secrets.STAGING_HOST }} "\
6062
docker system prune -af; \
6163
systemctl restart docker.service"
@@ -71,4 +73,4 @@ jobs:
7173
- name: Start
7274
run: |
7375
ssh -i ./ssh-key app@${{ secrets.STAGING_HOST }} "\
74-
cd dm3 && docker compose down && docker compose --env-file .env up -d"
76+
cd dm3 && docker compose --env-file .env up -d"

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,4 @@ packages/lib/**/dist
6262
!.yarn/versions
6363

6464
packages/**/.yarn
65+
temp

packages/cli/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"dependencies": {
1010
"ccip-resolver": "^0.2.2",
1111
"commander": "^11.0.0",
12-
"ethers": "^5.7.2",
12+
"ethers": "5.7.2",
1313
"ts-node": "^10.9.1"
1414
},
1515
"devDependencies": {

packages/lib/offchainResolver-api/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
},
1313
"dependencies": {
1414
"axios": "^1.5.0",
15-
"dm3-lib-profile": "workspace:^",
16-
"ethers": "5.7.2"
15+
"dm3-lib-crypto": "workspace:^",
16+
"dm3-lib-profile": "workspace:^"
1717
},
1818
"devDependencies": {
1919
"@types/data-urls": "^3.0.1",

packages/lib/offchainResolver-api/src/index.ts

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import axios from 'axios';
22
import { SignedUserProfile, formatAddress } from 'dm3-lib-profile';
3-
import { ethers } from 'ethers';
3+
import { sign } from 'dm3-lib-crypto';
44

55
/**
66
* claims a dm3.eth subdomain
@@ -15,12 +15,11 @@ export async function claimSubdomain(
1515
name: string,
1616
privateKey: string,
1717
): Promise<boolean> {
18-
const wallet = new ethers.Wallet(privateKey);
1918
const url = `${offchainResolverUrl}/profile/name`;
2019
const data = {
2120
alias,
2221
name,
23-
signature: await wallet.signMessage('alias: ' + alias),
22+
signature: await sign(privateKey, 'alias: ' + alias),
2423
};
2524

2625
const { status } = await axios.post(url, data);
@@ -38,11 +37,10 @@ export async function removeAlias(
3837
offchainResolverUrl: string,
3938
privateKey: string,
4039
): Promise<boolean> {
41-
const wallet = new ethers.Wallet(privateKey);
4240
const url = `${offchainResolverUrl}/profile/name`;
4341
const data = {
4442
name: alias,
45-
signature: await wallet.signMessage('remove: ' + alias),
43+
signature: await sign(privateKey, 'remove: ' + alias),
4644
};
4745

4846
const { status } = await axios.post(url, data);

packages/lib/offchainResolver-api/tsconfig.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
"strict": true,
1010
"forceConsistentCasingInFileNames": true,
1111
"noFallthroughCasesInSwitch": true,
12-
"module": "node16",
13-
"moduleResolution": "node16",
12+
"module": "CommonJS",
13+
"moduleResolution": "node",
1414
"resolveJsonModule": true,
1515
"isolatedModules": true,
1616
"outDir": "dist",

packages/messenger-demo/package.json

+9-7
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,18 @@
3434
},
3535
"browserslist": {
3636
"production": [
37-
">0.2%",
38-
"not dead",
39-
"not op_mini all"
37+
"chrome >= 67",
38+
"edge >= 79",
39+
"firefox >= 68",
40+
"opera >= 54",
41+
"safari >= 14"
4042
],
4143
"development": [
42-
"last 1 chrome version",
43-
"last 1 firefox version",
44-
"last 1 safari version"
44+
"last 1 chrome version",
45+
"last 1 firefox version",
46+
"last 1 safari version"
4547
]
46-
},
48+
},
4749
"devDependencies": {
4850
"@testing-library/dom": "^9.3.1",
4951
"@types/three": "^0.141.0",

packages/messenger-demo/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"forceConsistentCasingInFileNames": true,
1111
"noFallthroughCasesInSwitch": true,
1212
"module": "esnext",
13-
"moduleResolution": "node16",
13+
"moduleResolution": "node",
1414
"resolveJsonModule": true,
1515
"isolatedModules": true,
1616
"noEmit": true,

packages/messenger-widget/src/views/Home/Home.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
RainbowKitProvider,
1010
} from '@rainbow-me/rainbowkit';
1111
import { configureChains, createConfig, WagmiConfig } from 'wagmi';
12-
import { mainnet, goerli } from 'wagmi/chains';
12+
import { goerli } from 'wagmi/chains';
1313
import {
1414
metaMaskWallet,
1515
rainbowWallet,

packages/messenger-widget/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"forceConsistentCasingInFileNames": true,
1515
"noFallthroughCasesInSwitch": true,
1616
"module": "esnext",
17-
"moduleResolution": "node16",
17+
"moduleResolution": "node",
1818
"resolveJsonModule": true,
1919
"isolatedModules": true,
2020
"noEmit": true,

yarn.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -12254,7 +12254,7 @@ __metadata:
1225412254
"@nomiclabs/hardhat-ethers": ^2.2.3
1225512255
ccip-resolver: ^0.2.2
1225612256
commander: ^11.0.0
12257-
ethers: ^5.7.2
12257+
ethers: 5.7.2
1225812258
hardhat: ^2.7.2
1225912259
jest: ^28.1.1
1226012260
prettier: ^3.0.3
@@ -12403,8 +12403,8 @@ __metadata:
1240312403
"@types/whatwg-encoding": ^2.0.0
1240412404
axios: ^1.5.0
1240512405
axios-mock-adapter: ^1.21.2
12406+
dm3-lib-crypto: "workspace:^"
1240612407
dm3-lib-profile: "workspace:^"
12407-
ethers: 5.7.2
1240812408
jest: ^28.1.1
1240912409
ts-jest: ^28.0.4
1241012410
ts-json-schema-generator: ^0.98.0

0 commit comments

Comments
 (0)