mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-03 09:51:39 +00:00
feature/1121 implement ucan validation (#1176)
- **refactor: remove unused auth components** - **refactor: improve devbox configuration and deployment process** - **refactor: improve devnet and testnet setup** - **fix: update templ version to v0.2.778** - **refactor: rename pkl/net.matrix to pkl/matrix.net** - **refactor: migrate webapp components to nebula** - **refactor: protobuf types** - **chore: update dependencies for improved security and stability** - **feat: implement landing page and vault gateway servers** - **refactor: Migrate data models to new module structure and update related files** - **feature/1121-implement-ucan-validation** - **refactor: Replace hardcoded constants with model types in attns.go** - **feature/1121-implement-ucan-validation** - **chore: add origin Host struct and update main function to handle multiple hosts** - **build: remove unused static files from dwn module** - **build: remove unused static files from dwn module** - **refactor: Move DWN models to common package** - **refactor: move models to pkg/common** - **refactor: move vault web app assets to embed module** - **refactor: update session middleware import path** - **chore: configure port labels and auto-forwarding behavior** - **feat: enhance devcontainer configuration** - **feat: Add UCAN middleware for Echo with flexible token validation** - **feat: add JWT middleware for UCAN authentication** - **refactor: update package URI and versioning in PklProject files** - **fix: correct sonr.pkl import path** - **refactor: move JWT related code to auth package** - **feat: introduce vault configuration retrieval and management** - **refactor: Move vault components to gateway module and update file paths** - **refactor: remove Dexie and SQLite database implementations** - **feat: enhance frontend with PWA features and WASM integration** - **feat: add Devbox features and streamline Dockerfile** - **chore: update dependencies to include TigerBeetle** - **chore(deps): update go version to 1.23** - **feat: enhance devnet setup with PATH environment variable and updated PWA manifest** - **fix: upgrade tigerbeetle-go dependency and remove indirect dependency** - **feat: add PostgreSQL support to devnet and testnet deployments** - **refactor: rename keyshare cookie to token cookie** - **feat: upgrade Go version to 1.23.3 and update dependencies** - **refactor: update devnet and testnet configurations** - **feat: add IPFS configuration for devnet** - **I'll help you update the ipfs.config.pkl to include all the peers from the shell script. Here's the updated configuration:** - **refactor: move mpc package to crypto directory** - **feat: add BIP32 support for various cryptocurrencies** - **feat: enhance ATN.pkl with additional capabilities** - **refactor: simplify smart account and vault attenuation creation** - **feat: add new capabilities to the Attenuation type** - **refactor: Rename MPC files for clarity and consistency** - **feat: add DIDKey support for cryptographic operations** - **feat: add devnet and testnet deployment configurations** - **fix: correct key derivation in bip32 package** - **refactor: rename crypto/bip32 package to crypto/accaddr** - **fix: remove duplicate indirect dependency** - **refactor: move vault package to root directory** - **refactor: update routes for gateway and vault** - **refactor: remove obsolete web configuration file** - **refactor: remove unused TigerBeetle imports and update host configuration** - **refactor: adjust styles directory path** - **feat: add broadcastTx and simulateTx functions to gateway** - **feat: add PinVault handler**
This commit is contained in:
@@ -1,82 +0,0 @@
|
||||
package storage
|
||||
|
||||
var storageHandle = templ.NewOnceHandle()
|
||||
|
||||
// Internal script templates for storage operations
|
||||
|
||||
script setLocalStorage(key string, value string) {
|
||||
localStorage.setItem(key, value)
|
||||
}
|
||||
|
||||
script getLocalStorage(key string) {
|
||||
return localStorage.getItem(key)
|
||||
}
|
||||
|
||||
script removeLocalStorage(key string) {
|
||||
localStorage.removeItem(key)
|
||||
}
|
||||
|
||||
script setSessionStorage(key string, value string) {
|
||||
sessionStorage.setItem(key, value)
|
||||
}
|
||||
|
||||
script getSessionStorage(key string) {
|
||||
return sessionStorage.getItem(key)
|
||||
}
|
||||
|
||||
script removeSessionStorage(key string) {
|
||||
sessionStorage.removeItem(key)
|
||||
}
|
||||
|
||||
// Storage component that includes all storage-related scripts
|
||||
templ StorageScripts() {
|
||||
@storageHandle.Once() {
|
||||
<script type="text/javascript">
|
||||
// Storage helper functions
|
||||
function setLocalStorageItem(key, value) {
|
||||
localStorage.setItem(key, value);
|
||||
}
|
||||
|
||||
function getLocalStorageItem(key) {
|
||||
return localStorage.getItem(key);
|
||||
}
|
||||
|
||||
function removeLocalStorageItem(key) {
|
||||
localStorage.removeItem(key);
|
||||
}
|
||||
|
||||
function setSessionStorageItem(key, value) {
|
||||
sessionStorage.setItem(key, value);
|
||||
}
|
||||
|
||||
function getSessionStorageItem(key) {
|
||||
return sessionStorage.getItem(key);
|
||||
}
|
||||
|
||||
function removeSessionStorageItem(key) {
|
||||
sessionStorage.removeItem(key);
|
||||
}
|
||||
</script>
|
||||
}
|
||||
}
|
||||
|
||||
// Public components for storage operations
|
||||
templ SetLocalStorageItem(key string, value any) {
|
||||
@StorageScripts()
|
||||
<script>
|
||||
(() => {
|
||||
const value = { templ.JSONString(value) };
|
||||
setLocalStorageItem({ key }, JSON.stringify(value));
|
||||
})();
|
||||
</script>
|
||||
}
|
||||
|
||||
templ SetSessionStorageItem(key string, value any) {
|
||||
@StorageScripts()
|
||||
<script>
|
||||
(() => {
|
||||
const value = { templ.JSONString(value) };
|
||||
setSessionStorageItem({ key }, JSON.stringify(value));
|
||||
})();
|
||||
</script>
|
||||
}
|
||||
@@ -1,189 +0,0 @@
|
||||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.2.793
|
||||
package storage
|
||||
|
||||
//lint:file-ignore SA4006 This context is only used if a nested component is present.
|
||||
|
||||
import "github.com/a-h/templ"
|
||||
import templruntime "github.com/a-h/templ/runtime"
|
||||
|
||||
var storageHandle = templ.NewOnceHandle()
|
||||
|
||||
// Internal script templates for storage operations
|
||||
func setLocalStorage(key string, value string) templ.ComponentScript {
|
||||
return templ.ComponentScript{
|
||||
Name: `__templ_setLocalStorage_13ae`,
|
||||
Function: `function __templ_setLocalStorage_13ae(key, value){localStorage.setItem(key, value)
|
||||
}`,
|
||||
Call: templ.SafeScript(`__templ_setLocalStorage_13ae`, key, value),
|
||||
CallInline: templ.SafeScriptInline(`__templ_setLocalStorage_13ae`, key, value),
|
||||
}
|
||||
}
|
||||
|
||||
func getLocalStorage(key string) templ.ComponentScript {
|
||||
return templ.ComponentScript{
|
||||
Name: `__templ_getLocalStorage_3450`,
|
||||
Function: `function __templ_getLocalStorage_3450(key){return localStorage.getItem(key)
|
||||
}`,
|
||||
Call: templ.SafeScript(`__templ_getLocalStorage_3450`, key),
|
||||
CallInline: templ.SafeScriptInline(`__templ_getLocalStorage_3450`, key),
|
||||
}
|
||||
}
|
||||
|
||||
func removeLocalStorage(key string) templ.ComponentScript {
|
||||
return templ.ComponentScript{
|
||||
Name: `__templ_removeLocalStorage_64b1`,
|
||||
Function: `function __templ_removeLocalStorage_64b1(key){localStorage.removeItem(key)
|
||||
}`,
|
||||
Call: templ.SafeScript(`__templ_removeLocalStorage_64b1`, key),
|
||||
CallInline: templ.SafeScriptInline(`__templ_removeLocalStorage_64b1`, key),
|
||||
}
|
||||
}
|
||||
|
||||
func setSessionStorage(key string, value string) templ.ComponentScript {
|
||||
return templ.ComponentScript{
|
||||
Name: `__templ_setSessionStorage_0b44`,
|
||||
Function: `function __templ_setSessionStorage_0b44(key, value){sessionStorage.setItem(key, value)
|
||||
}`,
|
||||
Call: templ.SafeScript(`__templ_setSessionStorage_0b44`, key, value),
|
||||
CallInline: templ.SafeScriptInline(`__templ_setSessionStorage_0b44`, key, value),
|
||||
}
|
||||
}
|
||||
|
||||
func getSessionStorage(key string) templ.ComponentScript {
|
||||
return templ.ComponentScript{
|
||||
Name: `__templ_getSessionStorage_66b8`,
|
||||
Function: `function __templ_getSessionStorage_66b8(key){return sessionStorage.getItem(key)
|
||||
}`,
|
||||
Call: templ.SafeScript(`__templ_getSessionStorage_66b8`, key),
|
||||
CallInline: templ.SafeScriptInline(`__templ_getSessionStorage_66b8`, key),
|
||||
}
|
||||
}
|
||||
|
||||
func removeSessionStorage(key string) templ.ComponentScript {
|
||||
return templ.ComponentScript{
|
||||
Name: `__templ_removeSessionStorage_a2e3`,
|
||||
Function: `function __templ_removeSessionStorage_a2e3(key){sessionStorage.removeItem(key)
|
||||
}`,
|
||||
Call: templ.SafeScript(`__templ_removeSessionStorage_a2e3`, key),
|
||||
CallInline: templ.SafeScriptInline(`__templ_removeSessionStorage_a2e3`, key),
|
||||
}
|
||||
}
|
||||
|
||||
// Storage component that includes all storage-related scripts
|
||||
func StorageScripts() templ.Component {
|
||||
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
|
||||
return templ_7745c5c3_CtxErr
|
||||
}
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
defer func() {
|
||||
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err == nil {
|
||||
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
||||
}
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var1 == nil {
|
||||
templ_7745c5c3_Var1 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
templ_7745c5c3_Var2 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
defer func() {
|
||||
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err == nil {
|
||||
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
||||
}
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<script type=\"text/javascript\">\n // Storage helper functions\n function setLocalStorageItem(key, value) {\n localStorage.setItem(key, value);\n }\n\n function getLocalStorageItem(key) {\n return localStorage.getItem(key);\n }\n\n function removeLocalStorageItem(key) {\n localStorage.removeItem(key);\n }\n\n function setSessionStorageItem(key, value) {\n sessionStorage.setItem(key, value);\n }\n\n function getSessionStorageItem(key) {\n return sessionStorage.getItem(key);\n }\n\n function removeSessionStorageItem(key) {\n sessionStorage.removeItem(key);\n }\n </script>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
templ_7745c5c3_Err = storageHandle.Once().Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
// Public components for storage operations
|
||||
func SetLocalStorageItem(key string, value any) templ.Component {
|
||||
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
|
||||
return templ_7745c5c3_CtxErr
|
||||
}
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
defer func() {
|
||||
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err == nil {
|
||||
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
||||
}
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var3 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var3 == nil {
|
||||
templ_7745c5c3_Var3 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
templ_7745c5c3_Err = StorageScripts().Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<script>\n (() => {\n const value = { templ.JSONString(value) };\n setLocalStorageItem({ key }, JSON.stringify(value));\n })();\n </script>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
func SetSessionStorageItem(key string, value any) templ.Component {
|
||||
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
|
||||
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
|
||||
return templ_7745c5c3_CtxErr
|
||||
}
|
||||
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
|
||||
if !templ_7745c5c3_IsBuffer {
|
||||
defer func() {
|
||||
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err == nil {
|
||||
templ_7745c5c3_Err = templ_7745c5c3_BufErr
|
||||
}
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var4 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var4 == nil {
|
||||
templ_7745c5c3_Var4 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
templ_7745c5c3_Err = StorageScripts().Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<script>\n (() => {\n const value = { templ.JSONString(value) };\n setSessionStorageItem({ key }, JSON.stringify(value));\n })();\n </script>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
var _ = templruntime.GeneratedTemplate
|
||||
@@ -1,15 +0,0 @@
|
||||
package storage
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
)
|
||||
|
||||
// SetLocal sets a value in localStorage
|
||||
func SetLocal(c echo.Context, key string, value any) error {
|
||||
return SetLocalStorageItem(key, value).Render(c.Request().Context(), c.Response().Writer)
|
||||
}
|
||||
|
||||
// SetSession sets a value in sessionStorage
|
||||
func SetSession(c echo.Context, key string, value any) error {
|
||||
return SetSessionStorageItem(key, value).Render(c.Request().Context(), c.Response().Writer)
|
||||
}
|
||||
Reference in New Issue
Block a user