Skip to content

ARC-0031 : Authentication with Algorand accounts #160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 39 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
8de6348
arc-0014 first version
Apr 5, 2022
d33f1ad
arc-0014 update
Apr 5, 2022
34deaba
linters fix
Apr 5, 2022
ecd70d7
review until overview
Apr 7, 2022
5755c11
review until overview (typos)
Apr 7, 2022
26e9e06
ultimated version
Apr 14, 2022
65bac9a
style fix on overview
Apr 14, 2022
2a2e7f2
style fix specs
Apr 14, 2022
f5cdda1
style fix random
Apr 14, 2022
e0cb732
typo fix
Apr 20, 2022
7c705ed
new prefix and fix on txn-auth-msg sender param
May 25, 2022
d91fadc
rename of session design section
Aug 19, 2022
3747928
removing reference to PR#41
Aug 29, 2022
886b0da
Merge branch 'main' into pr/84
SudoWeezy Sep 9, 2022
1f088af
updating to match ARC-0 convention
SudoWeezy Sep 9, 2022
1401c2d
fix broken link
SudoWeezy Sep 9, 2022
ca7075e
removed session-related content
Sep 17, 2022
4fff311
fix typos + grammar
Oct 14, 2022
af20ddd
[WIP] Arc31
Jan 4, 2023
781a40e
arc31 rekeyed accounts
Jan 5, 2023
ea66bb4
minor typo
Jan 5, 2023
cb936e8
finalized arc-31
Jan 11, 2023
0da7597
ARC-0031: Reference Implementation
mrcointreau Jan 12, 2023
1ce6371
ref implementation details
deanstef Jan 12, 2023
5b9bbf6
readme disclamer ref impl
deanstef Jan 12, 2023
151f0fc
ref-impl readme requirements
deanstef Jan 12, 2023
ce6a80a
Remove ref-impl unnecessary package-lock.json files
mrcointreau Jan 12, 2023
33b301e
env vars in dockerfile + nit in api-v1
Jan 13, 2023
e207398
env examples
Jan 13, 2023
f3583e9
Merge pull request #1 from deanstef/reference-implementation
Jan 13, 2023
4fb50de
Merge branch 'algorandfoundation:main' into arc-0031
deanstef Jan 13, 2023
143b735
nit in multisig threshold
Jan 14, 2023
d2bf119
Replace myalgo-conect with @perawallet/connect
mrcointreau Feb 6, 2024
6978019
Merge branch 'algorandfoundation:main' into arc-0031
deanstef Feb 7, 2024
13d861e
Remove unused code
mrcointreau Feb 8, 2024
128b89f
Add api request body validation
mrcointreau Feb 8, 2024
c1a6c8d
Fix notifications icons and colors
mrcointreau Feb 8, 2024
51024c2
Refactor notification system
mrcointreau Feb 8, 2024
c6465fe
Merge pull request #2 from deanstef/feature/perawallet-connect
deanstef Feb 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
ARC-0031: Reference Implementation
  • Loading branch information
mrcointreau committed Jan 12, 2023
commit 0da7597c2da2d2558c5c229e11830ba06b6080c5
30 changes: 30 additions & 0 deletions assets/arc-0031/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
.DS_Store
dist
dist-ssr
coverage
*.local
.env
.env.*

/cypress/videos/
/cypress/screenshots/

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
35 changes: 35 additions & 0 deletions assets/arc-0031/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
.DS_Store
dist
dist-ssr
coverage
*.local
.env
.env.*

# Nuxt dev/build outputs
.output
.nuxt

/cypress/videos/
/cypress/screenshots/

# Editor directories and files
.vscode/*
!.vscode/extensions.json
!.vscode/settings.json.example
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
11 changes: 11 additions & 0 deletions assets/arc-0031/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"printWidth": 120,
"tabWidth": 2,
"useTabs": false,
"semi": false,
"singleQuote": true,
"trailingComma": "none",
"bracketSpacing": true,
"arrowParens": "avoid",
"htmlWhitespaceSensitivity": "strict"
}
6 changes: 6 additions & 0 deletions assets/arc-0031/.vscode/settings.json.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"eslint.workingDirectories": ["client", "server"],
"prettier.requireConfig": true
}
45 changes: 45 additions & 0 deletions assets/arc-0031/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# arc-0031

## Users registration

Add registered users to the `server/mock/users.json` array, user `nonce` must be set to `''`.

## Run via Docker Compose

From `client` folder run

```
docker build -t arc-0031-client .
```

From `server` folder run

```
docker build -t arc-0031-server .
```

From `arc-0031` folder run

```
docker-compose up
```

Visit `localhost:3000`

## Run local development environment

From `client` folder run

```
yarn install --frozen-lockfile
yarn dev
```

From `server` folder run

```
yarn install --frozen-lockfile
yarn dev
```

Visit `localhost:3000`
4 changes: 4 additions & 0 deletions assets/arc-0031/client/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"root": true,
"extends": ["@nuxtjs/eslint-config-typescript", "plugin:prettier/recommended"]
}
14 changes: 14 additions & 0 deletions assets/arc-0031/client/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM node:16-bullseye

WORKDIR /client
COPY package.json /client/package.json
COPY . .
RUN yarn install \
--prefer-offline \
--frozen-lockfile \
--non-interactive
RUN NODE_ENV=production yarn build

EXPOSE 3000

ENTRYPOINT ["node", ".output/server/index.mjs"]
42 changes: 42 additions & 0 deletions assets/arc-0031/client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Nuxt 3 Minimal Starter

Look at the [Nuxt 3 documentation](https://nuxt.com/docs/getting-started/introduction) to learn more.

## Setup

Make sure to install the dependencies:

```bash
# yarn
yarn install

# npm
npm install

# pnpm
pnpm install --shamefully-hoist
```

## Development Server

Start the development server on http://localhost:3000

```bash
npm run dev
```

## Production

Build the application for production:

```bash
npm run build
```

Locally preview production build:

```bash
npm run preview
```

Check out the [deployment documentation](https://nuxt.com/docs/getting-started/deployment) for more information.
43 changes: 43 additions & 0 deletions assets/arc-0031/client/app.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<script lang="ts" setup>
import { useDark } from '@vueuse/core'
import { darkTheme, type GlobalTheme, NConfigProvider, NGlobalStyle, NLayout, NMessageProvider } from 'naive-ui'
import { ref, onMounted } from 'vue'

useHead({
title: 'Index',
titleTemplate: '%s - arc-0031',
meta: [
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{
hid: 'description',
name: 'description',
content: 'Nuxt'
}
],
link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }]
})

const theme = ref<GlobalTheme | null>(null)
onMounted(() => {
const isDark = useDark()
if (isDark.value) {
theme.value = darkTheme
}
})
</script>

<template>
<Html>
<Body>
<NConfigProvider :theme="theme">
<NMessageProvider>
<NLayout>
<NuxtLoadingIndicator :height="5" :duration="3000" />
<NuxtPage style="width: 100vw; height: 100vh" />
</NLayout>
</NMessageProvider>
<NGlobalStyle />
</NConfigProvider>
</Body>
</Html>
</template>
15 changes: 15 additions & 0 deletions assets/arc-0031/client/middleware/guard.global.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { useAuthStore } from '~~/store/auth'

export default defineNuxtRouteMiddleware(to => {
if (process.server) {
const authStore = useAuthStore()
const { loadSession } = authStore
loadSession()
if (!authStore.session && to.path !== '/signin') {
return '/signin'
}
if (authStore.session && to.path === '/signin') {
return '/'
}
}
})
44 changes: 44 additions & 0 deletions assets/arc-0031/client/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { NodeGlobalsPolyfillPlugin } from '@esbuild-plugins/node-globals-polyfill'
import { NodeModulesPolyfillPlugin } from '@esbuild-plugins/node-modules-polyfill'
import inject from '@rollup/plugin-inject'

// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
modules: [
[
'@pinia/nuxt',
{
autoImports: ['defineStore', ['defineStore', 'definePiniaStore']]
}
]
],
build: {
transpile:
process.env.NODE_ENV === 'production'
? ['naive-ui', 'vueuc', '@css-render/vue3-ssr', '@juggle/resize-observer']
: ['@juggle/resize-observer']
},
vite: {
build: {
rollupOptions: {
plugins: [inject({ Buffer: ['buffer', 'Buffer'] })]
}
},
// in dev mode, vite use `esbuild`, so we should add `node polyfill`
optimizeDeps: {
include: process.env.NODE_ENV === 'development' ? ['naive-ui', 'vueuc', 'date-fns-tz/esm/formatInTimeZone'] : [],
esbuildOptions: {
define: {
global: 'globalThis'
},
plugins: [
NodeGlobalsPolyfillPlugin({
process: true,
buffer: true
}),
NodeModulesPolyfillPlugin()
]
}
}
}
})
Loading