Skip to content

Commit

Permalink
fix: offchain resolver sign
Browse files Browse the repository at this point in the history
  • Loading branch information
hai-ko committed Sep 15, 2023
1 parent b367477 commit a72df01
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 23 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ jobs:
rsync -avz -e 'ssh -i ./ssh-key' ./docker/docker-compose.yml app@${{ secrets.STAGING_HOST }}:/home/app/dm3
- name: Prepare docker
run: |
ssh -i ./ssh-key app@${{ secrets.STAGING_HOST }} "\
cd dm3 && docker compose down"
ssh -i ./ssh-key root@${{ secrets.STAGING_HOST }} "\
docker system prune -af; \
systemctl restart docker.service"
Expand All @@ -71,4 +73,4 @@ jobs:
- name: Start
run: |
ssh -i ./ssh-key app@${{ secrets.STAGING_HOST }} "\
cd dm3 && docker compose down && docker compose --env-file .env up -d"
cd dm3 && docker compose --env-file .env up -d"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,4 @@ packages/lib/**/dist
!.yarn/versions

packages/**/.yarn
temp
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"dependencies": {
"ccip-resolver": "^0.2.2",
"commander": "^11.0.0",
"ethers": "^5.7.2",
"ethers": "5.7.2",
"ts-node": "^10.9.1"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/lib/offchainResolver-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
},
"dependencies": {
"axios": "^1.5.0",
"dm3-lib-profile": "workspace:^",
"ethers": "5.7.2"
"dm3-lib-crypto": "workspace:^",
"dm3-lib-profile": "workspace:^"
},
"devDependencies": {
"@types/data-urls": "^3.0.1",
Expand Down
8 changes: 3 additions & 5 deletions packages/lib/offchainResolver-api/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import axios from 'axios';
import { SignedUserProfile, formatAddress } from 'dm3-lib-profile';
import { ethers } from 'ethers';
import { sign } from 'dm3-lib-crypto';

/**
* claims a dm3.eth subdomain
Expand All @@ -15,12 +15,11 @@ export async function claimSubdomain(
name: string,
privateKey: string,
): Promise<boolean> {
const wallet = new ethers.Wallet(privateKey);
const url = `${offchainResolverUrl}/profile/name`;
const data = {
alias,
name,
signature: await wallet.signMessage('alias: ' + alias),
signature: await sign(privateKey, 'alias: ' + alias),
};

const { status } = await axios.post(url, data);
Expand All @@ -38,11 +37,10 @@ export async function removeAlias(
offchainResolverUrl: string,
privateKey: string,
): Promise<boolean> {
const wallet = new ethers.Wallet(privateKey);
const url = `${offchainResolverUrl}/profile/name`;
const data = {
name: alias,
signature: await wallet.signMessage('remove: ' + alias),
signature: await sign(privateKey, 'remove: ' + alias),
};

const { status } = await axios.post(url, data);
Expand Down
4 changes: 2 additions & 2 deletions packages/lib/offchainResolver-api/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"strict": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"module": "node16",
"moduleResolution": "node16",
"module": "CommonJS",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"outDir": "dist",
Expand Down
16 changes: 9 additions & 7 deletions packages/messenger-demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,18 @@
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
"chrome >= 67",
"edge >= 79",
"firefox >= 68",
"opera >= 54",
"safari >= 14"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
},
"devDependencies": {
"@testing-library/dom": "^9.3.1",
"@types/three": "^0.141.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/messenger-demo/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"module": "esnext",
"moduleResolution": "node16",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
Expand Down
2 changes: 1 addition & 1 deletion packages/messenger-widget/src/views/Home/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
RainbowKitProvider,
} from '@rainbow-me/rainbowkit';
import { configureChains, createConfig, WagmiConfig } from 'wagmi';
import { mainnet, goerli } from 'wagmi/chains';
import { goerli } from 'wagmi/chains';
import {
metaMaskWallet,
rainbowWallet,
Expand Down
2 changes: 1 addition & 1 deletion packages/messenger-widget/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"module": "esnext",
"moduleResolution": "node16",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
Expand Down
4 changes: 2 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12254,7 +12254,7 @@ __metadata:
"@nomiclabs/hardhat-ethers": ^2.2.3
ccip-resolver: ^0.2.2
commander: ^11.0.0
ethers: ^5.7.2
ethers: 5.7.2
hardhat: ^2.7.2
jest: ^28.1.1
prettier: ^3.0.3
Expand Down Expand Up @@ -12403,8 +12403,8 @@ __metadata:
"@types/whatwg-encoding": ^2.0.0
axios: ^1.5.0
axios-mock-adapter: ^1.21.2
dm3-lib-crypto: "workspace:^"
dm3-lib-profile: "workspace:^"
ethers: 5.7.2
jest: ^28.1.1
ts-jest: ^28.0.4
ts-json-schema-generator: ^0.98.0
Expand Down

0 comments on commit a72df01

Please sign in to comment.