Skip to content

Commit

Permalink
♻️ Refactor SIGN_AUTHORIZATION_PERMISSIONS scopes
Browse files Browse the repository at this point in the history
  • Loading branch information
williamchong committed Mar 6, 2025
1 parent 34d6d52 commit daf60ff
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion composables/useAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { storeToRefs } from 'pinia'
import { useWalletStore } from '~/stores/wallet'
import { useBookStoreApiStore } from '~/stores/book-store-api'
import { useCollectionStore } from '~/stores/collection'
import { SIGN_AUTHORIZATION_PERMISSIONS } from '~/utils/auth'

export function useAuth () {
const bookStoreApiStore = useBookStoreApiStore()
Expand Down Expand Up @@ -31,7 +32,7 @@ export function useAuth () {

const signature = await signMessageMemo(
'authorize',
['read:nftbook', 'write:nftbook', 'read:nftcollection', 'write:nftcollection', 'write:iscn', 'read:iscn']
SIGN_AUTHORIZATION_PERMISSIONS
)

if (!signature) {
Expand Down
3 changes: 2 additions & 1 deletion pages/auth/redirect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import { storeToRefs } from 'pinia'
import { useWalletStore } from '~/stores/wallet'
import { useBookStoreApiStore } from '~/stores/book-store-api'
import { SIGN_AUTHORIZATION_PERMISSIONS } from '~/utils/auth'
definePageMeta({ layout: 'page' })
Expand Down Expand Up @@ -42,7 +43,7 @@ onMounted(async () => {
const signature = await signMessageMemo(
'authorize',
['read:nftbook', 'write:nftbook', 'read:nftcollection', 'write:nftcollection', 'write:iscn', 'read:iscn']
SIGN_AUTHORIZATION_PERMISSIONS
)
if (!signature) {
throw new Error('Failed to authenticate: no signature')
Expand Down
2 changes: 1 addition & 1 deletion utils/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export function clearPostAuthRedirect () {
} catch {}
}

const SIGN_AUTHORIZATION_PERMISSIONS = [
export const SIGN_AUTHORIZATION_PERMISSIONS = [
'read:nftbook',
'write:nftbook',
'read:nftcollection',
Expand Down

0 comments on commit daf60ff

Please sign in to comment.