mirror of
https://github.com/onsonr/sonr.git
synced 2025-03-10 04:57:08 +00:00
feature/1220 origin handle exists method (#1241)
* feat: add docs and CI workflow for publishing to onsonr.dev * (refactor): Move hway,motr executables to their own repos * feat: simplify devnet and testnet configurations * refactor: update import path for didcrypto package * docs(networks): Add README with project overview, architecture, and community links * refactor: Move network configurations to deploy directory * build: update golang version to 1.23 * refactor: move logger interface to appropriate package * refactor: Move devnet configuration to networks/devnet * chore: improve release process with date variable * (chore): Move Crypto Library * refactor: improve code structure and readability in DID module * feat: integrate Trunk CI checks * ci: optimize CI workflow by removing redundant build jobs --------- Co-authored-by: Darp Alakun <i@prad.nu>
This commit is contained in:
parent
9bd5e41fa0
commit
807b2e86ec
32
.github/Taskfile.yml
vendored
32
.github/Taskfile.yml
vendored
@ -1,32 +0,0 @@
|
|||||||
version: "3"
|
|
||||||
|
|
||||||
vars:
|
|
||||||
VERSION:
|
|
||||||
sh: git describe --tags --abbrev=0
|
|
||||||
COMMIT:
|
|
||||||
sh: git rev-parse --short HEAD
|
|
||||||
ROOT:
|
|
||||||
sh: git rev-parse --show-toplevel
|
|
||||||
OS:
|
|
||||||
sh: uname -s
|
|
||||||
|
|
||||||
tasks:
|
|
||||||
date:
|
|
||||||
desc: Returns date in YEAR.WEEK.DAY format
|
|
||||||
cmds:
|
|
||||||
- |
|
|
||||||
YEAR=$(date +%Y)
|
|
||||||
WEEK=$(date +%V)
|
|
||||||
DAY=$(date +%u)
|
|
||||||
echo "${YEAR}.${WEEK}.${DAY}"
|
|
||||||
vars:
|
|
||||||
DATE: '{{default "" .CLI_ARGS}}'
|
|
||||||
silent: true
|
|
||||||
|
|
||||||
release:
|
|
||||||
desc: Create a new release with formatted date
|
|
||||||
cmds:
|
|
||||||
- go install github.com/goreleaser/goreleaser/v2@latest
|
|
||||||
- RELEASE_DATE=$(task date) goreleaser release --clean -f {{.ROOT}}/.goreleaser.yaml
|
|
||||||
silent: true
|
|
||||||
|
|
281
.github/dependabot.yml
vendored
281
.github/dependabot.yml
vendored
@ -1,281 +0,0 @@
|
|||||||
# To get started with Dependabot version updates, you'll need to specify which
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# package ecosystems to update and where the package manifests are located.
|
|
||||||
# Please see the documentation for all configuration options:
|
|
||||||
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
|
|
||||||
|
|
||||||
version: 2
|
|
||||||
updates:
|
|
||||||
- package-ecosystem: "gomod" # See documentation for possible values
|
|
||||||
directory: "/" # Location of package manifests
|
|
||||||
schedule:
|
|
||||||
interval: "monthly"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
]]]]
|
|
355
.github/scopes.json
vendored
355
.github/scopes.json
vendored
@ -2,9 +2,6 @@
|
|||||||
"scopes": [
|
"scopes": [
|
||||||
"core-chain",
|
"core-chain",
|
||||||
"core-ibc",
|
"core-ibc",
|
||||||
"sonr-hway",
|
|
||||||
"sonr-matrix",
|
|
||||||
"sonr-motr",
|
|
||||||
"x-did",
|
"x-did",
|
||||||
"x-dwn",
|
"x-dwn",
|
||||||
"x-svc",
|
"x-svc",
|
||||||
@ -16,35 +13,19 @@
|
|||||||
],
|
],
|
||||||
"docs": [
|
"docs": [
|
||||||
{
|
{
|
||||||
"keywords": [
|
"keywords": ["github", "actions", "workflows", "syntax"],
|
||||||
"github",
|
|
||||||
"actions",
|
|
||||||
"workflows",
|
|
||||||
"syntax"
|
|
||||||
],
|
|
||||||
"url": "https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions"
|
"url": "https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"keywords": [
|
"keywords": ["cosmos", "tooling", "cosmovisor"],
|
||||||
"cosmos",
|
|
||||||
"tooling",
|
|
||||||
"cosmovisor"
|
|
||||||
],
|
|
||||||
"url": "https://docs.cosmos.network/v0.50/build/tooling/cosmovisor"
|
"url": "https://docs.cosmos.network/v0.50/build/tooling/cosmovisor"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"keywords": [
|
"keywords": ["process-compose", "configuration"],
|
||||||
"process-compose",
|
|
||||||
"configuration"
|
|
||||||
],
|
|
||||||
"url": "https://f1bonacc1.github.io/process-compose/configuration/"
|
"url": "https://f1bonacc1.github.io/process-compose/configuration/"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"keywords": [
|
"keywords": ["taskfile", "cli", "reference"],
|
||||||
"taskfile",
|
|
||||||
"cli",
|
|
||||||
"reference"
|
|
||||||
],
|
|
||||||
"url": "https://taskfile.dev/reference/cli"
|
"url": "https://taskfile.dev/reference/cli"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -52,250 +33,115 @@
|
|||||||
"url": "https://taskfile.dev/reference/schema"
|
"url": "https://taskfile.dev/reference/schema"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"keywords": [
|
"keywords": ["taskfile", "templating", "reference"],
|
||||||
"taskfile",
|
|
||||||
"templating",
|
|
||||||
"reference"
|
|
||||||
],
|
|
||||||
"url": "https://taskfile.dev/reference/templating/"
|
"url": "https://taskfile.dev/reference/templating/"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"keywords": [
|
"keywords": ["mkdocs", "material", "reference"],
|
||||||
"mkdocs",
|
|
||||||
"material",
|
|
||||||
"reference"
|
|
||||||
],
|
|
||||||
"url": "https://squidfunk.github.io/mkdocs-material/reference/"
|
"url": "https://squidfunk.github.io/mkdocs-material/reference/"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"keywords": [
|
"keywords": ["pkl", "language", "reference"],
|
||||||
"pkl",
|
|
||||||
"language",
|
|
||||||
"reference"
|
|
||||||
],
|
|
||||||
"url": "https://pkl-lang.org/main/current/language-reference/index.html"
|
"url": "https://pkl-lang.org/main/current/language-reference/index.html"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"keywords": [
|
"keywords": ["pwa", "service-workers", "web"],
|
||||||
"pwa",
|
|
||||||
"service-workers",
|
|
||||||
"web"
|
|
||||||
],
|
|
||||||
"url": "https://web.dev/learn/pwa/service-workers/"
|
"url": "https://web.dev/learn/pwa/service-workers/"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"keywords": [
|
"keywords": ["service-workers", "web", "api"],
|
||||||
"service-workers",
|
|
||||||
"web",
|
|
||||||
"api"
|
|
||||||
],
|
|
||||||
"url": "https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API"
|
"url": "https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"keywords": [
|
"keywords": ["web-authentication", "web", "api"],
|
||||||
"web-authentication",
|
|
||||||
"web",
|
|
||||||
"api"
|
|
||||||
],
|
|
||||||
"url": "https://developer.mozilla.org/en-US/docs/Web/API/Web_Authentication_API"
|
"url": "https://developer.mozilla.org/en-US/docs/Web/API/Web_Authentication_API"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"keywords": [
|
"keywords": ["sdk", "modules", "cosmos", "manager"],
|
||||||
"sdk",
|
|
||||||
"modules",
|
|
||||||
"cosmos",
|
|
||||||
"manager"
|
|
||||||
],
|
|
||||||
"url": "https://docs.cosmos.network/v0.50/build/building-modules/module-manager"
|
"url": "https://docs.cosmos.network/v0.50/build/building-modules/module-manager"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"keywords": [
|
"keywords": ["sdk", "modules", "cosmos", "messages", "queries"],
|
||||||
"sdk",
|
|
||||||
"modules",
|
|
||||||
"cosmos",
|
|
||||||
"messages",
|
|
||||||
"queries"
|
|
||||||
],
|
|
||||||
"url": "https://docs.cosmos.network/v0.50/build/building-modules/messages-and-queries"
|
"url": "https://docs.cosmos.network/v0.50/build/building-modules/messages-and-queries"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"keywords": [
|
"keywords": ["sdk", "modules", "messages", "service", "cosmos"],
|
||||||
"sdk",
|
|
||||||
"modules",
|
|
||||||
"messages",
|
|
||||||
"service",
|
|
||||||
"cosmos"
|
|
||||||
],
|
|
||||||
"url": "https://docs.cosmos.network/v0.50/build/building-modules/msg-services"
|
"url": "https://docs.cosmos.network/v0.50/build/building-modules/msg-services"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"keywords": [
|
"keywords": ["sdk", "modules", "services", "cosmos", "query"],
|
||||||
"sdk",
|
|
||||||
"modules",
|
|
||||||
"services",
|
|
||||||
"cosmos",
|
|
||||||
"query"
|
|
||||||
],
|
|
||||||
"url": "https://docs.cosmos.network/v0.50/build/building-modules/query-services"
|
"url": "https://docs.cosmos.network/v0.50/build/building-modules/query-services"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"keywords": [
|
"keywords": ["cosmos", "depinject", "modules", "sdk"],
|
||||||
"cosmos",
|
|
||||||
"depinject",
|
|
||||||
"modules",
|
|
||||||
"sdk"
|
|
||||||
],
|
|
||||||
"url": "https://docs.cosmos.network/v0.50/build/building-modules/depinject"
|
"url": "https://docs.cosmos.network/v0.50/build/building-modules/depinject"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"keywords": [
|
"keywords": ["ibc", "apps", "sdk", "interchain-accounts"],
|
||||||
"ibc",
|
|
||||||
"apps",
|
|
||||||
"sdk",
|
|
||||||
"interchain-accounts"
|
|
||||||
],
|
|
||||||
"url": "https://ibc.cosmos.network/v8/apps/interchain-accounts/overview/"
|
"url": "https://ibc.cosmos.network/v8/apps/interchain-accounts/overview/"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"keywords": [
|
"keywords": ["ibc", "apps", "sdk", "transfer"],
|
||||||
"ibc",
|
|
||||||
"apps",
|
|
||||||
"sdk",
|
|
||||||
"transfer"
|
|
||||||
],
|
|
||||||
"url": "https://ibc.cosmos.network/v8/apps/transfer/overview/"
|
"url": "https://ibc.cosmos.network/v8/apps/transfer/overview/"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"keywords": [
|
"keywords": ["osmosis", "modules", "ibc", "assets"],
|
||||||
"osmosis",
|
|
||||||
"modules",
|
|
||||||
"ibc",
|
|
||||||
"assets"
|
|
||||||
],
|
|
||||||
"url": "https://docs.osmosis.zone/osmosis-core/asset-info/"
|
"url": "https://docs.osmosis.zone/osmosis-core/asset-info/"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"keywords": [
|
"keywords": ["ibc", "osmosis", "tokenfactory", "modules", "assets"],
|
||||||
"ibc",
|
|
||||||
"osmosis",
|
|
||||||
"tokenfactory",
|
|
||||||
"modules",
|
|
||||||
"assets"
|
|
||||||
],
|
|
||||||
"url": "https://docs.osmosis.zone/osmosis-core/modules/tokenfactory"
|
"url": "https://docs.osmosis.zone/osmosis-core/modules/tokenfactory"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"keywords": [
|
"keywords": ["ibc", "mint", "cctp", "noble", "assets"],
|
||||||
"ibc",
|
|
||||||
"mint",
|
|
||||||
"cctp",
|
|
||||||
"noble",
|
|
||||||
"assets"
|
|
||||||
],
|
|
||||||
"url": "https://docs.noble.xyz/cctp/mint"
|
"url": "https://docs.noble.xyz/cctp/mint"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"keywords": [
|
"keywords": ["ibc", "relayer", "nomic", "assets"],
|
||||||
"ibc",
|
|
||||||
"relayer",
|
|
||||||
"nomic",
|
|
||||||
"assets"
|
|
||||||
],
|
|
||||||
"url": "https://docs.nomic.io/network/ibc-relayer"
|
"url": "https://docs.nomic.io/network/ibc-relayer"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"keywords": [
|
"keywords": ["ibc", "cctp", "noble", "mint_forward", "assets"],
|
||||||
"ibc",
|
|
||||||
"cctp",
|
|
||||||
"noble",
|
|
||||||
"mint_forward",
|
|
||||||
"assets"
|
|
||||||
],
|
|
||||||
"url": "https://docs.noble.xyz/cctp/mint_forward"
|
"url": "https://docs.noble.xyz/cctp/mint_forward"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"keywords": [
|
"keywords": ["evmos", "erc20", "assets"],
|
||||||
"evmos",
|
|
||||||
"erc20",
|
|
||||||
"assets"
|
|
||||||
],
|
|
||||||
"url": "https://docs.evmos.org/protocol/modules/erc20"
|
"url": "https://docs.evmos.org/protocol/modules/erc20"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"keywords": [
|
"keywords": ["nomic", "nbtc", "assets"],
|
||||||
"nomic",
|
|
||||||
"nbtc",
|
|
||||||
"assets"
|
|
||||||
],
|
|
||||||
"url": "https://docs.nomic.io/nbtc"
|
"url": "https://docs.nomic.io/nbtc"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"keywords": [
|
"keywords": ["mpc", "wallet", "cryptography", "capability", "invokation"],
|
||||||
"mpc",
|
|
||||||
"wallet",
|
|
||||||
"cryptography",
|
|
||||||
"capability",
|
|
||||||
"invokation"
|
|
||||||
],
|
|
||||||
"url": "https://csrc.nist.gov/CSRC/media/Events/NTCW19/papers/paper-DKLS.pdf"
|
"url": "https://csrc.nist.gov/CSRC/media/Events/NTCW19/papers/paper-DKLS.pdf"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"keywords": [
|
"keywords": ["ucan", "spec", "cryptography", "authorization"],
|
||||||
"ucan",
|
|
||||||
"spec",
|
|
||||||
"cryptography",
|
|
||||||
"authorization"
|
|
||||||
],
|
|
||||||
"url": "https://raw.githubusercontent.com/ucan-wg/spec/refs/heads/main/README.md"
|
"url": "https://raw.githubusercontent.com/ucan-wg/spec/refs/heads/main/README.md"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"keywords": [
|
"keywords": ["zero-knowledge", "proofs", "cryptography", "privacy"],
|
||||||
"zero-knowledge",
|
|
||||||
"proofs",
|
|
||||||
"cryptography",
|
|
||||||
"privacy"
|
|
||||||
],
|
|
||||||
"url": "https://eprint.iacr.org/2021/1672.pdf"
|
"url": "https://eprint.iacr.org/2021/1672.pdf"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"keywords": [
|
"keywords": ["gateway", "http", "sse"],
|
||||||
"gateway",
|
|
||||||
"http",
|
|
||||||
"sse"
|
|
||||||
],
|
|
||||||
"url": "https://echo.labstack.com/docs/cookbook/sse"
|
"url": "https://echo.labstack.com/docs/cookbook/sse"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"keywords": [
|
"keywords": ["gateway", "http", "websocket"],
|
||||||
"gateway",
|
|
||||||
"http",
|
|
||||||
"websocket"
|
|
||||||
],
|
|
||||||
"url": "https://echo.labstack.com/docs/cookbook/websocket"
|
"url": "https://echo.labstack.com/docs/cookbook/websocket"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"keywords": [
|
"keywords": ["gateway", "http", "subdomain"],
|
||||||
"gateway",
|
|
||||||
"http",
|
|
||||||
"subdomain"
|
|
||||||
],
|
|
||||||
"url": "https://echo.labstack.com/docs/cookbook/subdomain"
|
"url": "https://echo.labstack.com/docs/cookbook/subdomain"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"keywords": [
|
"keywords": ["tigerbeetle", "models", "oracle"],
|
||||||
"tigerbeetle",
|
|
||||||
"models",
|
|
||||||
"oracle"
|
|
||||||
],
|
|
||||||
"url": "https://docs.tigerbeetle.com/coding/data-modeling"
|
"url": "https://docs.tigerbeetle.com/coding/data-modeling"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"keywords": [
|
"keywords": ["tigerbeetle", "two=phase", "transfers", "oracle"],
|
||||||
"tigerbeetle",
|
|
||||||
"two=phase",
|
|
||||||
"transfers",
|
|
||||||
"oracle"
|
|
||||||
],
|
|
||||||
"url": "https://docs.tigerbeetle.com/coding/two-phase-transfers"
|
"url": "https://docs.tigerbeetle.com/coding/two-phase-transfers"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -309,12 +155,7 @@
|
|||||||
"url": "https://docs.tigerbeetle.com/coding/reliable-transaction-submission"
|
"url": "https://docs.tigerbeetle.com/coding/reliable-transaction-submission"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"keywords": [
|
"keywords": ["currency", "exchange", "tigerbeetle", "oracle"],
|
||||||
"currency",
|
|
||||||
"exchange",
|
|
||||||
"tigerbeetle",
|
|
||||||
"oracle"
|
|
||||||
],
|
|
||||||
"url": "https://docs.tigerbeetle.com/coding/recipes/currency-exchange"
|
"url": "https://docs.tigerbeetle.com/coding/recipes/currency-exchange"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -328,171 +169,79 @@
|
|||||||
"url": "https://docs.tigerbeetle.com/coding/recipes/balance-conditional-transfers"
|
"url": "https://docs.tigerbeetle.com/coding/recipes/balance-conditional-transfers"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"keywords": [
|
"keywords": ["tigerbeetle", "account", "oracle"],
|
||||||
"tigerbeetle",
|
|
||||||
"account",
|
|
||||||
"oracle"
|
|
||||||
],
|
|
||||||
"url": "https://docs.tigerbeetle.com/reference/account"
|
"url": "https://docs.tigerbeetle.com/reference/account"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"keywords": [
|
"keywords": ["tigerbeetle", "transfer", "oracle"],
|
||||||
"tigerbeetle",
|
|
||||||
"transfer",
|
|
||||||
"oracle"
|
|
||||||
],
|
|
||||||
"url": "https://docs.tigerbeetle.com/reference/transfer"
|
"url": "https://docs.tigerbeetle.com/reference/transfer"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"keywords": [
|
"keywords": ["substreams", "packages", "consumer", "oracle"],
|
||||||
"substreams",
|
|
||||||
"packages",
|
|
||||||
"consumer",
|
|
||||||
"oracle"
|
|
||||||
],
|
|
||||||
"url": "https://docs.substreams.dev/documentation/consume/packages"
|
"url": "https://docs.substreams.dev/documentation/consume/packages"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"keywords": [
|
"keywords": ["substreams", "deploy", "service", "oracle"],
|
||||||
"substreams",
|
|
||||||
"deploy",
|
|
||||||
"service",
|
|
||||||
"oracle"
|
|
||||||
],
|
|
||||||
"url": "https://docs.substreams.dev/documentation/consume/sql/deployable-services/local-service"
|
"url": "https://docs.substreams.dev/documentation/consume/sql/deployable-services/local-service"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"keywords": [
|
"keywords": ["substreams", "tutorial", "cosmos", "injective"],
|
||||||
"substreams",
|
|
||||||
"tutorial",
|
|
||||||
"cosmos",
|
|
||||||
"injective"
|
|
||||||
],
|
|
||||||
"url": "https://docs.substreams.dev/tutorials/cosmos/injective/foundational"
|
"url": "https://docs.substreams.dev/tutorials/cosmos/injective/foundational"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"keywords": [
|
"keywords": ["worker", "http", "jwt"],
|
||||||
"worker",
|
|
||||||
"http",
|
|
||||||
"jwt"
|
|
||||||
],
|
|
||||||
"url": "https://echo.labstack.com/docs/cookbook/jwt"
|
"url": "https://echo.labstack.com/docs/cookbook/jwt"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"keywords": [
|
"keywords": ["worker", "http", "secure"],
|
||||||
"worker",
|
|
||||||
"http",
|
|
||||||
"secure"
|
|
||||||
],
|
|
||||||
"url": "https://echo.labstack.com/docs/middleware/secure"
|
"url": "https://echo.labstack.com/docs/middleware/secure"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"keywords": [
|
"keywords": ["worker", "http", "service-workers", "web", "api"],
|
||||||
"worker",
|
|
||||||
"http",
|
|
||||||
"service-workers",
|
|
||||||
"web",
|
|
||||||
"api"
|
|
||||||
],
|
|
||||||
"url": "https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API"
|
"url": "https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"keywords": [
|
"keywords": ["synapse", "matrix", "configuration", "usage"],
|
||||||
"synapse",
|
|
||||||
"matrix",
|
|
||||||
"configuration",
|
|
||||||
"usage"
|
|
||||||
],
|
|
||||||
"url": "https://element-hq.github.io/synapse/latest/usage/configuration/config_documentation.html"
|
"url": "https://element-hq.github.io/synapse/latest/usage/configuration/config_documentation.html"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"keywords": [
|
"keywords": ["cosmos", "protobuf", "orm", "sdk"],
|
||||||
"cosmos",
|
|
||||||
"protobuf",
|
|
||||||
"orm",
|
|
||||||
"sdk"
|
|
||||||
],
|
|
||||||
"url": "https://docs.cosmos.network/v0.50/build/packages/orm"
|
"url": "https://docs.cosmos.network/v0.50/build/packages/orm"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"keywords": [
|
"keywords": ["cosmos", "sdk", "modules", "auth"],
|
||||||
"cosmos",
|
|
||||||
"sdk",
|
|
||||||
"modules",
|
|
||||||
"auth"
|
|
||||||
],
|
|
||||||
"url": "https://docs.cosmos.network/v0.50/build/modules/auth"
|
"url": "https://docs.cosmos.network/v0.50/build/modules/auth"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"keywords": [
|
"keywords": ["cosmos", "sdk", "modules", "bank"],
|
||||||
"cosmos",
|
|
||||||
"sdk",
|
|
||||||
"modules",
|
|
||||||
"bank"
|
|
||||||
],
|
|
||||||
"url": "https://docs.cosmos.network/v0.50/build/modules/bank"
|
"url": "https://docs.cosmos.network/v0.50/build/modules/bank"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"keywords": [
|
"keywords": ["cosmos", "modules", "authz", "sdk"],
|
||||||
"cosmos",
|
|
||||||
"modules",
|
|
||||||
"authz",
|
|
||||||
"sdk"
|
|
||||||
],
|
|
||||||
"url": "https://docs.cosmos.network/v0.50/build/modules/authz"
|
"url": "https://docs.cosmos.network/v0.50/build/modules/authz"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"keywords": [
|
"keywords": ["cosmos", "protobuf", "collections", "sdk"],
|
||||||
"cosmos",
|
|
||||||
"protobuf",
|
|
||||||
"collections",
|
|
||||||
"sdk"
|
|
||||||
],
|
|
||||||
"url": "https://docs.cosmos.network/v0.50/build/packages/collections"
|
"url": "https://docs.cosmos.network/v0.50/build/packages/collections"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"keywords": [
|
"keywords": ["cosmos", "modules", "gov", "sdk"],
|
||||||
"cosmos",
|
|
||||||
"modules",
|
|
||||||
"gov",
|
|
||||||
"sdk"
|
|
||||||
],
|
|
||||||
"url": "https://docs.cosmos.network/v0.50/build/modules/gov"
|
"url": "https://docs.cosmos.network/v0.50/build/modules/gov"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"keywords": [
|
"keywords": ["cosmos", "modules", "staking", "sdk"],
|
||||||
"cosmos",
|
|
||||||
"modules",
|
|
||||||
"staking",
|
|
||||||
"sdk"
|
|
||||||
],
|
|
||||||
"url": "https://docs.cosmos.network/v0.50/build/modules/staking"
|
"url": "https://docs.cosmos.network/v0.50/build/modules/staking"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"keywords": [
|
"keywords": ["cosmos", "protobuf", "annotations", "sdk"],
|
||||||
"cosmos",
|
|
||||||
"protobuf",
|
|
||||||
"annotations",
|
|
||||||
"sdk"
|
|
||||||
],
|
|
||||||
"url": "https://docs.cosmos.network/v0.50/build/building-modules/protobuf-annotations"
|
"url": "https://docs.cosmos.network/v0.50/build/building-modules/protobuf-annotations"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"keywords": [
|
"keywords": ["cosmos", "sdk", "modules", "group"],
|
||||||
"cosmos",
|
|
||||||
"sdk",
|
|
||||||
"modules",
|
|
||||||
"group"
|
|
||||||
],
|
|
||||||
"url": "https://docs.cosmos.network/v0.50/build/modules/group"
|
"url": "https://docs.cosmos.network/v0.50/build/modules/group"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"keywords": [
|
"keywords": ["cosmos", "sdk", "modules", "nft"],
|
||||||
"cosmos",
|
|
||||||
"sdk",
|
|
||||||
"modules",
|
|
||||||
"nft"
|
|
||||||
],
|
|
||||||
"url": "https://docs.cosmos.network/v0.50/build/modules/nft"
|
"url": "https://docs.cosmos.network/v0.50/build/modules/nft"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
9
.github/workflows/checks.yml
vendored
9
.github/workflows/checks.yml
vendored
@ -21,7 +21,10 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
configuration-path: .github/pr-labeler.yml # optional, .github/pr-labeler.yml is the default value
|
configuration-path: .github/pr-labeler.yml # optional, .github/pr-labeler.yml is the default value
|
||||||
|
- name: Trunk Check
|
||||||
|
uses: trunk-io/trunk-action@v1
|
||||||
|
with:
|
||||||
|
post-annotations: true # only for fork PRs
|
||||||
|
|
||||||
test-builds:
|
test-builds:
|
||||||
if: github.event_name == 'pull_request'
|
if: github.event_name == 'pull_request'
|
||||||
@ -41,10 +44,6 @@ jobs:
|
|||||||
check-latest: true
|
check-latest: true
|
||||||
- name: Run Sonrd Build
|
- name: Run Sonrd Build
|
||||||
run: make build
|
run: make build
|
||||||
- name: Run Hway Build
|
|
||||||
run: make build-hway
|
|
||||||
- name: Run Motr Build
|
|
||||||
run: make build-motr
|
|
||||||
|
|
||||||
test-unit:
|
test-unit:
|
||||||
if: github.event_name == 'pull_request'
|
if: github.event_name == 'pull_request'
|
||||||
|
2
.github/workflows/merge.yml
vendored
2
.github/workflows/merge.yml
vendored
@ -16,7 +16,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Check out
|
- name: Check out
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
ssh-key: "${{ secrets.COMMIT_KEY }}"
|
ssh-key: "${{ secrets.COMMIT_KEY }}"
|
||||||
|
22
.github/workflows/publish.yml
vendored
22
.github/workflows/publish.yml
vendored
@ -22,3 +22,25 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
input: proto
|
input: proto
|
||||||
buf_token: ${{ secrets.BUF_TOKEN }}
|
buf_token: ${{ secrets.BUF_TOKEN }}
|
||||||
|
|
||||||
|
docs-push:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: Publish Docs to onsonr.dev
|
||||||
|
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: mkdocs gh-deploy --force
|
||||||
|
1
.github/workflows/release.yml
vendored
1
.github/workflows/release.yml
vendored
@ -55,4 +55,3 @@ jobs:
|
|||||||
REDDIT_SECRET: ${{ secrets.REDDIT_SECRET }}
|
REDDIT_SECRET: ${{ secrets.REDDIT_SECRET }}
|
||||||
REDDIT_USERNAME: ${{ secrets.REDDIT_USERNAME }}
|
REDDIT_USERNAME: ${{ secrets.REDDIT_USERNAME }}
|
||||||
REDDIT_PASSWORD: ${{ secrets.REDDIT_PASSWORD }}
|
REDDIT_PASSWORD: ${{ secrets.REDDIT_PASSWORD }}
|
||||||
|
|
||||||
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,6 +1,5 @@
|
|||||||
# Aider related generated files
|
# Aider related generated files
|
||||||
MESSAGE.md
|
.aider-context
|
||||||
CONVENTIONS.md
|
|
||||||
|
|
||||||
# Binaries
|
# Binaries
|
||||||
.task
|
.task
|
||||||
|
@ -2,15 +2,15 @@
|
|||||||
version: 2
|
version: 2
|
||||||
project_name: sonr
|
project_name: sonr
|
||||||
|
|
||||||
builds:
|
before:
|
||||||
- id: motr
|
hooks:
|
||||||
main: ./cmd/motr
|
- echo "Release date is {{ .Env.RELEASE_DATE }}"
|
||||||
binary: app
|
- docker build -t ghcr.io/onsonr/sonr:latest .
|
||||||
goos:
|
- docker tag ghcr.io/onsonr/sonr:latest ghcr.io/onsonr/sonr:{{ .Tag }}
|
||||||
- js
|
- docker push ghcr.io/onsonr/sonr:{{ .Tag }}
|
||||||
goarch:
|
- docker push ghcr.io/onsonr/sonr:latest
|
||||||
- wasm
|
|
||||||
|
|
||||||
|
builds:
|
||||||
- id: sonr
|
- id: sonr
|
||||||
main: ./cmd/sonrd
|
main: ./cmd/sonrd
|
||||||
binary: sonrd
|
binary: sonrd
|
||||||
@ -36,27 +36,6 @@ builds:
|
|||||||
- netgo
|
- netgo
|
||||||
- ledger
|
- ledger
|
||||||
|
|
||||||
- id: hway
|
|
||||||
main: ./cmd/hway
|
|
||||||
binary: hway
|
|
||||||
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:
|
archives:
|
||||||
- id: sonr
|
- id: sonr
|
||||||
builds: [sonr]
|
builds: [sonr]
|
||||||
@ -69,41 +48,7 @@ archives:
|
|||||||
- src: README*
|
- src: README*
|
||||||
wrap_in_directory: true
|
wrap_in_directory: true
|
||||||
|
|
||||||
- id: hway
|
|
||||||
builds: [hway]
|
|
||||||
name_template: >-
|
|
||||||
hway_{{ .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:
|
nfpms:
|
||||||
- id: hway
|
|
||||||
package_name: hway
|
|
||||||
file_name_template: "hway_{{ .Os }}_{{ .Arch }}{{ .ConventionalExtension }}"
|
|
||||||
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
|
- id: sonr
|
||||||
package_name: sonrd
|
package_name: sonrd
|
||||||
file_name_template: "sonrd_{{ .Os }}_{{ .Arch }}{{ .ConventionalExtension }}"
|
file_name_template: "sonrd_{{ .Os }}_{{ .Arch }}{{ .ConventionalExtension }}"
|
||||||
@ -128,23 +73,6 @@ nfpms:
|
|||||||
# Add these lines to match build config
|
# Add these lines to match build config
|
||||||
|
|
||||||
brews:
|
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
|
- name: sonr
|
||||||
ids: [sonr]
|
ids: [sonr]
|
||||||
commit_author:
|
commit_author:
|
||||||
@ -152,7 +80,7 @@ brews:
|
|||||||
email: bot@goreleaser.com
|
email: bot@goreleaser.com
|
||||||
directory: Formula
|
directory: Formula
|
||||||
caveats: "Run a local sonr node and access it with the hway proxy"
|
caveats: "Run a local sonr node and access it with the hway proxy"
|
||||||
homepage: "https://onsonr.dev"
|
homepage: "https://onson.dev"
|
||||||
description: "Sonr is a decentralized, permissionless, and censorship-resistant identity network."
|
description: "Sonr is a decentralized, permissionless, and censorship-resistant identity network."
|
||||||
dependencies:
|
dependencies:
|
||||||
- name: ipfs
|
- name: ipfs
|
||||||
@ -166,7 +94,7 @@ release:
|
|||||||
github:
|
github:
|
||||||
owner: onsonr
|
owner: onsonr
|
||||||
name: sonr
|
name: sonr
|
||||||
name_template: 'Release {{ .Env.RELEASE_DATE }}'
|
name_template: "{{ .Tag }} | {{ .Env.RELEASE_DATE }}"
|
||||||
draft: false
|
draft: false
|
||||||
replace_existing_draft: true
|
replace_existing_draft: true
|
||||||
replace_existing_artifacts: true
|
replace_existing_artifacts: true
|
||||||
|
9
.trunk/.gitignore
vendored
Normal file
9
.trunk/.gitignore
vendored
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
*out
|
||||||
|
*logs
|
||||||
|
*actions
|
||||||
|
*notifications
|
||||||
|
*tools
|
||||||
|
plugins
|
||||||
|
user_trunk.yaml
|
||||||
|
user.yaml
|
||||||
|
tmp
|
27
.trunk/configs/.golangci.yaml
Normal file
27
.trunk/configs/.golangci.yaml
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
linters:
|
||||||
|
disable:
|
||||||
|
- unused # Disables unreachable code checking
|
||||||
|
|
||||||
|
run:
|
||||||
|
# Exclude test files from analysis
|
||||||
|
tests: false
|
||||||
|
|
||||||
|
# Define which files and directories to exclude
|
||||||
|
issues:
|
||||||
|
exclude-rules:
|
||||||
|
# Exclude all test files
|
||||||
|
- path: _test\.go
|
||||||
|
linters:
|
||||||
|
- all
|
||||||
|
|
||||||
|
# Exclude specific directories
|
||||||
|
exclude-dirs:
|
||||||
|
- api/did/v1
|
||||||
|
- api/dwn/v1
|
||||||
|
- api/svc/v1
|
||||||
|
- internal
|
||||||
|
|
||||||
|
# Exclude specific file patterns
|
||||||
|
exclude-files:
|
||||||
|
- ".*\\.pb\\.go$"
|
||||||
|
- ".*_templ\\.go$"
|
4
.trunk/configs/.hadolint.yaml
Normal file
4
.trunk/configs/.hadolint.yaml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# Following source doesn't work in most setups
|
||||||
|
ignored:
|
||||||
|
- SC1090
|
||||||
|
- SC1091
|
2
.trunk/configs/.markdownlint.yaml
Normal file
2
.trunk/configs/.markdownlint.yaml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# Prettier friendly markdownlint config (all formatting rules disabled)
|
||||||
|
extends: markdownlint/style/prettier
|
1
.trunk/configs/.rustfmt.toml
Normal file
1
.trunk/configs/.rustfmt.toml
Normal file
@ -0,0 +1 @@
|
|||||||
|
edition = "2021"
|
7
.trunk/configs/.shellcheckrc
Normal file
7
.trunk/configs/.shellcheckrc
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
enable=all
|
||||||
|
source-path=SCRIPTDIR
|
||||||
|
disable=SC2154
|
||||||
|
|
||||||
|
# If you're having issues with shellcheck following source, disable the errors via:
|
||||||
|
# disable=SC1090
|
||||||
|
# disable=SC1091
|
7
.trunk/configs/.yamllint.yaml
Normal file
7
.trunk/configs/.yamllint.yaml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
rules:
|
||||||
|
quoted-strings:
|
||||||
|
required: only-when-needed
|
||||||
|
extra-allowed: ["{|}"]
|
||||||
|
key-duplicates: {}
|
||||||
|
octal-values:
|
||||||
|
forbid-implicit-octal: true
|
41
.trunk/trunk.yaml
Normal file
41
.trunk/trunk.yaml
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
# This file controls the behavior of Trunk: https://docs.trunk.io/cli
|
||||||
|
# To learn more about the format of this file, see https://docs.trunk.io/reference/trunk-yaml
|
||||||
|
version: 0.1
|
||||||
|
cli:
|
||||||
|
version: 1.22.8
|
||||||
|
# Trunk provides extensibility via plugins. (https://docs.trunk.io/plugins)
|
||||||
|
plugins:
|
||||||
|
sources:
|
||||||
|
- id: trunk
|
||||||
|
ref: v1.6.6
|
||||||
|
uri: https://github.com/trunk-io/plugins
|
||||||
|
# Many linters and tools depend on runtimes - configure them here. (https://docs.trunk.io/runtimes)
|
||||||
|
runtimes:
|
||||||
|
enabled:
|
||||||
|
- go@1.23.0
|
||||||
|
- node@18.20.5
|
||||||
|
- python@3.10.8
|
||||||
|
# This is the section where you manage your linters. (https://docs.trunk.io/check/configuration)
|
||||||
|
lint:
|
||||||
|
enabled:
|
||||||
|
- actionlint@1.7.6
|
||||||
|
- checkov@3.2.347
|
||||||
|
- clippy@1.65.0
|
||||||
|
- git-diff-check
|
||||||
|
- gofmt@1.20.4
|
||||||
|
- golangci-lint@1.62.2
|
||||||
|
- hadolint@2.12.1-beta
|
||||||
|
# - markdownlint@0.43.0
|
||||||
|
- osv-scanner@1.9.2
|
||||||
|
- prettier@3.4.2
|
||||||
|
- rustfmt@1.65.0
|
||||||
|
# - shellcheck@0.10.0
|
||||||
|
# - shfmt@3.6.0
|
||||||
|
- taplo@0.9.3
|
||||||
|
- trufflehog@3.88.0
|
||||||
|
actions:
|
||||||
|
enabled:
|
||||||
|
- trunk-announce
|
||||||
|
- trunk-check-pre-push
|
||||||
|
- trunk-fmt-pre-commit
|
||||||
|
- trunk-upgrade-available
|
@ -475,7 +475,7 @@
|
|||||||
- **cta**: Fix typo in CTA title
|
- **cta**: Fix typo in CTA title
|
||||||
- change bento section title to reflect security focus
|
- change bento section title to reflect security focus
|
||||||
- adjust hero image dimensions
|
- adjust hero image dimensions
|
||||||
- **Input**: Change type from to
|
- **Input**: Change type from to
|
||||||
- update hero image height in config.pkl
|
- update hero image height in config.pkl
|
||||||
|
|
||||||
### Refactor
|
### Refactor
|
||||||
@ -507,7 +507,7 @@
|
|||||||
|
|
||||||
- remove old changelog entries
|
- remove old changelog entries
|
||||||
- rename buf-publish.yml to publish-assets.yml
|
- rename buf-publish.yml to publish-assets.yml
|
||||||
- remove unused field from
|
- remove unused field from
|
||||||
- remove unnecessary checkout in scheduled-release workflow
|
- remove unnecessary checkout in scheduled-release workflow
|
||||||
- rename build ID to sonr
|
- rename build ID to sonr
|
||||||
- remove unnecessary release existence check
|
- remove unnecessary release existence check
|
||||||
@ -626,7 +626,7 @@
|
|||||||
- extract root command creation to separate file
|
- extract root command creation to separate file
|
||||||
- move ipfs setup to function
|
- move ipfs setup to function
|
||||||
- remove unnecessary proxy config
|
- remove unnecessary proxy config
|
||||||
- rename script to
|
- rename script to
|
||||||
- move DWN proxy server logic to separate file
|
- move DWN proxy server logic to separate file
|
||||||
- use htmx instead of dwn for vault client
|
- use htmx instead of dwn for vault client
|
||||||
- remove unused environment variables
|
- remove unused environment variables
|
||||||
@ -634,7 +634,7 @@
|
|||||||
- use staking keeper in DID keeper
|
- use staking keeper in DID keeper
|
||||||
- remove unused dependencies
|
- remove unused dependencies
|
||||||
- remove unused image building workflow
|
- remove unused image building workflow
|
||||||
- add field to
|
- add field to
|
||||||
- Update KeyKind Enum to have proper naming conventions
|
- Update KeyKind Enum to have proper naming conventions
|
||||||
- Update `DIDNamespace` to have proper naming convention
|
- Update `DIDNamespace` to have proper naming convention
|
||||||
- expose ports directly in docker-compose
|
- expose ports directly in docker-compose
|
||||||
|
0
CONVENTIONS.md
Normal file
0
CONVENTIONS.md
Normal file
@ -1,4 +1,4 @@
|
|||||||
FROM golang:1.22-alpine AS go-builder
|
FROM golang:1.23-alpine AS go-builder
|
||||||
|
|
||||||
SHELL ["/bin/sh", "-ecuxo", "pipefail"]
|
SHELL ["/bin/sh", "-ecuxo", "pipefail"]
|
||||||
|
|
||||||
@ -31,6 +31,8 @@ RUN LEDGER_ENABLED=false BUILD_TAGS=muslc LINK_STATICALLY=true make build \
|
|||||||
# --------------------------------------------------------
|
# --------------------------------------------------------
|
||||||
FROM debian:11-slim
|
FROM debian:11-slim
|
||||||
|
|
||||||
|
LABEL org.opencontainers.image.source https://github.com/onsonr/sonr
|
||||||
|
|
||||||
COPY --from=go-builder /code/build/sonrd /usr/bin/sonrd
|
COPY --from=go-builder /code/build/sonrd /usr/bin/sonrd
|
||||||
|
|
||||||
# Install dependencies for Debian 11
|
# Install dependencies for Debian 11
|
||||||
|
48
Makefile
48
Makefile
@ -8,14 +8,16 @@ SDK_PACK := $(shell go list -m github.com/cosmos/cosmos-sdk | sed 's/ /\@/g')
|
|||||||
BINDIR ?= $(GOPATH)/bin
|
BINDIR ?= $(GOPATH)/bin
|
||||||
SIMAPP = ./app
|
SIMAPP = ./app
|
||||||
|
|
||||||
PC_PORT_NUM=42069
|
# Fetch from env
|
||||||
PC_LOG_FILE=./sonr.log
|
RELEASE_DATE ?= $(shell date +%Y).$(shell date +%V).$(shell date +%u)
|
||||||
PC_SOCKET_PATH=/tmp/sonr-net.sock
|
VERSION ?= $(shell echo $(shell git describe --tags) | sed 's/^v//')
|
||||||
|
COMMIT ?= $(shell git log -1 --format='%H')
|
||||||
|
OS ?= $(shell uname -s)
|
||||||
|
ROOT ?= $(shell git rev-parse --show-toplevel)
|
||||||
|
|
||||||
# for dockerized protobuf tools
|
# for dockerized protobuf tools
|
||||||
DOCKER := $(shell which docker)
|
DOCKER := $(shell which docker)
|
||||||
HTTPS_GIT := github.com/onsonr/sonr.git
|
HTTPS_GIT := github.com/onsonr/sonr.git
|
||||||
PROCESS_COMPOSE := $(shell which process-compose)
|
|
||||||
|
|
||||||
export GO111MODULE = on
|
export GO111MODULE = on
|
||||||
|
|
||||||
@ -107,8 +109,14 @@ install: go.sum
|
|||||||
install-hway: go.sum
|
install-hway: go.sum
|
||||||
go install -mod=readonly ./cmd/hway
|
go install -mod=readonly ./cmd/hway
|
||||||
|
|
||||||
|
release: fmt-date
|
||||||
|
@go install github.com/goreleaser/goreleaser/v2@latest
|
||||||
|
RELEASE_DATE=$(RELEASE_DATE) goreleaser release --clean
|
||||||
|
|
||||||
|
|
||||||
########################################
|
########################################
|
||||||
### Tools & dependencies
|
### Tools & dependencies
|
||||||
|
########################################
|
||||||
|
|
||||||
go-mod-cache: go.sum
|
go-mod-cache: go.sum
|
||||||
@echo "--> Download go modules to local cache"
|
@echo "--> Download go modules to local cache"
|
||||||
@ -134,12 +142,9 @@ clean:
|
|||||||
distclean: clean
|
distclean: clean
|
||||||
rm -rf vendor/
|
rm -rf vendor/
|
||||||
|
|
||||||
init-env:
|
|
||||||
@echo "Installing process-compose"
|
|
||||||
sh scripts/init_env.sh
|
|
||||||
|
|
||||||
########################################
|
########################################
|
||||||
### Testing
|
### Testing
|
||||||
|
########################################
|
||||||
|
|
||||||
test: test-unit
|
test: test-unit
|
||||||
test-all: test-race test-cover test-system
|
test-all: test-race test-cover test-system
|
||||||
@ -310,6 +315,33 @@ sh-testnet: mod-tidy
|
|||||||
|
|
||||||
.PHONY: setup-testnet set-testnet-configs testnet testnet-basic sh-testnet dop-testnet
|
.PHONY: setup-testnet set-testnet-configs testnet testnet-basic sh-testnet dop-testnet
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
### extra utils ###
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
push-docker:
|
||||||
|
@docker build -t ghcr.io/onsonr/sonr:latest .
|
||||||
|
@docker tag ghcr.io/onsonr/sonr:latest ghcr.io/onsonr/sonr:$(VERSION)
|
||||||
|
@docker push ghcr.io/onsonr/sonr:latest
|
||||||
|
@docker push ghcr.io/onsonr/sonr:$(VERSION)
|
||||||
|
|
||||||
|
status:
|
||||||
|
@gh run ls -L 3
|
||||||
|
@gum format -- "# Sonr ($OS-$VERSION)" "- ($(COMMIT)) $ROOT" "- $(RELEASE_DATE)"
|
||||||
|
@sleep 3
|
||||||
|
|
||||||
|
release:
|
||||||
|
@go install github.com/goreleaser/goreleaser/v2@latest
|
||||||
|
@RELEASE_DATE=$(RELEASE_DATE) goreleaser release --clean
|
||||||
|
|
||||||
|
release-dry:
|
||||||
|
@go install github.com/goreleaser/goreleaser/v2@latest
|
||||||
|
@RELEASE_DATE=$(RELEASE_DATE) goreleaser release --snapshot --clean --skip=publish
|
||||||
|
|
||||||
|
release-check:
|
||||||
|
@go install github.com/goreleaser/goreleaser/v2@latest
|
||||||
|
@RELEASE_DATE=$(RELEASE_DATE) goreleaser check
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
### help ###
|
### help ###
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
73
Taskfile.yml
73
Taskfile.yml
@ -1,73 +0,0 @@
|
|||||||
version: "3"
|
|
||||||
|
|
||||||
vars:
|
|
||||||
VERSION:
|
|
||||||
sh: git describe --tags --abbrev=0
|
|
||||||
COMMIT:
|
|
||||||
sh: git rev-parse --short HEAD
|
|
||||||
ROOT:
|
|
||||||
sh: git rev-parse --show-toplevel
|
|
||||||
OS:
|
|
||||||
sh: uname -s
|
|
||||||
# DOPPLER_TOKEN:
|
|
||||||
# sh: skate get DOPPLER_NETWORK
|
|
||||||
|
|
||||||
# includes:
|
|
||||||
# deps: https://raw.githubusercontent.com/onsonr/taskfiles/main/taskfiles/deps.yml
|
|
||||||
# gen: https://raw.githubusercontent.com/onsonr/taskfiles/main/taskfiles/gen.yml
|
|
||||||
# hway: https://raw.githubusercontent.com/onsonr/taskfiles/main/taskfiles/hway.yml
|
|
||||||
# ipfs: https://raw.githubusercontent.com/onsonr/taskfiles/main/taskfiles/ipfs.yml
|
|
||||||
# issue: https://raw.githubusercontent.com/onsonr/taskfiles/main/taskfiles/ghpm.yml
|
|
||||||
# procs: https://raw.githubusercontent.com/onsonr/taskfiles/main/taskfiles/procs.yml
|
|
||||||
# postgres: https://raw.githubusercontent.com/onsonr/taskfiles/main/taskfiles/postgres.yml
|
|
||||||
# sonrd: https://raw.githubusercontent.com/onsonr/taskfiles/main/taskfiles/sonrd.yml
|
|
||||||
#
|
|
||||||
tasks:
|
|
||||||
default:
|
|
||||||
cmds:
|
|
||||||
- gh run ls -L 3
|
|
||||||
- gum format -- "# Sonr ({{.OS}}-{{.VERSION}})" " - ({{.COMMIT}}) {{.ROOT}}"
|
|
||||||
- task -l -j | jq -r '.tasks[].name' | fzf --height=16 | xargs task
|
|
||||||
silent: true
|
|
||||||
|
|
||||||
# start:
|
|
||||||
# desc: Start the Network
|
|
||||||
# silent: true
|
|
||||||
# cmds:
|
|
||||||
# - task: postgres:reset
|
|
||||||
# - task: ipfs:init
|
|
||||||
# - task: ipfs:mount
|
|
||||||
# - task: sonrd:install
|
|
||||||
# - task: hway:build
|
|
||||||
# - task: procs:up
|
|
||||||
#
|
|
||||||
# status:
|
|
||||||
# desc: Check the status of the Network
|
|
||||||
# silent: true
|
|
||||||
# cmds:
|
|
||||||
# - task: procs:attach
|
|
||||||
#
|
|
||||||
# stop:
|
|
||||||
# desc: Stop the Network
|
|
||||||
# silent: true
|
|
||||||
# cmds:
|
|
||||||
# - task: procs:down
|
|
||||||
date:
|
|
||||||
desc: Returns date in YEAR.WEEK.DAY format
|
|
||||||
cmds:
|
|
||||||
- |
|
|
||||||
YEAR=$(date +%Y)
|
|
||||||
WEEK=$(date +%V)
|
|
||||||
DAY=$(date +%u)
|
|
||||||
echo "${YEAR}.${WEEK}.${DAY}"
|
|
||||||
vars:
|
|
||||||
DATE: '{{default "" .CLI_ARGS}}'
|
|
||||||
silent: true
|
|
||||||
|
|
||||||
release:
|
|
||||||
desc: Create a new release with formatted date
|
|
||||||
cmds:
|
|
||||||
- go install github.com/goreleaser/goreleaser/v2@latest
|
|
||||||
- RELEASE_DATE=$(task date) goreleaser release --clean
|
|
||||||
silent: true
|
|
||||||
|
|
@ -1,93 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"log"
|
|
||||||
"net/http"
|
|
||||||
"os"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/onsonr/sonr/gateway"
|
|
||||||
"github.com/onsonr/sonr/internal/common"
|
|
||||||
"github.com/spf13/cobra"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Command line flags
|
|
||||||
var (
|
|
||||||
servePort int // Gateway http entry point (default 3000)
|
|
||||||
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)
|
|
||||||
|
|
||||||
psqlHost string // PostgresSQL Host Flag
|
|
||||||
psqlPort string // PostgresSQL Port Flag
|
|
||||||
psqlUser string // PostgresSQL User Flag
|
|
||||||
psqlPass string // PostgresSQL Password Flag
|
|
||||||
psqlDB string // PostgresSQL Database Flag
|
|
||||||
)
|
|
||||||
|
|
||||||
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)
|
|
||||||
}
|
|
||||||
ipc, err := common.NewIPFS()
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
dbq, err := setupPostgresDB()
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
e, err := gateway.New(env, ipc, dbq)
|
|
||||||
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(&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")
|
|
||||||
cmd.Flags().StringVar(&psqlHost, "psql-host", "localhost", "PostgresSQL Host")
|
|
||||||
cmd.Flags().StringVar(&psqlPort, "psql-port", "5432", "PostgresSQL Port")
|
|
||||||
cmd.Flags().StringVar(&psqlUser, "psql-user", "highway_user", "PostgresSQL User")
|
|
||||||
cmd.Flags().StringVar(&psqlPass, "psql-pass", "highway_password123", "PostgresSQL Password")
|
|
||||||
cmd.Flags().StringVar(&psqlDB, "psql-db", "highway", "PostgresSQL Database")
|
|
||||||
return cmd
|
|
||||||
}
|
|
||||||
|
|
||||||
func formatPsqlDSN() string {
|
|
||||||
if psqlHost == "" {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
host := psqlHost
|
|
||||||
port := "5432"
|
|
||||||
|
|
||||||
if parts := strings.Split(psqlHost, ":"); len(parts) == 2 {
|
|
||||||
host = parts[0]
|
|
||||||
port = parts[1]
|
|
||||||
}
|
|
||||||
|
|
||||||
dsn := fmt.Sprintf("host=%s port=%s user=%s password=%s dbname=%s sslmode=verify-full",
|
|
||||||
host, port, psqlUser, psqlPass, psqlDB)
|
|
||||||
|
|
||||||
log.Printf("Attempting to connect to PostgreSQL with DSN: host=%s port=%s user=%s dbname=%s",
|
|
||||||
host, port, psqlUser, psqlDB) // Don't log the password
|
|
||||||
|
|
||||||
return dsn
|
|
||||||
}
|
|
@ -1,49 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
_ "embed"
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"github.com/jackc/pgx/v5"
|
|
||||||
config "github.com/onsonr/sonr/internal/config/hway"
|
|
||||||
hwayorm "github.com/onsonr/sonr/internal/database/hwayorm"
|
|
||||||
)
|
|
||||||
|
|
||||||
// main is the entry point for the application
|
|
||||||
func main() {
|
|
||||||
cmd := rootCmd()
|
|
||||||
if err := cmd.Execute(); err != nil {
|
|
||||||
fmt.Println(err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
os.Exit(0)
|
|
||||||
}
|
|
||||||
|
|
||||||
func loadEnvImplFromArgs(args []string) (config.Hway, error) {
|
|
||||||
cmd := rootCmd()
|
|
||||||
if err := cmd.ParseFlags(args); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
env := &config.HwayImpl{
|
|
||||||
ServePort: servePort,
|
|
||||||
ChainId: chainID,
|
|
||||||
IpfsGatewayUrl: ipfsGatewayURL,
|
|
||||||
SonrApiUrl: sonrAPIURL,
|
|
||||||
SonrGrpcUrl: sonrGrpcURL,
|
|
||||||
SonrRpcUrl: sonrRPCURL,
|
|
||||||
PsqlDSN: formatPsqlDSN(),
|
|
||||||
}
|
|
||||||
return env, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func setupPostgresDB() (*hwayorm.Queries, error) {
|
|
||||||
pgdsn := fmt.Sprintf("host=%s user=%s password=%s dbname=%s sslmode=disable", psqlHost, psqlUser, psqlPass, psqlDB)
|
|
||||||
conn, err := pgx.Connect(context.Background(), pgdsn)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return hwayorm.New(conn), nil
|
|
||||||
}
|
|
259
cmd/motr/main.go
259
cmd/motr/main.go
@ -1,259 +0,0 @@
|
|||||||
//go:build js && wasm
|
|
||||||
// +build js,wasm
|
|
||||||
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"bytes"
|
|
||||||
"context"
|
|
||||||
"database/sql"
|
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
|
||||||
"io"
|
|
||||||
"log"
|
|
||||||
"net/http"
|
|
||||||
"net/http/httptest"
|
|
||||||
"strings"
|
|
||||||
"sync"
|
|
||||||
"syscall/js"
|
|
||||||
|
|
||||||
_ "github.com/ncruces/go-sqlite3/driver"
|
|
||||||
_ "github.com/ncruces/go-sqlite3/embed"
|
|
||||||
"github.com/onsonr/sonr/internal/config/motr"
|
|
||||||
"github.com/onsonr/sonr/internal/database/motrorm"
|
|
||||||
sink "github.com/onsonr/sonr/internal/database/sink"
|
|
||||||
vault "github.com/onsonr/sonr/vault"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
// Global buffer pool to reduce allocations
|
|
||||||
bufferPool = sync.Pool{
|
|
||||||
New: func() interface{} {
|
|
||||||
return new(bytes.Buffer)
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
// Cached JS globals
|
|
||||||
jsGlobal = js.Global()
|
|
||||||
jsUint8Array = jsGlobal.Get("Uint8Array")
|
|
||||||
jsResponse = jsGlobal.Get("Response")
|
|
||||||
jsPromise = jsGlobal.Get("Promise")
|
|
||||||
jsWasmHTTP = jsGlobal.Get("wasmhttp")
|
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
configString := "TODO"
|
|
||||||
config, _ := loadConfig(configString)
|
|
||||||
dbq, err := createDB()
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
e, err := vault.New(config, dbq)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
serveFetch(e)
|
|
||||||
}
|
|
||||||
|
|
||||||
// loadConfig loads the config from the given JSON string
|
|
||||||
func loadConfig(configString string) (*motr.Config, error) {
|
|
||||||
var config motr.Config
|
|
||||||
err := json.Unmarshal([]byte(configString), &config)
|
|
||||||
return &config, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// createDB initializes and returns a configured database connection
|
|
||||||
func createDB() (*motrorm.Queries, error) {
|
|
||||||
db, err := sql.Open("sqlite3", ":memory:")
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// create tables
|
|
||||||
if _, err := db.ExecContext(context.Background(), sink.SchemaVaultSQL); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
return motrorm.New(db), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// serveFetch serves HTTP requests with optimized handler management
|
|
||||||
func serveFetch(handler http.Handler) func() {
|
|
||||||
h := handler
|
|
||||||
if h == nil {
|
|
||||||
h = http.DefaultServeMux
|
|
||||||
}
|
|
||||||
|
|
||||||
// Optimize prefix handling
|
|
||||||
prefix := strings.TrimRight(jsWasmHTTP.Get("path").String(), "/")
|
|
||||||
if prefix != "" {
|
|
||||||
mux := http.NewServeMux()
|
|
||||||
mux.Handle(prefix+"/", http.StripPrefix(prefix, h))
|
|
||||||
h = mux
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create request handler function
|
|
||||||
cb := js.FuncOf(func(_ js.Value, args []js.Value) interface{} {
|
|
||||||
promise, resolve, reject := newPromiseOptimized()
|
|
||||||
|
|
||||||
go handleRequest(h, args[1], resolve, reject)
|
|
||||||
|
|
||||||
return promise
|
|
||||||
})
|
|
||||||
|
|
||||||
jsWasmHTTP.Call("setHandler", cb)
|
|
||||||
return cb.Release
|
|
||||||
}
|
|
||||||
|
|
||||||
// handleRequest processes the request with panic recovery
|
|
||||||
func handleRequest(h http.Handler, jsReq js.Value, resolve, reject func(interface{})) {
|
|
||||||
defer func() {
|
|
||||||
if r := recover(); r != nil {
|
|
||||||
var errMsg string
|
|
||||||
if err, ok := r.(error); ok {
|
|
||||||
errMsg = fmt.Sprintf("wasmhttp: panic: %+v", err)
|
|
||||||
} else {
|
|
||||||
errMsg = fmt.Sprintf("wasmhttp: panic: %v", r)
|
|
||||||
}
|
|
||||||
reject(errMsg)
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
recorder := newResponseRecorder()
|
|
||||||
h.ServeHTTP(recorder, buildRequest(jsReq))
|
|
||||||
resolve(recorder.jsResponse())
|
|
||||||
}
|
|
||||||
|
|
||||||
// buildRequest creates an http.Request from JS Request
|
|
||||||
func buildRequest(jsReq js.Value) *http.Request {
|
|
||||||
// Get request body
|
|
||||||
arrayBuffer, err := awaitPromiseOptimized(jsReq.Call("arrayBuffer"))
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create body buffer
|
|
||||||
jsBody := jsUint8Array.New(arrayBuffer)
|
|
||||||
bodyLen := jsBody.Get("length").Int()
|
|
||||||
body := make([]byte, bodyLen)
|
|
||||||
js.CopyBytesToGo(body, jsBody)
|
|
||||||
|
|
||||||
// Create request
|
|
||||||
req := httptest.NewRequest(
|
|
||||||
jsReq.Get("method").String(),
|
|
||||||
jsReq.Get("url").String(),
|
|
||||||
bytes.NewReader(body),
|
|
||||||
)
|
|
||||||
|
|
||||||
// Set headers efficiently
|
|
||||||
headers := jsReq.Get("headers")
|
|
||||||
headersIt := headers.Call("entries")
|
|
||||||
for {
|
|
||||||
entry := headersIt.Call("next")
|
|
||||||
if entry.Get("done").Bool() {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
pair := entry.Get("value")
|
|
||||||
req.Header.Set(pair.Index(0).String(), pair.Index(1).String())
|
|
||||||
}
|
|
||||||
|
|
||||||
return req
|
|
||||||
}
|
|
||||||
|
|
||||||
// ResponseRecorder with optimized buffer handling
|
|
||||||
type ResponseRecorder struct {
|
|
||||||
*httptest.ResponseRecorder
|
|
||||||
buffer *bytes.Buffer
|
|
||||||
}
|
|
||||||
|
|
||||||
func newResponseRecorder() *ResponseRecorder {
|
|
||||||
return &ResponseRecorder{
|
|
||||||
ResponseRecorder: httptest.NewRecorder(),
|
|
||||||
buffer: bufferPool.Get().(*bytes.Buffer),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// jsResponse creates a JS Response with optimized memory usage
|
|
||||||
func (rr *ResponseRecorder) jsResponse() js.Value {
|
|
||||||
defer func() {
|
|
||||||
rr.buffer.Reset()
|
|
||||||
bufferPool.Put(rr.buffer)
|
|
||||||
}()
|
|
||||||
|
|
||||||
res := rr.Result()
|
|
||||||
defer res.Body.Close()
|
|
||||||
|
|
||||||
// Prepare response body
|
|
||||||
body := js.Undefined()
|
|
||||||
if res.ContentLength != 0 {
|
|
||||||
if _, err := io.Copy(rr.buffer, res.Body); err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
bodyBytes := rr.buffer.Bytes()
|
|
||||||
body = jsUint8Array.New(len(bodyBytes))
|
|
||||||
js.CopyBytesToJS(body, bodyBytes)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Prepare response init object
|
|
||||||
init := make(map[string]interface{}, 3)
|
|
||||||
if res.StatusCode != 0 {
|
|
||||||
init["status"] = res.StatusCode
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(res.Header) > 0 {
|
|
||||||
headers := make(map[string]interface{}, len(res.Header))
|
|
||||||
for k, v := range res.Header {
|
|
||||||
if len(v) > 0 {
|
|
||||||
headers[k] = v[0]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
init["headers"] = headers
|
|
||||||
}
|
|
||||||
|
|
||||||
return jsResponse.New(body, init)
|
|
||||||
}
|
|
||||||
|
|
||||||
// newPromiseOptimized creates a new JavaScript Promise with optimized callback handling
|
|
||||||
func newPromiseOptimized() (js.Value, func(interface{}), func(interface{})) {
|
|
||||||
var (
|
|
||||||
resolve func(interface{})
|
|
||||||
reject func(interface{})
|
|
||||||
promiseFunc = js.FuncOf(func(_ js.Value, args []js.Value) interface{} {
|
|
||||||
resolve = func(v interface{}) { args[0].Invoke(v) }
|
|
||||||
reject = func(v interface{}) { args[1].Invoke(v) }
|
|
||||||
return js.Undefined()
|
|
||||||
})
|
|
||||||
)
|
|
||||||
defer promiseFunc.Release()
|
|
||||||
|
|
||||||
return jsPromise.New(promiseFunc), resolve, reject
|
|
||||||
}
|
|
||||||
|
|
||||||
// awaitPromiseOptimized waits for Promise resolution with optimized channel handling
|
|
||||||
func awaitPromiseOptimized(promise js.Value) (js.Value, error) {
|
|
||||||
done := make(chan struct{})
|
|
||||||
var (
|
|
||||||
result js.Value
|
|
||||||
err error
|
|
||||||
)
|
|
||||||
|
|
||||||
thenFunc := js.FuncOf(func(_ js.Value, args []js.Value) interface{} {
|
|
||||||
result = args[0]
|
|
||||||
close(done)
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
defer thenFunc.Release()
|
|
||||||
|
|
||||||
catchFunc := js.FuncOf(func(_ js.Value, args []js.Value) interface{} {
|
|
||||||
err = js.Error{Value: args[0]}
|
|
||||||
close(done)
|
|
||||||
return nil
|
|
||||||
})
|
|
||||||
defer catchFunc.Release()
|
|
||||||
|
|
||||||
promise.Call("then", thenFunc).Call("catch", catchFunc)
|
|
||||||
<-done
|
|
||||||
|
|
||||||
return result, err
|
|
||||||
}
|
|
@ -16,7 +16,7 @@ import (
|
|||||||
|
|
||||||
"git.sr.ht/~sircmpwn/go-bare"
|
"git.sr.ht/~sircmpwn/go-bare"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/internal/crypto/core/curves"
|
"github.com/onsonr/sonr/crypto/core/curves"
|
||||||
)
|
)
|
||||||
|
|
||||||
type structMarshal struct {
|
type structMarshal struct {
|
@ -13,7 +13,7 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/internal/crypto/core/curves"
|
"github.com/onsonr/sonr/crypto/core/curves"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestNewAccumulator100(t *testing.T) {
|
func TestNewAccumulator100(t *testing.T) {
|
@ -12,7 +12,7 @@ import (
|
|||||||
|
|
||||||
"git.sr.ht/~sircmpwn/go-bare"
|
"git.sr.ht/~sircmpwn/go-bare"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/internal/crypto/core/curves"
|
"github.com/onsonr/sonr/crypto/core/curves"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SecretKey is the secret alpha only held by the accumulator manager.
|
// SecretKey is the secret alpha only held by the accumulator manager.
|
@ -11,7 +11,7 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/internal/crypto/core/curves"
|
"github.com/onsonr/sonr/crypto/core/curves"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestSecretKeyMarshal(t *testing.T) {
|
func TestSecretKeyMarshal(t *testing.T) {
|
@ -10,7 +10,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"math"
|
"math"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/internal/crypto/core/curves"
|
"github.com/onsonr/sonr/crypto/core/curves"
|
||||||
)
|
)
|
||||||
|
|
||||||
// dad constructs two polynomials - dA(x) and dD(x)
|
// dad constructs two polynomials - dA(x) and dD(x)
|
@ -11,7 +11,7 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/internal/crypto/core/curves"
|
"github.com/onsonr/sonr/crypto/core/curves"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestEvaluatePolyG1(t *testing.T) {
|
func TestEvaluatePolyG1(t *testing.T) {
|
@ -14,7 +14,7 @@ import (
|
|||||||
|
|
||||||
"git.sr.ht/~sircmpwn/go-bare"
|
"git.sr.ht/~sircmpwn/go-bare"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/internal/crypto/core/curves"
|
"github.com/onsonr/sonr/crypto/core/curves"
|
||||||
)
|
)
|
||||||
|
|
||||||
type proofParamsMarshal struct {
|
type proofParamsMarshal struct {
|
@ -11,7 +11,7 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/internal/crypto/core/curves"
|
"github.com/onsonr/sonr/crypto/core/curves"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestProofParamsMarshal(t *testing.T) {
|
func TestProofParamsMarshal(t *testing.T) {
|
@ -12,7 +12,7 @@ import (
|
|||||||
|
|
||||||
"git.sr.ht/~sircmpwn/go-bare"
|
"git.sr.ht/~sircmpwn/go-bare"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/internal/crypto/core/curves"
|
"github.com/onsonr/sonr/crypto/core/curves"
|
||||||
)
|
)
|
||||||
|
|
||||||
// MembershipWitness contains the witness c and the value y respect to the accumulator state.
|
// MembershipWitness contains the witness c and the value y respect to the accumulator state.
|
@ -11,7 +11,7 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/internal/crypto/core/curves"
|
"github.com/onsonr/sonr/crypto/core/curves"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Test_Membership_Witness_New(t *testing.T) {
|
func Test_Membership_Witness_New(t *testing.T) {
|
@ -10,7 +10,7 @@ import (
|
|||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"golang.org/x/crypto/sha3"
|
"golang.org/x/crypto/sha3"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/internal/crypto/core/curves"
|
"github.com/onsonr/sonr/crypto/core/curves"
|
||||||
)
|
)
|
||||||
|
|
||||||
// generators contains a list of points to be used as generators for bulletproofs.
|
// generators contains a list of points to be used as generators for bulletproofs.
|
@ -6,7 +6,7 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"golang.org/x/crypto/sha3"
|
"golang.org/x/crypto/sha3"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/internal/crypto/core/curves"
|
"github.com/onsonr/sonr/crypto/core/curves"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestGeneratorsHappyPath(t *testing.T) {
|
func TestGeneratorsHappyPath(t *testing.T) {
|
@ -9,7 +9,7 @@ package bulletproof
|
|||||||
import (
|
import (
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/internal/crypto/core/curves"
|
"github.com/onsonr/sonr/crypto/core/curves"
|
||||||
)
|
)
|
||||||
|
|
||||||
// innerProduct takes two lists of scalars (a, b) and performs the dot product returning a single scalar.
|
// innerProduct takes two lists of scalars (a, b) and performs the dot product returning a single scalar.
|
@ -6,7 +6,7 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/internal/crypto/core/curves"
|
"github.com/onsonr/sonr/crypto/core/curves"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestInnerProductHappyPath(t *testing.T) {
|
func TestInnerProductHappyPath(t *testing.T) {
|
@ -11,7 +11,7 @@ import (
|
|||||||
"github.com/gtank/merlin"
|
"github.com/gtank/merlin"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/internal/crypto/core/curves"
|
"github.com/onsonr/sonr/crypto/core/curves"
|
||||||
)
|
)
|
||||||
|
|
||||||
// InnerProductProver is the struct used to create InnerProductProofs
|
// InnerProductProver is the struct used to create InnerProductProofs
|
@ -7,7 +7,7 @@ import (
|
|||||||
"github.com/gtank/merlin"
|
"github.com/gtank/merlin"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/internal/crypto/core/curves"
|
"github.com/onsonr/sonr/crypto/core/curves"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestIPPHappyPath(t *testing.T) {
|
func TestIPPHappyPath(t *testing.T) {
|
@ -4,7 +4,7 @@ import (
|
|||||||
"github.com/gtank/merlin"
|
"github.com/gtank/merlin"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/internal/crypto/core/curves"
|
"github.com/onsonr/sonr/crypto/core/curves"
|
||||||
)
|
)
|
||||||
|
|
||||||
// InnerProductVerifier is the struct used to verify inner product proofs
|
// InnerProductVerifier is the struct used to verify inner product proofs
|
@ -7,7 +7,7 @@ import (
|
|||||||
"github.com/gtank/merlin"
|
"github.com/gtank/merlin"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/internal/crypto/core/curves"
|
"github.com/onsonr/sonr/crypto/core/curves"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestIPPVerifyHappyPath(t *testing.T) {
|
func TestIPPVerifyHappyPath(t *testing.T) {
|
@ -6,7 +6,7 @@ import (
|
|||||||
"github.com/gtank/merlin"
|
"github.com/gtank/merlin"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/internal/crypto/core/curves"
|
"github.com/onsonr/sonr/crypto/core/curves"
|
||||||
)
|
)
|
||||||
|
|
||||||
// BatchProve proves that a list of scalars v are in the range n.
|
// BatchProve proves that a list of scalars v are in the range n.
|
@ -7,7 +7,7 @@ import (
|
|||||||
"github.com/gtank/merlin"
|
"github.com/gtank/merlin"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/internal/crypto/core/curves"
|
"github.com/onsonr/sonr/crypto/core/curves"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestRangeBatchProverHappyPath(t *testing.T) {
|
func TestRangeBatchProverHappyPath(t *testing.T) {
|
@ -4,7 +4,7 @@ import (
|
|||||||
"github.com/gtank/merlin"
|
"github.com/gtank/merlin"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/internal/crypto/core/curves"
|
"github.com/onsonr/sonr/crypto/core/curves"
|
||||||
)
|
)
|
||||||
|
|
||||||
// VerifyBatched verifies a given batched range proof.
|
// VerifyBatched verifies a given batched range proof.
|
@ -7,7 +7,7 @@ import (
|
|||||||
"github.com/gtank/merlin"
|
"github.com/gtank/merlin"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/internal/crypto/core/curves"
|
"github.com/onsonr/sonr/crypto/core/curves"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestRangeBatchVerifyHappyPath(t *testing.T) {
|
func TestRangeBatchVerifyHappyPath(t *testing.T) {
|
@ -14,7 +14,7 @@ import (
|
|||||||
"github.com/gtank/merlin"
|
"github.com/gtank/merlin"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/internal/crypto/core/curves"
|
"github.com/onsonr/sonr/crypto/core/curves"
|
||||||
)
|
)
|
||||||
|
|
||||||
// RangeProver is the struct used to create RangeProofs
|
// RangeProver is the struct used to create RangeProofs
|
@ -7,7 +7,7 @@ import (
|
|||||||
"github.com/gtank/merlin"
|
"github.com/gtank/merlin"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/internal/crypto/core/curves"
|
"github.com/onsonr/sonr/crypto/core/curves"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestRangeProverHappyPath(t *testing.T) {
|
func TestRangeProverHappyPath(t *testing.T) {
|
@ -4,7 +4,7 @@ import (
|
|||||||
"github.com/gtank/merlin"
|
"github.com/gtank/merlin"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/internal/crypto/core/curves"
|
"github.com/onsonr/sonr/crypto/core/curves"
|
||||||
)
|
)
|
||||||
|
|
||||||
// RangeVerifier is the struct used to verify RangeProofs
|
// RangeVerifier is the struct used to verify RangeProofs
|
@ -7,7 +7,7 @@ import (
|
|||||||
"github.com/gtank/merlin"
|
"github.com/gtank/merlin"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/internal/crypto/core/curves"
|
"github.com/onsonr/sonr/crypto/core/curves"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestRangeVerifyHappyPath(t *testing.T) {
|
func TestRangeVerifyHappyPath(t *testing.T) {
|
@ -19,7 +19,7 @@ import (
|
|||||||
bls12377 "github.com/consensys/gnark-crypto/ecc/bls12-377"
|
bls12377 "github.com/consensys/gnark-crypto/ecc/bls12-377"
|
||||||
"golang.org/x/crypto/sha3"
|
"golang.org/x/crypto/sha3"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/internal/crypto/core"
|
"github.com/onsonr/sonr/crypto/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
// See 'r' = https://eprint.iacr.org/2018/962.pdf Figure 16
|
// See 'r' = https://eprint.iacr.org/2018/962.pdf Figure 16
|
@ -13,9 +13,9 @@ import (
|
|||||||
|
|
||||||
"golang.org/x/crypto/sha3"
|
"golang.org/x/crypto/sha3"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/internal/crypto/core/curves/native"
|
"github.com/onsonr/sonr/crypto/core/curves/native"
|
||||||
"github.com/onsonr/sonr/internal/crypto/core/curves/native/bls12381"
|
"github.com/onsonr/sonr/crypto/core/curves/native/bls12381"
|
||||||
"github.com/onsonr/sonr/internal/crypto/internal"
|
"github.com/onsonr/sonr/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
var bls12381modulus = bhex("1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab")
|
var bls12381modulus = bhex("1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab")
|
@ -16,7 +16,7 @@ import (
|
|||||||
"math/big"
|
"math/big"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/internal/crypto/core/curves/native/bls12381"
|
"github.com/onsonr/sonr/crypto/core/curves/native/bls12381"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
@ -12,10 +12,10 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"math/big"
|
"math/big"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/internal/crypto/core"
|
"github.com/onsonr/sonr/crypto/core"
|
||||||
|
|
||||||
"github.com/dustinxie/ecc"
|
"github.com/dustinxie/ecc"
|
||||||
"github.com/onsonr/sonr/internal/crypto/internal"
|
"github.com/onsonr/sonr/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
var curveNameToID = map[string]byte{
|
var curveNameToID = map[string]byte{
|
@ -15,8 +15,8 @@ import (
|
|||||||
"github.com/btcsuite/btcd/btcec/v2"
|
"github.com/btcsuite/btcd/btcec/v2"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/internal/crypto/core"
|
"github.com/onsonr/sonr/crypto/core"
|
||||||
tt "github.com/onsonr/sonr/internal/crypto/internal"
|
tt "github.com/onsonr/sonr/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestIsIdentity(t *testing.T) {
|
func TestIsIdentity(t *testing.T) {
|
@ -18,9 +18,9 @@ import (
|
|||||||
"github.com/btcsuite/btcd/btcec/v2"
|
"github.com/btcsuite/btcd/btcec/v2"
|
||||||
"github.com/bwesterb/go-ristretto"
|
"github.com/bwesterb/go-ristretto"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/internal/crypto/core"
|
"github.com/onsonr/sonr/crypto/core"
|
||||||
"github.com/onsonr/sonr/internal/crypto/core/curves/native/bls12381"
|
"github.com/onsonr/sonr/crypto/core/curves/native/bls12381"
|
||||||
"github.com/onsonr/sonr/internal/crypto/internal"
|
"github.com/onsonr/sonr/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
type EcScalar interface {
|
type EcScalar interface {
|
@ -19,7 +19,7 @@ import (
|
|||||||
"github.com/bwesterb/go-ristretto"
|
"github.com/bwesterb/go-ristretto"
|
||||||
ed "github.com/bwesterb/go-ristretto/edwards25519"
|
ed "github.com/bwesterb/go-ristretto/edwards25519"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/internal/crypto/internal"
|
"github.com/onsonr/sonr/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ScalarEd25519 struct {
|
type ScalarEd25519 struct {
|
@ -15,7 +15,7 @@ import (
|
|||||||
ed "filippo.io/edwards25519"
|
ed "filippo.io/edwards25519"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/internal/crypto/internal"
|
"github.com/onsonr/sonr/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestScalarEd25519Random(t *testing.T) {
|
func TestScalarEd25519Random(t *testing.T) {
|
@ -9,8 +9,8 @@ import (
|
|||||||
|
|
||||||
"github.com/btcsuite/btcd/btcec/v2"
|
"github.com/btcsuite/btcd/btcec/v2"
|
||||||
|
|
||||||
mod "github.com/onsonr/sonr/internal/crypto/core"
|
mod "github.com/onsonr/sonr/crypto/core"
|
||||||
"github.com/onsonr/sonr/internal/crypto/internal"
|
"github.com/onsonr/sonr/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
func BenchmarkK256(b *testing.B) {
|
func BenchmarkK256(b *testing.B) {
|
@ -15,11 +15,11 @@ import (
|
|||||||
|
|
||||||
"github.com/btcsuite/btcd/btcec/v2"
|
"github.com/btcsuite/btcd/btcec/v2"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/internal/crypto/core/curves/native"
|
"github.com/onsonr/sonr/crypto/core/curves/native"
|
||||||
secp256k1 "github.com/onsonr/sonr/internal/crypto/core/curves/native/k256"
|
secp256k1 "github.com/onsonr/sonr/crypto/core/curves/native/k256"
|
||||||
"github.com/onsonr/sonr/internal/crypto/core/curves/native/k256/fp"
|
"github.com/onsonr/sonr/crypto/core/curves/native/k256/fp"
|
||||||
"github.com/onsonr/sonr/internal/crypto/core/curves/native/k256/fq"
|
"github.com/onsonr/sonr/crypto/core/curves/native/k256/fq"
|
||||||
"github.com/onsonr/sonr/internal/crypto/internal"
|
"github.com/onsonr/sonr/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
@ -3,7 +3,7 @@ package bls12381
|
|||||||
import (
|
import (
|
||||||
"math/bits"
|
"math/bits"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/internal/crypto/core/curves/native"
|
"github.com/onsonr/sonr/crypto/core/curves/native"
|
||||||
)
|
)
|
||||||
|
|
||||||
var fqModulusBytes = [native.FieldBytes]byte{0x01, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x5b, 0xfe, 0xff, 0x02, 0xa4, 0xbd, 0x53, 0x05, 0xd8, 0xa1, 0x09, 0x08, 0xd8, 0x39, 0x33, 0x48, 0x7d, 0x9d, 0x29, 0x53, 0xa7, 0xed, 0x73}
|
var fqModulusBytes = [native.FieldBytes]byte{0x01, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x5b, 0xfe, 0xff, 0x02, 0xa4, 0xbd, 0x53, 0x05, 0xd8, 0xa1, 0x09, 0x08, 0xd8, 0x39, 0x33, 0x48, 0x7d, 0x9d, 0x29, 0x53, 0xa7, 0xed, 0x73}
|
@ -6,8 +6,8 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"math/big"
|
"math/big"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/internal/crypto/core/curves/native"
|
"github.com/onsonr/sonr/crypto/core/curves/native"
|
||||||
"github.com/onsonr/sonr/internal/crypto/internal"
|
"github.com/onsonr/sonr/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
// fp field element mod p
|
// fp field element mod p
|
@ -14,7 +14,7 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/internal/crypto/internal"
|
"github.com/onsonr/sonr/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestFpSetOne(t *testing.T) {
|
func TestFpSetOne(t *testing.T) {
|
@ -5,7 +5,7 @@ import (
|
|||||||
"math/big"
|
"math/big"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/internal/crypto/core/curves/native"
|
"github.com/onsonr/sonr/crypto/core/curves/native"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Fq [native.FieldLimbs]uint64
|
type Fq [native.FieldLimbs]uint64
|
@ -14,8 +14,8 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/internal/crypto/core/curves/native"
|
"github.com/onsonr/sonr/crypto/core/curves/native"
|
||||||
"github.com/onsonr/sonr/internal/crypto/internal"
|
"github.com/onsonr/sonr/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestFqSetOne(t *testing.T) {
|
func TestFqSetOne(t *testing.T) {
|
@ -7,8 +7,8 @@ import (
|
|||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/internal/crypto/core/curves/native"
|
"github.com/onsonr/sonr/crypto/core/curves/native"
|
||||||
"github.com/onsonr/sonr/internal/crypto/internal"
|
"github.com/onsonr/sonr/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
@ -7,7 +7,7 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/internal/crypto/core/curves/native"
|
"github.com/onsonr/sonr/crypto/core/curves/native"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestG1IsOnCurve(t *testing.T) {
|
func TestG1IsOnCurve(t *testing.T) {
|
@ -7,8 +7,8 @@ import (
|
|||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/internal/crypto/core/curves/native"
|
"github.com/onsonr/sonr/crypto/core/curves/native"
|
||||||
"github.com/onsonr/sonr/internal/crypto/internal"
|
"github.com/onsonr/sonr/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
@ -7,7 +7,7 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/internal/crypto/core/curves/native"
|
"github.com/onsonr/sonr/crypto/core/curves/native"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestG2IsOnCurve(t *testing.T) {
|
func TestG2IsOnCurve(t *testing.T) {
|
@ -3,8 +3,8 @@ package bls12381
|
|||||||
import (
|
import (
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/internal/crypto/core/curves/native"
|
"github.com/onsonr/sonr/crypto/core/curves/native"
|
||||||
"github.com/onsonr/sonr/internal/crypto/internal"
|
"github.com/onsonr/sonr/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GtFieldBytes is the number of bytes needed to represent this field
|
// GtFieldBytes is the number of bytes needed to represent this field
|
@ -6,7 +6,7 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/internal/crypto/core/curves/native"
|
"github.com/onsonr/sonr/crypto/core/curves/native"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestSinglePairing(t *testing.T) {
|
func TestSinglePairing(t *testing.T) {
|
@ -5,7 +5,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"math/big"
|
"math/big"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/internal/crypto/internal"
|
"github.com/onsonr/sonr/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
// FieldLimbs is the number of limbs needed to represent this field
|
// FieldLimbs is the number of limbs needed to represent this field
|
@ -10,7 +10,7 @@ import (
|
|||||||
"math/big"
|
"math/big"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/internal/crypto/core/curves/native"
|
"github.com/onsonr/sonr/crypto/core/curves/native"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
@ -14,8 +14,8 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/internal/crypto/core/curves/native"
|
"github.com/onsonr/sonr/crypto/core/curves/native"
|
||||||
"github.com/onsonr/sonr/internal/crypto/internal"
|
"github.com/onsonr/sonr/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestFpSetOne(t *testing.T) {
|
func TestFpSetOne(t *testing.T) {
|
@ -10,7 +10,7 @@ import (
|
|||||||
"math/big"
|
"math/big"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/internal/crypto/core/curves/native"
|
"github.com/onsonr/sonr/crypto/core/curves/native"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
@ -14,8 +14,8 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/internal/crypto/core/curves/native"
|
"github.com/onsonr/sonr/crypto/core/curves/native"
|
||||||
"github.com/onsonr/sonr/internal/crypto/internal"
|
"github.com/onsonr/sonr/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestFqSetOne(t *testing.T) {
|
func TestFqSetOne(t *testing.T) {
|
@ -3,9 +3,9 @@ package k256
|
|||||||
import (
|
import (
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/internal/crypto/core/curves/native"
|
"github.com/onsonr/sonr/crypto/core/curves/native"
|
||||||
"github.com/onsonr/sonr/internal/crypto/core/curves/native/k256/fp"
|
"github.com/onsonr/sonr/crypto/core/curves/native/k256/fp"
|
||||||
"github.com/onsonr/sonr/internal/crypto/internal"
|
"github.com/onsonr/sonr/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
@ -5,8 +5,8 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/internal/crypto/core/curves/native"
|
"github.com/onsonr/sonr/crypto/core/curves/native"
|
||||||
"github.com/onsonr/sonr/internal/crypto/core/curves/native/k256"
|
"github.com/onsonr/sonr/crypto/core/curves/native/k256"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestK256PointArithmetic_Hash(t *testing.T) {
|
func TestK256PointArithmetic_Hash(t *testing.T) {
|
@ -10,7 +10,7 @@ import (
|
|||||||
"math/big"
|
"math/big"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/internal/crypto/core/curves/native"
|
"github.com/onsonr/sonr/crypto/core/curves/native"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
@ -14,8 +14,8 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/internal/crypto/core/curves/native"
|
"github.com/onsonr/sonr/crypto/core/curves/native"
|
||||||
"github.com/onsonr/sonr/internal/crypto/internal"
|
"github.com/onsonr/sonr/crypto/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestFpSetOne(t *testing.T) {
|
func TestFpSetOne(t *testing.T) {
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user