@aztec/foundation 0.82.1 → 0.82.2
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/crypto/secp256k1-signer/utils.ts"],"names":[],"mappings":";;AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAMjE,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,QAAQ,GAAG,QAAQ,CAG7D;AAYD;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAElE;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,GAAG,UAAU,CAGpE;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,GAAG,UAAU,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/crypto/secp256k1-signer/utils.ts"],"names":[],"mappings":";;AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAMjE,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,QAAQ,GAAG,QAAQ,CAG7D;AAYD;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAElE;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,GAAG,UAAU,CAGpE;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,GAAG,UAAU,CAS/E;AAqBD;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,aAGhE;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,GAAG,MAAM,CAO7E"}
|
|
@@ -41,8 +41,12 @@ export function makeEthSignDigest(message) {
|
|
|
41
41
|
* @param signature - The signature to recover the address from.
|
|
42
42
|
* @returns The address.
|
|
43
43
|
*/ export function recoverAddress(hash, signature) {
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
try {
|
|
45
|
+
const publicKey = recoverPublicKey(hash, signature);
|
|
46
|
+
return publicKeyToAddress(publicKey);
|
|
47
|
+
} catch (err) {
|
|
48
|
+
throw new Error(`Error recovering Ethereum address from hash ${hash.toString()} and signature ${signature.toString()}: ${err}`);
|
|
49
|
+
}
|
|
46
50
|
}
|
|
47
51
|
/**
|
|
48
52
|
* @attribution - viem
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/foundation",
|
|
3
|
-
"version": "0.82.
|
|
3
|
+
"version": "0.82.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dest/index.js",
|
|
6
6
|
"types": "./dest/index.d.ts",
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
]
|
|
104
104
|
},
|
|
105
105
|
"dependencies": {
|
|
106
|
-
"@aztec/bb.js": "0.82.
|
|
106
|
+
"@aztec/bb.js": "0.82.2",
|
|
107
107
|
"@koa/cors": "^5.0.0",
|
|
108
108
|
"@noble/curves": "^1.2.0",
|
|
109
109
|
"bn.js": "^5.2.1",
|
|
@@ -49,8 +49,14 @@ export function addressFromPrivateKey(privateKey: Buffer): EthAddress {
|
|
|
49
49
|
* @returns The address.
|
|
50
50
|
*/
|
|
51
51
|
export function recoverAddress(hash: Buffer32, signature: Signature): EthAddress {
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
try {
|
|
53
|
+
const publicKey = recoverPublicKey(hash, signature);
|
|
54
|
+
return publicKeyToAddress(publicKey);
|
|
55
|
+
} catch (err) {
|
|
56
|
+
throw new Error(
|
|
57
|
+
`Error recovering Ethereum address from hash ${hash.toString()} and signature ${signature.toString()}: ${err}`,
|
|
58
|
+
);
|
|
59
|
+
}
|
|
54
60
|
}
|
|
55
61
|
|
|
56
62
|
/**
|