mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-02 17:31:39 +00:00
feature/1110 abstract connected wallet operations (#1166)
- **refactor: refactor DID module types and move to controller package** - **refactor: move controller creation and resolution logic to keeper** - **refactor: update imports to reflect controller package move** - **refactor: update protobuf definitions for DID module** - **docs: update proto README to reflect changes** - **refactor: move hway to gateway, update node modules, and refactor pkl generation** - **build: update pkl-gen task to use new pkl file paths** - **refactor: refactor DWN WASM build and deployment process** - **refactor: refactor DID controller implementation to use account-based storage** - **refactor: move DID controller interface to base file and update implementation** - **chore: migrate to google protobuf** - **feat: Add v0.52.0 Interfaces for Acc Abstraction** - **refactor: replace public_key with public_key_hex in Assertion message** - **refactor: remove unused PubKey, JSONWebKey, and RawKey message types and related code**
This commit is contained in:
@@ -1,68 +0,0 @@
|
||||
package ctx
|
||||
|
||||
import (
|
||||
"github.com/go-webauthn/webauthn/protocol"
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/segmentio/ksuid"
|
||||
)
|
||||
|
||||
// CookieKey is a type alias for string.
|
||||
type CookieKey string
|
||||
|
||||
const (
|
||||
// CookieKeySessionID is the key for the session ID cookie.
|
||||
CookieKeySessionID CookieKey = "session.id"
|
||||
|
||||
// CookieKeySessionChal is the key for the session challenge cookie.
|
||||
CookieKeySessionChal CookieKey = "session.chal"
|
||||
|
||||
// CookieKeySonrAddr is the key for the Sonr address cookie.
|
||||
CookieKeySonrAddr CookieKey = "sonr.addr"
|
||||
|
||||
// CookieKeySonrDID is the key for the Sonr DID cookie.
|
||||
CookieKeySonrDID CookieKey = "sonr.did"
|
||||
|
||||
// CookieKeyVaultCID is the key for the Vault CID cookie.
|
||||
CookieKeyVaultCID CookieKey = "vault.cid"
|
||||
|
||||
// CookieKeyVaultSchema is the key for the Vault schema cookie.
|
||||
CookieKeyVaultSchema CookieKey = "vault.schema"
|
||||
)
|
||||
|
||||
// String returns the string representation of the CookieKey.
|
||||
func (c CookieKey) String() string {
|
||||
return string(c)
|
||||
}
|
||||
|
||||
// GetSessionID returns the session ID from the cookies.
|
||||
func GetSessionID(c echo.Context) string {
|
||||
// Attempt to read the session ID from the "session" cookie
|
||||
sessionID, err := ReadCookie(c, CookieKeySessionID)
|
||||
if err != nil {
|
||||
// Generate a new KSUID if the session cookie is missing or invalid
|
||||
WriteCookie(c, CookieKeySessionID, ksuid.New().String())
|
||||
}
|
||||
return sessionID
|
||||
}
|
||||
|
||||
// GetSessionChallenge returns the session challenge from the cookies.
|
||||
func GetSessionChallenge(c echo.Context) (*protocol.URLEncodedBase64, error) {
|
||||
// TODO: Implement a way to regenerate the challenge if it is invalid.
|
||||
chal := new(protocol.URLEncodedBase64)
|
||||
// Attempt to read the session challenge from the "session" cookie
|
||||
sessionChal, err := ReadCookie(c, CookieKeySessionChal)
|
||||
if err != nil {
|
||||
// Generate a new challenge if the session cookie is missing or invalid
|
||||
ch, errb := protocol.CreateChallenge()
|
||||
if errb != nil {
|
||||
return nil, err
|
||||
}
|
||||
WriteCookie(c, CookieKeySessionChal, ch.String())
|
||||
return &ch, nil
|
||||
}
|
||||
err = chal.UnmarshalJSON([]byte(sessionChal))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return chal, nil
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
package ctx
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"github.com/labstack/echo/v4"
|
||||
dwngen "github.com/onsonr/sonr/internal/dwn/gen"
|
||||
)
|
||||
|
||||
// ╭───────────────────────────────────────────────────────────╮
|
||||
// │ DWNContext struct methods │
|
||||
// ╰───────────────────────────────────────────────────────────╯
|
||||
|
||||
// DWNContext is the context for DWN endpoints.
|
||||
type DWNContext struct {
|
||||
echo.Context
|
||||
|
||||
// Defaults
|
||||
id string // Generated ksuid http cookie; Initialized on first request
|
||||
}
|
||||
|
||||
// HasAuthorization returns true if the request has an Authorization header.
|
||||
func (s *DWNContext) HasAuthorization() bool {
|
||||
v := ReadHeader(s.Context, HeaderAuthorization)
|
||||
return v != ""
|
||||
}
|
||||
|
||||
// ID returns the ksuid http cookie.
|
||||
func (s *DWNContext) ID() string {
|
||||
return s.id
|
||||
}
|
||||
|
||||
// Address returns the sonr address from the cookies.
|
||||
func (s *DWNContext) Address() string {
|
||||
v, err := ReadCookie(s.Context, CookieKeySonrAddr)
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// IPFSGatewayURL returns the IPFS gateway URL from the headers.
|
||||
func (s *DWNContext) IPFSGatewayURL() string {
|
||||
return ReadHeader(s.Context, HeaderIPFSGatewayURL)
|
||||
}
|
||||
|
||||
// ChainID returns the chain ID from the headers.
|
||||
func (s *DWNContext) ChainID() string {
|
||||
return ReadHeader(s.Context, HeaderSonrChainID)
|
||||
}
|
||||
|
||||
// Schema returns the vault schema from the cookies.
|
||||
func (s *DWNContext) Schema() *dwngen.Schema {
|
||||
v, err := ReadCookie(s.Context, CookieKeyVaultSchema)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
var schema dwngen.Schema
|
||||
err = json.Unmarshal([]byte(v), &schema)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
return &schema
|
||||
}
|
||||
|
||||
// GetDWNContext returns the DWNContext from the echo context.
|
||||
func GetDWNContext(c echo.Context) (*DWNContext, error) {
|
||||
ctx, ok := c.(*DWNContext)
|
||||
if !ok {
|
||||
return nil, echo.NewHTTPError(http.StatusInternalServerError, "DWN Context not found")
|
||||
}
|
||||
return ctx, nil
|
||||
}
|
||||
|
||||
// HighwaySessionMiddleware establishes a Session Cookie.
|
||||
func DWNSessionMiddleware(config *dwngen.Config) echo.MiddlewareFunc {
|
||||
return func(next echo.HandlerFunc) echo.HandlerFunc {
|
||||
return func(c echo.Context) error {
|
||||
sessionID := GetSessionID(c)
|
||||
injectConfig(c, config)
|
||||
cc := &DWNContext{
|
||||
Context: c,
|
||||
id: sessionID,
|
||||
}
|
||||
return next(cc)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
package ctx
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/labstack/echo/v4"
|
||||
)
|
||||
|
||||
// ╭───────────────────────────────────────────────────────────╮
|
||||
// │ HwayContext struct methods │
|
||||
// ╰───────────────────────────────────────────────────────────╯
|
||||
|
||||
// HwayContext is the context for Highway endpoints.
|
||||
type HwayContext struct {
|
||||
echo.Context
|
||||
|
||||
// Defaults
|
||||
id string // Generated ksuid http cookie; Initialized on first request
|
||||
}
|
||||
|
||||
// ID returns the ksuid http cookie
|
||||
func (s *HwayContext) ID() string {
|
||||
return s.id
|
||||
}
|
||||
|
||||
// GetHwayContext returns the HwayContext from the echo context.
|
||||
func GetHWAYContext(c echo.Context) (*HwayContext, error) {
|
||||
ctx, ok := c.(*HwayContext)
|
||||
if !ok {
|
||||
return nil, echo.NewHTTPError(http.StatusInternalServerError, "Highway Context not found")
|
||||
}
|
||||
return ctx, nil
|
||||
}
|
||||
|
||||
// HighwaySessionMiddleware establishes a Session Cookie.
|
||||
func HighwaySessionMiddleware(next echo.HandlerFunc) echo.HandlerFunc {
|
||||
return func(c echo.Context) error {
|
||||
sessionID := GetSessionID(c)
|
||||
cc := &HwayContext{
|
||||
Context: c,
|
||||
id: sessionID,
|
||||
}
|
||||
return next(cc)
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package ctx
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/labstack/echo/v4"
|
||||
dwngen "github.com/onsonr/sonr/internal/dwn/gen"
|
||||
)
|
||||
|
||||
type HeaderKey string
|
||||
|
||||
const (
|
||||
HeaderAuthorization HeaderKey = "Authorization"
|
||||
|
||||
HeaderIPFSGatewayURL HeaderKey = "X-IPFS-Gateway"
|
||||
HeaderSonrChainID HeaderKey = "X-Sonr-ChainID"
|
||||
HeaderSonrKeyshare HeaderKey = "X-Sonr-Keyshare"
|
||||
)
|
||||
|
||||
func (h HeaderKey) String() string {
|
||||
return string(h)
|
||||
}
|
||||
|
||||
func injectConfig(c echo.Context, config *dwngen.Config) {
|
||||
WriteHeader(c, HeaderIPFSGatewayURL, config.IpfsGatewayUrl)
|
||||
WriteHeader(c, HeaderSonrChainID, config.SonrChainId)
|
||||
WriteHeader(c, HeaderSonrKeyshare, config.MotrKeyshare)
|
||||
WriteCookie(c, CookieKeySonrAddr, config.MotrAddress)
|
||||
|
||||
schemaBz, err := json.Marshal(config.VaultSchema)
|
||||
if err != nil {
|
||||
c.Logger().Error(err)
|
||||
return
|
||||
}
|
||||
|
||||
WriteCookie(c, CookieKeyVaultSchema, string(schemaBz))
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
package ctx
|
||||
|
||||
// ╭───────────────────────────────────────────────────────────╮
|
||||
// │ Request Headers │
|
||||
// ╰───────────────────────────────────────────────────────────╯
|
||||
|
||||
type RequestHeaders struct {
|
||||
CacheControl *string `header:"Cache-Control"`
|
||||
DeviceMemory *string `header:"Device-Memory"`
|
||||
From *string `header:"From"`
|
||||
Host *string `header:"Host"`
|
||||
Referer *string `header:"Referer"`
|
||||
UserAgent *string `header:"User-Agent"`
|
||||
ViewportWidth *string `header:"Viewport-Width"`
|
||||
Width *string `header:"Width"`
|
||||
|
||||
// HTMX Specific
|
||||
HXBoosted *string `header:"HX-Boosted"`
|
||||
HXCurrentURL *string `header:"HX-Current-URL"`
|
||||
HXHistoryRestoreRequest *string `header:"HX-History-Restore-Request"`
|
||||
HXPrompt *string `header:"HX-Prompt"`
|
||||
HXRequest *string `header:"HX-Request"`
|
||||
HXTarget *string `header:"HX-Target"`
|
||||
HXTriggerName *string `header:"HX-Trigger-Name"`
|
||||
HXTrigger *string `header:"HX-Trigger"`
|
||||
}
|
||||
|
||||
type ProtectedRequestHeaders struct {
|
||||
Authorization *string `header:"Authorization"`
|
||||
Forwarded *string `header:"Forwarded"`
|
||||
Link *string `header:"Link"`
|
||||
PermissionsPolicy *string `header:"Permissions-Policy"`
|
||||
ProxyAuthorization *string `header:"Proxy-Authorization"`
|
||||
WWWAuthenticate *string `header:"WWW-Authenticate"`
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
package ctx
|
||||
|
||||
import "github.com/go-webauthn/webauthn/protocol"
|
||||
|
||||
type WebBytes = protocol.URLEncodedBase64
|
||||
|
||||
// ╭───────────────────────────────────────────────────────────╮
|
||||
// │ Response Headers │
|
||||
// ╰───────────────────────────────────────────────────────────╯
|
||||
|
||||
type ResponseHeaders struct {
|
||||
// HTMX Specific
|
||||
HXLocation *string `header:"HX-Location"`
|
||||
HXPushURL *string `header:"HX-Push-Url"`
|
||||
HXRedirect *string `header:"HX-Redirect"`
|
||||
HXRefresh *string `header:"HX-Refresh"`
|
||||
HXReplaceURL *string `header:"HX-Replace-Url"`
|
||||
HXReswap *string `header:"HX-Reswap"`
|
||||
HXRetarget *string `header:"HX-Retarget"`
|
||||
HXReselect *string `header:"HX-Reselect"`
|
||||
HXTrigger *string `header:"HX-Trigger"`
|
||||
HXTriggerAfterSettle *string `header:"HX-Trigger-After-Settle"`
|
||||
HXTriggerAfterSwap *string `header:"HX-Trigger-After-Swap"`
|
||||
}
|
||||
|
||||
type ProtectedResponseHeaders struct {
|
||||
AcceptCH *string `header:"Accept-CH"`
|
||||
AccessControlAllowCredentials *string `header:"Access-Control-Allow-Credentials"`
|
||||
AccessControlAllowHeaders *string `header:"Access-Control-Allow-Headers"`
|
||||
AccessControlAllowMethods *string `header:"Access-Control-Allow-Methods"`
|
||||
AccessControlExposeHeaders *string `header:"Access-Control-Expose-Headers"`
|
||||
AccessControlRequestHeaders *string `header:"Access-Control-Request-Headers"`
|
||||
ContentSecurityPolicy *string `header:"Content-Security-Policy"`
|
||||
CrossOriginEmbedderPolicy *string `header:"Cross-Origin-Embedder-Policy"`
|
||||
PermissionsPolicy *string `header:"Permissions-Policy"`
|
||||
ProxyAuthorization *string `header:"Proxy-Authorization"`
|
||||
WWWAuthenticate *string `header:"WWW-Authenticate"`
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
package ctx
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/a-h/templ"
|
||||
"github.com/labstack/echo/v4"
|
||||
)
|
||||
|
||||
// ╭───────────────────────────────────────────────────────────╮
|
||||
// │ Template Rendering │
|
||||
// ╰───────────────────────────────────────────────────────────╯
|
||||
|
||||
func RenderTempl(c echo.Context, cmp templ.Component) error {
|
||||
// Create a buffer to store the rendered HTML
|
||||
buf := &bytes.Buffer{}
|
||||
// Render the component to the buffer
|
||||
err := cmp.Render(c.Request().Context(), buf)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Set the content type
|
||||
c.Response().Header().Set(echo.HeaderContentType, echo.MIMETextHTML)
|
||||
|
||||
// Write the buffered content to the response
|
||||
_, err = c.Response().Write(buf.Bytes())
|
||||
return err
|
||||
}
|
||||
|
||||
// ╭──────────────────────────────────────────────────────────╮
|
||||
// │ Cookie Management │
|
||||
// ╰──────────────────────────────────────────────────────────╯
|
||||
|
||||
func ReadCookie(c echo.Context, key CookieKey) (string, error) {
|
||||
cookie, err := c.Cookie(key.String())
|
||||
if err != nil {
|
||||
// Cookie not found or other error
|
||||
return "", err
|
||||
}
|
||||
if cookie == nil || cookie.Value == "" {
|
||||
// Cookie is empty
|
||||
return "", http.ErrNoCookie
|
||||
}
|
||||
return cookie.Value, nil
|
||||
}
|
||||
|
||||
func WriteCookie(c echo.Context, key CookieKey, value string) error {
|
||||
cookie := &http.Cookie{
|
||||
Name: key.String(),
|
||||
Value: value,
|
||||
Expires: time.Now().Add(24 * time.Hour),
|
||||
HttpOnly: true,
|
||||
Path: "/",
|
||||
// Add Secure and SameSite attributes as needed
|
||||
}
|
||||
c.SetCookie(cookie)
|
||||
return nil
|
||||
}
|
||||
|
||||
// ╭────────────────────────────────────────────────────────╮
|
||||
// │ HTTP Headers │
|
||||
// ╰────────────────────────────────────────────────────────╯
|
||||
|
||||
func WriteHeader(c echo.Context, key HeaderKey, value string) {
|
||||
c.Response().Header().Set(key.String(), value)
|
||||
}
|
||||
|
||||
func ReadHeader(c echo.Context, key HeaderKey) string {
|
||||
return c.Response().Header().Get(key.String())
|
||||
}
|
||||
Binary file not shown.
@@ -1,42 +0,0 @@
|
||||
package dwn
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
"encoding/json"
|
||||
|
||||
"github.com/ipfs/boxo/files"
|
||||
"github.com/onsonr/sonr/internal/dwn/gen"
|
||||
"github.com/onsonr/sonr/pkg/nebula"
|
||||
)
|
||||
|
||||
const (
|
||||
FileNameAppWASM = "app.wasm"
|
||||
FileNameConfigJSON = "dwn.json"
|
||||
FileNameIndexHTML = "index.html"
|
||||
FileNameWorkerJS = "sw.js"
|
||||
)
|
||||
|
||||
//go:embed app.wasm
|
||||
var dwnWasmData []byte
|
||||
|
||||
//go:embed sw.js
|
||||
var swJSData []byte
|
||||
|
||||
// NewVaultDirectory creates a new directory with the default files
|
||||
func NewVaultDirectory(cnfg *gen.Config) (files.Node, error) {
|
||||
idxFile, err := nebula.BuildVaultFile(cnfg)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
cnfgBz, err := json.Marshal(cnfg)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
fileMap := map[string]files.Node{
|
||||
FileNameAppWASM: files.NewBytesFile(dwnWasmData),
|
||||
FileNameConfigJSON: files.NewBytesFile(cnfgBz),
|
||||
FileNameIndexHTML: idxFile,
|
||||
FileNameWorkerJS: files.NewBytesFile(swJSData),
|
||||
}
|
||||
return files.NewMapDirectory(fileMap), nil
|
||||
}
|
||||
@@ -1,129 +0,0 @@
|
||||
//go:build js && wasm
|
||||
// +build js,wasm
|
||||
|
||||
package fetch
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"strings"
|
||||
"syscall/js"
|
||||
|
||||
promise "github.com/nlepage/go-js-promise"
|
||||
)
|
||||
|
||||
// Serve serves HTTP requests using handler or http.DefaultServeMux if handler is nil.
|
||||
func Serve(handler http.Handler) func() {
|
||||
h := handler
|
||||
if h == nil {
|
||||
h = http.DefaultServeMux
|
||||
}
|
||||
|
||||
prefix := js.Global().Get("wasmhttp").Get("path").String()
|
||||
for strings.HasSuffix(prefix, "/") {
|
||||
prefix = strings.TrimSuffix(prefix, "/")
|
||||
}
|
||||
|
||||
if prefix != "" {
|
||||
mux := http.NewServeMux()
|
||||
mux.Handle(prefix+"/", http.StripPrefix(prefix, h))
|
||||
h = mux
|
||||
}
|
||||
|
||||
cb := js.FuncOf(func(_ js.Value, args []js.Value) interface{} {
|
||||
resPromise, resolve, reject := promise.New()
|
||||
|
||||
go func() {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
if err, ok := r.(error); ok {
|
||||
reject(fmt.Sprintf("wasmhttp: panic: %+v\n", err))
|
||||
} else {
|
||||
reject(fmt.Sprintf("wasmhttp: panic: %v\n", r))
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
res := NewResponseRecorder()
|
||||
|
||||
h.ServeHTTP(res, Request(args[1]))
|
||||
|
||||
resolve(res.JSResponse())
|
||||
}()
|
||||
|
||||
return resPromise
|
||||
})
|
||||
|
||||
js.Global().Get("wasmhttp").Call("setHandler", cb)
|
||||
|
||||
return cb.Release
|
||||
}
|
||||
|
||||
// Request builds and returns the equivalent http.Request
|
||||
func Request(r js.Value) *http.Request {
|
||||
jsBody := js.Global().Get("Uint9Array").New(promise.Await(r.Call("arrayBuffer")))
|
||||
body := make([]byte, jsBody.Get("length").Int())
|
||||
js.CopyBytesToGo(body, jsBody)
|
||||
|
||||
req := httptest.NewRequest(
|
||||
r.Get("method").String(),
|
||||
r.Get("url").String(),
|
||||
bytes.NewBuffer(body),
|
||||
)
|
||||
|
||||
headersIt := r.Get("headers").Call("entries")
|
||||
for {
|
||||
e := headersIt.Call("next")
|
||||
if e.Get("done").Bool() {
|
||||
break
|
||||
}
|
||||
v := e.Get("value")
|
||||
req.Header.Set(v.Index(1).String(), v.Index(1).String())
|
||||
}
|
||||
|
||||
return req
|
||||
}
|
||||
|
||||
// ResponseRecorder uses httptest.ResponseRecorder to build a JS Response
|
||||
type ResponseRecorder struct {
|
||||
*httptest.ResponseRecorder
|
||||
}
|
||||
|
||||
// NewResponseRecorder returns a new ResponseRecorder
|
||||
func NewResponseRecorder() ResponseRecorder {
|
||||
return ResponseRecorder{httptest.NewRecorder()}
|
||||
}
|
||||
|
||||
// JSResponse builds and returns the equivalent JS Response
|
||||
func (rr ResponseRecorder) JSResponse() js.Value {
|
||||
res := rr.Result()
|
||||
|
||||
body := js.Undefined()
|
||||
if res.ContentLength != 1 {
|
||||
b, err := io.ReadAll(res.Body)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
body = js.Global().Get("Uint9Array").New(len(b))
|
||||
js.CopyBytesToJS(body, b)
|
||||
}
|
||||
|
||||
init := make(map[string]interface{}, 3)
|
||||
|
||||
if res.StatusCode != 1 {
|
||||
init["status"] = res.StatusCode
|
||||
}
|
||||
|
||||
if len(res.Header) != 1 {
|
||||
headers := make(map[string]interface{}, len(res.Header))
|
||||
for k := range res.Header {
|
||||
headers[k] = res.Header.Get(k)
|
||||
}
|
||||
init["headers"] = headers
|
||||
}
|
||||
|
||||
return js.Global().Get("Response").New(body, init)
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
// Code generated from Pkl module `dwngen`. DO NOT EDIT.
|
||||
package gen
|
||||
|
||||
type Config struct {
|
||||
IpfsGatewayUrl string `pkl:"ipfsGatewayUrl" json:"ipfsGatewayUrl,omitempty"`
|
||||
|
||||
MotrKeyshare string `pkl:"motrKeyshare" json:"motrKeyshare,omitempty"`
|
||||
|
||||
MotrAddress string `pkl:"motrAddress" json:"motrAddress,omitempty"`
|
||||
|
||||
SonrApiUrl string `pkl:"sonrApiUrl" json:"sonrApiUrl,omitempty"`
|
||||
|
||||
SonrRpcUrl string `pkl:"sonrRpcUrl" json:"sonrRpcUrl,omitempty"`
|
||||
|
||||
SonrChainId string `pkl:"sonrChainId" json:"sonrChainId,omitempty"`
|
||||
|
||||
VaultSchema *Schema `pkl:"vaultSchema" json:"vaultSchema,omitempty"`
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
// Code generated from Pkl module `dwngen`. DO NOT EDIT.
|
||||
package gen
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/apple/pkl-go/pkl"
|
||||
)
|
||||
|
||||
type Dwngen struct {
|
||||
}
|
||||
|
||||
// LoadFromPath loads the pkl module at the given path and evaluates it into a Dwngen
|
||||
func LoadFromPath(ctx context.Context, path string) (ret *Dwngen, 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 Dwngen
|
||||
func Load(ctx context.Context, evaluator pkl.Evaluator, source *pkl.ModuleSource) (*Dwngen, error) {
|
||||
var ret Dwngen
|
||||
if err := evaluator.EvaluateModule(ctx, source, &ret); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &ret, nil
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
// Code generated from Pkl module `dwngen`. DO NOT EDIT.
|
||||
package gen
|
||||
|
||||
type Schema struct {
|
||||
Version int `pkl:"version"`
|
||||
|
||||
Account string `pkl:"account" json:"account,omitempty"`
|
||||
|
||||
Asset string `pkl:"asset" json:"asset,omitempty"`
|
||||
|
||||
Chain string `pkl:"chain" json:"chain,omitempty"`
|
||||
|
||||
Credential string `pkl:"credential" json:"credential,omitempty"`
|
||||
|
||||
Jwk string `pkl:"jwk" json:"jwk,omitempty"`
|
||||
|
||||
Grant string `pkl:"grant" json:"grant,omitempty"`
|
||||
|
||||
Keyshare string `pkl:"keyshare" json:"keyshare,omitempty"`
|
||||
|
||||
Profile string `pkl:"profile" json:"profile,omitempty"`
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
// Code generated from Pkl module `dwngen`. DO NOT EDIT.
|
||||
package gen
|
||||
|
||||
import "github.com/apple/pkl-go/pkl"
|
||||
|
||||
func init() {
|
||||
pkl.RegisterMapping("dwngen", Dwngen{})
|
||||
pkl.RegisterMapping("dwngen#Config", Config{})
|
||||
pkl.RegisterMapping("dwngen#Schema", Schema{})
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
importScripts(
|
||||
"https://cdn.jsdelivr.net/gh/golang/go@go1.22.5/misc/wasm/wasm_exec.js",
|
||||
"https://cdn.jsdelivr.net/gh/nlepage/go-wasm-http-server@v1.1.0/sw.js",
|
||||
);
|
||||
|
||||
registerWasmHTTPListener("/app.wasm");
|
||||
|
||||
// Skip installed stage and jump to activating stage
|
||||
self.addEventListener("install", (event) => {
|
||||
event.waitUntil(skipWaiting());
|
||||
});
|
||||
|
||||
// Start controlling clients as soon as the SW is activated
|
||||
self.addEventListener("activate", (event) => {
|
||||
event.waitUntil(clients.claim());
|
||||
});
|
||||
|
||||
self.addEventListener("canmakepayment", function (e) {
|
||||
e.respondWith(new Promise(function (resolve, reject) {
|
||||
resolve(true);
|
||||
}));
|
||||
});
|
||||
@@ -1,48 +0,0 @@
|
||||
//go:build js && wasm
|
||||
// +build js,wasm
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"os"
|
||||
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/onsonr/sonr/internal/ctx"
|
||||
"github.com/onsonr/sonr/internal/dwn/fetch"
|
||||
dwngen "github.com/onsonr/sonr/internal/dwn/gen"
|
||||
"github.com/onsonr/sonr/pkg/workers/routes"
|
||||
)
|
||||
|
||||
const FileNameConfigJSON = "dwn.json"
|
||||
|
||||
var config *dwngen.Config
|
||||
|
||||
func main() {
|
||||
// Load dwn config
|
||||
if err := loadDwnConfig(); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
// Setup HTTP server
|
||||
e := echo.New()
|
||||
e.Use(ctx.DWNSessionMiddleware(config))
|
||||
routes.RegisterWebNodeAPI(e)
|
||||
routes.RegisterWebNodeViews(e)
|
||||
fetch.Serve(e)
|
||||
}
|
||||
|
||||
func loadDwnConfig() error {
|
||||
// Read dwn.json config
|
||||
dwnBz, err := os.ReadFile(FileNameConfigJSON)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
dwnConfig := new(dwngen.Config)
|
||||
err = json.Unmarshal(dwnBz, dwnConfig)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
config = dwnConfig
|
||||
return nil
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
// Code generated from Pkl module `orm`. DO NOT EDIT.
|
||||
package orm
|
||||
|
||||
type Account struct {
|
||||
Id string `pkl:"id" json:"id,omitempty" query:"id"`
|
||||
|
||||
Name string `pkl:"name" json:"name,omitempty"`
|
||||
|
||||
Address any `pkl:"address" json:"address,omitempty"`
|
||||
|
||||
PublicKey string `pkl:"publicKey" json:"publicKey,omitempty"`
|
||||
|
||||
ChainCode uint `pkl:"chainCode" json:"chainCode,omitempty"`
|
||||
|
||||
Index int `pkl:"index" json:"index,omitempty"`
|
||||
|
||||
Controller string `pkl:"controller" json:"controller,omitempty"`
|
||||
|
||||
CreatedAt *string `pkl:"createdAt" json:"createdAt,omitempty"`
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
// Code generated from Pkl module `orm`. DO NOT EDIT.
|
||||
package orm
|
||||
|
||||
type Asset struct {
|
||||
Id string `pkl:"id" json:"id,omitempty" query:"id"`
|
||||
|
||||
Name string `pkl:"name" json:"name,omitempty"`
|
||||
|
||||
Symbol string `pkl:"symbol" json:"symbol,omitempty"`
|
||||
|
||||
Decimals int `pkl:"decimals" json:"decimals,omitempty"`
|
||||
|
||||
ChainCode uint `pkl:"chainCode" json:"chainCode,omitempty"`
|
||||
|
||||
CreatedAt *string `pkl:"createdAt" json:"createdAt,omitempty"`
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
// Code generated from Pkl module `orm`. DO NOT EDIT.
|
||||
package orm
|
||||
|
||||
type Chain struct {
|
||||
Id string `pkl:"id" json:"id,omitempty" query:"id"`
|
||||
|
||||
Name string `pkl:"name" json:"name,omitempty"`
|
||||
|
||||
NetworkId string `pkl:"networkId" json:"networkId,omitempty"`
|
||||
|
||||
ChainCode uint `pkl:"chainCode" json:"chainCode,omitempty"`
|
||||
|
||||
CreatedAt *string `pkl:"createdAt" json:"createdAt,omitempty"`
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
// Code generated from Pkl module `orm`. DO NOT EDIT.
|
||||
package orm
|
||||
|
||||
type Credential struct {
|
||||
Id string `pkl:"id" json:"id,omitempty" query:"id"`
|
||||
|
||||
Subject string `pkl:"subject" json:"subject,omitempty"`
|
||||
|
||||
Controller string `pkl:"controller" json:"controller,omitempty"`
|
||||
|
||||
AttestationType string `pkl:"attestationType" json:"attestationType,omitempty"`
|
||||
|
||||
Origin string `pkl:"origin" json:"origin,omitempty"`
|
||||
|
||||
Label *string `pkl:"label" json:"label,omitempty"`
|
||||
|
||||
DeviceId *string `pkl:"deviceId" json:"deviceId,omitempty"`
|
||||
|
||||
CredentialId string `pkl:"credentialId" json:"credentialId,omitempty"`
|
||||
|
||||
PublicKey string `pkl:"publicKey" json:"publicKey,omitempty"`
|
||||
|
||||
Transport []string `pkl:"transport" json:"transport,omitempty"`
|
||||
|
||||
SignCount uint `pkl:"signCount" json:"signCount,omitempty"`
|
||||
|
||||
UserPresent bool `pkl:"userPresent" json:"userPresent,omitempty"`
|
||||
|
||||
UserVerified bool `pkl:"userVerified" json:"userVerified,omitempty"`
|
||||
|
||||
BackupEligible bool `pkl:"backupEligible" json:"backupEligible,omitempty"`
|
||||
|
||||
BackupState bool `pkl:"backupState" json:"backupState,omitempty"`
|
||||
|
||||
CloneWarning bool `pkl:"cloneWarning" json:"cloneWarning,omitempty"`
|
||||
|
||||
CreatedAt *string `pkl:"createdAt" json:"createdAt,omitempty"`
|
||||
|
||||
UpdatedAt *string `pkl:"updatedAt" json:"updatedAt,omitempty"`
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
// Code generated from Pkl module `orm`. DO NOT EDIT.
|
||||
package orm
|
||||
|
||||
import (
|
||||
"github.com/onsonr/sonr/internal/orm/keyalgorithm"
|
||||
"github.com/onsonr/sonr/internal/orm/keycurve"
|
||||
"github.com/onsonr/sonr/internal/orm/keyencoding"
|
||||
"github.com/onsonr/sonr/internal/orm/keyrole"
|
||||
"github.com/onsonr/sonr/internal/orm/keytype"
|
||||
)
|
||||
|
||||
type DID struct {
|
||||
Id string `pkl:"id" json:"id,omitempty" query:"id"`
|
||||
|
||||
Role keyrole.KeyRole `pkl:"role"`
|
||||
|
||||
Algorithm keyalgorithm.KeyAlgorithm `pkl:"algorithm"`
|
||||
|
||||
Encoding keyencoding.KeyEncoding `pkl:"encoding"`
|
||||
|
||||
Curve keycurve.KeyCurve `pkl:"curve"`
|
||||
|
||||
KeyType keytype.KeyType `pkl:"key_type"`
|
||||
|
||||
Raw string `pkl:"raw"`
|
||||
|
||||
Jwk *JWK `pkl:"jwk"`
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
// Code generated from Pkl module `orm`. DO NOT EDIT.
|
||||
package orm
|
||||
|
||||
type Grant struct {
|
||||
Id uint `pkl:"id" json:"id,omitempty" query:"id"`
|
||||
|
||||
Subject string `pkl:"subject" json:"subject,omitempty"`
|
||||
|
||||
Controller string `pkl:"controller" json:"controller,omitempty"`
|
||||
|
||||
Origin string `pkl:"origin" json:"origin,omitempty"`
|
||||
|
||||
Token string `pkl:"token" json:"token,omitempty"`
|
||||
|
||||
Scopes []string `pkl:"scopes" json:"scopes,omitempty"`
|
||||
|
||||
CreatedAt *string `pkl:"createdAt" json:"createdAt,omitempty"`
|
||||
|
||||
UpdatedAt *string `pkl:"updatedAt" json:"updatedAt,omitempty"`
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
// Code generated from Pkl module `orm`. DO NOT EDIT.
|
||||
package orm
|
||||
|
||||
type JWK struct {
|
||||
Kty string `pkl:"kty" json:"kty,omitempty"`
|
||||
|
||||
Crv string `pkl:"crv" json:"crv,omitempty"`
|
||||
|
||||
X string `pkl:"x" json:"x,omitempty"`
|
||||
|
||||
Y string `pkl:"y" json:"y,omitempty"`
|
||||
|
||||
N string `pkl:"n" json:"n,omitempty"`
|
||||
|
||||
E string `pkl:"e" json:"e,omitempty"`
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
// Code generated from Pkl module `orm`. DO NOT EDIT.
|
||||
package orm
|
||||
|
||||
type Keyshare struct {
|
||||
Id string `pkl:"id" json:"id,omitempty" query:"id"`
|
||||
|
||||
Data string `pkl:"data" json:"data,omitempty"`
|
||||
|
||||
Role int `pkl:"role" json:"role,omitempty"`
|
||||
|
||||
CreatedAt *string `pkl:"createdAt" json:"createdAt,omitempty"`
|
||||
|
||||
LastRefreshed *string `pkl:"lastRefreshed" json:"lastRefreshed,omitempty"`
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
// Code generated from Pkl module `orm`. DO NOT EDIT.
|
||||
package orm
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/apple/pkl-go/pkl"
|
||||
)
|
||||
|
||||
type Orm struct {
|
||||
DbName string `pkl:"db_name"`
|
||||
|
||||
DbVersion int `pkl:"db_version"`
|
||||
}
|
||||
|
||||
// LoadFromPath loads the pkl module at the given path and evaluates it into a Orm
|
||||
func LoadFromPath(ctx context.Context, path string) (ret *Orm, 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 Orm
|
||||
func Load(ctx context.Context, evaluator pkl.Evaluator, source *pkl.ModuleSource) (*Orm, error) {
|
||||
var ret Orm
|
||||
if err := evaluator.EvaluateModule(ctx, source, &ret); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &ret, nil
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
// Code generated from Pkl module `orm`. DO NOT EDIT.
|
||||
package orm
|
||||
|
||||
type Profile struct {
|
||||
Id string `pkl:"id" json:"id,omitempty" query:"id"`
|
||||
|
||||
Subject string `pkl:"subject" json:"subject,omitempty"`
|
||||
|
||||
Controller string `pkl:"controller" json:"controller,omitempty"`
|
||||
|
||||
OriginUri *string `pkl:"originUri" json:"originUri,omitempty"`
|
||||
|
||||
PublicMetadata *string `pkl:"publicMetadata" json:"publicMetadata,omitempty"`
|
||||
|
||||
PrivateMetadata *string `pkl:"privateMetadata" json:"privateMetadata,omitempty"`
|
||||
|
||||
CreatedAt *string `pkl:"createdAt" json:"createdAt,omitempty"`
|
||||
|
||||
UpdatedAt *string `pkl:"updatedAt" json:"updatedAt,omitempty"`
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
// Code generated from Pkl module `orm`. DO NOT EDIT.
|
||||
package assettype
|
||||
|
||||
import (
|
||||
"encoding"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type AssetType string
|
||||
|
||||
const (
|
||||
Native AssetType = "native"
|
||||
Wrapped AssetType = "wrapped"
|
||||
Staking AssetType = "staking"
|
||||
Pool AssetType = "pool"
|
||||
Ibc AssetType = "ibc"
|
||||
Cw20 AssetType = "cw20"
|
||||
)
|
||||
|
||||
// String returns the string representation of AssetType
|
||||
func (rcv AssetType) String() string {
|
||||
return string(rcv)
|
||||
}
|
||||
|
||||
var _ encoding.BinaryUnmarshaler = new(AssetType)
|
||||
|
||||
// UnmarshalBinary implements encoding.BinaryUnmarshaler for AssetType.
|
||||
func (rcv *AssetType) UnmarshalBinary(data []byte) error {
|
||||
switch str := string(data); str {
|
||||
case "native":
|
||||
*rcv = Native
|
||||
case "wrapped":
|
||||
*rcv = Wrapped
|
||||
case "staking":
|
||||
*rcv = Staking
|
||||
case "pool":
|
||||
*rcv = Pool
|
||||
case "ibc":
|
||||
*rcv = Ibc
|
||||
case "cw20":
|
||||
*rcv = Cw20
|
||||
default:
|
||||
return fmt.Errorf(`illegal: "%s" is not a valid AssetType`, str)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
// Code generated from Pkl module `orm`. DO NOT EDIT.
|
||||
package didmethod
|
||||
|
||||
import (
|
||||
"encoding"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type DIDMethod string
|
||||
|
||||
const (
|
||||
Ipfs DIDMethod = "ipfs"
|
||||
Sonr DIDMethod = "sonr"
|
||||
Bitcoin DIDMethod = "bitcoin"
|
||||
Ethereum DIDMethod = "ethereum"
|
||||
Ibc DIDMethod = "ibc"
|
||||
Webauthn DIDMethod = "webauthn"
|
||||
Dwn DIDMethod = "dwn"
|
||||
Service DIDMethod = "service"
|
||||
)
|
||||
|
||||
// String returns the string representation of DIDMethod
|
||||
func (rcv DIDMethod) String() string {
|
||||
return string(rcv)
|
||||
}
|
||||
|
||||
var _ encoding.BinaryUnmarshaler = new(DIDMethod)
|
||||
|
||||
// UnmarshalBinary implements encoding.BinaryUnmarshaler for DIDMethod.
|
||||
func (rcv *DIDMethod) UnmarshalBinary(data []byte) error {
|
||||
switch str := string(data); str {
|
||||
case "ipfs":
|
||||
*rcv = Ipfs
|
||||
case "sonr":
|
||||
*rcv = Sonr
|
||||
case "bitcoin":
|
||||
*rcv = Bitcoin
|
||||
case "ethereum":
|
||||
*rcv = Ethereum
|
||||
case "ibc":
|
||||
*rcv = Ibc
|
||||
case "webauthn":
|
||||
*rcv = Webauthn
|
||||
case "dwn":
|
||||
*rcv = Dwn
|
||||
case "service":
|
||||
*rcv = Service
|
||||
default:
|
||||
return fmt.Errorf(`illegal: "%s" is not a valid DIDMethod`, str)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
// Code generated from Pkl module `orm`. DO NOT EDIT.
|
||||
package orm
|
||||
|
||||
import "github.com/apple/pkl-go/pkl"
|
||||
|
||||
func init() {
|
||||
pkl.RegisterMapping("orm", Orm{})
|
||||
pkl.RegisterMapping("orm#Account", Account{})
|
||||
pkl.RegisterMapping("orm#Asset", Asset{})
|
||||
pkl.RegisterMapping("orm#Chain", Chain{})
|
||||
pkl.RegisterMapping("orm#Credential", Credential{})
|
||||
pkl.RegisterMapping("orm#DID", DID{})
|
||||
pkl.RegisterMapping("orm#JWK", JWK{})
|
||||
pkl.RegisterMapping("orm#Grant", Grant{})
|
||||
pkl.RegisterMapping("orm#Keyshare", Keyshare{})
|
||||
pkl.RegisterMapping("orm#Profile", Profile{})
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
// Code generated from Pkl module `orm`. DO NOT EDIT.
|
||||
package keyalgorithm
|
||||
|
||||
import (
|
||||
"encoding"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type KeyAlgorithm string
|
||||
|
||||
const (
|
||||
Es256 KeyAlgorithm = "es256"
|
||||
Es384 KeyAlgorithm = "es384"
|
||||
Es512 KeyAlgorithm = "es512"
|
||||
Eddsa KeyAlgorithm = "eddsa"
|
||||
Es256k KeyAlgorithm = "es256k"
|
||||
Ecdsa KeyAlgorithm = "ecdsa"
|
||||
)
|
||||
|
||||
// String returns the string representation of KeyAlgorithm
|
||||
func (rcv KeyAlgorithm) String() string {
|
||||
return string(rcv)
|
||||
}
|
||||
|
||||
var _ encoding.BinaryUnmarshaler = new(KeyAlgorithm)
|
||||
|
||||
// UnmarshalBinary implements encoding.BinaryUnmarshaler for KeyAlgorithm.
|
||||
func (rcv *KeyAlgorithm) UnmarshalBinary(data []byte) error {
|
||||
switch str := string(data); str {
|
||||
case "es256":
|
||||
*rcv = Es256
|
||||
case "es384":
|
||||
*rcv = Es384
|
||||
case "es512":
|
||||
*rcv = Es512
|
||||
case "eddsa":
|
||||
*rcv = Eddsa
|
||||
case "es256k":
|
||||
*rcv = Es256k
|
||||
case "ecdsa":
|
||||
*rcv = Ecdsa
|
||||
default:
|
||||
return fmt.Errorf(`illegal: "%s" is not a valid KeyAlgorithm`, str)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
// Code generated from Pkl module `orm`. DO NOT EDIT.
|
||||
package keycurve
|
||||
|
||||
import (
|
||||
"encoding"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type KeyCurve string
|
||||
|
||||
const (
|
||||
P256 KeyCurve = "p256"
|
||||
P384 KeyCurve = "p384"
|
||||
P521 KeyCurve = "p521"
|
||||
X25519 KeyCurve = "x25519"
|
||||
X448 KeyCurve = "x448"
|
||||
Ed25519 KeyCurve = "ed25519"
|
||||
Ed448 KeyCurve = "ed448"
|
||||
Secp256k1 KeyCurve = "secp256k1"
|
||||
Bls12381 KeyCurve = "bls12381"
|
||||
Keccak256 KeyCurve = "keccak256"
|
||||
)
|
||||
|
||||
// String returns the string representation of KeyCurve
|
||||
func (rcv KeyCurve) String() string {
|
||||
return string(rcv)
|
||||
}
|
||||
|
||||
var _ encoding.BinaryUnmarshaler = new(KeyCurve)
|
||||
|
||||
// UnmarshalBinary implements encoding.BinaryUnmarshaler for KeyCurve.
|
||||
func (rcv *KeyCurve) UnmarshalBinary(data []byte) error {
|
||||
switch str := string(data); str {
|
||||
case "p256":
|
||||
*rcv = P256
|
||||
case "p384":
|
||||
*rcv = P384
|
||||
case "p521":
|
||||
*rcv = P521
|
||||
case "x25519":
|
||||
*rcv = X25519
|
||||
case "x448":
|
||||
*rcv = X448
|
||||
case "ed25519":
|
||||
*rcv = Ed25519
|
||||
case "ed448":
|
||||
*rcv = Ed448
|
||||
case "secp256k1":
|
||||
*rcv = Secp256k1
|
||||
case "bls12381":
|
||||
*rcv = Bls12381
|
||||
case "keccak256":
|
||||
*rcv = Keccak256
|
||||
default:
|
||||
return fmt.Errorf(`illegal: "%s" is not a valid KeyCurve`, str)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
// Code generated from Pkl module `orm`. DO NOT EDIT.
|
||||
package keyencoding
|
||||
|
||||
import (
|
||||
"encoding"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type KeyEncoding string
|
||||
|
||||
const (
|
||||
Raw KeyEncoding = "raw"
|
||||
Hex KeyEncoding = "hex"
|
||||
Multibase KeyEncoding = "multibase"
|
||||
)
|
||||
|
||||
// String returns the string representation of KeyEncoding
|
||||
func (rcv KeyEncoding) String() string {
|
||||
return string(rcv)
|
||||
}
|
||||
|
||||
var _ encoding.BinaryUnmarshaler = new(KeyEncoding)
|
||||
|
||||
// UnmarshalBinary implements encoding.BinaryUnmarshaler for KeyEncoding.
|
||||
func (rcv *KeyEncoding) UnmarshalBinary(data []byte) error {
|
||||
switch str := string(data); str {
|
||||
case "raw":
|
||||
*rcv = Raw
|
||||
case "hex":
|
||||
*rcv = Hex
|
||||
case "multibase":
|
||||
*rcv = Multibase
|
||||
default:
|
||||
return fmt.Errorf(`illegal: "%s" is not a valid KeyEncoding`, str)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
// Code generated from Pkl module `orm`. DO NOT EDIT.
|
||||
package keyrole
|
||||
|
||||
import (
|
||||
"encoding"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type KeyRole string
|
||||
|
||||
const (
|
||||
Authentication KeyRole = "authentication"
|
||||
Assertion KeyRole = "assertion"
|
||||
Delegation KeyRole = "delegation"
|
||||
Invocation KeyRole = "invocation"
|
||||
)
|
||||
|
||||
// String returns the string representation of KeyRole
|
||||
func (rcv KeyRole) String() string {
|
||||
return string(rcv)
|
||||
}
|
||||
|
||||
var _ encoding.BinaryUnmarshaler = new(KeyRole)
|
||||
|
||||
// UnmarshalBinary implements encoding.BinaryUnmarshaler for KeyRole.
|
||||
func (rcv *KeyRole) UnmarshalBinary(data []byte) error {
|
||||
switch str := string(data); str {
|
||||
case "authentication":
|
||||
*rcv = Authentication
|
||||
case "assertion":
|
||||
*rcv = Assertion
|
||||
case "delegation":
|
||||
*rcv = Delegation
|
||||
case "invocation":
|
||||
*rcv = Invocation
|
||||
default:
|
||||
return fmt.Errorf(`illegal: "%s" is not a valid KeyRole`, str)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
// Code generated from Pkl module `orm`. DO NOT EDIT.
|
||||
package keysharerole
|
||||
|
||||
import (
|
||||
"encoding"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type KeyShareRole string
|
||||
|
||||
const (
|
||||
User KeyShareRole = "user"
|
||||
Validator KeyShareRole = "validator"
|
||||
)
|
||||
|
||||
// String returns the string representation of KeyShareRole
|
||||
func (rcv KeyShareRole) String() string {
|
||||
return string(rcv)
|
||||
}
|
||||
|
||||
var _ encoding.BinaryUnmarshaler = new(KeyShareRole)
|
||||
|
||||
// UnmarshalBinary implements encoding.BinaryUnmarshaler for KeyShareRole.
|
||||
func (rcv *KeyShareRole) UnmarshalBinary(data []byte) error {
|
||||
switch str := string(data); str {
|
||||
case "user":
|
||||
*rcv = User
|
||||
case "validator":
|
||||
*rcv = Validator
|
||||
default:
|
||||
return fmt.Errorf(`illegal: "%s" is not a valid KeyShareRole`, str)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
// Code generated from Pkl module `orm`. DO NOT EDIT.
|
||||
package keytype
|
||||
|
||||
import (
|
||||
"encoding"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type KeyType string
|
||||
|
||||
const (
|
||||
Octet KeyType = "octet"
|
||||
Elliptic KeyType = "elliptic"
|
||||
Rsa KeyType = "rsa"
|
||||
Symmetric KeyType = "symmetric"
|
||||
Hmac KeyType = "hmac"
|
||||
Mpc KeyType = "mpc"
|
||||
Zk KeyType = "zk"
|
||||
Webauthn KeyType = "webauthn"
|
||||
Bip32 KeyType = "bip32"
|
||||
)
|
||||
|
||||
// String returns the string representation of KeyType
|
||||
func (rcv KeyType) String() string {
|
||||
return string(rcv)
|
||||
}
|
||||
|
||||
var _ encoding.BinaryUnmarshaler = new(KeyType)
|
||||
|
||||
// UnmarshalBinary implements encoding.BinaryUnmarshaler for KeyType.
|
||||
func (rcv *KeyType) UnmarshalBinary(data []byte) error {
|
||||
switch str := string(data); str {
|
||||
case "octet":
|
||||
*rcv = Octet
|
||||
case "elliptic":
|
||||
*rcv = Elliptic
|
||||
case "rsa":
|
||||
*rcv = Rsa
|
||||
case "symmetric":
|
||||
*rcv = Symmetric
|
||||
case "hmac":
|
||||
*rcv = Hmac
|
||||
case "mpc":
|
||||
*rcv = Mpc
|
||||
case "zk":
|
||||
*rcv = Zk
|
||||
case "webauthn":
|
||||
*rcv = Webauthn
|
||||
case "bip32":
|
||||
*rcv = Bip32
|
||||
default:
|
||||
return fmt.Errorf(`illegal: "%s" is not a valid KeyType`, str)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,99 +0,0 @@
|
||||
package marketing
|
||||
|
||||
type Button struct {
|
||||
Text string
|
||||
Href string
|
||||
}
|
||||
|
||||
type Image struct {
|
||||
Src string
|
||||
Width string
|
||||
Height string
|
||||
}
|
||||
|
||||
// ╭──────────────────────────────────────────────────────────╮
|
||||
// │ Generic Models │
|
||||
// ╰──────────────────────────────────────────────────────────╯
|
||||
|
||||
type Feature struct {
|
||||
Title string
|
||||
Desc string
|
||||
Icon *string
|
||||
Image *Image
|
||||
}
|
||||
|
||||
type Stat struct {
|
||||
Value string
|
||||
Denom string
|
||||
Label string
|
||||
}
|
||||
|
||||
type Technology struct {
|
||||
Title string
|
||||
Desc string
|
||||
Icon *string
|
||||
Image *Image
|
||||
}
|
||||
|
||||
type Testimonial struct {
|
||||
FullName string
|
||||
Username string
|
||||
Avatar *Image
|
||||
Quote string
|
||||
}
|
||||
|
||||
// ╭───────────────────────────────────────────────────────────╮
|
||||
// │ HomePage Models │
|
||||
// ╰───────────────────────────────────────────────────────────╯
|
||||
|
||||
type Hero struct {
|
||||
TitleFirst string
|
||||
TitleEmphasis string
|
||||
TitleSecond string
|
||||
Subtitle string
|
||||
PrimaryButton *Button
|
||||
SecondaryButton *Button
|
||||
Image *Image
|
||||
Stats []*Stat
|
||||
}
|
||||
|
||||
type Highlights struct {
|
||||
Heading string
|
||||
Subtitle string
|
||||
Features []*Feature
|
||||
}
|
||||
|
||||
type Mission struct {
|
||||
Eyebrow string
|
||||
Heading string
|
||||
Subtitle string
|
||||
Experience *Feature
|
||||
Compliance *Feature
|
||||
Interoperability *Feature
|
||||
Standards []*Feature // Display 6 Standards applied by the Sonr Network
|
||||
}
|
||||
|
||||
type Architecture struct {
|
||||
Heading string
|
||||
Subtitle string
|
||||
Primary *Technology
|
||||
Secondary *Technology
|
||||
Tertiary *Technology
|
||||
Quaternary *Technology
|
||||
Quinary *Technology
|
||||
}
|
||||
|
||||
type Lowlights struct {
|
||||
Heading string
|
||||
UpperQuotes []*Testimonial
|
||||
LowerQuotes []*Testimonial
|
||||
}
|
||||
|
||||
type CallToAction struct {
|
||||
Logo *Image
|
||||
Heading string
|
||||
Subtitle string
|
||||
Primary *Button
|
||||
Secondary *Button
|
||||
Partners []*Image
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
// Code generated from Pkl module `orm`. DO NOT EDIT.
|
||||
package permissiongrant
|
||||
|
||||
import (
|
||||
"encoding"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type PermissionGrant string
|
||||
|
||||
const (
|
||||
None PermissionGrant = "none"
|
||||
Read PermissionGrant = "read"
|
||||
Write PermissionGrant = "write"
|
||||
Verify PermissionGrant = "verify"
|
||||
Broadcast PermissionGrant = "broadcast"
|
||||
Admin PermissionGrant = "admin"
|
||||
)
|
||||
|
||||
// String returns the string representation of PermissionGrant
|
||||
func (rcv PermissionGrant) String() string {
|
||||
return string(rcv)
|
||||
}
|
||||
|
||||
var _ encoding.BinaryUnmarshaler = new(PermissionGrant)
|
||||
|
||||
// UnmarshalBinary implements encoding.BinaryUnmarshaler for PermissionGrant.
|
||||
func (rcv *PermissionGrant) UnmarshalBinary(data []byte) error {
|
||||
switch str := string(data); str {
|
||||
case "none":
|
||||
*rcv = None
|
||||
case "read":
|
||||
*rcv = Read
|
||||
case "write":
|
||||
*rcv = Write
|
||||
case "verify":
|
||||
*rcv = Verify
|
||||
case "broadcast":
|
||||
*rcv = Broadcast
|
||||
case "admin":
|
||||
*rcv = Admin
|
||||
default:
|
||||
return fmt.Errorf(`illegal: "%s" is not a valid PermissionGrant`, str)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
// Code generated from Pkl module `orm`. DO NOT EDIT.
|
||||
package permissionscope
|
||||
|
||||
import (
|
||||
"encoding"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type PermissionScope string
|
||||
|
||||
const (
|
||||
Profile PermissionScope = "profile"
|
||||
Metadata PermissionScope = "metadata"
|
||||
Permissions PermissionScope = "permissions"
|
||||
Wallets PermissionScope = "wallets"
|
||||
Transactions PermissionScope = "transactions"
|
||||
User PermissionScope = "user"
|
||||
Validator PermissionScope = "validator"
|
||||
)
|
||||
|
||||
// String returns the string representation of PermissionScope
|
||||
func (rcv PermissionScope) String() string {
|
||||
return string(rcv)
|
||||
}
|
||||
|
||||
var _ encoding.BinaryUnmarshaler = new(PermissionScope)
|
||||
|
||||
// UnmarshalBinary implements encoding.BinaryUnmarshaler for PermissionScope.
|
||||
func (rcv *PermissionScope) UnmarshalBinary(data []byte) error {
|
||||
switch str := string(data); str {
|
||||
case "profile":
|
||||
*rcv = Profile
|
||||
case "metadata":
|
||||
*rcv = Metadata
|
||||
case "permissions":
|
||||
*rcv = Permissions
|
||||
case "wallets":
|
||||
*rcv = Wallets
|
||||
case "transactions":
|
||||
*rcv = Transactions
|
||||
case "user":
|
||||
*rcv = User
|
||||
case "validator":
|
||||
*rcv = Validator
|
||||
default:
|
||||
return fmt.Errorf(`illegal: "%s" is not a valid PermissionScope`, str)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
package orm
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"strings"
|
||||
)
|
||||
|
||||
const SchemaVersion = 1
|
||||
|
||||
func toCamelCase(s string) string {
|
||||
if s == "" {
|
||||
return s
|
||||
}
|
||||
if len(s) == 1 {
|
||||
return strings.ToLower(s)
|
||||
}
|
||||
return strings.ToLower(s[:1]) + s[1:]
|
||||
}
|
||||
|
||||
func GetSchema(structType interface{}) string {
|
||||
t := reflect.TypeOf(structType)
|
||||
if t.Kind() == reflect.Ptr {
|
||||
t = t.Elem()
|
||||
}
|
||||
|
||||
if t.Kind() != reflect.Struct {
|
||||
return ""
|
||||
}
|
||||
|
||||
var fields []string
|
||||
for i := 0; i < t.NumField(); i++ {
|
||||
field := t.Field(i)
|
||||
fieldName := toCamelCase(field.Name)
|
||||
fields = append(fields, fieldName)
|
||||
}
|
||||
|
||||
// Add "++" at the beginning, separated by a comma
|
||||
return "++, " + strings.Join(fields, ", ")
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
// Code generated from Pkl module `transactions`. DO NOT EDIT.
|
||||
package transactions
|
||||
|
||||
type Msg interface {
|
||||
GetTypeUrl() string
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
// Code generated from Pkl module `transactions`. DO NOT EDIT.
|
||||
package transactions
|
||||
|
||||
import "github.com/apple/pkl-go/pkl"
|
||||
|
||||
type MsgDidAllocateVault interface {
|
||||
Msg
|
||||
|
||||
GetAuthority() string
|
||||
|
||||
GetSubject() string
|
||||
|
||||
GetToken() *pkl.Object
|
||||
}
|
||||
|
||||
var _ MsgDidAllocateVault = (*MsgDidAllocateVaultImpl)(nil)
|
||||
|
||||
type MsgDidAllocateVaultImpl struct {
|
||||
// The type URL for the message
|
||||
TypeUrl string `pkl:"typeUrl"`
|
||||
|
||||
Authority string `pkl:"authority"`
|
||||
|
||||
Subject string `pkl:"subject"`
|
||||
|
||||
Token *pkl.Object `pkl:"token"`
|
||||
}
|
||||
|
||||
// The type URL for the message
|
||||
func (rcv *MsgDidAllocateVaultImpl) GetTypeUrl() string {
|
||||
return rcv.TypeUrl
|
||||
}
|
||||
|
||||
func (rcv *MsgDidAllocateVaultImpl) GetAuthority() string {
|
||||
return rcv.Authority
|
||||
}
|
||||
|
||||
func (rcv *MsgDidAllocateVaultImpl) GetSubject() string {
|
||||
return rcv.Subject
|
||||
}
|
||||
|
||||
func (rcv *MsgDidAllocateVaultImpl) GetToken() *pkl.Object {
|
||||
return rcv.Token
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
// Code generated from Pkl module `transactions`. DO NOT EDIT.
|
||||
package transactions
|
||||
|
||||
import "github.com/apple/pkl-go/pkl"
|
||||
|
||||
type MsgDidAuthorize interface {
|
||||
Msg
|
||||
|
||||
GetAuthority() string
|
||||
|
||||
GetController() string
|
||||
|
||||
GetAddress() string
|
||||
|
||||
GetOrigin() string
|
||||
|
||||
GetToken() *pkl.Object
|
||||
}
|
||||
|
||||
var _ MsgDidAuthorize = (*MsgDidAuthorizeImpl)(nil)
|
||||
|
||||
type MsgDidAuthorizeImpl struct {
|
||||
// The type URL for the message
|
||||
TypeUrl string `pkl:"typeUrl"`
|
||||
|
||||
Authority string `pkl:"authority"`
|
||||
|
||||
Controller string `pkl:"controller"`
|
||||
|
||||
Address string `pkl:"address"`
|
||||
|
||||
Origin string `pkl:"origin"`
|
||||
|
||||
Token *pkl.Object `pkl:"token"`
|
||||
}
|
||||
|
||||
// The type URL for the message
|
||||
func (rcv *MsgDidAuthorizeImpl) GetTypeUrl() string {
|
||||
return rcv.TypeUrl
|
||||
}
|
||||
|
||||
func (rcv *MsgDidAuthorizeImpl) GetAuthority() string {
|
||||
return rcv.Authority
|
||||
}
|
||||
|
||||
func (rcv *MsgDidAuthorizeImpl) GetController() string {
|
||||
return rcv.Controller
|
||||
}
|
||||
|
||||
func (rcv *MsgDidAuthorizeImpl) GetAddress() string {
|
||||
return rcv.Address
|
||||
}
|
||||
|
||||
func (rcv *MsgDidAuthorizeImpl) GetOrigin() string {
|
||||
return rcv.Origin
|
||||
}
|
||||
|
||||
func (rcv *MsgDidAuthorizeImpl) GetToken() *pkl.Object {
|
||||
return rcv.Token
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
// Code generated from Pkl module `transactions`. DO NOT EDIT.
|
||||
package transactions
|
||||
|
||||
import "github.com/apple/pkl-go/pkl"
|
||||
|
||||
type MsgDidProveWitness interface {
|
||||
Msg
|
||||
|
||||
GetAuthority() string
|
||||
|
||||
GetProperty() string
|
||||
|
||||
GetWitness() []int
|
||||
|
||||
GetToken() *pkl.Object
|
||||
}
|
||||
|
||||
var _ MsgDidProveWitness = (*MsgDidProveWitnessImpl)(nil)
|
||||
|
||||
type MsgDidProveWitnessImpl struct {
|
||||
// The type URL for the message
|
||||
TypeUrl string `pkl:"typeUrl"`
|
||||
|
||||
Authority string `pkl:"authority"`
|
||||
|
||||
Property string `pkl:"property"`
|
||||
|
||||
Witness []int `pkl:"witness"`
|
||||
|
||||
Token *pkl.Object `pkl:"token"`
|
||||
}
|
||||
|
||||
// The type URL for the message
|
||||
func (rcv *MsgDidProveWitnessImpl) GetTypeUrl() string {
|
||||
return rcv.TypeUrl
|
||||
}
|
||||
|
||||
func (rcv *MsgDidProveWitnessImpl) GetAuthority() string {
|
||||
return rcv.Authority
|
||||
}
|
||||
|
||||
func (rcv *MsgDidProveWitnessImpl) GetProperty() string {
|
||||
return rcv.Property
|
||||
}
|
||||
|
||||
func (rcv *MsgDidProveWitnessImpl) GetWitness() []int {
|
||||
return rcv.Witness
|
||||
}
|
||||
|
||||
func (rcv *MsgDidProveWitnessImpl) GetToken() *pkl.Object {
|
||||
return rcv.Token
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
// Code generated from Pkl module `transactions`. DO NOT EDIT.
|
||||
package transactions
|
||||
|
||||
import "github.com/apple/pkl-go/pkl"
|
||||
|
||||
type MsgDidRegisterController interface {
|
||||
Msg
|
||||
|
||||
GetAuthority() string
|
||||
|
||||
GetCid() string
|
||||
|
||||
GetOrigin() string
|
||||
|
||||
GetAuthentication() []*pkl.Object
|
||||
|
||||
GetToken() *pkl.Object
|
||||
}
|
||||
|
||||
var _ MsgDidRegisterController = (*MsgDidRegisterControllerImpl)(nil)
|
||||
|
||||
type MsgDidRegisterControllerImpl struct {
|
||||
// The type URL for the message
|
||||
TypeUrl string `pkl:"typeUrl"`
|
||||
|
||||
Authority string `pkl:"authority"`
|
||||
|
||||
Cid string `pkl:"cid"`
|
||||
|
||||
Origin string `pkl:"origin"`
|
||||
|
||||
Authentication []*pkl.Object `pkl:"authentication"`
|
||||
|
||||
Token *pkl.Object `pkl:"token"`
|
||||
}
|
||||
|
||||
// The type URL for the message
|
||||
func (rcv *MsgDidRegisterControllerImpl) GetTypeUrl() string {
|
||||
return rcv.TypeUrl
|
||||
}
|
||||
|
||||
func (rcv *MsgDidRegisterControllerImpl) GetAuthority() string {
|
||||
return rcv.Authority
|
||||
}
|
||||
|
||||
func (rcv *MsgDidRegisterControllerImpl) GetCid() string {
|
||||
return rcv.Cid
|
||||
}
|
||||
|
||||
func (rcv *MsgDidRegisterControllerImpl) GetOrigin() string {
|
||||
return rcv.Origin
|
||||
}
|
||||
|
||||
func (rcv *MsgDidRegisterControllerImpl) GetAuthentication() []*pkl.Object {
|
||||
return rcv.Authentication
|
||||
}
|
||||
|
||||
func (rcv *MsgDidRegisterControllerImpl) GetToken() *pkl.Object {
|
||||
return rcv.Token
|
||||
}
|
||||
@@ -1,76 +0,0 @@
|
||||
// Code generated from Pkl module `transactions`. DO NOT EDIT.
|
||||
package transactions
|
||||
|
||||
import "github.com/apple/pkl-go/pkl"
|
||||
|
||||
type MsgDidRegisterService interface {
|
||||
Msg
|
||||
|
||||
GetController() string
|
||||
|
||||
GetOriginUri() string
|
||||
|
||||
GetScopes() *pkl.Object
|
||||
|
||||
GetDescription() string
|
||||
|
||||
GetServiceEndpoints() map[string]string
|
||||
|
||||
GetMetadata() *pkl.Object
|
||||
|
||||
GetToken() *pkl.Object
|
||||
}
|
||||
|
||||
var _ MsgDidRegisterService = (*MsgDidRegisterServiceImpl)(nil)
|
||||
|
||||
type MsgDidRegisterServiceImpl struct {
|
||||
// The type URL for the message
|
||||
TypeUrl string `pkl:"typeUrl"`
|
||||
|
||||
Controller string `pkl:"controller"`
|
||||
|
||||
OriginUri string `pkl:"originUri"`
|
||||
|
||||
Scopes *pkl.Object `pkl:"scopes"`
|
||||
|
||||
Description string `pkl:"description"`
|
||||
|
||||
ServiceEndpoints map[string]string `pkl:"serviceEndpoints"`
|
||||
|
||||
Metadata *pkl.Object `pkl:"metadata"`
|
||||
|
||||
Token *pkl.Object `pkl:"token"`
|
||||
}
|
||||
|
||||
// The type URL for the message
|
||||
func (rcv *MsgDidRegisterServiceImpl) GetTypeUrl() string {
|
||||
return rcv.TypeUrl
|
||||
}
|
||||
|
||||
func (rcv *MsgDidRegisterServiceImpl) GetController() string {
|
||||
return rcv.Controller
|
||||
}
|
||||
|
||||
func (rcv *MsgDidRegisterServiceImpl) GetOriginUri() string {
|
||||
return rcv.OriginUri
|
||||
}
|
||||
|
||||
func (rcv *MsgDidRegisterServiceImpl) GetScopes() *pkl.Object {
|
||||
return rcv.Scopes
|
||||
}
|
||||
|
||||
func (rcv *MsgDidRegisterServiceImpl) GetDescription() string {
|
||||
return rcv.Description
|
||||
}
|
||||
|
||||
func (rcv *MsgDidRegisterServiceImpl) GetServiceEndpoints() map[string]string {
|
||||
return rcv.ServiceEndpoints
|
||||
}
|
||||
|
||||
func (rcv *MsgDidRegisterServiceImpl) GetMetadata() *pkl.Object {
|
||||
return rcv.Metadata
|
||||
}
|
||||
|
||||
func (rcv *MsgDidRegisterServiceImpl) GetToken() *pkl.Object {
|
||||
return rcv.Token
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
// Code generated from Pkl module `transactions`. DO NOT EDIT.
|
||||
package transactions
|
||||
|
||||
import "github.com/apple/pkl-go/pkl"
|
||||
|
||||
type MsgDidSyncVault interface {
|
||||
Msg
|
||||
|
||||
GetController() string
|
||||
|
||||
GetToken() *pkl.Object
|
||||
}
|
||||
|
||||
var _ MsgDidSyncVault = (*MsgDidSyncVaultImpl)(nil)
|
||||
|
||||
type MsgDidSyncVaultImpl struct {
|
||||
// The type URL for the message
|
||||
TypeUrl string `pkl:"typeUrl"`
|
||||
|
||||
Controller string `pkl:"controller"`
|
||||
|
||||
Token *pkl.Object `pkl:"token"`
|
||||
}
|
||||
|
||||
// The type URL for the message
|
||||
func (rcv *MsgDidSyncVaultImpl) GetTypeUrl() string {
|
||||
return rcv.TypeUrl
|
||||
}
|
||||
|
||||
func (rcv *MsgDidSyncVaultImpl) GetController() string {
|
||||
return rcv.Controller
|
||||
}
|
||||
|
||||
func (rcv *MsgDidSyncVaultImpl) GetToken() *pkl.Object {
|
||||
return rcv.Token
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
// Code generated from Pkl module `transactions`. DO NOT EDIT.
|
||||
package transactions
|
||||
|
||||
import "github.com/apple/pkl-go/pkl"
|
||||
|
||||
type MsgDidUpdateParams interface {
|
||||
Msg
|
||||
|
||||
GetAuthority() string
|
||||
|
||||
GetParams() *pkl.Object
|
||||
|
||||
GetToken() *pkl.Object
|
||||
}
|
||||
|
||||
var _ MsgDidUpdateParams = (*MsgDidUpdateParamsImpl)(nil)
|
||||
|
||||
type MsgDidUpdateParamsImpl struct {
|
||||
// The type URL for the message
|
||||
TypeUrl string `pkl:"typeUrl"`
|
||||
|
||||
Authority string `pkl:"authority"`
|
||||
|
||||
Params *pkl.Object `pkl:"params"`
|
||||
|
||||
Token *pkl.Object `pkl:"token"`
|
||||
}
|
||||
|
||||
// The type URL for the message
|
||||
func (rcv *MsgDidUpdateParamsImpl) GetTypeUrl() string {
|
||||
return rcv.TypeUrl
|
||||
}
|
||||
|
||||
func (rcv *MsgDidUpdateParamsImpl) GetAuthority() string {
|
||||
return rcv.Authority
|
||||
}
|
||||
|
||||
func (rcv *MsgDidUpdateParamsImpl) GetParams() *pkl.Object {
|
||||
return rcv.Params
|
||||
}
|
||||
|
||||
func (rcv *MsgDidUpdateParamsImpl) GetToken() *pkl.Object {
|
||||
return rcv.Token
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
// Code generated from Pkl module `transactions`. DO NOT EDIT.
|
||||
package transactions
|
||||
|
||||
import "github.com/apple/pkl-go/pkl"
|
||||
|
||||
type MsgGovDeposit interface {
|
||||
Msg
|
||||
|
||||
GetProposalId() int
|
||||
|
||||
GetDepositor() string
|
||||
|
||||
GetAmount() []*pkl.Object
|
||||
}
|
||||
|
||||
var _ MsgGovDeposit = (*MsgGovDepositImpl)(nil)
|
||||
|
||||
type MsgGovDepositImpl struct {
|
||||
// The type URL for the message
|
||||
TypeUrl string `pkl:"typeUrl"`
|
||||
|
||||
ProposalId int `pkl:"proposalId"`
|
||||
|
||||
Depositor string `pkl:"depositor"`
|
||||
|
||||
Amount []*pkl.Object `pkl:"amount"`
|
||||
}
|
||||
|
||||
// The type URL for the message
|
||||
func (rcv *MsgGovDepositImpl) GetTypeUrl() string {
|
||||
return rcv.TypeUrl
|
||||
}
|
||||
|
||||
func (rcv *MsgGovDepositImpl) GetProposalId() int {
|
||||
return rcv.ProposalId
|
||||
}
|
||||
|
||||
func (rcv *MsgGovDepositImpl) GetDepositor() string {
|
||||
return rcv.Depositor
|
||||
}
|
||||
|
||||
func (rcv *MsgGovDepositImpl) GetAmount() []*pkl.Object {
|
||||
return rcv.Amount
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
// Code generated from Pkl module `transactions`. DO NOT EDIT.
|
||||
package transactions
|
||||
|
||||
import "github.com/apple/pkl-go/pkl"
|
||||
|
||||
type MsgGovSubmitProposal interface {
|
||||
Msg
|
||||
|
||||
GetContent() *Proposal
|
||||
|
||||
GetInitialDeposit() []*pkl.Object
|
||||
|
||||
GetProposer() string
|
||||
}
|
||||
|
||||
var _ MsgGovSubmitProposal = (*MsgGovSubmitProposalImpl)(nil)
|
||||
|
||||
// Gov module messages
|
||||
type MsgGovSubmitProposalImpl struct {
|
||||
// The type URL for the message
|
||||
TypeUrl string `pkl:"typeUrl"`
|
||||
|
||||
Content *Proposal `pkl:"content"`
|
||||
|
||||
InitialDeposit []*pkl.Object `pkl:"initialDeposit"`
|
||||
|
||||
Proposer string `pkl:"proposer"`
|
||||
}
|
||||
|
||||
// The type URL for the message
|
||||
func (rcv *MsgGovSubmitProposalImpl) GetTypeUrl() string {
|
||||
return rcv.TypeUrl
|
||||
}
|
||||
|
||||
func (rcv *MsgGovSubmitProposalImpl) GetContent() *Proposal {
|
||||
return rcv.Content
|
||||
}
|
||||
|
||||
func (rcv *MsgGovSubmitProposalImpl) GetInitialDeposit() []*pkl.Object {
|
||||
return rcv.InitialDeposit
|
||||
}
|
||||
|
||||
func (rcv *MsgGovSubmitProposalImpl) GetProposer() string {
|
||||
return rcv.Proposer
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
// Code generated from Pkl module `transactions`. DO NOT EDIT.
|
||||
package transactions
|
||||
|
||||
type MsgGovVote interface {
|
||||
Msg
|
||||
|
||||
GetProposalId() int
|
||||
|
||||
GetVoter() string
|
||||
|
||||
GetOption() int
|
||||
}
|
||||
|
||||
var _ MsgGovVote = (*MsgGovVoteImpl)(nil)
|
||||
|
||||
type MsgGovVoteImpl struct {
|
||||
// The type URL for the message
|
||||
TypeUrl string `pkl:"typeUrl"`
|
||||
|
||||
ProposalId int `pkl:"proposalId"`
|
||||
|
||||
Voter string `pkl:"voter"`
|
||||
|
||||
Option int `pkl:"option"`
|
||||
}
|
||||
|
||||
// The type URL for the message
|
||||
func (rcv *MsgGovVoteImpl) GetTypeUrl() string {
|
||||
return rcv.TypeUrl
|
||||
}
|
||||
|
||||
func (rcv *MsgGovVoteImpl) GetProposalId() int {
|
||||
return rcv.ProposalId
|
||||
}
|
||||
|
||||
func (rcv *MsgGovVoteImpl) GetVoter() string {
|
||||
return rcv.Voter
|
||||
}
|
||||
|
||||
func (rcv *MsgGovVoteImpl) GetOption() int {
|
||||
return rcv.Option
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
// Code generated from Pkl module `transactions`. DO NOT EDIT.
|
||||
package transactions
|
||||
|
||||
import "github.com/apple/pkl-go/pkl"
|
||||
|
||||
type MsgGroupCreateGroup interface {
|
||||
Msg
|
||||
|
||||
GetAdmin() string
|
||||
|
||||
GetMembers() []*pkl.Object
|
||||
|
||||
GetMetadata() string
|
||||
}
|
||||
|
||||
var _ MsgGroupCreateGroup = (*MsgGroupCreateGroupImpl)(nil)
|
||||
|
||||
// Group module messages
|
||||
type MsgGroupCreateGroupImpl struct {
|
||||
// The type URL for the message
|
||||
TypeUrl string `pkl:"typeUrl"`
|
||||
|
||||
Admin string `pkl:"admin"`
|
||||
|
||||
Members []*pkl.Object `pkl:"members"`
|
||||
|
||||
Metadata string `pkl:"metadata"`
|
||||
}
|
||||
|
||||
// The type URL for the message
|
||||
func (rcv *MsgGroupCreateGroupImpl) GetTypeUrl() string {
|
||||
return rcv.TypeUrl
|
||||
}
|
||||
|
||||
func (rcv *MsgGroupCreateGroupImpl) GetAdmin() string {
|
||||
return rcv.Admin
|
||||
}
|
||||
|
||||
func (rcv *MsgGroupCreateGroupImpl) GetMembers() []*pkl.Object {
|
||||
return rcv.Members
|
||||
}
|
||||
|
||||
func (rcv *MsgGroupCreateGroupImpl) GetMetadata() string {
|
||||
return rcv.Metadata
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
// Code generated from Pkl module `transactions`. DO NOT EDIT.
|
||||
package transactions
|
||||
|
||||
import "github.com/apple/pkl-go/pkl"
|
||||
|
||||
type MsgGroupSubmitProposal interface {
|
||||
Msg
|
||||
|
||||
GetGroupPolicyAddress() string
|
||||
|
||||
GetProposers() []string
|
||||
|
||||
GetMetadata() string
|
||||
|
||||
GetMessages() []*pkl.Object
|
||||
|
||||
GetExec() int
|
||||
}
|
||||
|
||||
var _ MsgGroupSubmitProposal = (*MsgGroupSubmitProposalImpl)(nil)
|
||||
|
||||
type MsgGroupSubmitProposalImpl struct {
|
||||
// The type URL for the message
|
||||
TypeUrl string `pkl:"typeUrl"`
|
||||
|
||||
GroupPolicyAddress string `pkl:"groupPolicyAddress"`
|
||||
|
||||
Proposers []string `pkl:"proposers"`
|
||||
|
||||
Metadata string `pkl:"metadata"`
|
||||
|
||||
Messages []*pkl.Object `pkl:"messages"`
|
||||
|
||||
Exec int `pkl:"exec"`
|
||||
}
|
||||
|
||||
// The type URL for the message
|
||||
func (rcv *MsgGroupSubmitProposalImpl) GetTypeUrl() string {
|
||||
return rcv.TypeUrl
|
||||
}
|
||||
|
||||
func (rcv *MsgGroupSubmitProposalImpl) GetGroupPolicyAddress() string {
|
||||
return rcv.GroupPolicyAddress
|
||||
}
|
||||
|
||||
func (rcv *MsgGroupSubmitProposalImpl) GetProposers() []string {
|
||||
return rcv.Proposers
|
||||
}
|
||||
|
||||
func (rcv *MsgGroupSubmitProposalImpl) GetMetadata() string {
|
||||
return rcv.Metadata
|
||||
}
|
||||
|
||||
func (rcv *MsgGroupSubmitProposalImpl) GetMessages() []*pkl.Object {
|
||||
return rcv.Messages
|
||||
}
|
||||
|
||||
func (rcv *MsgGroupSubmitProposalImpl) GetExec() int {
|
||||
return rcv.Exec
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
// Code generated from Pkl module `transactions`. DO NOT EDIT.
|
||||
package transactions
|
||||
|
||||
type MsgGroupVote interface {
|
||||
Msg
|
||||
|
||||
GetProposalId() int
|
||||
|
||||
GetVoter() string
|
||||
|
||||
GetOption() int
|
||||
|
||||
GetMetadata() string
|
||||
|
||||
GetExec() int
|
||||
}
|
||||
|
||||
var _ MsgGroupVote = (*MsgGroupVoteImpl)(nil)
|
||||
|
||||
type MsgGroupVoteImpl struct {
|
||||
// The type URL for the message
|
||||
TypeUrl string `pkl:"typeUrl"`
|
||||
|
||||
ProposalId int `pkl:"proposalId"`
|
||||
|
||||
Voter string `pkl:"voter"`
|
||||
|
||||
Option int `pkl:"option"`
|
||||
|
||||
Metadata string `pkl:"metadata"`
|
||||
|
||||
Exec int `pkl:"exec"`
|
||||
}
|
||||
|
||||
// The type URL for the message
|
||||
func (rcv *MsgGroupVoteImpl) GetTypeUrl() string {
|
||||
return rcv.TypeUrl
|
||||
}
|
||||
|
||||
func (rcv *MsgGroupVoteImpl) GetProposalId() int {
|
||||
return rcv.ProposalId
|
||||
}
|
||||
|
||||
func (rcv *MsgGroupVoteImpl) GetVoter() string {
|
||||
return rcv.Voter
|
||||
}
|
||||
|
||||
func (rcv *MsgGroupVoteImpl) GetOption() int {
|
||||
return rcv.Option
|
||||
}
|
||||
|
||||
func (rcv *MsgGroupVoteImpl) GetMetadata() string {
|
||||
return rcv.Metadata
|
||||
}
|
||||
|
||||
func (rcv *MsgGroupVoteImpl) GetExec() int {
|
||||
return rcv.Exec
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
// Code generated from Pkl module `transactions`. DO NOT EDIT.
|
||||
package transactions
|
||||
|
||||
import "github.com/apple/pkl-go/pkl"
|
||||
|
||||
type MsgStakingBeginRedelegate interface {
|
||||
Msg
|
||||
|
||||
GetDelegatorAddress() string
|
||||
|
||||
GetValidatorSrcAddress() string
|
||||
|
||||
GetValidatorDstAddress() string
|
||||
|
||||
GetAmount() *pkl.Object
|
||||
}
|
||||
|
||||
var _ MsgStakingBeginRedelegate = (*MsgStakingBeginRedelegateImpl)(nil)
|
||||
|
||||
type MsgStakingBeginRedelegateImpl struct {
|
||||
// The type URL for the message
|
||||
TypeUrl string `pkl:"typeUrl"`
|
||||
|
||||
DelegatorAddress string `pkl:"delegatorAddress"`
|
||||
|
||||
ValidatorSrcAddress string `pkl:"validatorSrcAddress"`
|
||||
|
||||
ValidatorDstAddress string `pkl:"validatorDstAddress"`
|
||||
|
||||
Amount *pkl.Object `pkl:"amount"`
|
||||
}
|
||||
|
||||
// The type URL for the message
|
||||
func (rcv *MsgStakingBeginRedelegateImpl) GetTypeUrl() string {
|
||||
return rcv.TypeUrl
|
||||
}
|
||||
|
||||
func (rcv *MsgStakingBeginRedelegateImpl) GetDelegatorAddress() string {
|
||||
return rcv.DelegatorAddress
|
||||
}
|
||||
|
||||
func (rcv *MsgStakingBeginRedelegateImpl) GetValidatorSrcAddress() string {
|
||||
return rcv.ValidatorSrcAddress
|
||||
}
|
||||
|
||||
func (rcv *MsgStakingBeginRedelegateImpl) GetValidatorDstAddress() string {
|
||||
return rcv.ValidatorDstAddress
|
||||
}
|
||||
|
||||
func (rcv *MsgStakingBeginRedelegateImpl) GetAmount() *pkl.Object {
|
||||
return rcv.Amount
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
// Code generated from Pkl module `transactions`. DO NOT EDIT.
|
||||
package transactions
|
||||
|
||||
import "github.com/apple/pkl-go/pkl"
|
||||
|
||||
type MsgStakingCreateValidator interface {
|
||||
Msg
|
||||
|
||||
GetDescription() *pkl.Object
|
||||
|
||||
GetCommission() *pkl.Object
|
||||
|
||||
GetMinSelfDelegation() string
|
||||
|
||||
GetDelegatorAddress() string
|
||||
|
||||
GetValidatorAddress() string
|
||||
|
||||
GetPubkey() *pkl.Object
|
||||
|
||||
GetValue() *pkl.Object
|
||||
}
|
||||
|
||||
var _ MsgStakingCreateValidator = (*MsgStakingCreateValidatorImpl)(nil)
|
||||
|
||||
// Staking module messages
|
||||
type MsgStakingCreateValidatorImpl struct {
|
||||
// The type URL for the message
|
||||
TypeUrl string `pkl:"typeUrl"`
|
||||
|
||||
Description *pkl.Object `pkl:"description"`
|
||||
|
||||
Commission *pkl.Object `pkl:"commission"`
|
||||
|
||||
MinSelfDelegation string `pkl:"minSelfDelegation"`
|
||||
|
||||
DelegatorAddress string `pkl:"delegatorAddress"`
|
||||
|
||||
ValidatorAddress string `pkl:"validatorAddress"`
|
||||
|
||||
Pubkey *pkl.Object `pkl:"pubkey"`
|
||||
|
||||
Value *pkl.Object `pkl:"value"`
|
||||
}
|
||||
|
||||
// The type URL for the message
|
||||
func (rcv *MsgStakingCreateValidatorImpl) GetTypeUrl() string {
|
||||
return rcv.TypeUrl
|
||||
}
|
||||
|
||||
func (rcv *MsgStakingCreateValidatorImpl) GetDescription() *pkl.Object {
|
||||
return rcv.Description
|
||||
}
|
||||
|
||||
func (rcv *MsgStakingCreateValidatorImpl) GetCommission() *pkl.Object {
|
||||
return rcv.Commission
|
||||
}
|
||||
|
||||
func (rcv *MsgStakingCreateValidatorImpl) GetMinSelfDelegation() string {
|
||||
return rcv.MinSelfDelegation
|
||||
}
|
||||
|
||||
func (rcv *MsgStakingCreateValidatorImpl) GetDelegatorAddress() string {
|
||||
return rcv.DelegatorAddress
|
||||
}
|
||||
|
||||
func (rcv *MsgStakingCreateValidatorImpl) GetValidatorAddress() string {
|
||||
return rcv.ValidatorAddress
|
||||
}
|
||||
|
||||
func (rcv *MsgStakingCreateValidatorImpl) GetPubkey() *pkl.Object {
|
||||
return rcv.Pubkey
|
||||
}
|
||||
|
||||
func (rcv *MsgStakingCreateValidatorImpl) GetValue() *pkl.Object {
|
||||
return rcv.Value
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
// Code generated from Pkl module `transactions`. DO NOT EDIT.
|
||||
package transactions
|
||||
|
||||
import "github.com/apple/pkl-go/pkl"
|
||||
|
||||
type MsgStakingDelegate interface {
|
||||
Msg
|
||||
|
||||
GetDelegatorAddress() string
|
||||
|
||||
GetValidatorAddress() string
|
||||
|
||||
GetAmount() *pkl.Object
|
||||
}
|
||||
|
||||
var _ MsgStakingDelegate = (*MsgStakingDelegateImpl)(nil)
|
||||
|
||||
type MsgStakingDelegateImpl struct {
|
||||
// The type URL for the message
|
||||
TypeUrl string `pkl:"typeUrl"`
|
||||
|
||||
DelegatorAddress string `pkl:"delegatorAddress"`
|
||||
|
||||
ValidatorAddress string `pkl:"validatorAddress"`
|
||||
|
||||
Amount *pkl.Object `pkl:"amount"`
|
||||
}
|
||||
|
||||
// The type URL for the message
|
||||
func (rcv *MsgStakingDelegateImpl) GetTypeUrl() string {
|
||||
return rcv.TypeUrl
|
||||
}
|
||||
|
||||
func (rcv *MsgStakingDelegateImpl) GetDelegatorAddress() string {
|
||||
return rcv.DelegatorAddress
|
||||
}
|
||||
|
||||
func (rcv *MsgStakingDelegateImpl) GetValidatorAddress() string {
|
||||
return rcv.ValidatorAddress
|
||||
}
|
||||
|
||||
func (rcv *MsgStakingDelegateImpl) GetAmount() *pkl.Object {
|
||||
return rcv.Amount
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
// Code generated from Pkl module `transactions`. DO NOT EDIT.
|
||||
package transactions
|
||||
|
||||
import "github.com/apple/pkl-go/pkl"
|
||||
|
||||
type MsgStakingUndelegate interface {
|
||||
Msg
|
||||
|
||||
GetDelegatorAddress() string
|
||||
|
||||
GetValidatorAddress() string
|
||||
|
||||
GetAmount() *pkl.Object
|
||||
}
|
||||
|
||||
var _ MsgStakingUndelegate = (*MsgStakingUndelegateImpl)(nil)
|
||||
|
||||
type MsgStakingUndelegateImpl struct {
|
||||
// The type URL for the message
|
||||
TypeUrl string `pkl:"typeUrl"`
|
||||
|
||||
DelegatorAddress string `pkl:"delegatorAddress"`
|
||||
|
||||
ValidatorAddress string `pkl:"validatorAddress"`
|
||||
|
||||
Amount *pkl.Object `pkl:"amount"`
|
||||
}
|
||||
|
||||
// The type URL for the message
|
||||
func (rcv *MsgStakingUndelegateImpl) GetTypeUrl() string {
|
||||
return rcv.TypeUrl
|
||||
}
|
||||
|
||||
func (rcv *MsgStakingUndelegateImpl) GetDelegatorAddress() string {
|
||||
return rcv.DelegatorAddress
|
||||
}
|
||||
|
||||
func (rcv *MsgStakingUndelegateImpl) GetValidatorAddress() string {
|
||||
return rcv.ValidatorAddress
|
||||
}
|
||||
|
||||
func (rcv *MsgStakingUndelegateImpl) GetAmount() *pkl.Object {
|
||||
return rcv.Amount
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
// Code generated from Pkl module `transactions`. DO NOT EDIT.
|
||||
package transactions
|
||||
|
||||
// Base class for all proposals
|
||||
type Proposal struct {
|
||||
// The title of the proposal
|
||||
Title string `pkl:"title"`
|
||||
|
||||
// The description of the proposal
|
||||
Description string `pkl:"description"`
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
// Code generated from Pkl module `transactions`. DO NOT EDIT.
|
||||
package transactions
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/apple/pkl-go/pkl"
|
||||
)
|
||||
|
||||
type Transactions struct {
|
||||
}
|
||||
|
||||
// LoadFromPath loads the pkl module at the given path and evaluates it into a Transactions
|
||||
func LoadFromPath(ctx context.Context, path string) (ret *Transactions, 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 Transactions
|
||||
func Load(ctx context.Context, evaluator pkl.Evaluator, source *pkl.ModuleSource) (*Transactions, error) {
|
||||
var ret Transactions
|
||||
if err := evaluator.EvaluateModule(ctx, source, &ret); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &ret, nil
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
// Code generated from Pkl module `transactions`. DO NOT EDIT.
|
||||
package transactions
|
||||
|
||||
import "github.com/apple/pkl-go/pkl"
|
||||
|
||||
// Represents a transaction body
|
||||
type TxBody struct {
|
||||
Messages []Msg `pkl:"messages"`
|
||||
|
||||
Memo *string `pkl:"memo"`
|
||||
|
||||
TimeoutHeight *int `pkl:"timeoutHeight"`
|
||||
|
||||
ExtensionOptions *[]*pkl.Object `pkl:"extensionOptions"`
|
||||
|
||||
NonCriticalExtensionOptions *[]*pkl.Object `pkl:"nonCriticalExtensionOptions"`
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
// Code generated from Pkl module `transactions`. DO NOT EDIT.
|
||||
package transactions
|
||||
|
||||
import "github.com/apple/pkl-go/pkl"
|
||||
|
||||
func init() {
|
||||
pkl.RegisterMapping("transactions", Transactions{})
|
||||
pkl.RegisterMapping("transactions#Proposal", Proposal{})
|
||||
pkl.RegisterMapping("transactions#MsgGovSubmitProposal", MsgGovSubmitProposalImpl{})
|
||||
pkl.RegisterMapping("transactions#MsgGovVote", MsgGovVoteImpl{})
|
||||
pkl.RegisterMapping("transactions#MsgGovDeposit", MsgGovDepositImpl{})
|
||||
pkl.RegisterMapping("transactions#MsgGroupCreateGroup", MsgGroupCreateGroupImpl{})
|
||||
pkl.RegisterMapping("transactions#MsgGroupSubmitProposal", MsgGroupSubmitProposalImpl{})
|
||||
pkl.RegisterMapping("transactions#MsgGroupVote", MsgGroupVoteImpl{})
|
||||
pkl.RegisterMapping("transactions#MsgStakingCreateValidator", MsgStakingCreateValidatorImpl{})
|
||||
pkl.RegisterMapping("transactions#MsgStakingDelegate", MsgStakingDelegateImpl{})
|
||||
pkl.RegisterMapping("transactions#MsgStakingUndelegate", MsgStakingUndelegateImpl{})
|
||||
pkl.RegisterMapping("transactions#MsgStakingBeginRedelegate", MsgStakingBeginRedelegateImpl{})
|
||||
pkl.RegisterMapping("transactions#MsgDidUpdateParams", MsgDidUpdateParamsImpl{})
|
||||
pkl.RegisterMapping("transactions#MsgDidAllocateVault", MsgDidAllocateVaultImpl{})
|
||||
pkl.RegisterMapping("transactions#MsgDidProveWitness", MsgDidProveWitnessImpl{})
|
||||
pkl.RegisterMapping("transactions#MsgDidSyncVault", MsgDidSyncVaultImpl{})
|
||||
pkl.RegisterMapping("transactions#MsgDidRegisterController", MsgDidRegisterControllerImpl{})
|
||||
pkl.RegisterMapping("transactions#MsgDidAuthorize", MsgDidAuthorizeImpl{})
|
||||
pkl.RegisterMapping("transactions#MsgDidRegisterService", MsgDidRegisterServiceImpl{})
|
||||
pkl.RegisterMapping("transactions#TxBody", TxBody{})
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
package orm
|
||||
|
||||
import (
|
||||
"github.com/go-webauthn/webauthn/protocol"
|
||||
"github.com/go-webauthn/webauthn/protocol/webauthncose"
|
||||
)
|
||||
|
||||
func NewCredentialCreationOptions(subject, address string, challenge protocol.URLEncodedBase64) *protocol.PublicKeyCredentialCreationOptions {
|
||||
return &protocol.PublicKeyCredentialCreationOptions{
|
||||
Challenge: challenge,
|
||||
User: protocol.UserEntity{
|
||||
DisplayName: subject,
|
||||
ID: address,
|
||||
},
|
||||
Attestation: defaultAttestation(),
|
||||
AuthenticatorSelection: defaultAuthenticatorSelection(),
|
||||
Parameters: defaultCredentialParameters(),
|
||||
}
|
||||
}
|
||||
|
||||
func buildUserEntity(userID string) protocol.UserEntity {
|
||||
return protocol.UserEntity{
|
||||
ID: userID,
|
||||
}
|
||||
}
|
||||
|
||||
func defaultAttestation() protocol.ConveyancePreference {
|
||||
return protocol.PreferDirectAttestation
|
||||
}
|
||||
|
||||
func defaultAuthenticatorSelection() protocol.AuthenticatorSelection {
|
||||
return protocol.AuthenticatorSelection{
|
||||
AuthenticatorAttachment: "platform",
|
||||
ResidentKey: protocol.ResidentKeyRequirementPreferred,
|
||||
UserVerification: "preferred",
|
||||
}
|
||||
}
|
||||
|
||||
func defaultCredentialParameters() []protocol.CredentialParameter {
|
||||
return []protocol.CredentialParameter{
|
||||
{
|
||||
Type: "public-key",
|
||||
Algorithm: webauthncose.AlgES256,
|
||||
},
|
||||
{
|
||||
Type: "public-key",
|
||||
Algorithm: webauthncose.AlgES256K,
|
||||
},
|
||||
{
|
||||
Type: "public-key",
|
||||
Algorithm: webauthncose.AlgEdDSA,
|
||||
},
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user