re-enable signature checking
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 39s
Details
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 39s
Details
This commit is contained in:
parent
2f9e31852d
commit
25e515e0bb
|
@ -1,7 +1,7 @@
|
|||
import axios from 'axios';
|
||||
// trailing slash is deliberate, to differentiate this package from the core node module
|
||||
import { Buffer } from 'buffer/';
|
||||
// import { recoverPersonalSignature } from '@metamask/eth-sig-util/dist/personal-sign';
|
||||
import { recoverPersonalSignature } from '@metamask/eth-sig-util';
|
||||
import objectHash from 'object-hash/dist/object_hash';
|
||||
|
||||
// Make Buffer available to recoverPersonalSignature
|
||||
|
@ -25,18 +25,16 @@ class Post {
|
|||
if (hash !== derivedHash) {
|
||||
throw new Error('Hash mismatch');
|
||||
}
|
||||
// TODO: Verify signature
|
||||
// Disabling this because @metamask/eth-sig-util is a nodejs module
|
||||
// and we need to figure out how to bundle it.
|
||||
// let recovered;
|
||||
// try {
|
||||
// recovered = recoverPersonalSignature({ data: content, signature });
|
||||
// } catch (e) {
|
||||
// throw new Error('Signature error', e);
|
||||
// }
|
||||
// if (recovered !== author) {
|
||||
// throw new Error('Author mismatch');
|
||||
// }
|
||||
// Verify signature
|
||||
let recovered;
|
||||
try {
|
||||
recovered = recoverPersonalSignature({ data: content, signature });
|
||||
} catch (e) {
|
||||
throw new Error('Signature error', e);
|
||||
}
|
||||
if (recovered !== author) {
|
||||
throw new Error('Author mismatch');
|
||||
}
|
||||
return new Post({
|
||||
content, author, signature, hash,
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue