Compare commits
4 Commits
c3d77d5fa4
...
a987b3f639
Author | SHA1 | Date | |
---|---|---|---|
a987b3f639 | |||
070193c8df | |||
b3fc3c6715 | |||
1de8e89beb |
76
src/data/metaSamples.json
Normal file
76
src/data/metaSamples.json
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
{
|
||||||
|
"creatorMetaExample": {
|
||||||
|
"fileHashes": {
|
||||||
|
"firstPdfFile.pdf": "da5f857e77d3aa59c461efad804116931c059b36e6b4da0b5d9452753ec70c05",
|
||||||
|
"da5f857e77d3aa59c461efad804116931c059b36e6b4da0b5d9452753ec70c05/1.png": "hash123png1",
|
||||||
|
"da5f857e77d3aa59c461efad804116931c059b36e6b4da0b5d9452753ec70c05/2.png": "hash321png2"
|
||||||
|
},
|
||||||
|
"markConfig": {
|
||||||
|
"npub1x77qywdllzetv9ncnhlfpv62kshlgtt0uqlsq3v22uzzkk2xvvrsn6uyfy": {
|
||||||
|
"da5f857e77d3aa59c461efad804116931c059b36e6b4da0b5d9452753ec70c05/1.png": [
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"type": "FULLNAME",
|
||||||
|
"markLocation": {
|
||||||
|
"top": 56,
|
||||||
|
"left": 306,
|
||||||
|
"height": 200,
|
||||||
|
"width": 100,
|
||||||
|
"page": 1
|
||||||
|
},
|
||||||
|
"npub": "npub1x77qywdllzetv9ncnhlfpv62kshlgtt0uqlsq3v22uzzkk2xvvrsn6uyfy",
|
||||||
|
"pdfFileHash": "da5f857e77d3aa59c461efad804116931c059b36e6b4da0b5d9452753ec70c05"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"da5f857e77d3aa59c461efad804116931c059b36e6b4da0b5d9452753ec70c05/2.png": [
|
||||||
|
{
|
||||||
|
"id": 2,
|
||||||
|
"markType": "FULLNAME",
|
||||||
|
"location": {
|
||||||
|
"top": 76,
|
||||||
|
"left": 283,
|
||||||
|
"height": 150,
|
||||||
|
"width": 123,
|
||||||
|
"page": 2
|
||||||
|
},
|
||||||
|
"npub": "npub1x77qywdllzetv9ncnhlfpv62kshlgtt0uqlsq3v22uzzkk2xvvrsn6uyfy",
|
||||||
|
"pdfFileHash": "da5f857e77d3aa59c461efad804116931c059b36e6b4da0b5d9452753ec70c05"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"docSignatureExample": {
|
||||||
|
"prevSig": "10de030dd2bfafbbd34969645bd0b3f5e8ab71b3b32091fb29bbea5e272f8a3b7284ef667b6a02e9becc1036450d9fbe5c1c6d146fa91d70e0d8f3cd54d64f17",
|
||||||
|
"marks": [
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"type": "FULLNAME",
|
||||||
|
"markLocation": {
|
||||||
|
"top": 56,
|
||||||
|
"left": 306,
|
||||||
|
"height": 200,
|
||||||
|
"width": 100,
|
||||||
|
"page": 1
|
||||||
|
},
|
||||||
|
"npub": "npub1x77qywdllzetv9ncnhlfpv62kshlgtt0uqlsq3v22uzzkk2xvvrsn6uyfy",
|
||||||
|
"pdfFileHash": "da5f857e77d3aa59c461efad804116931c059b36e6b4da0b5d9452753ec70c05",
|
||||||
|
"value": "Pera Peric"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 2,
|
||||||
|
"markType": "FULLNAME",
|
||||||
|
"location": {
|
||||||
|
"top": 76,
|
||||||
|
"left": 283,
|
||||||
|
"height": 150,
|
||||||
|
"width": 123,
|
||||||
|
"page": 2
|
||||||
|
},
|
||||||
|
"npub": "npub1x77qywdllzetv9ncnhlfpv62kshlgtt0uqlsq3v22uzzkk2xvvrsn6uyfy",
|
||||||
|
"pdfFileHash": "da5f857e77d3aa59c461efad804116931c059b36e6b4da0b5d9452753ec70c05",
|
||||||
|
"value": "Pera Peric"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
@ -724,9 +724,9 @@ export const SignPage = () => {
|
|||||||
|
|
||||||
zip.file('meta.json', stringifiedMeta)
|
zip.file('meta.json', stringifiedMeta)
|
||||||
|
|
||||||
Object.entries(files).forEach(([fileName, arrayBuffer]) => {
|
for (const [fileName, pdf] of Object.entries(files)) {
|
||||||
zip.file(`files/${fileName}`, arrayBuffer)
|
zip.file(`files/${fileName}`, await pdf.file.arrayBuffer())
|
||||||
})
|
}
|
||||||
|
|
||||||
const arrayBuffer = await zip
|
const arrayBuffer = await zip
|
||||||
.generateAsync({
|
.generateAsync({
|
||||||
@ -763,9 +763,9 @@ export const SignPage = () => {
|
|||||||
|
|
||||||
zip.file('meta.json', stringifiedMeta)
|
zip.file('meta.json', stringifiedMeta)
|
||||||
|
|
||||||
Object.entries(files).forEach(([fileName, arrayBuffer]) => {
|
for (const [fileName, pdf] of Object.entries(files)) {
|
||||||
zip.file(`files/${fileName}`, arrayBuffer)
|
zip.file(`files/${fileName}`, await pdf.file.arrayBuffer())
|
||||||
})
|
}
|
||||||
|
|
||||||
const arrayBuffer = await zip
|
const arrayBuffer = await zip
|
||||||
.generateAsync({
|
.generateAsync({
|
||||||
|
@ -22,56 +22,3 @@ export interface MarkLocation {
|
|||||||
width: number;
|
width: number;
|
||||||
page: number;
|
page: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Creator Meta Object Example
|
|
||||||
const creatorMetaExample = {
|
|
||||||
"fileHashes": {
|
|
||||||
// PDF Hash
|
|
||||||
"Lorem ipsum dolor sit amet.pdf": "da5f857e77d3aa59c461efad804116931c059b36e6b4da0b5d9452753ec70c05",
|
|
||||||
// PDF Pages (in png format) hashes
|
|
||||||
// Page 1
|
|
||||||
"da5f857e77d3aa59c461efad804116931c059b36e6b4da0b5d9452753ec70c05/1.png": "hash123png1",
|
|
||||||
// Page 2
|
|
||||||
"da5f857e77d3aa59c461efad804116931c059b36e6b4da0b5d9452753ec70c05/2.png": "hash321png2"
|
|
||||||
},
|
|
||||||
"markConfig": {
|
|
||||||
// Signer npub
|
|
||||||
'npub1x77qywdllzetv9ncnhlfpv62kshlgtt0uqlsq3v22uzzkk2xvvrsn6uyfy': {
|
|
||||||
// PDF Page 1 (PNG file hash)
|
|
||||||
'da5f857e77d3aa59c461efad804116931c059b36e6b4da0b5d9452753ec70c05/1.png': [
|
|
||||||
{
|
|
||||||
markType: "FULLNAME",
|
|
||||||
markLocation: "X:56;Y:306"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
// PDF Page 2 (PNG file hash)
|
|
||||||
'da5f857e77d3aa59c461efad804116931c059b36e6b4da0b5d9452753ec70c05/2.png': [
|
|
||||||
{
|
|
||||||
markType: "FULLNAME",
|
|
||||||
markLocation: "X:76;Y:283.71875"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Signer meta example
|
|
||||||
const signerExample = {
|
|
||||||
"prevSig": "10de030dd2bfafbbd34969645bd0b3f5e8ab71b3b32091fb29bbea5e272f8a3b7284ef667b6a02e9becc1036450d9fbe5c1c6d146fa91d70e0d8f3cd54d64f17",
|
|
||||||
"marks": {
|
|
||||||
// PDF Page 1 (PNG file hash)
|
|
||||||
'da5f857e77d3aa59c461efad804116931c059b36e6b4da0b5d9452753ec70c05/1.png': {
|
|
||||||
// Mark coordinates
|
|
||||||
"X:56;Y:306": {
|
|
||||||
value: 'Pera Peric'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// PDF Page 2 (PNG file hash)
|
|
||||||
'da5f857e77d3aa59c461efad804116931c059b36e6b4da0b5d9452753ec70c05/2.png': {
|
|
||||||
// Mark coordinates
|
|
||||||
"X:76;Y:283.71875": {
|
|
||||||
value: 'Pera Peric'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user