storing contact details works
This commit is contained in:
parent
00fc6bb258
commit
6b52d06b3e
10 changed files with 138 additions and 15 deletions
|
|
@ -45,6 +45,12 @@ class ContactDetails {
|
|||
|
||||
return fragment;
|
||||
}
|
||||
|
||||
async getEncryptedContactDetails() {
|
||||
const jsonString = JSON.stringify(this.details);
|
||||
const encryptedContactDetails = await window.nostr.nip04.encrypt(await window.nostr.getPublicKey(), jsonString);
|
||||
return encryptedContactDetails;
|
||||
}
|
||||
}
|
||||
|
||||
let contactDetails;
|
||||
|
|
@ -67,4 +73,21 @@ window.onload = () => {
|
|||
input.value = '';
|
||||
});
|
||||
});
|
||||
|
||||
document
|
||||
.querySelector('#submit-details-button')
|
||||
.addEventListener(
|
||||
'click',
|
||||
async () => {
|
||||
const encryptedContactDetails = await contactDetails.getEncryptedContactDetails();
|
||||
await fetch('/api/set-contact-details',
|
||||
{
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({ encryptedContactDetails })
|
||||
});
|
||||
}
|
||||
);
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue