🔓Anonymous Authentication
An online authentication application for storing profiles
Last updated
{
"data":
{
"key":"4735904570539279682275507070929548418220332715061423656258515080175565373207",
"value":
{
"pfp":"https://expertphotography.b-cdn.net/wp-content/uploads/2020/06/stock-photography-trends11.jpg",
"username":"Merdo"
}
}
} const handleUpload = async () => {
...
// Request signature using Wagmi
const secret = await signMessageAsync();
const key = await computeKey(valueToBigInt(secret));
const profile = await getProfile(key);
const curValue = profile.data.data.value;
if (!curValue) {
createProfile(key, form.values)
.then((res) => {
if (res.statusText == "OK") {
setProfileLocal(form.values);
}
})
};
else {...} // Key exists, try to update
...
}; const handleUpload = async () => {
...
// Request signature using Wagmi
const secret = await signMessageAsync();
const key = await computeKey(valueToBigInt(secret));
const profile = await getProfile(key);
const curValue = profile.data.data.value;
if (!curValue) {...} // Key doesn't exists, try to create a profile
else {
// Generate the proof
const { proof } = await generateProof(
valueToBigInt(secret),
curValue,
form.values
);
updateProfile(key, form.values, proof)
.then((res) => {
if (res.statusText == "OK") {
setProfileLocal(form.values);
}
})
}
...
}; const handleRetrieve = async () => {
...
// Request signature using Wagmi
const secret = await signMessageAsync();
const key = await computeKey(valueToBigInt(secret));
const profile = await getProfile(key);
const curValue = profile.data.data.value;
if (curValue) {
setProfileLocal(curValue);
}
...
};