-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add annotation generation from Writer
- Loading branch information
1 parent
53dce3a
commit dced064
Showing
15 changed files
with
82 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<head><link href="/static/css/main.62dceea5.chunk.css" rel="stylesheet"></head><div id="modal-window"></div><script src="/static/js/runtime-main.0d1674f1.js"></script><script src="/static/js/2.344354a5.chunk.js"></script><script src="/static/js/main.11dfc34b.chunk.js"></script> | ||
<head><link href="/static/css/main.62dceea5.chunk.css" rel="stylesheet"></head><div id="modal-window"></div><script src="/static/js/runtime-main.0d1674f1.js"></script><script src="/static/js/2.0b7e9956.chunk.js"></script><script src="/static/js/main.d224a6b4.chunk.js"></script> |
12 changes: 6 additions & 6 deletions
12
...ifest.0a171aca7a1d1f41856a5345cc635505.js → ...ifest.ed2a8cbb9926c6074e7de6298d459189.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { sign as metamaskSign } from './ethereum' | ||
|
||
class Annotation { | ||
constructor({ content, issuerEthAddress, tweetAuthor, tweetId }) { | ||
this.payload = { | ||
["@context"]: ["https://pan.network/annotation/v1"], | ||
issuanceDate: new Date().toJSON(), | ||
issuer: `urn:ethereum:${issuerEthAddress}`, | ||
credentialSubject: { | ||
annotation: content, | ||
content: `uri:tweet:${tweetAuthor}/${tweetId}` | ||
}, | ||
proof: { | ||
created: this.issuanceDate, | ||
proofPurpose: "PANSubmission", | ||
type: "EthereumECDSA", | ||
verificationMethod: "urn:ethereum:messageHash" | ||
}, | ||
type: ["VerifiableCredential", "PANCredential"] | ||
} | ||
} | ||
async sign() { | ||
try { | ||
const signed = await metamaskSign(this.payload) | ||
this.payload.proof.jws = signed | ||
} catch (e) { | ||
console.error(e) | ||
} | ||
} | ||
} | ||
|
||
export default Annotation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters