Require verified wallet address when minting NFT

This commit is contained in:
silverpill 2022-05-27 20:04:51 +00:00
parent a3716079d7
commit b9722afebe
2 changed files with 3 additions and 2 deletions

View file

@ -524,7 +524,7 @@ paths:
schema: schema:
$ref: '#/components/schemas/Signature' $ref: '#/components/schemas/Signature'
403: 403:
description: Post does not belong to user, is not public or not saved to IPFS, or user's wallet address is not known description: Post does not belong to user, is not public or not saved to IPFS, or user's wallet address is not known or not verified
404: 404:
description: Post not found description: Post not found
418: 418:

View file

@ -451,7 +451,8 @@ async fn get_signature(
let current_user = get_current_user(db_client, auth.token()).await?; let current_user = get_current_user(db_client, auth.token()).await?;
let blockchain_config = config.blockchain.as_ref() let blockchain_config = config.blockchain.as_ref()
.ok_or(HttpError::NotSupported)?; .ok_or(HttpError::NotSupported)?;
let wallet_address = current_user.wallet_address // Wallet address must be public because minting exposes it
let wallet_address = current_user.public_wallet_address()
.ok_or(HttpError::PermissionError)?; .ok_or(HttpError::PermissionError)?;
let post = get_post_by_id(db_client, &status_id).await?; let post = get_post_by_id(db_client, &status_id).await?;
if post.author.id != current_user.id || !post.is_public() || post.repost_of_id.is_some() { if post.author.id != current_user.id || !post.is_public() || post.repost_of_id.is_some() {