Skip to content

Commit

Permalink
sha256 on av upload
Browse files Browse the repository at this point in the history
  • Loading branch information
TateB committed Sep 8, 2023
1 parent efd8bc8 commit 8bfa2ff
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"@metamask/inpage-provider": "^8.1.0",
"@metamask/mobile-provider": "^2.1.0",
"@metamask/post-message-stream": "^6.1.2",
"@noble/hashes": "^1.3.2",
"@rainbow-me/rainbowkit": "1.0.8",
"@sentry/nextjs": "^7.43.0",
"@svgr/webpack": "^8.1.0",
Expand Down
14 changes: 10 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
/* eslint-disable no-multi-assign */
import { sha256 } from '@noble/hashes/sha256'
import { useMemo, useState } from 'react'
import { useTranslation } from 'react-i18next'
import styled, { css } from 'styled-components'
import { bytesToHex } from 'viem'
import { useMutation, useQueryClient, useSignTypedData } from 'wagmi'

import { Button, Dialog, mq } from '@ensdomains/thorin'

import { useChainName } from '@app/hooks/chain/useChainName'

import { keccak256 } from 'viem'
import { useQueryKeys } from '../../../../utils/cacheKeyFactory'
import { AvCancelButton, CropComponent } from './AvatarCrop'

Expand Down Expand Up @@ -52,7 +53,7 @@ const UploadComponent = ({
const { t } = useTranslation('transactionFlow')
const queryClient = useQueryClient()
const queryKeys = useQueryKeys().avatar.avatar(name)
const urlHash = useMemo(() => keccak256(dataURLToBytes(dataURL)), [dataURL])
const urlHash = useMemo(() => bytesToHex(sha256(dataURLToBytes(dataURL))), [dataURL])
const expiry = useMemo(() => `${Date.now() + 1000 * 60 * 60 * 24 * 7}`, [])
const network = useChainName()

Expand Down

0 comments on commit 8bfa2ff

Please sign in to comment.