mirror of
https://github.com/onsonr/hway.git
synced 2025-03-10 13:07:09 +00:00
test: update tests to reflect hway changes
This commit is contained in:
parent
c31f5b67b7
commit
466b34b5bd
@ -3,41 +3,8 @@ version: 2
|
|||||||
project_name: sonr
|
project_name: sonr
|
||||||
|
|
||||||
builds:
|
builds:
|
||||||
- id: motr
|
|
||||||
main: ./cmd/motr
|
|
||||||
binary: app
|
|
||||||
goos:
|
|
||||||
- js
|
|
||||||
goarch:
|
|
||||||
- wasm
|
|
||||||
|
|
||||||
- id: sonr
|
|
||||||
main: ./cmd/sonrd
|
|
||||||
binary: sonrd
|
|
||||||
mod_timestamp: "{{ .CommitTimestamp }}"
|
|
||||||
goos:
|
|
||||||
- linux
|
|
||||||
- darwin
|
|
||||||
goarch:
|
|
||||||
- amd64
|
|
||||||
- arm64
|
|
||||||
goamd64:
|
|
||||||
- v1
|
|
||||||
flags:
|
|
||||||
- -mod=readonly
|
|
||||||
- -trimpath
|
|
||||||
ldflags:
|
|
||||||
- -X github.com/cosmos/cosmos-sdk/version.Name=sonr
|
|
||||||
- -X github.com/cosmos/cosmos-sdk/version.AppName=sonrd
|
|
||||||
- -X github.com/cosmos/cosmos-sdk/version.Version={{.Version}}
|
|
||||||
- -X github.com/cosmos/cosmos-sdk/version.Commit={{.Commit}}
|
|
||||||
- -X "github.com/cosmos/cosmos-sdk/version.BuildTags=netgo,ledger"
|
|
||||||
tags:
|
|
||||||
- netgo
|
|
||||||
- ledger
|
|
||||||
|
|
||||||
- id: hway
|
- id: hway
|
||||||
main: ./cmd/hway
|
main: ./cmd
|
||||||
binary: hway
|
binary: hway
|
||||||
goos:
|
goos:
|
||||||
- linux
|
- linux
|
||||||
@ -51,24 +18,11 @@ builds:
|
|||||||
- -trimpath
|
- -trimpath
|
||||||
goamd64:
|
goamd64:
|
||||||
- v1
|
- v1
|
||||||
tags:
|
|
||||||
- netgo
|
|
||||||
ldflags:
|
ldflags:
|
||||||
- -X main.version={{.Version}}
|
- -X main.version={{.Version}}
|
||||||
- -X main.commit={{.Commit}}
|
- -X main.commit={{.Commit}}
|
||||||
- -X main.date={{.Date}}
|
- -X main.date={{.Date}}
|
||||||
archives:
|
archives:
|
||||||
- id: sonr
|
|
||||||
builds: [sonr]
|
|
||||||
name_template: >-
|
|
||||||
sonr_{{ .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
|
|
||||||
|
|
||||||
- id: hway
|
- id: hway
|
||||||
builds: [hway]
|
builds: [hway]
|
||||||
name_template: >-
|
name_template: >-
|
||||||
@ -103,30 +57,6 @@ nfpms:
|
|||||||
section: net
|
section: net
|
||||||
priority: optional
|
priority: optional
|
||||||
# Add these lines to match build config
|
# Add these lines to match build config
|
||||||
|
|
||||||
- id: sonr
|
|
||||||
package_name: sonrd
|
|
||||||
file_name_template: "sonrd_{{ .Os }}_{{ .Arch }}{{ .ConventionalExtension }}"
|
|
||||||
builds: [sonr]
|
|
||||||
vendor: Sonr
|
|
||||||
homepage: "https://onsonr.dev"
|
|
||||||
maintainer: "Sonr <support@onsonr.dev>"
|
|
||||||
description: "Sonr is a decentralized, permissionless, and censorship-resistant identity network."
|
|
||||||
license: "Apache 2.0"
|
|
||||||
formats:
|
|
||||||
- rpm
|
|
||||||
- deb
|
|
||||||
- apk
|
|
||||||
dependencies:
|
|
||||||
- ipfs
|
|
||||||
contents:
|
|
||||||
- src: README*
|
|
||||||
dst: /usr/share/doc/sonrd
|
|
||||||
bindir: /usr/bin
|
|
||||||
section: net
|
|
||||||
priority: optional
|
|
||||||
# Add these lines to match build config
|
|
||||||
|
|
||||||
brews:
|
brews:
|
||||||
- name: hway
|
- name: hway
|
||||||
ids: [hway]
|
ids: [hway]
|
||||||
@ -145,36 +75,16 @@ brews:
|
|||||||
branch: master
|
branch: master
|
||||||
token: "{{ .Env.GITHUB_PERSONAL_AUTH_TOKEN }}"
|
token: "{{ .Env.GITHUB_PERSONAL_AUTH_TOKEN }}"
|
||||||
|
|
||||||
- name: sonr
|
|
||||||
ids: [sonr]
|
|
||||||
commit_author:
|
|
||||||
name: goreleaserbot
|
|
||||||
email: bot@goreleaser.com
|
|
||||||
directory: Formula
|
|
||||||
caveats: "Run a local sonr node and access it with the hway proxy"
|
|
||||||
homepage: "https://onsonr.dev"
|
|
||||||
description: "Sonr is a decentralized, permissionless, and censorship-resistant identity network."
|
|
||||||
dependencies:
|
|
||||||
- name: ipfs
|
|
||||||
repository:
|
|
||||||
owner: onsonr
|
|
||||||
name: homebrew-tap
|
|
||||||
branch: master
|
|
||||||
token: "{{ .Env.GITHUB_PERSONAL_AUTH_TOKEN }}"
|
|
||||||
|
|
||||||
release:
|
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
|
||||||
extra_files:
|
extra_files:
|
||||||
- glob: ./README*
|
- glob: ./README*
|
||||||
- glob: ./scripts/install.sh
|
|
||||||
- glob: ./scripts/test_node.sh
|
|
||||||
- glob: ./scripts/test_ics_node.sh
|
|
||||||
|
|
||||||
announce:
|
announce:
|
||||||
telegram:
|
telegram:
|
||||||
|
281
Makefile
281
Makefile
@ -1,114 +1,32 @@
|
|||||||
#!/usr/bin/make -f
|
#!/usr/bin/make -f
|
||||||
|
|
||||||
PACKAGES_SIMTEST=$(shell go list ./... | grep '/simulation')
|
|
||||||
VERSION := $(shell echo $(shell git describe --tags) | sed 's/^v//')
|
VERSION := $(shell echo $(shell git describe --tags) | sed 's/^v//')
|
||||||
COMMIT := $(shell git log -1 --format='%H')
|
COMMIT := $(shell git log -1 --format='%H')
|
||||||
LEDGER_ENABLED ?= true
|
|
||||||
SDK_PACK := $(shell go list -m github.com/cosmos/cosmos-sdk | sed 's/ /\@/g')
|
|
||||||
BINDIR ?= $(GOPATH)/bin
|
BINDIR ?= $(GOPATH)/bin
|
||||||
SIMAPP = ./app
|
|
||||||
|
|
||||||
PC_PORT_NUM=42069
|
|
||||||
PC_LOG_FILE=./sonr.log
|
|
||||||
PC_SOCKET_PATH=/tmp/sonr-net.sock
|
|
||||||
|
|
||||||
# for dockerized protobuf tools
|
# for dockerized protobuf tools
|
||||||
DOCKER := $(shell which docker)
|
DOCKER := $(shell which docker)
|
||||||
HTTPS_GIT := github.com/onsonr/sonr.git
|
HTTPS_GIT := github.com/onsonr/hway.git
|
||||||
PROCESS_COMPOSE := $(shell which process-compose)
|
|
||||||
|
|
||||||
export GO111MODULE = on
|
|
||||||
|
|
||||||
# process build tags
|
all: install test
|
||||||
|
|
||||||
build_tags = netgo
|
|
||||||
ifeq ($(LEDGER_ENABLED),true)
|
|
||||||
ifeq ($(OS),Windows_NT)
|
|
||||||
GCCEXE = $(shell where gcc.exe 2> NUL)
|
|
||||||
ifeq ($(GCCEXE),)
|
|
||||||
$(error gcc.exe not installed for ledger support, please install or set LEDGER_ENABLED=false)
|
|
||||||
else
|
|
||||||
build_tags += ledger
|
|
||||||
endif
|
|
||||||
else
|
|
||||||
UNAME_S = $(shell uname -s)
|
|
||||||
ifeq ($(UNAME_S),OpenBSD)
|
|
||||||
$(warning OpenBSD detected, disabling ledger support (https://github.com/cosmos/cosmos-sdk/issues/1988))
|
|
||||||
else
|
|
||||||
GCC = $(shell command -v gcc 2> /dev/null)
|
|
||||||
ifeq ($(GCC),)
|
|
||||||
$(error gcc not installed for ledger support, please install or set LEDGER_ENABLED=false)
|
|
||||||
else
|
|
||||||
build_tags += ledger
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(WITH_CLEVELDB),yes)
|
|
||||||
build_tags += gcc
|
|
||||||
endif
|
|
||||||
build_tags += $(BUILD_TAGS)
|
|
||||||
build_tags := $(strip $(build_tags))
|
|
||||||
|
|
||||||
whitespace :=
|
|
||||||
empty = $(whitespace) $(whitespace)
|
|
||||||
comma := ,
|
|
||||||
build_tags_comma_sep := $(subst $(empty),$(comma),$(build_tags))
|
|
||||||
|
|
||||||
# process linker flags
|
|
||||||
ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=sonr \
|
|
||||||
-X github.com/cosmos/cosmos-sdk/version.AppName=sonrd \
|
|
||||||
-X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \
|
|
||||||
-X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT) \
|
|
||||||
-X "github.com/cosmos/cosmos-sdk/version.BuildTags=$(build_tags_comma_sep)"
|
|
||||||
|
|
||||||
ifeq ($(WITH_CLEVELDB),yes)
|
|
||||||
ldflags += -X github.com/cosmos/cosmos-sdk/types.DBBackend=cleveldb
|
|
||||||
endif
|
|
||||||
ifeq ($(LINK_STATICALLY),true)
|
|
||||||
ldflags += -linkmode=external -extldflags "-Wl,-z,muldefs -static"
|
|
||||||
endif
|
|
||||||
ldflags += $(LDFLAGS)
|
|
||||||
ldflags := $(strip $(ldflags))
|
|
||||||
|
|
||||||
BUILD_FLAGS := -tags "$(build_tags_comma_sep)" -ldflags '$(ldflags)' -trimpath
|
|
||||||
|
|
||||||
# The below include contains the tools and runsim targets.
|
|
||||||
all: install lint test
|
|
||||||
|
|
||||||
build: go.sum
|
build: go.sum
|
||||||
ifeq ($(OS),Windows_NT)
|
go build -o build/hway ./cmd
|
||||||
$(error wasmd server not supported. Use "make build-windows-client" for client)
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
go build -mod=readonly $(BUILD_FLAGS) -o build/sonrd ./cmd/sonrd
|
|
||||||
endif
|
|
||||||
|
|
||||||
build-motr: go.sum
|
|
||||||
GOOS=js GOARCH=wasm go build -o static/wasm/app.wasm ./cmd/motr/main.go
|
|
||||||
|
|
||||||
build-hway: go.sum
|
|
||||||
go build -o build/hway ./cmd/hway
|
|
||||||
|
|
||||||
build-windows-client: go.sum
|
|
||||||
GOOS=windows GOARCH=amd64 go build -mod=readonly $(BUILD_FLAGS) -o build/sonrd.exe ./cmd/sonrd
|
|
||||||
|
|
||||||
build-contract-tests-hooks:
|
|
||||||
ifeq ($(OS),Windows_NT)
|
|
||||||
go build -mod=readonly $(BUILD_FLAGS) -o build/contract_tests.exe ./cmd/contract_tests
|
|
||||||
else
|
|
||||||
go build -mod=readonly $(BUILD_FLAGS) -o build/contract_tests ./cmd/contract_tests
|
|
||||||
endif
|
|
||||||
|
|
||||||
install: go.sum
|
install: go.sum
|
||||||
go install -mod=readonly $(BUILD_FLAGS) ./cmd/sonrd
|
|
||||||
|
|
||||||
install-hway: go.sum
|
|
||||||
go install -mod=readonly ./cmd/hway
|
go install -mod=readonly ./cmd/hway
|
||||||
|
|
||||||
########################################
|
########################################
|
||||||
### Tools & dependencies
|
### Tools & dependencies
|
||||||
|
########################################
|
||||||
|
pkl-gen:
|
||||||
|
@go install github.com/apple/pkl-go/cmd/pkl-gen-go@latest
|
||||||
|
@pkl-gen-go ./pkl/App.pkl
|
||||||
|
|
||||||
|
sqlc-gen:
|
||||||
|
@go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest
|
||||||
|
@go install github.com/apple/pkl-go/cmd/pkl-gen-go@latest
|
||||||
|
@cd internal && sqlc generate
|
||||||
|
|
||||||
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,181 +52,6 @@ clean:
|
|||||||
distclean: clean
|
distclean: clean
|
||||||
rm -rf vendor/
|
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
|
|
||||||
|
|
||||||
test-unit:
|
|
||||||
@VERSION=$(VERSION) go test -mod=readonly -tags='ledger test_ledger_mock' ./...
|
|
||||||
|
|
||||||
test-race:
|
|
||||||
@VERSION=$(VERSION) go test -mod=readonly -race -tags='ledger test_ledger_mock' ./...
|
|
||||||
|
|
||||||
test-cover:
|
|
||||||
@go test -mod=readonly -timeout 30m -race -coverprofile=coverage.txt -covermode=atomic -tags='ledger test_ledger_mock' ./...
|
|
||||||
|
|
||||||
benchmark:
|
|
||||||
@go test -mod=readonly -bench=. ./...
|
|
||||||
|
|
||||||
test-sim-import-export: runsim
|
|
||||||
@echo "Running application import/export simulation. This may take several minutes..."
|
|
||||||
@$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) -ExitOnFail 50 5 TestAppImportExport
|
|
||||||
|
|
||||||
test-sim-multi-seed-short: runsim
|
|
||||||
@echo "Running short multi-seed application simulation. This may take awhile!"
|
|
||||||
@$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) -ExitOnFail 50 5 TestFullAppSimulation
|
|
||||||
|
|
||||||
test-sim-deterministic: runsim
|
|
||||||
@echo "Running application deterministic simulation. This may take awhile!"
|
|
||||||
@$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) -ExitOnFail 1 1 TestAppStateDeterminism
|
|
||||||
|
|
||||||
test-system: install
|
|
||||||
$(MAKE) -C tests/system/ test
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
### Linting ###
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
format-tools:
|
|
||||||
go install mvdan.cc/gofumpt@v0.4.0
|
|
||||||
go install github.com/client9/misspell/cmd/misspell@v0.3.4
|
|
||||||
go install github.com/daixiang0/gci@v0.11.2
|
|
||||||
|
|
||||||
lint: format-tools
|
|
||||||
golangci-lint run --tests=false
|
|
||||||
find . -name '*.go' -type f -not -path "./vendor*" -not -path "./tests/system/vendor*" -not -path "*.git*" -not -path "*_test.go" | xargs gofumpt -d
|
|
||||||
|
|
||||||
format: format-tools
|
|
||||||
find . -name '*.go' -type f -not -path "./vendor*" -not -path "./tests/system/vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" | xargs gofumpt -w
|
|
||||||
find . -name '*.go' -type f -not -path "./vendor*" -not -path "./tests/system/vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" | xargs misspell -w
|
|
||||||
find . -name '*.go' -type f -not -path "./vendor*" -not -path "./tests/system/vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" | xargs gci write --skip-generated -s standard -s default -s "prefix(cosmossdk.io)" -s "prefix(github.com/cosmos/cosmos-sdk)" -s "prefix(github.com/CosmWasm/wasmd)" --custom-order
|
|
||||||
|
|
||||||
mod-tidy:
|
|
||||||
go mod tidy
|
|
||||||
|
|
||||||
.PHONY: format-tools lint format mod-tidy
|
|
||||||
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
### Protobuf ###
|
|
||||||
###############################################################################
|
|
||||||
protoVer=0.15.1
|
|
||||||
protoImageName=ghcr.io/cosmos/proto-builder:$(protoVer)
|
|
||||||
protoImage=$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace $(protoImageName)
|
|
||||||
|
|
||||||
proto-gen:
|
|
||||||
@echo "Generating Protobuf files"
|
|
||||||
@go install cosmossdk.io/orm/cmd/protoc-gen-go-cosmos-orm@latest
|
|
||||||
@$(protoImage) sh ./scripts/protocgen.sh
|
|
||||||
spawn stub-gen
|
|
||||||
|
|
||||||
proto-format:
|
|
||||||
@echo "Formatting Protobuf files"
|
|
||||||
@$(protoImage) find ./ -name "*.proto" -exec clang-format -i {} \;
|
|
||||||
|
|
||||||
proto-lint:
|
|
||||||
@$(protoImage) buf lint --error-format=json
|
|
||||||
|
|
||||||
proto-check-breaking:
|
|
||||||
@$(protoImage) buf breaking --against $(HTTPS_GIT)#branch=master
|
|
||||||
|
|
||||||
.PHONY: all install install-debug \
|
|
||||||
go-mod-cache draw-deps clean build format \
|
|
||||||
test test-all test-build test-cover test-unit test-race \
|
|
||||||
test-sim-import-export build-windows-client \
|
|
||||||
test-system
|
|
||||||
|
|
||||||
## --- Testnet Utilities ---
|
|
||||||
get-localic:
|
|
||||||
@echo "Installing local-interchain"
|
|
||||||
git clone --branch v8.7.0 https://github.com/strangelove-ventures/interchaintest.git interchaintest-downloader
|
|
||||||
cd interchaintest-downloader/local-interchain && make install
|
|
||||||
@echo ✅ local-interchain installed $(shell which local-ic)
|
|
||||||
|
|
||||||
is-localic-installed:
|
|
||||||
ifeq (,$(shell which local-ic))
|
|
||||||
make get-localic
|
|
||||||
endif
|
|
||||||
|
|
||||||
get-heighliner:
|
|
||||||
git clone https://github.com/strangelove-ventures/heighliner.git
|
|
||||||
cd heighliner && go install
|
|
||||||
|
|
||||||
local-image:
|
|
||||||
ifeq (,$(shell which heighliner))
|
|
||||||
echo 'heighliner' binary not found. Consider running `make get-heighliner`
|
|
||||||
else
|
|
||||||
heighliner build -c sonrd --local -f chains.yaml
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: get-heighliner local-image is-localic-installed
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
### e2e ###
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
ictest-basic:
|
|
||||||
@echo "Running basic interchain tests"
|
|
||||||
@cd interchaintest && go test -race -v -run TestBasicChain .
|
|
||||||
|
|
||||||
ictest-ibc:
|
|
||||||
@echo "Running IBC interchain tests"
|
|
||||||
@cd interchaintest && go test -race -v -run TestIBC .
|
|
||||||
|
|
||||||
ictest-wasm:
|
|
||||||
@echo "Running cosmwasm interchain tests"
|
|
||||||
@cd interchaintest && go test -race -v -run TestCosmWasmIntegration .
|
|
||||||
|
|
||||||
ictest-packetforward:
|
|
||||||
@echo "Running packet forward middleware interchain tests"
|
|
||||||
@cd interchaintest && go test -race -v -run TestPacketForwardMiddleware .
|
|
||||||
|
|
||||||
ictest-poa:
|
|
||||||
@echo "Running proof of authority interchain tests"
|
|
||||||
@cd interchaintest && go test -race -v -run TestPOA .
|
|
||||||
|
|
||||||
ictest-tokenfactory:
|
|
||||||
@echo "Running token factory interchain tests"
|
|
||||||
@cd interchaintest && go test -race -v -run TestTokenFactory .
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
### testnet ###
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
setup-ipfs:
|
|
||||||
./scripts/ipfs_config.sh
|
|
||||||
|
|
||||||
setup-testnet: mod-tidy is-localic-installed install local-image set-testnet-configs setup-testnet-keys
|
|
||||||
|
|
||||||
# Run this before testnet keys are added
|
|
||||||
# chainid-1 is used in the testnet.json
|
|
||||||
set-testnet-configs:
|
|
||||||
sonrd config set client chain-id sonr-testnet-1
|
|
||||||
sonrd config set client keyring-backend test
|
|
||||||
sonrd config set client output text
|
|
||||||
|
|
||||||
# import keys from testnet.json into test keyring
|
|
||||||
setup-testnet-keys:
|
|
||||||
-`echo "decorate bright ozone fork gallery riot bus exhaust worth way bone indoor calm squirrel merry zero scheme cotton until shop any excess stage laundry" | sonrd keys add acc0 --recover`
|
|
||||||
-`echo "wealth flavor believe regret funny network recall kiss grape useless pepper cram hint member few certain unveil rather brick bargain curious require crowd raise" | sonrd keys add acc1 --recover`
|
|
||||||
|
|
||||||
# default testnet is with IBC
|
|
||||||
testnet: setup-testnet
|
|
||||||
spawn local-ic start ibc-testnet
|
|
||||||
|
|
||||||
testnet-basic: setup-testnet
|
|
||||||
spawn local-ic start testnet
|
|
||||||
|
|
||||||
sh-testnet: mod-tidy
|
|
||||||
CHAIN_ID="sonr-testnet-1" BLOCK_TIME="1000ms" CLEAN=true sh scripts/test_node.sh
|
|
||||||
|
|
||||||
.PHONY: setup-testnet set-testnet-configs testnet testnet-basic sh-testnet dop-testnet
|
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
### help ###
|
### help ###
|
||||||
|
@ -5,11 +5,11 @@ import (
|
|||||||
"github.com/labstack/echo-contrib/echoprometheus"
|
"github.com/labstack/echo-contrib/echoprometheus"
|
||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
echomiddleware "github.com/labstack/echo/v4/middleware"
|
echomiddleware "github.com/labstack/echo/v4/middleware"
|
||||||
"github.com/onsonr/sonr/gateway/context"
|
"github.com/onsonr/hway/gateway/handlers"
|
||||||
"github.com/onsonr/sonr/gateway/handlers"
|
config "github.com/onsonr/hway/internal/config/hway"
|
||||||
"github.com/onsonr/sonr/internal/common"
|
hwayorm "github.com/onsonr/hway/internal/models"
|
||||||
config "github.com/onsonr/sonr/internal/config/hway"
|
"github.com/onsonr/hway/pkg/common"
|
||||||
hwayorm "github.com/onsonr/sonr/internal/database/hwayorm"
|
"github.com/onsonr/hway/pkg/context"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Gateway = *echo.Echo
|
type Gateway = *echo.Echo
|
@ -7,7 +7,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/gateway"
|
"github.com/onsonr/hway/gateway"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/jackc/pgx/v5"
|
"github.com/jackc/pgx/v5"
|
||||||
hwayorm "github.com/onsonr/sonr/internal/database/hwayorm"
|
hwayorm "github.com/onsonr/hway/internal/models"
|
||||||
)
|
)
|
||||||
|
|
||||||
// main is the entry point for the application
|
// main is the entry point for the application
|
||||||
|
2
go.mod
2
go.mod
@ -9,7 +9,7 @@ require (
|
|||||||
github.com/labstack/echo-contrib v0.17.2
|
github.com/labstack/echo-contrib v0.17.2
|
||||||
github.com/labstack/echo/v4 v4.13.3
|
github.com/labstack/echo/v4 v4.13.3
|
||||||
github.com/medama-io/go-useragent v1.0.1
|
github.com/medama-io/go-useragent v1.0.1
|
||||||
github.com/onsonr/sonr v0.6.1
|
github.com/onsonr/hway v0.6.1
|
||||||
github.com/segmentio/ksuid v1.0.4
|
github.com/segmentio/ksuid v1.0.4
|
||||||
github.com/spf13/cobra v1.8.1
|
github.com/spf13/cobra v1.8.1
|
||||||
lukechampine.com/blake3 v1.3.0
|
lukechampine.com/blake3 v1.3.0
|
||||||
|
4
go.sum
4
go.sum
@ -756,8 +756,8 @@ github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAl
|
|||||||
github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro=
|
github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro=
|
||||||
github.com/onsi/gomega v1.34.2 h1:pNCwDkzrsv7MS9kpaQvVb1aVLahQXyJ/Tv5oAZMI3i8=
|
github.com/onsi/gomega v1.34.2 h1:pNCwDkzrsv7MS9kpaQvVb1aVLahQXyJ/Tv5oAZMI3i8=
|
||||||
github.com/onsi/gomega v1.34.2/go.mod h1:v1xfxRgk0KIsG+QOdm7p8UosrOzPYRo60fd3B/1Dukc=
|
github.com/onsi/gomega v1.34.2/go.mod h1:v1xfxRgk0KIsG+QOdm7p8UosrOzPYRo60fd3B/1Dukc=
|
||||||
github.com/onsonr/sonr v0.6.1 h1:pNP2BbOfe/3UN/bZSYNyf9F+nlIpZaqi2LJ6Ol0496w=
|
github.com/onsonr/hway v0.6.1 h1:pNP2BbOfe/3UN/bZSYNyf9F+nlIpZaqi2LJ6Ol0496w=
|
||||||
github.com/onsonr/sonr v0.6.1/go.mod h1:L4ywLeJemlGD2pmlIX/j3eEKEgu5o/yzgFjkHNr7dAk=
|
github.com/onsonr/hway v0.6.1/go.mod h1:L4ywLeJemlGD2pmlIX/j3eEKEgu5o/yzgFjkHNr7dAk=
|
||||||
github.com/opencontainers/runtime-spec v1.2.0 h1:z97+pHb3uELt/yiAWD691HNHQIF07bE7dzrbT927iTk=
|
github.com/opencontainers/runtime-spec v1.2.0 h1:z97+pHb3uELt/yiAWD691HNHQIF07bE7dzrbT927iTk=
|
||||||
github.com/opencontainers/runtime-spec v1.2.0/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
|
github.com/opencontainers/runtime-spec v1.2.0/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
|
||||||
github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs=
|
github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs=
|
||||||
|
@ -2,7 +2,7 @@ package handlers
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
"github.com/onsonr/sonr/gateway/context"
|
"github.com/onsonr/hway/pkg/context"
|
||||||
)
|
)
|
||||||
|
|
||||||
func ErrorHandler(err error, c echo.Context) {
|
func ErrorHandler(err error, c echo.Context) {
|
||||||
|
@ -2,7 +2,7 @@ package handlers
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
"github.com/onsonr/sonr/gateway/context"
|
"github.com/onsonr/hway/pkg/context"
|
||||||
)
|
)
|
||||||
|
|
||||||
func IndexHandler(c echo.Context) error {
|
func IndexHandler(c echo.Context) error {
|
||||||
|
@ -4,11 +4,11 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
|
||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
"github.com/onsonr/sonr/gateway/islands"
|
"github.com/onsonr/hway/gateway/islands"
|
||||||
"github.com/onsonr/sonr/gateway/views"
|
"github.com/onsonr/hway/gateway/views"
|
||||||
"github.com/onsonr/sonr/gateway/context"
|
"github.com/onsonr/hway/internal/common"
|
||||||
"github.com/onsonr/sonr/internal/common"
|
hwayorm "github.com/onsonr/hway/internal/database/hwayorm"
|
||||||
hwayorm "github.com/onsonr/sonr/internal/database/hwayorm"
|
"github.com/onsonr/hway/pkg/context"
|
||||||
)
|
)
|
||||||
|
|
||||||
func RegisterHandler(g *echo.Group) {
|
func RegisterHandler(g *echo.Group) {
|
||||||
|
103
internal/config/Hway.pkl.go
Normal file
103
internal/config/Hway.pkl.go
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
// Code generated from Pkl module `sonr.net.Hway`. DO NOT EDIT.
|
||||||
|
package config
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/apple/pkl-go/pkl"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Hway interface {
|
||||||
|
GetServePort() int
|
||||||
|
|
||||||
|
GetSqliteFile() string
|
||||||
|
|
||||||
|
GetChainId() string
|
||||||
|
|
||||||
|
GetIpfsGatewayUrl() string
|
||||||
|
|
||||||
|
GetSonrApiUrl() string
|
||||||
|
|
||||||
|
GetSonrGrpcUrl() string
|
||||||
|
|
||||||
|
GetSonrRpcUrl() string
|
||||||
|
|
||||||
|
GetPsqlDSN() string
|
||||||
|
}
|
||||||
|
|
||||||
|
var _ Hway = (*HwayImpl)(nil)
|
||||||
|
|
||||||
|
type HwayImpl struct {
|
||||||
|
ServePort int `pkl:"servePort"`
|
||||||
|
|
||||||
|
SqliteFile string `pkl:"sqliteFile"`
|
||||||
|
|
||||||
|
ChainId string `pkl:"chainId"`
|
||||||
|
|
||||||
|
IpfsGatewayUrl string `pkl:"ipfsGatewayUrl"`
|
||||||
|
|
||||||
|
SonrApiUrl string `pkl:"sonrApiUrl"`
|
||||||
|
|
||||||
|
SonrGrpcUrl string `pkl:"sonrGrpcUrl"`
|
||||||
|
|
||||||
|
SonrRpcUrl string `pkl:"sonrRpcUrl"`
|
||||||
|
|
||||||
|
PsqlDSN string `pkl:"psqlDSN"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (rcv *HwayImpl) GetServePort() int {
|
||||||
|
return rcv.ServePort
|
||||||
|
}
|
||||||
|
|
||||||
|
func (rcv *HwayImpl) GetSqliteFile() string {
|
||||||
|
return rcv.SqliteFile
|
||||||
|
}
|
||||||
|
|
||||||
|
func (rcv *HwayImpl) GetChainId() string {
|
||||||
|
return rcv.ChainId
|
||||||
|
}
|
||||||
|
|
||||||
|
func (rcv *HwayImpl) GetIpfsGatewayUrl() string {
|
||||||
|
return rcv.IpfsGatewayUrl
|
||||||
|
}
|
||||||
|
|
||||||
|
func (rcv *HwayImpl) GetSonrApiUrl() string {
|
||||||
|
return rcv.SonrApiUrl
|
||||||
|
}
|
||||||
|
|
||||||
|
func (rcv *HwayImpl) GetSonrGrpcUrl() string {
|
||||||
|
return rcv.SonrGrpcUrl
|
||||||
|
}
|
||||||
|
|
||||||
|
func (rcv *HwayImpl) GetSonrRpcUrl() string {
|
||||||
|
return rcv.SonrRpcUrl
|
||||||
|
}
|
||||||
|
|
||||||
|
func (rcv *HwayImpl) GetPsqlDSN() string {
|
||||||
|
return rcv.PsqlDSN
|
||||||
|
}
|
||||||
|
|
||||||
|
// LoadFromPath loads the pkl module at the given path and evaluates it into a Hway
|
||||||
|
func LoadFromPath(ctx context.Context, path string) (ret Hway, err error) {
|
||||||
|
evaluator, err := pkl.NewEvaluator(ctx, pkl.PreconfiguredOptions)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
defer func() {
|
||||||
|
cerr := evaluator.Close()
|
||||||
|
if err == nil {
|
||||||
|
err = cerr
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
ret, err = Load(ctx, evaluator, pkl.FileSource(path))
|
||||||
|
return ret, err
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load loads the pkl module at the given source and evaluates it with the given evaluator into a Hway
|
||||||
|
func Load(ctx context.Context, evaluator pkl.Evaluator, source *pkl.ModuleSource) (Hway, error) {
|
||||||
|
var ret HwayImpl
|
||||||
|
if err := evaluator.EvaluateModule(ctx, source, &ret); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return &ret, nil
|
||||||
|
}
|
8
internal/config/init.pkl.go
Normal file
8
internal/config/init.pkl.go
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
// Code generated from Pkl module `sonr.net.Hway`. DO NOT EDIT.
|
||||||
|
package config
|
||||||
|
|
||||||
|
import "github.com/apple/pkl-go/pkl"
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
pkl.RegisterMapping("sonr.net.Hway", HwayImpl{})
|
||||||
|
}
|
31
internal/models/db.go
Normal file
31
internal/models/db.go
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
// Code generated by sqlc. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// sqlc v1.27.0
|
||||||
|
|
||||||
|
package models
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"database/sql"
|
||||||
|
)
|
||||||
|
|
||||||
|
type DBTX interface {
|
||||||
|
ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
|
||||||
|
PrepareContext(context.Context, string) (*sql.Stmt, error)
|
||||||
|
QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
|
||||||
|
QueryRowContext(context.Context, string, ...interface{}) *sql.Row
|
||||||
|
}
|
||||||
|
|
||||||
|
func New(db DBTX) *Queries {
|
||||||
|
return &Queries{db: db}
|
||||||
|
}
|
||||||
|
|
||||||
|
type Queries struct {
|
||||||
|
db DBTX
|
||||||
|
}
|
||||||
|
|
||||||
|
func (q *Queries) WithTx(tx *sql.Tx) *Queries {
|
||||||
|
return &Queries{
|
||||||
|
db: tx,
|
||||||
|
}
|
||||||
|
}
|
99
internal/models/models.go
Normal file
99
internal/models/models.go
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
// Code generated by sqlc. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// sqlc v1.27.0
|
||||||
|
|
||||||
|
package models
|
||||||
|
|
||||||
|
import (
|
||||||
|
"database/sql"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Account struct {
|
||||||
|
ID string `json:"id"`
|
||||||
|
CreatedAt time.Time `json:"created_at"`
|
||||||
|
UpdatedAt time.Time `json:"updated_at"`
|
||||||
|
DeletedAt sql.NullTime `json:"deleted_at"`
|
||||||
|
Number int64 `json:"number"`
|
||||||
|
Sequence int64 `json:"sequence"`
|
||||||
|
Address string `json:"address"`
|
||||||
|
PublicKey string `json:"public_key"`
|
||||||
|
ChainID string `json:"chain_id"`
|
||||||
|
Controller string `json:"controller"`
|
||||||
|
IsSubsidiary bool `json:"is_subsidiary"`
|
||||||
|
IsValidator bool `json:"is_validator"`
|
||||||
|
IsDelegator bool `json:"is_delegator"`
|
||||||
|
IsAccountable bool `json:"is_accountable"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Asset struct {
|
||||||
|
ID string `json:"id"`
|
||||||
|
CreatedAt time.Time `json:"created_at"`
|
||||||
|
UpdatedAt time.Time `json:"updated_at"`
|
||||||
|
DeletedAt sql.NullTime `json:"deleted_at"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Symbol string `json:"symbol"`
|
||||||
|
Decimals int64 `json:"decimals"`
|
||||||
|
ChainID string `json:"chain_id"`
|
||||||
|
Channel string `json:"channel"`
|
||||||
|
AssetType string `json:"asset_type"`
|
||||||
|
CoingeckoID sql.NullString `json:"coingecko_id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Credential struct {
|
||||||
|
ID string `json:"id"`
|
||||||
|
CreatedAt time.Time `json:"created_at"`
|
||||||
|
UpdatedAt time.Time `json:"updated_at"`
|
||||||
|
DeletedAt sql.NullTime `json:"deleted_at"`
|
||||||
|
Handle string `json:"handle"`
|
||||||
|
CredentialID string `json:"credential_id"`
|
||||||
|
AuthenticatorAttachment string `json:"authenticator_attachment"`
|
||||||
|
Origin string `json:"origin"`
|
||||||
|
Type string `json:"type"`
|
||||||
|
Transports string `json:"transports"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Profile struct {
|
||||||
|
ID string `json:"id"`
|
||||||
|
CreatedAt time.Time `json:"created_at"`
|
||||||
|
UpdatedAt time.Time `json:"updated_at"`
|
||||||
|
DeletedAt sql.NullTime `json:"deleted_at"`
|
||||||
|
Address string `json:"address"`
|
||||||
|
Handle string `json:"handle"`
|
||||||
|
Origin string `json:"origin"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Session struct {
|
||||||
|
ID string `json:"id"`
|
||||||
|
CreatedAt time.Time `json:"created_at"`
|
||||||
|
UpdatedAt time.Time `json:"updated_at"`
|
||||||
|
DeletedAt sql.NullTime `json:"deleted_at"`
|
||||||
|
BrowserName string `json:"browser_name"`
|
||||||
|
BrowserVersion string `json:"browser_version"`
|
||||||
|
ClientIpaddr string `json:"client_ipaddr"`
|
||||||
|
Platform string `json:"platform"`
|
||||||
|
IsDesktop bool `json:"is_desktop"`
|
||||||
|
IsMobile bool `json:"is_mobile"`
|
||||||
|
IsTablet bool `json:"is_tablet"`
|
||||||
|
IsTv bool `json:"is_tv"`
|
||||||
|
IsBot bool `json:"is_bot"`
|
||||||
|
Challenge string `json:"challenge"`
|
||||||
|
IsHumanFirst bool `json:"is_human_first"`
|
||||||
|
IsHumanLast bool `json:"is_human_last"`
|
||||||
|
ProfileID int64 `json:"profile_id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Vault struct {
|
||||||
|
ID string `json:"id"`
|
||||||
|
CreatedAt time.Time `json:"created_at"`
|
||||||
|
UpdatedAt time.Time `json:"updated_at"`
|
||||||
|
DeletedAt sql.NullTime `json:"deleted_at"`
|
||||||
|
Handle string `json:"handle"`
|
||||||
|
Origin string `json:"origin"`
|
||||||
|
Address string `json:"address"`
|
||||||
|
Cid string `json:"cid"`
|
||||||
|
Config string `json:"config"`
|
||||||
|
SessionID string `json:"session_id"`
|
||||||
|
RedirectUri string `json:"redirect_uri"`
|
||||||
|
}
|
34
internal/models/querier.go
Normal file
34
internal/models/querier.go
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
// Code generated by sqlc. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// sqlc v1.27.0
|
||||||
|
|
||||||
|
package models
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Querier interface {
|
||||||
|
CheckHandleExists(ctx context.Context, handle string) (bool, error)
|
||||||
|
CreateSession(ctx context.Context, arg CreateSessionParams) (Session, error)
|
||||||
|
GetChallengeBySessionID(ctx context.Context, id string) (string, error)
|
||||||
|
GetCredentialByID(ctx context.Context, credentialID string) (Credential, error)
|
||||||
|
GetCredentialsByHandle(ctx context.Context, handle string) ([]Credential, error)
|
||||||
|
GetHumanVerificationNumbers(ctx context.Context, id string) (GetHumanVerificationNumbersRow, error)
|
||||||
|
GetProfileByAddress(ctx context.Context, address string) (Profile, error)
|
||||||
|
GetProfileByHandle(ctx context.Context, handle string) (Profile, error)
|
||||||
|
GetProfileByID(ctx context.Context, id string) (Profile, error)
|
||||||
|
GetSessionByClientIP(ctx context.Context, clientIpaddr string) (Session, error)
|
||||||
|
GetSessionByID(ctx context.Context, id string) (Session, error)
|
||||||
|
GetVaultConfigByCID(ctx context.Context, cid string) (Vault, error)
|
||||||
|
GetVaultRedirectURIBySessionID(ctx context.Context, sessionID string) (string, error)
|
||||||
|
InsertCredential(ctx context.Context, arg InsertCredentialParams) (Credential, error)
|
||||||
|
InsertProfile(ctx context.Context, arg InsertProfileParams) (Profile, error)
|
||||||
|
SoftDeleteCredential(ctx context.Context, credentialID string) error
|
||||||
|
SoftDeleteProfile(ctx context.Context, address string) error
|
||||||
|
UpdateProfile(ctx context.Context, arg UpdateProfileParams) (Profile, error)
|
||||||
|
UpdateSessionHumanVerification(ctx context.Context, arg UpdateSessionHumanVerificationParams) (Session, error)
|
||||||
|
UpdateSessionWithProfileID(ctx context.Context, arg UpdateSessionWithProfileIDParams) (Session, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
var _ Querier = (*Queries)(nil)
|
581
internal/models/query.sql.go
Normal file
581
internal/models/query.sql.go
Normal file
@ -0,0 +1,581 @@
|
|||||||
|
// Code generated by sqlc. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// sqlc v1.27.0
|
||||||
|
// source: query.sql
|
||||||
|
|
||||||
|
package models
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
)
|
||||||
|
|
||||||
|
const checkHandleExists = `-- name: CheckHandleExists :one
|
||||||
|
SELECT COUNT(*) > 0 as handle_exists FROM profiles
|
||||||
|
WHERE handle = ?
|
||||||
|
AND deleted_at IS NULL
|
||||||
|
`
|
||||||
|
|
||||||
|
func (q *Queries) CheckHandleExists(ctx context.Context, handle string) (bool, error) {
|
||||||
|
row := q.db.QueryRowContext(ctx, checkHandleExists, handle)
|
||||||
|
var handle_exists bool
|
||||||
|
err := row.Scan(&handle_exists)
|
||||||
|
return handle_exists, err
|
||||||
|
}
|
||||||
|
|
||||||
|
const createSession = `-- name: CreateSession :one
|
||||||
|
INSERT INTO sessions (
|
||||||
|
id,
|
||||||
|
browser_name,
|
||||||
|
browser_version,
|
||||||
|
client_ipaddr,
|
||||||
|
platform,
|
||||||
|
is_desktop,
|
||||||
|
is_mobile,
|
||||||
|
is_tablet,
|
||||||
|
is_tv,
|
||||||
|
is_bot,
|
||||||
|
challenge,
|
||||||
|
is_human_first,
|
||||||
|
is_human_last,
|
||||||
|
profile_id
|
||||||
|
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
|
||||||
|
RETURNING id, created_at, updated_at, deleted_at, browser_name, browser_version, client_ipaddr, platform, is_desktop, is_mobile, is_tablet, is_tv, is_bot, challenge, is_human_first, is_human_last, profile_id
|
||||||
|
`
|
||||||
|
|
||||||
|
type CreateSessionParams struct {
|
||||||
|
ID string `json:"id"`
|
||||||
|
BrowserName string `json:"browser_name"`
|
||||||
|
BrowserVersion string `json:"browser_version"`
|
||||||
|
ClientIpaddr string `json:"client_ipaddr"`
|
||||||
|
Platform string `json:"platform"`
|
||||||
|
IsDesktop bool `json:"is_desktop"`
|
||||||
|
IsMobile bool `json:"is_mobile"`
|
||||||
|
IsTablet bool `json:"is_tablet"`
|
||||||
|
IsTv bool `json:"is_tv"`
|
||||||
|
IsBot bool `json:"is_bot"`
|
||||||
|
Challenge string `json:"challenge"`
|
||||||
|
IsHumanFirst bool `json:"is_human_first"`
|
||||||
|
IsHumanLast bool `json:"is_human_last"`
|
||||||
|
ProfileID int64 `json:"profile_id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (q *Queries) CreateSession(ctx context.Context, arg CreateSessionParams) (Session, error) {
|
||||||
|
row := q.db.QueryRowContext(ctx, createSession,
|
||||||
|
arg.ID,
|
||||||
|
arg.BrowserName,
|
||||||
|
arg.BrowserVersion,
|
||||||
|
arg.ClientIpaddr,
|
||||||
|
arg.Platform,
|
||||||
|
arg.IsDesktop,
|
||||||
|
arg.IsMobile,
|
||||||
|
arg.IsTablet,
|
||||||
|
arg.IsTv,
|
||||||
|
arg.IsBot,
|
||||||
|
arg.Challenge,
|
||||||
|
arg.IsHumanFirst,
|
||||||
|
arg.IsHumanLast,
|
||||||
|
arg.ProfileID,
|
||||||
|
)
|
||||||
|
var i Session
|
||||||
|
err := row.Scan(
|
||||||
|
&i.ID,
|
||||||
|
&i.CreatedAt,
|
||||||
|
&i.UpdatedAt,
|
||||||
|
&i.DeletedAt,
|
||||||
|
&i.BrowserName,
|
||||||
|
&i.BrowserVersion,
|
||||||
|
&i.ClientIpaddr,
|
||||||
|
&i.Platform,
|
||||||
|
&i.IsDesktop,
|
||||||
|
&i.IsMobile,
|
||||||
|
&i.IsTablet,
|
||||||
|
&i.IsTv,
|
||||||
|
&i.IsBot,
|
||||||
|
&i.Challenge,
|
||||||
|
&i.IsHumanFirst,
|
||||||
|
&i.IsHumanLast,
|
||||||
|
&i.ProfileID,
|
||||||
|
)
|
||||||
|
return i, err
|
||||||
|
}
|
||||||
|
|
||||||
|
const getChallengeBySessionID = `-- name: GetChallengeBySessionID :one
|
||||||
|
SELECT challenge FROM sessions
|
||||||
|
WHERE id = ? AND deleted_at IS NULL
|
||||||
|
LIMIT 1
|
||||||
|
`
|
||||||
|
|
||||||
|
func (q *Queries) GetChallengeBySessionID(ctx context.Context, id string) (string, error) {
|
||||||
|
row := q.db.QueryRowContext(ctx, getChallengeBySessionID, id)
|
||||||
|
var challenge string
|
||||||
|
err := row.Scan(&challenge)
|
||||||
|
return challenge, err
|
||||||
|
}
|
||||||
|
|
||||||
|
const getCredentialByID = `-- name: GetCredentialByID :one
|
||||||
|
SELECT id, created_at, updated_at, deleted_at, handle, credential_id, authenticator_attachment, origin, type, transports FROM credentials
|
||||||
|
WHERE credential_id = ?
|
||||||
|
AND deleted_at IS NULL
|
||||||
|
LIMIT 1
|
||||||
|
`
|
||||||
|
|
||||||
|
func (q *Queries) GetCredentialByID(ctx context.Context, credentialID string) (Credential, error) {
|
||||||
|
row := q.db.QueryRowContext(ctx, getCredentialByID, credentialID)
|
||||||
|
var i Credential
|
||||||
|
err := row.Scan(
|
||||||
|
&i.ID,
|
||||||
|
&i.CreatedAt,
|
||||||
|
&i.UpdatedAt,
|
||||||
|
&i.DeletedAt,
|
||||||
|
&i.Handle,
|
||||||
|
&i.CredentialID,
|
||||||
|
&i.AuthenticatorAttachment,
|
||||||
|
&i.Origin,
|
||||||
|
&i.Type,
|
||||||
|
&i.Transports,
|
||||||
|
)
|
||||||
|
return i, err
|
||||||
|
}
|
||||||
|
|
||||||
|
const getCredentialsByHandle = `-- name: GetCredentialsByHandle :many
|
||||||
|
SELECT id, created_at, updated_at, deleted_at, handle, credential_id, authenticator_attachment, origin, type, transports FROM credentials
|
||||||
|
WHERE handle = ?
|
||||||
|
AND deleted_at IS NULL
|
||||||
|
`
|
||||||
|
|
||||||
|
func (q *Queries) GetCredentialsByHandle(ctx context.Context, handle string) ([]Credential, error) {
|
||||||
|
rows, err := q.db.QueryContext(ctx, getCredentialsByHandle, handle)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
defer rows.Close()
|
||||||
|
var items []Credential
|
||||||
|
for rows.Next() {
|
||||||
|
var i Credential
|
||||||
|
if err := rows.Scan(
|
||||||
|
&i.ID,
|
||||||
|
&i.CreatedAt,
|
||||||
|
&i.UpdatedAt,
|
||||||
|
&i.DeletedAt,
|
||||||
|
&i.Handle,
|
||||||
|
&i.CredentialID,
|
||||||
|
&i.AuthenticatorAttachment,
|
||||||
|
&i.Origin,
|
||||||
|
&i.Type,
|
||||||
|
&i.Transports,
|
||||||
|
); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
items = append(items, i)
|
||||||
|
}
|
||||||
|
if err := rows.Close(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if err := rows.Err(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return items, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
const getHumanVerificationNumbers = `-- name: GetHumanVerificationNumbers :one
|
||||||
|
SELECT is_human_first, is_human_last FROM sessions
|
||||||
|
WHERE id = ? AND deleted_at IS NULL
|
||||||
|
LIMIT 1
|
||||||
|
`
|
||||||
|
|
||||||
|
type GetHumanVerificationNumbersRow struct {
|
||||||
|
IsHumanFirst bool `json:"is_human_first"`
|
||||||
|
IsHumanLast bool `json:"is_human_last"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (q *Queries) GetHumanVerificationNumbers(ctx context.Context, id string) (GetHumanVerificationNumbersRow, error) {
|
||||||
|
row := q.db.QueryRowContext(ctx, getHumanVerificationNumbers, id)
|
||||||
|
var i GetHumanVerificationNumbersRow
|
||||||
|
err := row.Scan(&i.IsHumanFirst, &i.IsHumanLast)
|
||||||
|
return i, err
|
||||||
|
}
|
||||||
|
|
||||||
|
const getProfileByAddress = `-- name: GetProfileByAddress :one
|
||||||
|
SELECT id, created_at, updated_at, deleted_at, address, handle, origin, name FROM profiles
|
||||||
|
WHERE address = ? AND deleted_at IS NULL
|
||||||
|
LIMIT 1
|
||||||
|
`
|
||||||
|
|
||||||
|
func (q *Queries) GetProfileByAddress(ctx context.Context, address string) (Profile, error) {
|
||||||
|
row := q.db.QueryRowContext(ctx, getProfileByAddress, address)
|
||||||
|
var i Profile
|
||||||
|
err := row.Scan(
|
||||||
|
&i.ID,
|
||||||
|
&i.CreatedAt,
|
||||||
|
&i.UpdatedAt,
|
||||||
|
&i.DeletedAt,
|
||||||
|
&i.Address,
|
||||||
|
&i.Handle,
|
||||||
|
&i.Origin,
|
||||||
|
&i.Name,
|
||||||
|
)
|
||||||
|
return i, err
|
||||||
|
}
|
||||||
|
|
||||||
|
const getProfileByHandle = `-- name: GetProfileByHandle :one
|
||||||
|
SELECT id, created_at, updated_at, deleted_at, address, handle, origin, name FROM profiles
|
||||||
|
WHERE handle = ?
|
||||||
|
AND deleted_at IS NULL
|
||||||
|
LIMIT 1
|
||||||
|
`
|
||||||
|
|
||||||
|
func (q *Queries) GetProfileByHandle(ctx context.Context, handle string) (Profile, error) {
|
||||||
|
row := q.db.QueryRowContext(ctx, getProfileByHandle, handle)
|
||||||
|
var i Profile
|
||||||
|
err := row.Scan(
|
||||||
|
&i.ID,
|
||||||
|
&i.CreatedAt,
|
||||||
|
&i.UpdatedAt,
|
||||||
|
&i.DeletedAt,
|
||||||
|
&i.Address,
|
||||||
|
&i.Handle,
|
||||||
|
&i.Origin,
|
||||||
|
&i.Name,
|
||||||
|
)
|
||||||
|
return i, err
|
||||||
|
}
|
||||||
|
|
||||||
|
const getProfileByID = `-- name: GetProfileByID :one
|
||||||
|
SELECT id, created_at, updated_at, deleted_at, address, handle, origin, name FROM profiles
|
||||||
|
WHERE id = ? AND deleted_at IS NULL
|
||||||
|
LIMIT 1
|
||||||
|
`
|
||||||
|
|
||||||
|
func (q *Queries) GetProfileByID(ctx context.Context, id string) (Profile, error) {
|
||||||
|
row := q.db.QueryRowContext(ctx, getProfileByID, id)
|
||||||
|
var i Profile
|
||||||
|
err := row.Scan(
|
||||||
|
&i.ID,
|
||||||
|
&i.CreatedAt,
|
||||||
|
&i.UpdatedAt,
|
||||||
|
&i.DeletedAt,
|
||||||
|
&i.Address,
|
||||||
|
&i.Handle,
|
||||||
|
&i.Origin,
|
||||||
|
&i.Name,
|
||||||
|
)
|
||||||
|
return i, err
|
||||||
|
}
|
||||||
|
|
||||||
|
const getSessionByClientIP = `-- name: GetSessionByClientIP :one
|
||||||
|
SELECT id, created_at, updated_at, deleted_at, browser_name, browser_version, client_ipaddr, platform, is_desktop, is_mobile, is_tablet, is_tv, is_bot, challenge, is_human_first, is_human_last, profile_id FROM sessions
|
||||||
|
WHERE client_ipaddr = ? AND deleted_at IS NULL
|
||||||
|
LIMIT 1
|
||||||
|
`
|
||||||
|
|
||||||
|
func (q *Queries) GetSessionByClientIP(ctx context.Context, clientIpaddr string) (Session, error) {
|
||||||
|
row := q.db.QueryRowContext(ctx, getSessionByClientIP, clientIpaddr)
|
||||||
|
var i Session
|
||||||
|
err := row.Scan(
|
||||||
|
&i.ID,
|
||||||
|
&i.CreatedAt,
|
||||||
|
&i.UpdatedAt,
|
||||||
|
&i.DeletedAt,
|
||||||
|
&i.BrowserName,
|
||||||
|
&i.BrowserVersion,
|
||||||
|
&i.ClientIpaddr,
|
||||||
|
&i.Platform,
|
||||||
|
&i.IsDesktop,
|
||||||
|
&i.IsMobile,
|
||||||
|
&i.IsTablet,
|
||||||
|
&i.IsTv,
|
||||||
|
&i.IsBot,
|
||||||
|
&i.Challenge,
|
||||||
|
&i.IsHumanFirst,
|
||||||
|
&i.IsHumanLast,
|
||||||
|
&i.ProfileID,
|
||||||
|
)
|
||||||
|
return i, err
|
||||||
|
}
|
||||||
|
|
||||||
|
const getSessionByID = `-- name: GetSessionByID :one
|
||||||
|
SELECT id, created_at, updated_at, deleted_at, browser_name, browser_version, client_ipaddr, platform, is_desktop, is_mobile, is_tablet, is_tv, is_bot, challenge, is_human_first, is_human_last, profile_id FROM sessions
|
||||||
|
WHERE id = ? AND deleted_at IS NULL
|
||||||
|
LIMIT 1
|
||||||
|
`
|
||||||
|
|
||||||
|
func (q *Queries) GetSessionByID(ctx context.Context, id string) (Session, error) {
|
||||||
|
row := q.db.QueryRowContext(ctx, getSessionByID, id)
|
||||||
|
var i Session
|
||||||
|
err := row.Scan(
|
||||||
|
&i.ID,
|
||||||
|
&i.CreatedAt,
|
||||||
|
&i.UpdatedAt,
|
||||||
|
&i.DeletedAt,
|
||||||
|
&i.BrowserName,
|
||||||
|
&i.BrowserVersion,
|
||||||
|
&i.ClientIpaddr,
|
||||||
|
&i.Platform,
|
||||||
|
&i.IsDesktop,
|
||||||
|
&i.IsMobile,
|
||||||
|
&i.IsTablet,
|
||||||
|
&i.IsTv,
|
||||||
|
&i.IsBot,
|
||||||
|
&i.Challenge,
|
||||||
|
&i.IsHumanFirst,
|
||||||
|
&i.IsHumanLast,
|
||||||
|
&i.ProfileID,
|
||||||
|
)
|
||||||
|
return i, err
|
||||||
|
}
|
||||||
|
|
||||||
|
const getVaultConfigByCID = `-- name: GetVaultConfigByCID :one
|
||||||
|
SELECT id, created_at, updated_at, deleted_at, handle, origin, address, cid, config, session_id, redirect_uri FROM vaults
|
||||||
|
WHERE cid = ?
|
||||||
|
AND deleted_at IS NULL
|
||||||
|
LIMIT 1
|
||||||
|
`
|
||||||
|
|
||||||
|
func (q *Queries) GetVaultConfigByCID(ctx context.Context, cid string) (Vault, error) {
|
||||||
|
row := q.db.QueryRowContext(ctx, getVaultConfigByCID, cid)
|
||||||
|
var i Vault
|
||||||
|
err := row.Scan(
|
||||||
|
&i.ID,
|
||||||
|
&i.CreatedAt,
|
||||||
|
&i.UpdatedAt,
|
||||||
|
&i.DeletedAt,
|
||||||
|
&i.Handle,
|
||||||
|
&i.Origin,
|
||||||
|
&i.Address,
|
||||||
|
&i.Cid,
|
||||||
|
&i.Config,
|
||||||
|
&i.SessionID,
|
||||||
|
&i.RedirectUri,
|
||||||
|
)
|
||||||
|
return i, err
|
||||||
|
}
|
||||||
|
|
||||||
|
const getVaultRedirectURIBySessionID = `-- name: GetVaultRedirectURIBySessionID :one
|
||||||
|
SELECT redirect_uri FROM vaults
|
||||||
|
WHERE session_id = ?
|
||||||
|
AND deleted_at IS NULL
|
||||||
|
LIMIT 1
|
||||||
|
`
|
||||||
|
|
||||||
|
func (q *Queries) GetVaultRedirectURIBySessionID(ctx context.Context, sessionID string) (string, error) {
|
||||||
|
row := q.db.QueryRowContext(ctx, getVaultRedirectURIBySessionID, sessionID)
|
||||||
|
var redirect_uri string
|
||||||
|
err := row.Scan(&redirect_uri)
|
||||||
|
return redirect_uri, err
|
||||||
|
}
|
||||||
|
|
||||||
|
const insertCredential = `-- name: InsertCredential :one
|
||||||
|
INSERT INTO credentials (
|
||||||
|
handle,
|
||||||
|
credential_id,
|
||||||
|
origin,
|
||||||
|
type,
|
||||||
|
transports
|
||||||
|
) VALUES (?, ?, ?, ?, ?)
|
||||||
|
RETURNING id, created_at, updated_at, deleted_at, handle, credential_id, authenticator_attachment, origin, type, transports
|
||||||
|
`
|
||||||
|
|
||||||
|
type InsertCredentialParams struct {
|
||||||
|
Handle string `json:"handle"`
|
||||||
|
CredentialID string `json:"credential_id"`
|
||||||
|
Origin string `json:"origin"`
|
||||||
|
Type string `json:"type"`
|
||||||
|
Transports string `json:"transports"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (q *Queries) InsertCredential(ctx context.Context, arg InsertCredentialParams) (Credential, error) {
|
||||||
|
row := q.db.QueryRowContext(ctx, insertCredential,
|
||||||
|
arg.Handle,
|
||||||
|
arg.CredentialID,
|
||||||
|
arg.Origin,
|
||||||
|
arg.Type,
|
||||||
|
arg.Transports,
|
||||||
|
)
|
||||||
|
var i Credential
|
||||||
|
err := row.Scan(
|
||||||
|
&i.ID,
|
||||||
|
&i.CreatedAt,
|
||||||
|
&i.UpdatedAt,
|
||||||
|
&i.DeletedAt,
|
||||||
|
&i.Handle,
|
||||||
|
&i.CredentialID,
|
||||||
|
&i.AuthenticatorAttachment,
|
||||||
|
&i.Origin,
|
||||||
|
&i.Type,
|
||||||
|
&i.Transports,
|
||||||
|
)
|
||||||
|
return i, err
|
||||||
|
}
|
||||||
|
|
||||||
|
const insertProfile = `-- name: InsertProfile :one
|
||||||
|
INSERT INTO profiles (
|
||||||
|
address,
|
||||||
|
handle,
|
||||||
|
origin,
|
||||||
|
name
|
||||||
|
) VALUES (?, ?, ?, ?)
|
||||||
|
RETURNING id, created_at, updated_at, deleted_at, address, handle, origin, name
|
||||||
|
`
|
||||||
|
|
||||||
|
type InsertProfileParams struct {
|
||||||
|
Address string `json:"address"`
|
||||||
|
Handle string `json:"handle"`
|
||||||
|
Origin string `json:"origin"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (q *Queries) InsertProfile(ctx context.Context, arg InsertProfileParams) (Profile, error) {
|
||||||
|
row := q.db.QueryRowContext(ctx, insertProfile,
|
||||||
|
arg.Address,
|
||||||
|
arg.Handle,
|
||||||
|
arg.Origin,
|
||||||
|
arg.Name,
|
||||||
|
)
|
||||||
|
var i Profile
|
||||||
|
err := row.Scan(
|
||||||
|
&i.ID,
|
||||||
|
&i.CreatedAt,
|
||||||
|
&i.UpdatedAt,
|
||||||
|
&i.DeletedAt,
|
||||||
|
&i.Address,
|
||||||
|
&i.Handle,
|
||||||
|
&i.Origin,
|
||||||
|
&i.Name,
|
||||||
|
)
|
||||||
|
return i, err
|
||||||
|
}
|
||||||
|
|
||||||
|
const softDeleteCredential = `-- name: SoftDeleteCredential :exec
|
||||||
|
UPDATE credentials
|
||||||
|
SET deleted_at = CURRENT_TIMESTAMP
|
||||||
|
WHERE credential_id = ?
|
||||||
|
`
|
||||||
|
|
||||||
|
func (q *Queries) SoftDeleteCredential(ctx context.Context, credentialID string) error {
|
||||||
|
_, err := q.db.ExecContext(ctx, softDeleteCredential, credentialID)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
const softDeleteProfile = `-- name: SoftDeleteProfile :exec
|
||||||
|
UPDATE profiles
|
||||||
|
SET deleted_at = CURRENT_TIMESTAMP
|
||||||
|
WHERE address = ?
|
||||||
|
`
|
||||||
|
|
||||||
|
func (q *Queries) SoftDeleteProfile(ctx context.Context, address string) error {
|
||||||
|
_, err := q.db.ExecContext(ctx, softDeleteProfile, address)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
const updateProfile = `-- name: UpdateProfile :one
|
||||||
|
UPDATE profiles
|
||||||
|
SET
|
||||||
|
name = ?,
|
||||||
|
handle = ?,
|
||||||
|
updated_at = CURRENT_TIMESTAMP
|
||||||
|
WHERE address = ?
|
||||||
|
AND deleted_at IS NULL
|
||||||
|
RETURNING id, created_at, updated_at, deleted_at, address, handle, origin, name
|
||||||
|
`
|
||||||
|
|
||||||
|
type UpdateProfileParams struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
Handle string `json:"handle"`
|
||||||
|
Address string `json:"address"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (q *Queries) UpdateProfile(ctx context.Context, arg UpdateProfileParams) (Profile, error) {
|
||||||
|
row := q.db.QueryRowContext(ctx, updateProfile, arg.Name, arg.Handle, arg.Address)
|
||||||
|
var i Profile
|
||||||
|
err := row.Scan(
|
||||||
|
&i.ID,
|
||||||
|
&i.CreatedAt,
|
||||||
|
&i.UpdatedAt,
|
||||||
|
&i.DeletedAt,
|
||||||
|
&i.Address,
|
||||||
|
&i.Handle,
|
||||||
|
&i.Origin,
|
||||||
|
&i.Name,
|
||||||
|
)
|
||||||
|
return i, err
|
||||||
|
}
|
||||||
|
|
||||||
|
const updateSessionHumanVerification = `-- name: UpdateSessionHumanVerification :one
|
||||||
|
UPDATE sessions
|
||||||
|
SET
|
||||||
|
is_human_first = ?,
|
||||||
|
is_human_last = ?,
|
||||||
|
updated_at = CURRENT_TIMESTAMP
|
||||||
|
WHERE id = ?
|
||||||
|
RETURNING id, created_at, updated_at, deleted_at, browser_name, browser_version, client_ipaddr, platform, is_desktop, is_mobile, is_tablet, is_tv, is_bot, challenge, is_human_first, is_human_last, profile_id
|
||||||
|
`
|
||||||
|
|
||||||
|
type UpdateSessionHumanVerificationParams struct {
|
||||||
|
IsHumanFirst bool `json:"is_human_first"`
|
||||||
|
IsHumanLast bool `json:"is_human_last"`
|
||||||
|
ID string `json:"id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (q *Queries) UpdateSessionHumanVerification(ctx context.Context, arg UpdateSessionHumanVerificationParams) (Session, error) {
|
||||||
|
row := q.db.QueryRowContext(ctx, updateSessionHumanVerification, arg.IsHumanFirst, arg.IsHumanLast, arg.ID)
|
||||||
|
var i Session
|
||||||
|
err := row.Scan(
|
||||||
|
&i.ID,
|
||||||
|
&i.CreatedAt,
|
||||||
|
&i.UpdatedAt,
|
||||||
|
&i.DeletedAt,
|
||||||
|
&i.BrowserName,
|
||||||
|
&i.BrowserVersion,
|
||||||
|
&i.ClientIpaddr,
|
||||||
|
&i.Platform,
|
||||||
|
&i.IsDesktop,
|
||||||
|
&i.IsMobile,
|
||||||
|
&i.IsTablet,
|
||||||
|
&i.IsTv,
|
||||||
|
&i.IsBot,
|
||||||
|
&i.Challenge,
|
||||||
|
&i.IsHumanFirst,
|
||||||
|
&i.IsHumanLast,
|
||||||
|
&i.ProfileID,
|
||||||
|
)
|
||||||
|
return i, err
|
||||||
|
}
|
||||||
|
|
||||||
|
const updateSessionWithProfileID = `-- name: UpdateSessionWithProfileID :one
|
||||||
|
UPDATE sessions
|
||||||
|
SET
|
||||||
|
profile_id = ?,
|
||||||
|
updated_at = CURRENT_TIMESTAMP
|
||||||
|
WHERE id = ?
|
||||||
|
RETURNING id, created_at, updated_at, deleted_at, browser_name, browser_version, client_ipaddr, platform, is_desktop, is_mobile, is_tablet, is_tv, is_bot, challenge, is_human_first, is_human_last, profile_id
|
||||||
|
`
|
||||||
|
|
||||||
|
type UpdateSessionWithProfileIDParams struct {
|
||||||
|
ProfileID int64 `json:"profile_id"`
|
||||||
|
ID string `json:"id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (q *Queries) UpdateSessionWithProfileID(ctx context.Context, arg UpdateSessionWithProfileIDParams) (Session, error) {
|
||||||
|
row := q.db.QueryRowContext(ctx, updateSessionWithProfileID, arg.ProfileID, arg.ID)
|
||||||
|
var i Session
|
||||||
|
err := row.Scan(
|
||||||
|
&i.ID,
|
||||||
|
&i.CreatedAt,
|
||||||
|
&i.UpdatedAt,
|
||||||
|
&i.DeletedAt,
|
||||||
|
&i.BrowserName,
|
||||||
|
&i.BrowserVersion,
|
||||||
|
&i.ClientIpaddr,
|
||||||
|
&i.Platform,
|
||||||
|
&i.IsDesktop,
|
||||||
|
&i.IsMobile,
|
||||||
|
&i.IsTablet,
|
||||||
|
&i.IsTv,
|
||||||
|
&i.IsBot,
|
||||||
|
&i.Challenge,
|
||||||
|
&i.IsHumanFirst,
|
||||||
|
&i.IsHumanLast,
|
||||||
|
&i.ProfileID,
|
||||||
|
)
|
||||||
|
return i, err
|
||||||
|
}
|
@ -1,151 +0,0 @@
|
|||||||
-- name: InsertCredential :one
|
|
||||||
INSERT INTO credentials (
|
|
||||||
id,
|
|
||||||
created_at,
|
|
||||||
updated_at,
|
|
||||||
deleted_at,
|
|
||||||
handle,
|
|
||||||
credential_id,
|
|
||||||
authenticator_attachment,
|
|
||||||
origin,
|
|
||||||
type,
|
|
||||||
transports
|
|
||||||
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
||||||
RETURNING *;
|
|
||||||
|
|
||||||
-- name: InsertProfile :one
|
|
||||||
INSERT INTO profiles (
|
|
||||||
id,
|
|
||||||
created_at,
|
|
||||||
updated_at,
|
|
||||||
deleted_at,
|
|
||||||
address,
|
|
||||||
handle,
|
|
||||||
origin,
|
|
||||||
name,
|
|
||||||
status
|
|
||||||
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
||||||
RETURNING *;
|
|
||||||
|
|
||||||
-- name: GetProfileByID :one
|
|
||||||
SELECT * FROM profiles
|
|
||||||
WHERE id = ? AND deleted_at IS NULL
|
|
||||||
LIMIT 1;
|
|
||||||
|
|
||||||
-- name: GetProfileByAddress :one
|
|
||||||
SELECT * FROM profiles
|
|
||||||
WHERE address = ? AND deleted_at IS NULL
|
|
||||||
LIMIT 1;
|
|
||||||
|
|
||||||
-- name: GetChallengeBySessionID :one
|
|
||||||
SELECT challenge FROM sessions
|
|
||||||
WHERE id = ? AND deleted_at IS NULL
|
|
||||||
LIMIT 1;
|
|
||||||
|
|
||||||
-- name: GetHumanVerificationNumbers :one
|
|
||||||
SELECT is_human_first, is_human_last FROM sessions
|
|
||||||
WHERE id = ? AND deleted_at IS NULL
|
|
||||||
LIMIT 1;
|
|
||||||
|
|
||||||
-- name: GetSessionByID :one
|
|
||||||
SELECT * FROM sessions
|
|
||||||
WHERE id = ? AND deleted_at IS NULL
|
|
||||||
LIMIT 1;
|
|
||||||
|
|
||||||
-- name: GetSessionByClientIP :one
|
|
||||||
SELECT * FROM sessions
|
|
||||||
WHERE client_ipaddr = ? AND deleted_at IS NULL
|
|
||||||
LIMIT 1;
|
|
||||||
|
|
||||||
-- name: UpdateSessionHumanVerification :one
|
|
||||||
UPDATE sessions
|
|
||||||
SET
|
|
||||||
is_human_first = ?,
|
|
||||||
is_human_last = ?,
|
|
||||||
updated_at = CURRENT_TIMESTAMP
|
|
||||||
WHERE id = ?
|
|
||||||
RETURNING *;
|
|
||||||
|
|
||||||
-- name: UpdateSessionWithProfileID :one
|
|
||||||
UPDATE sessions
|
|
||||||
SET
|
|
||||||
profile_id = ?,
|
|
||||||
updated_at = CURRENT_TIMESTAMP
|
|
||||||
WHERE id = ?
|
|
||||||
RETURNING *;
|
|
||||||
|
|
||||||
-- name: CheckHandleExists :one
|
|
||||||
SELECT COUNT(*) > 0 as handle_exists FROM profiles
|
|
||||||
WHERE handle = ?
|
|
||||||
AND deleted_at IS NULL;
|
|
||||||
|
|
||||||
-- name: GetCredentialsByHandle :many
|
|
||||||
SELECT * FROM credentials
|
|
||||||
WHERE handle = ?
|
|
||||||
AND deleted_at IS NULL;
|
|
||||||
|
|
||||||
-- name: GetCredentialByID :one
|
|
||||||
SELECT * FROM credentials
|
|
||||||
WHERE credential_id = ?
|
|
||||||
AND deleted_at IS NULL
|
|
||||||
LIMIT 1;
|
|
||||||
|
|
||||||
-- name: SoftDeleteCredential :exec
|
|
||||||
UPDATE credentials
|
|
||||||
SET deleted_at = CURRENT_TIMESTAMP
|
|
||||||
WHERE credential_id = ?;
|
|
||||||
|
|
||||||
-- name: SoftDeleteProfile :exec
|
|
||||||
UPDATE profiles
|
|
||||||
SET deleted_at = CURRENT_TIMESTAMP
|
|
||||||
WHERE id = ?;
|
|
||||||
|
|
||||||
-- name: UpdateProfile :one
|
|
||||||
UPDATE profiles
|
|
||||||
SET
|
|
||||||
name = ?,
|
|
||||||
handle = ?,
|
|
||||||
updated_at = CURRENT_TIMESTAMP
|
|
||||||
WHERE id = ?
|
|
||||||
AND deleted_at IS NULL
|
|
||||||
RETURNING *;
|
|
||||||
|
|
||||||
-- name: GetProfileByHandle :one
|
|
||||||
SELECT * FROM profiles
|
|
||||||
WHERE handle = ?
|
|
||||||
AND deleted_at IS NULL
|
|
||||||
LIMIT 1;
|
|
||||||
|
|
||||||
-- name: GetVaultConfigByCID :one
|
|
||||||
SELECT * FROM vaults
|
|
||||||
WHERE cid = ?
|
|
||||||
AND deleted_at IS NULL
|
|
||||||
LIMIT 1;
|
|
||||||
|
|
||||||
-- name: GetVaultRedirectURIBySessionID :one
|
|
||||||
SELECT redirect_uri FROM vaults
|
|
||||||
WHERE session_id = ?
|
|
||||||
AND deleted_at IS NULL
|
|
||||||
LIMIT 1;
|
|
||||||
|
|
||||||
-- name: CreateSession :one
|
|
||||||
INSERT INTO sessions (
|
|
||||||
id,
|
|
||||||
created_at,
|
|
||||||
updated_at,
|
|
||||||
deleted_at,
|
|
||||||
browser_name,
|
|
||||||
browser_version,
|
|
||||||
client_ipaddr,
|
|
||||||
platform,
|
|
||||||
is_desktop,
|
|
||||||
is_mobile,
|
|
||||||
is_tablet,
|
|
||||||
is_tv,
|
|
||||||
is_bot,
|
|
||||||
challenge,
|
|
||||||
is_human_first,
|
|
||||||
is_human_last,
|
|
||||||
profile_id
|
|
||||||
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
||||||
RETURNING *;
|
|
@ -1,122 +0,0 @@
|
|||||||
-- Profiles represent user identities
|
|
||||||
CREATE TABLE profiles (
|
|
||||||
id TEXT PRIMARY KEY,
|
|
||||||
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
||||||
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
||||||
deleted_at DATETIME,
|
|
||||||
address TEXT NOT NULL,
|
|
||||||
handle TEXT NOT NULL UNIQUE,
|
|
||||||
origin TEXT NOT NULL,
|
|
||||||
name TEXT NOT NULL,
|
|
||||||
status TEXT NOT NULL,
|
|
||||||
UNIQUE(address, origin)
|
|
||||||
);
|
|
||||||
|
|
||||||
-- Accounts represent blockchain accounts
|
|
||||||
CREATE TABLE accounts (
|
|
||||||
id TEXT PRIMARY KEY,
|
|
||||||
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
||||||
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
||||||
deleted_at DATETIME,
|
|
||||||
number INTEGER NOT NULL,
|
|
||||||
sequence INTEGER NOT NULL DEFAULT 0,
|
|
||||||
address TEXT NOT NULL UNIQUE,
|
|
||||||
public_key TEXT NOT NULL,
|
|
||||||
chain_id TEXT NOT NULL,
|
|
||||||
controller TEXT NOT NULL,
|
|
||||||
is_subsidiary INTEGER NOT NULL DEFAULT 0,
|
|
||||||
is_validator INTEGER NOT NULL DEFAULT 0,
|
|
||||||
is_delegator INTEGER NOT NULL DEFAULT 0,
|
|
||||||
is_accountable INTEGER NOT NULL DEFAULT 1
|
|
||||||
);
|
|
||||||
|
|
||||||
-- Assets represent tokens and coins
|
|
||||||
CREATE TABLE assets (
|
|
||||||
id TEXT PRIMARY KEY,
|
|
||||||
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
||||||
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
||||||
deleted_at DATETIME,
|
|
||||||
name TEXT NOT NULL,
|
|
||||||
symbol TEXT NOT NULL,
|
|
||||||
decimals INTEGER NOT NULL CHECK(decimals >= 0),
|
|
||||||
chain_id TEXT NOT NULL,
|
|
||||||
channel TEXT NOT NULL,
|
|
||||||
asset_type TEXT NOT NULL,
|
|
||||||
coingecko_id TEXT,
|
|
||||||
UNIQUE(chain_id, symbol)
|
|
||||||
);
|
|
||||||
|
|
||||||
-- Credentials store WebAuthn credentials
|
|
||||||
CREATE TABLE credentials (
|
|
||||||
id TEXT PRIMARY KEY,
|
|
||||||
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
||||||
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
||||||
deleted_at DATETIME,
|
|
||||||
handle TEXT NOT NULL,
|
|
||||||
credential_id TEXT NOT NULL UNIQUE,
|
|
||||||
authenticator_attachment TEXT NOT NULL,
|
|
||||||
origin TEXT NOT NULL,
|
|
||||||
type TEXT NOT NULL,
|
|
||||||
transports TEXT NOT NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
-- Sessions track user authentication state
|
|
||||||
CREATE TABLE sessions (
|
|
||||||
id TEXT PRIMARY KEY,
|
|
||||||
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
||||||
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
||||||
deleted_at DATETIME,
|
|
||||||
browser_name TEXT NOT NULL,
|
|
||||||
browser_version TEXT NOT NULL,
|
|
||||||
client_ipaddr TEXT NOT NULL,
|
|
||||||
platform TEXT NOT NULL,
|
|
||||||
is_desktop INTEGER NOT NULL DEFAULT 0,
|
|
||||||
is_mobile INTEGER NOT NULL DEFAULT 0,
|
|
||||||
is_tablet INTEGER NOT NULL DEFAULT 0,
|
|
||||||
is_tv INTEGER NOT NULL DEFAULT 0,
|
|
||||||
is_bot INTEGER NOT NULL DEFAULT 0,
|
|
||||||
challenge TEXT NOT NULL,
|
|
||||||
is_human_first INTEGER NOT NULL DEFAULT 0,
|
|
||||||
is_human_last INTEGER NOT NULL DEFAULT 0,
|
|
||||||
profile_id TEXT NOT NULL,
|
|
||||||
FOREIGN KEY (profile_id) REFERENCES profiles(id)
|
|
||||||
);
|
|
||||||
|
|
||||||
-- Vaults store encrypted data
|
|
||||||
CREATE TABLE vaults (
|
|
||||||
id TEXT PRIMARY KEY,
|
|
||||||
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
||||||
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
||||||
deleted_at DATETIME,
|
|
||||||
handle TEXT NOT NULL,
|
|
||||||
origin TEXT NOT NULL,
|
|
||||||
address TEXT NOT NULL,
|
|
||||||
cid TEXT NOT NULL UNIQUE,
|
|
||||||
config TEXT NOT NULL,
|
|
||||||
session_id TEXT NOT NULL,
|
|
||||||
redirect_uri TEXT NOT NULL,
|
|
||||||
FOREIGN KEY (session_id) REFERENCES sessions(id)
|
|
||||||
);
|
|
||||||
|
|
||||||
-- Indexes for common queries
|
|
||||||
CREATE INDEX idx_profiles_handle ON profiles(handle);
|
|
||||||
CREATE INDEX idx_profiles_address ON profiles(address);
|
|
||||||
CREATE INDEX idx_profiles_origin ON profiles(origin);
|
|
||||||
CREATE INDEX idx_profiles_status ON profiles(status);
|
|
||||||
CREATE INDEX idx_profiles_deleted_at ON profiles(deleted_at);
|
|
||||||
|
|
||||||
CREATE INDEX idx_accounts_address ON accounts(address);
|
|
||||||
CREATE INDEX idx_accounts_chain_id ON accounts(chain_id);
|
|
||||||
CREATE INDEX idx_accounts_deleted_at ON accounts(deleted_at);
|
|
||||||
|
|
||||||
CREATE INDEX idx_assets_symbol ON assets(symbol);
|
|
||||||
CREATE INDEX idx_assets_chain_id ON assets(chain_id);
|
|
||||||
CREATE INDEX idx_assets_deleted_at ON assets(deleted_at);
|
|
||||||
|
|
||||||
CREATE INDEX idx_credentials_handle ON credentials(handle);
|
|
||||||
CREATE INDEX idx_credentials_origin ON credentials(origin);
|
|
||||||
CREATE INDEX idx_credentials_deleted_at ON credentials(deleted_at);
|
|
||||||
|
|
||||||
CREATE INDEX idx_sessions_profile_id ON sessions(profile_id);
|
|
||||||
CREATE INDEX idx_sessions_client_ipaddr ON sessions(client_ipaddr);
|
|
||||||
CREATE INDEX idx_sessions_deleted_at ON sessions(deleted_at);
|
|
@ -4,5 +4,5 @@ import (
|
|||||||
_ "embed"
|
_ "embed"
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:embed vault/schema.sql
|
//go:embed schema.sql
|
||||||
var SchemaVaultSQL string
|
var SchemaVaultSQL string
|
||||||
|
@ -1,26 +1,11 @@
|
|||||||
version: "2"
|
version: "2"
|
||||||
sql:
|
sql:
|
||||||
- engine: "sqlite"
|
- engine: "sqlite"
|
||||||
queries: "./sink/vault/query.sql"
|
queries: "./sink/query.sql"
|
||||||
schema: "./sink/vault/schema.sql"
|
schema: "./sink/schema.sql"
|
||||||
gen:
|
gen:
|
||||||
go:
|
go:
|
||||||
emit_interface: true
|
emit_interface: true
|
||||||
emit_json_tags: true
|
emit_json_tags: true
|
||||||
package: "motrorm"
|
package: "models"
|
||||||
out: "motrorm"
|
out: "models"
|
||||||
|
|
||||||
- engine: "postgresql"
|
|
||||||
queries: "./sink/highway/query.sql"
|
|
||||||
schema: "./sink/highway/schema.sql"
|
|
||||||
gen:
|
|
||||||
go:
|
|
||||||
emit_all_enum_values: true
|
|
||||||
emit_enum_valid_method: true
|
|
||||||
emit_json_tags: true
|
|
||||||
emit_interface: true
|
|
||||||
emit_result_struct_pointers: true
|
|
||||||
omit_unused_structs: true
|
|
||||||
package: "hwayorm"
|
|
||||||
out: "hwayorm"
|
|
||||||
sql_package: "pgx/v5"
|
|
||||||
|
@ -3,9 +3,9 @@ package common
|
|||||||
import (
|
import (
|
||||||
bankv1beta1 "cosmossdk.io/api/cosmos/bank/v1beta1"
|
bankv1beta1 "cosmossdk.io/api/cosmos/bank/v1beta1"
|
||||||
nodev1beta1 "github.com/cosmos/cosmos-sdk/client/grpc/node"
|
nodev1beta1 "github.com/cosmos/cosmos-sdk/client/grpc/node"
|
||||||
didv1 "github.com/onsonr/sonr/api/did/v1"
|
didv1 "github.com/onsonr/hway/api/did/v1"
|
||||||
dwnv1 "github.com/onsonr/sonr/api/dwn/v1"
|
dwnv1 "github.com/onsonr/hway/api/dwn/v1"
|
||||||
svcv1 "github.com/onsonr/sonr/api/svc/v1"
|
svcv1 "github.com/onsonr/hway/api/svc/v1"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -8,8 +8,8 @@ import (
|
|||||||
|
|
||||||
"github.com/golang-jwt/jwt"
|
"github.com/golang-jwt/jwt"
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
"github.com/onsonr/sonr/internal/crypto/keys"
|
"github.com/onsonr/hway/internal/crypto/keys"
|
||||||
"github.com/onsonr/sonr/internal/crypto/ucan"
|
"github.com/onsonr/hway/internal/crypto/ucan"
|
||||||
)
|
)
|
||||||
|
|
||||||
type IPFSTokenStore interface {
|
type IPFSTokenStore interface {
|
||||||
|
@ -6,10 +6,10 @@ import (
|
|||||||
|
|
||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
"github.com/medama-io/go-useragent"
|
"github.com/medama-io/go-useragent"
|
||||||
"github.com/onsonr/sonr/internal/crypto/mpc"
|
"github.com/onsonr/hway/internal/crypto/mpc"
|
||||||
"github.com/onsonr/sonr/internal/common"
|
"github.com/onsonr/hway/internal/common"
|
||||||
"github.com/onsonr/sonr/internal/config/hway"
|
"github.com/onsonr/hway/internal/config/hway"
|
||||||
hwayorm "github.com/onsonr/sonr/internal/database/hwayorm"
|
hwayorm "github.com/onsonr/hway/internal/database/hwayorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
type GatewayContext struct {
|
type GatewayContext struct {
|
||||||
|
@ -4,7 +4,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
hwayorm "github.com/onsonr/sonr/internal/database/hwayorm"
|
hwayorm "github.com/onsonr/hway/internal/database/hwayorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
func UpdateProfile(c echo.Context) (*hwayorm.Profile, error) {
|
func UpdateProfile(c echo.Context) (*hwayorm.Profile, error) {
|
||||||
|
@ -5,7 +5,7 @@ import (
|
|||||||
|
|
||||||
"github.com/a-h/templ"
|
"github.com/a-h/templ"
|
||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
"github.com/onsonr/sonr/gateway/views"
|
"github.com/onsonr/hway/gateway/views"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Render(c echo.Context, cmp templ.Component) error {
|
func Render(c echo.Context, cmp templ.Component) error {
|
||||||
|
@ -3,7 +3,7 @@ package context
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/internal/common"
|
"github.com/onsonr/hway/internal/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ParamsBank returns the bank params
|
// ParamsBank returns the bank params
|
||||||
|
@ -4,7 +4,7 @@ import (
|
|||||||
gocontext "context"
|
gocontext "context"
|
||||||
|
|
||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
"github.com/onsonr/sonr/internal/common"
|
"github.com/onsonr/hway/internal/common"
|
||||||
"github.com/segmentio/ksuid"
|
"github.com/segmentio/ksuid"
|
||||||
"lukechampine.com/blake3"
|
"lukechampine.com/blake3"
|
||||||
)
|
)
|
||||||
|
@ -4,7 +4,7 @@ import (
|
|||||||
"github.com/go-webauthn/webauthn/protocol"
|
"github.com/go-webauthn/webauthn/protocol"
|
||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
"github.com/medama-io/go-useragent"
|
"github.com/medama-io/go-useragent"
|
||||||
hwayorm "github.com/onsonr/sonr/internal/database/hwayorm"
|
hwayorm "github.com/onsonr/hway/internal/database/hwayorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Define the credential structure matching our frontend data
|
// Define the credential structure matching our frontend data
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package context
|
package context
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/onsonr/sonr/internal/crypto/mpc"
|
"github.com/onsonr/hway/internal/crypto/mpc"
|
||||||
"github.com/onsonr/sonr/internal/common"
|
"github.com/onsonr/hway/internal/common"
|
||||||
"lukechampine.com/blake3"
|
"lukechampine.com/blake3"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ templ HeroSocials() {
|
|||||||
<sl-button circle outline href="https://onsonr.dev">
|
<sl-button circle outline href="https://onsonr.dev">
|
||||||
<sl-icon name="docs" library="sonr" label="Docs"></sl-icon>
|
<sl-icon name="docs" library="sonr" label="Docs"></sl-icon>
|
||||||
</sl-button>
|
</sl-button>
|
||||||
<sl-button circle outline href="https://github.com/onsonr/sonr">
|
<sl-button circle outline href="https://github.com/onsonr/hway">
|
||||||
<sl-icon name="social-github" library="sonr" label="Open Source"></sl-icon>
|
<sl-icon name="social-github" library="sonr" label="Open Source"></sl-icon>
|
||||||
</sl-button>
|
</sl-button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -113,7 +113,7 @@ func HeroSocials() templ.Component {
|
|||||||
templ_7745c5c3_Var5 = templ.NopComponent
|
templ_7745c5c3_Var5 = templ.NopComponent
|
||||||
}
|
}
|
||||||
ctx = templ.ClearChildren(ctx)
|
ctx = templ.ClearChildren(ctx)
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"pt-1.5 flex flex-row items-center justify-center h-full gap-3\"><sl-button circle outline href=\"https://sonr.io\"><sl-icon name=\"home\" library=\"sonr\" label=\"Home\"></sl-icon></sl-button> <sl-button circle outline href=\"https://onsonr.dev\"><sl-icon name=\"docs\" library=\"sonr\" label=\"Docs\"></sl-icon></sl-button> <sl-button circle outline href=\"https://github.com/onsonr/sonr\"><sl-icon name=\"social-github\" library=\"sonr\" label=\"Open Source\"></sl-icon></sl-button></div>")
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"pt-1.5 flex flex-row items-center justify-center h-full gap-3\"><sl-button circle outline href=\"https://sonr.io\"><sl-icon name=\"home\" library=\"sonr\" label=\"Home\"></sl-icon></sl-button> <sl-button circle outline href=\"https://onsonr.dev\"><sl-icon name=\"docs\" library=\"sonr\" label=\"Docs\"></sl-icon></sl-button> <sl-button circle outline href=\"https://github.com/onsonr/hway\"><sl-icon name=\"social-github\" library=\"sonr\" label=\"Open Source\"></sl-icon></sl-button></div>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package views
|
package views
|
||||||
|
|
||||||
import "github.com/onsonr/sonr/gateway/islands"
|
import "github.com/onsonr/hway/gateway/islands"
|
||||||
|
|
||||||
templ RegisterProfileView(firstNumber int, lastNumber int) {
|
templ RegisterProfileView(firstNumber int, lastNumber int) {
|
||||||
@LayoutView("New Profile | Sonr.ID") {
|
@LayoutView("New Profile | Sonr.ID") {
|
||||||
|
@ -8,7 +8,7 @@ package views
|
|||||||
import "github.com/a-h/templ"
|
import "github.com/a-h/templ"
|
||||||
import templruntime "github.com/a-h/templ/runtime"
|
import templruntime "github.com/a-h/templ/runtime"
|
||||||
|
|
||||||
import "github.com/onsonr/sonr/gateway/islands"
|
import "github.com/onsonr/hway/gateway/islands"
|
||||||
|
|
||||||
func RegisterProfileView(firstNumber int, lastNumber int) templ.Component {
|
func RegisterProfileView(firstNumber int, lastNumber int) templ.Component {
|
||||||
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||||
|
16
pkl/App.pkl
Normal file
16
pkl/App.pkl
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
@go.Package { name = "github.com/onsonr/hway/internal/config" }
|
||||||
|
|
||||||
|
|
||||||
|
open module sonr.net.Hway
|
||||||
|
|
||||||
|
import "package://pkg.pkl-lang.org/pkl-go/pkl.golang@0.5.0#/go.pkl"
|
||||||
|
|
||||||
|
servePort: Int = 3000
|
||||||
|
|
||||||
|
sqliteFile: String = "hway.db"
|
||||||
|
chainId: String = "sonr-testnet-1"
|
||||||
|
ipfsGatewayUrl: String = "http://localhost:8080"
|
||||||
|
sonrApiUrl: String = "http://localhost:1317"
|
||||||
|
sonrGrpcUrl: String = "http://localhost:9090"
|
||||||
|
sonrRpcUrl: String = "http://localhost:26657"
|
||||||
|
psqlDSN: String
|
Loading…
x
Reference in New Issue
Block a user