mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-02 17:31:39 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bb2972b527 | ||
|
|
45b474c9a6 | ||
|
|
99747c022e | ||
|
|
d9a2689469 | ||
|
|
08d8c7eda0 | ||
|
|
4dd23f1be8 | ||
|
|
0ebc988a68 | ||
|
|
9b8af84393 | ||
|
|
ff1ccd7c78 | ||
|
|
3176cc661a | ||
|
|
9ba387f2e4 | ||
|
|
c87dffd6da | ||
|
|
0cf69f5a59 | ||
|
|
babab1e09e | ||
|
|
6f5b079f51 | ||
|
|
9908669be0 | ||
|
|
c2f3e66405 | ||
|
|
b24c4668ed | ||
|
|
fcca387d9a | ||
|
|
97cc6a0d21 | ||
|
|
737565344d | ||
|
|
72f42afb81 | ||
|
|
0a2b91c9ac | ||
|
|
83b8fc597a | ||
|
|
0d4f2946f3 | ||
|
|
305efbea5d | ||
|
|
23f077ce75 | ||
|
|
d667c3c604 | ||
|
|
0502f52ec0 | ||
|
|
40f50bf37a | ||
|
|
0e0a46741f | ||
|
|
5b784659af | ||
|
|
e2f24eef8e | ||
|
|
aa43770bf4 | ||
|
|
45bc823de0 | ||
|
|
1250468f69 | ||
|
|
e94ce3b1cc | ||
|
|
ebb89facbd | ||
|
|
648b089c48 | ||
|
|
0befb6d431 | ||
|
|
35f2ad604c | ||
|
|
e139aee2b3 | ||
|
|
b57bea6f7b | ||
|
|
1828d2e710 | ||
|
|
04d929aae9 | ||
|
|
b51c36645e | ||
|
|
bd1ea5042e | ||
|
|
af4c66bc79 | ||
|
|
2d1f820451 | ||
|
|
179add9e12 | ||
|
|
9d3264256a | ||
|
|
fb234ed339 | ||
|
|
bb7724ece1 | ||
|
|
c67a7823a6 | ||
|
|
518109e9df | ||
|
|
e38a045de3 | ||
|
|
ba82d707d0 | ||
|
|
f366dd8cf2 | ||
|
|
dc6f02a000 | ||
|
|
b81bdebd64 | ||
|
|
6127d80f2a | ||
|
|
49c8a8c6d0 | ||
|
|
e2e0c35008 | ||
|
|
1de6eda49f | ||
|
|
000a0893c3 | ||
|
|
0a68ab682d | ||
|
|
54e51768c0 | ||
|
|
4eb294d856 | ||
|
|
e3b8f2cffe | ||
|
|
c158904efc | ||
|
|
f250082fff | ||
|
|
67432d3fdf | ||
|
|
0ff4299061 | ||
|
|
8ceb89053f | ||
|
|
6fbcb7cef5 | ||
|
|
f8d362352d | ||
|
|
ce3d073abd | ||
|
|
0e8b92e53d | ||
|
|
27d4dfcdfd | ||
|
|
38096db2dd | ||
|
|
bbb093b171 | ||
|
|
98bdf92d70 | ||
|
|
e572d7a626 | ||
|
|
aff4e3523c | ||
|
|
9972c5e40a | ||
|
|
2915ba2933 | ||
|
|
3d9264dae4 | ||
|
|
d030dbcfde | ||
|
|
60cede383a | ||
|
|
7ef06e8d05 | ||
|
|
e8475dbd8d | ||
|
|
3353d9f622 | ||
|
|
893631eb4c | ||
|
|
2286708d56 | ||
|
|
553cff37a1 | ||
|
|
7806c07381 | ||
|
|
b7a40ac3d7 | ||
|
|
5280209075 | ||
|
|
e0ebe92361 | ||
|
|
5c3966a9d6 | ||
|
|
38ca7b246b | ||
|
|
d9f2b21812 | ||
|
|
fb9f41248f | ||
|
|
4087fdd79e | ||
|
|
6bb2c2143e | ||
|
|
dae01698ef | ||
|
|
b65e844824 | ||
|
|
c64c506c52 | ||
|
|
889186ec3e | ||
|
|
9b3c89785e | ||
|
|
cfce4ba460 | ||
|
|
3cb72d89e9 | ||
|
|
cb6fb10c3c | ||
|
|
0c5f052f86 | ||
|
|
c36dc537ef | ||
|
|
4af64c8524 | ||
|
|
767e91f720 | ||
|
|
38447af730 | ||
|
|
94fb4dceac | ||
|
|
cbb98481c8 | ||
|
|
538806678d |
@@ -2,6 +2,7 @@
|
||||
name = "cz_conventional_commits"
|
||||
tag_format = "v$version"
|
||||
version_scheme = "semver"
|
||||
version = "0.5.19"
|
||||
version = "0.5.23"
|
||||
update_changelog_on_bump = true
|
||||
major_version_zero = true
|
||||
changelog_file = "./docs/docs/changelog/index.md"
|
||||
|
||||
@@ -1,29 +1,5 @@
|
||||
# User Controlled Authorization Network (UCAN) Specification
|
||||
|
||||
## Version 1.0.0-rc.1
|
||||
|
||||
## Editors
|
||||
|
||||
- [Brooklyn Zelenka], [Witchcraft Software]
|
||||
|
||||
## Authors
|
||||
|
||||
- [Irakli Gozalishvili], [Protocol Labs]
|
||||
- [Daniel Holmgren], [Bluesky]
|
||||
- [Philipp Krüger], [number zero]
|
||||
- [Brooklyn Zelenka], [Witchcraft Software]
|
||||
|
||||
## Sub-Specifications
|
||||
|
||||
- [UCAN Delegation][delegation]
|
||||
- [UCAN Invocation][invocation]
|
||||
- [UCAN Promise][promise]
|
||||
- [UCAN Revocation][revocation]
|
||||
|
||||
## Language
|
||||
|
||||
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [BCP 14] when, and only when, they appear in all capitals, as shown here.
|
||||
|
||||
# Abstract
|
||||
|
||||
User-Controlled Authorization Network (UCAN) is a [trustless], secure, [local-first], user-originated, distributed authorization scheme. This document provides a high level overview of the components of the system, concepts, and motivation. Exact formats are given in [sub-specifications].
|
||||
|
||||
@@ -0,0 +1,427 @@
|
||||
[
|
||||
{
|
||||
"name": "app/cosmos-sdk",
|
||||
"path": "app",
|
||||
"docs": [
|
||||
{
|
||||
"keywords": [
|
||||
"module",
|
||||
"cosmos"
|
||||
],
|
||||
"url": "https://docs.cosmos.network/v0.50/build/building-modules/module-manager"
|
||||
},
|
||||
{
|
||||
"keywords": [
|
||||
"protobuf",
|
||||
"cosmos"
|
||||
],
|
||||
"url": "https://docs.cosmos.network/v0.50/build/building-modules/messages-and-queries"
|
||||
},
|
||||
{
|
||||
"keywords": [
|
||||
"rpc",
|
||||
"protobuf",
|
||||
"service",
|
||||
"cosmos"
|
||||
],
|
||||
"url": "https://docs.cosmos.network/v0.50/build/building-modules/msg-services"
|
||||
},
|
||||
{
|
||||
"keywords": [
|
||||
"protobuf",
|
||||
"rpc",
|
||||
"cosmos",
|
||||
"query"
|
||||
],
|
||||
"url": "https://docs.cosmos.network/v0.50/build/building-modules/query-services"
|
||||
},
|
||||
{
|
||||
"keywords": [
|
||||
"cosmos",
|
||||
"depinject",
|
||||
"sdk"
|
||||
],
|
||||
"url": "https://docs.cosmos.network/v0.50/build/building-modules/depinject"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "app/ibc",
|
||||
"path": "app",
|
||||
"docs": [
|
||||
{
|
||||
"keywords": [
|
||||
"cosmos",
|
||||
"interchain",
|
||||
"accounts"
|
||||
],
|
||||
"url": "https://ibc.cosmos.network/v8/apps/interchain-accounts/overview/"
|
||||
},
|
||||
{
|
||||
"keywords": [],
|
||||
"url": "https://ibc.cosmos.network/v8/apps/transfer/overview/"
|
||||
},
|
||||
{
|
||||
"keywords": [],
|
||||
"url": "https://docs.osmosis.zone/osmosis-core/asset-info/"
|
||||
},
|
||||
{
|
||||
"keywords": [],
|
||||
"url": "https://docs.osmosis.zone/osmosis-core/modules/tokenfactory"
|
||||
},
|
||||
{
|
||||
"keywords": [
|
||||
"usdc",
|
||||
"mint",
|
||||
"cosmos",
|
||||
"noble"
|
||||
],
|
||||
"url": "https://docs.noble.xyz/cctp/mint"
|
||||
},
|
||||
{
|
||||
"keywords": [
|
||||
"usdc"
|
||||
],
|
||||
"url": "https://docs.noble.xyz/cctp/mint_forward"
|
||||
},
|
||||
{
|
||||
"keywords": [],
|
||||
"url": "https://docs.evmos.org/protocol/modules/erc20"
|
||||
},
|
||||
{
|
||||
"keywords": [],
|
||||
"url": "https://docs.nomic.io/nbtc"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "crypto/mpc",
|
||||
"path": "crypto/mpc",
|
||||
"docs": [
|
||||
{
|
||||
"keywords": [
|
||||
"mpc",
|
||||
"wallet",
|
||||
"security",
|
||||
"advanced cryptography"
|
||||
],
|
||||
"url": "https://csrc.nist.gov/CSRC/media/Events/NTCW19/papers/paper-DKLS.pdf"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "crypto/ucan",
|
||||
"path": "crypto/ucan",
|
||||
"docs": [
|
||||
{
|
||||
"keywords": [],
|
||||
"url": "https://raw.githubusercontent.com/ucan-wg/spec/refs/heads/main/README.md"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "crypto/zkp",
|
||||
"path": "crypto/accumulator",
|
||||
"docs": [
|
||||
{
|
||||
"keywords": [],
|
||||
"url": "https://eprint.iacr.org/2021/1672.pdf"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "gateway/handlers",
|
||||
"path": "pkg/gateway/handlers",
|
||||
"docs": [
|
||||
{
|
||||
"keywords": [],
|
||||
"url": "https://echo.labstack.com/docs/cookbook/sse"
|
||||
},
|
||||
{
|
||||
"keywords": [],
|
||||
"url": "https://echo.labstack.com/docs/cookbook/websocket"
|
||||
},
|
||||
{
|
||||
"keywords": [],
|
||||
"url": "https://echo.labstack.com/docs/cookbook/subdomain"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "gateway/database",
|
||||
"path": "pkg/gateway/internal/database",
|
||||
"docs": [
|
||||
{
|
||||
"keywords": [],
|
||||
"url": "https://docs.tigerbeetle.com/coding/data-modeling"
|
||||
},
|
||||
{
|
||||
"keywords": [],
|
||||
"url": "https://docs.tigerbeetle.com/coding/two-phase-transfers"
|
||||
},
|
||||
{
|
||||
"keywords": [],
|
||||
"url": "https://docs.tigerbeetle.com/coding/reliable-transaction-submission"
|
||||
},
|
||||
{
|
||||
"keywords": [
|
||||
"currency"
|
||||
],
|
||||
"url": "https://docs.tigerbeetle.com/coding/recipes/currency-exchange"
|
||||
},
|
||||
{
|
||||
"keywords": [
|
||||
"balance"
|
||||
],
|
||||
"url": "https://docs.tigerbeetle.com/coding/recipes/balance-conditional-transfers"
|
||||
},
|
||||
{
|
||||
"keywords": [],
|
||||
"url": "https://docs.tigerbeetle.com/reference/account"
|
||||
},
|
||||
{
|
||||
"keywords": [],
|
||||
"url": "https://docs.tigerbeetle.com/reference/transfer"
|
||||
},
|
||||
{
|
||||
"keywords": [],
|
||||
"url": "https://docs.substreams.dev/documentation/consume/packages"
|
||||
},
|
||||
{
|
||||
"keywords": [],
|
||||
"url": "https://docs.substreams.dev/documentation/consume/sql/deployable-services/local-service"
|
||||
},
|
||||
{
|
||||
"keywords": [],
|
||||
"url": "https://docs.substreams.dev/tutorials/cosmos/injective/foundational"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "vault/handlers",
|
||||
"path": "pkg/vault/handlers",
|
||||
"docs": [
|
||||
{
|
||||
"keywords": [],
|
||||
"url": "https://echo.labstack.com/docs/cookbook/jwt"
|
||||
},
|
||||
{
|
||||
"keywords": [],
|
||||
"url": "https://echo.labstack.com/docs/middleware/secure"
|
||||
},
|
||||
{
|
||||
"keywords": [],
|
||||
"url": "https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "vault/database",
|
||||
"path": "pkg/vault/internal/database",
|
||||
"docs": [
|
||||
"https://dexie.org/docs/ExportImport/dexie-export-import",
|
||||
"https://dexie.org/docs/API-Reference#quick-reference",
|
||||
"https://templ.guide/syntax-and-usage/script-templates"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "pkl/ipfs",
|
||||
"path": "pkl/ipfs.net",
|
||||
"docs": [
|
||||
{
|
||||
"keywords": [],
|
||||
"url": "https://github.com/ipfs/kubo/blob/master/docs/config.md"
|
||||
},
|
||||
{
|
||||
"keywords": [],
|
||||
"url": "https://pkl-lang.org/main/current/language-reference/index.html"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "pkl/matrix",
|
||||
"path": "pkl/matrix.net",
|
||||
"docs": [
|
||||
{
|
||||
"keywords": [],
|
||||
"url": "https://element-hq.github.io/synapse/latest/usage/configuration/config_documentation.html"
|
||||
},
|
||||
{
|
||||
"keywords": [],
|
||||
"url": "https://pkl-lang.org/main/current/language-reference/index.html"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "pkl/chain",
|
||||
"path": "pkl/sonr.chain",
|
||||
"docs": [
|
||||
"https://tutorials.cosmos.network/tutorials/9-path-to-prod/5-network.html",
|
||||
"https://tutorials.cosmos.network/tutorials/9-path-to-prod/4-genesis.html",
|
||||
"https://pkl-lang.org/main/current/language-reference/index.html",
|
||||
"https://docs.cosmos.network/v0.50/user/run-node/run-testnet"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "pkl/hway",
|
||||
"path": "pkl/sonr.hway",
|
||||
"docs": [
|
||||
{
|
||||
"keywords": [],
|
||||
"url": "https://pkl-lang.org/main/current/language-reference/index.html"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "pkl/motr",
|
||||
"path": "pkl/sonr.motr",
|
||||
"docs": [
|
||||
{
|
||||
"keywords": [],
|
||||
"url": "https://pkl-lang.org/main/current/language-reference/index.html"
|
||||
},
|
||||
{
|
||||
"keywords": [],
|
||||
"url": "https://web.dev/learn/pwa/service-workers/"
|
||||
},
|
||||
{
|
||||
"keywords": [],
|
||||
"url": "https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "x/did",
|
||||
"path": "proto/did",
|
||||
"docs": [
|
||||
{
|
||||
"keywords": [],
|
||||
"url": "https://docs.cosmos.network/v0.50/build/packages/orm"
|
||||
},
|
||||
{
|
||||
"keywords": [],
|
||||
"url": "https://docs.cosmos.network/v0.50/build/building-modules/protobuf-annotations"
|
||||
},
|
||||
{
|
||||
"keywords": [],
|
||||
"url": "https://docs.cosmos.network/v0.50/build/modules/auth"
|
||||
},
|
||||
{
|
||||
"keywords": [],
|
||||
"url": "https://docs.cosmos.network/v0.50/build/packages/collections"
|
||||
},
|
||||
{
|
||||
"keywords": [],
|
||||
"url": "https://docs.cosmos.network/v0.50/build/modules/bank"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "x/dwn",
|
||||
"path": "proto/dwn",
|
||||
"docs": [
|
||||
{
|
||||
"keywords": [],
|
||||
"url": "https://docs.cosmos.network/v0.50/build/building-modules/protobuf-annotations"
|
||||
},
|
||||
{
|
||||
"keywords": [],
|
||||
"url": "https://docs.cosmos.network/v0.50/build/packages/orm"
|
||||
},
|
||||
{
|
||||
"keywords": [],
|
||||
"url": "https://docs.cosmos.network/v0.50/build/modules/authz"
|
||||
},
|
||||
{
|
||||
"keywords": [],
|
||||
"url": "https://docs.cosmos.network/v0.50/build/packages/collections"
|
||||
},
|
||||
{
|
||||
"keywords": [],
|
||||
"url": "https://docs.cosmos.network/v0.50/build/modules/gov"
|
||||
},
|
||||
{
|
||||
"keywords": [],
|
||||
"url": "https://docs.cosmos.network/v0.50/build/modules/staking"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "x/svc",
|
||||
"path": "proto/svc",
|
||||
"docs": [
|
||||
{
|
||||
"keywords": [],
|
||||
"url": "https://docs.cosmos.network/v0.50/build/packages/collections"
|
||||
},
|
||||
{
|
||||
"keywords": [],
|
||||
"url": "https://docs.cosmos.network/v0.50/build/building-modules/protobuf-annotations"
|
||||
},
|
||||
{
|
||||
"keywords": [],
|
||||
"url": "https://docs.cosmos.network/v0.50/build/packages/orm"
|
||||
},
|
||||
{
|
||||
"keywords": [],
|
||||
"url": "https://docs.cosmos.network/v0.50/build/modules/group"
|
||||
},
|
||||
{
|
||||
"keywords": [],
|
||||
"url": "https://docs.cosmos.network/v0.50/build/modules/nft"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "repo/ci-cd",
|
||||
"path": "deploy",
|
||||
"docs": [
|
||||
{
|
||||
"keywords": [],
|
||||
"url": "https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions"
|
||||
},
|
||||
{
|
||||
"keywords": [],
|
||||
"url": "https://docs.cosmos.network/v0.50/build/tooling/cosmovisor"
|
||||
},
|
||||
{
|
||||
"keywords": [],
|
||||
"url": "https://f1bonacc1.github.io/process-compose/configuration/"
|
||||
},
|
||||
{
|
||||
"keywords": [],
|
||||
"url": "https://docs.nomic.io/network/ibc-relayer"
|
||||
},
|
||||
{
|
||||
"keywords": [],
|
||||
"url": "https://www.jetify.com/docs/devbox"
|
||||
},
|
||||
{
|
||||
"keywords": [],
|
||||
"url": "https://taskfile.dev/reference/cli"
|
||||
},
|
||||
{
|
||||
"keywords": [],
|
||||
"url": "https://taskfile.dev/reference/schema"
|
||||
},
|
||||
{
|
||||
"keywords": [],
|
||||
"url": "https://taskfile.dev/reference/templating/"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "repo/docs",
|
||||
"path": "docs",
|
||||
"docs": [
|
||||
{
|
||||
"keywords": [],
|
||||
"url": "https://squidfunk.github.io/mkdocs-material/reference/"
|
||||
},
|
||||
{
|
||||
"keywords": [],
|
||||
"url": "https://github.com/mkdocs/catalog/blob/main/README.md"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -1,7 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
ROOT_DIR=$(git rev-parse --show-toplevel)
|
||||
|
||||
|
||||
Executable
+63
@@ -0,0 +1,63 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
ROOT_DIR=$(git rev-parse --show-toplevel)
|
||||
|
||||
# Extract scope name and path using jq, and pass it to fzf for selection
|
||||
SCOPE=$(cat "$ROOT_DIR/.github/scopes.json" | jq -r '.[] | "\(.name)"' | fzf --prompt "Select scope:")
|
||||
DOCS=$(cat "$ROOT_DIR/.github/scopes.json" | jq -r ".[] | select(.name == \"$SCOPE\") | .docs[].url")
|
||||
|
||||
# Write Title
|
||||
TITLE=$(gum input --placeholder "Issue Title...")
|
||||
|
||||
# Write Goal
|
||||
GOAL=$(mods --role "determine-issue-goal" "$SCOPE $TITLE")
|
||||
|
||||
# Input Requirements
|
||||
REQUIREMENTS=()
|
||||
while true; do
|
||||
if [ ${#REQUIREMENTS[@]} -ge 2 ]; then
|
||||
if ! gum confirm "Do you want to add another requirement?"; then
|
||||
break
|
||||
fi
|
||||
fi
|
||||
REQUIREMENT=$(gum input --placeholder "Add a requirement...")
|
||||
if [ -n "$REQUIREMENT" ]; then
|
||||
REQUIREMENTS+=("$REQUIREMENT")
|
||||
else
|
||||
echo "Requirement cannot be empty. Please enter a valid requirement."
|
||||
fi
|
||||
done
|
||||
|
||||
create_body() {
|
||||
echo "### Goal(s):"
|
||||
echo "$GOAL"
|
||||
echo "### Requirements:"
|
||||
for i in "${!REQUIREMENTS[@]}"; do
|
||||
echo "$(($i + 1)). ${REQUIREMENTS[$i]}"
|
||||
done
|
||||
echo "### Resources:"
|
||||
while IFS= read -r doc; do
|
||||
echo "- $doc"
|
||||
done <<< "$DOCS"
|
||||
}
|
||||
|
||||
ISSUE_BODY=$(create_body)
|
||||
|
||||
# Function to collect output
|
||||
preview_output() {
|
||||
echo "# ($SCOPE) $TITLE"
|
||||
echo "$ISSUE_BODY"
|
||||
}
|
||||
|
||||
# Display the formatted output
|
||||
preview_output | gum format
|
||||
|
||||
# Confirm to create a GitHub issue
|
||||
if gum confirm "Do you want to create a new GitHub issue with this information?"; then
|
||||
# Create a new GitHub issue using the gh CLI
|
||||
gh issue create --repo onsonr/sonr --title "($SCOPE) $TITLE" --body "$ISSUE_BODY"
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
@@ -0,0 +1,34 @@
|
||||
name: Deploy Networks
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
branches:
|
||||
- develop
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
issues: write
|
||||
|
||||
jobs:
|
||||
reboot-devnet:
|
||||
name: Devnet Deploy
|
||||
runs-on: goliath
|
||||
environment: "Devnet"
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
branch: develop
|
||||
|
||||
- name: Stop Existing Network
|
||||
continue-on-error: true
|
||||
run: |
|
||||
make stop-uds
|
||||
make clean
|
||||
|
||||
- name: Start Updated Network
|
||||
run: |
|
||||
make start-uds
|
||||
@@ -0,0 +1,33 @@
|
||||
name: Publish Docs via GitHub Pages
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
- develop
|
||||
paths:
|
||||
- "docs/**"
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Configure Git Credentials
|
||||
run: |
|
||||
git config user.name github-actions[bot]
|
||||
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: 3.x
|
||||
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
key: mkdocs-material-${{ env.cache_id }}
|
||||
path: .cache
|
||||
restore-keys: |
|
||||
mkdocs-material-
|
||||
- run: pip install mkdocs-material
|
||||
- run: cd docs && mkdocs gh-deploy --force
|
||||
@@ -1,4 +1,4 @@
|
||||
name: Upload Public Assets
|
||||
name: Publish Versioned Assets
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
@@ -23,74 +23,3 @@ jobs:
|
||||
with:
|
||||
input: proto
|
||||
buf_token: ${{ secrets.BUF_TOKEN }}
|
||||
|
||||
buf_push_thirdparty:
|
||||
name: Publish to buf.build/onsonr/thirdparty
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
# Run `git checkout`
|
||||
- uses: actions/checkout@v3
|
||||
# Install the `buf` CLI
|
||||
- uses: bufbuild/buf-setup-action@v1
|
||||
# Push only the Input in `proto` to the BSR
|
||||
- uses: bufbuild/buf-push-action@v1
|
||||
continue-on-error: true
|
||||
with:
|
||||
input: third_party/proto
|
||||
buf_token: ${{ secrets.BUF_TOKEN }}
|
||||
|
||||
upload_motr_dwn:
|
||||
runs-on: ubuntu-latest
|
||||
name: Publish to configs.sonr.id
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: "1.23"
|
||||
check-latest: true
|
||||
|
||||
- name: Setup go-task / task / taskfile
|
||||
uses: rnorton5432/setup-task@v1
|
||||
|
||||
- name: Build DWN WASM
|
||||
run: task dwn:build
|
||||
|
||||
- name: Upload WASM to R2
|
||||
continue-on-error: true
|
||||
uses: ryand56/r2-upload-action@latest
|
||||
with:
|
||||
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
|
||||
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
|
||||
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
|
||||
r2-bucket: nebula
|
||||
source-dir: ./build/app.wasm
|
||||
destination-dir: wasm
|
||||
|
||||
- name: Upload SW JS to R2
|
||||
continue-on-error: true
|
||||
uses: ryand56/r2-upload-action@latest
|
||||
with:
|
||||
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
|
||||
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
|
||||
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
|
||||
r2-bucket: nebula
|
||||
source-dir: ./pkg/motr/static/sw.js
|
||||
destination-dir: js
|
||||
|
||||
upload_nebula_cdn:
|
||||
runs-on: ubuntu-latest
|
||||
name: Publish to cdn.sonr.id
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Upload to R2
|
||||
uses: ryand56/r2-upload-action@latest
|
||||
with:
|
||||
r2-account-id: ${{ secrets.R2_ACCOUNT_ID }}
|
||||
r2-access-key-id: ${{ secrets.R2_ACCESS_KEY_ID }}
|
||||
r2-secret-access-key: ${{ secrets.R2_SECRET_ACCESS_KEY }}
|
||||
r2-bucket: nebula
|
||||
source-dir: pkg/nebula/assets
|
||||
destination-dir: .
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
name: Run Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- feature/*
|
||||
pull_request:
|
||||
merge_group:
|
||||
|
||||
jobs:
|
||||
test-unit:
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
name: Scheduled Release
|
||||
name: Versioned Release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
tags:
|
||||
- v*
|
||||
- "v*"
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
goreleaser:
|
||||
name: Release motr, sonrd, and DWN
|
||||
name: Run GoReleaser
|
||||
permissions: write-all
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
@@ -22,6 +21,9 @@ jobs:
|
||||
fetch-depth: 0
|
||||
fetch-tags: true
|
||||
|
||||
- name: Checkout Latest Tag
|
||||
run: git checkout $(git describe --tags --abbrev=0)
|
||||
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: "1.23"
|
||||
@@ -46,3 +48,4 @@ jobs:
|
||||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
||||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
||||
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
|
||||
CLOUDSMITH_TOKEN: ${{ secrets.CLOUDSMITH_TOKEN }}
|
||||
|
||||
@@ -41,6 +41,7 @@ go.work.sum
|
||||
# Environment files
|
||||
.env
|
||||
**/*.env
|
||||
**/sonr.log
|
||||
|
||||
|
||||
# Terraform
|
||||
@@ -60,6 +61,10 @@ override.tf.json
|
||||
.terraformrc
|
||||
terraform.rc
|
||||
|
||||
Taskfile.yml
|
||||
|
||||
!deploy/**/Taskfile.yml
|
||||
|
||||
# Misc
|
||||
.DS_Store
|
||||
.tmp/
|
||||
|
||||
+143
-26
@@ -4,24 +4,161 @@ project_name: sonr
|
||||
|
||||
builds:
|
||||
- id: sonr
|
||||
goos: [linux, darwin]
|
||||
goarch: [amd64, arm64]
|
||||
main: ./cmd/sonrd
|
||||
binary: sonrd
|
||||
builder: go
|
||||
gobinary: go
|
||||
command: build
|
||||
mod_timestamp: "{{ .CommitTimestamp }}"
|
||||
goos:
|
||||
- linux
|
||||
- darwin
|
||||
goarch:
|
||||
- amd64
|
||||
- arm64
|
||||
goamd64:
|
||||
- v1
|
||||
flags:
|
||||
- -mod=readonly
|
||||
- -trimpath
|
||||
ldflags:
|
||||
- -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}
|
||||
- -X github.com/cosmos/cosmos-sdk/version.Name=sonr
|
||||
- -X github.com/cosmos/cosmos-sdk/version.AppName=sonrd
|
||||
- -X github.com/cosmos/cosmos-sdk/version.Version={{.Version}}
|
||||
- -X github.com/cosmos/cosmos-sdk/version.Commit={{.Commit}}
|
||||
- -X "github.com/cosmos/cosmos-sdk/version.BuildTags=netgo,ledger"
|
||||
tags:
|
||||
- netgo
|
||||
- ledger
|
||||
|
||||
- id: hway
|
||||
main: ./cmd/hway
|
||||
binary: hway
|
||||
builder: go
|
||||
gobinary: go
|
||||
goos:
|
||||
- linux
|
||||
- darwin
|
||||
goarch:
|
||||
- amd64
|
||||
- arm64
|
||||
mod_timestamp: "{{ .CommitTimestamp }}"
|
||||
flags:
|
||||
- -mod=readonly
|
||||
- -trimpath
|
||||
goamd64:
|
||||
- v1
|
||||
tags:
|
||||
- netgo
|
||||
ldflags:
|
||||
- -X main.version={{.Version}}
|
||||
- -X main.commit={{.Commit}}
|
||||
- -X main.date={{.Date}}
|
||||
archives:
|
||||
- id: sonr
|
||||
builds: [sonr]
|
||||
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ with .Arm }}v{{ . }}{{ end }}{{ with .Mips }}_{{ . }}{{ end }}{{ if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }}'
|
||||
name_template: >-
|
||||
sonr_{{ .Version }}_
|
||||
{{- title .Os }}_{{- if eq .Arch "amd64" }}x86_64
|
||||
{{- else if eq .Arch "386" }}i386
|
||||
{{- else }}{{ .Arch }}{{ end }}
|
||||
format: tar.gz
|
||||
files:
|
||||
- src: README*
|
||||
- src: CHANGELOG*
|
||||
wrap_in_directory: true
|
||||
|
||||
- id: hway
|
||||
builds: [hway]
|
||||
name_template: >-
|
||||
hway_{{ .Version }}_
|
||||
{{- title .Os }}_{{- if eq .Arch "amd64" }}x86_64
|
||||
{{- else if eq .Arch "386" }}i386
|
||||
{{- else }}{{ .Arch }}{{ end }}
|
||||
format: tar.gz
|
||||
files:
|
||||
- src: README*
|
||||
wrap_in_directory: true
|
||||
|
||||
nfpms:
|
||||
- id: hway
|
||||
package_name: hway
|
||||
file_name_template: "{{ .ConventionalFileName }}"
|
||||
builds: [hway]
|
||||
vendor: Sonr
|
||||
homepage: "https://onsonr.dev"
|
||||
maintainer: "Sonr <support@onsonr.dev>"
|
||||
description: "Sonr Highway is a decentralized, permissionless, and censorship-resistant identity network proxy."
|
||||
license: "Apache 2.0"
|
||||
formats:
|
||||
- rpm
|
||||
- deb
|
||||
- apk
|
||||
dependencies:
|
||||
- ipfs
|
||||
contents:
|
||||
- src: README*
|
||||
dst: /usr/share/doc/hway
|
||||
bindir: /usr/bin
|
||||
section: net
|
||||
priority: optional
|
||||
# Add these lines to match build config
|
||||
|
||||
- id: sonr
|
||||
package_name: sonrd
|
||||
file_name_template: "{{ .ConventionalFileName }}"
|
||||
builds: [sonr]
|
||||
vendor: Sonr
|
||||
homepage: "https://onsonr.dev"
|
||||
maintainer: "Sonr <support@onsonr.dev>"
|
||||
description: "Sonr is a decentralized, permissionless, and censorship-resistant identity network."
|
||||
license: "Apache 2.0"
|
||||
formats:
|
||||
- rpm
|
||||
- deb
|
||||
- apk
|
||||
dependencies:
|
||||
- ipfs
|
||||
contents:
|
||||
- src: README*
|
||||
dst: /usr/share/doc/sonrd
|
||||
bindir: /usr/bin
|
||||
section: net
|
||||
priority: optional
|
||||
# Add these lines to match build config
|
||||
|
||||
brews:
|
||||
- name: hway
|
||||
ids: [hway]
|
||||
commit_author:
|
||||
name: goreleaserbot
|
||||
email: bot@goreleaser.com
|
||||
directory: Formula
|
||||
caveats: "Run a local hway node and access it with the hway proxy"
|
||||
homepage: "https://onsonr.dev"
|
||||
description: "Sonr is a decentralized, permissionless, and censorship-resistant identity network."
|
||||
dependencies:
|
||||
- name: ipfs
|
||||
repository:
|
||||
owner: onsonr
|
||||
name: homebrew-tap
|
||||
branch: master
|
||||
token: "{{ .Env.GITHUB_PERSONAL_AUTH_TOKEN }}"
|
||||
|
||||
- name: sonr
|
||||
ids: [sonr]
|
||||
commit_author:
|
||||
name: goreleaserbot
|
||||
email: bot@goreleaser.com
|
||||
directory: Formula
|
||||
caveats: "Run a local sonr node and access it with the hway proxy"
|
||||
homepage: "https://onsonr.dev"
|
||||
description: "Sonr is a decentralized, permissionless, and censorship-resistant identity network."
|
||||
dependencies:
|
||||
- name: ipfs
|
||||
repository:
|
||||
owner: onsonr
|
||||
name: homebrew-tap
|
||||
branch: master
|
||||
token: "{{ .Env.GITHUB_PERSONAL_AUTH_TOKEN }}"
|
||||
|
||||
release:
|
||||
github:
|
||||
@@ -32,27 +169,7 @@ release:
|
||||
replace_existing_draft: true
|
||||
replace_existing_artifacts: true
|
||||
extra_files:
|
||||
- glob: ./CHANGELOG*
|
||||
- glob: ./README*
|
||||
- glob: ./LICENSE*
|
||||
|
||||
brews:
|
||||
- name: sonr
|
||||
ids: [sonr]
|
||||
commit_author:
|
||||
name: goreleaserbot
|
||||
email: bot@goreleaser.com
|
||||
directory: Formula
|
||||
caveats: "Run a local sonr node and access it with the hway proxy"
|
||||
homepage: "https://sonr.io/"
|
||||
description: "Sonr is a decentralized, permissionless, and censorship-resistant identity network."
|
||||
dependencies:
|
||||
- name: ipfs
|
||||
repository:
|
||||
owner: onsonr
|
||||
name: homebrew-tap
|
||||
branch: master
|
||||
token: "{{ .Env.GITHUB_PERSONAL_AUTH_TOKEN }}"
|
||||
|
||||
announce:
|
||||
telegram:
|
||||
|
||||
@@ -8,9 +8,14 @@ SDK_PACK := $(shell go list -m github.com/cosmos/cosmos-sdk | sed 's/ /\@/g')
|
||||
BINDIR ?= $(GOPATH)/bin
|
||||
SIMAPP = ./app
|
||||
|
||||
PC_PORT_NUM=42069
|
||||
PC_LOG_FILE=./sonr.log
|
||||
PC_SOCKET_PATH=/tmp/sonr-net.sock
|
||||
|
||||
# for dockerized protobuf tools
|
||||
DOCKER := $(shell which docker)
|
||||
HTTPS_GIT := github.com/onsonr/sonr.git
|
||||
PROCESS_COMPOSE := $(shell which process-compose)
|
||||
|
||||
export GO111MODULE = on
|
||||
|
||||
@@ -115,13 +120,17 @@ clean:
|
||||
rm -rf .aider*
|
||||
rm -rf static
|
||||
rm -rf .out
|
||||
rm -rf build
|
||||
rm -rf hway.db
|
||||
rm -rf snapcraft-local.yaml build/
|
||||
rm -rf build
|
||||
|
||||
distclean: clean
|
||||
rm -rf vendor/
|
||||
|
||||
init-env:
|
||||
@echo "Installing process-compose"
|
||||
sh scripts/init_env.sh
|
||||
|
||||
########################################
|
||||
### Testing
|
||||
|
||||
@@ -298,51 +307,66 @@ sh-testnet: mod-tidy
|
||||
###############################################################################
|
||||
### generation ###
|
||||
###############################################################################
|
||||
.PHONY: pkl-gen tailwind-gen templ-gen
|
||||
.PHONY: gen-pkl gen-templ
|
||||
|
||||
pkl-gen:
|
||||
go install github.com/apple/pkl-go/cmd/pkl-gen-go@latest
|
||||
pkl-gen-go pkl/sonr.motr/ATN.pkl
|
||||
pkl-gen-go pkl/sonr.hway/Env.pkl
|
||||
pkl-gen-go pkl/sonr.motr/DWN.pkl
|
||||
pkl-gen-go pkl/sonr.hway/ORM.pkl
|
||||
gen-pkl: init-env
|
||||
pkl-gen-go pkl/sonr.orm/UCAN.pkl
|
||||
pkl-gen-go pkl/sonr.orm/Models.pkl
|
||||
pkl-gen-go pkl/sonr.conf/Hway.pkl
|
||||
pkl-gen-go pkl/sonr.conf/Motr.pkl
|
||||
|
||||
templ-gen:
|
||||
@go install github.com/a-h/templ/cmd/templ@latest
|
||||
gen-templ: init-env
|
||||
templ generate
|
||||
|
||||
|
||||
###############################################################################
|
||||
### custom builds ###
|
||||
###############################################################################
|
||||
.PHONY: motr-build hway-build hway-serve
|
||||
.PHONY: build-motr build-hway logs-hway logs-sonr
|
||||
|
||||
motr-build:
|
||||
build-motr:
|
||||
GOOS=js GOARCH=wasm go build -o static/wasm/app.wasm ./cmd/motr/main.go
|
||||
|
||||
hway-build: templ-gen
|
||||
go build -o build/hway ./cmd/hway/main.go
|
||||
build-hway: gen-templ
|
||||
go build -o build/hway ./cmd/hway
|
||||
|
||||
hway-serve: hway-build
|
||||
./build/hway
|
||||
logs-hway: init-env
|
||||
bin/process-compose process logs hway --port $(PC_PORT_NUM) --follow
|
||||
|
||||
logs-sonr: init-env
|
||||
bin/process-compose process logs sonr --port $(PC_PORT_NUM) --follow
|
||||
|
||||
###############################################################################
|
||||
### Network Start/Stop ###
|
||||
###############################################################################
|
||||
|
||||
.PHONY: deploy start start-tui start-uds stop stop-uds restart status
|
||||
|
||||
start: build-hway init-env
|
||||
bin/process-compose up --port $(PC_PORT_NUM) --log-file $(PC_LOG_FILE) --detached -f deploy/process-compose.yaml
|
||||
|
||||
start-tui: build-hway init-env
|
||||
bin/process-compose up --port $(PC_PORT_NUM) --log-file $(PC_LOG_FILE) -f deploy/process-compose.yaml
|
||||
|
||||
start-uds: build-hway init-env
|
||||
bin/process-compose up --use-uds --unix-socket $(PC_SOCKET_PATH) --log-file $(PC_LOG_FILE) --detached -f deploy/process-compose.yaml
|
||||
|
||||
stop: init-env
|
||||
bin/process-compose down --port $(PC_PORT_NUM)
|
||||
|
||||
stop-uds: init-env
|
||||
bin/process-compose down --use-uds --unix-socket $(PC_SOCKET_PATH)
|
||||
|
||||
status: init-env
|
||||
bin/process-compose project state --port $(PC_PORT_NUM)
|
||||
###############################################################################
|
||||
### help ###
|
||||
###############################################################################
|
||||
.PHONY: deploy-buf deploy-pkl
|
||||
|
||||
deploy-buf:
|
||||
deploy:
|
||||
cd ./proto && bunx buf dep update && bunx buf build && bunx buf push
|
||||
|
||||
deploy-pkl:
|
||||
sh ./.github/scripts/upload_cdn.sh
|
||||
|
||||
|
||||
###############################################################################
|
||||
### help ###
|
||||
###############################################################################
|
||||
|
||||
|
||||
help:
|
||||
@echo "Usage: make <target>"
|
||||
@echo ""
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
[](https://sonr.io)
|
||||
[](https://goreportcard.com/report/github.com/onsonr/sonr)
|
||||
[](https://sonarcloud.io/summary/new_code?id=sonr-io_sonr)
|
||||
[](https://cloudsmith.io/~sonr/repos/sonr/packages/detail/deb/sonrd/latest/a=amd64;xc=main;d=ubuntu%252Fxenial;t=binary/)
|
||||
|
||||
> Sonr is a combination of decentralized primitives. Fundamentally, it is a peer-to-peer identity and asset management system that leverages DID documents, Webauthn, and IPFS—providing users with a secure, portable decentralized identity.
|
||||
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/labstack/echo/v4/middleware"
|
||||
"github.com/onsonr/sonr/crypto/ucan"
|
||||
"github.com/onsonr/sonr/internal/gateway"
|
||||
"github.com/onsonr/sonr/pkg/common/ipfs"
|
||||
config "github.com/onsonr/sonr/pkg/config/hway"
|
||||
"github.com/onsonr/sonr/pkg/database/sessions"
|
||||
"github.com/onsonr/sonr/pkg/didauth/producer"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
// Command line flags
|
||||
var (
|
||||
servePort int // Gateway http entry point (default 3000)
|
||||
configDir string // Hway config directory (default hway)
|
||||
sqliteFile string // SQLite database file (default hway.db)
|
||||
chainID string // Current chain ID (default sonr-testnet-1)
|
||||
ipfsGatewayURL string // IPFS gateway URL (default localhost:8080)
|
||||
sonrAPIURL string // Sonr API URL (default localhost:1317)
|
||||
sonrGrpcURL string // Sonr gRPC URL (default localhost:9090)
|
||||
sonrRPCURL string // Sonr RPC URL (default localhost:26657)
|
||||
)
|
||||
|
||||
func rootCmd() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "hway",
|
||||
Short: "Sonr DID gateway",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
env, err := loadEnvImplFromArgs(args)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
e, err := setupServer(env)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if err := e.Start(fmt.Sprintf(":%d", env.GetServePort())); err != http.ErrServerClosed {
|
||||
log.Fatal(err)
|
||||
os.Exit(1)
|
||||
return
|
||||
}
|
||||
},
|
||||
}
|
||||
cmd.Flags().IntVar(&servePort, "serve-port", 3000, "Port to serve the gateway on")
|
||||
cmd.Flags().StringVar(&configDir, "config-dir", "hway", "Directory to store config files")
|
||||
cmd.Flags().StringVar(&sqliteFile, "sqlite-file", "hway.db", "File to store sqlite database")
|
||||
cmd.Flags().StringVar(&chainID, "chain-id", "sonr-testnet-1", "Chain ID")
|
||||
cmd.Flags().StringVar(&ipfsGatewayURL, "ipfs-gateway-url", "localhost:8080", "IPFS gateway URL")
|
||||
cmd.Flags().StringVar(&sonrAPIURL, "sonr-api-url", "localhost:1317", "Sonr API URL")
|
||||
cmd.Flags().StringVar(&sonrGrpcURL, "sonr-grpc-url", "localhost:9090", "Sonr gRPC URL")
|
||||
cmd.Flags().StringVar(&sonrRPCURL, "sonr-rpc-url", "localhost:26657", "Sonr RPC URL")
|
||||
return cmd
|
||||
}
|
||||
|
||||
func loadEnvImplFromArgs(args []string) (config.Hway, error) {
|
||||
cmd := rootCmd()
|
||||
if err := cmd.ParseFlags(args); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
env := &config.HwayImpl{
|
||||
ServePort: servePort,
|
||||
ConfigDir: configDir,
|
||||
SqliteFile: sqliteFile,
|
||||
ChainId: chainID,
|
||||
IpfsGatewayUrl: ipfsGatewayURL,
|
||||
SonrApiUrl: sonrAPIURL,
|
||||
SonrGrpcUrl: sonrGrpcURL,
|
||||
SonrRpcUrl: sonrRPCURL,
|
||||
}
|
||||
return env, nil
|
||||
}
|
||||
|
||||
// setupServer sets up the server
|
||||
func setupServer(env config.Hway) (*echo.Echo, error) {
|
||||
ipc, err := ipfs.NewClient()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
db, err := sessions.NewGormDB(env)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
e := echo.New()
|
||||
e.IPExtractor = echo.ExtractIPDirect()
|
||||
e.Use(middleware.Logger())
|
||||
e.Use(middleware.Recover())
|
||||
e.Use(producer.Middleware(ipc, ucan.ServicePermissions))
|
||||
gateway.RegisterRoutes(e, env, db)
|
||||
return e, nil
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
amends "https://pkl.sh/sonr.hway/0.0.3/Env.pkl"
|
||||
+4
-45
@@ -3,56 +3,15 @@ package main
|
||||
import (
|
||||
_ "embed"
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/labstack/echo/v4/middleware"
|
||||
"github.com/onsonr/sonr/crypto/ucan"
|
||||
"github.com/onsonr/sonr/pkg/common/ipfs"
|
||||
"github.com/onsonr/sonr/pkg/common/producer"
|
||||
"github.com/onsonr/sonr/pkg/gateway"
|
||||
"github.com/onsonr/sonr/pkg/gateway/config"
|
||||
)
|
||||
|
||||
//go:embed config.pkl
|
||||
var configBz []byte
|
||||
|
||||
func loadConfig() (config.Env, error) {
|
||||
return config.LoadFromBytes(configBz)
|
||||
}
|
||||
|
||||
// setupServer sets up the server
|
||||
func setupServer(env config.Env) (*echo.Echo, error) {
|
||||
ipc, err := ipfs.NewClient()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
e := echo.New()
|
||||
e.IPExtractor = echo.ExtractIPDirect()
|
||||
e.Use(middleware.Logger())
|
||||
e.Use(middleware.Recover())
|
||||
e.Use(producer.Middleware(ipc, ucan.ServicePermissions))
|
||||
gateway.RegisterRoutes(e, env)
|
||||
return e, nil
|
||||
}
|
||||
|
||||
// main is the entry point for the application
|
||||
func main() {
|
||||
env, err := loadConfig()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
e, err := setupServer(env)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
if err := e.Start(fmt.Sprintf(":%d", env.GetServePort())); err != http.ErrServerClosed {
|
||||
log.Fatal(err)
|
||||
cmd := rootCmd()
|
||||
if err := cmd.Execute(); err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
return
|
||||
}
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
+8
-8
@@ -8,15 +8,15 @@ import (
|
||||
"syscall/js"
|
||||
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/onsonr/sonr/cmd/motr/internal"
|
||||
"github.com/onsonr/sonr/pkg/common/controller"
|
||||
"github.com/onsonr/sonr/pkg/vault"
|
||||
"github.com/onsonr/sonr/pkg/vault/types"
|
||||
"github.com/onsonr/sonr/internal/vault"
|
||||
"github.com/onsonr/sonr/pkg/common/wasm"
|
||||
"github.com/onsonr/sonr/pkg/config/motr"
|
||||
"github.com/onsonr/sonr/pkg/didauth/controller"
|
||||
)
|
||||
|
||||
var (
|
||||
env *types.Environment
|
||||
config *types.Config
|
||||
env *motr.Environment
|
||||
config *motr.Config
|
||||
err error
|
||||
)
|
||||
|
||||
@@ -48,8 +48,8 @@ func main() {
|
||||
js.Global().Set("processConfig", js.FuncOf(processConfig))
|
||||
|
||||
e := echo.New()
|
||||
e.Use(internal.WasmContextMiddleware)
|
||||
e.Use(wasm.ContextMiddleware)
|
||||
e.Use(controller.Middleware(nil))
|
||||
vault.RegisterRoutes(e, config)
|
||||
internal.ServeFetch(e)
|
||||
wasm.ServeFetch(e)
|
||||
}
|
||||
|
||||
+6
-84
@@ -1,14 +1,9 @@
|
||||
package mpc
|
||||
|
||||
import (
|
||||
genericecdsa "crypto/ecdsa"
|
||||
"fmt"
|
||||
"math/big"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/types/bech32"
|
||||
"github.com/onsonr/sonr/crypto/core/curves"
|
||||
"github.com/onsonr/sonr/crypto/core/protocol"
|
||||
"golang.org/x/crypto/sha3"
|
||||
)
|
||||
|
||||
type (
|
||||
@@ -16,6 +11,7 @@ type (
|
||||
)
|
||||
|
||||
type Keyset interface {
|
||||
Address() string
|
||||
Val() *ValKeyshare
|
||||
ValJSON() string
|
||||
User() *UserKeyshare
|
||||
@@ -25,6 +21,11 @@ type Keyset interface {
|
||||
type keyset struct {
|
||||
val *ValKeyshare
|
||||
user *UserKeyshare
|
||||
addr string
|
||||
}
|
||||
|
||||
func (k keyset) Address() string {
|
||||
return k.addr
|
||||
}
|
||||
|
||||
func (k keyset) Val() *ValKeyshare {
|
||||
@@ -58,82 +59,3 @@ func ComputeSonrAddr(pk []byte) (string, error) {
|
||||
}
|
||||
return sonrAddr, nil
|
||||
}
|
||||
|
||||
// For DKG bob starts first. For refresh and sign, Alice starts first.
|
||||
func RunProtocol(firstParty protocol.Iterator, secondParty protocol.Iterator) (error, error) {
|
||||
var (
|
||||
message *protocol.Message
|
||||
aErr error
|
||||
bErr error
|
||||
)
|
||||
|
||||
for aErr != protocol.ErrProtocolFinished || bErr != protocol.ErrProtocolFinished {
|
||||
// Crank each protocol forward one iteration
|
||||
message, bErr = firstParty.Next(message)
|
||||
if bErr != nil && bErr != protocol.ErrProtocolFinished {
|
||||
return nil, bErr
|
||||
}
|
||||
|
||||
message, aErr = secondParty.Next(message)
|
||||
if aErr != nil && aErr != protocol.ErrProtocolFinished {
|
||||
return aErr, nil
|
||||
}
|
||||
}
|
||||
return aErr, bErr
|
||||
}
|
||||
|
||||
// ComputeEcPoint builds an elliptic curve point from a compressed byte slice
|
||||
func ComputeEcPoint(pubKey []byte) (*curves.EcPoint, error) {
|
||||
crv := curves.K256()
|
||||
x := new(big.Int).SetBytes(pubKey[1:33])
|
||||
y := new(big.Int).SetBytes(pubKey[33:])
|
||||
ecCurve, err := crv.ToEllipticCurve()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error converting curve: %v", err)
|
||||
}
|
||||
return &curves.EcPoint{X: x, Y: y, Curve: ecCurve}, nil
|
||||
}
|
||||
|
||||
func ComputeEcdsaPublicKey(pubKey []byte) (*genericecdsa.PublicKey, error) {
|
||||
pk, err := ComputeEcPoint(pubKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &genericecdsa.PublicKey{
|
||||
Curve: pk.Curve,
|
||||
X: pk.X,
|
||||
Y: pk.Y,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// VerifySignature verifies the signature of a message
|
||||
func VerifySignature(pk []byte, msg []byte, sig []byte) (bool, error) {
|
||||
pp, err := ComputeEcPoint(pk)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
sigEd, err := DeserializeSignature(sig)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
hash := sha3.New256()
|
||||
_, err = hash.Write(msg)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
digest := hash.Sum(nil)
|
||||
return curves.VerifyEcdsa(pp, digest[:], sigEd), nil
|
||||
}
|
||||
|
||||
func checkIteratedErrors(aErr, bErr error) error {
|
||||
if aErr == protocol.ErrProtocolFinished && bErr == protocol.ErrProtocolFinished {
|
||||
return nil
|
||||
}
|
||||
if aErr != protocol.ErrProtocolFinished {
|
||||
return aErr
|
||||
}
|
||||
if bErr != protocol.ErrProtocolFinished {
|
||||
return bErr
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
+19
-15
@@ -4,23 +4,9 @@ import (
|
||||
"crypto/ecdsa"
|
||||
|
||||
"github.com/onsonr/sonr/crypto/core/protocol"
|
||||
"github.com/onsonr/sonr/crypto/tecdsa/dklsv1/dkg"
|
||||
)
|
||||
|
||||
// Keyshare represents the common interface for both validator and user keyshares
|
||||
type Keyshare interface {
|
||||
GetPayloads() map[string][]byte
|
||||
GetMetadata() map[string]string
|
||||
GetPublicKey() []byte
|
||||
GetProtocol() string
|
||||
GetRole() int32
|
||||
GetVersion() uint32
|
||||
ECDSAPublicKey() (*ecdsa.PublicKey, error)
|
||||
ExtractMessage() *protocol.Message
|
||||
RefreshFunc() (RefreshFunc, error)
|
||||
SignFunc(msg []byte) (SignFunc, error)
|
||||
Marshal() (string, error)
|
||||
}
|
||||
|
||||
// BaseKeyshare contains common fields and methods for both validator and user keyshares
|
||||
type BaseKeyshare struct {
|
||||
Message *protocol.Message `json:"message"`
|
||||
@@ -29,6 +15,24 @@ type BaseKeyshare struct {
|
||||
CompressedPubKey []byte `json:"compressed_public_key"`
|
||||
}
|
||||
|
||||
func initFromAlice(aliceOut *dkg.AliceOutput, originalMsg *protocol.Message) BaseKeyshare {
|
||||
return BaseKeyshare{
|
||||
Message: originalMsg,
|
||||
Role: 1,
|
||||
UncompressedPubKey: aliceOut.PublicKey.ToAffineUncompressed(),
|
||||
CompressedPubKey: aliceOut.PublicKey.ToAffineCompressed(),
|
||||
}
|
||||
}
|
||||
|
||||
func initFromBob(bobOut *dkg.BobOutput, originalMsg *protocol.Message) BaseKeyshare {
|
||||
return BaseKeyshare{
|
||||
Message: originalMsg,
|
||||
Role: 2,
|
||||
UncompressedPubKey: bobOut.PublicKey.ToAffineUncompressed(),
|
||||
CompressedPubKey: bobOut.PublicKey.ToAffineCompressed(),
|
||||
}
|
||||
}
|
||||
|
||||
func (b *BaseKeyshare) GetPayloads() map[string][]byte {
|
||||
return b.Message.Payloads
|
||||
}
|
||||
|
||||
+92
-2
@@ -2,12 +2,15 @@ package mpc
|
||||
|
||||
import (
|
||||
"crypto/ecdsa"
|
||||
genericecdsa "crypto/ecdsa"
|
||||
"errors"
|
||||
"fmt"
|
||||
"math/big"
|
||||
|
||||
"github.com/onsonr/sonr/crypto/core/curves"
|
||||
"github.com/onsonr/sonr/crypto/core/protocol"
|
||||
"github.com/onsonr/sonr/crypto/tecdsa/dklsv1"
|
||||
"golang.org/x/crypto/sha3"
|
||||
)
|
||||
|
||||
// NewKeyshareSource generates a new MPC keyshare
|
||||
@@ -35,7 +38,11 @@ func NewKeyset() (Keyset, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return keyset{val: valShare, user: userShare}, nil
|
||||
addr, err := computeSonrAddr(valShare.CompressedPublicKey())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return keyset{val: valShare, user: userShare, addr: addr}, nil
|
||||
}
|
||||
|
||||
// ExecuteSigning runs the MPC signing protocol
|
||||
@@ -73,7 +80,11 @@ func ExecuteRefresh(refreshFuncVal RefreshFunc, refreshFuncUser RefreshFunc) (Ke
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return keyset{val: valShare, user: userShare}, nil
|
||||
addr, err := computeSonrAddr(valShare.CompressedPublicKey())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return keyset{val: valShare, user: userShare, addr: addr}, nil
|
||||
}
|
||||
|
||||
// SerializeSecp256k1Signature serializes an ECDSA signature into a byte slice
|
||||
@@ -105,3 +116,82 @@ func DeserializeSignature(sigBytes []byte) (Signature, error) {
|
||||
func VerifyMPCSignature(sig Signature, msg []byte, publicKey *ecdsa.PublicKey) bool {
|
||||
return ecdsa.Verify(publicKey, msg, sig.R, sig.S)
|
||||
}
|
||||
|
||||
// For DKG bob starts first. For refresh and sign, Alice starts first.
|
||||
func RunProtocol(firstParty protocol.Iterator, secondParty protocol.Iterator) (error, error) {
|
||||
var (
|
||||
message *protocol.Message
|
||||
aErr error
|
||||
bErr error
|
||||
)
|
||||
|
||||
for aErr != protocol.ErrProtocolFinished || bErr != protocol.ErrProtocolFinished {
|
||||
// Crank each protocol forward one iteration
|
||||
message, bErr = firstParty.Next(message)
|
||||
if bErr != nil && bErr != protocol.ErrProtocolFinished {
|
||||
return nil, bErr
|
||||
}
|
||||
|
||||
message, aErr = secondParty.Next(message)
|
||||
if aErr != nil && aErr != protocol.ErrProtocolFinished {
|
||||
return aErr, nil
|
||||
}
|
||||
}
|
||||
return aErr, bErr
|
||||
}
|
||||
|
||||
// ComputeEcPoint builds an elliptic curve point from a compressed byte slice
|
||||
func ComputeEcPoint(pubKey []byte) (*curves.EcPoint, error) {
|
||||
crv := curves.K256()
|
||||
x := new(big.Int).SetBytes(pubKey[1:33])
|
||||
y := new(big.Int).SetBytes(pubKey[33:])
|
||||
ecCurve, err := crv.ToEllipticCurve()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error converting curve: %v", err)
|
||||
}
|
||||
return &curves.EcPoint{X: x, Y: y, Curve: ecCurve}, nil
|
||||
}
|
||||
|
||||
func ComputeEcdsaPublicKey(pubKey []byte) (*genericecdsa.PublicKey, error) {
|
||||
pk, err := ComputeEcPoint(pubKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &genericecdsa.PublicKey{
|
||||
Curve: pk.Curve,
|
||||
X: pk.X,
|
||||
Y: pk.Y,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// VerifySignature verifies the signature of a message
|
||||
func VerifySignature(pk []byte, msg []byte, sig []byte) (bool, error) {
|
||||
pp, err := ComputeEcPoint(pk)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
sigEd, err := DeserializeSignature(sig)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
hash := sha3.New256()
|
||||
_, err = hash.Write(msg)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
digest := hash.Sum(nil)
|
||||
return curves.VerifyEcdsa(pp, digest[:], sigEd), nil
|
||||
}
|
||||
|
||||
func checkIteratedErrors(aErr, bErr error) error {
|
||||
if aErr == protocol.ErrProtocolFinished && bErr == protocol.ErrProtocolFinished {
|
||||
return nil
|
||||
}
|
||||
if aErr != protocol.ErrProtocolFinished {
|
||||
return aErr
|
||||
}
|
||||
if bErr != protocol.ErrProtocolFinished {
|
||||
return bErr
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
+23
-22
@@ -3,6 +3,7 @@ package mpc
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/types/bech32"
|
||||
"github.com/onsonr/sonr/crypto/core/curves"
|
||||
"github.com/onsonr/sonr/crypto/core/protocol"
|
||||
"github.com/onsonr/sonr/crypto/tecdsa/dklsv1"
|
||||
@@ -47,7 +48,16 @@ type ValKeyshare struct {
|
||||
encoded string
|
||||
}
|
||||
|
||||
func computeSonrAddr(pk []byte) (string, error) {
|
||||
sonrAddr, err := bech32.ConvertAndEncode("idx", pk)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return sonrAddr, nil
|
||||
}
|
||||
|
||||
func NewValKeyshare(msg *protocol.Message) (*ValKeyshare, error) {
|
||||
vks := new(ValKeyshare)
|
||||
encoded, err := protocol.EncodeMessage(msg)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -56,15 +66,10 @@ func NewValKeyshare(msg *protocol.Message) (*ValKeyshare, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &ValKeyshare{
|
||||
BaseKeyshare: BaseKeyshare{
|
||||
Message: msg,
|
||||
Role: 1,
|
||||
UncompressedPubKey: valShare.PublicKey.ToAffineUncompressed(),
|
||||
CompressedPubKey: valShare.PublicKey.ToAffineCompressed(),
|
||||
},
|
||||
encoded: encoded,
|
||||
}, nil
|
||||
|
||||
vks.BaseKeyshare = initFromAlice(valShare, msg)
|
||||
vks.encoded = encoded
|
||||
return vks, nil
|
||||
}
|
||||
|
||||
func (v *ValKeyshare) RefreshFunc() (RefreshFunc, error) {
|
||||
@@ -83,12 +88,12 @@ func (v *ValKeyshare) String() string {
|
||||
|
||||
// PublicKey returns the uncompressed public key (65 bytes)
|
||||
func (v *ValKeyshare) PublicKey() []byte {
|
||||
return v.BaseKeyshare.UncompressedPubKey
|
||||
return v.UncompressedPubKey
|
||||
}
|
||||
|
||||
// CompressedPublicKey returns the compressed public key (33 bytes)
|
||||
func (v *ValKeyshare) CompressedPublicKey() []byte {
|
||||
return v.BaseKeyshare.CompressedPubKey
|
||||
return v.CompressedPubKey
|
||||
}
|
||||
|
||||
type UserKeyshare struct {
|
||||
@@ -97,6 +102,7 @@ type UserKeyshare struct {
|
||||
}
|
||||
|
||||
func NewUserKeyshare(msg *protocol.Message) (*UserKeyshare, error) {
|
||||
uks := new(UserKeyshare)
|
||||
encoded, err := protocol.EncodeMessage(msg)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -105,15 +111,10 @@ func NewUserKeyshare(msg *protocol.Message) (*UserKeyshare, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &UserKeyshare{
|
||||
BaseKeyshare: BaseKeyshare{
|
||||
Message: msg,
|
||||
Role: 2,
|
||||
UncompressedPubKey: out.PublicKey.ToAffineUncompressed(),
|
||||
CompressedPubKey: out.PublicKey.ToAffineCompressed(),
|
||||
},
|
||||
encoded: encoded,
|
||||
}, nil
|
||||
|
||||
uks.BaseKeyshare = initFromBob(out, msg)
|
||||
uks.encoded = encoded
|
||||
return uks, nil
|
||||
}
|
||||
|
||||
func (u *UserKeyshare) RefreshFunc() (RefreshFunc, error) {
|
||||
@@ -132,12 +133,12 @@ func (u *UserKeyshare) String() string {
|
||||
|
||||
// PublicKey returns the uncompressed public key (65 bytes)
|
||||
func (u *UserKeyshare) PublicKey() []byte {
|
||||
return u.BaseKeyshare.UncompressedPubKey
|
||||
return u.UncompressedPubKey
|
||||
}
|
||||
|
||||
// CompressedPublicKey returns the compressed public key (33 bytes)
|
||||
func (u *UserKeyshare) CompressedPublicKey() []byte {
|
||||
return u.BaseKeyshare.CompressedPubKey
|
||||
return u.CompressedPubKey
|
||||
}
|
||||
|
||||
func encodeMessage(m *protocol.Message) (string, error) {
|
||||
|
||||
@@ -21,7 +21,7 @@ import (
|
||||
"github.com/onsonr/sonr/crypto/tecdsa/dklsv1/dkg"
|
||||
)
|
||||
|
||||
// GenerationAndDeal produces private key material for alice and bob which they can later use in signing.
|
||||
// GenerateAndDeal produces private key material for alice and bob which they can later use in signing.
|
||||
// Running actual DKG is ALWAYS recommended over using this function, as this function breaks the security guarantees of DKG.
|
||||
// only use this function if you have a very good reason to.
|
||||
func GenerateAndDeal(curve *curves.Curve) (*dkg.AliceOutput, *dkg.BobOutput, error) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Code generated from Pkl module `sonr.motr.ATN`. DO NOT EDIT.
|
||||
// Code generated from Pkl module `sonr.orm.UCAN`. DO NOT EDIT.
|
||||
package attns
|
||||
|
||||
import (
|
||||
@@ -7,11 +7,11 @@ import (
|
||||
"github.com/apple/pkl-go/pkl"
|
||||
)
|
||||
|
||||
type ATN struct {
|
||||
type UCAN struct {
|
||||
}
|
||||
|
||||
// LoadFromPath loads the pkl module at the given path and evaluates it into a ATN
|
||||
func LoadFromPath(ctx context.Context, path string) (ret *ATN, err error) {
|
||||
// LoadFromPath loads the pkl module at the given path and evaluates it into a UCAN
|
||||
func LoadFromPath(ctx context.Context, path string) (ret *UCAN, err error) {
|
||||
evaluator, err := pkl.NewEvaluator(ctx, pkl.PreconfiguredOptions)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -26,9 +26,9 @@ func LoadFromPath(ctx context.Context, path string) (ret *ATN, err error) {
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// Load loads the pkl module at the given source and evaluates it with the given evaluator into a ATN
|
||||
func Load(ctx context.Context, evaluator pkl.Evaluator, source *pkl.ModuleSource) (*ATN, error) {
|
||||
var ret ATN
|
||||
// Load loads the pkl module at the given source and evaluates it with the given evaluator into a UCAN
|
||||
func Load(ctx context.Context, evaluator pkl.Evaluator, source *pkl.ModuleSource) (*UCAN, error) {
|
||||
var ret UCAN
|
||||
if err := evaluator.EvaluateModule(ctx, source, &ret); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
// Code generated from Pkl module `sonr.motr.ATN`. DO NOT EDIT.
|
||||
// Code generated from Pkl module `sonr.orm.UCAN`. DO NOT EDIT.
|
||||
package capability
|
||||
|
||||
import (
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// Code generated from Pkl module `sonr.motr.ATN`. DO NOT EDIT.
|
||||
// Code generated from Pkl module `sonr.orm.UCAN`. DO NOT EDIT.
|
||||
package attns
|
||||
|
||||
import "github.com/apple/pkl-go/pkl"
|
||||
|
||||
func init() {
|
||||
pkl.RegisterMapping("sonr.motr.ATN", ATN{})
|
||||
pkl.RegisterMapping("sonr.orm.UCAN", UCAN{})
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Code generated from Pkl module `sonr.motr.ATN`. DO NOT EDIT.
|
||||
// Code generated from Pkl module `sonr.orm.UCAN`. DO NOT EDIT.
|
||||
package policytype
|
||||
|
||||
import (
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Code generated from Pkl module `sonr.motr.ATN`. DO NOT EDIT.
|
||||
// Code generated from Pkl module `sonr.orm.UCAN`. DO NOT EDIT.
|
||||
package resourcetype
|
||||
|
||||
import (
|
||||
|
||||
@@ -97,6 +97,7 @@ func (k ucanKeyshare) newToken(audienceDID string, prf []Proof, att Attenuations
|
||||
}, nil
|
||||
}
|
||||
|
||||
// ComputeIssuerDID computes the issuer DID from a public key
|
||||
func ComputeIssuerDID(pk []byte) (string, string, error) {
|
||||
addr, err := ComputeSonrAddr(pk)
|
||||
if err != nil {
|
||||
@@ -105,6 +106,7 @@ func ComputeIssuerDID(pk []byte) (string, string, error) {
|
||||
return fmt.Sprintf("did:sonr:%s", addr), addr, nil
|
||||
}
|
||||
|
||||
// ComputeSonrAddr computes the Sonr address from a public key
|
||||
func ComputeSonrAddr(pk []byte) (string, error) {
|
||||
sonrAddr, err := bech32.ConvertAndEncode("idx", pk)
|
||||
if err != nil {
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
# https://taskfile.dev
|
||||
|
||||
version: "3"
|
||||
|
||||
vars:
|
||||
GREETING: Hello, World!
|
||||
|
||||
tasks:
|
||||
init:sonrd:
|
||||
cmds:
|
||||
- sonrd init {{.NODE_NAME}} --chain-id {{.CHAIN_ID}} --home {{.HOME}}
|
||||
|
||||
init:ipfs:
|
||||
cmds:
|
||||
- ipfs init
|
||||
|
||||
init:hway:
|
||||
cmds:
|
||||
- sonrd hway init {{.NODE_NAME}} --home {{.HOME}}
|
||||
|
||||
start:sonrd:
|
||||
cmds:
|
||||
- sonrd start --home {{.HOME}}
|
||||
|
||||
start:ipfs:
|
||||
cmds:
|
||||
- ipfs daemon
|
||||
|
||||
start:hway:
|
||||
cmds:
|
||||
- sonrd hway start --home {{.HOME}}
|
||||
|
||||
stop:sonrd:
|
||||
cmds:
|
||||
- sonrd stop
|
||||
|
||||
stop:ipfs:
|
||||
cmds:
|
||||
- ipfs daemon stop
|
||||
|
||||
stop:hway:
|
||||
cmds:
|
||||
- sonrd hway stop
|
||||
|
||||
clean:sonrd:
|
||||
cmds:
|
||||
- rm -rf {{.HOME}}
|
||||
|
||||
clean:ipfs:
|
||||
cmds:
|
||||
- rm -rf ~/.ipfs
|
||||
|
||||
clean:hway:
|
||||
cmds:
|
||||
- rm -rf {{.HOME}}/data/hway
|
||||
@@ -1,251 +0,0 @@
|
||||
{
|
||||
"lockfile_version": "1",
|
||||
"packages": {
|
||||
"air@latest": {
|
||||
"last_modified": "2024-11-16T04:25:12Z",
|
||||
"resolved": "github:NixOS/nixpkgs/34a626458d686f1b58139620a8b2793e9e123bba#air",
|
||||
"source": "devbox-search",
|
||||
"version": "1.61.1",
|
||||
"systems": {
|
||||
"aarch64-darwin": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/0s90vbnmsyyixs0991md21pbrw8babfb-air-1.61.1",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/0s90vbnmsyyixs0991md21pbrw8babfb-air-1.61.1"
|
||||
},
|
||||
"aarch64-linux": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/8mpw2asxs297v26fxqy2y1bq438f344l-air-1.61.1",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/8mpw2asxs297v26fxqy2y1bq438f344l-air-1.61.1"
|
||||
},
|
||||
"x86_64-darwin": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/abminkf7ldqf9vm14xx5wvsrdx3wrvy6-air-1.61.1",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/abminkf7ldqf9vm14xx5wvsrdx3wrvy6-air-1.61.1"
|
||||
},
|
||||
"x86_64-linux": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/ajx8v5rbbvglncb97yybg3x9kn95gfrm-air-1.61.1",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/ajx8v5rbbvglncb97yybg3x9kn95gfrm-air-1.61.1"
|
||||
}
|
||||
}
|
||||
},
|
||||
"bun@latest": {
|
||||
"last_modified": "2024-11-18T00:41:09Z",
|
||||
"resolved": "github:NixOS/nixpkgs/5083ec887760adfe12af64830a66807423a859a7#bun",
|
||||
"source": "devbox-search",
|
||||
"version": "1.1.34",
|
||||
"systems": {
|
||||
"aarch64-darwin": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/xnj00gq1mfffvgyisghk4m9f38gc5c5c-bun-1.1.34",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/xnj00gq1mfffvgyisghk4m9f38gc5c5c-bun-1.1.34"
|
||||
},
|
||||
"aarch64-linux": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/kccpzv8fb7swmmxbhv805qzq242rhy33-bun-1.1.34",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/kccpzv8fb7swmmxbhv805qzq242rhy33-bun-1.1.34"
|
||||
},
|
||||
"x86_64-darwin": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/8h5k3l4fpgs3al2wvna7x9ybyyc8k36d-bun-1.1.34",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/8h5k3l4fpgs3al2wvna7x9ybyyc8k36d-bun-1.1.34"
|
||||
},
|
||||
"x86_64-linux": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/x089g4srqw71w5jnc87vxbh7m12498i0-bun-1.1.34",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/x089g4srqw71w5jnc87vxbh7m12498i0-bun-1.1.34"
|
||||
}
|
||||
}
|
||||
},
|
||||
"ipfs@latest": {
|
||||
"last_modified": "2023-02-24T09:01:09Z",
|
||||
"resolved": "github:NixOS/nixpkgs/7d0ed7f2e5aea07ab22ccb338d27fbe347ed2f11#ipfs",
|
||||
"source": "devbox-search",
|
||||
"version": "0.17.0"
|
||||
},
|
||||
"skate@latest": {
|
||||
"last_modified": "2024-11-16T04:25:12Z",
|
||||
"resolved": "github:NixOS/nixpkgs/34a626458d686f1b58139620a8b2793e9e123bba#skate",
|
||||
"source": "devbox-search",
|
||||
"version": "1.0.0",
|
||||
"systems": {
|
||||
"aarch64-darwin": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/q6yhpyfbqiabyic6ymx5rp2db62bnbvr-skate-1.0.0",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/q6yhpyfbqiabyic6ymx5rp2db62bnbvr-skate-1.0.0"
|
||||
},
|
||||
"aarch64-linux": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/q55dbgvc4xwvr2g02dks6j2j699qni2k-skate-1.0.0",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/q55dbgvc4xwvr2g02dks6j2j699qni2k-skate-1.0.0"
|
||||
},
|
||||
"x86_64-darwin": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/s1hy525y8ciya3nrns9kryy3jlcw8igv-skate-1.0.0",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/s1hy525y8ciya3nrns9kryy3jlcw8igv-skate-1.0.0"
|
||||
},
|
||||
"x86_64-linux": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/8s03iazymz77nv6pjxpz7wair0m646wv-skate-1.0.0",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/8s03iazymz77nv6pjxpz7wair0m646wv-skate-1.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"templ@latest": {
|
||||
"last_modified": "2024-11-16T04:25:12Z",
|
||||
"resolved": "github:NixOS/nixpkgs/34a626458d686f1b58139620a8b2793e9e123bba#templ",
|
||||
"source": "devbox-search",
|
||||
"version": "0.2.793",
|
||||
"systems": {
|
||||
"aarch64-darwin": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/ivargvf76g71k5gk3iz4al52rsy28w38-templ-0.2.793",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/ivargvf76g71k5gk3iz4al52rsy28w38-templ-0.2.793"
|
||||
},
|
||||
"aarch64-linux": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/03654iddn006yx5j1lqq496hax60v8p5-templ-0.2.793",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/03654iddn006yx5j1lqq496hax60v8p5-templ-0.2.793"
|
||||
},
|
||||
"x86_64-darwin": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/blvd5wbd1ix6m745s4zx3b84kwzprshq-templ-0.2.793",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/blvd5wbd1ix6m745s4zx3b84kwzprshq-templ-0.2.793"
|
||||
},
|
||||
"x86_64-linux": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/sn5h79d36r86i6a8rm1k52c2ij1s32kx-templ-0.2.793",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/sn5h79d36r86i6a8rm1k52c2ij1s32kx-templ-0.2.793"
|
||||
}
|
||||
}
|
||||
},
|
||||
"tigerbeetle@latest": {
|
||||
"last_modified": "2024-11-16T04:25:12Z",
|
||||
"resolved": "github:NixOS/nixpkgs/34a626458d686f1b58139620a8b2793e9e123bba#tigerbeetle",
|
||||
"source": "devbox-search",
|
||||
"version": "0.16.12",
|
||||
"systems": {
|
||||
"aarch64-darwin": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/mm3jzwf24p35afr55v7kl5a0h6962i6p-tigerbeetle-0.16.12",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/mm3jzwf24p35afr55v7kl5a0h6962i6p-tigerbeetle-0.16.12"
|
||||
},
|
||||
"aarch64-linux": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/4106973gg3crfxq0gwrgwn4hcx64mzyy-tigerbeetle-0.16.12",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/4106973gg3crfxq0gwrgwn4hcx64mzyy-tigerbeetle-0.16.12"
|
||||
},
|
||||
"x86_64-darwin": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/6lnwnr3mvdamm5lxjjqkaagw2pyqlq0a-tigerbeetle-0.16.12",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/6lnwnr3mvdamm5lxjjqkaagw2pyqlq0a-tigerbeetle-0.16.12"
|
||||
},
|
||||
"x86_64-linux": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/afrj2ph61xz0lh7f3d1g1d7v2rslbvny-tigerbeetle-0.16.12",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/afrj2ph61xz0lh7f3d1g1d7v2rslbvny-tigerbeetle-0.16.12"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,16 +3,10 @@ version: "0.6"
|
||||
processes:
|
||||
sonr:
|
||||
namespace: devnet
|
||||
background: true
|
||||
command: "make sh-testnet"
|
||||
restart: never
|
||||
max_restarts: 1
|
||||
|
||||
hway:
|
||||
namespace: devnet
|
||||
background: true
|
||||
command: "./build/hway"
|
||||
restart: never
|
||||
max_restarts: 1
|
||||
depends:
|
||||
- sonr
|
||||
@@ -1,202 +0,0 @@
|
||||
import "https://pkl.sh/ipfs.net/0.0.1/Config.pkl"
|
||||
|
||||
API {
|
||||
HTTPHeaders {
|
||||
`Access-Control-Allow-Origin` = new { "*" }
|
||||
}
|
||||
}
|
||||
|
||||
Addresses {
|
||||
API = "/ip4/127.0.0.1/tcp/5001"
|
||||
Gateway = "/ip4/127.0.0.1/tcp/8080"
|
||||
Swarm = new {
|
||||
"/ip4/0.0.0.0/tcp/4001"
|
||||
"/ip6/::/tcp/4001"
|
||||
"/ip4/0.0.0.0/udp/4001/quic"
|
||||
"/ip6/::/udp/4001/quic"
|
||||
}
|
||||
}
|
||||
|
||||
Bootstrap {
|
||||
"/dnsaddr/bootstrap.libp2p.io/p2p/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa"
|
||||
"/dnsaddr/bootstrap.libp2p.io/p2p/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb"
|
||||
"/dnsaddr/bootstrap.libp2p.io/p2p/QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt"
|
||||
"/ip4/104.131.131.82/tcp/4001/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ"
|
||||
"/ip4/104.131.131.82/udp/4001/quic/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ"
|
||||
"/dnsaddr/bootstrap.libp2p.io/p2p/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN"
|
||||
}
|
||||
|
||||
Datastore {
|
||||
BloomFilterSize = 0
|
||||
GCPeriod = "1h"
|
||||
HashOnRead = false
|
||||
StorageGCWatermark = 90
|
||||
StorageMax = "10GB"
|
||||
Spec = new {
|
||||
mounts = new {
|
||||
new {
|
||||
prefix = "flatfs.datastore"
|
||||
child = new {
|
||||
path = "blocks"
|
||||
shardFunc = "/repo/flatfs/shard/v1/next-to-last/2"
|
||||
type = "flatfs"
|
||||
sync = true
|
||||
}
|
||||
mountpoint = "/blocks"
|
||||
type = "measure"
|
||||
}
|
||||
new {
|
||||
prefix = "leveldb.datastore"
|
||||
child = new {
|
||||
compression = "none"
|
||||
path = "datastore"
|
||||
type = "levelds"
|
||||
}
|
||||
mountpoint = "/"
|
||||
type = "measure"
|
||||
}
|
||||
}
|
||||
type = "mount"
|
||||
}
|
||||
}
|
||||
|
||||
Discovery {
|
||||
MDNS = new {
|
||||
Enabled = true
|
||||
}
|
||||
}
|
||||
|
||||
Experimental {
|
||||
StrategicProviding = false
|
||||
UrlstoreEnabled = false
|
||||
AcceleratedDHTClient = false
|
||||
GraphsyncEnabled = false
|
||||
FilestoreEnabled = false
|
||||
Libp2pStreamMounting = false
|
||||
P2pHttpProxy = false
|
||||
}
|
||||
|
||||
Gateway {
|
||||
HTTPHeaders = new {
|
||||
`Access-Control-Allow-Headers` = new {
|
||||
"X-Requested-With"
|
||||
"Range"
|
||||
"User-Agent"
|
||||
}
|
||||
`Access-Control-Allow-Methods` = new { "GET" }
|
||||
`Access-Control-Allow-Origin` = new { "*" }
|
||||
}
|
||||
NoDNSLink = false
|
||||
NoFetch = false
|
||||
PublicGateways = null
|
||||
RootRedirect = ""
|
||||
Writable = false
|
||||
}
|
||||
|
||||
Identity {
|
||||
PrivKey = "CAESQP0FRhYf5Nvxg0wrbN+VTK7kWdgy+3AKoxU3vNH0K9FHVpXyx6/mHKyCaPjqI11YsHUW0B2ZODGROPafyS6IeWY="
|
||||
PeerID = "12D3KooWFeMr1tHFs8WAF11rKDULJbmKg9rE5aVhYJU23oC7pqjB"
|
||||
}
|
||||
|
||||
Ipns {
|
||||
RecordLifetime = ""
|
||||
RepublishPeriod = ""
|
||||
ResolveCacheSize = 128
|
||||
}
|
||||
|
||||
Migration {
|
||||
Keep = ""
|
||||
}
|
||||
|
||||
Mounts {
|
||||
IPNS = "/ipns"
|
||||
FuseAllowOther = false
|
||||
IPFS = "/ipfs"
|
||||
}
|
||||
|
||||
Peering {
|
||||
Peers = new {
|
||||
new {
|
||||
Addrs = new { "/dnsaddr/node-1.ingress.cloudflare-ipfs.com" }
|
||||
ID = "QmcFf2FH3CEgTNHeMRGhN7HNHU1EXAxoEk6EFuSyXCsvRE"
|
||||
}
|
||||
new {
|
||||
Addrs = new { "/dnsaddr/node-2.ingress.cloudflare-ipfs.com" }
|
||||
ID = "QmcFmLd5ySfk2WZuJ1mfSWLDjdmHZq7rSAua4GoeSQfs1z"
|
||||
}
|
||||
new {
|
||||
Addrs = new { "/dnsaddr/node-3.ingress.cloudflare-ipfs.com" }
|
||||
ID = "QmcfFmzSDVbwexQ9Au2pt5YEXHK5xajwgaU6PpkbLWerMa"
|
||||
}
|
||||
new {
|
||||
Addrs = new { "/dnsaddr/node-4.ingress.cloudflare-ipfs.com" }
|
||||
ID = "QmcfJeB3Js1FG7T8YaZATEiaHqNKVdQfybYYkbT1knUswx"
|
||||
}
|
||||
new {
|
||||
Addrs = new { "/dnsaddr/node-5.ingress.cloudflare-ipfs.com" }
|
||||
ID = "QmcfVvzK4tMdFmpJjEKDUoqRgP4W9FnmJoziYX5GXJJ8eZ"
|
||||
}
|
||||
new {
|
||||
Addrs = new { "/dnsaddr/node-6.ingress.cloudflare-ipfs.com" }
|
||||
ID = "QmcfZD3VKrUxyP9BbyUnZDpbqDnT7cQ4WjPP8TRLXaoE7G"
|
||||
}
|
||||
new {
|
||||
Addrs = new { "/dnsaddr/node-7.ingress.cloudflare-ipfs.com" }
|
||||
ID = "QmcfZP2LuW4jxviTeG8fi28qjnZScACb8PEgHAc17ZEri3"
|
||||
}
|
||||
new {
|
||||
Addrs = new { "/dnsaddr/node-8.ingress.cloudflare-ipfs.com" }
|
||||
ID = "QmcfgsJsMtx6qJb74akCw1M24X1zFwgGo11h1cuhwQjtJP"
|
||||
}
|
||||
new {
|
||||
Addrs = new { "/dnsaddr/node-9.ingress.cloudflare-ipfs.com" }
|
||||
ID = "Qmcfr2FC7pFzJbTSDfYaSy1J8Uuy8ccGLeLyqJCKJvTHMi"
|
||||
}
|
||||
new {
|
||||
Addrs = new { "/dnsaddr/node-10.ingress.cloudflare-ipfs.com" }
|
||||
ID = "QmcfR3V5YAtHBzxVACWCzXTt26SyEkxdwhGJ6875A8BuWx"
|
||||
}
|
||||
new {
|
||||
Addrs = new { "/dnsaddr/node-11.ingress.cloudflare-ipfs.com" }
|
||||
ID = "Qmcfuo1TM9uUiJp6dTbm915Rf1aTqm3a3dnmCdDQLHgvL5"
|
||||
}
|
||||
new {
|
||||
Addrs = new { "/dnsaddr/node-12.ingress.cloudflare-ipfs.com" }
|
||||
ID = "QmcfV2sg9zaq7UUHVCGuSvT2M2rnLBAPsiE79vVyK3Cuev"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Provider {
|
||||
Strategy = ""
|
||||
}
|
||||
|
||||
Pubsub {
|
||||
Router = ""
|
||||
DisableSigning = false
|
||||
}
|
||||
|
||||
Reprovider {
|
||||
Strategy = "all"
|
||||
Interval = "12h"
|
||||
}
|
||||
|
||||
Routing {
|
||||
Methods = null
|
||||
Routers = null
|
||||
Type = "dht"
|
||||
}
|
||||
|
||||
Swarm {
|
||||
AddrFilters = null
|
||||
ConnMgr = new {}
|
||||
DisableBandwidthMetrics = false
|
||||
DisableNatPortMap = false
|
||||
RelayClient = new {}
|
||||
ResourceMgr = new {}
|
||||
Transports = new {
|
||||
Multiplexers = new {}
|
||||
Network = new {}
|
||||
Security = new {}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
amends "https://pkl.sh/sonr.chain/0.0.2/App.pkl"
|
||||
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
amends "https://pkl.sh/sonr.chain/0.0.2/Genesis.pkl"
|
||||
|
||||
|
||||
@@ -1,404 +0,0 @@
|
||||
{
|
||||
"lockfile_version": "1",
|
||||
"packages": {
|
||||
"bun@latest": {
|
||||
"last_modified": "2024-11-18T00:41:09Z",
|
||||
"resolved": "github:NixOS/nixpkgs/5083ec887760adfe12af64830a66807423a859a7#bun",
|
||||
"source": "devbox-search",
|
||||
"version": "1.1.34",
|
||||
"systems": {
|
||||
"aarch64-darwin": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/xnj00gq1mfffvgyisghk4m9f38gc5c5c-bun-1.1.34",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/xnj00gq1mfffvgyisghk4m9f38gc5c5c-bun-1.1.34"
|
||||
},
|
||||
"aarch64-linux": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/kccpzv8fb7swmmxbhv805qzq242rhy33-bun-1.1.34",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/kccpzv8fb7swmmxbhv805qzq242rhy33-bun-1.1.34"
|
||||
},
|
||||
"x86_64-darwin": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/8h5k3l4fpgs3al2wvna7x9ybyyc8k36d-bun-1.1.34",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/8h5k3l4fpgs3al2wvna7x9ybyyc8k36d-bun-1.1.34"
|
||||
},
|
||||
"x86_64-linux": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/x089g4srqw71w5jnc87vxbh7m12498i0-bun-1.1.34",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/x089g4srqw71w5jnc87vxbh7m12498i0-bun-1.1.34"
|
||||
}
|
||||
}
|
||||
},
|
||||
"cloudflared@latest": {
|
||||
"last_modified": "2024-11-18T00:41:09Z",
|
||||
"resolved": "github:NixOS/nixpkgs/5083ec887760adfe12af64830a66807423a859a7#cloudflared",
|
||||
"source": "devbox-search",
|
||||
"version": "2024.11.0",
|
||||
"systems": {
|
||||
"aarch64-darwin": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/95knk04xlh78swlk9a6kg524rfykzzmz-cloudflared-2024.11.0",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/95knk04xlh78swlk9a6kg524rfykzzmz-cloudflared-2024.11.0"
|
||||
},
|
||||
"aarch64-linux": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/2d6mh1pi99m19bc9m3phcsfgygbfpyig-cloudflared-2024.11.0",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/2d6mh1pi99m19bc9m3phcsfgygbfpyig-cloudflared-2024.11.0"
|
||||
},
|
||||
"x86_64-darwin": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/4dii539ldfv0f9n7xigfy19ivrg3ng2n-cloudflared-2024.11.0",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/4dii539ldfv0f9n7xigfy19ivrg3ng2n-cloudflared-2024.11.0"
|
||||
},
|
||||
"x86_64-linux": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/hlnabpfi58mpd16symqb7kp8xc2lf1pf-cloudflared-2024.11.0",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/hlnabpfi58mpd16symqb7kp8xc2lf1pf-cloudflared-2024.11.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"go@1.23": {
|
||||
"last_modified": "2024-11-16T04:25:12Z",
|
||||
"resolved": "github:NixOS/nixpkgs/34a626458d686f1b58139620a8b2793e9e123bba#go",
|
||||
"source": "devbox-search",
|
||||
"version": "1.23.3",
|
||||
"systems": {
|
||||
"aarch64-darwin": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/qrj2wp6vzfpjfrrlcmr22818zg83fb73-go-1.23.3",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/qrj2wp6vzfpjfrrlcmr22818zg83fb73-go-1.23.3"
|
||||
},
|
||||
"aarch64-linux": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/dm66qyl19skrwcmk4rb9xcs64xc1d071-go-1.23.3",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/dm66qyl19skrwcmk4rb9xcs64xc1d071-go-1.23.3"
|
||||
},
|
||||
"x86_64-darwin": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/vkjn6njpz4gy5ma763vh8hh93bgjwycr-go-1.23.3",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/vkjn6njpz4gy5ma763vh8hh93bgjwycr-go-1.23.3"
|
||||
},
|
||||
"x86_64-linux": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/bavnchxi7v6xs077jxv7fl5rrqc3y87w-go-1.23.3",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/bavnchxi7v6xs077jxv7fl5rrqc3y87w-go-1.23.3"
|
||||
}
|
||||
}
|
||||
},
|
||||
"ipfs@latest": {
|
||||
"last_modified": "2023-02-24T09:01:09Z",
|
||||
"resolved": "github:NixOS/nixpkgs/7d0ed7f2e5aea07ab22ccb338d27fbe347ed2f11#ipfs",
|
||||
"source": "devbox-search",
|
||||
"version": "0.17.0"
|
||||
},
|
||||
"matrix-synapse@latest": {
|
||||
"last_modified": "2024-11-18T00:41:09Z",
|
||||
"resolved": "github:NixOS/nixpkgs/5083ec887760adfe12af64830a66807423a859a7#matrix-synapse",
|
||||
"source": "devbox-search",
|
||||
"version": "1.119.0",
|
||||
"systems": {
|
||||
"aarch64-linux": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/dfgj6lgmxy18qd5v9z91376i0b1z06jx-matrix-synapse-wrapped-1.119.0",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/dfgj6lgmxy18qd5v9z91376i0b1z06jx-matrix-synapse-wrapped-1.119.0"
|
||||
},
|
||||
"x86_64-linux": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/570l35c4n3qdxaszrf6bz4rrrw87pkil-matrix-synapse-wrapped-1.119.0",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/570l35c4n3qdxaszrf6bz4rrrw87pkil-matrix-synapse-wrapped-1.119.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"postgresql@latest": {
|
||||
"last_modified": "2024-11-22T01:27:12Z",
|
||||
"plugin_version": "0.0.2",
|
||||
"resolved": "github:NixOS/nixpkgs/8edf06bea5bcbee082df1b7369ff973b91618b8d#postgresql",
|
||||
"source": "devbox-search",
|
||||
"version": "16.4",
|
||||
"systems": {
|
||||
"aarch64-darwin": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/j6n9b877yhrnkp9z9p1gllxpnfvdrbrb-postgresql-16.4",
|
||||
"default": true
|
||||
},
|
||||
{
|
||||
"name": "man",
|
||||
"path": "/nix/store/465icqyw6m38jxpx5yr1ri26ki0f96sz-postgresql-16.4-man",
|
||||
"default": true
|
||||
},
|
||||
{
|
||||
"name": "lib",
|
||||
"path": "/nix/store/l9w6d22hrcrxkv005g2gbzhvk64vp4rm-postgresql-16.4-lib"
|
||||
},
|
||||
{
|
||||
"name": "dev",
|
||||
"path": "/nix/store/jvw9nsblsbh9m4n551sq7qnw82hhsv08-postgresql-16.4-dev"
|
||||
},
|
||||
{
|
||||
"name": "doc",
|
||||
"path": "/nix/store/fk1x8k1qsiaasp73qnzyrzw4ylaf1xy6-postgresql-16.4-doc"
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/j6n9b877yhrnkp9z9p1gllxpnfvdrbrb-postgresql-16.4"
|
||||
},
|
||||
"aarch64-linux": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/2ywn472iqfdiyw5w4frm63rn3nyrkgn1-postgresql-16.4",
|
||||
"default": true
|
||||
},
|
||||
{
|
||||
"name": "man",
|
||||
"path": "/nix/store/650fqsb195p9x00jgqgzkisjwddbvgfd-postgresql-16.4-man",
|
||||
"default": true
|
||||
},
|
||||
{
|
||||
"name": "debug",
|
||||
"path": "/nix/store/wm34pd2y04mjgvhanqw4ymmhds56l9da-postgresql-16.4-debug"
|
||||
},
|
||||
{
|
||||
"name": "dev",
|
||||
"path": "/nix/store/ai2ckvi44jdh9i5078gj5brdwsxk4ydm-postgresql-16.4-dev"
|
||||
},
|
||||
{
|
||||
"name": "doc",
|
||||
"path": "/nix/store/qys6z2y4iwr0f6ahpq9gcv9hb551w479-postgresql-16.4-doc"
|
||||
},
|
||||
{
|
||||
"name": "lib",
|
||||
"path": "/nix/store/pii1vyxbzggi7aqy7xglav8p52c0qfp2-postgresql-16.4-lib"
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/2ywn472iqfdiyw5w4frm63rn3nyrkgn1-postgresql-16.4"
|
||||
},
|
||||
"x86_64-darwin": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/5k1p2jjnsdcsvk8zpsqxlzhajh1x9ghq-postgresql-16.4",
|
||||
"default": true
|
||||
},
|
||||
{
|
||||
"name": "man",
|
||||
"path": "/nix/store/p8b24icm7xiwlky1dggqcinn1ah92agl-postgresql-16.4-man",
|
||||
"default": true
|
||||
},
|
||||
{
|
||||
"name": "dev",
|
||||
"path": "/nix/store/cvl9wdw387jk02bbhm1qvidzl18hayyr-postgresql-16.4-dev"
|
||||
},
|
||||
{
|
||||
"name": "doc",
|
||||
"path": "/nix/store/ysmwxhh3s2l1k2jkzxq0bv6vdzlgr14j-postgresql-16.4-doc"
|
||||
},
|
||||
{
|
||||
"name": "lib",
|
||||
"path": "/nix/store/4va0gp1c718dk1zyqs0il2gn7a81spr0-postgresql-16.4-lib"
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/5k1p2jjnsdcsvk8zpsqxlzhajh1x9ghq-postgresql-16.4"
|
||||
},
|
||||
"x86_64-linux": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/ypx0whdqvwbql73nija0zrm4z3rgcm9l-postgresql-16.4",
|
||||
"default": true
|
||||
},
|
||||
{
|
||||
"name": "man",
|
||||
"path": "/nix/store/7x75jfmpc7x36863cf6kr61ikcz787ki-postgresql-16.4-man",
|
||||
"default": true
|
||||
},
|
||||
{
|
||||
"name": "doc",
|
||||
"path": "/nix/store/4c7h8sg2i0jim6hzmzhjw5nn0zmx1xvd-postgresql-16.4-doc"
|
||||
},
|
||||
{
|
||||
"name": "lib",
|
||||
"path": "/nix/store/xd8ks7bs2p7gjgk8h98bfg8801swl9m0-postgresql-16.4-lib"
|
||||
},
|
||||
{
|
||||
"name": "debug",
|
||||
"path": "/nix/store/pxhd0wq2sbafamjmcp7f890qza76gwav-postgresql-16.4-debug"
|
||||
},
|
||||
{
|
||||
"name": "dev",
|
||||
"path": "/nix/store/20i6jma3fbm4sw060hdnrs311fw4aczj-postgresql-16.4-dev"
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/ypx0whdqvwbql73nija0zrm4z3rgcm9l-postgresql-16.4"
|
||||
}
|
||||
}
|
||||
},
|
||||
"skate@latest": {
|
||||
"last_modified": "2024-11-16T04:25:12Z",
|
||||
"resolved": "github:NixOS/nixpkgs/34a626458d686f1b58139620a8b2793e9e123bba#skate",
|
||||
"source": "devbox-search",
|
||||
"version": "1.0.0",
|
||||
"systems": {
|
||||
"aarch64-darwin": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/q6yhpyfbqiabyic6ymx5rp2db62bnbvr-skate-1.0.0",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/q6yhpyfbqiabyic6ymx5rp2db62bnbvr-skate-1.0.0"
|
||||
},
|
||||
"aarch64-linux": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/q55dbgvc4xwvr2g02dks6j2j699qni2k-skate-1.0.0",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/q55dbgvc4xwvr2g02dks6j2j699qni2k-skate-1.0.0"
|
||||
},
|
||||
"x86_64-darwin": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/s1hy525y8ciya3nrns9kryy3jlcw8igv-skate-1.0.0",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/s1hy525y8ciya3nrns9kryy3jlcw8igv-skate-1.0.0"
|
||||
},
|
||||
"x86_64-linux": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/8s03iazymz77nv6pjxpz7wair0m646wv-skate-1.0.0",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/8s03iazymz77nv6pjxpz7wair0m646wv-skate-1.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"tigerbeetle@latest": {
|
||||
"last_modified": "2024-11-16T04:25:12Z",
|
||||
"resolved": "github:NixOS/nixpkgs/34a626458d686f1b58139620a8b2793e9e123bba#tigerbeetle",
|
||||
"source": "devbox-search",
|
||||
"version": "0.16.12",
|
||||
"systems": {
|
||||
"aarch64-darwin": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/mm3jzwf24p35afr55v7kl5a0h6962i6p-tigerbeetle-0.16.12",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/mm3jzwf24p35afr55v7kl5a0h6962i6p-tigerbeetle-0.16.12"
|
||||
},
|
||||
"aarch64-linux": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/4106973gg3crfxq0gwrgwn4hcx64mzyy-tigerbeetle-0.16.12",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/4106973gg3crfxq0gwrgwn4hcx64mzyy-tigerbeetle-0.16.12"
|
||||
},
|
||||
"x86_64-darwin": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/6lnwnr3mvdamm5lxjjqkaagw2pyqlq0a-tigerbeetle-0.16.12",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/6lnwnr3mvdamm5lxjjqkaagw2pyqlq0a-tigerbeetle-0.16.12"
|
||||
},
|
||||
"x86_64-linux": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/afrj2ph61xz0lh7f3d1g1d7v2rslbvny-tigerbeetle-0.16.12",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/afrj2ph61xz0lh7f3d1g1d7v2rslbvny-tigerbeetle-0.16.12"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
version: "0.6"
|
||||
|
||||
processes:
|
||||
ipfs:
|
||||
namespace: testnet
|
||||
command: "devbox run ipfs"
|
||||
background: true
|
||||
availability:
|
||||
restart: never
|
||||
max_restarts: 0
|
||||
|
||||
sonr:
|
||||
namespace: testnet
|
||||
background: true
|
||||
command: "devbox run sonr"
|
||||
restart: never
|
||||
max_restarts: 1
|
||||
depends:
|
||||
- ipfs
|
||||
|
||||
hway:
|
||||
namespace: testnet
|
||||
background: true
|
||||
command: "devbox run hway"
|
||||
restart: never
|
||||
max_restarts: 1
|
||||
depends:
|
||||
- ipfs
|
||||
- sonr
|
||||
@@ -1,85 +0,0 @@
|
||||
/*
|
||||
This file defines the database schema for the PostgresQL ("psql") event sink
|
||||
implementation in CometBFT. The operator must create a database and install
|
||||
this schema before using the database to index events.
|
||||
*/
|
||||
|
||||
-- The blocks table records metadata about each block.
|
||||
-- The block record does not include its events or transactions (see tx_results).
|
||||
CREATE TABLE blocks (
|
||||
rowid BIGSERIAL PRIMARY KEY,
|
||||
|
||||
height BIGINT NOT NULL,
|
||||
chain_id VARCHAR NOT NULL,
|
||||
|
||||
-- When this block header was logged into the sink, in UTC.
|
||||
created_at TIMESTAMPTZ NOT NULL,
|
||||
|
||||
UNIQUE (height, chain_id)
|
||||
);
|
||||
|
||||
-- Index blocks by height and chain, since we need to resolve block IDs when
|
||||
-- indexing transaction records and transaction events.
|
||||
CREATE INDEX idx_blocks_height_chain ON blocks(height, chain_id);
|
||||
|
||||
-- The tx_results table records metadata about transaction results. Note that
|
||||
-- the events from a transaction are stored separately.
|
||||
CREATE TABLE tx_results (
|
||||
rowid BIGSERIAL PRIMARY KEY,
|
||||
|
||||
-- The block to which this transaction belongs.
|
||||
block_id BIGINT NOT NULL REFERENCES blocks(rowid),
|
||||
-- The sequential index of the transaction within the block.
|
||||
index INTEGER NOT NULL,
|
||||
-- When this result record was logged into the sink, in UTC.
|
||||
created_at TIMESTAMPTZ NOT NULL,
|
||||
-- The hex-encoded hash of the transaction.
|
||||
tx_hash VARCHAR NOT NULL,
|
||||
-- The protobuf wire encoding of the TxResult message.
|
||||
tx_result BYTEA NOT NULL,
|
||||
|
||||
UNIQUE (block_id, index)
|
||||
);
|
||||
|
||||
-- The events table records events. All events (both block and transaction) are
|
||||
-- associated with a block ID; transaction events also have a transaction ID.
|
||||
CREATE TABLE events (
|
||||
rowid BIGSERIAL PRIMARY KEY,
|
||||
|
||||
-- The block and transaction this event belongs to.
|
||||
-- If tx_id is NULL, this is a block event.
|
||||
block_id BIGINT NOT NULL REFERENCES blocks(rowid),
|
||||
tx_id BIGINT NULL REFERENCES tx_results(rowid),
|
||||
|
||||
-- The application-defined type label for the event.
|
||||
type VARCHAR NOT NULL
|
||||
);
|
||||
|
||||
-- The attributes table records event attributes.
|
||||
CREATE TABLE attributes (
|
||||
event_id BIGINT NOT NULL REFERENCES events(rowid),
|
||||
key VARCHAR NOT NULL, -- bare key
|
||||
composite_key VARCHAR NOT NULL, -- composed type.key
|
||||
value VARCHAR NULL,
|
||||
|
||||
UNIQUE (event_id, key)
|
||||
);
|
||||
|
||||
-- A joined view of events and their attributes. Events that do not have any
|
||||
-- attributes are represented as a single row with empty key and value fields.
|
||||
CREATE VIEW event_attributes AS
|
||||
SELECT block_id, tx_id, type, key, composite_key, value
|
||||
FROM events LEFT JOIN attributes ON (events.rowid = attributes.event_id);
|
||||
|
||||
-- A joined view of all block events (those having tx_id NULL).
|
||||
CREATE VIEW block_events AS
|
||||
SELECT blocks.rowid as block_id, height, chain_id, type, key, composite_key, value
|
||||
FROM blocks JOIN event_attributes ON (blocks.rowid = event_attributes.block_id)
|
||||
WHERE event_attributes.tx_id IS NULL;
|
||||
|
||||
-- A joined view of all transaction events.
|
||||
CREATE VIEW tx_events AS
|
||||
SELECT height, index, chain_id, type, key, composite_key, value, tx_results.created_at
|
||||
FROM blocks JOIN tx_results ON (blocks.rowid = tx_results.block_id)
|
||||
JOIN event_attributes ON (tx_results.rowid = event_attributes.tx_id)
|
||||
WHERE event_attributes.tx_id IS NOT NULL;
|
||||
-44
@@ -1,44 +0,0 @@
|
||||
{
|
||||
"$schema": "https://raw.githubusercontent.com/jetify-com/devbox/0.12.0/.schema/devbox.schema.json",
|
||||
"packages": [
|
||||
"go@1.22",
|
||||
"bun@latest",
|
||||
"gum@latest",
|
||||
"ipfs@latest",
|
||||
"skate@latest",
|
||||
"air@latest",
|
||||
"go-task@latest",
|
||||
"templ@latest",
|
||||
"tigerbeetle@latest",
|
||||
"process-compose@latest"
|
||||
],
|
||||
"env": {
|
||||
"GOPATH": "$HOME/go",
|
||||
"PATH": "./build:$HOME/go/bin:$PATH",
|
||||
"CHAIN_ID": "sonr-testnet-1",
|
||||
"DENOM": "usnr",
|
||||
"KEYRING": "test",
|
||||
"MONIKER": "florence",
|
||||
"BINARY": "sonrd",
|
||||
"ACC0_NAME": "acc0",
|
||||
"ACC1_NAME": "acc1",
|
||||
"ACC0_ADDRESS": "idx1efd63aw40lxf3n4mhf7dzhjkr453axur9vjt6y",
|
||||
"ACC1_ADDRESS": "idx1hj5fveer5cjtn4wd6wstzugjfdxzl0xpecp0nd",
|
||||
"ACC0_MNEMONIC": "$(skate get ACC0_MNEMONIC)",
|
||||
"ACC1_MNEMONIC": "$(skate get ACC1_MNEMONIC)",
|
||||
"TUNNEL_TOKEN": "$(skate get CLOUDFLARE_TUNNEL_TOKEN)",
|
||||
"TURNSTILE_SITE_KEY": "$(skate get TURNSTILE_SITE_KEY)",
|
||||
"TEMPL_EXPERIMENT": "rawgo"
|
||||
},
|
||||
"shell": {
|
||||
"scripts": {
|
||||
"deploy": [
|
||||
"gum spin --title='Generating PKL' -- make pkl-gen",
|
||||
"gum spin --title='Building Motr WASM' -- make motr-build",
|
||||
"gum spin --title='Uploading to Bucket' -- make deploy-cdn"
|
||||
],
|
||||
"devnet": ["process-compose up -f deploy/devnet/process-compose.yaml"],
|
||||
"testnet": ["process-compose run -f deploy/testnet/process-compose.yaml"]
|
||||
}
|
||||
}
|
||||
}
|
||||
-443
@@ -1,443 +0,0 @@
|
||||
{
|
||||
"lockfile_version": "1",
|
||||
"packages": {
|
||||
"air@latest": {
|
||||
"last_modified": "2024-11-28T07:51:56Z",
|
||||
"resolved": "github:NixOS/nixpkgs/226216574ada4c3ecefcbbec41f39ce4655f78ef#air",
|
||||
"source": "devbox-search",
|
||||
"version": "1.61.1",
|
||||
"systems": {
|
||||
"aarch64-darwin": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/0s90vbnmsyyixs0991md21pbrw8babfb-air-1.61.1",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/0s90vbnmsyyixs0991md21pbrw8babfb-air-1.61.1"
|
||||
},
|
||||
"aarch64-linux": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/8mpw2asxs297v26fxqy2y1bq438f344l-air-1.61.1",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/8mpw2asxs297v26fxqy2y1bq438f344l-air-1.61.1"
|
||||
},
|
||||
"x86_64-darwin": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/abminkf7ldqf9vm14xx5wvsrdx3wrvy6-air-1.61.1",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/abminkf7ldqf9vm14xx5wvsrdx3wrvy6-air-1.61.1"
|
||||
},
|
||||
"x86_64-linux": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/ajx8v5rbbvglncb97yybg3x9kn95gfrm-air-1.61.1",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/ajx8v5rbbvglncb97yybg3x9kn95gfrm-air-1.61.1"
|
||||
}
|
||||
}
|
||||
},
|
||||
"bun@latest": {
|
||||
"last_modified": "2024-11-26T10:33:56Z",
|
||||
"resolved": "github:NixOS/nixpkgs/af51545ec9a44eadf3fe3547610a5cdd882bc34e#bun",
|
||||
"source": "devbox-search",
|
||||
"version": "1.1.34",
|
||||
"systems": {
|
||||
"aarch64-darwin": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/0hxh6hmzkpg56l11vsnyb287jynhf5f4-bun-1.1.34",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/0hxh6hmzkpg56l11vsnyb287jynhf5f4-bun-1.1.34"
|
||||
},
|
||||
"aarch64-linux": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/mc6bikx8a0rqm1xk040w2q861syxpr8d-bun-1.1.34",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/mc6bikx8a0rqm1xk040w2q861syxpr8d-bun-1.1.34"
|
||||
},
|
||||
"x86_64-darwin": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/fn9h6y3v8il2yax5pm965lacxzj8pq9q-bun-1.1.34",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/fn9h6y3v8il2yax5pm965lacxzj8pq9q-bun-1.1.34"
|
||||
},
|
||||
"x86_64-linux": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/mzk71frmsppga4i7sz7ca3r9wxv8slx9-bun-1.1.34",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/mzk71frmsppga4i7sz7ca3r9wxv8slx9-bun-1.1.34"
|
||||
}
|
||||
}
|
||||
},
|
||||
"go-task@latest": {
|
||||
"last_modified": "2024-11-28T07:51:56Z",
|
||||
"resolved": "github:NixOS/nixpkgs/226216574ada4c3ecefcbbec41f39ce4655f78ef#go-task",
|
||||
"source": "devbox-search",
|
||||
"version": "3.40.0",
|
||||
"systems": {
|
||||
"aarch64-darwin": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/ynnx5bghcar86a89026rdysvpf51b2li-go-task-3.40.0",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/ynnx5bghcar86a89026rdysvpf51b2li-go-task-3.40.0"
|
||||
},
|
||||
"aarch64-linux": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/2ga7yc7nn0k01n2w3wa6fjbp0i31r6d6-go-task-3.40.0",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/2ga7yc7nn0k01n2w3wa6fjbp0i31r6d6-go-task-3.40.0"
|
||||
},
|
||||
"x86_64-darwin": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/0fc73lrh98s9i7qjsxk8gjddxam5kv76-go-task-3.40.0",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/0fc73lrh98s9i7qjsxk8gjddxam5kv76-go-task-3.40.0"
|
||||
},
|
||||
"x86_64-linux": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/x5pbyv5p0yj3fl77j4bmgcj8s7jjcjwn-go-task-3.40.0",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/x5pbyv5p0yj3fl77j4bmgcj8s7jjcjwn-go-task-3.40.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"go@1.22": {
|
||||
"last_modified": "2024-11-28T07:51:56Z",
|
||||
"resolved": "github:NixOS/nixpkgs/226216574ada4c3ecefcbbec41f39ce4655f78ef#go_1_22",
|
||||
"source": "devbox-search",
|
||||
"version": "1.22.9",
|
||||
"systems": {
|
||||
"aarch64-darwin": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/4nf51i4ah186y2jy3fad2fyvpa49qx6q-go-1.22.9",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/4nf51i4ah186y2jy3fad2fyvpa49qx6q-go-1.22.9"
|
||||
},
|
||||
"aarch64-linux": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/8w8vzwgp55yl8j1ljgm4wzdgjkvkv5v3-go-1.22.9",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/8w8vzwgp55yl8j1ljgm4wzdgjkvkv5v3-go-1.22.9"
|
||||
},
|
||||
"x86_64-darwin": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/vlih7j78ki05i8nvzdsxvws7a7ksq04m-go-1.22.9",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/vlih7j78ki05i8nvzdsxvws7a7ksq04m-go-1.22.9"
|
||||
},
|
||||
"x86_64-linux": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/frc5188kgv3ws0n999c7cy5vi2f8k4jp-go-1.22.9",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/frc5188kgv3ws0n999c7cy5vi2f8k4jp-go-1.22.9"
|
||||
}
|
||||
}
|
||||
},
|
||||
"gum@latest": {
|
||||
"last_modified": "2024-11-16T04:25:12Z",
|
||||
"resolved": "github:NixOS/nixpkgs/34a626458d686f1b58139620a8b2793e9e123bba#gum",
|
||||
"source": "devbox-search",
|
||||
"version": "0.14.5",
|
||||
"systems": {
|
||||
"aarch64-darwin": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/rzqm62ixipbzbhfagqlic5xxag9a2v82-gum-0.14.5",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/rzqm62ixipbzbhfagqlic5xxag9a2v82-gum-0.14.5"
|
||||
},
|
||||
"aarch64-linux": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/3ick2j8z9jgkk3cyc1ik4zkbs3m4583n-gum-0.14.5",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/3ick2j8z9jgkk3cyc1ik4zkbs3m4583n-gum-0.14.5"
|
||||
},
|
||||
"x86_64-darwin": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/9rh8qxbxgb07v3a62mx9404ynk2yhxrj-gum-0.14.5",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/9rh8qxbxgb07v3a62mx9404ynk2yhxrj-gum-0.14.5"
|
||||
},
|
||||
"x86_64-linux": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/1bnivwijzrnzx5h0hd5rywwy8rlhxmw5-gum-0.14.5",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/1bnivwijzrnzx5h0hd5rywwy8rlhxmw5-gum-0.14.5"
|
||||
}
|
||||
}
|
||||
},
|
||||
"ipfs@latest": {
|
||||
"last_modified": "2023-02-24T09:01:09Z",
|
||||
"resolved": "github:NixOS/nixpkgs/7d0ed7f2e5aea07ab22ccb338d27fbe347ed2f11#ipfs",
|
||||
"source": "devbox-search",
|
||||
"version": "0.17.0"
|
||||
},
|
||||
"process-compose@latest": {
|
||||
"last_modified": "2024-11-28T07:51:56Z",
|
||||
"resolved": "github:NixOS/nixpkgs/226216574ada4c3ecefcbbec41f39ce4655f78ef#process-compose",
|
||||
"source": "devbox-search",
|
||||
"version": "1.40.1",
|
||||
"systems": {
|
||||
"aarch64-darwin": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/ndvh1v1881a3pwxyw1g38mhp5xzrpz16-process-compose-1.40.1",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/ndvh1v1881a3pwxyw1g38mhp5xzrpz16-process-compose-1.40.1"
|
||||
},
|
||||
"aarch64-linux": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/7jw864z6wlzcirsz8fgaj2bw0f22izch-process-compose-1.40.1",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/7jw864z6wlzcirsz8fgaj2bw0f22izch-process-compose-1.40.1"
|
||||
},
|
||||
"x86_64-darwin": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/qz9gb3briakkvylq3markxd1s7plaw47-process-compose-1.40.1",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/qz9gb3briakkvylq3markxd1s7plaw47-process-compose-1.40.1"
|
||||
},
|
||||
"x86_64-linux": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/0vq97wmm879440n8plsk1yjc1g28ai85-process-compose-1.40.1",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/0vq97wmm879440n8plsk1yjc1g28ai85-process-compose-1.40.1"
|
||||
}
|
||||
}
|
||||
},
|
||||
"skate@latest": {
|
||||
"last_modified": "2024-11-28T07:51:56Z",
|
||||
"resolved": "github:NixOS/nixpkgs/226216574ada4c3ecefcbbec41f39ce4655f78ef#skate",
|
||||
"source": "devbox-search",
|
||||
"version": "1.0.0",
|
||||
"systems": {
|
||||
"aarch64-darwin": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/q6yhpyfbqiabyic6ymx5rp2db62bnbvr-skate-1.0.0",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/q6yhpyfbqiabyic6ymx5rp2db62bnbvr-skate-1.0.0"
|
||||
},
|
||||
"aarch64-linux": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/q55dbgvc4xwvr2g02dks6j2j699qni2k-skate-1.0.0",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/q55dbgvc4xwvr2g02dks6j2j699qni2k-skate-1.0.0"
|
||||
},
|
||||
"x86_64-darwin": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/s1hy525y8ciya3nrns9kryy3jlcw8igv-skate-1.0.0",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/s1hy525y8ciya3nrns9kryy3jlcw8igv-skate-1.0.0"
|
||||
},
|
||||
"x86_64-linux": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/8s03iazymz77nv6pjxpz7wair0m646wv-skate-1.0.0",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/8s03iazymz77nv6pjxpz7wair0m646wv-skate-1.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"templ@latest": {
|
||||
"last_modified": "2024-11-28T07:51:56Z",
|
||||
"resolved": "github:NixOS/nixpkgs/226216574ada4c3ecefcbbec41f39ce4655f78ef#templ",
|
||||
"source": "devbox-search",
|
||||
"version": "0.2.793",
|
||||
"systems": {
|
||||
"aarch64-darwin": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/ivargvf76g71k5gk3iz4al52rsy28w38-templ-0.2.793",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/ivargvf76g71k5gk3iz4al52rsy28w38-templ-0.2.793"
|
||||
},
|
||||
"aarch64-linux": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/03654iddn006yx5j1lqq496hax60v8p5-templ-0.2.793",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/03654iddn006yx5j1lqq496hax60v8p5-templ-0.2.793"
|
||||
},
|
||||
"x86_64-darwin": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/blvd5wbd1ix6m745s4zx3b84kwzprshq-templ-0.2.793",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/blvd5wbd1ix6m745s4zx3b84kwzprshq-templ-0.2.793"
|
||||
},
|
||||
"x86_64-linux": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/sn5h79d36r86i6a8rm1k52c2ij1s32kx-templ-0.2.793",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/sn5h79d36r86i6a8rm1k52c2ij1s32kx-templ-0.2.793"
|
||||
}
|
||||
}
|
||||
},
|
||||
"tigerbeetle@latest": {
|
||||
"last_modified": "2024-11-30T03:39:21Z",
|
||||
"resolved": "github:NixOS/nixpkgs/4703b8d2c708e13a8cab03d865f90973536dcdf5#tigerbeetle",
|
||||
"source": "devbox-search",
|
||||
"version": "0.16.14",
|
||||
"systems": {
|
||||
"aarch64-darwin": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/jgcj3ci7708zsgirgjl4cdnaq7x59fm4-tigerbeetle-0.16.14",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/jgcj3ci7708zsgirgjl4cdnaq7x59fm4-tigerbeetle-0.16.14"
|
||||
},
|
||||
"aarch64-linux": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/b4zqvr0zanwvdz8c7fs6w1h51fh6pa1j-tigerbeetle-0.16.14",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/b4zqvr0zanwvdz8c7fs6w1h51fh6pa1j-tigerbeetle-0.16.14"
|
||||
},
|
||||
"x86_64-darwin": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/nqi4rb34bdcra0sx59dnipdp347smndx-tigerbeetle-0.16.14",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/nqi4rb34bdcra0sx59dnipdp347smndx-tigerbeetle-0.16.14"
|
||||
},
|
||||
"x86_64-linux": {
|
||||
"outputs": [
|
||||
{
|
||||
"name": "out",
|
||||
"path": "/nix/store/224jvdiazicsmm1r5dpykk912rzlyhgr-tigerbeetle-0.16.14",
|
||||
"default": true
|
||||
}
|
||||
],
|
||||
"store_path": "/nix/store/224jvdiazicsmm1r5dpykk912rzlyhgr-tigerbeetle-0.16.14"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
onsonr.dev
|
||||
@@ -1,3 +1,121 @@
|
||||
## v0.5.23 (2024-12-11)
|
||||
|
||||
### Refactor
|
||||
|
||||
- rename scheduled release workflow to versioned release
|
||||
- remove changelog from release artifacts
|
||||
|
||||
## v0.5.22 (2024-12-11)
|
||||
|
||||
### Feat
|
||||
|
||||
- Implement passkey-based authentication and registration flow
|
||||
|
||||
## v0.5.21 (2024-12-11)
|
||||
|
||||
### Feat
|
||||
|
||||
- allow manual triggering of deployment workflow
|
||||
- add start-tui command for interactive mode
|
||||
- add coin selection and update passkey input in registration form
|
||||
- add hway command for Sonr DID gateway
|
||||
- Conditionally install process-compose only if binary not found
|
||||
- Add process-compose support with custom start and down commands
|
||||
- implement passkey registration flow
|
||||
- Improve createProfile form layout with wider max-width and enhanced spacing
|
||||
- improve index page UI with new navigation buttons and remove redundant settings buttons
|
||||
- Make input rows responsive with grid layout for mobile and desktop
|
||||
- enhance index page with additional settings buttons and style adjustments
|
||||
- implement passkey-based authentication
|
||||
- add support for Cloudsmith releases
|
||||
- add go dependency and enhance devbox environment variables
|
||||
- update create profile form placeholders and handle
|
||||
- add DID-based authentication middleware
|
||||
- Add validation for human verification slider sum in CreateProfile form
|
||||
- implement passkey registration flow
|
||||
- Update WebAuthn credential handling with modern browser standards
|
||||
- Streamline passkey registration with automatic form submission
|
||||
- Add credential parsing and logging in register finish handler
|
||||
- Add credential details row with icon after passkey creation
|
||||
- Add form validation for passkey credential input
|
||||
- implement passkey registration flow
|
||||
- Add hidden input to store passkey credential data for form submission
|
||||
- add CI workflow for deploying network
|
||||
- add hway binary support and Homebrew formula
|
||||
- remove username from passkey creation
|
||||
- implement passkey registration flow
|
||||
- add passkey creation functionality
|
||||
- add CNAME for onsonr.dev domain
|
||||
|
||||
### Fix
|
||||
|
||||
- use Unix domain sockets for devnet processes
|
||||
- correct workflow name and improve devnet deployment process
|
||||
- correct title of profile creation page
|
||||
- rename devbox start script to up and remove stop script
|
||||
- Consolidate archive configuration and add LICENSE file
|
||||
- Improve cross-browser passkey credential handling and encoding
|
||||
- Remove commented-out code in passkey registration script
|
||||
- remove line-clamp from tailwind config
|
||||
- remove unnecessary background and restart settings from process-compose.yaml
|
||||
- suppress process-compose server output and log to file
|
||||
|
||||
### Refactor
|
||||
|
||||
- remove unnecessary git fetch step in deploy workflow
|
||||
- remove obsolete interchain test dependencies
|
||||
- update index views to use new nebula components
|
||||
- move Wasm related code to pkg/common/wasm
|
||||
- migrate config package to pkg directory
|
||||
- migrate to new configuration system and model definitions
|
||||
- move session package to pkg directory
|
||||
- Refactor registration forms to use UI components
|
||||
- move gateway config to vault package
|
||||
- improve command line flag descriptions and variable names
|
||||
- refactor hway command to use echo framework for server
|
||||
- Update root command to load EnvImpl from cobra flags
|
||||
- Modify command flags and environment loading logic in cmds.go
|
||||
- improve build process and move process-compose.yaml
|
||||
- remove unused devbox.json and related configurations
|
||||
- Improve mobile layout responsiveness for Rows and Columns components
|
||||
- Remove max-w-fit from Rows component
|
||||
- replace session package with context package
|
||||
- rename database initialization function
|
||||
- move session management to dedicated database module
|
||||
- remove unused UI components related to wallet and index pages
|
||||
- consolidate handlers into single files
|
||||
- move gateway and vault packages to internal directory
|
||||
- Move registration form components to dedicated directory
|
||||
- remove unused devbox package
|
||||
- remove devbox configuration
|
||||
- move vault package to app directory
|
||||
- improve code structure within gateway package
|
||||
- move gateway package to app directory
|
||||
- move vault package internal components to root
|
||||
- migrate layout imports to common styles package
|
||||
- Move form templates and styles to common directory
|
||||
- consolidate authentication and DID handling logic
|
||||
- Improve WebAuthn credential handling and validation in register finish route
|
||||
- remove profile card component
|
||||
- Simplify passkey registration UI and move profile component inline
|
||||
- Update credential logging with transport and ID type
|
||||
- Update register handler to use protocol.CredentialDescriptor struct
|
||||
- Update credential handling to use protocol.CredentialDescriptor
|
||||
- improve profile card styling and functionality
|
||||
- Simplify session management and browser information extraction
|
||||
- Update PeerInfo to extract and store comprehensive device information
|
||||
- improve address display in property details
|
||||
- remove unused documentation generation script
|
||||
- replace sonr/pkg/styles/layout with nebula/ui/layout
|
||||
- migrate UI components to nebula module
|
||||
- improve scopes.json structure and update scripts for better usability
|
||||
|
||||
## v0.5.20 (2024-12-07)
|
||||
|
||||
### Refactor
|
||||
|
||||
- simplify CI workflow by removing redundant asset publishing steps
|
||||
|
||||
## v0.5.19 (2024-12-06)
|
||||
|
||||
### Feat
|
||||
@@ -0,0 +1,104 @@
|
||||
## `x/did` - Auth & AuthZ
|
||||
|
||||
> The DID module is responsible for managing the creation and management of DIDs.
|
||||
> Controllers represent on-chain accounts backed by a MPC keypair. Controllers
|
||||
> provide methods for Wallet Account Abstraction (WAA) and are responsible for
|
||||
> managing the creation and management of DIDs for an individual user.
|
||||
|
||||
### Features
|
||||
|
||||
- DID Controllers leverage the Cosmos SDK's `x/accounts` std interface for WAA.
|
||||
- DIDs are represented by a `x/did` controller and are required to state the
|
||||
controller's public key, and which map to the controller's capabilities.
|
||||
- General Sign/Verify methods are provides from the QueryServer for HTTP requests.
|
||||
- The Execute method is used to broadcast transactions across the network. (TODO)
|
||||
- Biscuits are used to authenticate and authorize requests between services. (TODO)
|
||||
|
||||
### References
|
||||
|
||||
- [State](https://github.com/onsonr/sonr/tree/develop/x/did#state)
|
||||
- [State Transitions](https://github.com/onsonr/sonr/tree/develop/x/did#state-transitions)
|
||||
- [Messages](https://github.com/onsonr/sonr/tree/develop/x/did#messages)
|
||||
- [Queries](https://github.com/onsonr/sonr/tree/develop/x/did#query)
|
||||
- [Params](https://github.com/onsonr/sonr/tree/develop/x/did#params)
|
||||
- [Client](https://github.com/onsonr/sonr/tree/develop/x/did#client)
|
||||
- [Future Improvements](https://github.com/onsonr/sonr/tree/develop/x/did#future-improvements)
|
||||
- [Tests](https://github.com/onsonr/sonr/tree/develop/x/did#tests)
|
||||
- [Appendix](https://github.com/onsonr/sonr/tree/develop/x/did#appendix)
|
||||
|
||||
---
|
||||
|
||||
## `x/macaroon`
|
||||
|
||||
> The macaroon module is responsible for issuing and verifying macaroons. Macaroons
|
||||
> are used to authenticate and authorize requests between services.
|
||||
> Macaroons are requested by NFT Records from [`x/service`](2-‐-Modules-Overview.md#x-service) and granted by controllers from [`x/did`](2-‐-Modules-Overview.md#x/did)
|
||||
|
||||
### Features
|
||||
|
||||
- On Controller creation, a macaroon is created with an admin scope and a default expiry of _315,569,520 blocks (or ~10 years)_.
|
||||
- On Service registration, a macaroon is created with a service scope and a default expiry of _31,556,952 blocks (or ~1 year)_.
|
||||
- Macaroons contain the scope of access for a service and the expiry of the permissions in `blockHeight`.
|
||||
|
||||
### References
|
||||
|
||||
- [State](https://github.com/onsonr/sonr/tree/develop/x/macaroon#state)
|
||||
- [State Transitions](https://github.com/onsonr/sonr/tree/develop/x/macaroon#state-transitions)
|
||||
- [Messages](https://github.com/onsonr/sonr/tree/develop/x/macaroon#messages)
|
||||
- [Queries](https://github.com/onsonr/sonr/tree/develop/x/macaroon#query)
|
||||
- [Params](https://github.com/onsonr/sonr/tree/develop/x/macaroon#params)
|
||||
- [Client](https://github.com/onsonr/sonr/tree/develop/x/macaroon#client)
|
||||
- [Future Improvements](https://github.com/onsonr/sonr/tree/develop/x/macaroon#future-improvements)
|
||||
- [Tests](https://github.com/onsonr/sonr/tree/develop/x/macaroon#tests)
|
||||
- [Appendix](https://github.com/onsonr/sonr/tree/develop/x/macaroon#appendix)
|
||||
|
||||
---
|
||||
|
||||
## `x/service`
|
||||
|
||||
> The service module is responsible for managing decentralized services. Services
|
||||
> on the Sonr network are essentially on-chain MultiSig wallets that are
|
||||
> represented by a NFT. Service admins are represented by
|
||||
> a [`x/did`](2-‐-Modules-Overview.md#x-did) controller and are required to state
|
||||
> the service's scope of access, and which map to the services' capabilities.
|
||||
|
||||
### Features
|
||||
|
||||
- Needs a Valid Domain with .htaccess file to be whitelisted.
|
||||
|
||||
### References
|
||||
|
||||
- [State](https://github.com/onsonr/sonr/tree/develop/x/service#state)
|
||||
- [State Transitions](https://github.com/onsonr/sonr/tree/develop/x/service#state-transitions)
|
||||
- [Messages](https://github.com/onsonr/sonr/tree/develop/x/service#messages)
|
||||
- [Queries](https://github.com/onsonr/sonr/tree/develop/x/service#query)
|
||||
- [Params](https://github.com/onsonr/sonr/tree/develop/x/service#params)
|
||||
- [Client](https://github.com/onsonr/sonr/tree/develop/x/service#client)
|
||||
- [Future Improvements](https://github.com/onsonr/sonr/tree/develop/x/service#future-improvements)
|
||||
- [Tests](https://github.com/onsonr/sonr/tree/develop/x/service#tests)
|
||||
- [Appendix](https://github.com/onsonr/sonr/tree/develop/x/service#appendix)
|
||||
|
||||
---
|
||||
|
||||
## `x/vault`
|
||||
|
||||
> The vault module is responsible for managing the storage and acccess-control of
|
||||
> Decentralized Web Nodes (DWNs) from IPFS. Vaults contain user-facing keys and
|
||||
> are represented by a [`x/did`](2-‐-Modules-Overview.md#x-did) controller.
|
||||
|
||||
### Features
|
||||
|
||||
- Vaults can be created by anyone, but efforts are made to restrict 1 per user.
|
||||
- Vaults are stored in IPFS and when claimed, the bech32 Sonr Address is pinned to IPFS.
|
||||
|
||||
### References
|
||||
|
||||
- [State](https://github.com/onsonr/sonr/tree/develop/x/vault#state)
|
||||
- [State Transitions](https://github.com/onsonr/sonr/tree/develop/x/vault#state-transitions)
|
||||
- [Messages](https://github.com/onsonr/sonr/tree/develop/x/vault#messages)
|
||||
- [Queries](https://github.com/onsonr/sonr/tree/develop/x/vault#query)
|
||||
- [Params](https://github.com/onsonr/sonr/tree/develop/x/vault#params)
|
||||
- [Client](https://github.com/onsonr/sonr/tree/develop/x/vault#client)
|
||||
- [Future Improvements](https://github.com/onsonr/sonr/tree/develop/x/vault#future-improvements)
|
||||
- [Tests](https://github.com/onsonr/sonr/tree/develop/x/vault#tests)
|
||||
- [Appendix](https://github.com/onsonr/sonr/tree/develop/x/vault#appendix)
|
||||
@@ -0,0 +1,170 @@
|
||||
# Consumer Chain Launch Process
|
||||
|
||||
This guide is intended for consumer chain teams that are looking to be onboarded on to the Interchain Security testnet.
|
||||
|
||||
## Interchain Security Testnet Overview
|
||||
|
||||
- The Interchain Security (ICS) testnet is to be used to launch and test consumer chains. We recommend consumer chains to launch on the testnet before launching on the mainnet.
|
||||
- All information about the ICS testnet is available in this [repository](https://github.com/cosmos/testnets/tree/master/interchain-security).
|
||||
- The testnet coordinators (Hypha) have majority voting power in the ICS testnet. This means we need to work with you to bring your chain live and also to successfully pass any governance proposals you make.
|
||||
|
||||
## Chain Onboarding Process
|
||||
|
||||
For teams looking to join the ICS testnet, the onboarding process can be broken down in four phases:
|
||||
|
||||
- Testing and Integration
|
||||
- Planning with Testnet Coordinators
|
||||
- Proposal Submission
|
||||
- Chain Launch
|
||||
|
||||
### Local Testing and Integration
|
||||
|
||||
During this phase, your team will run integration tests with the following elements of an Interchain Security testnet:
|
||||
|
||||
- Gaia provider chain
|
||||
- Visit the provider chain [page](./provider/) for details on which Gaia version is currently being used.
|
||||
- Relayers
|
||||
- You will be responsible for running the relayer that relays the first set of Validator Set Change packets between provider and consumer chain. You should be proficient in setting up and running either [Hermes](https://github.com/informalsystems/hermes) or [rly](https://github.com/cosmos/relayer).
|
||||
|
||||
By the end of this phase, you are able to launch a consumer chain within a local testnet or CI workflow that resembles the testnet (or mainnet) environment.
|
||||
|
||||
### Planning with Testnet Coordinators
|
||||
|
||||
Once you have a binary release ready, you can begin planning the launch with the testnet coordinators (Hypha).
|
||||
|
||||
The goals of this phase are to update this repository with all the information validators need to join the network and to produce a `consumer-addition` proposal to be submitted in the provider chain.
|
||||
|
||||
We expect you to run the minimum infrastructure required to make your consumer chain usable by testnet participants. This means running:
|
||||
|
||||
1. **Seed/persistent nodes**
|
||||
2. **Relayer** it must be launched before the chain times out, preferably right after blocks start being produced.
|
||||
- **IMPORTANT**: Make sure you have funds to pay gas fees for the relayer. You will likely need to set up an adequately funded genesis account for this purpose.
|
||||
|
||||
Additionally, you may want to run:
|
||||
|
||||
- a faucet such as this simple [REST faucet](https://github.com/hyphacoop/cosmos-rest-faucet) (it may need a separate funded account in the genesis file as well)
|
||||
- a block explorer such as [ping.pub](https://github.com/ping-pub/explorer)
|
||||
|
||||
## ✍️ Submitting a PR for a new chain
|
||||
|
||||
Each consumer chain gets its own directory. You can use the [`slasher`](./stopped/slasher/) chain as reference. Feel free to clone the slasher directory, modify it for your consumer chain, and make a PR with the relevant information.
|
||||
|
||||
Hypha will be reviewing the PR to ensure it meets the following criteria:
|
||||
|
||||
#### README includes:
|
||||
|
||||
- [ ] Consumer chain repo and release or tag name.
|
||||
- [ ] Build instructions for chain binary.
|
||||
- [ ] Checksum of genesis file without CCV.
|
||||
- [ ] Checksum of reference binary.
|
||||
- [ ] Instructions on to join
|
||||
- [ ] Installation steps
|
||||
- Endpoints
|
||||
- [ ] Seeds OR persistent peers
|
||||
- [ ] State sync nodes (if any)
|
||||
|
||||
See the `slasher` chain [page](./stopped/slasher) for reference.
|
||||
|
||||
#### `chain_id` must be identical in the following places:
|
||||
|
||||
- [ ] `README`
|
||||
- [ ] genesis file
|
||||
- [ ] consumer addition proposal
|
||||
- [ ] bash script
|
||||
|
||||
We recommend choosing a `chain_id` with the suffix `-1`, even if it's a subsequent test of the same chain, e.g. `testchain-second-rehearsal-1`.
|
||||
|
||||
#### Binary checksum validation
|
||||
|
||||
- [ ] `shasum -a 256 <binary>` matches the checksum in the proposal
|
||||
- [ ] `shasum -a 256 <binary>` matches `README`
|
||||
|
||||
#### Bash script
|
||||
|
||||
- [ ] version built in script must match `README`
|
||||
- [ ] seeds or persistent peers must match `README`
|
||||
|
||||
#### Genesis file
|
||||
|
||||
- [ ] Genesis time must match spawn time in the `consumer-addition` proposal
|
||||
- [ ] Accounts and balances: Properly funded accounts (e.g., gas fees for relayer, faucet, etc.)
|
||||
- [ ] Bank balance denom matches denom in `README`
|
||||
- [ ] Slashing parameters: Set `signed_blocks_window` and `min_signed_per_window` adequately to ensure validators have at least 12 hours to join the chain after launch without getting jailed
|
||||
- [ ] `shasum -a 256 <genesis file without CCV>` matches the checksum in the proposal
|
||||
- [ ] `shasum -a 256 <genesis file without CCV>` matches the checksum in the `README`
|
||||
- [ ] The genesis file is correctly formed: `<consumer binary or gaiad> validate-genesis /path/to/genesis-without-ccv.json` returns without error
|
||||
|
||||
See the `slasher` chain [genesis](./stopped/slasher/slasher-genesis-without-ccv.json) for reference.
|
||||
|
||||
#### `consumer-addition` proposal
|
||||
|
||||
- [ ] Spawn time must match genesis time
|
||||
- [ ] Spawn time must be later than voting period
|
||||
- [ ] `revision_height: 1`
|
||||
- [ ] `revision_number: 1` (only if the `chain_id` ends in `-1`)
|
||||
- [ ] `transfer_timeout_period: 1800000000000`. This value should be smaller than `blocks_per_distribution_transmission * block_time`.
|
||||
- [ ] `ccv_timeout_period: 2419200000000000`. This value must be larger than the unbonding period, the default is 28 days.
|
||||
- [ ] `unbonding_period: 1728000000000000` (given current provider params)
|
||||
|
||||
See the `slasher` chain consumer-addition [proposal](./stopped/slasher/proposal-slasher.json) and [Interchain Security time-based parameters](https://github.com/cosmos/interchain-security/blob/main/docs/params.md#time-based-parameters) for reference.
|
||||
|
||||
#### Node configurations
|
||||
|
||||
- [ ] `minimum_gas_prices`
|
||||
- [ ] Check with Hypha about any other chain-specific params
|
||||
|
||||
---
|
||||
|
||||
### On-chain Proposal Submission
|
||||
|
||||
When you make your proposal, please let us know well in advance. The current voting period is five minutes, which means we’ll need to vote right after you submit your proposal. We recommend submitting the proposal together with us on a call.
|
||||
|
||||
The following will take place during the proposal submission phase:
|
||||
|
||||
- Your team will submit the `consumer-addition` proposal with a command that looks like this:
|
||||
```
|
||||
gaiad tx gov submit-legacy-proposal consumer-addition proposal.json --from <account name> --chain-id provider --gas auto --fees 500uatom -b block -y
|
||||
```
|
||||
- Testnet coordinators will vote on it shortly afterwards to make sure it passes.
|
||||
- You will open a pull request to add the new consumer chain entry to this repo and update the [schedule page](SCHEDULE.md) with the launch date.
|
||||
- You will announce the upcoming launch, including the spawn time, in the Interchain Security `announcements` channel of the Cosmos Network Discord Server. If you need permissions for posting, please reach out to us.
|
||||
|
||||
### Chain Launch
|
||||
|
||||
After the spawn time is reached, the Cross-Chain Validation (CCV) state will be available on the provider chain and the new IBC client will be created. At this point, you will be able to:
|
||||
|
||||
- Collect the Cross-Chain Validation (CCV) state from the provider chain.
|
||||
```
|
||||
gaiad q provider consumer-genesis <chain-id> -o json > ccv-state.json
|
||||
```
|
||||
- Update the genesis file with the CCV state.
|
||||
```
|
||||
jq -s '.[0].app_state.ccvconsumer = .[1] | .[0]' <consumer genesis without CCV state> ccv-state.json > <consumer genesis file with CCV state>
|
||||
```
|
||||
- Publish the genesis file with CCV state to the testnets repo.
|
||||
- Post the link to the genesis file and the SHA256 hash to the Interchain Security `interchain-security-testnet` channel of the Cosmos Network Discord Server.
|
||||
- Ensure the required peers are online for people to connect to.
|
||||
|
||||
The consumer chain will start producing blocks as soon as 66.67% of the provider chain's voting power comes online. You will be able to start the relayer afterwards:
|
||||
|
||||
- Query the IBC client ID of the provider chain.
|
||||
```
|
||||
gaiad q provider list-consumer-chains
|
||||
```
|
||||
- Create the required IBC connections and channels for the CCV channel to be established. Using Hermes:
|
||||
```
|
||||
hermes create connection --a-chain <consumer chain ID> --a-client 07-tendermint-0 --b-client <provider chain client ID>
|
||||
hermes create channel --a-chain <consumer chain ID> --a-port consumer --b-port provider --order ordered --a-connection connection-0 --channel-version 1
|
||||
```
|
||||
- Start the relayer
|
||||
- The trusting period fraction is set to `0.25` on the provider chain, so you should use a trusting period of 5 days in your relayer configuration.
|
||||
|
||||
Finally, the testnet coordinators will:
|
||||
|
||||
- Trigger a validator set update in the provider chain to establish the CCV channel and verify the validator set has been updated in the consumer chain.
|
||||
- Announce the chain is interchain secured.
|
||||
- Update the testnets repo with the IBC information.
|
||||
|
||||
## Talk to us
|
||||
|
||||
If you're a consumer chain looking to launch, please get in touch with Hypha. You can reach Lexa Michaelides at `lexa@hypha.coop` or on Telegram.
|
||||
@@ -0,0 +1,10 @@
|
||||
> With increasingly sensitive information being stored in centralized databases, we
|
||||
> believe that a decentralized anonymity mechanism is the only way to protect user data.
|
||||
> Sonr is at its core a peer-to-peer identity system, which means that users can choose
|
||||
> to share their identity with others in a way that is private and secure.
|
||||
|
||||
# Decentralized Identifiers
|
||||
|
||||
# Cross-chain Interoperability
|
||||
|
||||
# W3C Web APIs
|
||||
@@ -0,0 +1,21 @@
|
||||
> Sonr is a decentralized platform that allows users to create and manage their own decentralized identity.
|
||||
|
||||
# Blockchain: Sonr
|
||||
|
||||
Sonr stores Decentralized Identifiers (DIDs) on its Cosmos-sdk based blockchain. The blockchain's role is to act as the
|
||||
persistent pointer store for locations of User owned data.
|
||||
|
||||
# User Key Vault: Motr
|
||||
|
||||
The Motr node is a service-worker which functions as a personal encrypted key-enclave for users stored on IPFS. They can be allocated and persisted on the
|
||||
Sonr blockchain for Smart Wallet functionality.
|
||||
|
||||
# Network Gateway: Hway
|
||||
|
||||
The Hway protocol is a network proxy which routes network requests to the appropriate service endpoint. This is used for seamless communication between
|
||||
Blockchain Nodes, Decentralized Applications, and User Nodes.
|
||||
|
||||
# Design System: Nebula
|
||||
|
||||
Built with Golang-Templ, TailwindCSS, HTMX, and Service Workers - Nebula is a component library which allows for
|
||||
consistent UX across the entire ecosystem.
|
||||
@@ -0,0 +1,13 @@
|
||||
> The `$SNR` token is the native platform token of the Sonr network. It is used by services to
|
||||
> pay for Authentication and Authorization services. The system is designed for developers to
|
||||
> be similar to centralized authentication providers like Google, Facebook, Okta, etc.
|
||||
|
||||
# Usage
|
||||
|
||||
The Sonr blockchain is a Delegated Proof of Stake (DPoS) blockchain built with the Cosmos-sdk.
|
||||
|
||||
# Supply
|
||||
|
||||
> The total supply of `$SNR` is fixed at 1 billion.
|
||||
|
||||

|
||||
@@ -0,0 +1,40 @@
|
||||
# Interchain Accounts
|
||||
|
||||
:::note Synopsis
|
||||
Learn about what the Interchain Accounts module is
|
||||
:::
|
||||
|
||||
## What is the Interchain Accounts module?
|
||||
|
||||
Interchain Accounts is the Cosmos SDK implementation of the ICS-27 protocol, which enables cross-chain account management built upon IBC.
|
||||
|
||||
- How does an interchain account differ from a regular account?
|
||||
|
||||
Regular accounts use a private key to sign transactions. Interchain Accounts are instead controlled programmatically by counterparty chains via IBC packets.
|
||||
|
||||
## Concepts
|
||||
|
||||
`Host Chain`: The chain where the interchain account is registered. The host chain listens for IBC packets from a controller chain which should contain instructions (e.g. Cosmos SDK messages) for which the interchain account will execute.
|
||||
|
||||
`Controller Chain`: The chain registering and controlling an account on a host chain. The controller chain sends IBC packets to the host chain to control the account.
|
||||
|
||||
`Interchain Account`: An account on a host chain created using the ICS-27 protocol. An interchain account has all the capabilities of a normal account. However, rather than signing transactions with a private key, a controller chain will send IBC packets to the host chain which signals what transactions the interchain account should execute.
|
||||
|
||||
`Authentication Module`: A custom application module on the controller chain that uses the Interchain Accounts module to build custom logic for the creation & management of interchain accounts. It can be either an IBC application module using the [legacy API](10-legacy/03-keeper-api.md), or a regular Cosmos SDK application module sending messages to the controller submodule's `MsgServer` (this is the recommended approach from ibc-go v6 if access to packet callbacks is not needed). Please note that the legacy API will eventually be removed and IBC applications will not be able to use them in later releases.
|
||||
|
||||
## SDK security model
|
||||
|
||||
SDK modules on a chain are assumed to be trustworthy. For example, there are no checks to prevent an untrustworthy module from accessing the bank keeper.
|
||||
|
||||
The implementation of ICS-27 in ibc-go uses this assumption in its security considerations.
|
||||
|
||||
The implementation assumes other IBC application modules will not bind to ports within the ICS-27 namespace.
|
||||
|
||||
## Channel Closure
|
||||
|
||||
The provided interchain account host and controller implementations do not support `ChanCloseInit`. However, they do support `ChanCloseConfirm`.
|
||||
This means that the host and controller modules cannot close channels, but they will confirm channel closures initiated by other implementations of ICS-27.
|
||||
|
||||
In the event of a channel closing (due to a packet timeout in an ordered channel, for example), the interchain account associated with that channel can become accessible again if a new channel is created with a (JSON-formatted) version string that encodes the exact same `Metadata` information of the previous channel. The channel can be reopened using either [`MsgRegisterInterchainAccount`](./05-messages.md#msgregisterinterchainaccount) or `MsgChannelOpenInit`. If `MsgRegisterInterchainAccount` is used, then it is possible to leave the `version` field of the message empty, since it will be filled in by the controller submodule. If `MsgChannelOpenInit` is used, then the `version` field must be provided with the correct JSON-encoded `Metadata` string. See section [Understanding Active Channels](./09-active-channels.md#understanding-active-channels) for more information.
|
||||
|
||||
When reopening a channel with the default controller submodule, the ordering of the channel cannot be changed. In order to change the ordering of the channel, the channel has to go through a [channel upgrade handshake](../../01-ibc/06-channel-upgrades.md) or reopen the channel with a custom controller implementation.
|
||||
@@ -0,0 +1,11 @@
|
||||
> In order to maintain a tight-knit experience, we designed Sonr to operate completely
|
||||
> in the point-of-view of the user. This led to us building a Component Library which
|
||||
> creates consistent UX across the entire ecosystem.
|
||||
|
||||
# Overview
|
||||
|
||||
The Sonr blockchain is a Delegated Proof of Stake (DPoS) blockchain built with the Cosmos-sdk.
|
||||
|
||||
# Nebula Package
|
||||
|
||||
> The total supply of `$SNR` is fixed at 1 billion.
|
||||
@@ -0,0 +1,104 @@
|
||||
## `x/did` - Auth & AuthZ
|
||||
|
||||
> The DID module is responsible for managing the creation and management of DIDs.
|
||||
> Controllers represent on-chain accounts backed by a MPC keypair. Controllers
|
||||
> provide methods for Wallet Account Abstraction (WAA) and are responsible for
|
||||
> managing the creation and management of DIDs for an individual user.
|
||||
|
||||
### Features
|
||||
|
||||
- DID Controllers leverage the Cosmos SDK's `x/accounts` std interface for WAA.
|
||||
- DIDs are represented by a `x/did` controller and are required to state the
|
||||
controller's public key, and which map to the controller's capabilities.
|
||||
- General Sign/Verify methods are provides from the QueryServer for HTTP requests.
|
||||
- The Execute method is used to broadcast transactions across the network. (TODO)
|
||||
- Biscuits are used to authenticate and authorize requests between services. (TODO)
|
||||
|
||||
### References
|
||||
|
||||
- [State](https://github.com/onsonr/sonr/tree/develop/x/did#state)
|
||||
- [State Transitions](https://github.com/onsonr/sonr/tree/develop/x/did#state-transitions)
|
||||
- [Messages](https://github.com/onsonr/sonr/tree/develop/x/did#messages)
|
||||
- [Queries](https://github.com/onsonr/sonr/tree/develop/x/did#query)
|
||||
- [Params](https://github.com/onsonr/sonr/tree/develop/x/did#params)
|
||||
- [Client](https://github.com/onsonr/sonr/tree/develop/x/did#client)
|
||||
- [Future Improvements](https://github.com/onsonr/sonr/tree/develop/x/did#future-improvements)
|
||||
- [Tests](https://github.com/onsonr/sonr/tree/develop/x/did#tests)
|
||||
- [Appendix](https://github.com/onsonr/sonr/tree/develop/x/did#appendix)
|
||||
|
||||
---
|
||||
|
||||
## `x/macaroon`
|
||||
|
||||
> The macaroon module is responsible for issuing and verifying macaroons. Macaroons
|
||||
> are used to authenticate and authorize requests between services.
|
||||
> Macaroons are requested by NFT Records from [`x/service`](2-‐-Modules-Overview.md#x-service) and granted by controllers from [`x/did`](2-‐-Modules-Overview.md#x/did)
|
||||
|
||||
### Features
|
||||
|
||||
- On Controller creation, a macaroon is created with an admin scope and a default expiry of _315,569,520 blocks (or ~10 years)_.
|
||||
- On Service registration, a macaroon is created with a service scope and a default expiry of _31,556,952 blocks (or ~1 year)_.
|
||||
- Macaroons contain the scope of access for a service and the expiry of the permissions in `blockHeight`.
|
||||
|
||||
### References
|
||||
|
||||
- [State](https://github.com/onsonr/sonr/tree/develop/x/macaroon#state)
|
||||
- [State Transitions](https://github.com/onsonr/sonr/tree/develop/x/macaroon#state-transitions)
|
||||
- [Messages](https://github.com/onsonr/sonr/tree/develop/x/macaroon#messages)
|
||||
- [Queries](https://github.com/onsonr/sonr/tree/develop/x/macaroon#query)
|
||||
- [Params](https://github.com/onsonr/sonr/tree/develop/x/macaroon#params)
|
||||
- [Client](https://github.com/onsonr/sonr/tree/develop/x/macaroon#client)
|
||||
- [Future Improvements](https://github.com/onsonr/sonr/tree/develop/x/macaroon#future-improvements)
|
||||
- [Tests](https://github.com/onsonr/sonr/tree/develop/x/macaroon#tests)
|
||||
- [Appendix](https://github.com/onsonr/sonr/tree/develop/x/macaroon#appendix)
|
||||
|
||||
---
|
||||
|
||||
## `x/service`
|
||||
|
||||
> The service module is responsible for managing decentralized services. Services
|
||||
> on the Sonr network are essentially on-chain MultiSig wallets that are
|
||||
> represented by a NFT. Service admins are represented by
|
||||
> a [`x/did`](2-‐-Modules-Overview.md#x-did) controller and are required to state
|
||||
> the service's scope of access, and which map to the services' capabilities.
|
||||
|
||||
### Features
|
||||
|
||||
- Needs a Valid Domain with .htaccess file to be whitelisted.
|
||||
|
||||
### References
|
||||
|
||||
- [State](https://github.com/onsonr/sonr/tree/develop/x/service#state)
|
||||
- [State Transitions](https://github.com/onsonr/sonr/tree/develop/x/service#state-transitions)
|
||||
- [Messages](https://github.com/onsonr/sonr/tree/develop/x/service#messages)
|
||||
- [Queries](https://github.com/onsonr/sonr/tree/develop/x/service#query)
|
||||
- [Params](https://github.com/onsonr/sonr/tree/develop/x/service#params)
|
||||
- [Client](https://github.com/onsonr/sonr/tree/develop/x/service#client)
|
||||
- [Future Improvements](https://github.com/onsonr/sonr/tree/develop/x/service#future-improvements)
|
||||
- [Tests](https://github.com/onsonr/sonr/tree/develop/x/service#tests)
|
||||
- [Appendix](https://github.com/onsonr/sonr/tree/develop/x/service#appendix)
|
||||
|
||||
---
|
||||
|
||||
## `x/vault`
|
||||
|
||||
> The vault module is responsible for managing the storage and acccess-control of
|
||||
> Decentralized Web Nodes (DWNs) from IPFS. Vaults contain user-facing keys and
|
||||
> are represented by a [`x/did`](2-‐-Modules-Overview.md#x-did) controller.
|
||||
|
||||
### Features
|
||||
|
||||
- Vaults can be created by anyone, but efforts are made to restrict 1 per user.
|
||||
- Vaults are stored in IPFS and when claimed, the bech32 Sonr Address is pinned to IPFS.
|
||||
|
||||
### References
|
||||
|
||||
- [State](https://github.com/onsonr/sonr/tree/develop/x/vault#state)
|
||||
- [State Transitions](https://github.com/onsonr/sonr/tree/develop/x/vault#state-transitions)
|
||||
- [Messages](https://github.com/onsonr/sonr/tree/develop/x/vault#messages)
|
||||
- [Queries](https://github.com/onsonr/sonr/tree/develop/x/vault#query)
|
||||
- [Params](https://github.com/onsonr/sonr/tree/develop/x/vault#params)
|
||||
- [Client](https://github.com/onsonr/sonr/tree/develop/x/vault#client)
|
||||
- [Future Improvements](https://github.com/onsonr/sonr/tree/develop/x/vault#future-improvements)
|
||||
- [Tests](https://github.com/onsonr/sonr/tree/develop/x/vault#tests)
|
||||
- [Appendix](https://github.com/onsonr/sonr/tree/develop/x/vault#appendix)
|
||||
@@ -0,0 +1,11 @@
|
||||
> The `$SNR` token is the native platform token of the Sonr network. It is used by services to
|
||||
> pay for Authentication and Authorization services. The system is designed for developers to
|
||||
> be similar to centralized authentication providers like Google, Facebook, Okta, etc.
|
||||
|
||||
# Usage
|
||||
|
||||
The Sonr blockchain is a Delegated Proof of Stake (DPoS) blockchain built with the Cosmos-sdk.
|
||||
|
||||
# Supply
|
||||
|
||||
> The total supply of `$SNR` is fixed at 1 billion.
|
||||
@@ -0,0 +1,11 @@
|
||||
<div style="text-align: center;">
|
||||
|
||||
# Page Not Found
|
||||
|
||||

|
||||
|
||||
The page you were looking for couldn't be found.
|
||||
|
||||
Press [[/]] to search, or [head back to the homepage](/).
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1 @@
|
||||
# Sonr Blockchain
|
||||
@@ -0,0 +1,11 @@
|
||||
<div style="text-align: center;">
|
||||
|
||||
# Page Not Found
|
||||
|
||||

|
||||
|
||||
The page you were looking for couldn't be found.
|
||||
|
||||
Press [[/]] to search, or [head back to the homepage](/).
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,47 @@
|
||||
# Introduction
|
||||
|
||||
Sonr is a decentralized identity network built on the Cosmos-sdk. It has early origins as a peer-to-peer file sharing network, but has since evolved into a platform for decentralized authentication and authorization. The early lessons taught from our file sharing roots are used as our theology for building the Sonr Blockchain.
|
||||
|
||||
1. [Cosmos-SDK](./concepts/Cosmos-SDK.md)
|
||||
2. [Chain-Modules](./concepts/Chain-Modules.md)
|
||||
3. [System-Architecture](./concepts/System-Architecture.md)
|
||||
4. [Token-Economy](./concepts/Token-Economy.md)
|
||||
5. [Service-Management](./concepts/Service-Management.md)
|
||||
6. [Design-System](./concepts/Design-System.md)
|
||||
7. [Self-Custody](./concepts/Self-Custody.md)
|
||||
8. [Consumer Launch](./concepts/Consumer-Launch.md)
|
||||
|
||||
## Principles
|
||||
|
||||
1. Bitcoin is digital gold
|
||||
2. Blockchains are programmable databases with functional operations
|
||||
3. Staking is essentially a savings account
|
||||
4. The Sonr Network conducts all operations in the $SNR token
|
||||
5. Service Delegation subsidizes user wallet operations.
|
||||
6. Cryptocurrency has the potential to break the software innovation ceiling
|
||||
|
||||
## The Problem
|
||||
|
||||
Centralized identity has led to internet monopolies abusing your trust and privacy.
|
||||
|
||||
## The Solution
|
||||
|
||||
A peer-to-peer system for decentralized personal identity with Authentication and Authorization capabilities.
|
||||
|
||||
## What is Sonr?
|
||||
|
||||
A privacy preserving, identity system managed by user controlled decentralized vaults which have the flexibility of
|
||||
software wallets with the security of hardware wallets.
|
||||
|
||||
## The End Goal
|
||||
|
||||
A Data sharing economy where human-specific information has intrinsic value. Services are incentivized to act in
|
||||
good faith in order to obtain quality user data.
|
||||
|
||||
## How do we do it?
|
||||
|
||||
Provide Internet Citizens with a robust easy to use WebVault which features a crypto wallet, passkey authenticator, and encrypted messages. The WebVault serves as a wrapper over every sensitive intent-based user interaction. The Smart blockchain is responsible for keeping a record of where WebVaults are located, when authorization activity occurs, and which services are allowed over what permissions.
|
||||
|
||||
## The User Incentive
|
||||
|
||||
Data is the byproduct of currency exchange in the Information age. Meaning services pay other services for user data or profits in order to enrich their database with complete user personas.
|
||||
@@ -0,0 +1,55 @@
|
||||
site_name: Sonr Docs
|
||||
site_description: Sonr is a decentralized identity network built on the Cosmos-sdk. It has early origins as a peer-to-peer file sharing network, but has since evolved into a platform for decentralized authentication and authorization. The early lessons taught from our file sharing roots are used as our theology for building the Sonr Blockchain.
|
||||
site_url: https://onsonr.dev
|
||||
theme:
|
||||
name: material
|
||||
features:
|
||||
- announce.dismiss
|
||||
- content.action.edit
|
||||
- content.action.view
|
||||
- content.code.annotate
|
||||
- content.code.copy
|
||||
- content.code.select
|
||||
# - content.footnote.tooltips
|
||||
# - content.tabs.link
|
||||
- content.tooltips
|
||||
- header.autohide
|
||||
# - navigation.expand
|
||||
- navigation.footer
|
||||
- navigation.indexes
|
||||
- navigation.instant
|
||||
- navigation.instant.prefetch
|
||||
# - navigation.instant.progress
|
||||
# - navigation.prune
|
||||
- navigation.sections
|
||||
- navigation.tabs
|
||||
- navigation.tabs.sticky
|
||||
- navigation.top
|
||||
- navigation.tracking
|
||||
- search.highlight
|
||||
- search.share
|
||||
- search.suggest
|
||||
- toc.follow
|
||||
- toc.integrate
|
||||
palette:
|
||||
- media: "(prefers-color-scheme)"
|
||||
toggle:
|
||||
icon: material/link
|
||||
name: Switch to light mode
|
||||
- media: "(prefers-color-scheme: light)"
|
||||
scheme: default
|
||||
primary: cyan
|
||||
accent: cyan
|
||||
toggle:
|
||||
icon: material/toggle-switch
|
||||
name: Switch to dark mode
|
||||
- media: "(prefers-color-scheme: dark)"
|
||||
scheme: slate
|
||||
primary: black
|
||||
accent: cyan
|
||||
toggle:
|
||||
icon: material/toggle-switch-off
|
||||
name: Switch to system preference
|
||||
font:
|
||||
text: Geist
|
||||
code: Geist Mono
|
||||
@@ -1,8 +1,6 @@
|
||||
module github.com/onsonr/sonr
|
||||
|
||||
go 1.23
|
||||
|
||||
toolchain go1.23.1
|
||||
go 1.23.3
|
||||
|
||||
// overrides
|
||||
replace (
|
||||
@@ -94,6 +92,7 @@ require (
|
||||
github.com/strangelove-ventures/tokenfactory v0.50.0
|
||||
github.com/stretchr/testify v1.10.0
|
||||
golang.org/x/crypto v0.30.0
|
||||
golang.org/x/exp v0.0.0-20241204233417-43b7b7cde48d
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20241007155032-5fefd90f89a9
|
||||
google.golang.org/grpc v1.67.1
|
||||
google.golang.org/protobuf v1.35.2
|
||||
@@ -354,7 +353,6 @@ require (
|
||||
go.uber.org/multierr v1.11.0 // indirect
|
||||
go.uber.org/zap v1.27.0 // indirect
|
||||
go4.org v0.0.0-20230225012048-214862532bf5 // indirect
|
||||
golang.org/x/exp v0.0.0-20241204233417-43b7b7cde48d // indirect
|
||||
golang.org/x/mod v0.22.0 // indirect
|
||||
golang.org/x/net v0.32.0 // indirect
|
||||
golang.org/x/oauth2 v0.23.0 // indirect
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
package e2e
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/strangelove-ventures/interchaintest/v8"
|
||||
"github.com/strangelove-ventures/interchaintest/v8/chain/cosmos"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.uber.org/zap/zaptest"
|
||||
)
|
||||
|
||||
func TestBasicChain(t *testing.T) {
|
||||
cf := interchaintest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*interchaintest.ChainSpec{
|
||||
&DefaultChainSpec,
|
||||
})
|
||||
|
||||
chains, err := cf.Chains(t.Name())
|
||||
require.NoError(t, err)
|
||||
|
||||
chain := chains[0].(*cosmos.CosmosChain)
|
||||
|
||||
ic := interchaintest.NewInterchain().
|
||||
AddChain(chain)
|
||||
|
||||
ctx := context.Background()
|
||||
client, network := interchaintest.DockerSetup(t)
|
||||
|
||||
require.NoError(t, ic.Build(ctx, nil, interchaintest.InterchainBuildOptions{
|
||||
TestName: t.Name(),
|
||||
Client: client,
|
||||
NetworkID: network,
|
||||
SkipPathCreation: true,
|
||||
}))
|
||||
t.Cleanup(func() {
|
||||
_ = ic.Close()
|
||||
})
|
||||
|
||||
// faucet funds to the user
|
||||
users := interchaintest.GetAndFundTestUsers(t, ctx, "default", GenesisFundsAmount, chain)
|
||||
user := users[0]
|
||||
|
||||
// balance check
|
||||
balance, err := chain.GetBalance(ctx, user.FormattedAddress(), Denom)
|
||||
require.NoError(t, err)
|
||||
require.True(t, balance.Equal(GenesisFundsAmount), "user balance should be equal to genesis funds")
|
||||
}
|
||||
@@ -1,280 +0,0 @@
|
||||
module github.com/di-dao/core/interchaintest
|
||||
|
||||
go 1.22
|
||||
|
||||
toolchain go1.22.7
|
||||
|
||||
replace (
|
||||
// not tagged properly (SDK v51)
|
||||
cosmossdk.io/core => cosmossdk.io/core v0.11.0
|
||||
github.com/ChainSafe/go-schnorrkel => github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d
|
||||
github.com/ChainSafe/go-schnorrkel/1 => github.com/ChainSafe/go-schnorrkel v1.0.0
|
||||
github.com/btcsuite/btcd => github.com/btcsuite/btcd v0.22.2 //indirect
|
||||
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1
|
||||
// breaks SDK app.toml parsing for client configs.
|
||||
github.com/spf13/viper => github.com/spf13/viper v1.17.0
|
||||
|
||||
// If using custom internal modules, replace your app here with the parent application
|
||||
// github.com/di-dao/core => ../.
|
||||
|
||||
github.com/vedhavyas/go-subkey => github.com/strangelove-ventures/go-subkey v1.0.7
|
||||
)
|
||||
|
||||
require (
|
||||
cosmossdk.io/math v1.3.0
|
||||
github.com/cosmos/cosmos-sdk v0.50.5
|
||||
github.com/cosmos/ibc-go/v8 v8.2.0
|
||||
github.com/strangelove-ventures/globalfee v0.50.0
|
||||
github.com/strangelove-ventures/interchaintest/v8 v8.1.0
|
||||
github.com/strangelove-ventures/poa v0.50.0
|
||||
github.com/strangelove-ventures/tokenfactory v0.50.0
|
||||
github.com/stretchr/testify v1.9.0
|
||||
go.uber.org/zap v1.27.0
|
||||
)
|
||||
|
||||
require (
|
||||
cloud.google.com/go v0.112.0 // indirect
|
||||
cloud.google.com/go/compute/metadata v0.5.0 // indirect
|
||||
cloud.google.com/go/iam v1.1.6 // indirect
|
||||
cloud.google.com/go/storage v1.37.0 // indirect
|
||||
cosmossdk.io/api v0.7.3 // indirect
|
||||
cosmossdk.io/collections v0.4.0 // indirect
|
||||
cosmossdk.io/core v0.12.0 // indirect
|
||||
cosmossdk.io/depinject v1.0.0-alpha.4 // indirect
|
||||
cosmossdk.io/errors v1.0.1 // indirect
|
||||
cosmossdk.io/log v1.3.1 // indirect
|
||||
cosmossdk.io/store v1.0.2 // indirect
|
||||
cosmossdk.io/x/feegrant v0.1.0 // indirect
|
||||
cosmossdk.io/x/tx v0.13.1 // indirect
|
||||
cosmossdk.io/x/upgrade v0.1.1 // indirect
|
||||
filippo.io/edwards25519 v1.0.0 // indirect
|
||||
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect
|
||||
github.com/99designs/keyring v1.2.2 // indirect
|
||||
github.com/BurntSushi/toml v1.4.0 // indirect
|
||||
github.com/ChainSafe/go-schnorrkel v1.1.0 // indirect
|
||||
github.com/ChainSafe/go-schnorrkel/1 v0.0.0-00010101000000-000000000000 // indirect
|
||||
github.com/ComposableFi/go-subkey/v2 v2.0.0-tm03420 // indirect
|
||||
github.com/DataDog/datadog-go v3.2.0+incompatible // indirect
|
||||
github.com/DataDog/zstd v1.5.5 // indirect
|
||||
github.com/FactomProject/basen v0.0.0-20150613233007-fe3947df716e // indirect
|
||||
github.com/FactomProject/btcutilecc v0.0.0-20130527213604-d3a63a5752ec // indirect
|
||||
github.com/Microsoft/go-winio v0.6.1 // indirect
|
||||
github.com/StirlingMarketingGroup/go-namecase v1.0.0 // indirect
|
||||
github.com/avast/retry-go/v4 v4.5.1 // indirect
|
||||
github.com/aws/aws-sdk-go v1.46.6 // indirect
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
|
||||
github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect
|
||||
github.com/bits-and-blooms/bitset v1.10.0 // indirect
|
||||
github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect
|
||||
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
|
||||
github.com/cespare/xxhash v1.1.0 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||
github.com/chzyer/readline v1.5.1 // indirect
|
||||
github.com/cockroachdb/errors v1.11.3 // indirect
|
||||
github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce // indirect
|
||||
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
|
||||
github.com/cockroachdb/pebble v1.1.1 // indirect
|
||||
github.com/cockroachdb/redact v1.1.5 // indirect
|
||||
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect
|
||||
github.com/cometbft/cometbft v0.38.12 // indirect
|
||||
github.com/cometbft/cometbft-db v0.11.0 // indirect
|
||||
github.com/containerd/log v0.1.0 // indirect
|
||||
github.com/cosmos/btcutil v1.0.5 // indirect
|
||||
github.com/cosmos/cosmos-db v1.0.2 // indirect
|
||||
github.com/cosmos/cosmos-proto v1.0.0-beta.4 // indirect
|
||||
github.com/cosmos/go-bip39 v1.0.0 // indirect
|
||||
github.com/cosmos/gogogateway v1.2.0 // indirect
|
||||
github.com/cosmos/gogoproto v1.7.0 // indirect
|
||||
github.com/cosmos/iavl v1.0.1 // indirect
|
||||
github.com/cosmos/ibc-go/modules/capability v1.0.0 // indirect
|
||||
github.com/cosmos/ics23/go v0.10.0 // indirect
|
||||
github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect
|
||||
github.com/danieljoos/wincred v1.2.0 // indirect
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
|
||||
github.com/deckarep/golang-set v1.8.0 // indirect
|
||||
github.com/decred/base58 v1.0.5 // indirect
|
||||
github.com/decred/dcrd/crypto/blake256 v1.0.1 // indirect
|
||||
github.com/decred/dcrd/dcrec/secp256k1/v2 v2.0.1 // indirect
|
||||
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
|
||||
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect
|
||||
github.com/dgraph-io/badger/v2 v2.2007.4 // indirect
|
||||
github.com/dgraph-io/ristretto v0.1.1 // indirect
|
||||
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect
|
||||
github.com/distribution/reference v0.5.0 // indirect
|
||||
github.com/docker/docker v25.0.6+incompatible // indirect
|
||||
github.com/docker/go-connections v0.5.0 // indirect
|
||||
github.com/docker/go-units v0.5.0 // indirect
|
||||
github.com/dustin/go-humanize v1.0.1 // indirect
|
||||
github.com/dvsekhvalnov/jose2go v1.6.0 // indirect
|
||||
github.com/emicklei/dot v1.6.1 // indirect
|
||||
github.com/ethereum/go-ethereum v1.14.0 // indirect
|
||||
github.com/fatih/color v1.15.0 // indirect
|
||||
github.com/felixge/httpsnoop v1.0.4 // indirect
|
||||
github.com/fsnotify/fsnotify v1.7.0 // indirect
|
||||
github.com/getsentry/sentry-go v0.27.0 // indirect
|
||||
github.com/go-kit/kit v0.13.0 // indirect
|
||||
github.com/go-kit/log v0.2.1 // indirect
|
||||
github.com/go-logfmt/logfmt v0.6.0 // indirect
|
||||
github.com/go-logr/logr v1.4.2 // indirect
|
||||
github.com/go-logr/stdr v1.2.2 // indirect
|
||||
github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect
|
||||
github.com/gogo/googleapis v1.4.1 // indirect
|
||||
github.com/gogo/protobuf v1.3.3 // indirect
|
||||
github.com/golang/glog v1.2.2 // indirect
|
||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
||||
github.com/golang/mock v1.6.0 // indirect
|
||||
github.com/golang/protobuf v1.5.4 // indirect
|
||||
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect
|
||||
github.com/google/btree v1.1.2 // indirect
|
||||
github.com/google/go-cmp v0.6.0 // indirect
|
||||
github.com/google/orderedcode v0.0.1 // indirect
|
||||
github.com/google/s2a-go v0.1.7 // indirect
|
||||
github.com/google/uuid v1.6.0 // indirect
|
||||
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
|
||||
github.com/googleapis/gax-go/v2 v2.12.0 // indirect
|
||||
github.com/gorilla/handlers v1.5.2 // indirect
|
||||
github.com/gorilla/mux v1.8.1 // indirect
|
||||
github.com/gorilla/websocket v1.5.3 // indirect
|
||||
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
|
||||
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect
|
||||
github.com/gtank/merlin v0.1.1 // indirect
|
||||
github.com/gtank/ristretto255 v0.1.2 // indirect
|
||||
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
|
||||
github.com/hashicorp/go-getter v1.7.5 // indirect
|
||||
github.com/hashicorp/go-hclog v1.5.0 // indirect
|
||||
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
|
||||
github.com/hashicorp/go-metrics v0.5.2 // indirect
|
||||
github.com/hashicorp/go-plugin v1.5.2 // indirect
|
||||
github.com/hashicorp/go-safetemp v1.0.0 // indirect
|
||||
github.com/hashicorp/go-version v1.6.0 // indirect
|
||||
github.com/hashicorp/golang-lru v1.0.2 // indirect
|
||||
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
|
||||
github.com/hashicorp/hcl v1.0.0 // indirect
|
||||
github.com/hashicorp/yamux v0.1.1 // indirect
|
||||
github.com/hdevalence/ed25519consensus v0.1.0 // indirect
|
||||
github.com/holiman/uint256 v1.2.4 // indirect
|
||||
github.com/huandu/skiplist v1.2.0 // indirect
|
||||
github.com/iancoleman/strcase v0.3.0 // indirect
|
||||
github.com/icza/dyno v0.0.0-20230330125955-09f820a8d9c0 // indirect
|
||||
github.com/improbable-eng/grpc-web v0.15.0 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||
github.com/ipfs/go-cid v0.4.1 // indirect
|
||||
github.com/jmespath/go-jmespath v0.4.0 // indirect
|
||||
github.com/jmhodges/levigo v1.0.0 // indirect
|
||||
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
|
||||
github.com/klauspost/compress v1.17.9 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
|
||||
github.com/kr/pretty v0.3.1 // indirect
|
||||
github.com/kr/text v0.2.0 // indirect
|
||||
github.com/lib/pq v1.10.9 // indirect
|
||||
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
|
||||
github.com/libp2p/go-libp2p v0.33.2 // indirect
|
||||
github.com/linxGnu/grocksdb v1.8.12 // indirect
|
||||
github.com/magiconair/properties v1.8.7 // indirect
|
||||
github.com/manifoldco/promptui v0.9.0 // indirect
|
||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/mimoo/StrobeGo v0.0.0-20220103164710-9a04d6ca976b // indirect
|
||||
github.com/minio/highwayhash v1.0.2 // indirect
|
||||
github.com/minio/sha256-simd v1.0.1 // indirect
|
||||
github.com/misko9/go-substrate-rpc-client/v4 v4.0.0-20230913220906-b988ea7da0c2 // indirect
|
||||
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
||||
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
|
||||
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||
github.com/mr-tron/base58 v1.2.0 // indirect
|
||||
github.com/mtibben/percent v0.2.1 // indirect
|
||||
github.com/multiformats/go-base32 v0.1.0 // indirect
|
||||
github.com/multiformats/go-base36 v0.2.0 // indirect
|
||||
github.com/multiformats/go-multiaddr v0.12.3 // indirect
|
||||
github.com/multiformats/go-multibase v0.2.0 // indirect
|
||||
github.com/multiformats/go-multicodec v0.9.0 // indirect
|
||||
github.com/multiformats/go-multihash v0.2.3 // indirect
|
||||
github.com/multiformats/go-varint v0.0.7 // indirect
|
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
||||
github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect
|
||||
github.com/oklog/run v1.1.0 // indirect
|
||||
github.com/onsi/gomega v1.30.0 // indirect
|
||||
github.com/opencontainers/go-digest v1.0.0 // indirect
|
||||
github.com/opencontainers/image-spec v1.1.0-rc5 // indirect
|
||||
github.com/pelletier/go-toml v1.9.5 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
|
||||
github.com/petermattis/goid v0.0.0-20230904192822-1876fd5063bc // indirect
|
||||
github.com/pierrec/xxHash v0.1.5 // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
|
||||
github.com/prometheus/client_golang v1.20.1 // indirect
|
||||
github.com/prometheus/client_model v0.6.1 // indirect
|
||||
github.com/prometheus/common v0.55.0 // indirect
|
||||
github.com/prometheus/procfs v0.15.1 // indirect
|
||||
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
|
||||
github.com/rogpeppe/go-internal v1.12.0 // indirect
|
||||
github.com/rs/cors v1.11.1 // indirect
|
||||
github.com/rs/zerolog v1.32.0 // indirect
|
||||
github.com/sagikazarmark/locafero v0.4.0 // indirect
|
||||
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
|
||||
github.com/sasha-s/go-deadlock v0.3.1 // indirect
|
||||
github.com/sourcegraph/conc v0.3.0 // indirect
|
||||
github.com/spaolacci/murmur3 v1.1.0 // indirect
|
||||
github.com/spf13/afero v1.11.0 // indirect
|
||||
github.com/spf13/cast v1.6.0 // indirect
|
||||
github.com/spf13/cobra v1.8.1 // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
github.com/spf13/viper v1.19.0 // indirect
|
||||
github.com/subosito/gotenv v1.6.0 // indirect
|
||||
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect
|
||||
github.com/tendermint/go-amino v0.16.0 // indirect
|
||||
github.com/tidwall/btree v1.7.0 // indirect
|
||||
github.com/tyler-smith/go-bip32 v1.0.0 // indirect
|
||||
github.com/tyler-smith/go-bip39 v1.1.0 // indirect
|
||||
github.com/ulikunitz/xz v0.5.11 // indirect
|
||||
github.com/zondax/hid v0.9.2 // indirect
|
||||
github.com/zondax/ledger-go v0.14.3 // indirect
|
||||
go.etcd.io/bbolt v1.3.10 // indirect
|
||||
go.opencensus.io v0.24.0 // indirect
|
||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.47.0 // indirect
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 // indirect
|
||||
go.opentelemetry.io/otel v1.31.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.31.0 // indirect
|
||||
go.opentelemetry.io/otel/metric v1.31.0 // indirect
|
||||
go.opentelemetry.io/otel/sdk v1.31.0 // indirect
|
||||
go.opentelemetry.io/otel/trace v1.31.0 // indirect
|
||||
go.uber.org/multierr v1.11.0 // indirect
|
||||
golang.org/x/crypto v0.28.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect
|
||||
golang.org/x/mod v0.17.0 // indirect
|
||||
golang.org/x/net v0.30.0 // indirect
|
||||
golang.org/x/oauth2 v0.22.0 // indirect
|
||||
golang.org/x/sync v0.8.0 // indirect
|
||||
golang.org/x/sys v0.26.0 // indirect
|
||||
golang.org/x/term v0.25.0 // indirect
|
||||
golang.org/x/text v0.19.0 // indirect
|
||||
golang.org/x/time v0.5.0 // indirect
|
||||
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
|
||||
google.golang.org/api v0.162.0 // indirect
|
||||
google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 // indirect
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20241007155032-5fefd90f89a9 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9 // indirect
|
||||
google.golang.org/grpc v1.67.1 // indirect
|
||||
google.golang.org/protobuf v1.35.1 // indirect
|
||||
gopkg.in/ini.v1 v1.67.0 // indirect
|
||||
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
gotest.tools/v3 v3.5.1 // indirect
|
||||
lukechampine.com/blake3 v1.2.2 // indirect
|
||||
lukechampine.com/uint128 v1.3.0 // indirect
|
||||
modernc.org/cc/v3 v3.41.0 // indirect
|
||||
modernc.org/ccgo/v3 v3.16.15 // indirect
|
||||
modernc.org/libc v1.29.0 // indirect
|
||||
modernc.org/mathutil v1.6.0 // indirect
|
||||
modernc.org/memory v1.7.2 // indirect
|
||||
modernc.org/opt v0.1.3 // indirect
|
||||
modernc.org/sqlite v1.28.0 // indirect
|
||||
modernc.org/strutil v1.2.0 // indirect
|
||||
modernc.org/token v1.1.0 // indirect
|
||||
nhooyr.io/websocket v1.8.10 // indirect
|
||||
pgregory.net/rapid v1.1.0 // indirect
|
||||
sigs.k8s.io/yaml v1.4.0 // indirect
|
||||
)
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,137 +0,0 @@
|
||||
package e2e
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"cosmossdk.io/math"
|
||||
transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"
|
||||
"github.com/strangelove-ventures/interchaintest/v8"
|
||||
"github.com/strangelove-ventures/interchaintest/v8/chain/cosmos"
|
||||
"github.com/strangelove-ventures/interchaintest/v8/ibc"
|
||||
interchaintestrelayer "github.com/strangelove-ventures/interchaintest/v8/relayer"
|
||||
"github.com/strangelove-ventures/interchaintest/v8/testreporter"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.uber.org/zap/zapcore"
|
||||
"go.uber.org/zap/zaptest"
|
||||
)
|
||||
|
||||
const (
|
||||
ibcPath = "ibc-path"
|
||||
)
|
||||
|
||||
func TestIBC(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := context.Background()
|
||||
|
||||
cfgA := DefaultChainConfig
|
||||
cfgA.ChainID = cfgA.ChainID + "-1"
|
||||
|
||||
cfgB := DefaultChainConfig
|
||||
cfgB.ChainID = cfgB.ChainID + "-2"
|
||||
|
||||
cf := interchaintest.NewBuiltinChainFactory(zaptest.NewLogger(t, zaptest.Level(zapcore.DebugLevel)), []*interchaintest.ChainSpec{
|
||||
{
|
||||
Name: DefaultChainConfig.Name,
|
||||
Version: ChainImage.Version,
|
||||
ChainName: cfgA.ChainID,
|
||||
NumValidators: &NumberVals,
|
||||
NumFullNodes: &NumberFullNodes,
|
||||
ChainConfig: cfgA,
|
||||
},
|
||||
{
|
||||
Name: DefaultChainConfig.Name,
|
||||
Version: ChainImage.Version,
|
||||
ChainName: cfgB.ChainID,
|
||||
NumValidators: &NumberVals,
|
||||
NumFullNodes: &NumberFullNodes,
|
||||
ChainConfig: cfgB,
|
||||
},
|
||||
})
|
||||
|
||||
chains, err := cf.Chains(t.Name())
|
||||
require.NoError(t, err)
|
||||
chainA, chainB := chains[0].(*cosmos.CosmosChain), chains[1].(*cosmos.CosmosChain)
|
||||
|
||||
// Relayer Factory
|
||||
client, network := interchaintest.DockerSetup(t)
|
||||
rf := interchaintest.NewBuiltinRelayerFactory(
|
||||
ibc.CosmosRly,
|
||||
zaptest.NewLogger(t, zaptest.Level(zapcore.DebugLevel)),
|
||||
interchaintestrelayer.CustomDockerImage(RelayerRepo, RelayerVersion, "100:1000"),
|
||||
interchaintestrelayer.StartupFlags("--processor", "events", "--block-history", "100"),
|
||||
)
|
||||
|
||||
r := rf.Build(t, client, network)
|
||||
|
||||
ic := interchaintest.NewInterchain().
|
||||
AddChain(chainA).
|
||||
AddChain(chainB).
|
||||
AddRelayer(r, "relayer").
|
||||
AddLink(interchaintest.InterchainLink{
|
||||
Chain1: chainA,
|
||||
Chain2: chainB,
|
||||
Relayer: r,
|
||||
Path: ibcPath,
|
||||
})
|
||||
|
||||
rep := testreporter.NewNopReporter()
|
||||
eRep := rep.RelayerExecReporter(t)
|
||||
|
||||
// Build interchain
|
||||
require.NoError(t, ic.Build(ctx, eRep, interchaintest.InterchainBuildOptions{
|
||||
TestName: t.Name(),
|
||||
Client: client,
|
||||
NetworkID: network,
|
||||
SkipPathCreation: false,
|
||||
}))
|
||||
|
||||
// Create and Fund User Wallets
|
||||
fundAmount := math.NewInt(10_000_000)
|
||||
users := interchaintest.GetAndFundTestUsers(t, ctx, "default", fundAmount, chainA, chainB)
|
||||
userA := users[0]
|
||||
userB := users[1]
|
||||
|
||||
userAInitial, err := chainA.GetBalance(ctx, userA.FormattedAddress(), chainA.Config().Denom)
|
||||
require.NoError(t, err)
|
||||
require.True(t, userAInitial.Equal(fundAmount))
|
||||
|
||||
// Get Channel ID
|
||||
aInfo, err := r.GetChannels(ctx, eRep, chainA.Config().ChainID)
|
||||
require.NoError(t, err)
|
||||
aChannelID := aInfo[0].ChannelID
|
||||
|
||||
bInfo, err := r.GetChannels(ctx, eRep, chainB.Config().ChainID)
|
||||
require.NoError(t, err)
|
||||
bChannelID := bInfo[0].ChannelID
|
||||
|
||||
// Send Transaction
|
||||
amountToSend := math.NewInt(1_000_000)
|
||||
dstAddress := userB.FormattedAddress()
|
||||
transfer := ibc.WalletAmount{
|
||||
Address: dstAddress,
|
||||
Denom: chainA.Config().Denom,
|
||||
Amount: amountToSend,
|
||||
}
|
||||
|
||||
_, err = chainA.SendIBCTransfer(ctx, aChannelID, userA.KeyName(), transfer, ibc.TransferOptions{})
|
||||
require.NoError(t, err)
|
||||
|
||||
// relay MsgRecvPacket to chainB, then MsgAcknowledgement back to chainA
|
||||
require.NoError(t, r.Flush(ctx, eRep, ibcPath, aChannelID))
|
||||
|
||||
// test source wallet has decreased funds
|
||||
expectedBal := userAInitial.Sub(amountToSend)
|
||||
aNewBal, err := chainA.GetBalance(ctx, userA.FormattedAddress(), chainA.Config().Denom)
|
||||
require.NoError(t, err)
|
||||
require.True(t, aNewBal.Equal(expectedBal))
|
||||
|
||||
// Trace IBC Denom
|
||||
srcDenomTrace := transfertypes.ParseDenomTrace(transfertypes.GetPrefixedDenom("transfer", bChannelID, chainA.Config().Denom))
|
||||
dstIbcDenom := srcDenomTrace.IBCDenom()
|
||||
|
||||
// Test destination wallet has increased funds
|
||||
bNewBal, err := chainB.GetBalance(ctx, userB.FormattedAddress(), dstIbcDenom)
|
||||
require.NoError(t, err)
|
||||
require.True(t, bNewBal.Equal(amountToSend))
|
||||
}
|
||||
@@ -1,231 +0,0 @@
|
||||
package e2e
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"cosmossdk.io/math"
|
||||
"github.com/strangelove-ventures/interchaintest/v8"
|
||||
"github.com/strangelove-ventures/interchaintest/v8/chain/cosmos"
|
||||
"github.com/strangelove-ventures/interchaintest/v8/ibc"
|
||||
interchaintestrelayer "github.com/strangelove-ventures/interchaintest/v8/relayer"
|
||||
"github.com/strangelove-ventures/interchaintest/v8/testreporter"
|
||||
"github.com/strangelove-ventures/interchaintest/v8/testutil"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.uber.org/zap/zaptest"
|
||||
|
||||
transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
)
|
||||
|
||||
type PacketMetadata struct {
|
||||
Forward *ForwardMetadata `json:"forward"`
|
||||
}
|
||||
|
||||
type ForwardMetadata struct {
|
||||
Receiver string `json:"receiver"`
|
||||
Port string `json:"port"`
|
||||
Channel string `json:"channel"`
|
||||
Timeout time.Duration `json:"timeout"`
|
||||
Retries *uint8 `json:"retries,omitempty"`
|
||||
Next *string `json:"next,omitempty"`
|
||||
RefundSequence *uint64 `json:"refund_sequence,omitempty"`
|
||||
}
|
||||
|
||||
func TestPacketForwardMiddleware(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip()
|
||||
}
|
||||
|
||||
var (
|
||||
ctx = context.Background()
|
||||
client, network = interchaintest.DockerSetup(t)
|
||||
rep = testreporter.NewNopReporter()
|
||||
eRep = rep.RelayerExecReporter(t)
|
||||
chainID_A, chainID_B, chainID_C = "chain-a", "chain-b", "chain-c"
|
||||
chainA, chainB, chainC *cosmos.CosmosChain
|
||||
)
|
||||
|
||||
// base config which all networks will use as defaults.
|
||||
baseCfg := DefaultChainConfig
|
||||
|
||||
// Set specific chain ids for each so they are their own unique networks
|
||||
baseCfg.ChainID = chainID_A
|
||||
configA := baseCfg
|
||||
|
||||
baseCfg.ChainID = chainID_B
|
||||
configB := baseCfg
|
||||
|
||||
baseCfg.ChainID = chainID_C
|
||||
configC := baseCfg
|
||||
|
||||
// Create chain factory with multiple individual networks.
|
||||
numVals := 1
|
||||
numFullNodes := 0
|
||||
|
||||
cf := interchaintest.NewBuiltinChainFactory(zaptest.NewLogger(t), []*interchaintest.ChainSpec{
|
||||
{
|
||||
Name: configA.Name,
|
||||
ChainConfig: configA,
|
||||
NumValidators: &numVals,
|
||||
NumFullNodes: &numFullNodes,
|
||||
},
|
||||
{
|
||||
Name: configA.Name,
|
||||
ChainConfig: configB,
|
||||
NumValidators: &numVals,
|
||||
NumFullNodes: &numFullNodes,
|
||||
},
|
||||
{
|
||||
Name: configA.Name,
|
||||
ChainConfig: configC,
|
||||
NumValidators: &numVals,
|
||||
NumFullNodes: &numFullNodes,
|
||||
},
|
||||
})
|
||||
|
||||
// Get chains from the chain factory
|
||||
chains, err := cf.Chains(t.Name())
|
||||
require.NoError(t, err)
|
||||
|
||||
chainA, chainB, chainC = chains[0].(*cosmos.CosmosChain), chains[1].(*cosmos.CosmosChain), chains[2].(*cosmos.CosmosChain)
|
||||
|
||||
r := interchaintest.NewBuiltinRelayerFactory(
|
||||
ibc.CosmosRly,
|
||||
zaptest.NewLogger(t),
|
||||
interchaintestrelayer.CustomDockerImage(RelayerRepo, RelayerVersion, "100:1000"),
|
||||
interchaintestrelayer.StartupFlags("--processor", "events", "--block-history", "100"),
|
||||
).Build(t, client, network)
|
||||
|
||||
const pathAB = "ab"
|
||||
const pathBC = "bc"
|
||||
|
||||
ic := interchaintest.NewInterchain().
|
||||
AddChain(chainA).
|
||||
AddChain(chainB).
|
||||
AddChain(chainC).
|
||||
AddRelayer(r, "relayer").
|
||||
AddLink(interchaintest.InterchainLink{
|
||||
Chain1: chainA,
|
||||
Chain2: chainB,
|
||||
Relayer: r,
|
||||
Path: pathAB,
|
||||
}).
|
||||
AddLink(interchaintest.InterchainLink{
|
||||
Chain1: chainB,
|
||||
Chain2: chainC,
|
||||
Relayer: r,
|
||||
Path: pathBC,
|
||||
})
|
||||
|
||||
require.NoError(t, ic.Build(ctx, eRep, interchaintest.InterchainBuildOptions{
|
||||
TestName: t.Name(),
|
||||
Client: client,
|
||||
NetworkID: network,
|
||||
BlockDatabaseFile: interchaintest.DefaultBlockDatabaseFilepath(),
|
||||
|
||||
SkipPathCreation: false,
|
||||
}))
|
||||
t.Cleanup(func() {
|
||||
_ = ic.Close()
|
||||
})
|
||||
|
||||
users := interchaintest.GetAndFundTestUsers(t, ctx, t.Name(), GenesisFundsAmount, chainA, chainB, chainC)
|
||||
|
||||
abChan, err := ibc.GetTransferChannel(ctx, r, eRep, chainID_A, chainID_B)
|
||||
require.NoError(t, err)
|
||||
|
||||
baChan := abChan.Counterparty
|
||||
|
||||
cbChan, err := ibc.GetTransferChannel(ctx, r, eRep, chainID_C, chainID_B)
|
||||
require.NoError(t, err)
|
||||
|
||||
bcChan := cbChan.Counterparty
|
||||
|
||||
// Start the relayer on all paths
|
||||
err = r.StartRelayer(ctx, eRep, pathAB, pathBC)
|
||||
require.NoError(t, err)
|
||||
|
||||
t.Cleanup(
|
||||
func() {
|
||||
err := r.StopRelayer(ctx, eRep)
|
||||
if err != nil {
|
||||
t.Logf("an error occurred while stopping the relayer: %s", err)
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
// Get original account balances
|
||||
userA, userB, userC := users[0], users[1], users[2]
|
||||
|
||||
var transferAmount math.Int = math.NewInt(100_000)
|
||||
|
||||
// Compose the prefixed denoms and ibc denom for asserting balances
|
||||
firstHopDenom := transfertypes.GetPrefixedDenom(baChan.PortID, baChan.ChannelID, chainA.Config().Denom)
|
||||
secondHopDenom := transfertypes.GetPrefixedDenom(cbChan.PortID, cbChan.ChannelID, firstHopDenom)
|
||||
|
||||
firstHopDenomTrace := transfertypes.ParseDenomTrace(firstHopDenom)
|
||||
secondHopDenomTrace := transfertypes.ParseDenomTrace(secondHopDenom)
|
||||
|
||||
firstHopIBCDenom := firstHopDenomTrace.IBCDenom()
|
||||
secondHopIBCDenom := secondHopDenomTrace.IBCDenom()
|
||||
|
||||
firstHopEscrowAccount := sdk.MustBech32ifyAddressBytes(chainA.Config().Bech32Prefix, transfertypes.GetEscrowAddress(abChan.PortID, abChan.ChannelID))
|
||||
secondHopEscrowAccount := sdk.MustBech32ifyAddressBytes(chainB.Config().Bech32Prefix, transfertypes.GetEscrowAddress(bcChan.PortID, bcChan.ChannelID))
|
||||
|
||||
t.Run("multi-hop a->b->c", func(t *testing.T) {
|
||||
// Send packet from Chain A->Chain B->Chain C
|
||||
|
||||
transfer := ibc.WalletAmount{
|
||||
Address: userB.FormattedAddress(),
|
||||
Denom: chainA.Config().Denom,
|
||||
Amount: transferAmount,
|
||||
}
|
||||
|
||||
firstHopMetadata := &PacketMetadata{
|
||||
Forward: &ForwardMetadata{
|
||||
Receiver: userC.FormattedAddress(),
|
||||
Channel: bcChan.ChannelID,
|
||||
Port: bcChan.PortID,
|
||||
},
|
||||
}
|
||||
|
||||
memo, err := json.Marshal(firstHopMetadata)
|
||||
require.NoError(t, err)
|
||||
|
||||
chainAHeight, err := chainA.Height(ctx)
|
||||
require.NoError(t, err)
|
||||
|
||||
transferTx, err := chainA.SendIBCTransfer(ctx, abChan.ChannelID, userA.KeyName(), transfer, ibc.TransferOptions{Memo: string(memo)})
|
||||
require.NoError(t, err)
|
||||
_, err = testutil.PollForAck(ctx, chainA, chainAHeight, chainAHeight+30, transferTx.Packet)
|
||||
require.NoError(t, err)
|
||||
err = testutil.WaitForBlocks(ctx, 1, chainA)
|
||||
require.NoError(t, err)
|
||||
|
||||
chainABalance, err := chainA.GetBalance(ctx, userA.FormattedAddress(), chainA.Config().Denom)
|
||||
require.NoError(t, err)
|
||||
|
||||
chainBBalance, err := chainB.GetBalance(ctx, userB.FormattedAddress(), firstHopIBCDenom)
|
||||
require.NoError(t, err)
|
||||
|
||||
chainCBalance, err := chainC.GetBalance(ctx, userC.FormattedAddress(), secondHopIBCDenom)
|
||||
require.NoError(t, err)
|
||||
|
||||
require.Equal(t, GenesisFundsAmount.Sub(transferAmount).Int64(), chainABalance.Int64())
|
||||
require.Equal(t, int64(0), chainBBalance.Int64())
|
||||
require.Equal(t, int64(100000), chainCBalance.Int64())
|
||||
|
||||
firstHopEscrowBalance, err := chainA.GetBalance(ctx, firstHopEscrowAccount, chainA.Config().Denom)
|
||||
require.NoError(t, err)
|
||||
|
||||
secondHopEscrowBalance, err := chainB.GetBalance(ctx, secondHopEscrowAccount, firstHopIBCDenom)
|
||||
require.NoError(t, err)
|
||||
|
||||
require.Equal(t, transferAmount.Int64(), firstHopEscrowBalance.Int64())
|
||||
require.Equal(t, transferAmount.Int64(), secondHopEscrowBalance.Int64())
|
||||
})
|
||||
}
|
||||
@@ -1,135 +0,0 @@
|
||||
package e2e
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
|
||||
"github.com/strangelove-ventures/interchaintest/v8/chain/cosmos"
|
||||
"github.com/strangelove-ventures/interchaintest/v8/ibc"
|
||||
"github.com/strangelove-ventures/poa"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func POASetPower(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain, user ibc.Wallet, valoper string, power int64, flags ...string) (sdk.TxResponse, error) {
|
||||
cmd := TxCommandBuilder(ctx, chain, []string{"tx", "poa", "set-power", valoper, fmt.Sprintf("%d", power)}, user.KeyName(), flags...)
|
||||
return ExecuteTransaction(ctx, chain, cmd)
|
||||
}
|
||||
|
||||
func POARemove(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain, user ibc.Wallet, valoper string) (sdk.TxResponse, error) {
|
||||
cmd := TxCommandBuilder(ctx, chain, []string{"tx", "poa", "remove", valoper}, user.KeyName())
|
||||
return ExecuteTransaction(ctx, chain, cmd)
|
||||
}
|
||||
|
||||
func POARemovePending(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain, user ibc.Wallet, valoper string) (sdk.TxResponse, error) {
|
||||
cmd := TxCommandBuilder(ctx, chain, []string{"tx", "poa", "remove-pending", valoper}, user.KeyName())
|
||||
return ExecuteTransaction(ctx, chain, cmd)
|
||||
}
|
||||
|
||||
func POACreatePendingValidator(
|
||||
t *testing.T, ctx context.Context, chain *cosmos.CosmosChain, user ibc.Wallet,
|
||||
ed25519PubKey string, moniker string, commissionRate string, commissionMaxRate string, commissionMaxChangeRate string,
|
||||
) (sdk.TxResponse, error) {
|
||||
file := "validator_file.json"
|
||||
|
||||
content := fmt.Sprintf(`{
|
||||
"pubkey": {"@type":"/cosmos.crypto.ed25519.PubKey","key":"%s"},
|
||||
"amount": "0%s",
|
||||
"moniker": "%s",
|
||||
"identity": "",
|
||||
"website": "https://website.com",
|
||||
"security": "security@cosmos.xyz",
|
||||
"details": "description",
|
||||
"commission-rate": "%s",
|
||||
"commission-max-rate": "%s",
|
||||
"commission-max-change-rate": "%s",
|
||||
"min-self-delegation": "1"
|
||||
|
||||
}`, ed25519PubKey, chain.Config().Denom, moniker, commissionRate, commissionMaxRate, commissionMaxChangeRate)
|
||||
|
||||
err := chain.GetNode().WriteFile(ctx, []byte(content), file)
|
||||
require.NoError(t, err)
|
||||
|
||||
filePath := fmt.Sprintf("%s/%s", chain.GetNode().HomeDir(), file)
|
||||
cmd := TxCommandBuilder(ctx, chain, []string{"tx", "poa", "create-validator", filePath}, user.KeyName())
|
||||
return ExecuteTransaction(ctx, chain, cmd)
|
||||
}
|
||||
|
||||
func SubmitGovernanceProposalForValidatorChanges(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain, user ibc.Wallet, validator string, power uint64, unsafe bool) string {
|
||||
govAddr := "cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn"
|
||||
|
||||
powerMsg := []cosmos.ProtoMessage{
|
||||
&poa.MsgSetPower{
|
||||
Sender: govAddr,
|
||||
ValidatorAddress: validator,
|
||||
Power: power,
|
||||
Unsafe: unsafe,
|
||||
},
|
||||
}
|
||||
|
||||
title := fmt.Sprintf("Update" + validator + "Power")
|
||||
desc := fmt.Sprintf("Updating power for validator %s to %d", validator, power)
|
||||
|
||||
proposal, err := chain.BuildProposal(powerMsg, title, desc, desc, fmt.Sprintf(`50%s`, chain.Config().Denom), user.FormattedAddress(), false)
|
||||
require.NoError(t, err, "error building proposal")
|
||||
|
||||
fmt.Printf("proposal: %+v\n", proposal)
|
||||
|
||||
txProp, err := chain.SubmitProposal(ctx, user.KeyName(), proposal)
|
||||
t.Log("txProp", txProp)
|
||||
require.NoError(t, err, "error submitting proposal")
|
||||
|
||||
return txProp.ProposalID
|
||||
}
|
||||
|
||||
func GetPOAParams(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain) poa.Params {
|
||||
var res poa.ParamsResponse
|
||||
ExecuteQuery(ctx, chain, []string{"query", "poa", "params"}, &res)
|
||||
return res.Params
|
||||
}
|
||||
|
||||
func GetPOAConsensusPower(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain, valoperAddr string) int64 {
|
||||
res, err := poa.NewQueryClient(chain.GetNode().GrpcConn).ConsensusPower(ctx, &poa.QueryConsensusPowerRequest{ValidatorAddress: valoperAddr})
|
||||
require.NoError(t, err)
|
||||
return res.ConsensusPower
|
||||
}
|
||||
|
||||
func GetPOAPending(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain) []poa.Validator {
|
||||
res, err := poa.NewQueryClient(chain.GetNode().GrpcConn).PendingValidators(ctx, &poa.QueryPendingValidatorsRequest{})
|
||||
require.NoError(t, err)
|
||||
|
||||
return res.Pending
|
||||
}
|
||||
|
||||
func POAUpdateParams(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain, user ibc.Wallet, admins []string, gracefulExit bool) (sdk.TxResponse, error) {
|
||||
// admin1,admin2,admin3
|
||||
adminList := ""
|
||||
for _, admin := range admins {
|
||||
adminList += admin + ","
|
||||
}
|
||||
adminList = adminList[:len(adminList)-1]
|
||||
|
||||
gracefulParam := "true"
|
||||
if !gracefulExit {
|
||||
gracefulParam = "false"
|
||||
}
|
||||
|
||||
cmd := TxCommandBuilder(ctx, chain, []string{"tx", "poa", "update-params", adminList, gracefulParam}, user.KeyName())
|
||||
return ExecuteTransaction(ctx, chain, cmd)
|
||||
}
|
||||
|
||||
func POAUpdateStakingParams(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain, user ibc.Wallet, sp stakingtypes.Params) (sdk.TxResponse, error) {
|
||||
command := []string{"tx", "poa", "update-staking-params",
|
||||
sp.UnbondingTime.String(),
|
||||
fmt.Sprintf("%d", sp.MaxValidators),
|
||||
fmt.Sprintf("%d", sp.MaxEntries),
|
||||
fmt.Sprintf("%d", sp.HistoricalEntries),
|
||||
sp.BondDenom,
|
||||
fmt.Sprintf("%d", sp.MinCommissionRate),
|
||||
}
|
||||
|
||||
cmd := TxCommandBuilder(ctx, chain, command, user.KeyName())
|
||||
return ExecuteTransaction(ctx, chain, cmd)
|
||||
}
|
||||
@@ -1,182 +0,0 @@
|
||||
package e2e
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
|
||||
"github.com/strangelove-ventures/interchaintest/v8"
|
||||
"github.com/strangelove-ventures/interchaintest/v8/chain/cosmos"
|
||||
"github.com/strangelove-ventures/interchaintest/v8/ibc"
|
||||
"github.com/strangelove-ventures/interchaintest/v8/testutil"
|
||||
"github.com/strangelove-ventures/poa"
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
const (
|
||||
numPOAVals = 2
|
||||
)
|
||||
|
||||
func TestPOA(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping in short mode")
|
||||
}
|
||||
|
||||
// setup base chain
|
||||
chains := interchaintest.CreateChainWithConfig(t, numPOAVals, NumberFullNodes, Name, ChainImage.Version, DefaultChainConfig)
|
||||
chain := chains[0].(*cosmos.CosmosChain)
|
||||
|
||||
enableBlockDB := false
|
||||
ctx, _, _, _ := interchaintest.BuildInitialChain(t, chains, enableBlockDB)
|
||||
|
||||
// setup accounts
|
||||
acc0, err := interchaintest.GetAndFundTestUserWithMnemonic(ctx, "acc0", AccMnemonic, GenesisFundsAmount, chain)
|
||||
require.NoError(t, err)
|
||||
acc1, err := interchaintest.GetAndFundTestUserWithMnemonic(ctx, "acc1", Acc1Mnemonic, GenesisFundsAmount, chain)
|
||||
require.NoError(t, err)
|
||||
|
||||
users := interchaintest.GetAndFundTestUsers(t, ctx, t.Name(), GenesisFundsAmount, chain)
|
||||
incorrectUser := users[0]
|
||||
|
||||
// get validator operator addresses
|
||||
vals, err := chain.StakingQueryValidators(ctx, stakingtypes.Bonded.String())
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, len(vals), numPOAVals)
|
||||
|
||||
validators := make([]string, len(vals))
|
||||
for i, v := range vals {
|
||||
validators[i] = v.OperatorAddress
|
||||
}
|
||||
|
||||
// === Test Cases ===
|
||||
testStakingDisabled(t, ctx, chain, validators, acc0, acc1)
|
||||
testPowerErrors(t, ctx, chain, validators, incorrectUser, acc0)
|
||||
testPending(t, ctx, chain, acc0)
|
||||
testRemoveValidator(t, ctx, chain, validators, acc0)
|
||||
}
|
||||
|
||||
func testRemoveValidator(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain, validators []string, acc0 ibc.Wallet) {
|
||||
t.Log("\n===== TEST REMOVE VALIDATOR =====")
|
||||
powerOne := int64(9_000_000_000_000)
|
||||
powerTwo := int64(2_500_000)
|
||||
|
||||
res, _ := POASetPower(t, ctx, chain, acc0, validators[0], powerOne, "--unsafe")
|
||||
fmt.Printf("%+v", res)
|
||||
res, _ = POASetPower(t, ctx, chain, acc0, validators[1], powerTwo, "--unsafe")
|
||||
fmt.Printf("%+v", res)
|
||||
|
||||
// decode res.TxHash into a TxResponse
|
||||
txRes, err := chain.GetTransaction(res.TxHash)
|
||||
require.NoError(t, err)
|
||||
fmt.Printf("%+v", txRes)
|
||||
|
||||
if err := testutil.WaitForBlocks(ctx, 2, chain); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
vals, err := chain.StakingQueryValidators(ctx, stakingtypes.Bonded.String())
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, fmt.Sprintf("%d", powerOne), vals[0].Tokens.String())
|
||||
require.Equal(t, fmt.Sprintf("%d", powerTwo), vals[1].Tokens.String())
|
||||
|
||||
// validate the validators both have a conesnsus-power of /1_000_000
|
||||
p1 := GetPOAConsensusPower(t, ctx, chain, vals[0].OperatorAddress)
|
||||
require.EqualValues(t, powerOne/1_000_000, p1) // = 9000000
|
||||
p2 := GetPOAConsensusPower(t, ctx, chain, vals[1].OperatorAddress)
|
||||
require.EqualValues(t, powerTwo/1_000_000, p2) // = 2
|
||||
|
||||
// remove the 2nd validator (lower power)
|
||||
POARemove(t, ctx, chain, acc0, validators[1])
|
||||
|
||||
// allow the poa.BeginBlocker to update new status
|
||||
if err := testutil.WaitForBlocks(ctx, 5, chain); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
vals, err = chain.StakingQueryValidators(ctx, stakingtypes.Bonded.String())
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, fmt.Sprintf("%d", powerOne), vals[0].Tokens.String())
|
||||
require.Equal(t, 1, len(vals))
|
||||
|
||||
vals, err = chain.StakingQueryValidators(ctx, stakingtypes.Unbonded.String())
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, "0", vals[0].Tokens.String())
|
||||
require.Equal(t, 1, len(vals))
|
||||
p2 = GetPOAConsensusPower(t, ctx, chain, vals[0].OperatorAddress)
|
||||
require.EqualValues(t, 0, p2)
|
||||
}
|
||||
|
||||
func testStakingDisabled(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain, validators []string, acc0, acc1 ibc.Wallet) {
|
||||
t.Log("\n===== TEST STAKING DISABLED =====")
|
||||
|
||||
err := chain.GetNode().StakingDelegate(ctx, acc0.KeyName(), validators[0], "1stake")
|
||||
require.Error(t, err)
|
||||
require.Contains(t, err.Error(), poa.ErrStakingActionNotAllowed.Error())
|
||||
|
||||
granter := acc1
|
||||
grantee := acc0
|
||||
|
||||
// Grant grantee (acc0) the ability to delegate from granter (acc1)
|
||||
res, err := chain.GetNode().AuthzGrant(ctx, granter, grantee.FormattedAddress(), "generic", "--msg-type", "/cosmos.staking.v1beta1.MsgDelegate")
|
||||
require.NoError(t, err)
|
||||
require.EqualValues(t, res.Code, 0)
|
||||
|
||||
// Generate nested message
|
||||
nested := []string{"tx", "staking", "delegate", validators[0], "1stake"}
|
||||
nestedCmd := TxCommandBuilder(ctx, chain, nested, granter.FormattedAddress())
|
||||
|
||||
// Execute nested message via a wrapped Exec
|
||||
_, err = chain.GetNode().AuthzExec(ctx, grantee, nestedCmd)
|
||||
require.Error(t, err)
|
||||
require.Contains(t, err.Error(), poa.ErrStakingActionNotAllowed.Error())
|
||||
}
|
||||
|
||||
func testPending(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain, acc0 ibc.Wallet) {
|
||||
t.Log("\n===== TEST PENDING =====")
|
||||
|
||||
res, _ := POACreatePendingValidator(t, ctx, chain, acc0, "pl3Q8OQwtC7G2dSqRqsUrO5VZul7l40I+MKUcejqRsg=", "testval", "0.10", "0.25", "0.05")
|
||||
require.EqualValues(t, 0, res.Code)
|
||||
|
||||
require.NoError(t, testutil.WaitForBlocks(ctx, 2, chain))
|
||||
|
||||
pv := GetPOAPending(t, ctx, chain)
|
||||
require.Equal(t, 1, len(pv))
|
||||
require.Equal(t, "0", pv[0].Tokens.String())
|
||||
require.Equal(t, "1", pv[0].MinSelfDelegation.String())
|
||||
|
||||
res, _ = POARemovePending(t, ctx, chain, acc0, pv[0].OperatorAddress)
|
||||
require.EqualValues(t, 0, res.Code)
|
||||
|
||||
// validate it was removed
|
||||
pv = GetPOAPending(t, ctx, chain)
|
||||
require.Equal(t, 0, len(pv))
|
||||
}
|
||||
|
||||
func testPowerErrors(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain, validators []string, incorrectUser ibc.Wallet, admin ibc.Wallet) {
|
||||
t.Log("\n===== TEST POWER ERRORS =====")
|
||||
var res sdk.TxResponse
|
||||
var err error
|
||||
|
||||
t.Run("fail: set-power message from a non authorized user", func(t *testing.T) {
|
||||
res, _ = POASetPower(t, ctx, chain, incorrectUser, validators[1], 1_000_000)
|
||||
res, err := chain.GetTransaction(res.TxHash)
|
||||
require.NoError(t, err)
|
||||
require.Contains(t, res.RawLog, poa.ErrNotAnAuthority.Error())
|
||||
})
|
||||
|
||||
t.Run("fail: set-power message below minimum power requirement (self bond)", func(t *testing.T) {
|
||||
res, err = POASetPower(t, ctx, chain, admin, validators[0], 1)
|
||||
require.Error(t, err) // cli validate error
|
||||
require.Contains(t, err.Error(), poa.ErrPowerBelowMinimum.Error())
|
||||
})
|
||||
|
||||
t.Run("fail: set-power message above 30%% without unsafe flag", func(t *testing.T) {
|
||||
res, _ = POASetPower(t, ctx, chain, admin, validators[0], 9_000_000_000_000_000)
|
||||
res, err := chain.GetTransaction(res.TxHash)
|
||||
require.NoError(t, err)
|
||||
require.Contains(t, res.RawLog, poa.ErrUnsafePower.Error())
|
||||
})
|
||||
}
|
||||
@@ -1,175 +0,0 @@
|
||||
package e2e
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/crypto/keyring"
|
||||
moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil"
|
||||
"github.com/strangelove-ventures/interchaintest/v8"
|
||||
"github.com/strangelove-ventures/interchaintest/v8/chain/cosmos"
|
||||
"github.com/strangelove-ventures/interchaintest/v8/ibc"
|
||||
"github.com/strangelove-ventures/interchaintest/v8/testutil"
|
||||
|
||||
sdkmath "cosmossdk.io/math"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
|
||||
globalfee "github.com/strangelove-ventures/globalfee/x/globalfee/types"
|
||||
poa "github.com/strangelove-ventures/poa"
|
||||
tokenfactory "github.com/strangelove-ventures/tokenfactory/x/tokenfactory/types"
|
||||
)
|
||||
|
||||
var (
|
||||
VotingPeriod = "15s"
|
||||
MaxDepositPeriod = "10s"
|
||||
|
||||
Denom = "usnr"
|
||||
Name = "sonr"
|
||||
ChainID = "chainid-1"
|
||||
Binary = "sonrd"
|
||||
|
||||
Bech32 = "idx"
|
||||
|
||||
NumberVals = 1
|
||||
NumberFullNodes = 0
|
||||
GenesisFundsAmount = sdkmath.NewInt(1000_000000) // 1k tokens
|
||||
|
||||
ChainImage = ibc.NewDockerImage("core", "local", "1025:1025")
|
||||
|
||||
DefaultGenesis = []cosmos.GenesisKV{
|
||||
// default
|
||||
cosmos.NewGenesisKV("app_state.gov.params.voting_period", VotingPeriod),
|
||||
cosmos.NewGenesisKV("app_state.gov.params.max_deposit_period", MaxDepositPeriod),
|
||||
cosmos.NewGenesisKV("app_state.gov.params.min_deposit.0.denom", Denom),
|
||||
cosmos.NewGenesisKV("app_state.gov.params.min_deposit.0.amount", "1"),
|
||||
// poa: gov & testing account
|
||||
cosmos.NewGenesisKV("app_state.poa.params.admins", []string{"idx10d07y265gmmuvt4z0w9aw880jnsr700j9kqcfa", "idx1hj5fveer5cjtn4wd6wstzugjfdxzl0xpecp0nd"}),
|
||||
// globalfee: set minimum fee requirements
|
||||
cosmos.NewGenesisKV("app_state.globalfee.params.minimum_gas_prices", sdk.DecCoins{sdk.NewDecCoinFromDec(Denom, sdkmath.LegacyMustNewDecFromStr("0.0"))}),
|
||||
// tokenfactory: set create cost in set denom or in gas usage.
|
||||
cosmos.NewGenesisKV("app_state.tokenfactory.params.denom_creation_fee", nil),
|
||||
cosmos.NewGenesisKV("app_state.tokenfactory.params.denom_creation_gas_consume", 1), // cost 1 gas to create a new denom
|
||||
|
||||
}
|
||||
|
||||
DefaultChainConfig = ibc.ChainConfig{
|
||||
Images: []ibc.DockerImage{
|
||||
ChainImage,
|
||||
},
|
||||
GasAdjustment: 1.5,
|
||||
ModifyGenesis: cosmos.ModifyGenesis(DefaultGenesis),
|
||||
EncodingConfig: func() *moduletestutil.TestEncodingConfig {
|
||||
cfg := cosmos.DefaultEncoding()
|
||||
// TODO: add encoding types here for the modules you want to use
|
||||
tokenfactory.RegisterInterfaces(cfg.InterfaceRegistry)
|
||||
globalfee.RegisterInterfaces(cfg.InterfaceRegistry)
|
||||
poa.RegisterInterfaces(cfg.InterfaceRegistry)
|
||||
return &cfg
|
||||
}(),
|
||||
Type: "cosmos",
|
||||
Name: Name,
|
||||
ChainID: ChainID,
|
||||
Bin: Binary,
|
||||
Bech32Prefix: Bech32,
|
||||
Denom: Denom,
|
||||
CoinType: "118",
|
||||
GasPrices: "0" + Denom,
|
||||
TrustingPeriod: "336h",
|
||||
}
|
||||
|
||||
DefaultChainSpec = interchaintest.ChainSpec{
|
||||
Name: Name,
|
||||
ChainName: Name,
|
||||
Version: ChainImage.Version,
|
||||
ChainConfig: DefaultChainConfig,
|
||||
NumValidators: &NumberVals,
|
||||
NumFullNodes: &NumberFullNodes,
|
||||
}
|
||||
|
||||
// cosmos1hj5fveer5cjtn4wd6wstzugjfdxzl0xpxvjjvr - test_node.sh
|
||||
AccMnemonic = "decorate bright ozone fork gallery riot bus exhaust worth way bone indoor calm squirrel merry zero scheme cotton until shop any excess stage laundry"
|
||||
Acc1Mnemonic = "wealth flavor believe regret funny network recall kiss grape useless pepper cram hint member few certain unveil rather brick bargain curious require crowd raise"
|
||||
|
||||
RelayerRepo = "ghcr.io/cosmos/relayer"
|
||||
RelayerVersion = "main"
|
||||
)
|
||||
|
||||
// Other Helpers
|
||||
func ExecuteQuery(ctx context.Context, chain *cosmos.CosmosChain, cmd []string, i interface{}, extraFlags ...string) {
|
||||
flags := []string{
|
||||
"--node", chain.GetRPCAddress(),
|
||||
"--output=json",
|
||||
}
|
||||
flags = append(flags, extraFlags...)
|
||||
|
||||
ExecuteExec(ctx, chain, cmd, i, flags...)
|
||||
}
|
||||
func ExecuteExec(ctx context.Context, chain *cosmos.CosmosChain, cmd []string, i interface{}, extraFlags ...string) {
|
||||
command := []string{chain.Config().Bin}
|
||||
command = append(command, cmd...)
|
||||
command = append(command, extraFlags...)
|
||||
fmt.Println(command)
|
||||
|
||||
stdout, _, err := chain.Exec(ctx, command, nil)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
|
||||
fmt.Println(string(stdout))
|
||||
if err := json.Unmarshal(stdout, &i); err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
}
|
||||
|
||||
// Executes a command from CommandBuilder
|
||||
func ExecuteTransaction(ctx context.Context, chain *cosmos.CosmosChain, cmd []string) (sdk.TxResponse, error) {
|
||||
var err error
|
||||
var stdout []byte
|
||||
|
||||
stdout, _, err = chain.Exec(ctx, cmd, nil)
|
||||
if err != nil {
|
||||
return sdk.TxResponse{}, err
|
||||
}
|
||||
|
||||
if err := testutil.WaitForBlocks(ctx, 2, chain); err != nil {
|
||||
return sdk.TxResponse{}, err
|
||||
}
|
||||
|
||||
var res sdk.TxResponse
|
||||
if err := json.Unmarshal(stdout, &res); err != nil {
|
||||
return res, err
|
||||
}
|
||||
|
||||
return res, err
|
||||
}
|
||||
|
||||
func TxCommandBuilder(ctx context.Context, chain *cosmos.CosmosChain, cmd []string, fromUser string, extraFlags ...string) []string {
|
||||
return TxCommandBuilderNode(ctx, chain.GetNode(), cmd, fromUser, extraFlags...)
|
||||
}
|
||||
|
||||
func TxCommandBuilderNode(ctx context.Context, node *cosmos.ChainNode, cmd []string, fromUser string, extraFlags ...string) []string {
|
||||
command := []string{node.Chain.Config().Bin}
|
||||
command = append(command, cmd...)
|
||||
command = append(command, "--node", node.Chain.GetRPCAddress())
|
||||
command = append(command, "--home", node.HomeDir())
|
||||
command = append(command, "--chain-id", node.Chain.Config().ChainID)
|
||||
command = append(command, "--from", fromUser)
|
||||
command = append(command, "--keyring-backend", keyring.BackendTest)
|
||||
command = append(command, "--output=json")
|
||||
command = append(command, "--yes")
|
||||
|
||||
gasFlag := false
|
||||
for _, flag := range extraFlags {
|
||||
if flag == "--gas" {
|
||||
gasFlag = true
|
||||
}
|
||||
}
|
||||
|
||||
if !gasFlag {
|
||||
command = append(command, "--gas", "500000")
|
||||
}
|
||||
|
||||
command = append(command, extraFlags...)
|
||||
return command
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
package e2e
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/strangelove-ventures/interchaintest/v8"
|
||||
"github.com/strangelove-ventures/interchaintest/v8/chain/cosmos"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestTokenFactory(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.Skip("skipping in short mode")
|
||||
}
|
||||
|
||||
// setup base chain
|
||||
chains := interchaintest.CreateChainWithConfig(t, NumberVals, NumberFullNodes, Name, ChainImage.Version, DefaultChainConfig)
|
||||
chain := chains[0].(*cosmos.CosmosChain)
|
||||
ctx, ic, _, _ := interchaintest.BuildInitialChain(t, chains, false)
|
||||
|
||||
users := interchaintest.GetAndFundTestUsers(t, ctx, "default", GenesisFundsAmount, chain, chain)
|
||||
user := users[0]
|
||||
user2 := users[1]
|
||||
|
||||
uaddr := user.FormattedAddress()
|
||||
uaddr2 := user2.FormattedAddress()
|
||||
|
||||
node := chain.GetNode()
|
||||
|
||||
tfDenom, _, err := node.TokenFactoryCreateDenom(ctx, user, "ictestdenom", 2_500_00)
|
||||
t.Log("TF Denom: ", tfDenom)
|
||||
require.NoError(t, err)
|
||||
|
||||
t.Log("Mint TF Denom to user")
|
||||
node.TokenFactoryMintDenom(ctx, user.FormattedAddress(), tfDenom, 100)
|
||||
if balance, err := chain.GetBalance(ctx, uaddr, tfDenom); err != nil {
|
||||
t.Fatal(err)
|
||||
} else if balance.Int64() != 100 {
|
||||
t.Fatal("balance not 100")
|
||||
}
|
||||
|
||||
t.Log("Mint TF Denom to another user")
|
||||
node.TokenFactoryMintDenomTo(ctx, user.FormattedAddress(), tfDenom, 70, user2.FormattedAddress())
|
||||
if balance, err := chain.GetBalance(ctx, uaddr2, tfDenom); err != nil {
|
||||
t.Fatal(err)
|
||||
} else if balance.Int64() != 70 {
|
||||
t.Fatal("balance not 70")
|
||||
}
|
||||
|
||||
t.Log("Change admin to uaddr2")
|
||||
_, err = node.TokenFactoryChangeAdmin(ctx, user.KeyName(), tfDenom, uaddr2)
|
||||
require.NoError(t, err)
|
||||
|
||||
// ensure the admin is the contract
|
||||
res, err := chain.TokenFactoryQueryAdmin(ctx, tfDenom)
|
||||
require.NoError(t, err)
|
||||
require.EqualValues(t, res.AuthorityMetadata.Admin, uaddr2, "admin not uaddr2. Did not properly transfer.")
|
||||
|
||||
t.Cleanup(func() {
|
||||
_ = ic.Close()
|
||||
})
|
||||
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package context
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/onsonr/sonr/pkg/common"
|
||||
"github.com/onsonr/sonr/pkg/database/sessions"
|
||||
"github.com/segmentio/ksuid"
|
||||
)
|
||||
|
||||
// InitSession initializes or loads an existing session
|
||||
func (s *HTTPContext) InitSession() error {
|
||||
sessionID := s.getOrCreateSessionID()
|
||||
|
||||
// Try to load existing session
|
||||
var sess sessions.Session
|
||||
result := s.db.Where("id = ?", sessionID).First(&sess)
|
||||
if result.Error != nil {
|
||||
// Create new session if not found
|
||||
bn, bv, arch, plat, platVer, model := extractBrowserInfo(s.Context)
|
||||
sess = sessions.Session{
|
||||
ID: sessionID,
|
||||
BrowserName: bn,
|
||||
BrowserVersion: bv,
|
||||
UserArchitecture: arch,
|
||||
Platform: plat,
|
||||
PlatformVersion: platVer,
|
||||
DeviceModel: model,
|
||||
}
|
||||
if err := s.db.Create(&sess).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
s.sess = &sess
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *HTTPContext) getOrCreateSessionID() string {
|
||||
if ok := common.CookieExists(s.Context, common.SessionID); !ok {
|
||||
sessionID := ksuid.New().String()
|
||||
common.WriteCookie(s.Context, common.SessionID, sessionID)
|
||||
return sessionID
|
||||
}
|
||||
|
||||
sessionID, err := common.ReadCookie(s.Context, common.SessionID)
|
||||
if err != nil {
|
||||
sessionID = ksuid.New().String()
|
||||
common.WriteCookie(s.Context, common.SessionID, sessionID)
|
||||
}
|
||||
return sessionID
|
||||
}
|
||||
|
||||
func extractBrowserInfo(c echo.Context) (string, string, string, string, string, string) {
|
||||
// Extract all relevant headers
|
||||
browserName := common.HeaderRead(c, common.UserAgent)
|
||||
arch := common.HeaderRead(c, common.Architecture)
|
||||
platform := common.HeaderRead(c, common.Platform)
|
||||
platformVer := common.HeaderRead(c, common.PlatformVersion)
|
||||
model := common.HeaderRead(c, common.Model)
|
||||
fullVersionList := common.HeaderRead(c, common.FullVersionList)
|
||||
|
||||
// Default values if headers are empty
|
||||
if browserName == "" {
|
||||
browserName = "N/A"
|
||||
}
|
||||
if arch == "" {
|
||||
arch = "unknown"
|
||||
}
|
||||
if platform == "" {
|
||||
platform = "unknown"
|
||||
}
|
||||
if platformVer == "" {
|
||||
platformVer = "unknown"
|
||||
}
|
||||
if model == "" {
|
||||
model = "unknown"
|
||||
}
|
||||
|
||||
// Extract browser version from full version list
|
||||
version := "-1"
|
||||
if fullVersionList != "" {
|
||||
entries := strings.Split(strings.TrimSpace(fullVersionList), ",")
|
||||
for _, entry := range entries {
|
||||
entry = strings.TrimSpace(entry)
|
||||
re := regexp.MustCompile(`"([^"]+)";v="([^"]+)"`)
|
||||
matches := re.FindStringSubmatch(entry)
|
||||
|
||||
if len(matches) == 3 {
|
||||
browserName = matches[1]
|
||||
version = matches[2]
|
||||
if browserName != "Not.A/Brand" &&
|
||||
browserName != "Chromium" {
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return browserName, version, arch, platform, platformVer, model
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package context
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/labstack/echo/v4"
|
||||
config "github.com/onsonr/sonr/pkg/config/hway"
|
||||
"github.com/onsonr/sonr/pkg/database/sessions"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// Middleware creates a new session middleware
|
||||
func Middleware(db *gorm.DB, env config.Hway) echo.MiddlewareFunc {
|
||||
return func(next echo.HandlerFunc) echo.HandlerFunc {
|
||||
return func(c echo.Context) error {
|
||||
cc := NewHTTPContext(c, db)
|
||||
if err := cc.InitSession(); err != nil {
|
||||
return err
|
||||
}
|
||||
return next(cc)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// HTTPContext is the context for HTTP endpoints.
|
||||
type HTTPContext struct {
|
||||
echo.Context
|
||||
db *gorm.DB
|
||||
sess *sessions.Session
|
||||
env config.Hway
|
||||
}
|
||||
|
||||
// Get returns the HTTPContext from the echo context
|
||||
func Get(c echo.Context) (*HTTPContext, error) {
|
||||
ctx, ok := c.(*HTTPContext)
|
||||
if !ok {
|
||||
return nil, echo.NewHTTPError(http.StatusInternalServerError, "Session Context not found")
|
||||
}
|
||||
return ctx, nil
|
||||
}
|
||||
|
||||
// NewHTTPContext creates a new session context
|
||||
func NewHTTPContext(c echo.Context, db *gorm.DB) *HTTPContext {
|
||||
return &HTTPContext{
|
||||
Context: c,
|
||||
db: db,
|
||||
}
|
||||
}
|
||||
|
||||
// Session returns the current session
|
||||
func (s *HTTPContext) Session() *sessions.Session {
|
||||
return s.sess
|
||||
}
|
||||
@@ -0,0 +1,168 @@
|
||||
package context
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/onsonr/sonr/pkg/database/sessions"
|
||||
)
|
||||
|
||||
// ╭───────────────────────────────────────────────────────╮
|
||||
// │ DB Setter Functions │
|
||||
// ╰───────────────────────────────────────────────────────╯
|
||||
|
||||
// SetUserHandle sets the user handle in the session
|
||||
func SetUserHandle(c echo.Context, handle string) error {
|
||||
sess, err := Get(c)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
sess.Session().UserHandle = handle
|
||||
return sess.db.Save(sess.Session()).Error
|
||||
}
|
||||
|
||||
// SetFirstName sets the first name in the session
|
||||
func SetFirstName(c echo.Context, name string) error {
|
||||
sess, err := Get(c)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
sess.Session().FirstName = name
|
||||
return sess.db.Save(sess.Session()).Error
|
||||
}
|
||||
|
||||
// SetLastInitial sets the last initial in the session
|
||||
func SetLastInitial(c echo.Context, initial string) error {
|
||||
sess, err := Get(c)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
sess.Session().LastInitial = initial
|
||||
return sess.db.Save(sess.Session()).Error
|
||||
}
|
||||
|
||||
// SetVaultAddress sets the vault address in the session
|
||||
func SetVaultAddress(c echo.Context, address string) error {
|
||||
sess, err := Get(c)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
sess.Session().VaultAddress = address
|
||||
return sess.db.Save(sess.Session()).Error
|
||||
}
|
||||
|
||||
// ╭───────────────────────────────────────────────────────╮
|
||||
// │ DB Getter Functions │
|
||||
// ╰───────────────────────────────────────────────────────╯
|
||||
|
||||
// GetID returns the session ID
|
||||
func GetID(c echo.Context) (string, error) {
|
||||
sess, err := Get(c)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return sess.Session().ID, nil
|
||||
}
|
||||
|
||||
// GetBrowserName returns the browser name
|
||||
func GetBrowserName(c echo.Context) (string, error) {
|
||||
sess, err := Get(c)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return sess.Session().BrowserName, nil
|
||||
}
|
||||
|
||||
// GetBrowserVersion returns the browser version
|
||||
func GetBrowserVersion(c echo.Context) (string, error) {
|
||||
sess, err := Get(c)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return sess.Session().BrowserVersion, nil
|
||||
}
|
||||
|
||||
// GetUserArchitecture returns the user architecture
|
||||
func GetUserArchitecture(c echo.Context) (string, error) {
|
||||
sess, err := Get(c)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return sess.Session().UserArchitecture, nil
|
||||
}
|
||||
|
||||
// GetPlatform returns the platform
|
||||
func GetPlatform(c echo.Context) (string, error) {
|
||||
sess, err := Get(c)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return sess.Session().Platform, nil
|
||||
}
|
||||
|
||||
// GetPlatformVersion returns the platform version
|
||||
func GetPlatformVersion(c echo.Context) (string, error) {
|
||||
sess, err := Get(c)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return sess.Session().PlatformVersion, nil
|
||||
}
|
||||
|
||||
// GetDeviceModel returns the device model
|
||||
func GetDeviceModel(c echo.Context) (string, error) {
|
||||
sess, err := Get(c)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return sess.Session().DeviceModel, nil
|
||||
}
|
||||
|
||||
// GetUserHandle returns the user handle
|
||||
func GetUserHandle(c echo.Context) (string, error) {
|
||||
sess, err := Get(c)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return sess.Session().UserHandle, nil
|
||||
}
|
||||
|
||||
// GetFirstName returns the first name
|
||||
func GetFirstName(c echo.Context) (string, error) {
|
||||
sess, err := Get(c)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return sess.Session().FirstName, nil
|
||||
}
|
||||
|
||||
// GetLastInitial returns the last initial
|
||||
func GetLastInitial(c echo.Context) (string, error) {
|
||||
sess, err := Get(c)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return sess.Session().LastInitial, nil
|
||||
}
|
||||
|
||||
// GetVaultAddress returns the vault address
|
||||
func GetVaultAddress(c echo.Context) (string, error) {
|
||||
sess, err := Get(c)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return sess.Session().VaultAddress, nil
|
||||
}
|
||||
|
||||
// HandleExists checks if a handle already exists in any session
|
||||
func HandleExists(c echo.Context, handle string) (bool, error) {
|
||||
sess, err := Get(c)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
var count int64
|
||||
if err := sess.db.Model(&sessions.Session{}).Where("user_handle = ?", handle).Count(&count).Error; err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
return count > 0, nil
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package index
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/onsonr/sonr/internal/gateway/context"
|
||||
)
|
||||
|
||||
// Initial users have no authorization, user handle, or vault address
|
||||
func isInitial(c echo.Context) bool {
|
||||
sess, err := context.Get(c)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
data := sess.Session()
|
||||
return data.UserHandle == "" && data.VaultAddress == ""
|
||||
}
|
||||
|
||||
// Expired users have either a user handle or vault address
|
||||
func isExpired(c echo.Context) bool {
|
||||
sess, err := context.Get(c)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
data := sess.Session()
|
||||
return data.UserHandle != "" || data.VaultAddress != ""
|
||||
}
|
||||
|
||||
// Returning users have a valid authorization, and either a user handle or vault address
|
||||
func isReturning(c echo.Context) bool {
|
||||
sess, err := context.Get(c)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
data := sess.Session()
|
||||
return data.UserHandle != "" && data.VaultAddress != ""
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package index
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/onsonr/sonr/pkg/common/response"
|
||||
)
|
||||
|
||||
func Handler(c echo.Context) error {
|
||||
if isExpired(c) {
|
||||
return response.TemplEcho(c, ReturningView())
|
||||
}
|
||||
return response.TemplEcho(c, InitialView())
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package index
|
||||
|
||||
import (
|
||||
"github.com/onsonr/sonr/internal/nebula/card"
|
||||
"github.com/onsonr/sonr/internal/nebula/layout"
|
||||
"github.com/onsonr/sonr/internal/nebula/text"
|
||||
)
|
||||
|
||||
templ InitialView() {
|
||||
@layout.View("Sonr.ID") {
|
||||
@card.Container() {
|
||||
@text.TitleDescription("Sonr.ID", "The decentralized identity layer for the web.")
|
||||
<div class="pt-1.5 mb-3 flex flex-col items-center justify-center h-full">
|
||||
<sl-button size="large" hx-target="#container" hx-get="/register" hx-push-url="/register" type="button">
|
||||
<sl-icon slot="prefix" library="sonr" name="sonr"></sl-icon>
|
||||
Get Started
|
||||
<sl-icon slot="suffix" library="sonr" name="arrow-right"></sl-icon>
|
||||
</sl-button>
|
||||
</div>
|
||||
<div class="pt-1.5 flex flex-row items-center justify-center h-full gap-3">
|
||||
<sl-button circle outline href="https://sonr.io">
|
||||
<sl-icon name="home" library="sonr" label="Home"></sl-icon>
|
||||
</sl-button>
|
||||
<sl-button circle outline href="https://onsonr.dev">
|
||||
<sl-icon name="docs" library="sonr" label="Docs"></sl-icon>
|
||||
</sl-button>
|
||||
<sl-button circle outline href="https://github.com/onsonr/sonr">
|
||||
<sl-icon name="social-github" library="sonr" label="Open Source"></sl-icon>
|
||||
</sl-button>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
templ ReturningView() {
|
||||
@layout.View("Login | Sonr.ID") {
|
||||
@card.Container() {
|
||||
@text.TitleDescription("Welcome Back!", "Continue with your existing Sonr.ID.")
|
||||
<div class="pt-3 flex flex-col items-center justify-center h-full">
|
||||
<sl-button hx-target="#container" hx-get="/register" type="button">
|
||||
<sl-icon slot="prefix" library="sonr" name="sonr"></sl-icon>
|
||||
Log back in
|
||||
<sl-icon slot="suffix" library="sonr" name="arrow-right"></sl-icon>
|
||||
</sl-button>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
}
|
||||
+10
-9
@@ -9,8 +9,9 @@ import "github.com/a-h/templ"
|
||||
import templruntime "github.com/a-h/templ/runtime"
|
||||
|
||||
import (
|
||||
"github.com/onsonr/sonr/pkg/styles/layout"
|
||||
"github.com/onsonr/sonr/pkg/styles/text"
|
||||
"github.com/onsonr/sonr/internal/nebula/card"
|
||||
"github.com/onsonr/sonr/internal/nebula/layout"
|
||||
"github.com/onsonr/sonr/internal/nebula/text"
|
||||
)
|
||||
|
||||
func InitialView() templ.Component {
|
||||
@@ -58,23 +59,23 @@ func InitialView() templ.Component {
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Err = text.Header("Sonr.ID", "The decentralized identity layer for the web.").Render(ctx, templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = text.TitleDescription("Sonr.ID", "The decentralized identity layer for the web.").Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" <div class=\"pt-3 flex flex-col items-center justify-center h-full\"><sl-button hx-target=\"#container\" hx-get=\"/register\" type=\"button\"><sl-icon slot=\"prefix\" library=\"sonr\" name=\"sonr\"></sl-icon> Get Started <sl-icon slot=\"suffix\" library=\"sonr\" name=\"arrow-right\"></sl-icon></sl-button></div>")
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" <div class=\"pt-1.5 mb-3 flex flex-col items-center justify-center h-full\"><sl-button size=\"large\" hx-target=\"#container\" hx-get=\"/register\" hx-push-url=\"/register\" type=\"button\"><sl-icon slot=\"prefix\" library=\"sonr\" name=\"sonr\"></sl-icon> Get Started <sl-icon slot=\"suffix\" library=\"sonr\" name=\"arrow-right\"></sl-icon></sl-button></div><div class=\"pt-1.5 flex flex-row items-center justify-center h-full gap-3\"><sl-button circle outline href=\"https://sonr.io\"><sl-icon name=\"home\" library=\"sonr\" label=\"Home\"></sl-icon></sl-button> <sl-button circle outline href=\"https://onsonr.dev\"><sl-icon name=\"docs\" library=\"sonr\" label=\"Docs\"></sl-icon></sl-button> <sl-button circle outline href=\"https://github.com/onsonr/sonr\"><sl-icon name=\"social-github\" library=\"sonr\" label=\"Open Source\"></sl-icon></sl-button></div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
templ_7745c5c3_Err = layout.Container().Render(templ.WithChildren(ctx, templ_7745c5c3_Var3), templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = card.Container().Render(templ.WithChildren(ctx, templ_7745c5c3_Var3), templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
templ_7745c5c3_Err = layout.Root("Welcome | Sonr.ID").Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = layout.View("Sonr.ID").Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
@@ -127,7 +128,7 @@ func ReturningView() templ.Component {
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Err = text.Header("Welcome Back!", "Continue with your existing Sonr.ID.").Render(ctx, templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = text.TitleDescription("Welcome Back!", "Continue with your existing Sonr.ID.").Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
@@ -137,13 +138,13 @@ func ReturningView() templ.Component {
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
templ_7745c5c3_Err = layout.Container().Render(templ.WithChildren(ctx, templ_7745c5c3_Var6), templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = card.Container().Render(templ.WithChildren(ctx, templ_7745c5c3_Var6), templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
templ_7745c5c3_Err = layout.Root("Login | Sonr.ID").Render(templ.WithChildren(ctx, templ_7745c5c3_Var5), templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = layout.View("Login | Sonr.ID").Render(templ.WithChildren(ctx, templ_7745c5c3_Var5), templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package register
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/labstack/echo/v4"
|
||||
"golang.org/x/exp/rand"
|
||||
)
|
||||
|
||||
// Define the credential structure matching our frontend data
|
||||
type Credential struct {
|
||||
Handle string `json:"handle"`
|
||||
ID string `json:"id"`
|
||||
RawID string `json:"rawId"`
|
||||
Type string `json:"type"`
|
||||
AuthenticatorAttachment string `json:"authenticatorAttachment"`
|
||||
Transports string `json:"transports"`
|
||||
ClientExtensionResults map[string]string `json:"clientExtensionResults"`
|
||||
Response struct {
|
||||
AttestationObject string `json:"attestationObject"`
|
||||
ClientDataJSON string `json:"clientDataJSON"`
|
||||
} `json:"response"`
|
||||
}
|
||||
|
||||
type CreateProfileData struct {
|
||||
TurnstileSiteKey string
|
||||
FirstNumber int
|
||||
LastNumber int
|
||||
}
|
||||
|
||||
type RegisterPasskeyData struct {
|
||||
Address string
|
||||
Handle string
|
||||
Name string
|
||||
Challenge string
|
||||
CreationBlock string
|
||||
}
|
||||
|
||||
func (d CreateProfileData) IsHumanLabel() string {
|
||||
return fmt.Sprintf("What is %d + %d?", d.FirstNumber, d.LastNumber)
|
||||
}
|
||||
|
||||
func extractCredentialDescriptor(jsonString string) (*Credential, error) {
|
||||
cred := &Credential{}
|
||||
// Unmarshal the credential JSON
|
||||
if err := json.Unmarshal([]byte(jsonString), cred); err != nil {
|
||||
return nil, echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("invalid credential format: %v", err))
|
||||
}
|
||||
|
||||
// Validate required fields
|
||||
if cred.ID == "" || cred.RawID == "" {
|
||||
return nil, echo.NewHTTPError(http.StatusBadRequest, "missing credential ID")
|
||||
}
|
||||
if cred.Type != "public-key" {
|
||||
return nil, echo.NewHTTPError(http.StatusBadRequest, "invalid credential type")
|
||||
}
|
||||
if cred.Response.AttestationObject == "" || cred.Response.ClientDataJSON == "" {
|
||||
return nil, echo.NewHTTPError(http.StatusBadRequest, "missing attestation data")
|
||||
}
|
||||
|
||||
// Log detailed credential information
|
||||
fmt.Printf("Credential Details:\n"+
|
||||
"ID: %s\n"+
|
||||
"Raw ID: %s\n"+
|
||||
"Type: %s\n"+
|
||||
"Authenticator Attachment: %s\n"+
|
||||
"Transports: %v\n"+
|
||||
cred.ID,
|
||||
cred.RawID,
|
||||
cred.Type,
|
||||
cred.AuthenticatorAttachment,
|
||||
cred.Transports,
|
||||
)
|
||||
return cred, nil
|
||||
}
|
||||
|
||||
func randomCreateProfileData() CreateProfileData {
|
||||
return CreateProfileData{
|
||||
FirstNumber: rand.Intn(5) + 1,
|
||||
LastNumber: rand.Intn(4) + 1,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package register
|
||||
|
||||
import (
|
||||
"github.com/onsonr/sonr/internal/nebula/card"
|
||||
"github.com/onsonr/sonr/internal/nebula/form"
|
||||
"github.com/onsonr/sonr/internal/nebula/input"
|
||||
)
|
||||
|
||||
templ formCreateProfile(action string, method string, data CreateProfileData) {
|
||||
@form.Root(action, method, "create-profile") {
|
||||
@form.Body() {
|
||||
@form.Header() {
|
||||
<sl-progress-bar value="50"></sl-progress-bar>
|
||||
}
|
||||
@input.Name()
|
||||
@input.Handle()
|
||||
@input.HumanSlider(data.FirstNumber, data.LastNumber)
|
||||
@form.Footer() {
|
||||
@form.CancelButton()
|
||||
@form.SubmitButton("Next")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
templ formRegisterPasskey(action, method string, data RegisterPasskeyData) {
|
||||
<form action={ templ.SafeURL(action) } method={ method } id="passkey-form">
|
||||
<input type="hidden" name="credential" id="credential-data" required/>
|
||||
<sl-card class="card-form gap-4 max-w-xl">
|
||||
<div slot="header">
|
||||
<div class="w-full py-2">
|
||||
@card.SonrProfile(data.Address, data.Name, data.Handle, data.CreationBlock)
|
||||
</div>
|
||||
</div>
|
||||
@input.CoinSelect()
|
||||
<div slot="footer" class="space-y-2">
|
||||
@input.Passkey(data.Address, data.Handle, data.Challenge)
|
||||
<sl-button href="/" style="width: 100%;" outline>
|
||||
<sl-icon slot="prefix" name="x-lg"></sl-icon>
|
||||
Cancel
|
||||
</sl-button>
|
||||
</div>
|
||||
<style>
|
||||
.card-form [slot='footer'] {
|
||||
justify-content: space-evenly;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
</sl-card>
|
||||
</form>
|
||||
}
|
||||
@@ -0,0 +1,233 @@
|
||||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.2.793
|
||||
package register
|
||||
|
||||
//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"
|
||||
|
||||
import (
|
||||
"github.com/onsonr/sonr/internal/nebula/card"
|
||||
"github.com/onsonr/sonr/internal/nebula/form"
|
||||
"github.com/onsonr/sonr/internal/nebula/input"
|
||||
)
|
||||
|
||||
func formCreateProfile(action string, method string, data CreateProfileData) 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_Var3 := 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_Var4 := 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("<sl-progress-bar value=\"50\"></sl-progress-bar>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
templ_7745c5c3_Err = form.Header().Render(templ.WithChildren(ctx, templ_7745c5c3_Var4), templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = input.Name().Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = input.Handle().Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = input.HumanSlider(data.FirstNumber, data.LastNumber).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Var5 := 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 = form.CancelButton().Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = form.SubmitButton("Next").Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
templ_7745c5c3_Err = form.Footer().Render(templ.WithChildren(ctx, templ_7745c5c3_Var5), templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
templ_7745c5c3_Err = form.Body().Render(templ.WithChildren(ctx, templ_7745c5c3_Var3), templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
templ_7745c5c3_Err = form.Root(action, method, "create-profile").Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
func formRegisterPasskey(action, method string, data RegisterPasskeyData) 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_Var6 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var6 == nil {
|
||||
templ_7745c5c3_Var6 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<form action=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var7 templ.SafeURL = templ.SafeURL(action)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var7)))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" method=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var8 string
|
||||
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(method)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/gateway/handlers/register/forms.templ`, Line: 27, Col: 55}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" id=\"passkey-form\"><input type=\"hidden\" name=\"credential\" id=\"credential-data\" required> <sl-card class=\"card-form gap-4 max-w-xl\"><div slot=\"header\"><div class=\"w-full py-2\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = card.SonrProfile(data.Address, data.Name, data.Handle, data.CreationBlock).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div></div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = input.CoinSelect().Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div slot=\"footer\" class=\"space-y-2\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = input.Passkey(data.Address, data.Handle, data.Challenge).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<sl-button href=\"/\" style=\"width: 100%;\" outline><sl-icon slot=\"prefix\" name=\"x-lg\"></sl-icon> Cancel</sl-button></div><style>\n \t\t.card-form [slot='footer'] {\n \t\tjustify-content: space-evenly;\n \t\talign-items: center;\n \t\t}\n\t\t</style></sl-card></form>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
var _ = templruntime.GeneratedTemplate
|
||||
@@ -0,0 +1,49 @@
|
||||
package register
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/go-webauthn/webauthn/protocol"
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/onsonr/sonr/crypto/mpc"
|
||||
"github.com/onsonr/sonr/pkg/common/response"
|
||||
)
|
||||
|
||||
func HandleCreateProfile(c echo.Context) error {
|
||||
d := randomCreateProfileData()
|
||||
return response.TemplEcho(c, ProfileFormView(d))
|
||||
}
|
||||
|
||||
func HandlePasskeyStart(c echo.Context) error {
|
||||
challenge, _ := protocol.CreateChallenge()
|
||||
handle := c.FormValue("handle")
|
||||
firstName := c.FormValue("first_name")
|
||||
lastName := c.FormValue("last_name")
|
||||
|
||||
ks, err := mpc.NewKeyset()
|
||||
if err != nil {
|
||||
return echo.NewHTTPError(http.StatusInternalServerError, err.Error())
|
||||
}
|
||||
dat := RegisterPasskeyData{
|
||||
Address: ks.Address(),
|
||||
Handle: handle,
|
||||
Name: fmt.Sprintf("%s %s", firstName, lastName),
|
||||
Challenge: challenge.String(),
|
||||
CreationBlock: "00001",
|
||||
}
|
||||
return response.TemplEcho(c, LinkCredentialView(dat))
|
||||
}
|
||||
|
||||
func HandlePasskeyFinish(c echo.Context) error {
|
||||
// Get the raw credential JSON string
|
||||
credentialJSON := c.FormValue("credential")
|
||||
if credentialJSON == "" {
|
||||
return echo.NewHTTPError(http.StatusBadRequest, "missing credential data")
|
||||
}
|
||||
_, err := extractCredentialDescriptor(credentialJSON)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return response.TemplEcho(c, LoadingVaultView())
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package register
|
||||
|
||||
import (
|
||||
"github.com/onsonr/sonr/internal/nebula/card"
|
||||
"github.com/onsonr/sonr/internal/nebula/layout"
|
||||
"github.com/onsonr/sonr/internal/nebula/text"
|
||||
)
|
||||
|
||||
templ ProfileFormView(data CreateProfileData) {
|
||||
@layout.View("New Profile | Sonr.ID") {
|
||||
@card.Container() {
|
||||
@text.TitleDescription("Basic Info", "Tell us a little about yourself.")
|
||||
@formCreateProfile("/register/start", "POST", data)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
templ LinkCredentialView(data RegisterPasskeyData) {
|
||||
@layout.View("Register | Sonr.ID") {
|
||||
@card.Container() {
|
||||
@text.TitleDescription("Link a PassKey", "This will be used to login to your vault.")
|
||||
@formRegisterPasskey("/register/finish", "POST", data)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
templ LoadingVaultView() {
|
||||
@layout.View("Loading... | Sonr.ID") {
|
||||
@card.Container() {
|
||||
@text.TitleDescription("Loading Vault", "This will be used to login to your vault.")
|
||||
}
|
||||
}
|
||||
}
|
||||
+28
-123
@@ -9,13 +9,12 @@ import "github.com/a-h/templ"
|
||||
import templruntime "github.com/a-h/templ/runtime"
|
||||
|
||||
import (
|
||||
"github.com/onsonr/sonr/pkg/styles/details"
|
||||
"github.com/onsonr/sonr/pkg/styles/form"
|
||||
"github.com/onsonr/sonr/pkg/styles/layout"
|
||||
"github.com/onsonr/sonr/pkg/styles/text"
|
||||
"github.com/onsonr/sonr/internal/nebula/card"
|
||||
"github.com/onsonr/sonr/internal/nebula/layout"
|
||||
"github.com/onsonr/sonr/internal/nebula/text"
|
||||
)
|
||||
|
||||
func ProfileFormView(turnstileSiteKey string) templ.Component {
|
||||
func ProfileFormView(data CreateProfileData) 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 {
|
||||
@@ -60,61 +59,27 @@ func ProfileFormView(turnstileSiteKey string) templ.Component {
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Err = text.Header("Create a Profile", "Enter some basic information about yourself.").Render(ctx, templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = text.TitleDescription("Basic Info", "Tell us a little about yourself.").Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" <br>")
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Var4 := 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 = form.NameInput().Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" <br>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = form.HandleInput().Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = form.TurnstileWidget(turnstileSiteKey).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
templ_7745c5c3_Err = form.Form("/register/start", "POST", form.Submit("Continue"), "25", true).Render(templ.WithChildren(ctx, templ_7745c5c3_Var4), templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = formCreateProfile("/register/start", "POST", data).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
templ_7745c5c3_Err = layout.Container().Render(templ.WithChildren(ctx, templ_7745c5c3_Var3), templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = card.Container().Render(templ.WithChildren(ctx, templ_7745c5c3_Var3), templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
templ_7745c5c3_Err = layout.Root("Sonr.ID").Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = layout.View("New Profile | Sonr.ID").Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
@@ -122,7 +87,7 @@ func ProfileFormView(turnstileSiteKey string) templ.Component {
|
||||
})
|
||||
}
|
||||
|
||||
func LinkCredentialView(req LinkCredentialRequest) templ.Component {
|
||||
func LinkCredentialView(data RegisterPasskeyData) 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 {
|
||||
@@ -138,12 +103,12 @@ func LinkCredentialView(req LinkCredentialRequest) templ.Component {
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var5 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var5 == nil {
|
||||
templ_7745c5c3_Var5 = templ.NopComponent
|
||||
templ_7745c5c3_Var4 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var4 == nil {
|
||||
templ_7745c5c3_Var4 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
templ_7745c5c3_Var6 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_Var5 := 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 {
|
||||
@@ -155,7 +120,7 @@ func LinkCredentialView(req LinkCredentialRequest) templ.Component {
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var7 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_Var6 := 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 {
|
||||
@@ -167,87 +132,27 @@ func LinkCredentialView(req LinkCredentialRequest) templ.Component {
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Err = text.Header("Link a PassKey", "This will be used to login to your vault.").Render(ctx, templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = text.TitleDescription("Link a PassKey", "This will be used to login to your vault.").Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" <br>")
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Var8 := 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_Var9 := 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 = details.Property("Address", req.Address, "wallet").Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = details.Property("Handle", req.Handle, "at-sign").Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = details.Property("Platform", req.Platform, "device-iphone").Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = details.Property("Model", req.DeviceModel, "laptop").Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
templ_7745c5c3_Err = details.PropertyList().Render(templ.WithChildren(ctx, templ_7745c5c3_Var9), templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
templ_7745c5c3_Err = form.Form("/register/finish", "POST", form.PasskeyInput("passkey"), "65", false).Render(templ.WithChildren(ctx, templ_7745c5c3_Var8), templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = formRegisterPasskey("/register/finish", "POST", data).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
templ_7745c5c3_Err = layout.Container().Render(templ.WithChildren(ctx, templ_7745c5c3_Var7), templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = card.Container().Render(templ.WithChildren(ctx, templ_7745c5c3_Var6), templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
templ_7745c5c3_Err = layout.Root("Sonr.ID").Render(templ.WithChildren(ctx, templ_7745c5c3_Var6), templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = layout.View("Register | Sonr.ID").Render(templ.WithChildren(ctx, templ_7745c5c3_Var5), templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
@@ -271,12 +176,12 @@ func LoadingVaultView() templ.Component {
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var10 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var10 == nil {
|
||||
templ_7745c5c3_Var10 = templ.NopComponent
|
||||
templ_7745c5c3_Var7 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var7 == nil {
|
||||
templ_7745c5c3_Var7 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
templ_7745c5c3_Var11 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_Var8 := 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 {
|
||||
@@ -288,7 +193,7 @@ func LoadingVaultView() templ.Component {
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var12 := templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||
templ_7745c5c3_Var9 := 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 {
|
||||
@@ -300,19 +205,19 @@ func LoadingVaultView() templ.Component {
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Err = text.Header("Loading Vault", "This will be used to login to your vault.").Render(ctx, templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = text.TitleDescription("Loading Vault", "This will be used to login to your vault.").Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
templ_7745c5c3_Err = layout.Container().Render(templ.WithChildren(ctx, templ_7745c5c3_Var12), templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = card.Container().Render(templ.WithChildren(ctx, templ_7745c5c3_Var9), templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
templ_7745c5c3_Err = layout.Root("Sonr.ID").Render(templ.WithChildren(ctx, templ_7745c5c3_Var11), templ_7745c5c3_Buffer)
|
||||
templ_7745c5c3_Err = layout.View("Loading... | Sonr.ID").Render(templ.WithChildren(ctx, templ_7745c5c3_Var8), templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
// Package gateway provides the default routes for the Sonr hway.
|
||||
package gateway
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/onsonr/sonr/internal/gateway/context"
|
||||
"github.com/onsonr/sonr/internal/gateway/handlers/index"
|
||||
"github.com/onsonr/sonr/internal/gateway/handlers/register"
|
||||
"github.com/onsonr/sonr/pkg/common/response"
|
||||
config "github.com/onsonr/sonr/pkg/config/hway"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
func RegisterRoutes(e *echo.Echo, env config.Hway, db *gorm.DB) error {
|
||||
// Custom error handler for gateway
|
||||
e.HTTPErrorHandler = response.RedirectOnError("http://localhost:3000")
|
||||
|
||||
// Inject session middleware with database connection
|
||||
e.Use(context.Middleware(db, env))
|
||||
|
||||
// Register routes
|
||||
e.GET("/", index.Handler)
|
||||
e.GET("/register", register.HandleCreateProfile)
|
||||
e.POST("/register/start", register.HandlePasskeyStart)
|
||||
e.POST("/register/finish", register.HandlePasskeyFinish)
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package card
|
||||
|
||||
templ Container() {
|
||||
<div id="container" class="flex fixed inset-0 z-[99] w-screen min-h-screen">
|
||||
<div class="relative flex flex-wrap items-center w-full min-h-full px-4 py-6 sm:px-6 md:px-8">
|
||||
<div class="relative w-full max-w-screen-lg mx-auto">
|
||||
<div class="flex flex-col items-center justify-center min-h-full gap-4">
|
||||
{ children... }
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
+11
-3
@@ -1,14 +1,14 @@
|
||||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.2.793
|
||||
package internal
|
||||
package card
|
||||
|
||||
//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"
|
||||
|
||||
func ProfileForm() templ.Component {
|
||||
func Container() 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 {
|
||||
@@ -29,7 +29,15 @@ func ProfileForm() templ.Component {
|
||||
templ_7745c5c3_Var1 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"relative w-full max-w-sm mx-auto lg:mb-0\"><div class=\"relative text-center\"><div class=\"flex flex-col mb-6 space-y-2\"><span><wa-qr-code size=\"140\" value=\"https://shoelace.style/\"></wa-qr-code></span><h1 class=\"text-2xl lg:text-3xl font-bold pb-3\"><span>Shoelace</span></h1><p class=\"text-lg text-zinc-500\">A lightweight library for building accessible, high-performance UI components with no dependencies.</p></div><div class=\"max-w-xs mx-auto sm:max-w-none sm:inline-flex sm:justify-center space-y-4 sm:space-y-0 sm:space-x-4\"><button class=\"inline-flex items-center justify-center w-full h-10 px-4 py-2 text-sm font-medium text-white transition-colors duration-200 rounded-md bg-neutral-950 hover:bg-neutral-900 focus:ring-2 focus:ring-offset-2 focus:ring-neutral-900\">Get started</button></div></div></div>")
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div id=\"container\" class=\"flex fixed inset-0 z-[99] w-screen min-h-screen\"><div class=\"relative flex flex-wrap items-center w-full min-h-full px-4 py-6 sm:px-6 md:px-8\"><div class=\"relative w-full max-w-screen-lg mx-auto\"><div class=\"flex flex-col items-center justify-center min-h-full gap-4\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templ_7745c5c3_Var1.Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div></div></div></div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package card
|
||||
|
||||
templ SonrProfile(addr, name, handle, creationBlock string) {
|
||||
<div class="profile-card min-w-[320px]">
|
||||
<div class="text-white max-w-xs my-auto mx-auto bg-gradient-to-r from-cyan-700 to-cyan-300 p-4 py-5 px-5 rounded-xl">
|
||||
<div class="flex justify-between">
|
||||
<div>
|
||||
<h2>sonr-testnet-1</h2>
|
||||
<p class="text-2xl font-bold">{ handle }</p>
|
||||
</div>
|
||||
<div class="flex items-center opacity-60">
|
||||
<sl-icon style="font-size: 52px;" library="sonr" name="sonr-fill"></sl-icon>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-5 flex justify-between items-center w-52">
|
||||
<span class="text-lg font-mono">{ shortenAddress(addr) }</span>
|
||||
</div>
|
||||
<div class="flex justify-between mt-5 w-48 ">
|
||||
<div>
|
||||
<h3 class="text-xs">Block Created </h3>
|
||||
<p class="font-bold"><span>#</span>{ creationBlock }</p>
|
||||
</div>
|
||||
<div>
|
||||
<h3 class="text-xs">Issued to</h3>
|
||||
<p class="font-bold">{ name }</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
// Helper function to shorten address
|
||||
func shortenAddress(address string) string {
|
||||
if len(address) <= 20 {
|
||||
return address
|
||||
}
|
||||
return address[:16] + "..." + address[len(address)-4:]
|
||||
}
|
||||
@@ -1,14 +1,14 @@
|
||||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.2.793
|
||||
package button
|
||||
package card
|
||||
|
||||
//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"
|
||||
|
||||
func Primary(href string, text string) templ.Component {
|
||||
func SonrProfile(addr, name, handle, creationBlock string) 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 {
|
||||
@@ -29,75 +29,59 @@ func Primary(href string, text string) templ.Component {
|
||||
templ_7745c5c3_Var1 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div><div class=\"btn cursor-pointer text-zinc-100 bg-zinc-900 hover:bg-zinc-800 w-full shadow\" hx-swap=\"afterend\" hx-get=\"")
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"profile-card min-w-[320px]\"><div class=\"text-white max-w-xs my-auto mx-auto bg-gradient-to-r from-cyan-700 to-cyan-300 p-4 py-5 px-5 rounded-xl\"><div class=\"flex justify-between\"><div><h2>sonr-testnet-1</h2><p class=\"text-2xl font-bold\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var2 string
|
||||
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(href)
|
||||
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(handle)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/styles/button/default.templ`, Line: 5, Col: 124}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/nebula/card/sonr_profile.templ`, Line: 9, Col: 43}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\">")
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</p></div><div class=\"flex items-center opacity-60\"><sl-icon style=\"font-size: 52px;\" library=\"sonr\" name=\"sonr-fill\"></sl-icon></div></div><div class=\"mt-5 flex justify-between items-center w-52\"><span class=\"text-lg font-mono\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var3 string
|
||||
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(text)
|
||||
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(shortenAddress(addr))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/styles/button/default.templ`, Line: 6, Col: 9}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/nebula/card/sonr_profile.templ`, Line: 16, Col: 58}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div></div>")
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</span></div><div class=\"flex justify-between mt-5 w-48 \"><div><h3 class=\"text-xs\">Block Created </h3><p class=\"font-bold\"><span>#</span>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
func Secondary(href string, text string) 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
|
||||
var templ_7745c5c3_Var4 string
|
||||
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(creationBlock)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/nebula/card/sonr_profile.templ`, Line: 21, Col: 55}
|
||||
}
|
||||
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
|
||||
}
|
||||
}()
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
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 = templ_7745c5c3_Buffer.WriteString("<div><div x-on:click=\"toast('Default Toast Notification', 'default', '', 'top-center')\" class=\"btn cursor-pointer text-zinc-600 bg-white hover:text-zinc-900 w-full shadow\">")
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</p></div><div><h3 class=\"text-xs\">Issued to</h3><p class=\"font-bold\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var5 string
|
||||
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(text)
|
||||
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(name)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/styles/button/default.templ`, Line: 13, Col: 175}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/nebula/card/sonr_profile.templ`, Line: 25, Col: 32}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div></div>")
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</p></div></div></div></div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
@@ -105,4 +89,12 @@ func Secondary(href string, text string) templ.Component {
|
||||
})
|
||||
}
|
||||
|
||||
// Helper function to shorten address
|
||||
func shortenAddress(address string) string {
|
||||
if len(address) <= 20 {
|
||||
return address
|
||||
}
|
||||
return address[:16] + "..." + address[len(address)-4:]
|
||||
}
|
||||
|
||||
var _ = templruntime.GeneratedTemplate
|
||||
@@ -0,0 +1,58 @@
|
||||
package form
|
||||
|
||||
templ Root(action, method, id string) {
|
||||
<form action={ templ.SafeURL(action) } method={ method } id={ id }>
|
||||
{ children... }
|
||||
</form>
|
||||
}
|
||||
|
||||
templ Header() {
|
||||
<div slot="header">
|
||||
<div class="w-full py-2">
|
||||
{ children... }
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
templ Body() {
|
||||
<sl-card class="card-form max-w-lg mx-auto">
|
||||
{ children... }
|
||||
<style>
|
||||
.card-form {
|
||||
space-y: 1rem;
|
||||
}
|
||||
|
||||
.card-form [slot='header'] {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.card-form [slot='footer'] {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
</sl-card>
|
||||
}
|
||||
|
||||
templ Footer() {
|
||||
<div slot="footer">
|
||||
{ children... }
|
||||
</div>
|
||||
}
|
||||
|
||||
templ CancelButton() {
|
||||
<sl-button href="/" outline>
|
||||
<sl-icon slot="prefix" name="x-lg"></sl-icon>
|
||||
Cancel
|
||||
</sl-button>
|
||||
}
|
||||
|
||||
templ SubmitButton(text string) {
|
||||
<sl-button type="submit">
|
||||
{ text }
|
||||
<sl-icon slot="suffix" name="arrow-right" library="sonr"></sl-icon>
|
||||
</sl-button>
|
||||
}
|
||||
@@ -8,10 +8,7 @@ package form
|
||||
import "github.com/a-h/templ"
|
||||
import templruntime "github.com/a-h/templ/runtime"
|
||||
|
||||
import "github.com/onsonr/sonr/pkg/styles/layout"
|
||||
|
||||
// Form is a standard form styled like a card
|
||||
func Form(action string, method string, submit templ.Component, progress string, enableCancel bool) templ.Component {
|
||||
func Root(action, method, id string) 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 {
|
||||
@@ -48,26 +45,26 @@ func Form(action string, method string, submit templ.Component, progress string,
|
||||
var templ_7745c5c3_Var3 string
|
||||
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(method)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/styles/form/form.templ`, Line: 7, Col: 55}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/nebula/form/base.templ`, Line: 4, Col: 55}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\"><sl-card class=\"card-form gap-4 max-w-lg\"><div slot=\"header\"><div class=\"w-full py-1\"><sl-progress-bar value=\"")
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" id=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var4 string
|
||||
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(progress)
|
||||
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(id)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/styles/form/form.templ`, Line: 11, Col: 38}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/nebula/form/base.templ`, Line: 4, Col: 65}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\"></sl-progress-bar></div></div>")
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
@@ -75,21 +72,7 @@ func Form(action string, method string, submit templ.Component, progress string,
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div slot=\"footer\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
if enableCancel {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<sl-button href=\"/\" outline><sl-icon slot=\"prefix\" name=\"arrow-left\" library=\"sonr\"></sl-icon> Cancel</sl-button>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
templ_7745c5c3_Err = submit.Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div><style>\n \t\t.card-form [slot='footer'] {\n \t\tdisplay: flex;\n \t\tjustify-content: space-between;\n \t\talign-items: center;\n \t\t}\n\t\t</style></sl-card></form>")
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</form>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
@@ -97,7 +80,7 @@ func Form(action string, method string, submit templ.Component, progress string,
|
||||
})
|
||||
}
|
||||
|
||||
func NameInput() templ.Component {
|
||||
func Header() 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 {
|
||||
@@ -118,25 +101,15 @@ func NameInput() templ.Component {
|
||||
templ_7745c5c3_Var5 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
templ_7745c5c3_Var6 := 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("<sl-input name=\"first_name\" placeholder=\"Steve\" type=\"text\" label=\"First Name\" required autofocus></sl-input> <sl-input name=\"last_name\" placeholder=\"J\" maxlength=\"1\" type=\"text\" label=\"Last Initial\"></sl-input>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div slot=\"header\"><div class=\"w-full py-2\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
templ_7745c5c3_Err = layout.Rows().Render(templ.WithChildren(ctx, templ_7745c5c3_Var6), templ_7745c5c3_Buffer)
|
||||
}
|
||||
templ_7745c5c3_Err = templ_7745c5c3_Var5.Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div></div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
@@ -144,7 +117,44 @@ func NameInput() templ.Component {
|
||||
})
|
||||
}
|
||||
|
||||
func HandleInput() templ.Component {
|
||||
func Body() 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_Var6 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var6 == nil {
|
||||
templ_7745c5c3_Var6 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<sl-card class=\"card-form max-w-lg mx-auto\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templ_7745c5c3_Var6.Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<style>\n\t\t.card-form {\n\t\t\t\tspace-y: 1rem;\n\t\t}\n\n \t.card-form [slot='header'] {\n \tdisplay: flex;\n \talign-items: center;\n \t justify-content: space-between;\n\t }\n\n\t .card-form [slot='footer'] {\n \t \tdisplay: flex;\n \tjustify-content: space-between;\n \talign-items: center;\n \t}\n\t\t</style></sl-card>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
func Footer() 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 {
|
||||
@@ -165,7 +175,15 @@ func HandleInput() templ.Component {
|
||||
templ_7745c5c3_Var7 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<sl-input name=\"handle\" placeholder=\"thoughtdiff\" type=\"text\" label=\"Handle\" minlength=\"4\" maxlength=\"12\" required><div slot=\"prefix\"><sl-icon name=\"at-sign\" library=\"sonr\"></sl-icon></div></sl-input>")
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div slot=\"footer\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
templ_7745c5c3_Err = templ_7745c5c3_Var7.Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
@@ -173,7 +191,7 @@ func HandleInput() templ.Component {
|
||||
})
|
||||
}
|
||||
|
||||
func CodeInput(id string) templ.Component {
|
||||
func CancelButton() 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 {
|
||||
@@ -194,20 +212,7 @@ func CodeInput(id string) templ.Component {
|
||||
templ_7745c5c3_Var8 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<sl-input id=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var9 string
|
||||
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(id)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/styles/form/form.templ`, Line: 51, Col: 18}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" placeholder=\"●\" type=\"text\" maxlength=\"1\" pill class=\"w-min\"></sl-input>")
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<sl-button href=\"/\" outline><sl-icon slot=\"prefix\" name=\"x-lg\"></sl-icon> Cancel</sl-button>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
@@ -215,8 +220,7 @@ func CodeInput(id string) templ.Component {
|
||||
})
|
||||
}
|
||||
|
||||
// Hidden input and button which calls a javascript function to generate a passkey
|
||||
func PasskeyInput(id string) templ.Component {
|
||||
func SubmitButton(text string) 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 {
|
||||
@@ -232,98 +236,21 @@ func PasskeyInput(id string) templ.Component {
|
||||
}()
|
||||
}
|
||||
ctx = templ.InitializeContext(ctx)
|
||||
templ_7745c5c3_Var10 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var10 == nil {
|
||||
templ_7745c5c3_Var10 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
templ_7745c5c3_Err = CredentialsScripts().Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<sl-button type=\"submit\" pill style=\"width: 100%;\"><sl-icon slot=\"prefix\" name=\"passkey\" library=\"sonr\" style=\"font-size: 20px;\"></sl-icon> Create PassKey <sl-icon slot=\"suffix\" name=\"arrow-right\" library=\"sonr\" style=\"font-size: 20px;\"></sl-icon></sl-button>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
func TurnstileWidget(sitekey string) 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_Var11 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var11 == nil {
|
||||
templ_7745c5c3_Var11 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
if sitekey != "" {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<br><div class=\"cf-turnstile\" data-sitekey=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var12 string
|
||||
templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(sitekey)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/styles/form/form.templ`, Line: 67, Col: 50}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\"></div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
func Submit(text string) 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_Var13 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var13 == nil {
|
||||
templ_7745c5c3_Var13 = templ.NopComponent
|
||||
templ_7745c5c3_Var9 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var9 == nil {
|
||||
templ_7745c5c3_Var9 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<sl-button type=\"submit\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var14 string
|
||||
templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(text)
|
||||
var templ_7745c5c3_Var10 string
|
||||
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(text)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `pkg/styles/form/form.templ`, Line: 73, Col: 8}
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/nebula/form/base.templ`, Line: 55, Col: 8}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14))
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package input
|
||||
|
||||
type Coin struct {
|
||||
Ticker string
|
||||
Name string
|
||||
IsDefault bool
|
||||
}
|
||||
|
||||
var defaultCoins = []Coin{
|
||||
{Ticker: "SNR", Name: "Sonr", IsDefault: true},
|
||||
{Ticker: "BTC", Name: "Bitcoin", IsDefault: true},
|
||||
{Ticker: "ETH", Name: "Ethereum", IsDefault: true},
|
||||
{Ticker: "SOL", Name: "Solana", IsDefault: false},
|
||||
{Ticker: "LTC", Name: "Litecoin", IsDefault: false},
|
||||
{Ticker: "DOGE", Name: "Dogecoin", IsDefault: false},
|
||||
{Ticker: "XRP", Name: "Ripple", IsDefault: false},
|
||||
{Ticker: "OSMO", Name: "Osmosis", IsDefault: false},
|
||||
{Ticker: "ATOM", Name: "Cosmos", IsDefault: false},
|
||||
{Ticker: "STARZ", Name: "Stargaze", IsDefault: false},
|
||||
{Ticker: "AKT", Name: "Akash", IsDefault: false},
|
||||
{Ticker: "EVMOS", Name: "Evmos", IsDefault: false},
|
||||
{Ticker: "FIL", Name: "Filecoin", IsDefault: false},
|
||||
{Ticker: "AXL", Name: "Axelar", IsDefault: false},
|
||||
}
|
||||
|
||||
templ CoinSelect() {
|
||||
<sl-select
|
||||
label="Accounts"
|
||||
name="selected_assets"
|
||||
value="SNR BTC ETH"
|
||||
help-text="Select Blockchains to connect with your Vault"
|
||||
multiple
|
||||
class="custom-tag py-2"
|
||||
>
|
||||
for _, a := range defaultCoins {
|
||||
@CoinOption(a)
|
||||
}
|
||||
</sl-select>
|
||||
<script>
|
||||
const select = document.querySelector('.custom-tag');
|
||||
select.getTag = (option, index) => {
|
||||
// Use the same icon used in the <sl-option>
|
||||
const name = option.querySelector('sl-icon[slot="prefix"]').name;
|
||||
|
||||
// You can return a string, a Lit Template, or an HTMLElement here
|
||||
return `
|
||||
<sl-tag removable>
|
||||
<sl-icon name="${name}" library="crypto" style="padding-inline-end: .5rem;"></sl-icon>
|
||||
${option.getTextLabel()}
|
||||
</sl-tag>
|
||||
`;
|
||||
};
|
||||
</script>
|
||||
}
|
||||
|
||||
templ CoinOption(a Coin) {
|
||||
if a.IsDefault {
|
||||
<sl-option value={ a.Ticker } selected disabled>
|
||||
<sl-icon slot="prefix" name={ a.Ticker } library="crypto"></sl-icon>
|
||||
{ a.Name }
|
||||
</sl-option>
|
||||
<sl-divider></sl-divider>
|
||||
} else {
|
||||
<sl-option value={ a.Ticker }>
|
||||
<sl-icon slot="prefix" name={ a.Ticker } library="crypto"></sl-icon>
|
||||
{ a.Name }
|
||||
</sl-option>
|
||||
<sl-divider></sl-divider>
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,187 @@
|
||||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.2.793
|
||||
package input
|
||||
|
||||
//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"
|
||||
|
||||
type Coin struct {
|
||||
Ticker string
|
||||
Name string
|
||||
IsDefault bool
|
||||
}
|
||||
|
||||
var defaultCoins = []Coin{
|
||||
{Ticker: "SNR", Name: "Sonr", IsDefault: true},
|
||||
{Ticker: "BTC", Name: "Bitcoin", IsDefault: true},
|
||||
{Ticker: "ETH", Name: "Ethereum", IsDefault: true},
|
||||
{Ticker: "SOL", Name: "Solana", IsDefault: false},
|
||||
{Ticker: "LTC", Name: "Litecoin", IsDefault: false},
|
||||
{Ticker: "DOGE", Name: "Dogecoin", IsDefault: false},
|
||||
{Ticker: "XRP", Name: "Ripple", IsDefault: false},
|
||||
{Ticker: "OSMO", Name: "Osmosis", IsDefault: false},
|
||||
{Ticker: "ATOM", Name: "Cosmos", IsDefault: false},
|
||||
{Ticker: "STARZ", Name: "Stargaze", IsDefault: false},
|
||||
{Ticker: "AKT", Name: "Akash", IsDefault: false},
|
||||
{Ticker: "EVMOS", Name: "Evmos", IsDefault: false},
|
||||
{Ticker: "FIL", Name: "Filecoin", IsDefault: false},
|
||||
{Ticker: "AXL", Name: "Axelar", IsDefault: false},
|
||||
}
|
||||
|
||||
func CoinSelect() 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_Err = templ_7745c5c3_Buffer.WriteString("<sl-select label=\"Accounts\" name=\"selected_assets\" value=\"SNR BTC ETH\" help-text=\"Select Blockchains to connect with your Vault\" multiple class=\"custom-tag py-2\">")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
for _, a := range defaultCoins {
|
||||
templ_7745c5c3_Err = CoinOption(a).Render(ctx, templ_7745c5c3_Buffer)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</sl-select><script>\n\t const select = document.querySelector('.custom-tag');\n select.getTag = (option, index) => {\n // Use the same icon used in the <sl-option>\n const name = option.querySelector('sl-icon[slot=\"prefix\"]').name;\n\n // You can return a string, a Lit Template, or an HTMLElement here\n return `\n <sl-tag removable>\n <sl-icon name=\"${name}\" library=\"crypto\" style=\"padding-inline-end: .5rem;\"></sl-icon>\n ${option.getTextLabel()}\n </sl-tag>\n `;\n };\n\t</script>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
func CoinOption(a Coin) 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_Var2 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var2 == nil {
|
||||
templ_7745c5c3_Var2 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
if a.IsDefault {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<sl-option value=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var3 string
|
||||
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(a.Ticker)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/nebula/input/coin_select.templ`, Line: 58, Col: 29}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" selected disabled><sl-icon slot=\"prefix\" name=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var4 string
|
||||
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(a.Ticker)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/nebula/input/coin_select.templ`, Line: 59, Col: 41}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" library=\"crypto\"></sl-icon> ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var5 string
|
||||
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(a.Name)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/nebula/input/coin_select.templ`, Line: 60, Col: 11}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</sl-option> <sl-divider></sl-divider>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
} else {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<sl-option value=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var6 string
|
||||
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(a.Ticker)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/nebula/input/coin_select.templ`, Line: 64, Col: 29}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\"><sl-icon slot=\"prefix\" name=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var7 string
|
||||
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(a.Ticker)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/nebula/input/coin_select.templ`, Line: 65, Col: 41}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" library=\"crypto\"></sl-icon> ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var8 string
|
||||
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(a.Name)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/nebula/input/coin_select.templ`, Line: 66, Col: 11}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</sl-option> <sl-divider></sl-divider>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
var _ = templruntime.GeneratedTemplate
|
||||
@@ -0,0 +1,43 @@
|
||||
package input
|
||||
|
||||
type HandleState string
|
||||
|
||||
const (
|
||||
HandleStateInitial HandleState = "inital"
|
||||
HandleStateValid HandleState = "valid"
|
||||
HandleStateInvalid HandleState = "invalid"
|
||||
)
|
||||
|
||||
func (s HandleState) string() string {
|
||||
return string(s)
|
||||
}
|
||||
|
||||
templ Handle() {
|
||||
<sl-input name="handle" placeholder="digitalgold" type="text" label="Handle" minlength="4" maxlength="12" required>
|
||||
<div slot="prefix">
|
||||
<sl-icon name="at-sign" library="sonr"></sl-icon>
|
||||
</div>
|
||||
</sl-input>
|
||||
<br/>
|
||||
}
|
||||
|
||||
templ HandleError() {
|
||||
<sl-input name="handle" placeholder="digitalgold" type="text" label="Handle" minlength="4" maxlength="12" required class="border-red-500">
|
||||
<div slot="prefix">
|
||||
<sl-icon name="at-sign" library="sonr"></sl-icon>
|
||||
</div>
|
||||
<div slot="suffix" style="color: #B54549;">
|
||||
<sl-icon name="at-sign" library="sonr"></sl-icon>
|
||||
</div>
|
||||
</sl-input>
|
||||
<br/>
|
||||
}
|
||||
|
||||
templ HandleValid() {
|
||||
<sl-input name="handle" placeholder="digitalgold" type="text" label="Handle" minlength="4" maxlength="12" required class="border-green-500">
|
||||
<div slot="prefix" style="color: #46A758;">
|
||||
<sl-icon name="at-sign" library="sonr"></sl-icon>
|
||||
</div>
|
||||
</sl-input>
|
||||
<br/>
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.2.793
|
||||
package input
|
||||
|
||||
//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"
|
||||
|
||||
type HandleState string
|
||||
|
||||
const (
|
||||
HandleStateInitial HandleState = "inital"
|
||||
HandleStateValid HandleState = "valid"
|
||||
HandleStateInvalid HandleState = "invalid"
|
||||
)
|
||||
|
||||
func (s HandleState) string() string {
|
||||
return string(s)
|
||||
}
|
||||
|
||||
func Handle() 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_Err = templ_7745c5c3_Buffer.WriteString("<sl-input name=\"handle\" placeholder=\"digitalgold\" type=\"text\" label=\"Handle\" minlength=\"4\" maxlength=\"12\" required><div slot=\"prefix\"><sl-icon name=\"at-sign\" library=\"sonr\"></sl-icon></div></sl-input><br>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
func HandleError() 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_Var2 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var2 == nil {
|
||||
templ_7745c5c3_Var2 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<sl-input name=\"handle\" placeholder=\"digitalgold\" type=\"text\" label=\"Handle\" minlength=\"4\" maxlength=\"12\" required class=\"border-red-500\"><div slot=\"prefix\"><sl-icon name=\"at-sign\" library=\"sonr\"></sl-icon></div><div slot=\"suffix\" style=\"color: #B54549;\"><sl-icon name=\"at-sign\" library=\"sonr\"></sl-icon></div></sl-input><br>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
func HandleValid() 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 = templ_7745c5c3_Buffer.WriteString("<sl-input name=\"handle\" placeholder=\"digitalgold\" type=\"text\" label=\"Handle\" minlength=\"4\" maxlength=\"12\" required class=\"border-green-500\"><div slot=\"prefix\" style=\"color: #46A758;\"><sl-icon name=\"at-sign\" library=\"sonr\"></sl-icon></div></sl-input><br>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
var _ = templruntime.GeneratedTemplate
|
||||
@@ -0,0 +1,37 @@
|
||||
package input
|
||||
|
||||
type NameState string
|
||||
|
||||
const (
|
||||
NameStateInitial NameState = "inital"
|
||||
NameStateValid NameState = "valid"
|
||||
NameStateInvalid NameState = "invalid"
|
||||
)
|
||||
|
||||
func (s NameState) string() string {
|
||||
return string(s)
|
||||
}
|
||||
|
||||
templ Name() {
|
||||
<div hx-target="this" hx-swap="outerHTML" class="grid grid-cols-1 lg:grid-cols-2 gap-4">
|
||||
<sl-input name="first_name" placeholder="Satoshi" type="text" label="First Name" required autofocus></sl-input>
|
||||
<sl-input name="last_name" placeholder="N" maxlength="1" type="text" label="Last Initial"></sl-input>
|
||||
</div>
|
||||
<br/>
|
||||
}
|
||||
|
||||
templ NameError() {
|
||||
<div class="grid grid-cols-1 lg:grid-cols-2 gap-4">
|
||||
<sl-input name="first_name" placeholder="Satoshi" type="text" label="First Name" required autofocus class="border-red-500"></sl-input>
|
||||
<sl-input name="last_name" placeholder="N" maxlength="1" type="text" label="Last Initial" class="border-red-500"></sl-input>
|
||||
</div>
|
||||
<br/>
|
||||
}
|
||||
|
||||
templ NameValid() {
|
||||
<div class="grid grid-cols-1 lg:grid-cols-2 gap-4">
|
||||
<sl-input name="first_name" placeholder="Satoshi" type="text" label="First Name" required autofocus class="border-green-500"></sl-input>
|
||||
<sl-input name="last_name" placeholder="N" maxlength="1" type="text" label="Last Initial" class="border-green-500"></sl-input>
|
||||
</div>
|
||||
<br/>
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.2.793
|
||||
package input
|
||||
|
||||
//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"
|
||||
|
||||
type NameState string
|
||||
|
||||
const (
|
||||
NameStateInitial NameState = "inital"
|
||||
NameStateValid NameState = "valid"
|
||||
NameStateInvalid NameState = "invalid"
|
||||
)
|
||||
|
||||
func (s NameState) string() string {
|
||||
return string(s)
|
||||
}
|
||||
|
||||
func Name() 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_Err = templ_7745c5c3_Buffer.WriteString("<div hx-target=\"this\" hx-swap=\"outerHTML\" class=\"grid grid-cols-1 lg:grid-cols-2 gap-4\"><sl-input name=\"first_name\" placeholder=\"Satoshi\" type=\"text\" label=\"First Name\" required autofocus></sl-input> <sl-input name=\"last_name\" placeholder=\"N\" maxlength=\"1\" type=\"text\" label=\"Last Initial\"></sl-input></div><br>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
func NameError() 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_Var2 := templ.GetChildren(ctx)
|
||||
if templ_7745c5c3_Var2 == nil {
|
||||
templ_7745c5c3_Var2 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"grid grid-cols-1 lg:grid-cols-2 gap-4\"><sl-input name=\"first_name\" placeholder=\"Satoshi\" type=\"text\" label=\"First Name\" required autofocus class=\"border-red-500\"></sl-input> <sl-input name=\"last_name\" placeholder=\"N\" maxlength=\"1\" type=\"text\" label=\"Last Initial\" class=\"border-red-500\"></sl-input></div><br>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
func NameValid() 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 = templ_7745c5c3_Buffer.WriteString("<div class=\"grid grid-cols-1 lg:grid-cols-2 gap-4\"><sl-input name=\"first_name\" placeholder=\"Satoshi\" type=\"text\" label=\"First Name\" required autofocus class=\"border-green-500\"></sl-input> <sl-input name=\"last_name\" placeholder=\"N\" maxlength=\"1\" type=\"text\" label=\"Last Initial\" class=\"border-green-500\"></sl-input></div><br>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
var _ = templruntime.GeneratedTemplate
|
||||
@@ -0,0 +1,94 @@
|
||||
package input
|
||||
|
||||
templ Passkey(addr string, userHandle string, challenge string) {
|
||||
<sl-button style="width: 100%;" onclick={ navigatorCredentialsCreate(addr, userHandle, challenge) }>
|
||||
<sl-icon slot="prefix" name="passkey" library="sonr" style="font-size: 24px;" class="text-neutral-500"></sl-icon>
|
||||
Register Passkey
|
||||
</sl-button>
|
||||
}
|
||||
|
||||
script navigatorCredentialsCreate(userId string, userHandle string, challenge string) {
|
||||
const publicKey = {
|
||||
challenge: Uint8Array.from(challenge, (c) => c.charCodeAt(0)),
|
||||
rp: {
|
||||
name: "Sonr.ID",
|
||||
},
|
||||
user: {
|
||||
// Assuming that userId is ASCII-only
|
||||
id: Uint8Array.from(userId, (c) => c.charCodeAt(0)),
|
||||
name: userId,
|
||||
displayName: userHandle,
|
||||
},
|
||||
pubKeyCredParams: [
|
||||
{
|
||||
type: "public-key",
|
||||
alg: -7, // "ES256"
|
||||
},
|
||||
{
|
||||
type: "public-key",
|
||||
alg: -257, // "RS256"
|
||||
},
|
||||
],
|
||||
authenticatorSelection: {
|
||||
userVerification: "required",
|
||||
residentKey: "required",
|
||||
authenticatorAttachment: "platform",
|
||||
},
|
||||
timeout: 60000, // 1 minute
|
||||
extensions: {
|
||||
payment: {
|
||||
isPayment: true,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
// Helper function to convert ArrayBuffer to Base64URL string
|
||||
function arrayBufferToBase64URL(buffer) {
|
||||
const bytes = new Uint8Array(buffer);
|
||||
let str = '';
|
||||
bytes.forEach(byte => { str += String.fromCharCode(byte) });
|
||||
return btoa(str)
|
||||
.replace(/\+/g, '-')
|
||||
.replace(/\//g, '_')
|
||||
.replace(/=/g, '');
|
||||
}
|
||||
|
||||
navigator.credentials
|
||||
.create({ publicKey })
|
||||
.then((newCredentialInfo) => {
|
||||
if (!(newCredentialInfo instanceof PublicKeyCredential)) {
|
||||
throw new Error('Received credential is not a PublicKeyCredential');
|
||||
}
|
||||
|
||||
const response = newCredentialInfo.response;
|
||||
if (!(response instanceof AuthenticatorAttestationResponse)) {
|
||||
throw new Error('Response is not an AuthenticatorAttestationResponse');
|
||||
}
|
||||
|
||||
// Convert the credential data to a cross-platform compatible format
|
||||
const credentialJSON = {
|
||||
id: newCredentialInfo.id,
|
||||
rawId: arrayBufferToBase64URL(newCredentialInfo.rawId),
|
||||
type: newCredentialInfo.type,
|
||||
authenticatorAttachment: newCredentialInfo.authenticatorAttachment || null,
|
||||
transports: Array.isArray(response.getTransports) ? response.getTransports() : [],
|
||||
clientExtensionResults: newCredentialInfo.getClientExtensionResults(),
|
||||
response: {
|
||||
attestationObject: arrayBufferToBase64URL(response.attestationObject),
|
||||
clientDataJSON: arrayBufferToBase64URL(response.clientDataJSON)
|
||||
}
|
||||
};
|
||||
|
||||
// Set the form value with the stringified credential data
|
||||
const credential = document.getElementById('credential-data');
|
||||
credential.value = JSON.stringify(credentialJSON);
|
||||
|
||||
// Submit the form
|
||||
const form = document.getElementById('passkey-form');
|
||||
form.submit();
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error('Passkey creation failed:', err);
|
||||
alert(`Failed to create passkey: ${err.message || 'Unknown error'}`);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.2.793
|
||||
package input
|
||||
|
||||
//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"
|
||||
|
||||
func Passkey(addr string, userHandle string, challenge string) 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_Err = templ.RenderScriptItems(ctx, templ_7745c5c3_Buffer, navigatorCredentialsCreate(addr, userHandle, challenge))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<sl-button style=\"width: 100%;\" onclick=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var2 templ.ComponentScript = navigatorCredentialsCreate(addr, userHandle, challenge)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var2.Call)
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\"><sl-icon slot=\"prefix\" name=\"passkey\" library=\"sonr\" style=\"font-size: 24px;\" class=\"text-neutral-500\"></sl-icon> Register Passkey</sl-button>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
func navigatorCredentialsCreate(userId string, userHandle string, challenge string) templ.ComponentScript {
|
||||
return templ.ComponentScript{
|
||||
Name: `__templ_navigatorCredentialsCreate_7340`,
|
||||
Function: `function __templ_navigatorCredentialsCreate_7340(userId, userHandle, challenge){const publicKey = {
|
||||
challenge: Uint8Array.from(challenge, (c) => c.charCodeAt(0)),
|
||||
rp: {
|
||||
name: "Sonr.ID",
|
||||
},
|
||||
user: {
|
||||
// Assuming that userId is ASCII-only
|
||||
id: Uint8Array.from(userId, (c) => c.charCodeAt(0)),
|
||||
name: userId,
|
||||
displayName: userHandle,
|
||||
},
|
||||
pubKeyCredParams: [
|
||||
{
|
||||
type: "public-key",
|
||||
alg: -7, // "ES256"
|
||||
},
|
||||
{
|
||||
type: "public-key",
|
||||
alg: -257, // "RS256"
|
||||
},
|
||||
],
|
||||
authenticatorSelection: {
|
||||
userVerification: "required",
|
||||
residentKey: "required",
|
||||
authenticatorAttachment: "platform",
|
||||
},
|
||||
timeout: 60000, // 1 minute
|
||||
extensions: {
|
||||
payment: {
|
||||
isPayment: true,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
// Helper function to convert ArrayBuffer to Base64URL string
|
||||
function arrayBufferToBase64URL(buffer) {
|
||||
const bytes = new Uint8Array(buffer);
|
||||
let str = '';
|
||||
bytes.forEach(byte => { str += String.fromCharCode(byte) });
|
||||
return btoa(str)
|
||||
.replace(/\+/g, '-')
|
||||
.replace(/\//g, '_')
|
||||
.replace(/=/g, '');
|
||||
}
|
||||
|
||||
navigator.credentials
|
||||
.create({ publicKey })
|
||||
.then((newCredentialInfo) => {
|
||||
if (!(newCredentialInfo instanceof PublicKeyCredential)) {
|
||||
throw new Error('Received credential is not a PublicKeyCredential');
|
||||
}
|
||||
|
||||
const response = newCredentialInfo.response;
|
||||
if (!(response instanceof AuthenticatorAttestationResponse)) {
|
||||
throw new Error('Response is not an AuthenticatorAttestationResponse');
|
||||
}
|
||||
|
||||
// Convert the credential data to a cross-platform compatible format
|
||||
const credentialJSON = {
|
||||
id: newCredentialInfo.id,
|
||||
rawId: arrayBufferToBase64URL(newCredentialInfo.rawId),
|
||||
type: newCredentialInfo.type,
|
||||
authenticatorAttachment: newCredentialInfo.authenticatorAttachment || null,
|
||||
transports: Array.isArray(response.getTransports) ? response.getTransports() : [],
|
||||
clientExtensionResults: newCredentialInfo.getClientExtensionResults(),
|
||||
response: {
|
||||
attestationObject: arrayBufferToBase64URL(response.attestationObject),
|
||||
clientDataJSON: arrayBufferToBase64URL(response.clientDataJSON)
|
||||
}
|
||||
};
|
||||
|
||||
// Set the form value with the stringified credential data
|
||||
const credential = document.getElementById('credential-data');
|
||||
credential.value = JSON.stringify(credentialJSON);
|
||||
|
||||
// Submit the form
|
||||
const form = document.getElementById('passkey-form');
|
||||
form.submit();
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error('Passkey creation failed:', err);
|
||||
alert(` + "`" + `Failed to create passkey: ${err.message || 'Unknown error'}` + "`" + `);
|
||||
});
|
||||
}`,
|
||||
Call: templ.SafeScript(`__templ_navigatorCredentialsCreate_7340`, userId, userHandle, challenge),
|
||||
CallInline: templ.SafeScriptInline(`__templ_navigatorCredentialsCreate_7340`, userId, userHandle, challenge),
|
||||
}
|
||||
}
|
||||
|
||||
var _ = templruntime.GeneratedTemplate
|
||||
@@ -0,0 +1,11 @@
|
||||
package input
|
||||
|
||||
import "fmt"
|
||||
|
||||
templ HumanSlider(firstNumber int, lastNumber int) {
|
||||
<sl-range name="is_human" label={ formatHumanSliderLabel(firstNumber, lastNumber) } help-text="Prove you are a human." min="0" max="9" step="1"></sl-range>
|
||||
}
|
||||
|
||||
func formatHumanSliderLabel(firstNumber int, lastNumber int) string {
|
||||
return fmt.Sprintf("What is %d + %d?", firstNumber, lastNumber)
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
// Code generated by templ - DO NOT EDIT.
|
||||
|
||||
// templ: version: v0.2.793
|
||||
package input
|
||||
|
||||
//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"
|
||||
|
||||
import "fmt"
|
||||
|
||||
func HumanSlider(firstNumber int, lastNumber int) 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_Err = templ_7745c5c3_Buffer.WriteString("<sl-range name=\"is_human\" label=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
var templ_7745c5c3_Var2 string
|
||||
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(formatHumanSliderLabel(firstNumber, lastNumber))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/nebula/input/input_slider_isHuman.templ`, Line: 6, Col: 82}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" help-text=\"Prove you are a human.\" min=\"0\" max=\"9\" step=\"1\"></sl-range>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
return templ_7745c5c3_Err
|
||||
})
|
||||
}
|
||||
|
||||
func formatHumanSliderLabel(firstNumber int, lastNumber int) string {
|
||||
return fmt.Sprintf("What is %d + %d?", firstNumber, lastNumber)
|
||||
}
|
||||
|
||||
var _ = templruntime.GeneratedTemplate
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user