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:
Prad Nukala 2025-01-06 12:06:10 -05:00 committed by GitHub
parent 9bd5e41fa0
commit 807b2e86ec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
483 changed files with 8067 additions and 12559 deletions

32
.github/Taskfile.yml vendored
View File

@ -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
View File

@ -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
View File

@ -2,9 +2,6 @@
"scopes": [
"core-chain",
"core-ibc",
"sonr-hway",
"sonr-matrix",
"sonr-motr",
"x-did",
"x-dwn",
"x-svc",
@ -16,35 +13,19 @@
],
"docs": [
{
"keywords": [
"github",
"actions",
"workflows",
"syntax"
],
"keywords": ["github", "actions", "workflows", "syntax"],
"url": "https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions"
},
{
"keywords": [
"cosmos",
"tooling",
"cosmovisor"
],
"keywords": ["cosmos", "tooling", "cosmovisor"],
"url": "https://docs.cosmos.network/v0.50/build/tooling/cosmovisor"
},
{
"keywords": [
"process-compose",
"configuration"
],
"keywords": ["process-compose", "configuration"],
"url": "https://f1bonacc1.github.io/process-compose/configuration/"
},
{
"keywords": [
"taskfile",
"cli",
"reference"
],
"keywords": ["taskfile", "cli", "reference"],
"url": "https://taskfile.dev/reference/cli"
},
{
@ -52,250 +33,115 @@
"url": "https://taskfile.dev/reference/schema"
},
{
"keywords": [
"taskfile",
"templating",
"reference"
],
"keywords": ["taskfile", "templating", "reference"],
"url": "https://taskfile.dev/reference/templating/"
},
{
"keywords": [
"mkdocs",
"material",
"reference"
],
"keywords": ["mkdocs", "material", "reference"],
"url": "https://squidfunk.github.io/mkdocs-material/reference/"
},
{
"keywords": [
"pkl",
"language",
"reference"
],
"keywords": ["pkl", "language", "reference"],
"url": "https://pkl-lang.org/main/current/language-reference/index.html"
},
{
"keywords": [
"pwa",
"service-workers",
"web"
],
"keywords": ["pwa", "service-workers", "web"],
"url": "https://web.dev/learn/pwa/service-workers/"
},
{
"keywords": [
"service-workers",
"web",
"api"
],
"keywords": ["service-workers", "web", "api"],
"url": "https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API"
},
{
"keywords": [
"web-authentication",
"web",
"api"
],
"keywords": ["web-authentication", "web", "api"],
"url": "https://developer.mozilla.org/en-US/docs/Web/API/Web_Authentication_API"
},
{
"keywords": [
"sdk",
"modules",
"cosmos",
"manager"
],
"keywords": ["sdk", "modules", "cosmos", "manager"],
"url": "https://docs.cosmos.network/v0.50/build/building-modules/module-manager"
},
{
"keywords": [
"sdk",
"modules",
"cosmos",
"messages",
"queries"
],
"keywords": ["sdk", "modules", "cosmos", "messages", "queries"],
"url": "https://docs.cosmos.network/v0.50/build/building-modules/messages-and-queries"
},
{
"keywords": [
"sdk",
"modules",
"messages",
"service",
"cosmos"
],
"keywords": ["sdk", "modules", "messages", "service", "cosmos"],
"url": "https://docs.cosmos.network/v0.50/build/building-modules/msg-services"
},
{
"keywords": [
"sdk",
"modules",
"services",
"cosmos",
"query"
],
"keywords": ["sdk", "modules", "services", "cosmos", "query"],
"url": "https://docs.cosmos.network/v0.50/build/building-modules/query-services"
},
{
"keywords": [
"cosmos",
"depinject",
"modules",
"sdk"
],
"keywords": ["cosmos", "depinject", "modules", "sdk"],
"url": "https://docs.cosmos.network/v0.50/build/building-modules/depinject"
},
{
"keywords": [
"ibc",
"apps",
"sdk",
"interchain-accounts"
],
"keywords": ["ibc", "apps", "sdk", "interchain-accounts"],
"url": "https://ibc.cosmos.network/v8/apps/interchain-accounts/overview/"
},
{
"keywords": [
"ibc",
"apps",
"sdk",
"transfer"
],
"keywords": ["ibc", "apps", "sdk", "transfer"],
"url": "https://ibc.cosmos.network/v8/apps/transfer/overview/"
},
{
"keywords": [
"osmosis",
"modules",
"ibc",
"assets"
],
"keywords": ["osmosis", "modules", "ibc", "assets"],
"url": "https://docs.osmosis.zone/osmosis-core/asset-info/"
},
{
"keywords": [
"ibc",
"osmosis",
"tokenfactory",
"modules",
"assets"
],
"keywords": ["ibc", "osmosis", "tokenfactory", "modules", "assets"],
"url": "https://docs.osmosis.zone/osmosis-core/modules/tokenfactory"
},
{
"keywords": [
"ibc",
"mint",
"cctp",
"noble",
"assets"
],
"keywords": ["ibc", "mint", "cctp", "noble", "assets"],
"url": "https://docs.noble.xyz/cctp/mint"
},
{
"keywords": [
"ibc",
"relayer",
"nomic",
"assets"
],
"keywords": ["ibc", "relayer", "nomic", "assets"],
"url": "https://docs.nomic.io/network/ibc-relayer"
},
{
"keywords": [
"ibc",
"cctp",
"noble",
"mint_forward",
"assets"
],
"keywords": ["ibc", "cctp", "noble", "mint_forward", "assets"],
"url": "https://docs.noble.xyz/cctp/mint_forward"
},
{
"keywords": [
"evmos",
"erc20",
"assets"
],
"keywords": ["evmos", "erc20", "assets"],
"url": "https://docs.evmos.org/protocol/modules/erc20"
},
{
"keywords": [
"nomic",
"nbtc",
"assets"
],
"keywords": ["nomic", "nbtc", "assets"],
"url": "https://docs.nomic.io/nbtc"
},
{
"keywords": [
"mpc",
"wallet",
"cryptography",
"capability",
"invokation"
],
"keywords": ["mpc", "wallet", "cryptography", "capability", "invokation"],
"url": "https://csrc.nist.gov/CSRC/media/Events/NTCW19/papers/paper-DKLS.pdf"
},
{
"keywords": [
"ucan",
"spec",
"cryptography",
"authorization"
],
"keywords": ["ucan", "spec", "cryptography", "authorization"],
"url": "https://raw.githubusercontent.com/ucan-wg/spec/refs/heads/main/README.md"
},
{
"keywords": [
"zero-knowledge",
"proofs",
"cryptography",
"privacy"
],
"keywords": ["zero-knowledge", "proofs", "cryptography", "privacy"],
"url": "https://eprint.iacr.org/2021/1672.pdf"
},
{
"keywords": [
"gateway",
"http",
"sse"
],
"keywords": ["gateway", "http", "sse"],
"url": "https://echo.labstack.com/docs/cookbook/sse"
},
{
"keywords": [
"gateway",
"http",
"websocket"
],
"keywords": ["gateway", "http", "websocket"],
"url": "https://echo.labstack.com/docs/cookbook/websocket"
},
{
"keywords": [
"gateway",
"http",
"subdomain"
],
"keywords": ["gateway", "http", "subdomain"],
"url": "https://echo.labstack.com/docs/cookbook/subdomain"
},
{
"keywords": [
"tigerbeetle",
"models",
"oracle"
],
"keywords": ["tigerbeetle", "models", "oracle"],
"url": "https://docs.tigerbeetle.com/coding/data-modeling"
},
{
"keywords": [
"tigerbeetle",
"two=phase",
"transfers",
"oracle"
],
"keywords": ["tigerbeetle", "two=phase", "transfers", "oracle"],
"url": "https://docs.tigerbeetle.com/coding/two-phase-transfers"
},
{
@ -309,12 +155,7 @@
"url": "https://docs.tigerbeetle.com/coding/reliable-transaction-submission"
},
{
"keywords": [
"currency",
"exchange",
"tigerbeetle",
"oracle"
],
"keywords": ["currency", "exchange", "tigerbeetle", "oracle"],
"url": "https://docs.tigerbeetle.com/coding/recipes/currency-exchange"
},
{
@ -328,171 +169,79 @@
"url": "https://docs.tigerbeetle.com/coding/recipes/balance-conditional-transfers"
},
{
"keywords": [
"tigerbeetle",
"account",
"oracle"
],
"keywords": ["tigerbeetle", "account", "oracle"],
"url": "https://docs.tigerbeetle.com/reference/account"
},
{
"keywords": [
"tigerbeetle",
"transfer",
"oracle"
],
"keywords": ["tigerbeetle", "transfer", "oracle"],
"url": "https://docs.tigerbeetle.com/reference/transfer"
},
{
"keywords": [
"substreams",
"packages",
"consumer",
"oracle"
],
"keywords": ["substreams", "packages", "consumer", "oracle"],
"url": "https://docs.substreams.dev/documentation/consume/packages"
},
{
"keywords": [
"substreams",
"deploy",
"service",
"oracle"
],
"keywords": ["substreams", "deploy", "service", "oracle"],
"url": "https://docs.substreams.dev/documentation/consume/sql/deployable-services/local-service"
},
{
"keywords": [
"substreams",
"tutorial",
"cosmos",
"injective"
],
"keywords": ["substreams", "tutorial", "cosmos", "injective"],
"url": "https://docs.substreams.dev/tutorials/cosmos/injective/foundational"
},
{
"keywords": [
"worker",
"http",
"jwt"
],
"keywords": ["worker", "http", "jwt"],
"url": "https://echo.labstack.com/docs/cookbook/jwt"
},
{
"keywords": [
"worker",
"http",
"secure"
],
"keywords": ["worker", "http", "secure"],
"url": "https://echo.labstack.com/docs/middleware/secure"
},
{
"keywords": [
"worker",
"http",
"service-workers",
"web",
"api"
],
"keywords": ["worker", "http", "service-workers", "web", "api"],
"url": "https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API"
},
{
"keywords": [
"synapse",
"matrix",
"configuration",
"usage"
],
"keywords": ["synapse", "matrix", "configuration", "usage"],
"url": "https://element-hq.github.io/synapse/latest/usage/configuration/config_documentation.html"
},
{
"keywords": [
"cosmos",
"protobuf",
"orm",
"sdk"
],
"keywords": ["cosmos", "protobuf", "orm", "sdk"],
"url": "https://docs.cosmos.network/v0.50/build/packages/orm"
},
{
"keywords": [
"cosmos",
"sdk",
"modules",
"auth"
],
"keywords": ["cosmos", "sdk", "modules", "auth"],
"url": "https://docs.cosmos.network/v0.50/build/modules/auth"
},
{
"keywords": [
"cosmos",
"sdk",
"modules",
"bank"
],
"keywords": ["cosmos", "sdk", "modules", "bank"],
"url": "https://docs.cosmos.network/v0.50/build/modules/bank"
},
{
"keywords": [
"cosmos",
"modules",
"authz",
"sdk"
],
"keywords": ["cosmos", "modules", "authz", "sdk"],
"url": "https://docs.cosmos.network/v0.50/build/modules/authz"
},
{
"keywords": [
"cosmos",
"protobuf",
"collections",
"sdk"
],
"keywords": ["cosmos", "protobuf", "collections", "sdk"],
"url": "https://docs.cosmos.network/v0.50/build/packages/collections"
},
{
"keywords": [
"cosmos",
"modules",
"gov",
"sdk"
],
"keywords": ["cosmos", "modules", "gov", "sdk"],
"url": "https://docs.cosmos.network/v0.50/build/modules/gov"
},
{
"keywords": [
"cosmos",
"modules",
"staking",
"sdk"
],
"keywords": ["cosmos", "modules", "staking", "sdk"],
"url": "https://docs.cosmos.network/v0.50/build/modules/staking"
},
{
"keywords": [
"cosmos",
"protobuf",
"annotations",
"sdk"
],
"keywords": ["cosmos", "protobuf", "annotations", "sdk"],
"url": "https://docs.cosmos.network/v0.50/build/building-modules/protobuf-annotations"
},
{
"keywords": [
"cosmos",
"sdk",
"modules",
"group"
],
"keywords": ["cosmos", "sdk", "modules", "group"],
"url": "https://docs.cosmos.network/v0.50/build/modules/group"
},
{
"keywords": [
"cosmos",
"sdk",
"modules",
"nft"
],
"keywords": ["cosmos", "sdk", "modules", "nft"],
"url": "https://docs.cosmos.network/v0.50/build/modules/nft"
}
],

View File

@ -21,7 +21,10 @@ jobs:
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
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:
if: github.event_name == 'pull_request'
@ -41,10 +44,6 @@ jobs:
check-latest: true
- name: Run Sonrd Build
run: make build
- name: Run Hway Build
run: make build-hway
- name: Run Motr Build
run: make build-motr
test-unit:
if: github.event_name == 'pull_request'

View File

@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
ssh-key: "${{ secrets.COMMIT_KEY }}"

View File

@ -22,3 +22,25 @@ jobs:
with:
input: proto
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

View File

@ -55,4 +55,3 @@ jobs:
REDDIT_SECRET: ${{ secrets.REDDIT_SECRET }}
REDDIT_USERNAME: ${{ secrets.REDDIT_USERNAME }}
REDDIT_PASSWORD: ${{ secrets.REDDIT_PASSWORD }}

3
.gitignore vendored
View File

@ -1,6 +1,5 @@
# Aider related generated files
MESSAGE.md
CONVENTIONS.md
.aider-context
# Binaries
.task

View File

@ -2,15 +2,15 @@
version: 2
project_name: sonr
builds:
- id: motr
main: ./cmd/motr
binary: app
goos:
- js
goarch:
- wasm
before:
hooks:
- echo "Release date is {{ .Env.RELEASE_DATE }}"
- docker build -t ghcr.io/onsonr/sonr:latest .
- docker tag ghcr.io/onsonr/sonr:latest ghcr.io/onsonr/sonr:{{ .Tag }}
- docker push ghcr.io/onsonr/sonr:{{ .Tag }}
- docker push ghcr.io/onsonr/sonr:latest
builds:
- id: sonr
main: ./cmd/sonrd
binary: sonrd
@ -36,27 +36,6 @@ builds:
- netgo
- 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:
- id: sonr
builds: [sonr]
@ -69,41 +48,7 @@ archives:
- src: README*
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:
- 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
package_name: sonrd
file_name_template: "sonrd_{{ .Os }}_{{ .Arch }}{{ .ConventionalExtension }}"
@ -128,23 +73,6 @@ nfpms:
# 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:
@ -152,7 +80,7 @@ brews:
email: bot@goreleaser.com
directory: Formula
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."
dependencies:
- name: ipfs
@ -166,7 +94,7 @@ release:
github:
owner: onsonr
name: sonr
name_template: 'Release {{ .Env.RELEASE_DATE }}'
name_template: "{{ .Tag }} | {{ .Env.RELEASE_DATE }}"
draft: false
replace_existing_draft: true
replace_existing_artifacts: true

9
.trunk/.gitignore vendored Normal file
View File

@ -0,0 +1,9 @@
*out
*logs
*actions
*notifications
*tools
plugins
user_trunk.yaml
user.yaml
tmp

View 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$"

View File

@ -0,0 +1,4 @@
# Following source doesn't work in most setups
ignored:
- SC1090
- SC1091

View File

@ -0,0 +1,2 @@
# Prettier friendly markdownlint config (all formatting rules disabled)
extends: markdownlint/style/prettier

View File

@ -0,0 +1 @@
edition = "2021"

View 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

View 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
View 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

View File

@ -475,7 +475,7 @@
- **cta**: Fix typo in CTA title
- change bento section title to reflect security focus
- adjust hero image dimensions
- **Input**: Change type from to
- **Input**: Change type from to
- update hero image height in config.pkl
### Refactor
@ -507,7 +507,7 @@
- remove old changelog entries
- rename buf-publish.yml to publish-assets.yml
- remove unused field from
- remove unused field from
- remove unnecessary checkout in scheduled-release workflow
- rename build ID to sonr
- remove unnecessary release existence check
@ -626,7 +626,7 @@
- extract root command creation to separate file
- move ipfs setup to function
- remove unnecessary proxy config
- rename script to
- rename script to
- move DWN proxy server logic to separate file
- use htmx instead of dwn for vault client
- remove unused environment variables
@ -634,7 +634,7 @@
- use staking keeper in DID keeper
- remove unused dependencies
- remove unused image building workflow
- add field to
- add field to
- Update KeyKind Enum to have proper naming conventions
- Update `DIDNamespace` to have proper naming convention
- expose ports directly in docker-compose

0
CONVENTIONS.md Normal file
View File

View 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"]
@ -31,6 +31,8 @@ RUN LEDGER_ENABLED=false BUILD_TAGS=muslc LINK_STATICALLY=true make build \
# --------------------------------------------------------
FROM debian:11-slim
LABEL org.opencontainers.image.source https://github.com/onsonr/sonr
COPY --from=go-builder /code/build/sonrd /usr/bin/sonrd
# Install dependencies for Debian 11

View File

@ -8,14 +8,16 @@ 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
# Fetch from env
RELEASE_DATE ?= $(shell date +%Y).$(shell date +%V).$(shell date +%u)
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
DOCKER := $(shell which docker)
HTTPS_GIT := github.com/onsonr/sonr.git
PROCESS_COMPOSE := $(shell which process-compose)
export GO111MODULE = on
@ -107,8 +109,14 @@ install: go.sum
install-hway: go.sum
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
########################################
go-mod-cache: go.sum
@echo "--> Download go modules to local cache"
@ -134,12 +142,9 @@ clean:
distclean: clean
rm -rf vendor/
init-env:
@echo "Installing process-compose"
sh scripts/init_env.sh
########################################
### Testing
########################################
test: test-unit
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
###############################################################################
### 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 ###
###############################################################################

View File

@ -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

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -16,7 +16,7 @@ import (
"git.sr.ht/~sircmpwn/go-bare"
"github.com/onsonr/sonr/internal/crypto/core/curves"
"github.com/onsonr/sonr/crypto/core/curves"
)
type structMarshal struct {

View File

@ -13,7 +13,7 @@ import (
"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) {

View File

@ -12,7 +12,7 @@ import (
"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.

View File

@ -11,7 +11,7 @@ import (
"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) {

View File

@ -10,7 +10,7 @@ import (
"fmt"
"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)

View File

@ -11,7 +11,7 @@ import (
"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) {

View File

@ -14,7 +14,7 @@ import (
"git.sr.ht/~sircmpwn/go-bare"
"github.com/onsonr/sonr/internal/crypto/core/curves"
"github.com/onsonr/sonr/crypto/core/curves"
)
type proofParamsMarshal struct {

View File

@ -11,7 +11,7 @@ import (
"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) {

View File

@ -12,7 +12,7 @@ import (
"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.

View File

@ -11,7 +11,7 @@ import (
"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) {

View File

@ -10,7 +10,7 @@ import (
"github.com/pkg/errors"
"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.

View File

@ -6,7 +6,7 @@ import (
"github.com/stretchr/testify/require"
"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) {

View File

@ -9,7 +9,7 @@ package bulletproof
import (
"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.

View File

@ -6,7 +6,7 @@ import (
"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) {

View File

@ -11,7 +11,7 @@ import (
"github.com/gtank/merlin"
"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

View File

@ -7,7 +7,7 @@ import (
"github.com/gtank/merlin"
"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) {

View File

@ -4,7 +4,7 @@ import (
"github.com/gtank/merlin"
"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

View File

@ -7,7 +7,7 @@ import (
"github.com/gtank/merlin"
"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) {

View File

@ -6,7 +6,7 @@ import (
"github.com/gtank/merlin"
"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.

View File

@ -7,7 +7,7 @@ import (
"github.com/gtank/merlin"
"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) {

View File

@ -4,7 +4,7 @@ import (
"github.com/gtank/merlin"
"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.

View File

@ -7,7 +7,7 @@ import (
"github.com/gtank/merlin"
"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) {

View File

@ -14,7 +14,7 @@ import (
"github.com/gtank/merlin"
"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

View File

@ -7,7 +7,7 @@ import (
"github.com/gtank/merlin"
"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) {

View File

@ -4,7 +4,7 @@ import (
"github.com/gtank/merlin"
"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

View File

@ -7,7 +7,7 @@ import (
"github.com/gtank/merlin"
"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) {

View File

@ -19,7 +19,7 @@ import (
bls12377 "github.com/consensys/gnark-crypto/ecc/bls12-377"
"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

View File

@ -13,9 +13,9 @@ import (
"golang.org/x/crypto/sha3"
"github.com/onsonr/sonr/internal/crypto/core/curves/native"
"github.com/onsonr/sonr/internal/crypto/core/curves/native/bls12381"
"github.com/onsonr/sonr/internal/crypto/internal"
"github.com/onsonr/sonr/crypto/core/curves/native"
"github.com/onsonr/sonr/crypto/core/curves/native/bls12381"
"github.com/onsonr/sonr/crypto/internal"
)
var bls12381modulus = bhex("1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab")

View File

@ -16,7 +16,7 @@ import (
"math/big"
"sync"
"github.com/onsonr/sonr/internal/crypto/core/curves/native/bls12381"
"github.com/onsonr/sonr/crypto/core/curves/native/bls12381"
)
var (

View File

@ -12,10 +12,10 @@ import (
"fmt"
"math/big"
"github.com/onsonr/sonr/internal/crypto/core"
"github.com/onsonr/sonr/crypto/core"
"github.com/dustinxie/ecc"
"github.com/onsonr/sonr/internal/crypto/internal"
"github.com/onsonr/sonr/crypto/internal"
)
var curveNameToID = map[string]byte{

View File

@ -15,8 +15,8 @@ import (
"github.com/btcsuite/btcd/btcec/v2"
"github.com/stretchr/testify/require"
"github.com/onsonr/sonr/internal/crypto/core"
tt "github.com/onsonr/sonr/internal/crypto/internal"
"github.com/onsonr/sonr/crypto/core"
tt "github.com/onsonr/sonr/crypto/internal"
)
func TestIsIdentity(t *testing.T) {

View File

@ -18,9 +18,9 @@ import (
"github.com/btcsuite/btcd/btcec/v2"
"github.com/bwesterb/go-ristretto"
"github.com/onsonr/sonr/internal/crypto/core"
"github.com/onsonr/sonr/internal/crypto/core/curves/native/bls12381"
"github.com/onsonr/sonr/internal/crypto/internal"
"github.com/onsonr/sonr/crypto/core"
"github.com/onsonr/sonr/crypto/core/curves/native/bls12381"
"github.com/onsonr/sonr/crypto/internal"
)
type EcScalar interface {

View File

@ -19,7 +19,7 @@ import (
"github.com/bwesterb/go-ristretto"
ed "github.com/bwesterb/go-ristretto/edwards25519"
"github.com/onsonr/sonr/internal/crypto/internal"
"github.com/onsonr/sonr/crypto/internal"
)
type ScalarEd25519 struct {

View File

@ -15,7 +15,7 @@ import (
ed "filippo.io/edwards25519"
"github.com/stretchr/testify/require"
"github.com/onsonr/sonr/internal/crypto/internal"
"github.com/onsonr/sonr/crypto/internal"
)
func TestScalarEd25519Random(t *testing.T) {

View File

@ -9,8 +9,8 @@ import (
"github.com/btcsuite/btcd/btcec/v2"
mod "github.com/onsonr/sonr/internal/crypto/core"
"github.com/onsonr/sonr/internal/crypto/internal"
mod "github.com/onsonr/sonr/crypto/core"
"github.com/onsonr/sonr/crypto/internal"
)
func BenchmarkK256(b *testing.B) {

View File

@ -15,11 +15,11 @@ import (
"github.com/btcsuite/btcd/btcec/v2"
"github.com/onsonr/sonr/internal/crypto/core/curves/native"
secp256k1 "github.com/onsonr/sonr/internal/crypto/core/curves/native/k256"
"github.com/onsonr/sonr/internal/crypto/core/curves/native/k256/fp"
"github.com/onsonr/sonr/internal/crypto/core/curves/native/k256/fq"
"github.com/onsonr/sonr/internal/crypto/internal"
"github.com/onsonr/sonr/crypto/core/curves/native"
secp256k1 "github.com/onsonr/sonr/crypto/core/curves/native/k256"
"github.com/onsonr/sonr/crypto/core/curves/native/k256/fp"
"github.com/onsonr/sonr/crypto/core/curves/native/k256/fq"
"github.com/onsonr/sonr/crypto/internal"
)
var (

View File

@ -3,7 +3,7 @@ package bls12381
import (
"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}

View File

@ -6,8 +6,8 @@ import (
"io"
"math/big"
"github.com/onsonr/sonr/internal/crypto/core/curves/native"
"github.com/onsonr/sonr/internal/crypto/internal"
"github.com/onsonr/sonr/crypto/core/curves/native"
"github.com/onsonr/sonr/crypto/internal"
)
// fp field element mod p

View File

@ -14,7 +14,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/onsonr/sonr/internal/crypto/internal"
"github.com/onsonr/sonr/crypto/internal"
)
func TestFpSetOne(t *testing.T) {

View File

@ -5,7 +5,7 @@ import (
"math/big"
"sync"
"github.com/onsonr/sonr/internal/crypto/core/curves/native"
"github.com/onsonr/sonr/crypto/core/curves/native"
)
type Fq [native.FieldLimbs]uint64

View File

@ -14,8 +14,8 @@ import (
"github.com/stretchr/testify/require"
"github.com/onsonr/sonr/internal/crypto/core/curves/native"
"github.com/onsonr/sonr/internal/crypto/internal"
"github.com/onsonr/sonr/crypto/core/curves/native"
"github.com/onsonr/sonr/crypto/internal"
)
func TestFqSetOne(t *testing.T) {

View File

@ -7,8 +7,8 @@ import (
"github.com/pkg/errors"
"github.com/onsonr/sonr/internal/crypto/core/curves/native"
"github.com/onsonr/sonr/internal/crypto/internal"
"github.com/onsonr/sonr/crypto/core/curves/native"
"github.com/onsonr/sonr/crypto/internal"
)
var (

View File

@ -7,7 +7,7 @@ import (
"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) {

View File

@ -7,8 +7,8 @@ import (
"github.com/pkg/errors"
"github.com/onsonr/sonr/internal/crypto/core/curves/native"
"github.com/onsonr/sonr/internal/crypto/internal"
"github.com/onsonr/sonr/crypto/core/curves/native"
"github.com/onsonr/sonr/crypto/internal"
)
var (

View File

@ -7,7 +7,7 @@ import (
"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) {

View File

@ -3,8 +3,8 @@ package bls12381
import (
"io"
"github.com/onsonr/sonr/internal/crypto/core/curves/native"
"github.com/onsonr/sonr/internal/crypto/internal"
"github.com/onsonr/sonr/crypto/core/curves/native"
"github.com/onsonr/sonr/crypto/internal"
)
// GtFieldBytes is the number of bytes needed to represent this field

View File

@ -6,7 +6,7 @@ import (
"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) {

View File

@ -5,7 +5,7 @@ import (
"fmt"
"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

View File

@ -10,7 +10,7 @@ import (
"math/big"
"sync"
"github.com/onsonr/sonr/internal/crypto/core/curves/native"
"github.com/onsonr/sonr/crypto/core/curves/native"
)
var (

View File

@ -14,8 +14,8 @@ import (
"github.com/stretchr/testify/require"
"github.com/onsonr/sonr/internal/crypto/core/curves/native"
"github.com/onsonr/sonr/internal/crypto/internal"
"github.com/onsonr/sonr/crypto/core/curves/native"
"github.com/onsonr/sonr/crypto/internal"
)
func TestFpSetOne(t *testing.T) {

View File

@ -10,7 +10,7 @@ import (
"math/big"
"sync"
"github.com/onsonr/sonr/internal/crypto/core/curves/native"
"github.com/onsonr/sonr/crypto/core/curves/native"
)
var (

View File

@ -14,8 +14,8 @@ import (
"github.com/stretchr/testify/require"
"github.com/onsonr/sonr/internal/crypto/core/curves/native"
"github.com/onsonr/sonr/internal/crypto/internal"
"github.com/onsonr/sonr/crypto/core/curves/native"
"github.com/onsonr/sonr/crypto/internal"
)
func TestFqSetOne(t *testing.T) {

View File

@ -3,9 +3,9 @@ package k256
import (
"sync"
"github.com/onsonr/sonr/internal/crypto/core/curves/native"
"github.com/onsonr/sonr/internal/crypto/core/curves/native/k256/fp"
"github.com/onsonr/sonr/internal/crypto/internal"
"github.com/onsonr/sonr/crypto/core/curves/native"
"github.com/onsonr/sonr/crypto/core/curves/native/k256/fp"
"github.com/onsonr/sonr/crypto/internal"
)
var (

View File

@ -5,8 +5,8 @@ import (
"github.com/stretchr/testify/require"
"github.com/onsonr/sonr/internal/crypto/core/curves/native"
"github.com/onsonr/sonr/internal/crypto/core/curves/native/k256"
"github.com/onsonr/sonr/crypto/core/curves/native"
"github.com/onsonr/sonr/crypto/core/curves/native/k256"
)
func TestK256PointArithmetic_Hash(t *testing.T) {

View File

@ -10,7 +10,7 @@ import (
"math/big"
"sync"
"github.com/onsonr/sonr/internal/crypto/core/curves/native"
"github.com/onsonr/sonr/crypto/core/curves/native"
)
var (

View File

@ -14,8 +14,8 @@ import (
"github.com/stretchr/testify/require"
"github.com/onsonr/sonr/internal/crypto/core/curves/native"
"github.com/onsonr/sonr/internal/crypto/internal"
"github.com/onsonr/sonr/crypto/core/curves/native"
"github.com/onsonr/sonr/crypto/internal"
)
func TestFpSetOne(t *testing.T) {

Some files were not shown because too many files have changed in this diff Show More