12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- /* Import modules. */
- import { defineStore } from 'pinia'
- /**
- * Profile Store
- */
- export const useProfileStore = defineStore('profile', {
- state: () => ({
- /* Initialize player id. */
- _playerid: null,
- /* Initialize session. */
- _session: null,
- /**
- * Email
- *
- * This is a valid email address.
- */
- _email: null,
- /**
- * Metadata
- *
- * Used to store (user-defined) data for:
- * 1. Individual accounts
- * 2. Individual unspent transaction outputs (UXTOs)
- *
- * NOTE: Metadata MUST be used sparingly, to avoid data storage bloat;
- * and should be deleted when no longer needed.
- *
- * TODO: Allow this data to be stored on-chain using:
- * 1. Bitcoin Files Protocol (BFP) (https://bitcoinfiles.com/)
- * 2. Telr Locker (https://locker.telr.io)
- */
- _meta: null,
- /**
- * Nickname
- *
- * This is a public alias.
- *
- * NOTE: Only alpha-numeric characters are accepted.
- * Both upper and lower-case characters are accepted.
- */
- _nickname: null,
- }),
- getters: {
- playerid(_state) {
- // return _state._playerid
- return 'nexa:nqtsq5g50uxexshuxtfhg8gava58m99japtehqvy0fgcm2zy' // Anon
- },
- session(_state) {
- return _state._session
- },
- sessionid(_state) {
- return _state._session?.id
- },
- challenge(_state) {
- return _state._session?.challenge
- },
- },
- actions: {
- deleteSession() {
- /* Reset session. */
- this._session = null
- },
- saveSession(_session) {
- console.log('PROFILE SAVING SESSION', _session)
- /* Set session. */
- this._session = _session
- },
- },
- // persist: true,
- })
|