@unchainedshop/api 3.0.0-rc3 → 3.0.0-rc5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/resolvers/mutations/accounts/verifyWeb3Address.d.ts.map +1 -1
- package/lib/resolvers/mutations/accounts/verifyWeb3Address.js +3 -1
- package/lib/resolvers/mutations/accounts/verifyWeb3Address.js.map +1 -1
- package/package.json +45 -11
- package/src/resolvers/mutations/accounts/verifyWeb3Address.ts +4 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verifyWeb3Address.d.ts","sourceRoot":"","sources":["../../../../src/resolvers/mutations/accounts/verifyWeb3Address.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"verifyWeb3Address.d.ts","sourceRoot":"","sources":["../../../../src/resolvers/mutations/accounts/verifyWeb3Address.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE9C,wBAA8B,iBAAiB,CAC7C,IAAI,EAAE,KAAK,EACX,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EACpD,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,OAAO,qDAqDnC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { log } from '@unchainedshop/logger';
|
|
2
|
-
import { recoverPersonalSignature } from '@metamask/eth-sig-util';
|
|
3
2
|
import { UserWeb3AddressNotFoundError, UserWeb3AddressSignatureError } from '../../../errors.js';
|
|
4
3
|
export default async function verifyWeb3Address(root, { address, hash }, { modules, userId, user }) {
|
|
5
4
|
log(`mutation verifyWeb3Address ${address} ${user.username}`, {
|
|
@@ -10,6 +9,9 @@ export default async function verifyWeb3Address(root, { address, hash }, { modul
|
|
|
10
9
|
throw new UserWeb3AddressNotFoundError({ userId, address });
|
|
11
10
|
}
|
|
12
11
|
const msg = `0x${Buffer.from(foundCredentials.nonce, 'utf8').toString('hex')}`;
|
|
12
|
+
// eslint-disable-next-line
|
|
13
|
+
// @ts-ignore
|
|
14
|
+
const { recoverPersonalSignature } = await import('@metamask/eth-sig-util');
|
|
13
15
|
const recoveredAddr = recoverPersonalSignature({
|
|
14
16
|
data: msg,
|
|
15
17
|
signature: hash,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verifyWeb3Address.js","sourceRoot":"","sources":["../../../../src/resolvers/mutations/accounts/verifyWeb3Address.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"verifyWeb3Address.js","sourceRoot":"","sources":["../../../../src/resolvers/mutations/accounts/verifyWeb3Address.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,4BAA4B,EAAE,6BAA6B,EAAE,MAAM,oBAAoB,CAAC;AAGjG,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,iBAAiB,CAC7C,IAAW,EACX,EAAE,OAAO,EAAE,IAAI,EAAqC,EACpD,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAW;IAElC,GAAG,CAAC,8BAA8B,OAAO,IAAI,IAAI,CAAC,QAAQ,EAAE,EAAE;QAC5D,MAAM;KACP,CAAC,CAAC;IAEH,MAAM,gBAAgB,GAAG,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,CAChD,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE,KAAK,OAAO,CAAC,WAAW,EAAE,CACrE,CAAC;IACF,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACtB,MAAM,IAAI,4BAA4B,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;IAC9D,CAAC;IAED,MAAM,GA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.0.0-rc5",
|
|
4
4
|
"main": "lib/api-index.js",
|
|
5
5
|
"types": "lib/api-index.d.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -28,24 +28,51 @@
|
|
|
28
28
|
},
|
|
29
29
|
"homepage": "https://github.com/unchainedshop/unchained#readme",
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"graphql-yoga": "^5.10.6"
|
|
32
|
-
},
|
|
33
|
-
"optionalDependencies": {
|
|
34
31
|
"@fastify/cookie": "^11.0.1",
|
|
35
32
|
"@fastify/session": "^11.0.2",
|
|
33
|
+
"@metamask/eth-sig-util": "^8.1.2",
|
|
36
34
|
"connect-mongo": "^5.1.0",
|
|
37
|
-
"express": "^
|
|
35
|
+
"express": "^5.0.1",
|
|
38
36
|
"express-session": "^1.18.1",
|
|
39
37
|
"fastify": "^5.2.0",
|
|
38
|
+
"graphql-yoga": "^5.10.6",
|
|
40
39
|
"passport": "^0.7.0"
|
|
41
40
|
},
|
|
41
|
+
"peerDependenciesMeta": {
|
|
42
|
+
"graphql-yoga": {
|
|
43
|
+
"optional": false
|
|
44
|
+
},
|
|
45
|
+
"connect-mongo": {
|
|
46
|
+
"optional": false
|
|
47
|
+
},
|
|
48
|
+
"@metamask/eth-sig-util": {
|
|
49
|
+
"optional": true
|
|
50
|
+
},
|
|
51
|
+
"@fastify/cookie": {
|
|
52
|
+
"optional": true
|
|
53
|
+
},
|
|
54
|
+
"@fastify/session": {
|
|
55
|
+
"optional": true
|
|
56
|
+
},
|
|
57
|
+
"express": {
|
|
58
|
+
"optional": true
|
|
59
|
+
},
|
|
60
|
+
"express-session": {
|
|
61
|
+
"optional": true
|
|
62
|
+
},
|
|
63
|
+
"fastify": {
|
|
64
|
+
"optional": true
|
|
65
|
+
},
|
|
66
|
+
"passport": {
|
|
67
|
+
"optional": true
|
|
68
|
+
}
|
|
69
|
+
},
|
|
42
70
|
"dependencies": {
|
|
43
|
-
"@
|
|
44
|
-
"@unchainedshop/
|
|
45
|
-
"@unchainedshop/
|
|
46
|
-
"@unchainedshop/
|
|
47
|
-
"@unchainedshop/
|
|
48
|
-
"@unchainedshop/utils": "^3.0.0-rc3",
|
|
71
|
+
"@unchainedshop/core": "^3.0.0-rc5",
|
|
72
|
+
"@unchainedshop/events": "^3.0.0-rc5",
|
|
73
|
+
"@unchainedshop/logger": "^3.0.0-rc5",
|
|
74
|
+
"@unchainedshop/roles": "^3.0.0-rc5",
|
|
75
|
+
"@unchainedshop/utils": "^3.0.0-rc5",
|
|
49
76
|
"accounting": "0.4.1",
|
|
50
77
|
"dataloader": "^2.2.3",
|
|
51
78
|
"expiry-map": "^2.0.0",
|
|
@@ -54,7 +81,14 @@
|
|
|
54
81
|
"p-memoize": "^7.1.1"
|
|
55
82
|
},
|
|
56
83
|
"devDependencies": {
|
|
84
|
+
"@fastify/cookie": "^11.0.1",
|
|
85
|
+
"@fastify/session": "^11.0.2",
|
|
86
|
+
"@metamask/eth-sig-util": "^8.1.2",
|
|
87
|
+
"@types/express": "^5.0.0",
|
|
57
88
|
"@types/node": "^22.10.2",
|
|
89
|
+
"express": "^5.0.1",
|
|
90
|
+
"express-session": "^1.18.1",
|
|
91
|
+
"fastify": "^5.2.0",
|
|
58
92
|
"jest": "^29.7.0",
|
|
59
93
|
"passport": "^0.7.0",
|
|
60
94
|
"ts-jest": "^29.2.5",
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { log } from '@unchainedshop/logger';
|
|
2
|
-
import { recoverPersonalSignature } from '@metamask/eth-sig-util';
|
|
3
2
|
import { UserWeb3AddressNotFoundError, UserWeb3AddressSignatureError } from '../../../errors.js';
|
|
4
3
|
import { Context } from '../../../context.js';
|
|
5
4
|
|
|
@@ -21,6 +20,10 @@ export default async function verifyWeb3Address(
|
|
|
21
20
|
|
|
22
21
|
const msg = `0x${Buffer.from(foundCredentials.nonce, 'utf8').toString('hex')}`;
|
|
23
22
|
|
|
23
|
+
// eslint-disable-next-line
|
|
24
|
+
// @ts-ignore
|
|
25
|
+
const { recoverPersonalSignature } = await import('@metamask/eth-sig-util');
|
|
26
|
+
|
|
24
27
|
const recoveredAddr = recoverPersonalSignature({
|
|
25
28
|
data: msg,
|
|
26
29
|
signature: hash,
|