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:
Prad Nukala
2024-11-18 19:04:10 -05:00
committed by GitHub
parent 01cb37e82e
commit bf94277b0f
190 changed files with 9345 additions and 14038 deletions
+1
View File
@@ -0,0 +1 @@
# Common
+68
View File
@@ -0,0 +1,68 @@
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
}
+90
View File
@@ -0,0 +1,90 @@
package ctx
import (
"encoding/json"
"net/http"
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/pkg/motr/config"
)
// ╭───────────────────────────────────────────────────────────╮
// │ 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() *config.Schema {
v, err := ReadCookie(s.Context, CookieKeyVaultSchema)
if err != nil {
return nil
}
var schema config.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 *config.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)
}
}
}
+45
View File
@@ -0,0 +1,45 @@
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)
}
}
+38
View File
@@ -0,0 +1,38 @@
package ctx
import (
"encoding/json"
"github.com/labstack/echo/v4"
dwngen "github.com/onsonr/sonr/pkg/motr/config"
)
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))
}
+35
View File
@@ -0,0 +1,35 @@
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"`
}
+38
View File
@@ -0,0 +1,38 @@
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"`
}
+73
View File
@@ -0,0 +1,73 @@
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())
}
+64
View File
@@ -0,0 +1,64 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.1
// protoc (unknown)
// source: common/v1/ipfs.proto
package commonv1
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
var File_common_v1_ipfs_proto protoreflect.FileDescriptor
var file_common_v1_ipfs_proto_rawDesc = []byte{
0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x69, 0x70, 0x66, 0x73,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76,
0x31, 0x42, 0x32, 0x5a, 0x30, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f,
0x6f, 0x6e, 0x73, 0x6f, 0x6e, 0x72, 0x2f, 0x73, 0x6f, 0x6e, 0x72, 0x2f, 0x70, 0x6b, 0x67, 0x2f,
0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x3b, 0x63, 0x6f, 0x6d,
0x6d, 0x6f, 0x6e, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var file_common_v1_ipfs_proto_goTypes = []interface{}{}
var file_common_v1_ipfs_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
0, // [0:0] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_common_v1_ipfs_proto_init() }
func file_common_v1_ipfs_proto_init() {
if File_common_v1_ipfs_proto != nil {
return
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_common_v1_ipfs_proto_rawDesc,
NumEnums: 0,
NumMessages: 0,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_common_v1_ipfs_proto_goTypes,
DependencyIndexes: file_common_v1_ipfs_proto_depIdxs,
}.Build()
File_common_v1_ipfs_proto = out.File
file_common_v1_ipfs_proto_rawDesc = nil
file_common_v1_ipfs_proto_goTypes = nil
file_common_v1_ipfs_proto_depIdxs = nil
}
+377
View File
@@ -0,0 +1,377 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.1
// protoc (unknown)
// source: common/v1/keys.proto
package commonv1
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// PubKey defines a public key for a did
type PubKey struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Role string `protobuf:"bytes,1,opt,name=role,proto3" json:"role,omitempty"`
KeyType string `protobuf:"bytes,2,opt,name=key_type,json=keyType,proto3" json:"key_type,omitempty"`
RawKey *RawKey `protobuf:"bytes,3,opt,name=raw_key,json=rawKey,proto3" json:"raw_key,omitempty"`
Jwk *JSONWebKey `protobuf:"bytes,4,opt,name=jwk,proto3" json:"jwk,omitempty"`
}
func (x *PubKey) Reset() {
*x = PubKey{}
if protoimpl.UnsafeEnabled {
mi := &file_common_v1_keys_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *PubKey) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*PubKey) ProtoMessage() {}
func (x *PubKey) ProtoReflect() protoreflect.Message {
mi := &file_common_v1_keys_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use PubKey.ProtoReflect.Descriptor instead.
func (*PubKey) Descriptor() ([]byte, []int) {
return file_common_v1_keys_proto_rawDescGZIP(), []int{0}
}
func (x *PubKey) GetRole() string {
if x != nil {
return x.Role
}
return ""
}
func (x *PubKey) GetKeyType() string {
if x != nil {
return x.KeyType
}
return ""
}
func (x *PubKey) GetRawKey() *RawKey {
if x != nil {
return x.RawKey
}
return nil
}
func (x *PubKey) GetJwk() *JSONWebKey {
if x != nil {
return x.Jwk
}
return nil
}
// JWK represents a JSON Web Key
type JSONWebKey struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Kty string `protobuf:"bytes,1,opt,name=kty,proto3" json:"kty,omitempty"` // Key Type
Crv string `protobuf:"bytes,2,opt,name=crv,proto3" json:"crv,omitempty"` // Curve (for EC and OKP keys)
X string `protobuf:"bytes,3,opt,name=x,proto3" json:"x,omitempty"` // X coordinate (for EC and OKP keys)
Y string `protobuf:"bytes,4,opt,name=y,proto3" json:"y,omitempty"` // Y coordinate (for EC keys)
N string `protobuf:"bytes,5,opt,name=n,proto3" json:"n,omitempty"` // Modulus (for RSA keys)
E string `protobuf:"bytes,6,opt,name=e,proto3" json:"e,omitempty"` // Exponent (for RSA keys)
}
func (x *JSONWebKey) Reset() {
*x = JSONWebKey{}
if protoimpl.UnsafeEnabled {
mi := &file_common_v1_keys_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *JSONWebKey) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*JSONWebKey) ProtoMessage() {}
func (x *JSONWebKey) ProtoReflect() protoreflect.Message {
mi := &file_common_v1_keys_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use JSONWebKey.ProtoReflect.Descriptor instead.
func (*JSONWebKey) Descriptor() ([]byte, []int) {
return file_common_v1_keys_proto_rawDescGZIP(), []int{1}
}
func (x *JSONWebKey) GetKty() string {
if x != nil {
return x.Kty
}
return ""
}
func (x *JSONWebKey) GetCrv() string {
if x != nil {
return x.Crv
}
return ""
}
func (x *JSONWebKey) GetX() string {
if x != nil {
return x.X
}
return ""
}
func (x *JSONWebKey) GetY() string {
if x != nil {
return x.Y
}
return ""
}
func (x *JSONWebKey) GetN() string {
if x != nil {
return x.N
}
return ""
}
func (x *JSONWebKey) GetE() string {
if x != nil {
return x.E
}
return ""
}
type RawKey struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Algorithm string `protobuf:"bytes,1,opt,name=algorithm,proto3" json:"algorithm,omitempty"`
Encoding string `protobuf:"bytes,2,opt,name=encoding,proto3" json:"encoding,omitempty"`
Curve string `protobuf:"bytes,3,opt,name=curve,proto3" json:"curve,omitempty"`
Key []byte `protobuf:"bytes,4,opt,name=key,proto3" json:"key,omitempty"`
}
func (x *RawKey) Reset() {
*x = RawKey{}
if protoimpl.UnsafeEnabled {
mi := &file_common_v1_keys_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *RawKey) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*RawKey) ProtoMessage() {}
func (x *RawKey) ProtoReflect() protoreflect.Message {
mi := &file_common_v1_keys_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use RawKey.ProtoReflect.Descriptor instead.
func (*RawKey) Descriptor() ([]byte, []int) {
return file_common_v1_keys_proto_rawDescGZIP(), []int{2}
}
func (x *RawKey) GetAlgorithm() string {
if x != nil {
return x.Algorithm
}
return ""
}
func (x *RawKey) GetEncoding() string {
if x != nil {
return x.Encoding
}
return ""
}
func (x *RawKey) GetCurve() string {
if x != nil {
return x.Curve
}
return ""
}
func (x *RawKey) GetKey() []byte {
if x != nil {
return x.Key
}
return nil
}
var File_common_v1_keys_proto protoreflect.FileDescriptor
var file_common_v1_keys_proto_rawDesc = []byte{
0x0a, 0x14, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x6b, 0x65, 0x79, 0x73,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76,
0x31, 0x22, 0x8c, 0x01, 0x0a, 0x06, 0x50, 0x75, 0x62, 0x4b, 0x65, 0x79, 0x12, 0x12, 0x0a, 0x04,
0x72, 0x6f, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65,
0x12, 0x19, 0x0a, 0x08, 0x6b, 0x65, 0x79, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01,
0x28, 0x09, 0x52, 0x07, 0x6b, 0x65, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x2a, 0x0a, 0x07, 0x72,
0x61, 0x77, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63,
0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x52, 0x61, 0x77, 0x4b, 0x65, 0x79, 0x52,
0x06, 0x72, 0x61, 0x77, 0x4b, 0x65, 0x79, 0x12, 0x27, 0x0a, 0x03, 0x6a, 0x77, 0x6b, 0x18, 0x04,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31,
0x2e, 0x4a, 0x53, 0x4f, 0x4e, 0x57, 0x65, 0x62, 0x4b, 0x65, 0x79, 0x52, 0x03, 0x6a, 0x77, 0x6b,
0x22, 0x68, 0x0a, 0x0a, 0x4a, 0x53, 0x4f, 0x4e, 0x57, 0x65, 0x62, 0x4b, 0x65, 0x79, 0x12, 0x10,
0x0a, 0x03, 0x6b, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x74, 0x79,
0x12, 0x10, 0x0a, 0x03, 0x63, 0x72, 0x76, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x63,
0x72, 0x76, 0x12, 0x0c, 0x0a, 0x01, 0x78, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x01, 0x78,
0x12, 0x0c, 0x0a, 0x01, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x01, 0x79, 0x12, 0x0c,
0x0a, 0x01, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x01, 0x6e, 0x12, 0x0c, 0x0a, 0x01,
0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x01, 0x65, 0x22, 0x6a, 0x0a, 0x06, 0x52, 0x61,
0x77, 0x4b, 0x65, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68,
0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x6c, 0x67, 0x6f, 0x72, 0x69, 0x74,
0x68, 0x6d, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x18, 0x02,
0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x69, 0x6e, 0x67, 0x12, 0x14,
0x0a, 0x05, 0x63, 0x75, 0x72, 0x76, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x63,
0x75, 0x72, 0x76, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28,
0x0c, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x42, 0x32, 0x5a, 0x30, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62,
0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x6e, 0x73, 0x6f, 0x6e, 0x72, 0x2f, 0x73, 0x6f, 0x6e, 0x72,
0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x74, 0x79, 0x70, 0x65,
0x73, 0x3b, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x33,
}
var (
file_common_v1_keys_proto_rawDescOnce sync.Once
file_common_v1_keys_proto_rawDescData = file_common_v1_keys_proto_rawDesc
)
func file_common_v1_keys_proto_rawDescGZIP() []byte {
file_common_v1_keys_proto_rawDescOnce.Do(func() {
file_common_v1_keys_proto_rawDescData = protoimpl.X.CompressGZIP(file_common_v1_keys_proto_rawDescData)
})
return file_common_v1_keys_proto_rawDescData
}
var file_common_v1_keys_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
var file_common_v1_keys_proto_goTypes = []interface{}{
(*PubKey)(nil), // 0: common.v1.PubKey
(*JSONWebKey)(nil), // 1: common.v1.JSONWebKey
(*RawKey)(nil), // 2: common.v1.RawKey
}
var file_common_v1_keys_proto_depIdxs = []int32{
2, // 0: common.v1.PubKey.raw_key:type_name -> common.v1.RawKey
1, // 1: common.v1.PubKey.jwk:type_name -> common.v1.JSONWebKey
2, // [2:2] is the sub-list for method output_type
2, // [2:2] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension type_name
2, // [2:2] is the sub-list for extension extendee
0, // [0:2] is the sub-list for field type_name
}
func init() { file_common_v1_keys_proto_init() }
func file_common_v1_keys_proto_init() {
if File_common_v1_keys_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_common_v1_keys_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*PubKey); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_common_v1_keys_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*JSONWebKey); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_common_v1_keys_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RawKey); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_common_v1_keys_proto_rawDesc,
NumEnums: 0,
NumMessages: 3,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_common_v1_keys_proto_goTypes,
DependencyIndexes: file_common_v1_keys_proto_depIdxs,
MessageInfos: file_common_v1_keys_proto_msgTypes,
}.Build()
File_common_v1_keys_proto = out.File
file_common_v1_keys_proto_rawDesc = nil
file_common_v1_keys_proto_goTypes = nil
file_common_v1_keys_proto_depIdxs = nil
}
+215
View File
@@ -0,0 +1,215 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.1
// protoc (unknown)
// source: common/v1/uri.proto
package commonv1
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type URI_URIProtocol int32
const (
URI_HTTPS URI_URIProtocol = 0
URI_IPFS URI_URIProtocol = 1
URI_IPNS URI_URIProtocol = 2
URI_DID URI_URIProtocol = 3
)
// Enum value maps for URI_URIProtocol.
var (
URI_URIProtocol_name = map[int32]string{
0: "HTTPS",
1: "IPFS",
2: "IPNS",
3: "DID",
}
URI_URIProtocol_value = map[string]int32{
"HTTPS": 0,
"IPFS": 1,
"IPNS": 2,
"DID": 3,
}
)
func (x URI_URIProtocol) Enum() *URI_URIProtocol {
p := new(URI_URIProtocol)
*p = x
return p
}
func (x URI_URIProtocol) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (URI_URIProtocol) Descriptor() protoreflect.EnumDescriptor {
return file_common_v1_uri_proto_enumTypes[0].Descriptor()
}
func (URI_URIProtocol) Type() protoreflect.EnumType {
return &file_common_v1_uri_proto_enumTypes[0]
}
func (x URI_URIProtocol) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use URI_URIProtocol.Descriptor instead.
func (URI_URIProtocol) EnumDescriptor() ([]byte, []int) {
return file_common_v1_uri_proto_rawDescGZIP(), []int{0, 0}
}
type URI struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Protocol URI_URIProtocol `protobuf:"varint,1,opt,name=protocol,proto3,enum=common.v1.URI_URIProtocol" json:"protocol,omitempty"`
Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
}
func (x *URI) Reset() {
*x = URI{}
if protoimpl.UnsafeEnabled {
mi := &file_common_v1_uri_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *URI) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*URI) ProtoMessage() {}
func (x *URI) ProtoReflect() protoreflect.Message {
mi := &file_common_v1_uri_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use URI.ProtoReflect.Descriptor instead.
func (*URI) Descriptor() ([]byte, []int) {
return file_common_v1_uri_proto_rawDescGZIP(), []int{0}
}
func (x *URI) GetProtocol() URI_URIProtocol {
if x != nil {
return x.Protocol
}
return URI_HTTPS
}
func (x *URI) GetValue() string {
if x != nil {
return x.Value
}
return ""
}
var File_common_v1_uri_proto protoreflect.FileDescriptor
var file_common_v1_uri_proto_rawDesc = []byte{
0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x2f, 0x75, 0x72, 0x69, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31,
0x22, 0x8a, 0x01, 0x0a, 0x03, 0x55, 0x52, 0x49, 0x12, 0x36, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x63, 0x6f, 0x6d,
0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x52, 0x49, 0x2e, 0x55, 0x52, 0x49, 0x50, 0x72,
0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c,
0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x35, 0x0a, 0x0b, 0x55, 0x52, 0x49, 0x50, 0x72, 0x6f,
0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x12, 0x09, 0x0a, 0x05, 0x48, 0x54, 0x54, 0x50, 0x53, 0x10, 0x00,
0x12, 0x08, 0x0a, 0x04, 0x49, 0x50, 0x46, 0x53, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x49, 0x50,
0x4e, 0x53, 0x10, 0x02, 0x12, 0x07, 0x0a, 0x03, 0x44, 0x49, 0x44, 0x10, 0x03, 0x42, 0x32, 0x5a,
0x30, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x6e, 0x73, 0x6f,
0x6e, 0x72, 0x2f, 0x73, 0x6f, 0x6e, 0x72, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x63, 0x6f, 0x6d, 0x6d,
0x6f, 0x6e, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x3b, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x76,
0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_common_v1_uri_proto_rawDescOnce sync.Once
file_common_v1_uri_proto_rawDescData = file_common_v1_uri_proto_rawDesc
)
func file_common_v1_uri_proto_rawDescGZIP() []byte {
file_common_v1_uri_proto_rawDescOnce.Do(func() {
file_common_v1_uri_proto_rawDescData = protoimpl.X.CompressGZIP(file_common_v1_uri_proto_rawDescData)
})
return file_common_v1_uri_proto_rawDescData
}
var file_common_v1_uri_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_common_v1_uri_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_common_v1_uri_proto_goTypes = []interface{}{
(URI_URIProtocol)(0), // 0: common.v1.URI.URIProtocol
(*URI)(nil), // 1: common.v1.URI
}
var file_common_v1_uri_proto_depIdxs = []int32{
0, // 0: common.v1.URI.protocol:type_name -> common.v1.URI.URIProtocol
1, // [1:1] is the sub-list for method output_type
1, // [1:1] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
}
func init() { file_common_v1_uri_proto_init() }
func file_common_v1_uri_proto_init() {
if File_common_v1_uri_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_common_v1_uri_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*URI); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_common_v1_uri_proto_rawDesc,
NumEnums: 1,
NumMessages: 1,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_common_v1_uri_proto_goTypes,
DependencyIndexes: file_common_v1_uri_proto_depIdxs,
EnumInfos: file_common_v1_uri_proto_enumTypes,
MessageInfos: file_common_v1_uri_proto_msgTypes,
}.Build()
File_common_v1_uri_proto = out.File
file_common_v1_uri_proto_rawDesc = nil
file_common_v1_uri_proto_goTypes = nil
file_common_v1_uri_proto_depIdxs = nil
}
+1
View File
@@ -0,0 +1 @@
# Core
+30
View File
@@ -0,0 +1,30 @@
package appmodule
import (
"cosmossdk.io/core/event"
"cosmossdk.io/core/gas"
"cosmossdk.io/core/header"
"cosmossdk.io/core/store"
"github.com/onsonr/sonr/pkg/core/branch"
"github.com/onsonr/sonr/pkg/core/log"
"github.com/onsonr/sonr/pkg/core/router"
"github.com/onsonr/sonr/pkg/core/transaction"
)
// Environment is used to get all services to their respective module.
// Contract: All fields of environment are always populated by runtime.
type Environment struct {
Logger log.Logger
BranchService branch.Service
EventService event.Service
GasService gas.Service
HeaderService header.Service
QueryRouterService router.Service
MsgRouterService router.Service
TransactionService transaction.Service
KVStoreService store.KVStoreService
MemStoreService store.MemoryStoreService
}
+34
View File
@@ -0,0 +1,34 @@
// Package branch contains the core branch service interface.
package branch
import (
"context"
"errors"
)
// ErrGasLimitExceeded is returned when the gas limit is exceeded in a
// Service.ExecuteWithGasLimit call.
var ErrGasLimitExceeded = errors.New("branch: gas limit exceeded")
// Service is the branch service interface. It can be used to execute
// code paths in an isolated execution context that can be reverted.
// A revert typically means a rollback on events and state changes.
type Service interface {
// Execute executes the given function in an isolated context. If the
// `f` function returns an error, the execution is considered failed,
// and every change made affecting the execution context is rolled back.
// If the function returns nil, the execution is considered successful, and
// committed.
// The context.Context passed to the `f` function is a child of the context
// passed to the Execute function, and is what should be used with other
// core services in order to ensure the execution remains isolated.
Execute(ctx context.Context, f func(ctx context.Context) error) error
// ExecuteWithGasLimit executes the given function `f` in an isolated context,
// with the provided gas limit, this is advanced usage and is used to disallow
// an execution path to consume an indefinite amount of gas.
// If the execution fails or succeeds the gas limit is still applied to the
// parent context, the function returns a gasUsed value which is the amount
// of gas used by the execution path. If the execution path exceeds the gas
// ErrGasLimitExceeded is returned.
ExecuteWithGasLimit(ctx context.Context, gasLimit uint64, f func(ctx context.Context) error) (gasUsed uint64, err error)
}
+29
View File
@@ -0,0 +1,29 @@
package log
const ModuleKey = "module"
// Logger defines basic logger functionality that all previous versions of the Logger interface should
// support. Library users should prefer to use this interface when possible, then type case to Logger
// to see if WithContext is supported.
type Logger interface {
// Info takes a message and a set of key/value pairs and logs with level INFO.
// The key of the tuple must be a string.
Info(msg string, keyVals ...any)
// Warn takes a message and a set of key/value pairs and logs with level WARN.
// The key of the tuple must be a string.
Warn(msg string, keyVals ...any)
// Error takes a message and a set of key/value pairs and logs with level ERR.
// The key of the tuple must be a string.
Error(msg string, keyVals ...any)
// Debug takes a message and a set of key/value pairs and logs with level DEBUG.
// The key of the tuple must be a string.
Debug(msg string, keyVals ...any)
// Impl returns the underlying logger implementation.
// It is used to access the full functionalities of the underlying logger.
// Advanced users can type cast the returned value to the actual logger.
Impl() any
}
+16
View File
@@ -0,0 +1,16 @@
package router
import (
"context"
"github.com/onsonr/sonr/pkg/core/transaction"
)
// Service is the interface that wraps the basic methods for a router.
// A router can be a query router or a message router.
type Service interface {
// CanInvoke returns an error if the given request cannot be invoked.
CanInvoke(ctx context.Context, typeURL string) error
// Invoke execute a message or query. The response should be type casted by the caller to the expected response.
Invoke(ctx context.Context, req transaction.Msg) (res transaction.Msg, err error)
}
+25
View File
@@ -0,0 +1,25 @@
package transaction
import "context"
// ExecMode defines the execution mode
type ExecMode uint8
// All possible execution modes.
// For backwards compatibility and easier casting, the exec mode values must be the same as in cosmos/cosmos-sdk/types package.
const (
ExecModeCheck ExecMode = iota
ExecModeReCheck
ExecModeSimulate
_
_
_
_
ExecModeFinalize
)
// Service creates a transaction service.
type Service interface {
// ExecMode returns the current execution mode.
ExecMode(ctx context.Context) ExecMode
}
+45
View File
@@ -0,0 +1,45 @@
package transaction
type (
// Msg uses structural types to define the interface for a message.
Msg = interface {
Reset()
String() string
ProtoMessage()
}
Identity = []byte
)
// GenericMsg defines a generic version of a Msg.
// The GenericMsg refers to the non pointer version of Msg,
// and is required to allow its instantiations in generic contexts.
type GenericMsg[T any] interface {
*T
Msg
}
// Codec defines the TX codec, which converts a TX from bytes to its concrete representation.
type Codec[T Tx] interface {
// Decode decodes the tx bytes into a DecodedTx, containing
// both concrete and bytes representation of the tx.
Decode([]byte) (T, error)
// DecodeJSON decodes the tx JSON bytes into a DecodedTx
DecodeJSON([]byte) (T, error)
}
// Tx defines the interface for a transaction.
// All custom transactions must implement this interface.
type Tx interface {
// Hash returns the unique identifier for the Tx.
Hash() [32]byte
// GetMessages returns the list of state transitions of the Tx.
GetMessages() ([]Msg, error)
// GetSenders returns the tx state transition sender.
GetSenders() ([]Identity, error) // TODO reduce this to a single identity if accepted
// GetGasLimit returns the gas limit of the tx. Must return math.MaxUint64 for infinite gas
// txs.
GetGasLimit() (uint64, error)
// Bytes returns the encoded version of this tx. Note: this is ideally cached
// from the first instance of the decoding of the tx.
Bytes() []byte
}
+1
View File
@@ -0,0 +1 @@
# Hway
+13
View File
@@ -0,0 +1,13 @@
package handlers
import "github.com/labstack/echo/v4"
func FetchInitial(e echo.Context) error {
// Implement database schema endpoint
return nil
}
func FetchCurrent(e echo.Context) error {
// Implement account entries endpoint
return nil
}
+535
View File
@@ -0,0 +1,535 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.1
// protoc (unknown)
// source: hway/v1/api.proto
package types
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type GetJWKSRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *GetJWKSRequest) Reset() {
*x = GetJWKSRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_hway_v1_api_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetJWKSRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetJWKSRequest) ProtoMessage() {}
func (x *GetJWKSRequest) ProtoReflect() protoreflect.Message {
mi := &file_hway_v1_api_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetJWKSRequest.ProtoReflect.Descriptor instead.
func (*GetJWKSRequest) Descriptor() ([]byte, []int) {
return file_hway_v1_api_proto_rawDescGZIP(), []int{0}
}
type GetJWKSResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Jwks string `protobuf:"bytes,1,opt,name=jwks,proto3" json:"jwks,omitempty"`
}
func (x *GetJWKSResponse) Reset() {
*x = GetJWKSResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_hway_v1_api_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetJWKSResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetJWKSResponse) ProtoMessage() {}
func (x *GetJWKSResponse) ProtoReflect() protoreflect.Message {
mi := &file_hway_v1_api_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetJWKSResponse.ProtoReflect.Descriptor instead.
func (*GetJWKSResponse) Descriptor() ([]byte, []int) {
return file_hway_v1_api_proto_rawDescGZIP(), []int{1}
}
func (x *GetJWKSResponse) GetJwks() string {
if x != nil {
return x.Jwks
}
return ""
}
type GetTokenRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Subject string `protobuf:"bytes,1,opt,name=subject,proto3" json:"subject,omitempty"`
Origin string `protobuf:"bytes,2,opt,name=origin,proto3" json:"origin,omitempty"`
Key string `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty"`
Asset string `protobuf:"bytes,4,opt,name=asset,proto3" json:"asset,omitempty"`
}
func (x *GetTokenRequest) Reset() {
*x = GetTokenRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_hway_v1_api_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetTokenRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetTokenRequest) ProtoMessage() {}
func (x *GetTokenRequest) ProtoReflect() protoreflect.Message {
mi := &file_hway_v1_api_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetTokenRequest.ProtoReflect.Descriptor instead.
func (*GetTokenRequest) Descriptor() ([]byte, []int) {
return file_hway_v1_api_proto_rawDescGZIP(), []int{2}
}
func (x *GetTokenRequest) GetSubject() string {
if x != nil {
return x.Subject
}
return ""
}
func (x *GetTokenRequest) GetOrigin() string {
if x != nil {
return x.Origin
}
return ""
}
func (x *GetTokenRequest) GetKey() string {
if x != nil {
return x.Key
}
return ""
}
func (x *GetTokenRequest) GetAsset() string {
if x != nil {
return x.Asset
}
return ""
}
type GetTokenResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"`
}
func (x *GetTokenResponse) Reset() {
*x = GetTokenResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_hway_v1_api_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetTokenResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetTokenResponse) ProtoMessage() {}
func (x *GetTokenResponse) ProtoReflect() protoreflect.Message {
mi := &file_hway_v1_api_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetTokenResponse.ProtoReflect.Descriptor instead.
func (*GetTokenResponse) Descriptor() ([]byte, []int) {
return file_hway_v1_api_proto_rawDescGZIP(), []int{3}
}
func (x *GetTokenResponse) GetToken() string {
if x != nil {
return x.Token
}
return ""
}
type GrantAuthorizationRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Subject string `protobuf:"bytes,1,opt,name=subject,proto3" json:"subject,omitempty"`
Origin string `protobuf:"bytes,2,opt,name=origin,proto3" json:"origin,omitempty"`
Key string `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty"`
Asset string `protobuf:"bytes,4,opt,name=asset,proto3" json:"asset,omitempty"`
Assertion string `protobuf:"bytes,5,opt,name=assertion,proto3" json:"assertion,omitempty"`
}
func (x *GrantAuthorizationRequest) Reset() {
*x = GrantAuthorizationRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_hway_v1_api_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GrantAuthorizationRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GrantAuthorizationRequest) ProtoMessage() {}
func (x *GrantAuthorizationRequest) ProtoReflect() protoreflect.Message {
mi := &file_hway_v1_api_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GrantAuthorizationRequest.ProtoReflect.Descriptor instead.
func (*GrantAuthorizationRequest) Descriptor() ([]byte, []int) {
return file_hway_v1_api_proto_rawDescGZIP(), []int{4}
}
func (x *GrantAuthorizationRequest) GetSubject() string {
if x != nil {
return x.Subject
}
return ""
}
func (x *GrantAuthorizationRequest) GetOrigin() string {
if x != nil {
return x.Origin
}
return ""
}
func (x *GrantAuthorizationRequest) GetKey() string {
if x != nil {
return x.Key
}
return ""
}
func (x *GrantAuthorizationRequest) GetAsset() string {
if x != nil {
return x.Asset
}
return ""
}
func (x *GrantAuthorizationRequest) GetAssertion() string {
if x != nil {
return x.Assertion
}
return ""
}
type GrantAuthorizationResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"`
}
func (x *GrantAuthorizationResponse) Reset() {
*x = GrantAuthorizationResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_hway_v1_api_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GrantAuthorizationResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GrantAuthorizationResponse) ProtoMessage() {}
func (x *GrantAuthorizationResponse) ProtoReflect() protoreflect.Message {
mi := &file_hway_v1_api_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GrantAuthorizationResponse.ProtoReflect.Descriptor instead.
func (*GrantAuthorizationResponse) Descriptor() ([]byte, []int) {
return file_hway_v1_api_proto_rawDescGZIP(), []int{5}
}
func (x *GrantAuthorizationResponse) GetToken() string {
if x != nil {
return x.Token
}
return ""
}
var File_hway_v1_api_proto protoreflect.FileDescriptor
var file_hway_v1_api_proto_rawDesc = []byte{
0x0a, 0x11, 0x68, 0x77, 0x61, 0x79, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x12, 0x07, 0x68, 0x77, 0x61, 0x79, 0x2e, 0x76, 0x31, 0x22, 0x10, 0x0a, 0x0e,
0x47, 0x65, 0x74, 0x4a, 0x57, 0x4b, 0x53, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x25,
0x0a, 0x0f, 0x47, 0x65, 0x74, 0x4a, 0x57, 0x4b, 0x53, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x12, 0x12, 0x0a, 0x04, 0x6a, 0x77, 0x6b, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
0x04, 0x6a, 0x77, 0x6b, 0x73, 0x22, 0x6b, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x54, 0x6f, 0x6b, 0x65,
0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x62, 0x6a,
0x65, 0x63, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65,
0x63, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01,
0x28, 0x09, 0x52, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65,
0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05,
0x61, 0x73, 0x73, 0x65, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x73, 0x73,
0x65, 0x74, 0x22, 0x28, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18,
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x93, 0x01, 0x0a,
0x19, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75,
0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x62,
0x6a, 0x65, 0x63, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x02,
0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x12, 0x10, 0x0a, 0x03,
0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14,
0x0a, 0x05, 0x61, 0x73, 0x73, 0x65, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61,
0x73, 0x73, 0x65, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x73, 0x73, 0x65, 0x72, 0x74, 0x69, 0x6f,
0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x73, 0x73, 0x65, 0x72, 0x74, 0x69,
0x6f, 0x6e, 0x22, 0x32, 0x0a, 0x1a, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x41, 0x75, 0x74, 0x68, 0x6f,
0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x32, 0xe7, 0x01, 0x0a, 0x07, 0x48, 0x69, 0x67, 0x68, 0x77,
0x61, 0x79, 0x12, 0x3c, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x4a, 0x57, 0x4b, 0x53, 0x12, 0x17, 0x2e,
0x68, 0x77, 0x61, 0x79, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4a, 0x57, 0x4b, 0x53, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x68, 0x77, 0x61, 0x79, 0x2e, 0x76, 0x31,
0x2e, 0x47, 0x65, 0x74, 0x4a, 0x57, 0x4b, 0x53, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x12, 0x3f, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x18, 0x2e, 0x68,
0x77, 0x61, 0x79, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x68, 0x77, 0x61, 0x79, 0x2e, 0x76, 0x31,
0x2e, 0x47, 0x65, 0x74, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x12, 0x5d, 0x0a, 0x12, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72,
0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x22, 0x2e, 0x68, 0x77, 0x61, 0x79, 0x2e, 0x76,
0x31, 0x2e, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61,
0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x68, 0x77,
0x61, 0x79, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x72, 0x61, 0x6e, 0x74, 0x41, 0x75, 0x74, 0x68, 0x6f,
0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x42, 0x27, 0x5a, 0x25, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f,
0x6e, 0x73, 0x6f, 0x6e, 0x72, 0x2f, 0x73, 0x6f, 0x6e, 0x72, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x68,
0x77, 0x61, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x33,
}
var (
file_hway_v1_api_proto_rawDescOnce sync.Once
file_hway_v1_api_proto_rawDescData = file_hway_v1_api_proto_rawDesc
)
func file_hway_v1_api_proto_rawDescGZIP() []byte {
file_hway_v1_api_proto_rawDescOnce.Do(func() {
file_hway_v1_api_proto_rawDescData = protoimpl.X.CompressGZIP(file_hway_v1_api_proto_rawDescData)
})
return file_hway_v1_api_proto_rawDescData
}
var file_hway_v1_api_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
var file_hway_v1_api_proto_goTypes = []interface{}{
(*GetJWKSRequest)(nil), // 0: hway.v1.GetJWKSRequest
(*GetJWKSResponse)(nil), // 1: hway.v1.GetJWKSResponse
(*GetTokenRequest)(nil), // 2: hway.v1.GetTokenRequest
(*GetTokenResponse)(nil), // 3: hway.v1.GetTokenResponse
(*GrantAuthorizationRequest)(nil), // 4: hway.v1.GrantAuthorizationRequest
(*GrantAuthorizationResponse)(nil), // 5: hway.v1.GrantAuthorizationResponse
}
var file_hway_v1_api_proto_depIdxs = []int32{
0, // 0: hway.v1.Highway.GetJWKS:input_type -> hway.v1.GetJWKSRequest
2, // 1: hway.v1.Highway.GetToken:input_type -> hway.v1.GetTokenRequest
4, // 2: hway.v1.Highway.GrantAuthorization:input_type -> hway.v1.GrantAuthorizationRequest
1, // 3: hway.v1.Highway.GetJWKS:output_type -> hway.v1.GetJWKSResponse
3, // 4: hway.v1.Highway.GetToken:output_type -> hway.v1.GetTokenResponse
5, // 5: hway.v1.Highway.GrantAuthorization:output_type -> hway.v1.GrantAuthorizationResponse
3, // [3:6] is the sub-list for method output_type
0, // [0:3] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_hway_v1_api_proto_init() }
func file_hway_v1_api_proto_init() {
if File_hway_v1_api_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_hway_v1_api_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetJWKSRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_hway_v1_api_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetJWKSResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_hway_v1_api_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetTokenRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_hway_v1_api_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetTokenResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_hway_v1_api_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GrantAuthorizationRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_hway_v1_api_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GrantAuthorizationResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_hway_v1_api_proto_rawDesc,
NumEnums: 0,
NumMessages: 6,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_hway_v1_api_proto_goTypes,
DependencyIndexes: file_hway_v1_api_proto_depIdxs,
MessageInfos: file_hway_v1_api_proto_msgTypes,
}.Build()
File_hway_v1_api_proto = out.File
file_hway_v1_api_proto_rawDesc = nil
file_hway_v1_api_proto_goTypes = nil
file_hway_v1_api_proto_depIdxs = nil
}
+63
View File
@@ -0,0 +1,63 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.1
// protoc (unknown)
// source: hway/v1/client.proto
package types
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
var File_hway_v1_client_proto protoreflect.FileDescriptor
var file_hway_v1_client_proto_rawDesc = []byte{
0x0a, 0x14, 0x68, 0x77, 0x61, 0x79, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x07, 0x68, 0x77, 0x61, 0x79, 0x2e, 0x76, 0x31, 0x42,
0x27, 0x5a, 0x25, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x6e,
0x73, 0x6f, 0x6e, 0x72, 0x2f, 0x73, 0x6f, 0x6e, 0x72, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x68, 0x77,
0x61, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73,
}
var file_hway_v1_client_proto_goTypes = []interface{}{}
var file_hway_v1_client_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
0, // [0:0] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_hway_v1_client_proto_init() }
func file_hway_v1_client_proto_init() {
if File_hway_v1_client_proto != nil {
return
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_hway_v1_client_proto_rawDesc,
NumEnums: 0,
NumMessages: 0,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_hway_v1_client_proto_goTypes,
DependencyIndexes: file_hway_v1_client_proto_depIdxs,
}.Build()
File_hway_v1_client_proto = out.File
file_hway_v1_client_proto_rawDesc = nil
file_hway_v1_client_proto_goTypes = nil
file_hway_v1_client_proto_depIdxs = nil
}
+1
View File
@@ -0,0 +1 @@
# Motr
+18
View File
@@ -0,0 +1,18 @@
// Code generated from Pkl module `dwn`. DO NOT EDIT.
package config
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"`
}
+36
View File
@@ -0,0 +1,36 @@
// Code generated from Pkl module `dwn`. DO NOT EDIT.
package config
import (
"context"
"github.com/apple/pkl-go/pkl"
)
type Dwn struct {
}
// LoadFromPath loads the pkl module at the given path and evaluates it into a Dwn
func LoadFromPath(ctx context.Context, path string) (ret *Dwn, 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 Dwn
func Load(ctx context.Context, evaluator pkl.Evaluator, source *pkl.ModuleSource) (*Dwn, error) {
var ret Dwn
if err := evaluator.EvaluateModule(ctx, source, &ret); err != nil {
return nil, err
}
return &ret, nil
}
+22
View File
@@ -0,0 +1,22 @@
// Code generated from Pkl module `dwn`. DO NOT EDIT.
package config
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"`
}
+10
View File
@@ -0,0 +1,10 @@
// Code generated from Pkl module `dwn`. DO NOT EDIT.
package config
import "github.com/apple/pkl-go/pkl"
func init() {
pkl.RegisterMapping("dwn", Dwn{})
pkl.RegisterMapping("dwn#Config", Config{})
pkl.RegisterMapping("dwn#Schema", Schema{})
}
+38
View File
@@ -0,0 +1,38 @@
package motr
import (
_ "embed"
"encoding/json"
"github.com/ipfs/boxo/files"
"github.com/onsonr/sonr/pkg/motr/config"
"github.com/onsonr/sonr/pkg/motr/static"
)
const (
FileNameConfigJSON = "dwn.pkl"
FileNameIndexHTML = "index.html"
FileNameWorkerJS = "sw.js"
)
//go:embed static/sw.js
var swJSData []byte
// NewVaultDirectory creates a new directory with the default files
func NewVaultDirectory(cnfg *config.Config) (files.Node, error) {
idxFile, err := static.BuildVaultFile(cnfg)
if err != nil {
return nil, err
}
cnfgBz, err := json.Marshal(cnfg)
if err != nil {
return nil, err
}
fileMap := map[string]files.Node{
FileNameConfigJSON: files.NewBytesFile(cnfgBz),
FileNameIndexHTML: idxFile,
FileNameWorkerJS: files.NewBytesFile(swJSData),
}
return files.NewMapDirectory(fileMap), nil
}
@@ -4,24 +4,20 @@ import (
"github.com/go-webauthn/webauthn/protocol"
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/internal/orm"
"github.com/onsonr/sonr/pkg/motr/types/orm"
)
type authAPI struct{}
var Auth = new(authAPI)
// ╭───────────────────────────────────────────────────────────╮
// │ Login Handlers │
// ╰───────────────────────────────────────────────────────────╯
// LoginSubjectCheck handles the login subject check.
func (a *authAPI) LoginSubjectCheck(e echo.Context) error {
func LoginSubjectCheck(e echo.Context) error {
return e.JSON(200, "HandleCredentialAssertion")
}
// LoginSubjectStart handles the login subject start.
func (a *authAPI) LoginSubjectStart(e echo.Context) error {
func LoginSubjectStart(e echo.Context) error {
opts := &protocol.PublicKeyCredentialRequestOptions{
UserVerification: "preferred",
Challenge: []byte("challenge"),
@@ -30,7 +26,7 @@ func (a *authAPI) LoginSubjectStart(e echo.Context) error {
}
// LoginSubjectFinish handles the login subject finish.
func (a *authAPI) LoginSubjectFinish(e echo.Context) error {
func LoginSubjectFinish(e echo.Context) error {
var crr protocol.CredentialAssertionResponse
if err := e.Bind(&crr); err != nil {
return err
@@ -43,13 +39,13 @@ func (a *authAPI) LoginSubjectFinish(e echo.Context) error {
// ╰───────────────────────────────────────────────────────────╯
// RegisterSubjectCheck handles the register subject check.
func (a *authAPI) RegisterSubjectCheck(e echo.Context) error {
func RegisterSubjectCheck(e echo.Context) error {
subject := e.FormValue("subject")
return e.JSON(200, subject)
}
// RegisterSubjectStart handles the register subject start.
func (a *authAPI) RegisterSubjectStart(e echo.Context) error {
func RegisterSubjectStart(e echo.Context) error {
// Get subject and address
subject := e.FormValue("subject")
address := e.FormValue("address")
@@ -63,7 +59,7 @@ func (a *authAPI) RegisterSubjectStart(e echo.Context) error {
}
// RegisterSubjectFinish handles the register subject finish.
func (a *authAPI) RegisterSubjectFinish(e echo.Context) error {
func RegisterSubjectFinish(e echo.Context) error {
// Deserialize the JSON into a temporary struct
var ccr protocol.CredentialCreationResponse
if err := e.Bind(&ccr); err != nil {
+23
View File
@@ -0,0 +1,23 @@
package handlers
import (
"github.com/labstack/echo/v4"
)
func GrantAuthorization(e echo.Context) error {
// Implement authorization endpoint using passkey authentication
// Store session data in cache
return nil
}
func GetJWKS(e echo.Context) error {
// Implement token endpoint
// Use cached session data for validation
return nil
}
func GetToken(e echo.Context) error {
// Implement token endpoint
// Use cached session data for validation
return nil
}
+26
View File
@@ -0,0 +1,26 @@
package routes
import (
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/pkg/motr/handlers"
)
// RegisterWebNodeAPI registers the Decentralized Web Node API routes.
func RegisterWebNodeAPI(e *echo.Echo) {
g1 := e.Group("api")
g1.GET("/register/:subject/start", handlers.RegisterSubjectStart)
g1.POST("/register/:subject/check", handlers.RegisterSubjectCheck)
g1.POST("/register/:subject/finish", handlers.RegisterSubjectFinish)
g1.GET("/login/:subject/start", handlers.LoginSubjectStart)
g1.POST("/login/:subject/check", handlers.LoginSubjectCheck)
g1.POST("/login/:subject/finish", handlers.LoginSubjectFinish)
g1.GET("/:origin/grant/jwks", handlers.GetJWKS)
g1.GET("/:origin/grant/token", handlers.GetToken)
g1.POST("/:origin/grant/:subject", handlers.GrantAuthorization)
}
func RegisterWebNodeViews(e *echo.Echo) {
}
@@ -1,16 +1,17 @@
package nebula
package static
import (
"bytes"
"context"
"github.com/ipfs/boxo/files"
"github.com/onsonr/sonr/internal/dwn/gen"
dwn "github.com/onsonr/sonr/pkg/motr/config"
"github.com/onsonr/sonr/pkg/nebula/views"
)
// BuildVaultFile builds the index.html file for the vault
func BuildVaultFile(cnfg *gen.Config) (files.Node, error) {
func BuildVaultFile(cnfg *dwn.Config) (files.Node, error) {
w := bytes.NewBuffer(nil)
err := views.VaultIndexFile().Render(context.Background(), w)
if err != nil {
+22
View File
@@ -0,0 +1,22 @@
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);
}));
});
+342
View File
@@ -0,0 +1,342 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.1
// protoc (unknown)
// source: motr/v1/api.proto
package types
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type PinRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Cid string `protobuf:"bytes,1,opt,name=cid,proto3" json:"cid,omitempty"`
}
func (x *PinRequest) Reset() {
*x = PinRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_motr_v1_api_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *PinRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*PinRequest) ProtoMessage() {}
func (x *PinRequest) ProtoReflect() protoreflect.Message {
mi := &file_motr_v1_api_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use PinRequest.ProtoReflect.Descriptor instead.
func (*PinRequest) Descriptor() ([]byte, []int) {
return file_motr_v1_api_proto_rawDescGZIP(), []int{0}
}
func (x *PinRequest) GetCid() string {
if x != nil {
return x.Cid
}
return ""
}
type PinResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
}
func (x *PinResponse) Reset() {
*x = PinResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_motr_v1_api_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *PinResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*PinResponse) ProtoMessage() {}
func (x *PinResponse) ProtoReflect() protoreflect.Message {
mi := &file_motr_v1_api_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use PinResponse.ProtoReflect.Descriptor instead.
func (*PinResponse) Descriptor() ([]byte, []int) {
return file_motr_v1_api_proto_rawDescGZIP(), []int{1}
}
func (x *PinResponse) GetSuccess() bool {
if x != nil {
return x.Success
}
return false
}
type UnpinRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Cid string `protobuf:"bytes,1,opt,name=cid,proto3" json:"cid,omitempty"`
}
func (x *UnpinRequest) Reset() {
*x = UnpinRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_motr_v1_api_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *UnpinRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UnpinRequest) ProtoMessage() {}
func (x *UnpinRequest) ProtoReflect() protoreflect.Message {
mi := &file_motr_v1_api_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use UnpinRequest.ProtoReflect.Descriptor instead.
func (*UnpinRequest) Descriptor() ([]byte, []int) {
return file_motr_v1_api_proto_rawDescGZIP(), []int{2}
}
func (x *UnpinRequest) GetCid() string {
if x != nil {
return x.Cid
}
return ""
}
type UnpinResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
}
func (x *UnpinResponse) Reset() {
*x = UnpinResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_motr_v1_api_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *UnpinResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*UnpinResponse) ProtoMessage() {}
func (x *UnpinResponse) ProtoReflect() protoreflect.Message {
mi := &file_motr_v1_api_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use UnpinResponse.ProtoReflect.Descriptor instead.
func (*UnpinResponse) Descriptor() ([]byte, []int) {
return file_motr_v1_api_proto_rawDescGZIP(), []int{3}
}
func (x *UnpinResponse) GetSuccess() bool {
if x != nil {
return x.Success
}
return false
}
var File_motr_v1_api_proto protoreflect.FileDescriptor
var file_motr_v1_api_proto_rawDesc = []byte{
0x0a, 0x11, 0x6d, 0x6f, 0x74, 0x72, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x12, 0x07, 0x6d, 0x6f, 0x74, 0x72, 0x2e, 0x76, 0x31, 0x22, 0x1e, 0x0a, 0x0a,
0x50, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x69,
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x63, 0x69, 0x64, 0x22, 0x27, 0x0a, 0x0b,
0x50, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73,
0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75,
0x63, 0x63, 0x65, 0x73, 0x73, 0x22, 0x20, 0x0a, 0x0c, 0x55, 0x6e, 0x70, 0x69, 0x6e, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01,
0x28, 0x09, 0x52, 0x03, 0x63, 0x69, 0x64, 0x22, 0x29, 0x0a, 0x0d, 0x55, 0x6e, 0x70, 0x69, 0x6e,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x63, 0x63,
0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x75, 0x63, 0x63, 0x65,
0x73, 0x73, 0x32, 0x70, 0x0a, 0x04, 0x4d, 0x6f, 0x74, 0x72, 0x12, 0x30, 0x0a, 0x03, 0x50, 0x69,
0x6e, 0x12, 0x13, 0x2e, 0x6d, 0x6f, 0x74, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x69, 0x6e, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x6d, 0x6f, 0x74, 0x72, 0x2e, 0x76, 0x31,
0x2e, 0x50, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x36, 0x0a, 0x05,
0x55, 0x6e, 0x70, 0x69, 0x6e, 0x12, 0x15, 0x2e, 0x6d, 0x6f, 0x74, 0x72, 0x2e, 0x76, 0x31, 0x2e,
0x55, 0x6e, 0x70, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x6d,
0x6f, 0x74, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x6e, 0x70, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x42, 0x27, 0x5a, 0x25, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63,
0x6f, 0x6d, 0x2f, 0x6f, 0x6e, 0x73, 0x6f, 0x6e, 0x72, 0x2f, 0x73, 0x6f, 0x6e, 0x72, 0x2f, 0x70,
0x6b, 0x67, 0x2f, 0x6d, 0x6f, 0x74, 0x72, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x62, 0x06, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_motr_v1_api_proto_rawDescOnce sync.Once
file_motr_v1_api_proto_rawDescData = file_motr_v1_api_proto_rawDesc
)
func file_motr_v1_api_proto_rawDescGZIP() []byte {
file_motr_v1_api_proto_rawDescOnce.Do(func() {
file_motr_v1_api_proto_rawDescData = protoimpl.X.CompressGZIP(file_motr_v1_api_proto_rawDescData)
})
return file_motr_v1_api_proto_rawDescData
}
var file_motr_v1_api_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_motr_v1_api_proto_goTypes = []interface{}{
(*PinRequest)(nil), // 0: motr.v1.PinRequest
(*PinResponse)(nil), // 1: motr.v1.PinResponse
(*UnpinRequest)(nil), // 2: motr.v1.UnpinRequest
(*UnpinResponse)(nil), // 3: motr.v1.UnpinResponse
}
var file_motr_v1_api_proto_depIdxs = []int32{
0, // 0: motr.v1.Motr.Pin:input_type -> motr.v1.PinRequest
2, // 1: motr.v1.Motr.Unpin:input_type -> motr.v1.UnpinRequest
1, // 2: motr.v1.Motr.Pin:output_type -> motr.v1.PinResponse
3, // 3: motr.v1.Motr.Unpin:output_type -> motr.v1.UnpinResponse
2, // [2:4] is the sub-list for method output_type
0, // [0:2] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_motr_v1_api_proto_init() }
func file_motr_v1_api_proto_init() {
if File_motr_v1_api_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_motr_v1_api_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*PinRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_motr_v1_api_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*PinResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_motr_v1_api_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UnpinRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_motr_v1_api_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UnpinResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_motr_v1_api_proto_rawDesc,
NumEnums: 0,
NumMessages: 4,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_motr_v1_api_proto_goTypes,
DependencyIndexes: file_motr_v1_api_proto_depIdxs,
MessageInfos: file_motr_v1_api_proto_msgTypes,
}.Build()
File_motr_v1_api_proto = out.File
file_motr_v1_api_proto_rawDesc = nil
file_motr_v1_api_proto_goTypes = nil
file_motr_v1_api_proto_depIdxs = nil
}
+20
View File
@@ -0,0 +1,20 @@
// 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"`
}
+16
View File
@@ -0,0 +1,16 @@
// 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"`
}
+14
View File
@@ -0,0 +1,14 @@
// 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"`
}
+40
View File
@@ -0,0 +1,40 @@
// 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"`
}
+28
View File
@@ -0,0 +1,28 @@
// Code generated from Pkl module `orm`. DO NOT EDIT.
package orm
import (
"github.com/onsonr/sonr/pkg/motr/types/orm/keyalgorithm"
"github.com/onsonr/sonr/pkg/motr/types/orm/keycurve"
"github.com/onsonr/sonr/pkg/motr/types/orm/keyencoding"
"github.com/onsonr/sonr/pkg/motr/types/orm/keyrole"
"github.com/onsonr/sonr/pkg/motr/types/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"`
}
+20
View File
@@ -0,0 +1,20 @@
// 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"`
}
+16
View File
@@ -0,0 +1,16 @@
// 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"`
}
+14
View File
@@ -0,0 +1,14 @@
// 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"`
}
+39
View File
@@ -0,0 +1,39 @@
// 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
}
+20
View File
@@ -0,0 +1,20 @@
// 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"`
}
@@ -0,0 +1,46 @@
// 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
}
@@ -0,0 +1,52 @@
// 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
}
+17
View File
@@ -0,0 +1,17 @@
// 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{})
}
@@ -0,0 +1,46 @@
// 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
}
@@ -0,0 +1,58 @@
// 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
}
@@ -0,0 +1,37 @@
// 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
}
+40
View File
@@ -0,0 +1,40 @@
// 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
}
@@ -0,0 +1,34 @@
// 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
}
+55
View File
@@ -0,0 +1,55 @@
// 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
}
@@ -0,0 +1,46 @@
// 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
}
@@ -0,0 +1,49 @@
// 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
}
+39
View File
@@ -0,0 +1,39 @@
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, ", ")
}
+54
View File
@@ -0,0 +1,54 @@
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,
},
}
}
+1 -1
View File
@@ -1,8 +1,8 @@
package marketing
import (
models "github.com/onsonr/sonr/internal/orm/marketing"
"github.com/onsonr/sonr/pkg/nebula/global"
models "github.com/onsonr/sonr/pkg/nebula/types"
)
// ╭───────────────────────────────────────────────────────────╮
+1 -1
View File
@@ -9,8 +9,8 @@ import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
import (
models "github.com/onsonr/sonr/internal/orm/marketing"
"github.com/onsonr/sonr/pkg/nebula/global"
models "github.com/onsonr/sonr/pkg/nebula/types"
)
// ╭───────────────────────────────────────────────────────────╮
+1 -1
View File
@@ -1,6 +1,6 @@
package marketing
import models "github.com/onsonr/sonr/internal/orm/marketing"
import models "github.com/onsonr/sonr/pkg/nebula/types"
// ╭───────────────────────────────────────────────────────────╮
// │ Data Model │
+1 -1
View File
@@ -8,7 +8,7 @@ package marketing
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
import models "github.com/onsonr/sonr/internal/orm/marketing"
import models "github.com/onsonr/sonr/pkg/nebula/types"
// ╭───────────────────────────────────────────────────────────╮
// │ Data Model │
+1 -1
View File
@@ -2,8 +2,8 @@ package marketing
import (
"fmt"
models "github.com/onsonr/sonr/internal/orm/marketing"
"github.com/onsonr/sonr/pkg/nebula/global/ui"
models "github.com/onsonr/sonr/pkg/nebula/types"
)
// ╭───────────────────────────────────────────────────────────╮
+1 -1
View File
@@ -10,8 +10,8 @@ import templruntime "github.com/a-h/templ/runtime"
import (
"fmt"
models "github.com/onsonr/sonr/internal/orm/marketing"
"github.com/onsonr/sonr/pkg/nebula/global/ui"
models "github.com/onsonr/sonr/pkg/nebula/types"
)
// ╭───────────────────────────────────────────────────────────╮
@@ -2,7 +2,7 @@ package marketing
import (
"fmt"
models "github.com/onsonr/sonr/internal/orm/marketing"
models "github.com/onsonr/sonr/pkg/nebula/types"
)
// ╭───────────────────────────────────────────────────────────╮
@@ -10,7 +10,7 @@ import templruntime "github.com/a-h/templ/runtime"
import (
"fmt"
models "github.com/onsonr/sonr/internal/orm/marketing"
models "github.com/onsonr/sonr/pkg/nebula/types"
)
// ╭───────────────────────────────────────────────────────────╮
+1 -1
View File
@@ -1,8 +1,8 @@
package marketing
import (
models "github.com/onsonr/sonr/internal/orm/marketing"
global "github.com/onsonr/sonr/pkg/nebula/global"
models "github.com/onsonr/sonr/pkg/nebula/types"
)
// ╭───────────────────────────────────────────────────────────╮
@@ -9,8 +9,8 @@ import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
import (
models "github.com/onsonr/sonr/internal/orm/marketing"
global "github.com/onsonr/sonr/pkg/nebula/global"
models "github.com/onsonr/sonr/pkg/nebula/types"
)
// ╭───────────────────────────────────────────────────────────╮
+1 -1
View File
@@ -1,6 +1,6 @@
package marketing
import models "github.com/onsonr/sonr/internal/orm/marketing"
import models "github.com/onsonr/sonr/pkg/nebula/types"
// mission is the (3rd) home page mission section
var mission = &models.Mission{
@@ -8,7 +8,7 @@ package marketing
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
import models "github.com/onsonr/sonr/internal/orm/marketing"
import models "github.com/onsonr/sonr/pkg/nebula/types"
// mission is the (3rd) home page mission section
var mission = &models.Mission{
+2 -1
View File
@@ -4,7 +4,8 @@ import (
"log"
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/internal/ctx"
"github.com/onsonr/sonr/pkg/common/ctx"
"github.com/onsonr/sonr/pkg/nebula/modals"
"github.com/onsonr/sonr/pkg/nebula/views"
)
+2 -1
View File
@@ -4,7 +4,8 @@ import (
"log"
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/internal/ctx"
"github.com/onsonr/sonr/pkg/common/ctx"
"github.com/onsonr/sonr/pkg/nebula/marketing"
)
+99
View File
@@ -0,0 +1,99 @@
package types
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
View File
@@ -1 +0,0 @@
# Workers
-47
View File
@@ -1,47 +0,0 @@
package client
import "net/http"
// SonrClient is a REST HTTP client for Querying Module Endpoints
// for the Sonr blockchain.
type SonrClient struct {
apiURL string
}
// NewLocal creates a new SonrClient for local development.
func NewLocal() (*SonrClient, error) {
// create http client
client := &SonrClient{
apiURL: "http://localhost:1323",
}
// Issue ping to check if server is up
resp, err := http.Get(client.apiURL + "/genesis")
if err != nil {
return nil, err
}
defer resp.Body.Close()
// Check if server is up
if resp.StatusCode != http.StatusOK {
return nil, err
}
return client, nil
}
// NewRemote creates a new SonrClient for remote production.
func NewRemote(url string) (*SonrClient, error) {
// create http client
client := &SonrClient{
apiURL: url,
}
// Issue ping to check if server is up
resp, err := http.Get(client.apiURL + "/genesis")
if err != nil {
return nil, err
}
defer resp.Body.Close()
// Check if server is up
if resp.StatusCode != http.StatusOK {
return nil, err
}
return client, nil
}
-31
View File
@@ -1,31 +0,0 @@
package handlers
import (
"github.com/labstack/echo/v4"
)
func (a *openidAPI) GrantAuthorization(e echo.Context) error {
// Implement authorization endpoint using passkey authentication
// Store session data in cache
return nil
}
func (a *openidAPI) GetJWKS(e echo.Context) error {
// Implement token endpoint
// Use cached session data for validation
return nil
}
func (a *openidAPI) GetToken(e echo.Context) error {
// Implement token endpoint
// Use cached session data for validation
return nil
}
// ╭───────────────────────────────────────────────────────────╮
// │ Group Structures │
// ╰───────────────────────────────────────────────────────────╯
type openidAPI struct{}
var OpenID = new(openidAPI)
-25
View File
@@ -1,25 +0,0 @@
package handlers
import "github.com/labstack/echo/v4"
// ╭───────────────────────────────────────────────────────────╮
// │ Dexie Database Handlers │
// ╰───────────────────────────────────────────────────────────╯
func (a *syncAPI) FetchInitial(e echo.Context) error {
// Implement database schema endpoint
return nil
}
func (a *syncAPI) FetchCurrent(e echo.Context) error {
// Implement account entries endpoint
return nil
}
// ╭───────────────────────────────────────────────────────────╮
// │ Group Structures │
// ╰───────────────────────────────────────────────────────────╯
type syncAPI struct{}
var Sync = new(syncAPI)
-33
View File
@@ -1,33 +0,0 @@
package routes
import (
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/pkg/nebula/routes"
"github.com/onsonr/sonr/pkg/workers/handlers"
)
// RegisterWebNodeAPI registers the Decentralized Web Node API routes.
func RegisterWebNodeAPI(e *echo.Echo) {
g1 := e.Group("api")
g1.GET("/register/:subject/start", handlers.Auth.RegisterSubjectStart)
g1.POST("/register/:subject/check", handlers.Auth.RegisterSubjectCheck)
g1.POST("/register/:subject/finish", handlers.Auth.RegisterSubjectFinish)
g1.GET("/login/:subject/start", handlers.Auth.LoginSubjectStart)
g1.POST("/login/:subject/check", handlers.Auth.LoginSubjectCheck)
g1.POST("/login/:subject/finish", handlers.Auth.LoginSubjectFinish)
g1.GET("/:origin/grant/jwks", handlers.OpenID.GetJWKS)
g1.GET("/:origin/grant/token", handlers.OpenID.GetToken)
g1.POST("/:origin/grant/:subject", handlers.OpenID.GrantAuthorization)
}
// RegisterWebNodeViews registers the Decentralized Web Node HTMX views.
func RegisterWebNodeViews(e *echo.Echo) {
e.File("/", "index.html")
e.GET("/#", routes.CurrentViewRoute)
e.GET("/login", routes.LoginModalRoute)
e.File("/config", "config.json")
e.GET("/register", routes.RegisterModalRoute)
}