mirror of
https://github.com/onsonr/sonr.git
synced 2025-03-10 13:07:09 +00:00
feature/dwn sw js (#1103)
- **feat(macaroon): add and to macaroon genesis** - **refactor: move schema definitions to dedicated file** - **feat: remove Session model** - **refactor: move session middleware to internal package**
This commit is contained in:
parent
d62fb30eb8
commit
edb109b542
@ -14,22 +14,22 @@ builds:
|
|||||||
ldflags:
|
ldflags:
|
||||||
- -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}
|
- -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}
|
||||||
|
|
||||||
- id: motr
|
- id: hway
|
||||||
goos: [linux, darwin]
|
goos: [linux, darwin]
|
||||||
goarch: [amd64, arm64]
|
goarch: [amd64, arm64]
|
||||||
main: ./cmd/motr
|
main: ./cmd/hway
|
||||||
binary: motr
|
binary: hway
|
||||||
builder: go
|
builder: go
|
||||||
gobinary: go
|
gobinary: go
|
||||||
command: build
|
command: build
|
||||||
ldflags:
|
ldflags:
|
||||||
- -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}
|
- -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}
|
||||||
|
|
||||||
- id: dwn
|
- id: motr
|
||||||
goos: [js]
|
goos: [js]
|
||||||
goarch: [wasm]
|
goarch: [wasm]
|
||||||
main: ./cmd/dwn/dwn.go
|
main: ./cmd/motr/motr.go
|
||||||
binary: dwn
|
binary: motr
|
||||||
builder: go
|
builder: go
|
||||||
gobinary: go
|
gobinary: go
|
||||||
command: build
|
command: build
|
||||||
@ -43,8 +43,8 @@ archives:
|
|||||||
- src: README*
|
- src: README*
|
||||||
- src: CHANGELOG*
|
- src: CHANGELOG*
|
||||||
|
|
||||||
- id: motr
|
- id: hway
|
||||||
builds: [motr]
|
builds: [hway]
|
||||||
name_template: '{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ with .Arm }}v{{ . }}{{ end }}{{ with .Mips }}_{{ . }}{{ end }}{{ if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }}'
|
name_template: '{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ with .Arm }}v{{ . }}{{ end }}{{ with .Mips }}_{{ . }}{{ end }}{{ if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }}'
|
||||||
format: tar.gz
|
format: tar.gz
|
||||||
files:
|
files:
|
||||||
@ -72,7 +72,7 @@ brews:
|
|||||||
name: goreleaserbot
|
name: goreleaserbot
|
||||||
email: bot@goreleaser.com
|
email: bot@goreleaser.com
|
||||||
directory: Formula
|
directory: Formula
|
||||||
caveats: "Run a local sonr node and access it with the motr proxy"
|
caveats: "Run a local sonr node and access it with the hway proxy"
|
||||||
homepage: "https://sonr.io/"
|
homepage: "https://sonr.io/"
|
||||||
description: "Sonr is a decentralized, permissionless, and censorship-resistant identity network."
|
description: "Sonr is a decentralized, permissionless, and censorship-resistant identity network."
|
||||||
dependencies:
|
dependencies:
|
||||||
@ -83,13 +83,13 @@ brews:
|
|||||||
branch: master
|
branch: master
|
||||||
token: "{{ .Env.GITHUB_PERSONAL_AUTH_TOKEN }}"
|
token: "{{ .Env.GITHUB_PERSONAL_AUTH_TOKEN }}"
|
||||||
|
|
||||||
- name: motr
|
- name: hway
|
||||||
ids: [motr]
|
ids: [hway]
|
||||||
commit_author:
|
commit_author:
|
||||||
name: goreleaserbot
|
name: goreleaserbot
|
||||||
email: bot@goreleaser.com
|
email: bot@goreleaser.com
|
||||||
directory: Formula
|
directory: Formula
|
||||||
caveats: "Use motr to interact with the Sonr network"
|
caveats: "Use hway to interact with the Sonr network"
|
||||||
homepage: "https://sonr.io/"
|
homepage: "https://sonr.io/"
|
||||||
description: "Motr is a proxy for interacting with the Sonr network."
|
description: "Motr is a proxy for interacting with the Sonr network."
|
||||||
dependencies:
|
dependencies:
|
||||||
@ -118,18 +118,18 @@ dockers:
|
|||||||
- "--label=org.opencontainers.image.version={{.Version}}"
|
- "--label=org.opencontainers.image.version={{.Version}}"
|
||||||
|
|
||||||
- # Motr Binary
|
- # Motr Binary
|
||||||
id: motr
|
id: hway
|
||||||
goos: linux
|
goos: linux
|
||||||
goarch: amd64
|
goarch: amd64
|
||||||
ids:
|
ids:
|
||||||
- motr
|
- hway
|
||||||
image_templates:
|
image_templates:
|
||||||
- "onsonr/motr:latest"
|
- "onsonr/hway:latest"
|
||||||
- "onsonr/motr:{{ .Tag }}"
|
- "onsonr/hway:{{ .Tag }}"
|
||||||
dockerfile: "./deploy/release/motr.Dockerfile"
|
dockerfile: "./deploy/release/hway.Dockerfile"
|
||||||
build_flag_templates:
|
build_flag_templates:
|
||||||
- "--label=org.opencontainers.image.created={{.Date}}"
|
- "--label=org.opencontainers.image.created={{.Date}}"
|
||||||
- "--label=org.opencontainers.image.title=motr"
|
- "--label=org.opencontainers.image.title=hway"
|
||||||
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
|
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
|
||||||
- "--label=org.opencontainers.image.version={{.Version}}"
|
- "--label=org.opencontainers.image.version={{.Version}}"
|
||||||
|
|
||||||
|
18
Makefile
18
Makefile
@ -295,15 +295,15 @@ sh-testnet: mod-tidy
|
|||||||
### templ & vault ###
|
### templ & vault ###
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
.PHONY: dwn motr templ pkl nebula
|
.PHONY: motr hway templ pkl nebula
|
||||||
|
|
||||||
|
hway:
|
||||||
|
@echo "(motr) Building Highway gateway"
|
||||||
|
go build -o ./build/hway ./cmd/hway
|
||||||
|
|
||||||
motr:
|
motr:
|
||||||
@echo "(motr) Building motr gateway"
|
@echo "(dwn) Building motr.wasm -> Service Worker IPFS Vault"
|
||||||
go build -o ./build/motr ./cmd/motr
|
GOOS=js GOARCH=wasm go build -o ./pkg/dwn/app.wasm ./cmd/motr/motr.go
|
||||||
|
|
||||||
dwn:
|
|
||||||
@echo "(dwn) Building dwn.wasm -> IPFS Vault"
|
|
||||||
GOOS=js GOARCH=wasm go build -o ./pkg/dwn/app.wasm ./cmd/dwn/dwn.go
|
|
||||||
|
|
||||||
templ:
|
templ:
|
||||||
@echo "(templ) Generating templ files"
|
@echo "(templ) Generating templ files"
|
||||||
@ -325,9 +325,9 @@ start-caddy:
|
|||||||
@echo "(start-caddy) Starting caddy"
|
@echo "(start-caddy) Starting caddy"
|
||||||
./build/caddy run --config ./config/caddy/Caddyfile
|
./build/caddy run --config ./config/caddy/Caddyfile
|
||||||
|
|
||||||
start-motr: motr
|
start-hway: hway
|
||||||
@echo "(start-proxy) Starting proxy server"
|
@echo "(start-proxy) Starting proxy server"
|
||||||
./build/motr start
|
./build/hway start
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
### help ###
|
### help ###
|
||||||
|
@ -1042,61 +1042,63 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ protoreflect.List = (*_Methods_1_list)(nil)
|
var _ protoreflect.List = (*_Methods_2_list)(nil)
|
||||||
|
|
||||||
type _Methods_1_list struct {
|
type _Methods_2_list struct {
|
||||||
list *[]string
|
list *[]string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *_Methods_1_list) Len() int {
|
func (x *_Methods_2_list) Len() int {
|
||||||
if x.list == nil {
|
if x.list == nil {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
return len(*x.list)
|
return len(*x.list)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *_Methods_1_list) Get(i int) protoreflect.Value {
|
func (x *_Methods_2_list) Get(i int) protoreflect.Value {
|
||||||
return protoreflect.ValueOfString((*x.list)[i])
|
return protoreflect.ValueOfString((*x.list)[i])
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *_Methods_1_list) Set(i int, value protoreflect.Value) {
|
func (x *_Methods_2_list) Set(i int, value protoreflect.Value) {
|
||||||
valueUnwrapped := value.String()
|
valueUnwrapped := value.String()
|
||||||
concreteValue := valueUnwrapped
|
concreteValue := valueUnwrapped
|
||||||
(*x.list)[i] = concreteValue
|
(*x.list)[i] = concreteValue
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *_Methods_1_list) Append(value protoreflect.Value) {
|
func (x *_Methods_2_list) Append(value protoreflect.Value) {
|
||||||
valueUnwrapped := value.String()
|
valueUnwrapped := value.String()
|
||||||
concreteValue := valueUnwrapped
|
concreteValue := valueUnwrapped
|
||||||
*x.list = append(*x.list, concreteValue)
|
*x.list = append(*x.list, concreteValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *_Methods_1_list) AppendMutable() protoreflect.Value {
|
func (x *_Methods_2_list) AppendMutable() protoreflect.Value {
|
||||||
panic(fmt.Errorf("AppendMutable can not be called on message Methods at list field Methods as it is not of Message kind"))
|
panic(fmt.Errorf("AppendMutable can not be called on message Methods at list field Supported as it is not of Message kind"))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *_Methods_1_list) Truncate(n int) {
|
func (x *_Methods_2_list) Truncate(n int) {
|
||||||
*x.list = (*x.list)[:n]
|
*x.list = (*x.list)[:n]
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *_Methods_1_list) NewElement() protoreflect.Value {
|
func (x *_Methods_2_list) NewElement() protoreflect.Value {
|
||||||
v := ""
|
v := ""
|
||||||
return protoreflect.ValueOfString(v)
|
return protoreflect.ValueOfString(v)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *_Methods_1_list) IsValid() bool {
|
func (x *_Methods_2_list) IsValid() bool {
|
||||||
return x.list != nil
|
return x.list != nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
md_Methods protoreflect.MessageDescriptor
|
md_Methods protoreflect.MessageDescriptor
|
||||||
fd_Methods_methods protoreflect.FieldDescriptor
|
fd_Methods_default protoreflect.FieldDescriptor
|
||||||
|
fd_Methods_supported protoreflect.FieldDescriptor
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
file_macaroon_v1_genesis_proto_init()
|
file_macaroon_v1_genesis_proto_init()
|
||||||
md_Methods = File_macaroon_v1_genesis_proto.Messages().ByName("Methods")
|
md_Methods = File_macaroon_v1_genesis_proto.Messages().ByName("Methods")
|
||||||
fd_Methods_methods = md_Methods.Fields().ByName("methods")
|
fd_Methods_default = md_Methods.Fields().ByName("default")
|
||||||
|
fd_Methods_supported = md_Methods.Fields().ByName("supported")
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ protoreflect.Message = (*fastReflection_Methods)(nil)
|
var _ protoreflect.Message = (*fastReflection_Methods)(nil)
|
||||||
@ -1164,9 +1166,15 @@ func (x *fastReflection_Methods) Interface() protoreflect.ProtoMessage {
|
|||||||
// While iterating, mutating operations may only be performed
|
// While iterating, mutating operations may only be performed
|
||||||
// on the current field descriptor.
|
// on the current field descriptor.
|
||||||
func (x *fastReflection_Methods) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
|
func (x *fastReflection_Methods) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
|
||||||
if len(x.Methods) != 0 {
|
if x.Default != "" {
|
||||||
value := protoreflect.ValueOfList(&_Methods_1_list{list: &x.Methods})
|
value := protoreflect.ValueOfString(x.Default)
|
||||||
if !f(fd_Methods_methods, value) {
|
if !f(fd_Methods_default, value) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(x.Supported) != 0 {
|
||||||
|
value := protoreflect.ValueOfList(&_Methods_2_list{list: &x.Supported})
|
||||||
|
if !f(fd_Methods_supported, value) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1185,8 +1193,10 @@ func (x *fastReflection_Methods) Range(f func(protoreflect.FieldDescriptor, prot
|
|||||||
// a repeated field is populated if it is non-empty.
|
// a repeated field is populated if it is non-empty.
|
||||||
func (x *fastReflection_Methods) Has(fd protoreflect.FieldDescriptor) bool {
|
func (x *fastReflection_Methods) Has(fd protoreflect.FieldDescriptor) bool {
|
||||||
switch fd.FullName() {
|
switch fd.FullName() {
|
||||||
case "macaroon.v1.Methods.methods":
|
case "macaroon.v1.Methods.default":
|
||||||
return len(x.Methods) != 0
|
return x.Default != ""
|
||||||
|
case "macaroon.v1.Methods.supported":
|
||||||
|
return len(x.Supported) != 0
|
||||||
default:
|
default:
|
||||||
if fd.IsExtension() {
|
if fd.IsExtension() {
|
||||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.Methods"))
|
panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.Methods"))
|
||||||
@ -1203,8 +1213,10 @@ func (x *fastReflection_Methods) Has(fd protoreflect.FieldDescriptor) bool {
|
|||||||
// Clear is a mutating operation and unsafe for concurrent use.
|
// Clear is a mutating operation and unsafe for concurrent use.
|
||||||
func (x *fastReflection_Methods) Clear(fd protoreflect.FieldDescriptor) {
|
func (x *fastReflection_Methods) Clear(fd protoreflect.FieldDescriptor) {
|
||||||
switch fd.FullName() {
|
switch fd.FullName() {
|
||||||
case "macaroon.v1.Methods.methods":
|
case "macaroon.v1.Methods.default":
|
||||||
x.Methods = nil
|
x.Default = ""
|
||||||
|
case "macaroon.v1.Methods.supported":
|
||||||
|
x.Supported = nil
|
||||||
default:
|
default:
|
||||||
if fd.IsExtension() {
|
if fd.IsExtension() {
|
||||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.Methods"))
|
panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.Methods"))
|
||||||
@ -1221,11 +1233,14 @@ func (x *fastReflection_Methods) Clear(fd protoreflect.FieldDescriptor) {
|
|||||||
// of the value; to obtain a mutable reference, use Mutable.
|
// of the value; to obtain a mutable reference, use Mutable.
|
||||||
func (x *fastReflection_Methods) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value {
|
func (x *fastReflection_Methods) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value {
|
||||||
switch descriptor.FullName() {
|
switch descriptor.FullName() {
|
||||||
case "macaroon.v1.Methods.methods":
|
case "macaroon.v1.Methods.default":
|
||||||
if len(x.Methods) == 0 {
|
value := x.Default
|
||||||
return protoreflect.ValueOfList(&_Methods_1_list{})
|
return protoreflect.ValueOfString(value)
|
||||||
|
case "macaroon.v1.Methods.supported":
|
||||||
|
if len(x.Supported) == 0 {
|
||||||
|
return protoreflect.ValueOfList(&_Methods_2_list{})
|
||||||
}
|
}
|
||||||
listValue := &_Methods_1_list{list: &x.Methods}
|
listValue := &_Methods_2_list{list: &x.Supported}
|
||||||
return protoreflect.ValueOfList(listValue)
|
return protoreflect.ValueOfList(listValue)
|
||||||
default:
|
default:
|
||||||
if descriptor.IsExtension() {
|
if descriptor.IsExtension() {
|
||||||
@ -1247,10 +1262,12 @@ func (x *fastReflection_Methods) Get(descriptor protoreflect.FieldDescriptor) pr
|
|||||||
// Set is a mutating operation and unsafe for concurrent use.
|
// Set is a mutating operation and unsafe for concurrent use.
|
||||||
func (x *fastReflection_Methods) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) {
|
func (x *fastReflection_Methods) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) {
|
||||||
switch fd.FullName() {
|
switch fd.FullName() {
|
||||||
case "macaroon.v1.Methods.methods":
|
case "macaroon.v1.Methods.default":
|
||||||
|
x.Default = value.Interface().(string)
|
||||||
|
case "macaroon.v1.Methods.supported":
|
||||||
lv := value.List()
|
lv := value.List()
|
||||||
clv := lv.(*_Methods_1_list)
|
clv := lv.(*_Methods_2_list)
|
||||||
x.Methods = *clv.list
|
x.Supported = *clv.list
|
||||||
default:
|
default:
|
||||||
if fd.IsExtension() {
|
if fd.IsExtension() {
|
||||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.Methods"))
|
panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.Methods"))
|
||||||
@ -1271,12 +1288,14 @@ func (x *fastReflection_Methods) Set(fd protoreflect.FieldDescriptor, value prot
|
|||||||
// Mutable is a mutating operation and unsafe for concurrent use.
|
// Mutable is a mutating operation and unsafe for concurrent use.
|
||||||
func (x *fastReflection_Methods) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
func (x *fastReflection_Methods) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
||||||
switch fd.FullName() {
|
switch fd.FullName() {
|
||||||
case "macaroon.v1.Methods.methods":
|
case "macaroon.v1.Methods.supported":
|
||||||
if x.Methods == nil {
|
if x.Supported == nil {
|
||||||
x.Methods = []string{}
|
x.Supported = []string{}
|
||||||
}
|
}
|
||||||
value := &_Methods_1_list{list: &x.Methods}
|
value := &_Methods_2_list{list: &x.Supported}
|
||||||
return protoreflect.ValueOfList(value)
|
return protoreflect.ValueOfList(value)
|
||||||
|
case "macaroon.v1.Methods.default":
|
||||||
|
panic(fmt.Errorf("field default of message macaroon.v1.Methods is not mutable"))
|
||||||
default:
|
default:
|
||||||
if fd.IsExtension() {
|
if fd.IsExtension() {
|
||||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.Methods"))
|
panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.Methods"))
|
||||||
@ -1290,9 +1309,11 @@ func (x *fastReflection_Methods) Mutable(fd protoreflect.FieldDescriptor) protor
|
|||||||
// For lists, maps, and messages, this returns a new, empty, mutable value.
|
// For lists, maps, and messages, this returns a new, empty, mutable value.
|
||||||
func (x *fastReflection_Methods) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
func (x *fastReflection_Methods) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
||||||
switch fd.FullName() {
|
switch fd.FullName() {
|
||||||
case "macaroon.v1.Methods.methods":
|
case "macaroon.v1.Methods.default":
|
||||||
|
return protoreflect.ValueOfString("")
|
||||||
|
case "macaroon.v1.Methods.supported":
|
||||||
list := []string{}
|
list := []string{}
|
||||||
return protoreflect.ValueOfList(&_Methods_1_list{list: &list})
|
return protoreflect.ValueOfList(&_Methods_2_list{list: &list})
|
||||||
default:
|
default:
|
||||||
if fd.IsExtension() {
|
if fd.IsExtension() {
|
||||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.Methods"))
|
panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.Methods"))
|
||||||
@ -1362,8 +1383,12 @@ func (x *fastReflection_Methods) ProtoMethods() *protoiface.Methods {
|
|||||||
var n int
|
var n int
|
||||||
var l int
|
var l int
|
||||||
_ = l
|
_ = l
|
||||||
if len(x.Methods) > 0 {
|
l = len(x.Default)
|
||||||
for _, s := range x.Methods {
|
if l > 0 {
|
||||||
|
n += 1 + l + runtime.Sov(uint64(l))
|
||||||
|
}
|
||||||
|
if len(x.Supported) > 0 {
|
||||||
|
for _, s := range x.Supported {
|
||||||
l = len(s)
|
l = len(s)
|
||||||
n += 1 + l + runtime.Sov(uint64(l))
|
n += 1 + l + runtime.Sov(uint64(l))
|
||||||
}
|
}
|
||||||
@ -1397,15 +1422,22 @@ func (x *fastReflection_Methods) ProtoMethods() *protoiface.Methods {
|
|||||||
i -= len(x.unknownFields)
|
i -= len(x.unknownFields)
|
||||||
copy(dAtA[i:], x.unknownFields)
|
copy(dAtA[i:], x.unknownFields)
|
||||||
}
|
}
|
||||||
if len(x.Methods) > 0 {
|
if len(x.Supported) > 0 {
|
||||||
for iNdEx := len(x.Methods) - 1; iNdEx >= 0; iNdEx-- {
|
for iNdEx := len(x.Supported) - 1; iNdEx >= 0; iNdEx-- {
|
||||||
i -= len(x.Methods[iNdEx])
|
i -= len(x.Supported[iNdEx])
|
||||||
copy(dAtA[i:], x.Methods[iNdEx])
|
copy(dAtA[i:], x.Supported[iNdEx])
|
||||||
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Methods[iNdEx])))
|
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Supported[iNdEx])))
|
||||||
|
i--
|
||||||
|
dAtA[i] = 0x12
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(x.Default) > 0 {
|
||||||
|
i -= len(x.Default)
|
||||||
|
copy(dAtA[i:], x.Default)
|
||||||
|
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Default)))
|
||||||
i--
|
i--
|
||||||
dAtA[i] = 0xa
|
dAtA[i] = 0xa
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if input.Buf != nil {
|
if input.Buf != nil {
|
||||||
input.Buf = append(input.Buf, dAtA...)
|
input.Buf = append(input.Buf, dAtA...)
|
||||||
} else {
|
} else {
|
||||||
@ -1457,7 +1489,7 @@ func (x *fastReflection_Methods) ProtoMethods() *protoiface.Methods {
|
|||||||
switch fieldNum {
|
switch fieldNum {
|
||||||
case 1:
|
case 1:
|
||||||
if wireType != 2 {
|
if wireType != 2 {
|
||||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Methods", wireType)
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Default", wireType)
|
||||||
}
|
}
|
||||||
var stringLen uint64
|
var stringLen uint64
|
||||||
for shift := uint(0); ; shift += 7 {
|
for shift := uint(0); ; shift += 7 {
|
||||||
@ -1485,7 +1517,39 @@ func (x *fastReflection_Methods) ProtoMethods() *protoiface.Methods {
|
|||||||
if postIndex > l {
|
if postIndex > l {
|
||||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||||
}
|
}
|
||||||
x.Methods = append(x.Methods, string(dAtA[iNdEx:postIndex]))
|
x.Default = string(dAtA[iNdEx:postIndex])
|
||||||
|
iNdEx = postIndex
|
||||||
|
case 2:
|
||||||
|
if wireType != 2 {
|
||||||
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Supported", wireType)
|
||||||
|
}
|
||||||
|
var stringLen uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
stringLen |= uint64(b&0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
intStringLen := int(stringLen)
|
||||||
|
if intStringLen < 0 {
|
||||||
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + intStringLen
|
||||||
|
if postIndex < 0 {
|
||||||
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||||
|
}
|
||||||
|
if postIndex > l {
|
||||||
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
x.Supported = append(x.Supported, string(dAtA[iNdEx:postIndex]))
|
||||||
iNdEx = postIndex
|
iNdEx = postIndex
|
||||||
default:
|
default:
|
||||||
iNdEx = preIndex
|
iNdEx = preIndex
|
||||||
@ -1522,61 +1586,63 @@ func (x *fastReflection_Methods) ProtoMethods() *protoiface.Methods {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ protoreflect.List = (*_Scopes_1_list)(nil)
|
var _ protoreflect.List = (*_Scopes_2_list)(nil)
|
||||||
|
|
||||||
type _Scopes_1_list struct {
|
type _Scopes_2_list struct {
|
||||||
list *[]string
|
list *[]string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *_Scopes_1_list) Len() int {
|
func (x *_Scopes_2_list) Len() int {
|
||||||
if x.list == nil {
|
if x.list == nil {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
return len(*x.list)
|
return len(*x.list)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *_Scopes_1_list) Get(i int) protoreflect.Value {
|
func (x *_Scopes_2_list) Get(i int) protoreflect.Value {
|
||||||
return protoreflect.ValueOfString((*x.list)[i])
|
return protoreflect.ValueOfString((*x.list)[i])
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *_Scopes_1_list) Set(i int, value protoreflect.Value) {
|
func (x *_Scopes_2_list) Set(i int, value protoreflect.Value) {
|
||||||
valueUnwrapped := value.String()
|
valueUnwrapped := value.String()
|
||||||
concreteValue := valueUnwrapped
|
concreteValue := valueUnwrapped
|
||||||
(*x.list)[i] = concreteValue
|
(*x.list)[i] = concreteValue
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *_Scopes_1_list) Append(value protoreflect.Value) {
|
func (x *_Scopes_2_list) Append(value protoreflect.Value) {
|
||||||
valueUnwrapped := value.String()
|
valueUnwrapped := value.String()
|
||||||
concreteValue := valueUnwrapped
|
concreteValue := valueUnwrapped
|
||||||
*x.list = append(*x.list, concreteValue)
|
*x.list = append(*x.list, concreteValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *_Scopes_1_list) AppendMutable() protoreflect.Value {
|
func (x *_Scopes_2_list) AppendMutable() protoreflect.Value {
|
||||||
panic(fmt.Errorf("AppendMutable can not be called on message Scopes at list field Scopes as it is not of Message kind"))
|
panic(fmt.Errorf("AppendMutable can not be called on message Scopes at list field Supported as it is not of Message kind"))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *_Scopes_1_list) Truncate(n int) {
|
func (x *_Scopes_2_list) Truncate(n int) {
|
||||||
*x.list = (*x.list)[:n]
|
*x.list = (*x.list)[:n]
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *_Scopes_1_list) NewElement() protoreflect.Value {
|
func (x *_Scopes_2_list) NewElement() protoreflect.Value {
|
||||||
v := ""
|
v := ""
|
||||||
return protoreflect.ValueOfString(v)
|
return protoreflect.ValueOfString(v)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *_Scopes_1_list) IsValid() bool {
|
func (x *_Scopes_2_list) IsValid() bool {
|
||||||
return x.list != nil
|
return x.list != nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
md_Scopes protoreflect.MessageDescriptor
|
md_Scopes protoreflect.MessageDescriptor
|
||||||
fd_Scopes_scopes protoreflect.FieldDescriptor
|
fd_Scopes_base protoreflect.FieldDescriptor
|
||||||
|
fd_Scopes_supported protoreflect.FieldDescriptor
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
file_macaroon_v1_genesis_proto_init()
|
file_macaroon_v1_genesis_proto_init()
|
||||||
md_Scopes = File_macaroon_v1_genesis_proto.Messages().ByName("Scopes")
|
md_Scopes = File_macaroon_v1_genesis_proto.Messages().ByName("Scopes")
|
||||||
fd_Scopes_scopes = md_Scopes.Fields().ByName("scopes")
|
fd_Scopes_base = md_Scopes.Fields().ByName("base")
|
||||||
|
fd_Scopes_supported = md_Scopes.Fields().ByName("supported")
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ protoreflect.Message = (*fastReflection_Scopes)(nil)
|
var _ protoreflect.Message = (*fastReflection_Scopes)(nil)
|
||||||
@ -1644,9 +1710,15 @@ func (x *fastReflection_Scopes) Interface() protoreflect.ProtoMessage {
|
|||||||
// While iterating, mutating operations may only be performed
|
// While iterating, mutating operations may only be performed
|
||||||
// on the current field descriptor.
|
// on the current field descriptor.
|
||||||
func (x *fastReflection_Scopes) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
|
func (x *fastReflection_Scopes) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
|
||||||
if len(x.Scopes) != 0 {
|
if x.Base != "" {
|
||||||
value := protoreflect.ValueOfList(&_Scopes_1_list{list: &x.Scopes})
|
value := protoreflect.ValueOfString(x.Base)
|
||||||
if !f(fd_Scopes_scopes, value) {
|
if !f(fd_Scopes_base, value) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(x.Supported) != 0 {
|
||||||
|
value := protoreflect.ValueOfList(&_Scopes_2_list{list: &x.Supported})
|
||||||
|
if !f(fd_Scopes_supported, value) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1665,8 +1737,10 @@ func (x *fastReflection_Scopes) Range(f func(protoreflect.FieldDescriptor, proto
|
|||||||
// a repeated field is populated if it is non-empty.
|
// a repeated field is populated if it is non-empty.
|
||||||
func (x *fastReflection_Scopes) Has(fd protoreflect.FieldDescriptor) bool {
|
func (x *fastReflection_Scopes) Has(fd protoreflect.FieldDescriptor) bool {
|
||||||
switch fd.FullName() {
|
switch fd.FullName() {
|
||||||
case "macaroon.v1.Scopes.scopes":
|
case "macaroon.v1.Scopes.base":
|
||||||
return len(x.Scopes) != 0
|
return x.Base != ""
|
||||||
|
case "macaroon.v1.Scopes.supported":
|
||||||
|
return len(x.Supported) != 0
|
||||||
default:
|
default:
|
||||||
if fd.IsExtension() {
|
if fd.IsExtension() {
|
||||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.Scopes"))
|
panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.Scopes"))
|
||||||
@ -1683,8 +1757,10 @@ func (x *fastReflection_Scopes) Has(fd protoreflect.FieldDescriptor) bool {
|
|||||||
// Clear is a mutating operation and unsafe for concurrent use.
|
// Clear is a mutating operation and unsafe for concurrent use.
|
||||||
func (x *fastReflection_Scopes) Clear(fd protoreflect.FieldDescriptor) {
|
func (x *fastReflection_Scopes) Clear(fd protoreflect.FieldDescriptor) {
|
||||||
switch fd.FullName() {
|
switch fd.FullName() {
|
||||||
case "macaroon.v1.Scopes.scopes":
|
case "macaroon.v1.Scopes.base":
|
||||||
x.Scopes = nil
|
x.Base = ""
|
||||||
|
case "macaroon.v1.Scopes.supported":
|
||||||
|
x.Supported = nil
|
||||||
default:
|
default:
|
||||||
if fd.IsExtension() {
|
if fd.IsExtension() {
|
||||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.Scopes"))
|
panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.Scopes"))
|
||||||
@ -1701,11 +1777,14 @@ func (x *fastReflection_Scopes) Clear(fd protoreflect.FieldDescriptor) {
|
|||||||
// of the value; to obtain a mutable reference, use Mutable.
|
// of the value; to obtain a mutable reference, use Mutable.
|
||||||
func (x *fastReflection_Scopes) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value {
|
func (x *fastReflection_Scopes) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value {
|
||||||
switch descriptor.FullName() {
|
switch descriptor.FullName() {
|
||||||
case "macaroon.v1.Scopes.scopes":
|
case "macaroon.v1.Scopes.base":
|
||||||
if len(x.Scopes) == 0 {
|
value := x.Base
|
||||||
return protoreflect.ValueOfList(&_Scopes_1_list{})
|
return protoreflect.ValueOfString(value)
|
||||||
|
case "macaroon.v1.Scopes.supported":
|
||||||
|
if len(x.Supported) == 0 {
|
||||||
|
return protoreflect.ValueOfList(&_Scopes_2_list{})
|
||||||
}
|
}
|
||||||
listValue := &_Scopes_1_list{list: &x.Scopes}
|
listValue := &_Scopes_2_list{list: &x.Supported}
|
||||||
return protoreflect.ValueOfList(listValue)
|
return protoreflect.ValueOfList(listValue)
|
||||||
default:
|
default:
|
||||||
if descriptor.IsExtension() {
|
if descriptor.IsExtension() {
|
||||||
@ -1727,10 +1806,12 @@ func (x *fastReflection_Scopes) Get(descriptor protoreflect.FieldDescriptor) pro
|
|||||||
// Set is a mutating operation and unsafe for concurrent use.
|
// Set is a mutating operation and unsafe for concurrent use.
|
||||||
func (x *fastReflection_Scopes) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) {
|
func (x *fastReflection_Scopes) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) {
|
||||||
switch fd.FullName() {
|
switch fd.FullName() {
|
||||||
case "macaroon.v1.Scopes.scopes":
|
case "macaroon.v1.Scopes.base":
|
||||||
|
x.Base = value.Interface().(string)
|
||||||
|
case "macaroon.v1.Scopes.supported":
|
||||||
lv := value.List()
|
lv := value.List()
|
||||||
clv := lv.(*_Scopes_1_list)
|
clv := lv.(*_Scopes_2_list)
|
||||||
x.Scopes = *clv.list
|
x.Supported = *clv.list
|
||||||
default:
|
default:
|
||||||
if fd.IsExtension() {
|
if fd.IsExtension() {
|
||||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.Scopes"))
|
panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.Scopes"))
|
||||||
@ -1751,12 +1832,14 @@ func (x *fastReflection_Scopes) Set(fd protoreflect.FieldDescriptor, value proto
|
|||||||
// Mutable is a mutating operation and unsafe for concurrent use.
|
// Mutable is a mutating operation and unsafe for concurrent use.
|
||||||
func (x *fastReflection_Scopes) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
func (x *fastReflection_Scopes) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
||||||
switch fd.FullName() {
|
switch fd.FullName() {
|
||||||
case "macaroon.v1.Scopes.scopes":
|
case "macaroon.v1.Scopes.supported":
|
||||||
if x.Scopes == nil {
|
if x.Supported == nil {
|
||||||
x.Scopes = []string{}
|
x.Supported = []string{}
|
||||||
}
|
}
|
||||||
value := &_Scopes_1_list{list: &x.Scopes}
|
value := &_Scopes_2_list{list: &x.Supported}
|
||||||
return protoreflect.ValueOfList(value)
|
return protoreflect.ValueOfList(value)
|
||||||
|
case "macaroon.v1.Scopes.base":
|
||||||
|
panic(fmt.Errorf("field base of message macaroon.v1.Scopes is not mutable"))
|
||||||
default:
|
default:
|
||||||
if fd.IsExtension() {
|
if fd.IsExtension() {
|
||||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.Scopes"))
|
panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.Scopes"))
|
||||||
@ -1770,9 +1853,11 @@ func (x *fastReflection_Scopes) Mutable(fd protoreflect.FieldDescriptor) protore
|
|||||||
// For lists, maps, and messages, this returns a new, empty, mutable value.
|
// For lists, maps, and messages, this returns a new, empty, mutable value.
|
||||||
func (x *fastReflection_Scopes) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
func (x *fastReflection_Scopes) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
||||||
switch fd.FullName() {
|
switch fd.FullName() {
|
||||||
case "macaroon.v1.Scopes.scopes":
|
case "macaroon.v1.Scopes.base":
|
||||||
|
return protoreflect.ValueOfString("")
|
||||||
|
case "macaroon.v1.Scopes.supported":
|
||||||
list := []string{}
|
list := []string{}
|
||||||
return protoreflect.ValueOfList(&_Scopes_1_list{list: &list})
|
return protoreflect.ValueOfList(&_Scopes_2_list{list: &list})
|
||||||
default:
|
default:
|
||||||
if fd.IsExtension() {
|
if fd.IsExtension() {
|
||||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.Scopes"))
|
panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.Scopes"))
|
||||||
@ -1842,8 +1927,12 @@ func (x *fastReflection_Scopes) ProtoMethods() *protoiface.Methods {
|
|||||||
var n int
|
var n int
|
||||||
var l int
|
var l int
|
||||||
_ = l
|
_ = l
|
||||||
if len(x.Scopes) > 0 {
|
l = len(x.Base)
|
||||||
for _, s := range x.Scopes {
|
if l > 0 {
|
||||||
|
n += 1 + l + runtime.Sov(uint64(l))
|
||||||
|
}
|
||||||
|
if len(x.Supported) > 0 {
|
||||||
|
for _, s := range x.Supported {
|
||||||
l = len(s)
|
l = len(s)
|
||||||
n += 1 + l + runtime.Sov(uint64(l))
|
n += 1 + l + runtime.Sov(uint64(l))
|
||||||
}
|
}
|
||||||
@ -1877,15 +1966,22 @@ func (x *fastReflection_Scopes) ProtoMethods() *protoiface.Methods {
|
|||||||
i -= len(x.unknownFields)
|
i -= len(x.unknownFields)
|
||||||
copy(dAtA[i:], x.unknownFields)
|
copy(dAtA[i:], x.unknownFields)
|
||||||
}
|
}
|
||||||
if len(x.Scopes) > 0 {
|
if len(x.Supported) > 0 {
|
||||||
for iNdEx := len(x.Scopes) - 1; iNdEx >= 0; iNdEx-- {
|
for iNdEx := len(x.Supported) - 1; iNdEx >= 0; iNdEx-- {
|
||||||
i -= len(x.Scopes[iNdEx])
|
i -= len(x.Supported[iNdEx])
|
||||||
copy(dAtA[i:], x.Scopes[iNdEx])
|
copy(dAtA[i:], x.Supported[iNdEx])
|
||||||
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Scopes[iNdEx])))
|
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Supported[iNdEx])))
|
||||||
|
i--
|
||||||
|
dAtA[i] = 0x12
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(x.Base) > 0 {
|
||||||
|
i -= len(x.Base)
|
||||||
|
copy(dAtA[i:], x.Base)
|
||||||
|
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Base)))
|
||||||
i--
|
i--
|
||||||
dAtA[i] = 0xa
|
dAtA[i] = 0xa
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if input.Buf != nil {
|
if input.Buf != nil {
|
||||||
input.Buf = append(input.Buf, dAtA...)
|
input.Buf = append(input.Buf, dAtA...)
|
||||||
} else {
|
} else {
|
||||||
@ -1937,7 +2033,7 @@ func (x *fastReflection_Scopes) ProtoMethods() *protoiface.Methods {
|
|||||||
switch fieldNum {
|
switch fieldNum {
|
||||||
case 1:
|
case 1:
|
||||||
if wireType != 2 {
|
if wireType != 2 {
|
||||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Scopes", wireType)
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Base", wireType)
|
||||||
}
|
}
|
||||||
var stringLen uint64
|
var stringLen uint64
|
||||||
for shift := uint(0); ; shift += 7 {
|
for shift := uint(0); ; shift += 7 {
|
||||||
@ -1965,7 +2061,39 @@ func (x *fastReflection_Scopes) ProtoMethods() *protoiface.Methods {
|
|||||||
if postIndex > l {
|
if postIndex > l {
|
||||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||||
}
|
}
|
||||||
x.Scopes = append(x.Scopes, string(dAtA[iNdEx:postIndex]))
|
x.Base = string(dAtA[iNdEx:postIndex])
|
||||||
|
iNdEx = postIndex
|
||||||
|
case 2:
|
||||||
|
if wireType != 2 {
|
||||||
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Supported", wireType)
|
||||||
|
}
|
||||||
|
var stringLen uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
stringLen |= uint64(b&0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
intStringLen := int(stringLen)
|
||||||
|
if intStringLen < 0 {
|
||||||
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + intStringLen
|
||||||
|
if postIndex < 0 {
|
||||||
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||||
|
}
|
||||||
|
if postIndex > l {
|
||||||
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
x.Supported = append(x.Supported, string(dAtA[iNdEx:postIndex]))
|
||||||
iNdEx = postIndex
|
iNdEx = postIndex
|
||||||
default:
|
default:
|
||||||
iNdEx = preIndex
|
iNdEx = preIndex
|
||||||
@ -2032,7 +2160,7 @@ func (x *_Caveats_1_list) Append(value protoreflect.Value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (x *_Caveats_1_list) AppendMutable() protoreflect.Value {
|
func (x *_Caveats_1_list) AppendMutable() protoreflect.Value {
|
||||||
panic(fmt.Errorf("AppendMutable can not be called on message Caveats at list field Caveats as it is not of Message kind"))
|
panic(fmt.Errorf("AppendMutable can not be called on message Caveats at list field SupportedFirstParty as it is not of Message kind"))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *_Caveats_1_list) Truncate(n int) {
|
func (x *_Caveats_1_list) Truncate(n int) {
|
||||||
@ -2048,15 +2176,63 @@ func (x *_Caveats_1_list) IsValid() bool {
|
|||||||
return x.list != nil
|
return x.list != nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var _ protoreflect.List = (*_Caveats_2_list)(nil)
|
||||||
|
|
||||||
|
type _Caveats_2_list struct {
|
||||||
|
list *[]string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *_Caveats_2_list) Len() int {
|
||||||
|
if x.list == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
return len(*x.list)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *_Caveats_2_list) Get(i int) protoreflect.Value {
|
||||||
|
return protoreflect.ValueOfString((*x.list)[i])
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *_Caveats_2_list) Set(i int, value protoreflect.Value) {
|
||||||
|
valueUnwrapped := value.String()
|
||||||
|
concreteValue := valueUnwrapped
|
||||||
|
(*x.list)[i] = concreteValue
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *_Caveats_2_list) Append(value protoreflect.Value) {
|
||||||
|
valueUnwrapped := value.String()
|
||||||
|
concreteValue := valueUnwrapped
|
||||||
|
*x.list = append(*x.list, concreteValue)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *_Caveats_2_list) AppendMutable() protoreflect.Value {
|
||||||
|
panic(fmt.Errorf("AppendMutable can not be called on message Caveats at list field SupportedThirdParty as it is not of Message kind"))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *_Caveats_2_list) Truncate(n int) {
|
||||||
|
*x.list = (*x.list)[:n]
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *_Caveats_2_list) NewElement() protoreflect.Value {
|
||||||
|
v := ""
|
||||||
|
return protoreflect.ValueOfString(v)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *_Caveats_2_list) IsValid() bool {
|
||||||
|
return x.list != nil
|
||||||
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
md_Caveats protoreflect.MessageDescriptor
|
md_Caveats protoreflect.MessageDescriptor
|
||||||
fd_Caveats_caveats protoreflect.FieldDescriptor
|
fd_Caveats_supported_first_party protoreflect.FieldDescriptor
|
||||||
|
fd_Caveats_supported_third_party protoreflect.FieldDescriptor
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
file_macaroon_v1_genesis_proto_init()
|
file_macaroon_v1_genesis_proto_init()
|
||||||
md_Caveats = File_macaroon_v1_genesis_proto.Messages().ByName("Caveats")
|
md_Caveats = File_macaroon_v1_genesis_proto.Messages().ByName("Caveats")
|
||||||
fd_Caveats_caveats = md_Caveats.Fields().ByName("caveats")
|
fd_Caveats_supported_first_party = md_Caveats.Fields().ByName("supported_first_party")
|
||||||
|
fd_Caveats_supported_third_party = md_Caveats.Fields().ByName("supported_third_party")
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ protoreflect.Message = (*fastReflection_Caveats)(nil)
|
var _ protoreflect.Message = (*fastReflection_Caveats)(nil)
|
||||||
@ -2124,9 +2300,15 @@ func (x *fastReflection_Caveats) Interface() protoreflect.ProtoMessage {
|
|||||||
// While iterating, mutating operations may only be performed
|
// While iterating, mutating operations may only be performed
|
||||||
// on the current field descriptor.
|
// on the current field descriptor.
|
||||||
func (x *fastReflection_Caveats) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
|
func (x *fastReflection_Caveats) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
|
||||||
if len(x.Caveats) != 0 {
|
if len(x.SupportedFirstParty) != 0 {
|
||||||
value := protoreflect.ValueOfList(&_Caveats_1_list{list: &x.Caveats})
|
value := protoreflect.ValueOfList(&_Caveats_1_list{list: &x.SupportedFirstParty})
|
||||||
if !f(fd_Caveats_caveats, value) {
|
if !f(fd_Caveats_supported_first_party, value) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(x.SupportedThirdParty) != 0 {
|
||||||
|
value := protoreflect.ValueOfList(&_Caveats_2_list{list: &x.SupportedThirdParty})
|
||||||
|
if !f(fd_Caveats_supported_third_party, value) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2145,8 +2327,10 @@ func (x *fastReflection_Caveats) Range(f func(protoreflect.FieldDescriptor, prot
|
|||||||
// a repeated field is populated if it is non-empty.
|
// a repeated field is populated if it is non-empty.
|
||||||
func (x *fastReflection_Caveats) Has(fd protoreflect.FieldDescriptor) bool {
|
func (x *fastReflection_Caveats) Has(fd protoreflect.FieldDescriptor) bool {
|
||||||
switch fd.FullName() {
|
switch fd.FullName() {
|
||||||
case "macaroon.v1.Caveats.caveats":
|
case "macaroon.v1.Caveats.supported_first_party":
|
||||||
return len(x.Caveats) != 0
|
return len(x.SupportedFirstParty) != 0
|
||||||
|
case "macaroon.v1.Caveats.supported_third_party":
|
||||||
|
return len(x.SupportedThirdParty) != 0
|
||||||
default:
|
default:
|
||||||
if fd.IsExtension() {
|
if fd.IsExtension() {
|
||||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.Caveats"))
|
panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.Caveats"))
|
||||||
@ -2163,8 +2347,10 @@ func (x *fastReflection_Caveats) Has(fd protoreflect.FieldDescriptor) bool {
|
|||||||
// Clear is a mutating operation and unsafe for concurrent use.
|
// Clear is a mutating operation and unsafe for concurrent use.
|
||||||
func (x *fastReflection_Caveats) Clear(fd protoreflect.FieldDescriptor) {
|
func (x *fastReflection_Caveats) Clear(fd protoreflect.FieldDescriptor) {
|
||||||
switch fd.FullName() {
|
switch fd.FullName() {
|
||||||
case "macaroon.v1.Caveats.caveats":
|
case "macaroon.v1.Caveats.supported_first_party":
|
||||||
x.Caveats = nil
|
x.SupportedFirstParty = nil
|
||||||
|
case "macaroon.v1.Caveats.supported_third_party":
|
||||||
|
x.SupportedThirdParty = nil
|
||||||
default:
|
default:
|
||||||
if fd.IsExtension() {
|
if fd.IsExtension() {
|
||||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.Caveats"))
|
panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.Caveats"))
|
||||||
@ -2181,11 +2367,17 @@ func (x *fastReflection_Caveats) Clear(fd protoreflect.FieldDescriptor) {
|
|||||||
// of the value; to obtain a mutable reference, use Mutable.
|
// of the value; to obtain a mutable reference, use Mutable.
|
||||||
func (x *fastReflection_Caveats) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value {
|
func (x *fastReflection_Caveats) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value {
|
||||||
switch descriptor.FullName() {
|
switch descriptor.FullName() {
|
||||||
case "macaroon.v1.Caveats.caveats":
|
case "macaroon.v1.Caveats.supported_first_party":
|
||||||
if len(x.Caveats) == 0 {
|
if len(x.SupportedFirstParty) == 0 {
|
||||||
return protoreflect.ValueOfList(&_Caveats_1_list{})
|
return protoreflect.ValueOfList(&_Caveats_1_list{})
|
||||||
}
|
}
|
||||||
listValue := &_Caveats_1_list{list: &x.Caveats}
|
listValue := &_Caveats_1_list{list: &x.SupportedFirstParty}
|
||||||
|
return protoreflect.ValueOfList(listValue)
|
||||||
|
case "macaroon.v1.Caveats.supported_third_party":
|
||||||
|
if len(x.SupportedThirdParty) == 0 {
|
||||||
|
return protoreflect.ValueOfList(&_Caveats_2_list{})
|
||||||
|
}
|
||||||
|
listValue := &_Caveats_2_list{list: &x.SupportedThirdParty}
|
||||||
return protoreflect.ValueOfList(listValue)
|
return protoreflect.ValueOfList(listValue)
|
||||||
default:
|
default:
|
||||||
if descriptor.IsExtension() {
|
if descriptor.IsExtension() {
|
||||||
@ -2207,10 +2399,14 @@ func (x *fastReflection_Caveats) Get(descriptor protoreflect.FieldDescriptor) pr
|
|||||||
// Set is a mutating operation and unsafe for concurrent use.
|
// Set is a mutating operation and unsafe for concurrent use.
|
||||||
func (x *fastReflection_Caveats) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) {
|
func (x *fastReflection_Caveats) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) {
|
||||||
switch fd.FullName() {
|
switch fd.FullName() {
|
||||||
case "macaroon.v1.Caveats.caveats":
|
case "macaroon.v1.Caveats.supported_first_party":
|
||||||
lv := value.List()
|
lv := value.List()
|
||||||
clv := lv.(*_Caveats_1_list)
|
clv := lv.(*_Caveats_1_list)
|
||||||
x.Caveats = *clv.list
|
x.SupportedFirstParty = *clv.list
|
||||||
|
case "macaroon.v1.Caveats.supported_third_party":
|
||||||
|
lv := value.List()
|
||||||
|
clv := lv.(*_Caveats_2_list)
|
||||||
|
x.SupportedThirdParty = *clv.list
|
||||||
default:
|
default:
|
||||||
if fd.IsExtension() {
|
if fd.IsExtension() {
|
||||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.Caveats"))
|
panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.Caveats"))
|
||||||
@ -2231,11 +2427,17 @@ func (x *fastReflection_Caveats) Set(fd protoreflect.FieldDescriptor, value prot
|
|||||||
// Mutable is a mutating operation and unsafe for concurrent use.
|
// Mutable is a mutating operation and unsafe for concurrent use.
|
||||||
func (x *fastReflection_Caveats) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
func (x *fastReflection_Caveats) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
||||||
switch fd.FullName() {
|
switch fd.FullName() {
|
||||||
case "macaroon.v1.Caveats.caveats":
|
case "macaroon.v1.Caveats.supported_first_party":
|
||||||
if x.Caveats == nil {
|
if x.SupportedFirstParty == nil {
|
||||||
x.Caveats = []string{}
|
x.SupportedFirstParty = []string{}
|
||||||
}
|
}
|
||||||
value := &_Caveats_1_list{list: &x.Caveats}
|
value := &_Caveats_1_list{list: &x.SupportedFirstParty}
|
||||||
|
return protoreflect.ValueOfList(value)
|
||||||
|
case "macaroon.v1.Caveats.supported_third_party":
|
||||||
|
if x.SupportedThirdParty == nil {
|
||||||
|
x.SupportedThirdParty = []string{}
|
||||||
|
}
|
||||||
|
value := &_Caveats_2_list{list: &x.SupportedThirdParty}
|
||||||
return protoreflect.ValueOfList(value)
|
return protoreflect.ValueOfList(value)
|
||||||
default:
|
default:
|
||||||
if fd.IsExtension() {
|
if fd.IsExtension() {
|
||||||
@ -2250,9 +2452,12 @@ func (x *fastReflection_Caveats) Mutable(fd protoreflect.FieldDescriptor) protor
|
|||||||
// For lists, maps, and messages, this returns a new, empty, mutable value.
|
// For lists, maps, and messages, this returns a new, empty, mutable value.
|
||||||
func (x *fastReflection_Caveats) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
func (x *fastReflection_Caveats) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
||||||
switch fd.FullName() {
|
switch fd.FullName() {
|
||||||
case "macaroon.v1.Caveats.caveats":
|
case "macaroon.v1.Caveats.supported_first_party":
|
||||||
list := []string{}
|
list := []string{}
|
||||||
return protoreflect.ValueOfList(&_Caveats_1_list{list: &list})
|
return protoreflect.ValueOfList(&_Caveats_1_list{list: &list})
|
||||||
|
case "macaroon.v1.Caveats.supported_third_party":
|
||||||
|
list := []string{}
|
||||||
|
return protoreflect.ValueOfList(&_Caveats_2_list{list: &list})
|
||||||
default:
|
default:
|
||||||
if fd.IsExtension() {
|
if fd.IsExtension() {
|
||||||
panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.Caveats"))
|
panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.Caveats"))
|
||||||
@ -2322,8 +2527,14 @@ func (x *fastReflection_Caveats) ProtoMethods() *protoiface.Methods {
|
|||||||
var n int
|
var n int
|
||||||
var l int
|
var l int
|
||||||
_ = l
|
_ = l
|
||||||
if len(x.Caveats) > 0 {
|
if len(x.SupportedFirstParty) > 0 {
|
||||||
for _, s := range x.Caveats {
|
for _, s := range x.SupportedFirstParty {
|
||||||
|
l = len(s)
|
||||||
|
n += 1 + l + runtime.Sov(uint64(l))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(x.SupportedThirdParty) > 0 {
|
||||||
|
for _, s := range x.SupportedThirdParty {
|
||||||
l = len(s)
|
l = len(s)
|
||||||
n += 1 + l + runtime.Sov(uint64(l))
|
n += 1 + l + runtime.Sov(uint64(l))
|
||||||
}
|
}
|
||||||
@ -2357,11 +2568,20 @@ func (x *fastReflection_Caveats) ProtoMethods() *protoiface.Methods {
|
|||||||
i -= len(x.unknownFields)
|
i -= len(x.unknownFields)
|
||||||
copy(dAtA[i:], x.unknownFields)
|
copy(dAtA[i:], x.unknownFields)
|
||||||
}
|
}
|
||||||
if len(x.Caveats) > 0 {
|
if len(x.SupportedThirdParty) > 0 {
|
||||||
for iNdEx := len(x.Caveats) - 1; iNdEx >= 0; iNdEx-- {
|
for iNdEx := len(x.SupportedThirdParty) - 1; iNdEx >= 0; iNdEx-- {
|
||||||
i -= len(x.Caveats[iNdEx])
|
i -= len(x.SupportedThirdParty[iNdEx])
|
||||||
copy(dAtA[i:], x.Caveats[iNdEx])
|
copy(dAtA[i:], x.SupportedThirdParty[iNdEx])
|
||||||
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Caveats[iNdEx])))
|
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.SupportedThirdParty[iNdEx])))
|
||||||
|
i--
|
||||||
|
dAtA[i] = 0x12
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(x.SupportedFirstParty) > 0 {
|
||||||
|
for iNdEx := len(x.SupportedFirstParty) - 1; iNdEx >= 0; iNdEx-- {
|
||||||
|
i -= len(x.SupportedFirstParty[iNdEx])
|
||||||
|
copy(dAtA[i:], x.SupportedFirstParty[iNdEx])
|
||||||
|
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.SupportedFirstParty[iNdEx])))
|
||||||
i--
|
i--
|
||||||
dAtA[i] = 0xa
|
dAtA[i] = 0xa
|
||||||
}
|
}
|
||||||
@ -2417,7 +2637,7 @@ func (x *fastReflection_Caveats) ProtoMethods() *protoiface.Methods {
|
|||||||
switch fieldNum {
|
switch fieldNum {
|
||||||
case 1:
|
case 1:
|
||||||
if wireType != 2 {
|
if wireType != 2 {
|
||||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Caveats", wireType)
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field SupportedFirstParty", wireType)
|
||||||
}
|
}
|
||||||
var stringLen uint64
|
var stringLen uint64
|
||||||
for shift := uint(0); ; shift += 7 {
|
for shift := uint(0); ; shift += 7 {
|
||||||
@ -2445,7 +2665,39 @@ func (x *fastReflection_Caveats) ProtoMethods() *protoiface.Methods {
|
|||||||
if postIndex > l {
|
if postIndex > l {
|
||||||
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||||
}
|
}
|
||||||
x.Caveats = append(x.Caveats, string(dAtA[iNdEx:postIndex]))
|
x.SupportedFirstParty = append(x.SupportedFirstParty, string(dAtA[iNdEx:postIndex]))
|
||||||
|
iNdEx = postIndex
|
||||||
|
case 2:
|
||||||
|
if wireType != 2 {
|
||||||
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field SupportedThirdParty", wireType)
|
||||||
|
}
|
||||||
|
var stringLen uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
stringLen |= uint64(b&0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
intStringLen := int(stringLen)
|
||||||
|
if intStringLen < 0 {
|
||||||
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + intStringLen
|
||||||
|
if postIndex < 0 {
|
||||||
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||||
|
}
|
||||||
|
if postIndex > l {
|
||||||
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
x.SupportedThirdParty = append(x.SupportedThirdParty, string(dAtA[iNdEx:postIndex]))
|
||||||
iNdEx = postIndex
|
iNdEx = postIndex
|
||||||
default:
|
default:
|
||||||
iNdEx = preIndex
|
iNdEx = preIndex
|
||||||
@ -2593,7 +2845,8 @@ type Methods struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
Methods []string `protobuf:"bytes,1,rep,name=methods,proto3" json:"methods,omitempty"`
|
Default string `protobuf:"bytes,1,opt,name=default,proto3" json:"default,omitempty"`
|
||||||
|
Supported []string `protobuf:"bytes,2,rep,name=supported,proto3" json:"supported,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Methods) Reset() {
|
func (x *Methods) Reset() {
|
||||||
@ -2616,9 +2869,16 @@ func (*Methods) Descriptor() ([]byte, []int) {
|
|||||||
return file_macaroon_v1_genesis_proto_rawDescGZIP(), []int{2}
|
return file_macaroon_v1_genesis_proto_rawDescGZIP(), []int{2}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Methods) GetMethods() []string {
|
func (x *Methods) GetDefault() string {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Methods
|
return x.Default
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Methods) GetSupported() []string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Supported
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -2629,7 +2889,8 @@ type Scopes struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
Scopes []string `protobuf:"bytes,1,rep,name=scopes,proto3" json:"scopes,omitempty"`
|
Base string `protobuf:"bytes,1,opt,name=base,proto3" json:"base,omitempty"`
|
||||||
|
Supported []string `protobuf:"bytes,2,rep,name=supported,proto3" json:"supported,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Scopes) Reset() {
|
func (x *Scopes) Reset() {
|
||||||
@ -2652,9 +2913,16 @@ func (*Scopes) Descriptor() ([]byte, []int) {
|
|||||||
return file_macaroon_v1_genesis_proto_rawDescGZIP(), []int{3}
|
return file_macaroon_v1_genesis_proto_rawDescGZIP(), []int{3}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Scopes) GetScopes() []string {
|
func (x *Scopes) GetBase() string {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Scopes
|
return x.Base
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Scopes) GetSupported() []string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Supported
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -2665,7 +2933,8 @@ type Caveats struct {
|
|||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
Caveats []string `protobuf:"bytes,1,rep,name=caveats,proto3" json:"caveats,omitempty"`
|
SupportedFirstParty []string `protobuf:"bytes,1,rep,name=supported_first_party,json=supportedFirstParty,proto3" json:"supported_first_party,omitempty"`
|
||||||
|
SupportedThirdParty []string `protobuf:"bytes,2,rep,name=supported_third_party,json=supportedThirdParty,proto3" json:"supported_third_party,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Caveats) Reset() {
|
func (x *Caveats) Reset() {
|
||||||
@ -2688,9 +2957,16 @@ func (*Caveats) Descriptor() ([]byte, []int) {
|
|||||||
return file_macaroon_v1_genesis_proto_rawDescGZIP(), []int{4}
|
return file_macaroon_v1_genesis_proto_rawDescGZIP(), []int{4}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *Caveats) GetCaveats() []string {
|
func (x *Caveats) GetSupportedFirstParty() []string {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.Caveats
|
return x.SupportedFirstParty
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Caveats) GetSupportedThirdParty() []string {
|
||||||
|
if x != nil {
|
||||||
|
return x.SupportedThirdParty
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -2718,29 +2994,38 @@ var file_macaroon_v1_genesis_proto_rawDesc = []byte{
|
|||||||
0x6d, 0x61, 0x63, 0x61, 0x72, 0x6f, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x61, 0x76, 0x65,
|
0x6d, 0x61, 0x63, 0x61, 0x72, 0x6f, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x61, 0x76, 0x65,
|
||||||
0x61, 0x74, 0x73, 0x52, 0x07, 0x63, 0x61, 0x76, 0x65, 0x61, 0x74, 0x73, 0x3a, 0x1c, 0x98, 0xa0,
|
0x61, 0x74, 0x73, 0x52, 0x07, 0x63, 0x61, 0x76, 0x65, 0x61, 0x74, 0x73, 0x3a, 0x1c, 0x98, 0xa0,
|
||||||
0x1f, 0x00, 0xe8, 0xa0, 0x1f, 0x01, 0x8a, 0xe7, 0xb0, 0x2a, 0x0f, 0x6d, 0x61, 0x63, 0x61, 0x72,
|
0x1f, 0x00, 0xe8, 0xa0, 0x1f, 0x01, 0x8a, 0xe7, 0xb0, 0x2a, 0x0f, 0x6d, 0x61, 0x63, 0x61, 0x72,
|
||||||
0x6f, 0x6f, 0x6e, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x3e, 0x0a, 0x07, 0x4d, 0x65,
|
0x6f, 0x6f, 0x6e, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x5c, 0x0a, 0x07, 0x4d, 0x65,
|
||||||
0x74, 0x68, 0x6f, 0x64, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73,
|
0x74, 0x68, 0x6f, 0x64, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74,
|
||||||
0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x3a,
|
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x12,
|
||||||
0x19, 0xe8, 0xa0, 0x1f, 0x01, 0x8a, 0xe7, 0xb0, 0x2a, 0x10, 0x6d, 0x61, 0x63, 0x61, 0x72, 0x6f,
|
0x1c, 0x0a, 0x09, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x18, 0x02, 0x20, 0x03,
|
||||||
0x6f, 0x6e, 0x2f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x22, 0x3a, 0x0a, 0x06, 0x53, 0x63,
|
0x28, 0x09, 0x52, 0x09, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x3a, 0x19, 0xe8,
|
||||||
0x6f, 0x70, 0x65, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x18, 0x01,
|
0xa0, 0x1f, 0x01, 0x8a, 0xe7, 0xb0, 0x2a, 0x10, 0x6d, 0x61, 0x63, 0x61, 0x72, 0x6f, 0x6f, 0x6e,
|
||||||
0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x3a, 0x18, 0xe8, 0xa0,
|
0x2f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x73, 0x22, 0x54, 0x0a, 0x06, 0x53, 0x63, 0x6f, 0x70,
|
||||||
0x1f, 0x01, 0x8a, 0xe7, 0xb0, 0x2a, 0x0f, 0x6d, 0x61, 0x63, 0x61, 0x72, 0x6f, 0x6f, 0x6e, 0x2f,
|
0x65, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x62, 0x61, 0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
|
||||||
0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x22, 0x3d, 0x0a, 0x07, 0x43, 0x61, 0x76, 0x65, 0x61, 0x74,
|
0x52, 0x04, 0x62, 0x61, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72,
|
||||||
0x73, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x61, 0x76, 0x65, 0x61, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03,
|
0x74, 0x65, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x73, 0x75, 0x70, 0x70, 0x6f,
|
||||||
0x28, 0x09, 0x52, 0x07, 0x63, 0x61, 0x76, 0x65, 0x61, 0x74, 0x73, 0x3a, 0x18, 0xe8, 0xa0, 0x1f,
|
0x72, 0x74, 0x65, 0x64, 0x3a, 0x18, 0xe8, 0xa0, 0x1f, 0x01, 0x8a, 0xe7, 0xb0, 0x2a, 0x0f, 0x6d,
|
||||||
0x01, 0x8a, 0xe7, 0xb0, 0x2a, 0x0f, 0x6d, 0x61, 0x63, 0x61, 0x72, 0x6f, 0x6f, 0x6e, 0x2f, 0x63,
|
0x61, 0x63, 0x61, 0x72, 0x6f, 0x6f, 0x6e, 0x2f, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x73, 0x22, 0x8b,
|
||||||
0x61, 0x76, 0x65, 0x61, 0x74, 0x42, 0x9f, 0x01, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x61,
|
0x01, 0x0a, 0x07, 0x43, 0x61, 0x76, 0x65, 0x61, 0x74, 0x73, 0x12, 0x32, 0x0a, 0x15, 0x73, 0x75,
|
||||||
0x63, 0x61, 0x72, 0x6f, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x42, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73,
|
0x70, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x5f, 0x66, 0x69, 0x72, 0x73, 0x74, 0x5f, 0x70, 0x61,
|
||||||
0x69, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x31, 0x67, 0x69, 0x74, 0x68, 0x75,
|
0x72, 0x74, 0x79, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x13, 0x73, 0x75, 0x70, 0x70, 0x6f,
|
||||||
0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x6e, 0x73, 0x6f, 0x6e, 0x72, 0x2f, 0x73, 0x6f, 0x6e,
|
0x72, 0x74, 0x65, 0x64, 0x46, 0x69, 0x72, 0x73, 0x74, 0x50, 0x61, 0x72, 0x74, 0x79, 0x12, 0x32,
|
||||||
0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6d, 0x61, 0x63, 0x61, 0x72, 0x6f, 0x6f, 0x6e, 0x2f, 0x76,
|
0x0a, 0x15, 0x73, 0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x68, 0x69, 0x72,
|
||||||
0x31, 0x3b, 0x6d, 0x61, 0x63, 0x61, 0x72, 0x6f, 0x6f, 0x6e, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x4d,
|
0x64, 0x5f, 0x70, 0x61, 0x72, 0x74, 0x79, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x13, 0x73,
|
||||||
0x58, 0x58, 0xaa, 0x02, 0x0b, 0x4d, 0x61, 0x63, 0x61, 0x72, 0x6f, 0x6f, 0x6e, 0x2e, 0x56, 0x31,
|
0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x65, 0x64, 0x54, 0x68, 0x69, 0x72, 0x64, 0x50, 0x61, 0x72,
|
||||||
0xca, 0x02, 0x0b, 0x4d, 0x61, 0x63, 0x61, 0x72, 0x6f, 0x6f, 0x6e, 0x5c, 0x56, 0x31, 0xe2, 0x02,
|
0x74, 0x79, 0x3a, 0x18, 0xe8, 0xa0, 0x1f, 0x01, 0x8a, 0xe7, 0xb0, 0x2a, 0x0f, 0x6d, 0x61, 0x63,
|
||||||
0x17, 0x4d, 0x61, 0x63, 0x61, 0x72, 0x6f, 0x6f, 0x6e, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42,
|
0x61, 0x72, 0x6f, 0x6f, 0x6e, 0x2f, 0x63, 0x61, 0x76, 0x65, 0x61, 0x74, 0x42, 0x9f, 0x01, 0x0a,
|
||||||
0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0c, 0x4d, 0x61, 0x63, 0x61, 0x72,
|
0x0f, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x61, 0x63, 0x61, 0x72, 0x6f, 0x6f, 0x6e, 0x2e, 0x76, 0x31,
|
||||||
0x6f, 0x6f, 0x6e, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x42, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01,
|
||||||
|
0x5a, 0x31, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x6e, 0x73,
|
||||||
|
0x6f, 0x6e, 0x72, 0x2f, 0x73, 0x6f, 0x6e, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6d, 0x61, 0x63,
|
||||||
|
0x61, 0x72, 0x6f, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x3b, 0x6d, 0x61, 0x63, 0x61, 0x72, 0x6f, 0x6f,
|
||||||
|
0x6e, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x4d, 0x58, 0x58, 0xaa, 0x02, 0x0b, 0x4d, 0x61, 0x63, 0x61,
|
||||||
|
0x72, 0x6f, 0x6f, 0x6e, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0b, 0x4d, 0x61, 0x63, 0x61, 0x72, 0x6f,
|
||||||
|
0x6f, 0x6e, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x17, 0x4d, 0x61, 0x63, 0x61, 0x72, 0x6f, 0x6f, 0x6e,
|
||||||
|
0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea,
|
||||||
|
0x02, 0x0c, 0x4d, 0x61, 0x63, 0x61, 0x72, 0x6f, 0x6f, 0x6e, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06,
|
||||||
|
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -176,20 +176,193 @@ func NewGrantTable(db ormtable.Schema) (GrantTable, error) {
|
|||||||
return grantTable{table.(ormtable.AutoIncrementTable)}, nil
|
return grantTable{table.(ormtable.AutoIncrementTable)}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type MacaroonTable interface {
|
||||||
|
Insert(ctx context.Context, macaroon *Macaroon) error
|
||||||
|
InsertReturningId(ctx context.Context, macaroon *Macaroon) (uint64, error)
|
||||||
|
LastInsertedSequence(ctx context.Context) (uint64, error)
|
||||||
|
Update(ctx context.Context, macaroon *Macaroon) error
|
||||||
|
Save(ctx context.Context, macaroon *Macaroon) error
|
||||||
|
Delete(ctx context.Context, macaroon *Macaroon) error
|
||||||
|
Has(ctx context.Context, id uint64) (found bool, err error)
|
||||||
|
// Get returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
|
||||||
|
Get(ctx context.Context, id uint64) (*Macaroon, error)
|
||||||
|
HasBySubjectOrigin(ctx context.Context, subject string, origin string) (found bool, err error)
|
||||||
|
// GetBySubjectOrigin returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
|
||||||
|
GetBySubjectOrigin(ctx context.Context, subject string, origin string) (*Macaroon, error)
|
||||||
|
List(ctx context.Context, prefixKey MacaroonIndexKey, opts ...ormlist.Option) (MacaroonIterator, error)
|
||||||
|
ListRange(ctx context.Context, from, to MacaroonIndexKey, opts ...ormlist.Option) (MacaroonIterator, error)
|
||||||
|
DeleteBy(ctx context.Context, prefixKey MacaroonIndexKey) error
|
||||||
|
DeleteRange(ctx context.Context, from, to MacaroonIndexKey) error
|
||||||
|
|
||||||
|
doNotImplement()
|
||||||
|
}
|
||||||
|
|
||||||
|
type MacaroonIterator struct {
|
||||||
|
ormtable.Iterator
|
||||||
|
}
|
||||||
|
|
||||||
|
func (i MacaroonIterator) Value() (*Macaroon, error) {
|
||||||
|
var macaroon Macaroon
|
||||||
|
err := i.UnmarshalMessage(&macaroon)
|
||||||
|
return &macaroon, err
|
||||||
|
}
|
||||||
|
|
||||||
|
type MacaroonIndexKey interface {
|
||||||
|
id() uint32
|
||||||
|
values() []interface{}
|
||||||
|
macaroonIndexKey()
|
||||||
|
}
|
||||||
|
|
||||||
|
// primary key starting index..
|
||||||
|
type MacaroonPrimaryKey = MacaroonIdIndexKey
|
||||||
|
|
||||||
|
type MacaroonIdIndexKey struct {
|
||||||
|
vs []interface{}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x MacaroonIdIndexKey) id() uint32 { return 0 }
|
||||||
|
func (x MacaroonIdIndexKey) values() []interface{} { return x.vs }
|
||||||
|
func (x MacaroonIdIndexKey) macaroonIndexKey() {}
|
||||||
|
|
||||||
|
func (this MacaroonIdIndexKey) WithId(id uint64) MacaroonIdIndexKey {
|
||||||
|
this.vs = []interface{}{id}
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
type MacaroonSubjectOriginIndexKey struct {
|
||||||
|
vs []interface{}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x MacaroonSubjectOriginIndexKey) id() uint32 { return 1 }
|
||||||
|
func (x MacaroonSubjectOriginIndexKey) values() []interface{} { return x.vs }
|
||||||
|
func (x MacaroonSubjectOriginIndexKey) macaroonIndexKey() {}
|
||||||
|
|
||||||
|
func (this MacaroonSubjectOriginIndexKey) WithSubject(subject string) MacaroonSubjectOriginIndexKey {
|
||||||
|
this.vs = []interface{}{subject}
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this MacaroonSubjectOriginIndexKey) WithSubjectOrigin(subject string, origin string) MacaroonSubjectOriginIndexKey {
|
||||||
|
this.vs = []interface{}{subject, origin}
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
type macaroonTable struct {
|
||||||
|
table ormtable.AutoIncrementTable
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this macaroonTable) Insert(ctx context.Context, macaroon *Macaroon) error {
|
||||||
|
return this.table.Insert(ctx, macaroon)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this macaroonTable) Update(ctx context.Context, macaroon *Macaroon) error {
|
||||||
|
return this.table.Update(ctx, macaroon)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this macaroonTable) Save(ctx context.Context, macaroon *Macaroon) error {
|
||||||
|
return this.table.Save(ctx, macaroon)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this macaroonTable) Delete(ctx context.Context, macaroon *Macaroon) error {
|
||||||
|
return this.table.Delete(ctx, macaroon)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this macaroonTable) InsertReturningId(ctx context.Context, macaroon *Macaroon) (uint64, error) {
|
||||||
|
return this.table.InsertReturningPKey(ctx, macaroon)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this macaroonTable) LastInsertedSequence(ctx context.Context) (uint64, error) {
|
||||||
|
return this.table.LastInsertedSequence(ctx)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this macaroonTable) Has(ctx context.Context, id uint64) (found bool, err error) {
|
||||||
|
return this.table.PrimaryKey().Has(ctx, id)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this macaroonTable) Get(ctx context.Context, id uint64) (*Macaroon, error) {
|
||||||
|
var macaroon Macaroon
|
||||||
|
found, err := this.table.PrimaryKey().Get(ctx, &macaroon, id)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if !found {
|
||||||
|
return nil, ormerrors.NotFound
|
||||||
|
}
|
||||||
|
return &macaroon, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this macaroonTable) HasBySubjectOrigin(ctx context.Context, subject string, origin string) (found bool, err error) {
|
||||||
|
return this.table.GetIndexByID(1).(ormtable.UniqueIndex).Has(ctx,
|
||||||
|
subject,
|
||||||
|
origin,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this macaroonTable) GetBySubjectOrigin(ctx context.Context, subject string, origin string) (*Macaroon, error) {
|
||||||
|
var macaroon Macaroon
|
||||||
|
found, err := this.table.GetIndexByID(1).(ormtable.UniqueIndex).Get(ctx, &macaroon,
|
||||||
|
subject,
|
||||||
|
origin,
|
||||||
|
)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if !found {
|
||||||
|
return nil, ormerrors.NotFound
|
||||||
|
}
|
||||||
|
return &macaroon, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this macaroonTable) List(ctx context.Context, prefixKey MacaroonIndexKey, opts ...ormlist.Option) (MacaroonIterator, error) {
|
||||||
|
it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...)
|
||||||
|
return MacaroonIterator{it}, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this macaroonTable) ListRange(ctx context.Context, from, to MacaroonIndexKey, opts ...ormlist.Option) (MacaroonIterator, error) {
|
||||||
|
it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...)
|
||||||
|
return MacaroonIterator{it}, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this macaroonTable) DeleteBy(ctx context.Context, prefixKey MacaroonIndexKey) error {
|
||||||
|
return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this macaroonTable) DeleteRange(ctx context.Context, from, to MacaroonIndexKey) error {
|
||||||
|
return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values())
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this macaroonTable) doNotImplement() {}
|
||||||
|
|
||||||
|
var _ MacaroonTable = macaroonTable{}
|
||||||
|
|
||||||
|
func NewMacaroonTable(db ormtable.Schema) (MacaroonTable, error) {
|
||||||
|
table := db.GetTable(&Macaroon{})
|
||||||
|
if table == nil {
|
||||||
|
return nil, ormerrors.TableNotFound.Wrap(string((&Macaroon{}).ProtoReflect().Descriptor().FullName()))
|
||||||
|
}
|
||||||
|
return macaroonTable{table.(ormtable.AutoIncrementTable)}, nil
|
||||||
|
}
|
||||||
|
|
||||||
type StateStore interface {
|
type StateStore interface {
|
||||||
GrantTable() GrantTable
|
GrantTable() GrantTable
|
||||||
|
MacaroonTable() MacaroonTable
|
||||||
|
|
||||||
doNotImplement()
|
doNotImplement()
|
||||||
}
|
}
|
||||||
|
|
||||||
type stateStore struct {
|
type stateStore struct {
|
||||||
grant GrantTable
|
grant GrantTable
|
||||||
|
macaroon MacaroonTable
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x stateStore) GrantTable() GrantTable {
|
func (x stateStore) GrantTable() GrantTable {
|
||||||
return x.grant
|
return x.grant
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x stateStore) MacaroonTable() MacaroonTable {
|
||||||
|
return x.macaroon
|
||||||
|
}
|
||||||
|
|
||||||
func (stateStore) doNotImplement() {}
|
func (stateStore) doNotImplement() {}
|
||||||
|
|
||||||
var _ StateStore = stateStore{}
|
var _ StateStore = stateStore{}
|
||||||
@ -200,7 +373,13 @@ func NewStateStore(db ormtable.Schema) (StateStore, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
macaroonTable, err := NewMacaroonTable(db)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
return stateStore{
|
return stateStore{
|
||||||
grantTable,
|
grantTable,
|
||||||
|
macaroonTable,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
@ -657,6 +657,714 @@ func (x *fastReflection_Grant) ProtoMethods() *protoiface.Methods {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
md_Macaroon protoreflect.MessageDescriptor
|
||||||
|
fd_Macaroon_id protoreflect.FieldDescriptor
|
||||||
|
fd_Macaroon_controller protoreflect.FieldDescriptor
|
||||||
|
fd_Macaroon_subject protoreflect.FieldDescriptor
|
||||||
|
fd_Macaroon_origin protoreflect.FieldDescriptor
|
||||||
|
fd_Macaroon_expiry_height protoreflect.FieldDescriptor
|
||||||
|
fd_Macaroon_macaroon protoreflect.FieldDescriptor
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
file_macaroon_v1_state_proto_init()
|
||||||
|
md_Macaroon = File_macaroon_v1_state_proto.Messages().ByName("Macaroon")
|
||||||
|
fd_Macaroon_id = md_Macaroon.Fields().ByName("id")
|
||||||
|
fd_Macaroon_controller = md_Macaroon.Fields().ByName("controller")
|
||||||
|
fd_Macaroon_subject = md_Macaroon.Fields().ByName("subject")
|
||||||
|
fd_Macaroon_origin = md_Macaroon.Fields().ByName("origin")
|
||||||
|
fd_Macaroon_expiry_height = md_Macaroon.Fields().ByName("expiry_height")
|
||||||
|
fd_Macaroon_macaroon = md_Macaroon.Fields().ByName("macaroon")
|
||||||
|
}
|
||||||
|
|
||||||
|
var _ protoreflect.Message = (*fastReflection_Macaroon)(nil)
|
||||||
|
|
||||||
|
type fastReflection_Macaroon Macaroon
|
||||||
|
|
||||||
|
func (x *Macaroon) ProtoReflect() protoreflect.Message {
|
||||||
|
return (*fastReflection_Macaroon)(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Macaroon) slowProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_macaroon_v1_state_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)
|
||||||
|
}
|
||||||
|
|
||||||
|
var _fastReflection_Macaroon_messageType fastReflection_Macaroon_messageType
|
||||||
|
var _ protoreflect.MessageType = fastReflection_Macaroon_messageType{}
|
||||||
|
|
||||||
|
type fastReflection_Macaroon_messageType struct{}
|
||||||
|
|
||||||
|
func (x fastReflection_Macaroon_messageType) Zero() protoreflect.Message {
|
||||||
|
return (*fastReflection_Macaroon)(nil)
|
||||||
|
}
|
||||||
|
func (x fastReflection_Macaroon_messageType) New() protoreflect.Message {
|
||||||
|
return new(fastReflection_Macaroon)
|
||||||
|
}
|
||||||
|
func (x fastReflection_Macaroon_messageType) Descriptor() protoreflect.MessageDescriptor {
|
||||||
|
return md_Macaroon
|
||||||
|
}
|
||||||
|
|
||||||
|
// Descriptor returns message descriptor, which contains only the protobuf
|
||||||
|
// type information for the message.
|
||||||
|
func (x *fastReflection_Macaroon) Descriptor() protoreflect.MessageDescriptor {
|
||||||
|
return md_Macaroon
|
||||||
|
}
|
||||||
|
|
||||||
|
// Type returns the message type, which encapsulates both Go and protobuf
|
||||||
|
// type information. If the Go type information is not needed,
|
||||||
|
// it is recommended that the message descriptor be used instead.
|
||||||
|
func (x *fastReflection_Macaroon) Type() protoreflect.MessageType {
|
||||||
|
return _fastReflection_Macaroon_messageType
|
||||||
|
}
|
||||||
|
|
||||||
|
// New returns a newly allocated and mutable empty message.
|
||||||
|
func (x *fastReflection_Macaroon) New() protoreflect.Message {
|
||||||
|
return new(fastReflection_Macaroon)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Interface unwraps the message reflection interface and
|
||||||
|
// returns the underlying ProtoMessage interface.
|
||||||
|
func (x *fastReflection_Macaroon) Interface() protoreflect.ProtoMessage {
|
||||||
|
return (*Macaroon)(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Range iterates over every populated field in an undefined order,
|
||||||
|
// calling f for each field descriptor and value encountered.
|
||||||
|
// Range returns immediately if f returns false.
|
||||||
|
// While iterating, mutating operations may only be performed
|
||||||
|
// on the current field descriptor.
|
||||||
|
func (x *fastReflection_Macaroon) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
|
||||||
|
if x.Id != uint64(0) {
|
||||||
|
value := protoreflect.ValueOfUint64(x.Id)
|
||||||
|
if !f(fd_Macaroon_id, value) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if x.Controller != "" {
|
||||||
|
value := protoreflect.ValueOfString(x.Controller)
|
||||||
|
if !f(fd_Macaroon_controller, value) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if x.Subject != "" {
|
||||||
|
value := protoreflect.ValueOfString(x.Subject)
|
||||||
|
if !f(fd_Macaroon_subject, value) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if x.Origin != "" {
|
||||||
|
value := protoreflect.ValueOfString(x.Origin)
|
||||||
|
if !f(fd_Macaroon_origin, value) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if x.ExpiryHeight != int64(0) {
|
||||||
|
value := protoreflect.ValueOfInt64(x.ExpiryHeight)
|
||||||
|
if !f(fd_Macaroon_expiry_height, value) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if x.Macaroon != "" {
|
||||||
|
value := protoreflect.ValueOfString(x.Macaroon)
|
||||||
|
if !f(fd_Macaroon_macaroon, value) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Has reports whether a field is populated.
|
||||||
|
//
|
||||||
|
// Some fields have the property of nullability where it is possible to
|
||||||
|
// distinguish between the default value of a field and whether the field
|
||||||
|
// was explicitly populated with the default value. Singular message fields,
|
||||||
|
// member fields of a oneof, and proto2 scalar fields are nullable. Such
|
||||||
|
// fields are populated only if explicitly set.
|
||||||
|
//
|
||||||
|
// In other cases (aside from the nullable cases above),
|
||||||
|
// a proto3 scalar field is populated if it contains a non-zero value, and
|
||||||
|
// a repeated field is populated if it is non-empty.
|
||||||
|
func (x *fastReflection_Macaroon) Has(fd protoreflect.FieldDescriptor) bool {
|
||||||
|
switch fd.FullName() {
|
||||||
|
case "macaroon.v1.Macaroon.id":
|
||||||
|
return x.Id != uint64(0)
|
||||||
|
case "macaroon.v1.Macaroon.controller":
|
||||||
|
return x.Controller != ""
|
||||||
|
case "macaroon.v1.Macaroon.subject":
|
||||||
|
return x.Subject != ""
|
||||||
|
case "macaroon.v1.Macaroon.origin":
|
||||||
|
return x.Origin != ""
|
||||||
|
case "macaroon.v1.Macaroon.expiry_height":
|
||||||
|
return x.ExpiryHeight != int64(0)
|
||||||
|
case "macaroon.v1.Macaroon.macaroon":
|
||||||
|
return x.Macaroon != ""
|
||||||
|
default:
|
||||||
|
if fd.IsExtension() {
|
||||||
|
panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.Macaroon"))
|
||||||
|
}
|
||||||
|
panic(fmt.Errorf("message macaroon.v1.Macaroon does not contain field %s", fd.FullName()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clear clears the field such that a subsequent Has call reports false.
|
||||||
|
//
|
||||||
|
// Clearing an extension field clears both the extension type and value
|
||||||
|
// associated with the given field number.
|
||||||
|
//
|
||||||
|
// Clear is a mutating operation and unsafe for concurrent use.
|
||||||
|
func (x *fastReflection_Macaroon) Clear(fd protoreflect.FieldDescriptor) {
|
||||||
|
switch fd.FullName() {
|
||||||
|
case "macaroon.v1.Macaroon.id":
|
||||||
|
x.Id = uint64(0)
|
||||||
|
case "macaroon.v1.Macaroon.controller":
|
||||||
|
x.Controller = ""
|
||||||
|
case "macaroon.v1.Macaroon.subject":
|
||||||
|
x.Subject = ""
|
||||||
|
case "macaroon.v1.Macaroon.origin":
|
||||||
|
x.Origin = ""
|
||||||
|
case "macaroon.v1.Macaroon.expiry_height":
|
||||||
|
x.ExpiryHeight = int64(0)
|
||||||
|
case "macaroon.v1.Macaroon.macaroon":
|
||||||
|
x.Macaroon = ""
|
||||||
|
default:
|
||||||
|
if fd.IsExtension() {
|
||||||
|
panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.Macaroon"))
|
||||||
|
}
|
||||||
|
panic(fmt.Errorf("message macaroon.v1.Macaroon does not contain field %s", fd.FullName()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get retrieves the value for a field.
|
||||||
|
//
|
||||||
|
// For unpopulated scalars, it returns the default value, where
|
||||||
|
// the default value of a bytes scalar is guaranteed to be a copy.
|
||||||
|
// For unpopulated composite types, it returns an empty, read-only view
|
||||||
|
// of the value; to obtain a mutable reference, use Mutable.
|
||||||
|
func (x *fastReflection_Macaroon) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value {
|
||||||
|
switch descriptor.FullName() {
|
||||||
|
case "macaroon.v1.Macaroon.id":
|
||||||
|
value := x.Id
|
||||||
|
return protoreflect.ValueOfUint64(value)
|
||||||
|
case "macaroon.v1.Macaroon.controller":
|
||||||
|
value := x.Controller
|
||||||
|
return protoreflect.ValueOfString(value)
|
||||||
|
case "macaroon.v1.Macaroon.subject":
|
||||||
|
value := x.Subject
|
||||||
|
return protoreflect.ValueOfString(value)
|
||||||
|
case "macaroon.v1.Macaroon.origin":
|
||||||
|
value := x.Origin
|
||||||
|
return protoreflect.ValueOfString(value)
|
||||||
|
case "macaroon.v1.Macaroon.expiry_height":
|
||||||
|
value := x.ExpiryHeight
|
||||||
|
return protoreflect.ValueOfInt64(value)
|
||||||
|
case "macaroon.v1.Macaroon.macaroon":
|
||||||
|
value := x.Macaroon
|
||||||
|
return protoreflect.ValueOfString(value)
|
||||||
|
default:
|
||||||
|
if descriptor.IsExtension() {
|
||||||
|
panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.Macaroon"))
|
||||||
|
}
|
||||||
|
panic(fmt.Errorf("message macaroon.v1.Macaroon does not contain field %s", descriptor.FullName()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set stores the value for a field.
|
||||||
|
//
|
||||||
|
// For a field belonging to a oneof, it implicitly clears any other field
|
||||||
|
// that may be currently set within the same oneof.
|
||||||
|
// For extension fields, it implicitly stores the provided ExtensionType.
|
||||||
|
// When setting a composite type, it is unspecified whether the stored value
|
||||||
|
// aliases the source's memory in any way. If the composite value is an
|
||||||
|
// empty, read-only value, then it panics.
|
||||||
|
//
|
||||||
|
// Set is a mutating operation and unsafe for concurrent use.
|
||||||
|
func (x *fastReflection_Macaroon) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) {
|
||||||
|
switch fd.FullName() {
|
||||||
|
case "macaroon.v1.Macaroon.id":
|
||||||
|
x.Id = value.Uint()
|
||||||
|
case "macaroon.v1.Macaroon.controller":
|
||||||
|
x.Controller = value.Interface().(string)
|
||||||
|
case "macaroon.v1.Macaroon.subject":
|
||||||
|
x.Subject = value.Interface().(string)
|
||||||
|
case "macaroon.v1.Macaroon.origin":
|
||||||
|
x.Origin = value.Interface().(string)
|
||||||
|
case "macaroon.v1.Macaroon.expiry_height":
|
||||||
|
x.ExpiryHeight = value.Int()
|
||||||
|
case "macaroon.v1.Macaroon.macaroon":
|
||||||
|
x.Macaroon = value.Interface().(string)
|
||||||
|
default:
|
||||||
|
if fd.IsExtension() {
|
||||||
|
panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.Macaroon"))
|
||||||
|
}
|
||||||
|
panic(fmt.Errorf("message macaroon.v1.Macaroon does not contain field %s", fd.FullName()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mutable returns a mutable reference to a composite type.
|
||||||
|
//
|
||||||
|
// If the field is unpopulated, it may allocate a composite value.
|
||||||
|
// For a field belonging to a oneof, it implicitly clears any other field
|
||||||
|
// that may be currently set within the same oneof.
|
||||||
|
// For extension fields, it implicitly stores the provided ExtensionType
|
||||||
|
// if not already stored.
|
||||||
|
// It panics if the field does not contain a composite type.
|
||||||
|
//
|
||||||
|
// Mutable is a mutating operation and unsafe for concurrent use.
|
||||||
|
func (x *fastReflection_Macaroon) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
||||||
|
switch fd.FullName() {
|
||||||
|
case "macaroon.v1.Macaroon.id":
|
||||||
|
panic(fmt.Errorf("field id of message macaroon.v1.Macaroon is not mutable"))
|
||||||
|
case "macaroon.v1.Macaroon.controller":
|
||||||
|
panic(fmt.Errorf("field controller of message macaroon.v1.Macaroon is not mutable"))
|
||||||
|
case "macaroon.v1.Macaroon.subject":
|
||||||
|
panic(fmt.Errorf("field subject of message macaroon.v1.Macaroon is not mutable"))
|
||||||
|
case "macaroon.v1.Macaroon.origin":
|
||||||
|
panic(fmt.Errorf("field origin of message macaroon.v1.Macaroon is not mutable"))
|
||||||
|
case "macaroon.v1.Macaroon.expiry_height":
|
||||||
|
panic(fmt.Errorf("field expiry_height of message macaroon.v1.Macaroon is not mutable"))
|
||||||
|
case "macaroon.v1.Macaroon.macaroon":
|
||||||
|
panic(fmt.Errorf("field macaroon of message macaroon.v1.Macaroon is not mutable"))
|
||||||
|
default:
|
||||||
|
if fd.IsExtension() {
|
||||||
|
panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.Macaroon"))
|
||||||
|
}
|
||||||
|
panic(fmt.Errorf("message macaroon.v1.Macaroon does not contain field %s", fd.FullName()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewField returns a new value that is assignable to the field
|
||||||
|
// for the given descriptor. For scalars, this returns the default value.
|
||||||
|
// For lists, maps, and messages, this returns a new, empty, mutable value.
|
||||||
|
func (x *fastReflection_Macaroon) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value {
|
||||||
|
switch fd.FullName() {
|
||||||
|
case "macaroon.v1.Macaroon.id":
|
||||||
|
return protoreflect.ValueOfUint64(uint64(0))
|
||||||
|
case "macaroon.v1.Macaroon.controller":
|
||||||
|
return protoreflect.ValueOfString("")
|
||||||
|
case "macaroon.v1.Macaroon.subject":
|
||||||
|
return protoreflect.ValueOfString("")
|
||||||
|
case "macaroon.v1.Macaroon.origin":
|
||||||
|
return protoreflect.ValueOfString("")
|
||||||
|
case "macaroon.v1.Macaroon.expiry_height":
|
||||||
|
return protoreflect.ValueOfInt64(int64(0))
|
||||||
|
case "macaroon.v1.Macaroon.macaroon":
|
||||||
|
return protoreflect.ValueOfString("")
|
||||||
|
default:
|
||||||
|
if fd.IsExtension() {
|
||||||
|
panic(fmt.Errorf("proto3 declared messages do not support extensions: macaroon.v1.Macaroon"))
|
||||||
|
}
|
||||||
|
panic(fmt.Errorf("message macaroon.v1.Macaroon does not contain field %s", fd.FullName()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WhichOneof reports which field within the oneof is populated,
|
||||||
|
// returning nil if none are populated.
|
||||||
|
// It panics if the oneof descriptor does not belong to this message.
|
||||||
|
func (x *fastReflection_Macaroon) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor {
|
||||||
|
switch d.FullName() {
|
||||||
|
default:
|
||||||
|
panic(fmt.Errorf("%s is not a oneof field in macaroon.v1.Macaroon", d.FullName()))
|
||||||
|
}
|
||||||
|
panic("unreachable")
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetUnknown retrieves the entire list of unknown fields.
|
||||||
|
// The caller may only mutate the contents of the RawFields
|
||||||
|
// if the mutated bytes are stored back into the message with SetUnknown.
|
||||||
|
func (x *fastReflection_Macaroon) GetUnknown() protoreflect.RawFields {
|
||||||
|
return x.unknownFields
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetUnknown stores an entire list of unknown fields.
|
||||||
|
// The raw fields must be syntactically valid according to the wire format.
|
||||||
|
// An implementation may panic if this is not the case.
|
||||||
|
// Once stored, the caller must not mutate the content of the RawFields.
|
||||||
|
// An empty RawFields may be passed to clear the fields.
|
||||||
|
//
|
||||||
|
// SetUnknown is a mutating operation and unsafe for concurrent use.
|
||||||
|
func (x *fastReflection_Macaroon) SetUnknown(fields protoreflect.RawFields) {
|
||||||
|
x.unknownFields = fields
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsValid reports whether the message is valid.
|
||||||
|
//
|
||||||
|
// An invalid message is an empty, read-only value.
|
||||||
|
//
|
||||||
|
// An invalid message often corresponds to a nil pointer of the concrete
|
||||||
|
// message type, but the details are implementation dependent.
|
||||||
|
// Validity is not part of the protobuf data model, and may not
|
||||||
|
// be preserved in marshaling or other operations.
|
||||||
|
func (x *fastReflection_Macaroon) IsValid() bool {
|
||||||
|
return x != nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations.
|
||||||
|
// This method may return nil.
|
||||||
|
//
|
||||||
|
// The returned methods type is identical to
|
||||||
|
// "google.golang.org/protobuf/runtime/protoiface".Methods.
|
||||||
|
// Consult the protoiface package documentation for details.
|
||||||
|
func (x *fastReflection_Macaroon) ProtoMethods() *protoiface.Methods {
|
||||||
|
size := func(input protoiface.SizeInput) protoiface.SizeOutput {
|
||||||
|
x := input.Message.Interface().(*Macaroon)
|
||||||
|
if x == nil {
|
||||||
|
return protoiface.SizeOutput{
|
||||||
|
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
|
||||||
|
Size: 0,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
options := runtime.SizeInputToOptions(input)
|
||||||
|
_ = options
|
||||||
|
var n int
|
||||||
|
var l int
|
||||||
|
_ = l
|
||||||
|
if x.Id != 0 {
|
||||||
|
n += 1 + runtime.Sov(uint64(x.Id))
|
||||||
|
}
|
||||||
|
l = len(x.Controller)
|
||||||
|
if l > 0 {
|
||||||
|
n += 1 + l + runtime.Sov(uint64(l))
|
||||||
|
}
|
||||||
|
l = len(x.Subject)
|
||||||
|
if l > 0 {
|
||||||
|
n += 1 + l + runtime.Sov(uint64(l))
|
||||||
|
}
|
||||||
|
l = len(x.Origin)
|
||||||
|
if l > 0 {
|
||||||
|
n += 1 + l + runtime.Sov(uint64(l))
|
||||||
|
}
|
||||||
|
if x.ExpiryHeight != 0 {
|
||||||
|
n += 1 + runtime.Sov(uint64(x.ExpiryHeight))
|
||||||
|
}
|
||||||
|
l = len(x.Macaroon)
|
||||||
|
if l > 0 {
|
||||||
|
n += 1 + l + runtime.Sov(uint64(l))
|
||||||
|
}
|
||||||
|
if x.unknownFields != nil {
|
||||||
|
n += len(x.unknownFields)
|
||||||
|
}
|
||||||
|
return protoiface.SizeOutput{
|
||||||
|
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
|
||||||
|
Size: n,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) {
|
||||||
|
x := input.Message.Interface().(*Macaroon)
|
||||||
|
if x == nil {
|
||||||
|
return protoiface.MarshalOutput{
|
||||||
|
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
|
||||||
|
Buf: input.Buf,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
options := runtime.MarshalInputToOptions(input)
|
||||||
|
_ = options
|
||||||
|
size := options.Size(x)
|
||||||
|
dAtA := make([]byte, size)
|
||||||
|
i := len(dAtA)
|
||||||
|
_ = i
|
||||||
|
var l int
|
||||||
|
_ = l
|
||||||
|
if x.unknownFields != nil {
|
||||||
|
i -= len(x.unknownFields)
|
||||||
|
copy(dAtA[i:], x.unknownFields)
|
||||||
|
}
|
||||||
|
if len(x.Macaroon) > 0 {
|
||||||
|
i -= len(x.Macaroon)
|
||||||
|
copy(dAtA[i:], x.Macaroon)
|
||||||
|
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Macaroon)))
|
||||||
|
i--
|
||||||
|
dAtA[i] = 0x32
|
||||||
|
}
|
||||||
|
if x.ExpiryHeight != 0 {
|
||||||
|
i = runtime.EncodeVarint(dAtA, i, uint64(x.ExpiryHeight))
|
||||||
|
i--
|
||||||
|
dAtA[i] = 0x28
|
||||||
|
}
|
||||||
|
if len(x.Origin) > 0 {
|
||||||
|
i -= len(x.Origin)
|
||||||
|
copy(dAtA[i:], x.Origin)
|
||||||
|
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Origin)))
|
||||||
|
i--
|
||||||
|
dAtA[i] = 0x22
|
||||||
|
}
|
||||||
|
if len(x.Subject) > 0 {
|
||||||
|
i -= len(x.Subject)
|
||||||
|
copy(dAtA[i:], x.Subject)
|
||||||
|
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Subject)))
|
||||||
|
i--
|
||||||
|
dAtA[i] = 0x1a
|
||||||
|
}
|
||||||
|
if len(x.Controller) > 0 {
|
||||||
|
i -= len(x.Controller)
|
||||||
|
copy(dAtA[i:], x.Controller)
|
||||||
|
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Controller)))
|
||||||
|
i--
|
||||||
|
dAtA[i] = 0x12
|
||||||
|
}
|
||||||
|
if x.Id != 0 {
|
||||||
|
i = runtime.EncodeVarint(dAtA, i, uint64(x.Id))
|
||||||
|
i--
|
||||||
|
dAtA[i] = 0x8
|
||||||
|
}
|
||||||
|
if input.Buf != nil {
|
||||||
|
input.Buf = append(input.Buf, dAtA...)
|
||||||
|
} else {
|
||||||
|
input.Buf = dAtA
|
||||||
|
}
|
||||||
|
return protoiface.MarshalOutput{
|
||||||
|
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
|
||||||
|
Buf: input.Buf,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {
|
||||||
|
x := input.Message.Interface().(*Macaroon)
|
||||||
|
if x == nil {
|
||||||
|
return protoiface.UnmarshalOutput{
|
||||||
|
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
|
||||||
|
Flags: input.Flags,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
options := runtime.UnmarshalInputToOptions(input)
|
||||||
|
_ = options
|
||||||
|
dAtA := input.Buf
|
||||||
|
l := len(dAtA)
|
||||||
|
iNdEx := 0
|
||||||
|
for iNdEx < l {
|
||||||
|
preIndex := iNdEx
|
||||||
|
var wire uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
wire |= uint64(b&0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fieldNum := int32(wire >> 3)
|
||||||
|
wireType := int(wire & 0x7)
|
||||||
|
if wireType == 4 {
|
||||||
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Macaroon: wiretype end group for non-group")
|
||||||
|
}
|
||||||
|
if fieldNum <= 0 {
|
||||||
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Macaroon: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||||
|
}
|
||||||
|
switch fieldNum {
|
||||||
|
case 1:
|
||||||
|
if wireType != 0 {
|
||||||
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Id", wireType)
|
||||||
|
}
|
||||||
|
x.Id = 0
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
x.Id |= uint64(b&0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case 2:
|
||||||
|
if wireType != 2 {
|
||||||
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Controller", wireType)
|
||||||
|
}
|
||||||
|
var stringLen uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
stringLen |= uint64(b&0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
intStringLen := int(stringLen)
|
||||||
|
if intStringLen < 0 {
|
||||||
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + intStringLen
|
||||||
|
if postIndex < 0 {
|
||||||
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||||
|
}
|
||||||
|
if postIndex > l {
|
||||||
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
x.Controller = string(dAtA[iNdEx:postIndex])
|
||||||
|
iNdEx = postIndex
|
||||||
|
case 3:
|
||||||
|
if wireType != 2 {
|
||||||
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Subject", wireType)
|
||||||
|
}
|
||||||
|
var stringLen uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
stringLen |= uint64(b&0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
intStringLen := int(stringLen)
|
||||||
|
if intStringLen < 0 {
|
||||||
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + intStringLen
|
||||||
|
if postIndex < 0 {
|
||||||
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||||
|
}
|
||||||
|
if postIndex > l {
|
||||||
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
x.Subject = string(dAtA[iNdEx:postIndex])
|
||||||
|
iNdEx = postIndex
|
||||||
|
case 4:
|
||||||
|
if wireType != 2 {
|
||||||
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Origin", wireType)
|
||||||
|
}
|
||||||
|
var stringLen uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
stringLen |= uint64(b&0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
intStringLen := int(stringLen)
|
||||||
|
if intStringLen < 0 {
|
||||||
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + intStringLen
|
||||||
|
if postIndex < 0 {
|
||||||
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||||
|
}
|
||||||
|
if postIndex > l {
|
||||||
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
x.Origin = string(dAtA[iNdEx:postIndex])
|
||||||
|
iNdEx = postIndex
|
||||||
|
case 5:
|
||||||
|
if wireType != 0 {
|
||||||
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ExpiryHeight", wireType)
|
||||||
|
}
|
||||||
|
x.ExpiryHeight = 0
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
x.ExpiryHeight |= int64(b&0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case 6:
|
||||||
|
if wireType != 2 {
|
||||||
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Macaroon", wireType)
|
||||||
|
}
|
||||||
|
var stringLen uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
stringLen |= uint64(b&0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
intStringLen := int(stringLen)
|
||||||
|
if intStringLen < 0 {
|
||||||
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + intStringLen
|
||||||
|
if postIndex < 0 {
|
||||||
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||||
|
}
|
||||||
|
if postIndex > l {
|
||||||
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
x.Macaroon = string(dAtA[iNdEx:postIndex])
|
||||||
|
iNdEx = postIndex
|
||||||
|
default:
|
||||||
|
iNdEx = preIndex
|
||||||
|
skippy, err := runtime.Skip(dAtA[iNdEx:])
|
||||||
|
if err != nil {
|
||||||
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err
|
||||||
|
}
|
||||||
|
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||||
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
|
||||||
|
}
|
||||||
|
if (iNdEx + skippy) > l {
|
||||||
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
if !options.DiscardUnknown {
|
||||||
|
x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)
|
||||||
|
}
|
||||||
|
iNdEx += skippy
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if iNdEx > l {
|
||||||
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil
|
||||||
|
}
|
||||||
|
return &protoiface.Methods{
|
||||||
|
NoUnkeyedLiterals: struct{}{},
|
||||||
|
Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown,
|
||||||
|
Size: size,
|
||||||
|
Marshal: marshal,
|
||||||
|
Unmarshal: unmarshal,
|
||||||
|
Merge: nil,
|
||||||
|
CheckInitialized: nil,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// protoc-gen-go v1.27.0
|
// protoc-gen-go v1.27.0
|
||||||
@ -737,6 +1445,81 @@ func (x *Grant) GetExpiryHeight() int64 {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Macaroon struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||||
|
Controller string `protobuf:"bytes,2,opt,name=controller,proto3" json:"controller,omitempty"`
|
||||||
|
Subject string `protobuf:"bytes,3,opt,name=subject,proto3" json:"subject,omitempty"`
|
||||||
|
Origin string `protobuf:"bytes,4,opt,name=origin,proto3" json:"origin,omitempty"`
|
||||||
|
ExpiryHeight int64 `protobuf:"varint,5,opt,name=expiry_height,json=expiryHeight,proto3" json:"expiry_height,omitempty"`
|
||||||
|
Macaroon string `protobuf:"bytes,6,opt,name=macaroon,proto3" json:"macaroon,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Macaroon) Reset() {
|
||||||
|
*x = Macaroon{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_macaroon_v1_state_proto_msgTypes[1]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Macaroon) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*Macaroon) ProtoMessage() {}
|
||||||
|
|
||||||
|
// Deprecated: Use Macaroon.ProtoReflect.Descriptor instead.
|
||||||
|
func (*Macaroon) Descriptor() ([]byte, []int) {
|
||||||
|
return file_macaroon_v1_state_proto_rawDescGZIP(), []int{1}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Macaroon) GetId() uint64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.Id
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Macaroon) GetController() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Controller
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Macaroon) GetSubject() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Subject
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Macaroon) GetOrigin() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Origin
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Macaroon) GetExpiryHeight() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.ExpiryHeight
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Macaroon) GetMacaroon() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Macaroon
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
var File_macaroon_v1_state_proto protoreflect.FileDescriptor
|
var File_macaroon_v1_state_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_macaroon_v1_state_proto_rawDesc = []byte{
|
var file_macaroon_v1_state_proto_rawDesc = []byte{
|
||||||
@ -755,17 +1538,31 @@ var file_macaroon_v1_state_proto_rawDesc = []byte{
|
|||||||
0x28, 0x03, 0x52, 0x0c, 0x65, 0x78, 0x70, 0x69, 0x72, 0x79, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74,
|
0x28, 0x03, 0x52, 0x0c, 0x65, 0x78, 0x70, 0x69, 0x72, 0x79, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74,
|
||||||
0x3a, 0x26, 0xf2, 0x9e, 0xd3, 0x8e, 0x03, 0x20, 0x0a, 0x06, 0x0a, 0x02, 0x69, 0x64, 0x10, 0x01,
|
0x3a, 0x26, 0xf2, 0x9e, 0xd3, 0x8e, 0x03, 0x20, 0x0a, 0x06, 0x0a, 0x02, 0x69, 0x64, 0x10, 0x01,
|
||||||
0x12, 0x14, 0x0a, 0x0e, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2c, 0x6f, 0x72, 0x69, 0x67,
|
0x12, 0x14, 0x0a, 0x0e, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2c, 0x6f, 0x72, 0x69, 0x67,
|
||||||
0x69, 0x6e, 0x10, 0x01, 0x18, 0x01, 0x18, 0x01, 0x42, 0x9d, 0x01, 0x0a, 0x0f, 0x63, 0x6f, 0x6d,
|
0x69, 0x6e, 0x10, 0x01, 0x18, 0x01, 0x18, 0x01, 0x22, 0xd5, 0x01, 0x0a, 0x08, 0x4d, 0x61, 0x63,
|
||||||
0x2e, 0x6d, 0x61, 0x63, 0x61, 0x72, 0x6f, 0x6f, 0x6e, 0x2e, 0x76, 0x31, 0x42, 0x0a, 0x53, 0x74,
|
0x61, 0x72, 0x6f, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||||
0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x31, 0x67, 0x69, 0x74, 0x68,
|
0x04, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c,
|
||||||
0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x6e, 0x73, 0x6f, 0x6e, 0x72, 0x2f, 0x73, 0x6f,
|
0x6c, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x6f, 0x6e, 0x74, 0x72,
|
||||||
0x6e, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6d, 0x61, 0x63, 0x61, 0x72, 0x6f, 0x6f, 0x6e, 0x2f,
|
0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74,
|
||||||
0x76, 0x31, 0x3b, 0x6d, 0x61, 0x63, 0x61, 0x72, 0x6f, 0x6f, 0x6e, 0x76, 0x31, 0xa2, 0x02, 0x03,
|
0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12,
|
||||||
0x4d, 0x58, 0x58, 0xaa, 0x02, 0x0b, 0x4d, 0x61, 0x63, 0x61, 0x72, 0x6f, 0x6f, 0x6e, 0x2e, 0x56,
|
0x16, 0x0a, 0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||||
0x31, 0xca, 0x02, 0x0b, 0x4d, 0x61, 0x63, 0x61, 0x72, 0x6f, 0x6f, 0x6e, 0x5c, 0x56, 0x31, 0xe2,
|
0x06, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x12, 0x23, 0x0a, 0x0d, 0x65, 0x78, 0x70, 0x69, 0x72,
|
||||||
0x02, 0x17, 0x4d, 0x61, 0x63, 0x61, 0x72, 0x6f, 0x6f, 0x6e, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50,
|
0x79, 0x5f, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c,
|
||||||
0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0c, 0x4d, 0x61, 0x63, 0x61,
|
0x65, 0x78, 0x70, 0x69, 0x72, 0x79, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x1a, 0x0a, 0x08,
|
||||||
0x72, 0x6f, 0x6f, 0x6e, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x6d, 0x61, 0x63, 0x61, 0x72, 0x6f, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08,
|
||||||
|
0x6d, 0x61, 0x63, 0x61, 0x72, 0x6f, 0x6f, 0x6e, 0x3a, 0x26, 0xf2, 0x9e, 0xd3, 0x8e, 0x03, 0x20,
|
||||||
|
0x0a, 0x06, 0x0a, 0x02, 0x69, 0x64, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x0e, 0x73, 0x75, 0x62, 0x6a,
|
||||||
|
0x65, 0x63, 0x74, 0x2c, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x10, 0x01, 0x18, 0x01, 0x18, 0x01,
|
||||||
|
0x42, 0x9d, 0x01, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x61, 0x63, 0x61, 0x72, 0x6f, 0x6f,
|
||||||
|
0x6e, 0x2e, 0x76, 0x31, 0x42, 0x0a, 0x53, 0x74, 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f,
|
||||||
|
0x50, 0x01, 0x5a, 0x31, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f,
|
||||||
|
0x6e, 0x73, 0x6f, 0x6e, 0x72, 0x2f, 0x73, 0x6f, 0x6e, 0x72, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x6d,
|
||||||
|
0x61, 0x63, 0x61, 0x72, 0x6f, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x3b, 0x6d, 0x61, 0x63, 0x61, 0x72,
|
||||||
|
0x6f, 0x6f, 0x6e, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x4d, 0x58, 0x58, 0xaa, 0x02, 0x0b, 0x4d, 0x61,
|
||||||
|
0x63, 0x61, 0x72, 0x6f, 0x6f, 0x6e, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0b, 0x4d, 0x61, 0x63, 0x61,
|
||||||
|
0x72, 0x6f, 0x6f, 0x6e, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x17, 0x4d, 0x61, 0x63, 0x61, 0x72, 0x6f,
|
||||||
|
0x6f, 0x6e, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74,
|
||||||
|
0x61, 0xea, 0x02, 0x0c, 0x4d, 0x61, 0x63, 0x61, 0x72, 0x6f, 0x6f, 0x6e, 0x3a, 0x3a, 0x56, 0x31,
|
||||||
|
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -780,9 +1577,10 @@ func file_macaroon_v1_state_proto_rawDescGZIP() []byte {
|
|||||||
return file_macaroon_v1_state_proto_rawDescData
|
return file_macaroon_v1_state_proto_rawDescData
|
||||||
}
|
}
|
||||||
|
|
||||||
var file_macaroon_v1_state_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
var file_macaroon_v1_state_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
||||||
var file_macaroon_v1_state_proto_goTypes = []interface{}{
|
var file_macaroon_v1_state_proto_goTypes = []interface{}{
|
||||||
(*Grant)(nil), // 0: macaroon.v1.Grant
|
(*Grant)(nil), // 0: macaroon.v1.Grant
|
||||||
|
(*Macaroon)(nil), // 1: macaroon.v1.Macaroon
|
||||||
}
|
}
|
||||||
var file_macaroon_v1_state_proto_depIdxs = []int32{
|
var file_macaroon_v1_state_proto_depIdxs = []int32{
|
||||||
0, // [0:0] is the sub-list for method output_type
|
0, // [0:0] is the sub-list for method output_type
|
||||||
@ -810,6 +1608,18 @@ func file_macaroon_v1_state_proto_init() {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
file_macaroon_v1_state_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*Macaroon); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
type x struct{}
|
type x struct{}
|
||||||
out := protoimpl.TypeBuilder{
|
out := protoimpl.TypeBuilder{
|
||||||
@ -817,7 +1627,7 @@ func file_macaroon_v1_state_proto_init() {
|
|||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_macaroon_v1_state_proto_rawDesc,
|
RawDescriptor: file_macaroon_v1_state_proto_rawDesc,
|
||||||
NumEnums: 0,
|
NumEnums: 0,
|
||||||
NumMessages: 1,
|
NumMessages: 2,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
NumServices: 0,
|
NumServices: 0,
|
||||||
},
|
},
|
||||||
|
53
app/app.go
53
app/app.go
@ -626,28 +626,15 @@ func NewChainApp(
|
|||||||
// If evidence needs to be handled for the app, set routes in router here and seal
|
// If evidence needs to be handled for the app, set routes in router here and seal
|
||||||
app.EvidenceKeeper = *evidenceKeeper
|
app.EvidenceKeeper = *evidenceKeeper
|
||||||
|
|
||||||
// Create the oracle Keeper
|
// Create the did Keeper
|
||||||
app.OracleKeeper = oraclekeeper.NewKeeper(
|
app.DidKeeper = didkeeper.NewKeeper(
|
||||||
appCodec,
|
appCodec,
|
||||||
sdkruntime.NewKVStoreService(keys[oracletypes.StoreKey]),
|
sdkruntime.NewKVStoreService(keys[didtypes.StoreKey]),
|
||||||
logger,
|
|
||||||
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
|
|
||||||
)
|
|
||||||
|
|
||||||
// Create the service Keeper
|
|
||||||
app.ServiceKeeper = servicekeeper.NewKeeper(
|
|
||||||
appCodec,
|
|
||||||
sdkruntime.NewKVStoreService(keys[servicetypes.StoreKey]),
|
|
||||||
logger,
|
|
||||||
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
|
|
||||||
)
|
|
||||||
|
|
||||||
// Create the macaroon Keeper
|
|
||||||
app.MacaroonKeeper = macaroonkeeper.NewKeeper(
|
|
||||||
appCodec,
|
|
||||||
sdkruntime.NewKVStoreService(keys[macaroontypes.StoreKey]),
|
|
||||||
logger,
|
logger,
|
||||||
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
|
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
|
||||||
|
app.AccountKeeper,
|
||||||
|
app.NFTKeeper,
|
||||||
|
app.StakingKeeper,
|
||||||
)
|
)
|
||||||
|
|
||||||
// Create the vault Keeper
|
// Create the vault Keeper
|
||||||
@ -656,16 +643,34 @@ func NewChainApp(
|
|||||||
sdkruntime.NewKVStoreService(keys[vaulttypes.StoreKey]),
|
sdkruntime.NewKVStoreService(keys[vaulttypes.StoreKey]),
|
||||||
logger,
|
logger,
|
||||||
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
|
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
|
||||||
|
app.AccountKeeper,
|
||||||
|
app.DidKeeper,
|
||||||
|
)
|
||||||
|
// Create the macaroon Keeper
|
||||||
|
app.MacaroonKeeper = macaroonkeeper.NewKeeper(
|
||||||
|
appCodec,
|
||||||
|
sdkruntime.NewKVStoreService(keys[macaroontypes.StoreKey]),
|
||||||
|
logger,
|
||||||
|
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
|
||||||
|
app.AccountKeeper,
|
||||||
app.DidKeeper,
|
app.DidKeeper,
|
||||||
)
|
)
|
||||||
|
|
||||||
// Create the did Keeper
|
// Create the service Keeper
|
||||||
app.DidKeeper = didkeeper.NewKeeper(
|
app.ServiceKeeper = servicekeeper.NewKeeper(
|
||||||
appCodec,
|
appCodec,
|
||||||
sdkruntime.NewKVStoreService(keys[didtypes.StoreKey]),
|
sdkruntime.NewKVStoreService(keys[servicetypes.StoreKey]),
|
||||||
app.AccountKeeper,
|
logger,
|
||||||
|
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
|
||||||
|
app.DidKeeper,
|
||||||
|
app.MacaroonKeeper,
|
||||||
app.NFTKeeper,
|
app.NFTKeeper,
|
||||||
app.StakingKeeper,
|
)
|
||||||
|
|
||||||
|
// Create the oracle Keeper
|
||||||
|
app.OracleKeeper = oraclekeeper.NewKeeper(
|
||||||
|
appCodec,
|
||||||
|
sdkruntime.NewKVStoreService(keys[oracletypes.StoreKey]),
|
||||||
logger,
|
logger,
|
||||||
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
|
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
|
||||||
)
|
)
|
||||||
|
@ -5,10 +5,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
|
|
||||||
|
|
||||||
storetypes "cosmossdk.io/store/types"
|
storetypes "cosmossdk.io/store/types"
|
||||||
|
cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
|
||||||
servertypes "github.com/cosmos/cosmos-sdk/server/types"
|
servertypes "github.com/cosmos/cosmos-sdk/server/types"
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
|
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
|
||||||
@ -45,7 +43,7 @@ func (app *SonrApp) ExportAppStateAndValidators(forZeroHeight bool, jailAllowedA
|
|||||||
AppState: appState,
|
AppState: appState,
|
||||||
Validators: validators,
|
Validators: validators,
|
||||||
Height: height,
|
Height: height,
|
||||||
ConsensusParams: app.BaseApp.GetConsensusParams(ctx),
|
ConsensusParams: app.GetConsensusParams(ctx),
|
||||||
}, err
|
}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,13 +52,9 @@ func (app *SonrApp) ExportAppStateAndValidators(forZeroHeight bool, jailAllowedA
|
|||||||
//
|
//
|
||||||
// in favor of export at a block height
|
// in favor of export at a block height
|
||||||
func (app *SonrApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []string) {
|
func (app *SonrApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []string) {
|
||||||
applyAllowedAddrs := false
|
applyAllowedAddrs := len(jailAllowedAddrs) > 0
|
||||||
|
|
||||||
// check if there is a allowed address list
|
// check if there is a allowed address list
|
||||||
if len(jailAllowedAddrs) > 0 {
|
|
||||||
applyAllowedAddrs = true
|
|
||||||
}
|
|
||||||
|
|
||||||
allowedAddrsMap := make(map[string]bool)
|
allowedAddrsMap := make(map[string]bool)
|
||||||
|
|
||||||
for _, addr := range jailAllowedAddrs {
|
for _, addr := range jailAllowedAddrs {
|
||||||
|
@ -1 +0,0 @@
|
|||||||
package state
|
|
@ -1 +0,0 @@
|
|||||||
package state
|
|
@ -1,4 +1,4 @@
|
|||||||
package main
|
package commands
|
||||||
|
|
||||||
import "github.com/spf13/cobra"
|
import "github.com/spf13/cobra"
|
||||||
|
|
18
cmd/hway/commands/start.go
Normal file
18
cmd/hway/commands/start.go
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
package commands
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
|
"github.com/onsonr/sonr/cmd/hway/server"
|
||||||
|
)
|
||||||
|
|
||||||
|
func NewStartCmd() *cobra.Command {
|
||||||
|
return &cobra.Command{
|
||||||
|
Use: "start",
|
||||||
|
Short: "Starts the DWN proxy server for the local IPFS node",
|
||||||
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
|
s := server.New()
|
||||||
|
s.Start()
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
13
cmd/hway/main.go
Normal file
13
cmd/hway/main.go
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/onsonr/sonr/cmd/hway/commands"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
rootCmd := commands.NewRootCmd()
|
||||||
|
rootCmd.AddCommand(commands.NewStartCmd())
|
||||||
|
if err := rootCmd.Execute(); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
}
|
41
cmd/hway/server/server.go
Normal file
41
cmd/hway/server/server.go
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
package server
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/labstack/echo/v4"
|
||||||
|
"github.com/labstack/gommon/log"
|
||||||
|
|
||||||
|
"github.com/onsonr/sonr/internal/session"
|
||||||
|
"github.com/onsonr/sonr/pkg/nebula"
|
||||||
|
"github.com/onsonr/sonr/pkg/nebula/pages"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Server struct {
|
||||||
|
*echo.Echo
|
||||||
|
}
|
||||||
|
|
||||||
|
func New() *Server {
|
||||||
|
s := &Server{Echo: echo.New()}
|
||||||
|
s.Logger.SetLevel(log.INFO)
|
||||||
|
s.Use(session.UseSession)
|
||||||
|
|
||||||
|
// Configure the server
|
||||||
|
if err := nebula.UseAssets(s.Echo); err != nil {
|
||||||
|
s.Logger.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
s.GET("/", pages.Home)
|
||||||
|
s.GET("/login", pages.Login)
|
||||||
|
s.GET("/register", pages.Register)
|
||||||
|
s.GET("/profile", pages.Profile)
|
||||||
|
s.GET("/allocate", pages.Profile)
|
||||||
|
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Server) Start() {
|
||||||
|
if err := s.Echo.Start(":1323"); err != http.ErrServerClosed {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package state
|
package handlers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
1
cmd/motr/handlers/manifest.go
Normal file
1
cmd/motr/handlers/manifest.go
Normal file
@ -0,0 +1 @@
|
|||||||
|
package handlers
|
@ -1,4 +1,4 @@
|
|||||||
package state
|
package handlers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
1
cmd/motr/handlers/wellknown.go
Normal file
1
cmd/motr/handlers/wellknown.go
Normal file
@ -0,0 +1 @@
|
|||||||
|
package handlers
|
@ -1,9 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
rootCmd := NewRootCmd()
|
|
||||||
rootCmd.AddCommand(NewProxyCmd())
|
|
||||||
if err := rootCmd.Execute(); err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
}
|
|
@ -15,14 +15,14 @@ import (
|
|||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
promise "github.com/nlepage/go-js-promise"
|
promise "github.com/nlepage/go-js-promise"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/cmd/dwn/middleware"
|
"github.com/onsonr/sonr/cmd/motr/handlers"
|
||||||
"github.com/onsonr/sonr/cmd/dwn/state"
|
"github.com/onsonr/sonr/internal/session"
|
||||||
"github.com/onsonr/sonr/pkg/nebula/pages"
|
"github.com/onsonr/sonr/pkg/nebula/pages"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
e := echo.New()
|
e := echo.New()
|
||||||
e.Use(middleware.UseSession)
|
e.Use(session.UseSession)
|
||||||
registerViews(e)
|
registerViews(e)
|
||||||
registerState(e)
|
registerState(e)
|
||||||
Serve(e)
|
Serve(e)
|
||||||
@ -30,13 +30,13 @@ func main() {
|
|||||||
|
|
||||||
func registerState(e *echo.Echo) {
|
func registerState(e *echo.Echo) {
|
||||||
g := e.Group("state")
|
g := e.Group("state")
|
||||||
g.POST("/login/:identifier", state.HandleCredentialAssertion)
|
g.POST("/login/:identifier", handlers.HandleCredentialAssertion)
|
||||||
// g.GET("/discovery", state.GetDiscovery)
|
// g.GET("/discovery", state.GetDiscovery)
|
||||||
g.GET("/jwks", state.GetJWKS)
|
g.GET("/jwks", handlers.GetJWKS)
|
||||||
g.GET("/token", state.GetToken)
|
g.GET("/token", handlers.GetToken)
|
||||||
g.POST("/:origin/grant/:subject", state.GrantAuthorization)
|
g.POST("/:origin/grant/:subject", handlers.GrantAuthorization)
|
||||||
g.POST("/register/:subject", state.HandleCredentialCreation)
|
g.POST("/register/:subject", handlers.HandleCredentialCreation)
|
||||||
g.POST("/register/:subject/check", state.CheckSubjectIsValid)
|
g.POST("/register/:subject/check", handlers.CheckSubjectIsValid)
|
||||||
}
|
}
|
||||||
|
|
||||||
func registerViews(e *echo.Echo) {
|
func registerViews(e *echo.Echo) {
|
@ -1,39 +0,0 @@
|
|||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"net/http"
|
|
||||||
|
|
||||||
"github.com/labstack/echo/v4"
|
|
||||||
"github.com/labstack/gommon/log"
|
|
||||||
"github.com/spf13/cobra"
|
|
||||||
|
|
||||||
"github.com/onsonr/sonr/pkg/nebula"
|
|
||||||
"github.com/onsonr/sonr/pkg/nebula/pages"
|
|
||||||
)
|
|
||||||
|
|
||||||
func NewProxyCmd() *cobra.Command {
|
|
||||||
return &cobra.Command{
|
|
||||||
Use: "start",
|
|
||||||
Short: "Starts the DWN proxy server for the local IPFS node",
|
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
|
||||||
// Echo instance
|
|
||||||
e := echo.New()
|
|
||||||
e.Logger.SetLevel(log.INFO)
|
|
||||||
|
|
||||||
// Configure the server
|
|
||||||
if err := nebula.UseAssets(e); err != nil {
|
|
||||||
e.Logger.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
e.GET("/", pages.Home)
|
|
||||||
e.GET("/login", pages.Login)
|
|
||||||
e.GET("/register", pages.Register)
|
|
||||||
e.GET("/profile", pages.Profile)
|
|
||||||
e.GET("/allocate", pages.Profile)
|
|
||||||
|
|
||||||
if err := e.Start(":1323"); err != http.ErrServerClosed {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
16
devbox.json
16
devbox.json
@ -34,21 +34,21 @@
|
|||||||
"build:docker": [
|
"build:docker": [
|
||||||
"make local-image"
|
"make local-image"
|
||||||
],
|
],
|
||||||
"build:motr": [
|
"build:hway": [
|
||||||
"make nebula",
|
"make nebula",
|
||||||
"make motr"
|
"make hway"
|
||||||
],
|
],
|
||||||
"build:nebula": [
|
"build:nebula": [
|
||||||
"make nebula"
|
"make nebula"
|
||||||
],
|
],
|
||||||
"build:sonrd": [
|
"build:sonrd": [
|
||||||
"make dwn",
|
"make motr",
|
||||||
"make build"
|
"make build"
|
||||||
],
|
],
|
||||||
"build": [
|
"build": [
|
||||||
"make dwn",
|
"make motr",
|
||||||
"make build",
|
"make build",
|
||||||
"make motr"
|
"make hway"
|
||||||
],
|
],
|
||||||
"gen:proto": [
|
"gen:proto": [
|
||||||
"make proto-gen"
|
"make proto-gen"
|
||||||
@ -59,10 +59,10 @@
|
|||||||
"gen:templ": [
|
"gen:templ": [
|
||||||
"make templ"
|
"make templ"
|
||||||
],
|
],
|
||||||
"start:motr": [
|
"start:hway": [
|
||||||
"make templ",
|
"make templ",
|
||||||
"make motr",
|
"make hway",
|
||||||
"make start-motr"
|
"make start-hway"
|
||||||
],
|
],
|
||||||
"start:testnet": [
|
"start:testnet": [
|
||||||
"make templ",
|
"make templ",
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package middleware
|
package auth
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
@ -1,4 +1,4 @@
|
|||||||
package middleware
|
package auth
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
@ -7,21 +7,6 @@ import (
|
|||||||
"gopkg.in/macaroon.v2"
|
"gopkg.in/macaroon.v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GetSession returns the current Session
|
|
||||||
func GetSession(c echo.Context) *Session {
|
|
||||||
return c.(*Session)
|
|
||||||
}
|
|
||||||
|
|
||||||
// UseSession establishes a Session Cookie.
|
|
||||||
func UseSession(next echo.HandlerFunc) echo.HandlerFunc {
|
|
||||||
return func(c echo.Context) error {
|
|
||||||
sc := initSession(c)
|
|
||||||
headers := new(RequestHeaders)
|
|
||||||
sc.Bind(headers)
|
|
||||||
return next(sc)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func MacaroonMiddleware(secretKeyStr string, location string) echo.MiddlewareFunc {
|
func MacaroonMiddleware(secretKeyStr string, location string) echo.MiddlewareFunc {
|
||||||
secretKey := []byte(secretKeyStr)
|
secretKey := []byte(secretKeyStr)
|
||||||
return func(next echo.HandlerFunc) echo.HandlerFunc {
|
return func(next echo.HandlerFunc) echo.HandlerFunc {
|
28
internal/headers/request.go
Normal file
28
internal/headers/request.go
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
package headers
|
||||||
|
|
||||||
|
type RequestHeaders struct {
|
||||||
|
Authorization *string `header:"Authorization"`
|
||||||
|
CacheControl *string `header:"Cache-Control"`
|
||||||
|
DeviceMemory *string `header:"Device-Memory"`
|
||||||
|
Forwarded *string `header:"Forwarded"`
|
||||||
|
From *string `header:"From"`
|
||||||
|
Host *string `header:"Host"`
|
||||||
|
Link *string `header:"Link"`
|
||||||
|
PermissionsPolicy *string `header:"Permissions-Policy"`
|
||||||
|
ProxyAuthorization *string `header:"Proxy-Authorization"`
|
||||||
|
Referer *string `header:"Referer"`
|
||||||
|
UserAgent *string `header:"User-Agent"`
|
||||||
|
ViewportWidth *string `header:"Viewport-Width"`
|
||||||
|
Width *string `header:"Width"`
|
||||||
|
WWWAuthenticate *string `header:"WWW-Authenticate"`
|
||||||
|
|
||||||
|
// 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"`
|
||||||
|
}
|
@ -1,31 +1,4 @@
|
|||||||
package middleware
|
package headers
|
||||||
|
|
||||||
type RequestHeaders struct {
|
|
||||||
Authorization *string `header:"Authorization"`
|
|
||||||
CacheControl *string `header:"Cache-Control"`
|
|
||||||
DeviceMemory *string `header:"Device-Memory"`
|
|
||||||
Forwarded *string `header:"Forwarded"`
|
|
||||||
From *string `header:"From"`
|
|
||||||
Host *string `header:"Host"`
|
|
||||||
Link *string `header:"Link"`
|
|
||||||
PermissionsPolicy *string `header:"Permissions-Policy"`
|
|
||||||
ProxyAuthorization *string `header:"Proxy-Authorization"`
|
|
||||||
Referer *string `header:"Referer"`
|
|
||||||
UserAgent *string `header:"User-Agent"`
|
|
||||||
ViewportWidth *string `header:"Viewport-Width"`
|
|
||||||
Width *string `header:"Width"`
|
|
||||||
WWWAuthenticate *string `header:"WWW-Authenticate"`
|
|
||||||
|
|
||||||
// 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 ResponseHeaders struct {
|
type ResponseHeaders struct {
|
||||||
AcceptCH *string `header:"Accept-CH"`
|
AcceptCH *string `header:"Accept-CH"`
|
@ -1,4 +1,4 @@
|
|||||||
package middleware
|
package session
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
@ -6,7 +6,6 @@ import (
|
|||||||
|
|
||||||
"github.com/donseba/go-htmx"
|
"github.com/donseba/go-htmx"
|
||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
"github.com/segmentio/ksuid"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type Session struct {
|
type Session struct {
|
||||||
@ -22,15 +21,6 @@ func (c *Session) ID() string {
|
|||||||
return ReadCookie(c, "session")
|
return ReadCookie(c, "session")
|
||||||
}
|
}
|
||||||
|
|
||||||
func initSession(c echo.Context) *Session {
|
|
||||||
s := &Session{Context: c}
|
|
||||||
if val := ReadCookie(c, "session"); val == "" {
|
|
||||||
id := ksuid.New().String()
|
|
||||||
WriteCookie(c, "session", id)
|
|
||||||
}
|
|
||||||
return s
|
|
||||||
}
|
|
||||||
|
|
||||||
func ReadCookie(c echo.Context, key string) string {
|
func ReadCookie(c echo.Context, key string) string {
|
||||||
cookie, err := c.Cookie(key)
|
cookie, err := c.Cookie(key)
|
||||||
if err != nil {
|
if err != nil {
|
35
internal/session/middleware.go
Normal file
35
internal/session/middleware.go
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
package session
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/labstack/echo/v4"
|
||||||
|
"github.com/segmentio/ksuid"
|
||||||
|
|
||||||
|
"github.com/onsonr/sonr/internal/headers"
|
||||||
|
)
|
||||||
|
|
||||||
|
// GetSession returns the current Session
|
||||||
|
func GetSession(c echo.Context) *Session {
|
||||||
|
return c.(*Session)
|
||||||
|
}
|
||||||
|
|
||||||
|
// UseSession establishes a Session Cookie.
|
||||||
|
func UseSession(next echo.HandlerFunc) echo.HandlerFunc {
|
||||||
|
return func(c echo.Context) error {
|
||||||
|
sc := initSession(c)
|
||||||
|
headers := new(headers.RequestHeaders)
|
||||||
|
err := sc.Bind(headers)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return next(sc)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func initSession(c echo.Context) *Session {
|
||||||
|
s := &Session{Context: c}
|
||||||
|
if val := ReadCookie(c, "session"); val == "" {
|
||||||
|
id := ksuid.New().String()
|
||||||
|
WriteCookie(c, "session", id)
|
||||||
|
}
|
||||||
|
return s
|
||||||
|
}
|
@ -1,26 +0,0 @@
|
|||||||
// Code generated from Pkl module `orm`. DO NOT EDIT.
|
|
||||||
package orm
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/onsonr/sonr/pkg/orm/keyalgorithm"
|
|
||||||
"github.com/onsonr/sonr/pkg/orm/keycurve"
|
|
||||||
"github.com/onsonr/sonr/pkg/orm/keyencoding"
|
|
||||||
"github.com/onsonr/sonr/pkg/orm/keyrole"
|
|
||||||
"github.com/onsonr/sonr/pkg/orm/keytype"
|
|
||||||
)
|
|
||||||
|
|
||||||
type PublicKey struct {
|
|
||||||
Role keyrole.KeyRole `pkl:"role" json:"role,omitempty" query:"role"`
|
|
||||||
|
|
||||||
Algorithm keyalgorithm.KeyAlgorithm `pkl:"algorithm"`
|
|
||||||
|
|
||||||
Encoding keyencoding.KeyEncoding `pkl:"encoding"`
|
|
||||||
|
|
||||||
Curve keycurve.KeyCurve `pkl:"curve"`
|
|
||||||
|
|
||||||
KeyType keytype.KeyType `pkl:"key_type"`
|
|
||||||
|
|
||||||
Raw string `pkl:"raw"`
|
|
||||||
|
|
||||||
Jwk *JWK `pkl:"jwk"`
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
// Code generated from Pkl module `orm`. DO NOT EDIT.
|
|
||||||
package orm
|
|
||||||
|
|
||||||
type Session struct {
|
|
||||||
Id string `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"`
|
|
||||||
|
|
||||||
CreatedAt *string `pkl:"createdAt" json:"createdAt,omitempty"`
|
|
||||||
|
|
||||||
UpdatedAt *string `pkl:"updatedAt" json:"updatedAt,omitempty"`
|
|
||||||
}
|
|
@ -14,5 +14,4 @@ func init() {
|
|||||||
pkl.RegisterMapping("orm#Grant", Grant{})
|
pkl.RegisterMapping("orm#Grant", Grant{})
|
||||||
pkl.RegisterMapping("orm#Keyshare", Keyshare{})
|
pkl.RegisterMapping("orm#Keyshare", Keyshare{})
|
||||||
pkl.RegisterMapping("orm#Profile", Profile{})
|
pkl.RegisterMapping("orm#Profile", Profile{})
|
||||||
pkl.RegisterMapping("orm#Session", Session{})
|
|
||||||
}
|
}
|
||||||
|
@ -1 +1,39 @@
|
|||||||
package orm
|
package orm
|
||||||
|
|
||||||
|
const SCHEMA_VERSION = 1
|
||||||
|
|
||||||
|
func AccountSchema() string {
|
||||||
|
return "++, id, name, address, publicKey, chainCode, index, controller, createdAt"
|
||||||
|
}
|
||||||
|
|
||||||
|
func AssetSchema() string {
|
||||||
|
return "++, id, name, symbol, decimals, chainCode, createdAt"
|
||||||
|
}
|
||||||
|
|
||||||
|
func ChainSchema() string {
|
||||||
|
return "++, id, name, networkId, chainCode, createdAt"
|
||||||
|
}
|
||||||
|
|
||||||
|
func CredentialSchema() string {
|
||||||
|
return "++, id, subject, controller, attestationType, origin, label, deviceId, credentialId, publicKey, transport, signCount, userPresent, userVerified, backupEligible, backupState, cloneWarning, createdAt, updatedAt"
|
||||||
|
}
|
||||||
|
|
||||||
|
func DIDSchema() string {
|
||||||
|
return "++, id, role, algorithm, encoding, curve, key_type, raw, jwk"
|
||||||
|
}
|
||||||
|
|
||||||
|
func JwkSchema() string {
|
||||||
|
return "++, kty, crv, x, y, n, e"
|
||||||
|
}
|
||||||
|
|
||||||
|
func GrantSchema() string {
|
||||||
|
return "++, subject, controller, origin, token, scopes, createdAt, updatedAt"
|
||||||
|
}
|
||||||
|
|
||||||
|
func KeyshareSchema() string {
|
||||||
|
return "++, id, data, role, createdAt, lastRefreshed"
|
||||||
|
}
|
||||||
|
|
||||||
|
func ProfileSchema() string {
|
||||||
|
return "++, id, subject, controller, originUri, publicMetadata, privateMetadata, createdAt, updatedAt"
|
||||||
|
}
|
||||||
|
21
pkl/orm.pkl
21
pkl/orm.pkl
@ -269,26 +269,5 @@ class Profile {
|
|||||||
@JsonField
|
@JsonField
|
||||||
updatedAt: String?
|
updatedAt: String?
|
||||||
}
|
}
|
||||||
|
|
||||||
class Session {
|
|
||||||
@PrimaryKey
|
|
||||||
id: String
|
|
||||||
|
|
||||||
@JsonField
|
|
||||||
subject: String
|
|
||||||
|
|
||||||
@JsonField
|
|
||||||
controller: Bech32
|
|
||||||
|
|
||||||
@JsonField
|
|
||||||
origin: String
|
|
||||||
|
|
||||||
@JsonField
|
|
||||||
createdAt: String?
|
|
||||||
|
|
||||||
@JsonField
|
|
||||||
updatedAt: String?
|
|
||||||
}
|
|
||||||
|
|
||||||
db_name: String = "vault"
|
db_name: String = "vault"
|
||||||
db_version: Int = 1
|
db_version: Int = 1
|
||||||
|
@ -17,9 +17,9 @@ processes:
|
|||||||
depends:
|
depends:
|
||||||
- ipfs
|
- ipfs
|
||||||
|
|
||||||
motr:
|
hway:
|
||||||
namespace: testnet
|
namespace: testnet
|
||||||
command: "devbox run start:motr"
|
command: "devbox run start:hway"
|
||||||
restart: on_failure
|
restart: on_failure
|
||||||
max_restarts: 1
|
max_restarts: 1
|
||||||
depends:
|
depends:
|
||||||
|
@ -32,16 +32,16 @@ message Params {
|
|||||||
message Methods {
|
message Methods {
|
||||||
option (amino.name) = "macaroon/methods";
|
option (amino.name) = "macaroon/methods";
|
||||||
option (gogoproto.equal) = true;
|
option (gogoproto.equal) = true;
|
||||||
|
string default = 1;
|
||||||
repeated string methods = 1;
|
repeated string supported = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scopes defines the set of scopes
|
// Scopes defines the set of scopes
|
||||||
message Scopes {
|
message Scopes {
|
||||||
option (amino.name) = "macaroon/scopes";
|
option (amino.name) = "macaroon/scopes";
|
||||||
option (gogoproto.equal) = true;
|
option (gogoproto.equal) = true;
|
||||||
|
string base = 1;
|
||||||
repeated string scopes = 1;
|
repeated string supported = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Caveats defines the available caveats
|
// Caveats defines the available caveats
|
||||||
@ -49,5 +49,6 @@ message Caveats {
|
|||||||
option (amino.name) = "macaroon/caveat";
|
option (amino.name) = "macaroon/caveat";
|
||||||
option (gogoproto.equal) = true;
|
option (gogoproto.equal) = true;
|
||||||
|
|
||||||
repeated string caveats = 1;
|
repeated string supported_first_party = 1;
|
||||||
|
repeated string supported_third_party = 2;
|
||||||
}
|
}
|
||||||
|
@ -27,3 +27,25 @@ message Grant {
|
|||||||
string origin = 4;
|
string origin = 4;
|
||||||
int64 expiry_height = 5;
|
int64 expiry_height = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message Macaroon {
|
||||||
|
option (cosmos.orm.v1.table) = {
|
||||||
|
id: 1
|
||||||
|
primary_key: {
|
||||||
|
fields: "id"
|
||||||
|
auto_increment: true
|
||||||
|
}
|
||||||
|
index: {
|
||||||
|
id: 1
|
||||||
|
fields: "subject,origin"
|
||||||
|
unique: true
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
uint64 id = 1;
|
||||||
|
string controller = 2;
|
||||||
|
string subject = 3;
|
||||||
|
string origin = 4;
|
||||||
|
int64 expiry_height = 5;
|
||||||
|
string macaroon = 6;
|
||||||
|
}
|
||||||
|
@ -13,7 +13,6 @@ import (
|
|||||||
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
|
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
|
||||||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||||
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
|
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
|
||||||
|
|
||||||
slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper"
|
slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper"
|
||||||
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
|
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
|
||||||
|
|
||||||
@ -59,7 +58,7 @@ type ModuleOutputs struct {
|
|||||||
func ProvideModule(in ModuleInputs) ModuleOutputs {
|
func ProvideModule(in ModuleInputs) ModuleOutputs {
|
||||||
govAddr := authtypes.NewModuleAddress(govtypes.ModuleName).String()
|
govAddr := authtypes.NewModuleAddress(govtypes.ModuleName).String()
|
||||||
|
|
||||||
k := keeper.NewKeeper(in.Cdc, in.StoreService, in.AccountKeeper, in.NFTKeeper, &in.StakingKeeper, log.NewLogger(os.Stderr), govAddr)
|
k := keeper.NewKeeper(in.Cdc, in.StoreService, log.NewLogger(os.Stderr), govAddr, in.AccountKeeper, in.NFTKeeper, &in.StakingKeeper)
|
||||||
m := NewAppModule(in.Cdc, k, in.NFTKeeper)
|
m := NewAppModule(in.Cdc, k, in.NFTKeeper)
|
||||||
|
|
||||||
return ModuleOutputs{Module: m, Keeper: k, Out: depinject.Out{}}
|
return ModuleOutputs{Module: m, Keeper: k, Out: depinject.Out{}}
|
||||||
|
@ -13,12 +13,11 @@ import (
|
|||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
|
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
|
||||||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||||
"gopkg.in/macaroon.v2"
|
|
||||||
|
|
||||||
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
|
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
|
||||||
stakkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
|
stakkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
|
||||||
|
|
||||||
"github.com/onsonr/crypto/mpc"
|
"github.com/onsonr/crypto/mpc"
|
||||||
|
"gopkg.in/macaroon.v2"
|
||||||
|
|
||||||
apiv1 "github.com/onsonr/sonr/api/did/v1"
|
apiv1 "github.com/onsonr/sonr/api/did/v1"
|
||||||
"github.com/onsonr/sonr/x/did/types"
|
"github.com/onsonr/sonr/x/did/types"
|
||||||
)
|
)
|
||||||
@ -45,11 +44,11 @@ type Keeper struct {
|
|||||||
func NewKeeper(
|
func NewKeeper(
|
||||||
cdc codec.BinaryCodec,
|
cdc codec.BinaryCodec,
|
||||||
storeService storetypes.KVStoreService,
|
storeService storetypes.KVStoreService,
|
||||||
|
logger log.Logger,
|
||||||
|
authority string,
|
||||||
accKeeper authkeeper.AccountKeeper,
|
accKeeper authkeeper.AccountKeeper,
|
||||||
nftKeeper nftkeeper.Keeper,
|
nftKeeper nftkeeper.Keeper,
|
||||||
stkKeeper *stakkeeper.Keeper,
|
stkKeeper *stakkeeper.Keeper,
|
||||||
logger log.Logger,
|
|
||||||
authority string,
|
|
||||||
) Keeper {
|
) Keeper {
|
||||||
logger = logger.With(log.ModuleKey, "x/"+types.ModuleName)
|
logger = logger.With(log.ModuleKey, "x/"+types.ModuleName)
|
||||||
sb := collections.NewSchemaBuilder(storeService)
|
sb := collections.NewSchemaBuilder(storeService)
|
||||||
|
@ -79,7 +79,7 @@ func SetupTest(t *testing.T) *testFixture {
|
|||||||
registerBaseSDKModules(f, encCfg, storeService, logger, require)
|
registerBaseSDKModules(f, encCfg, storeService, logger, require)
|
||||||
|
|
||||||
// Setup POA Keeper.
|
// Setup POA Keeper.
|
||||||
f.k = keeper.NewKeeper(encCfg.Codec, storeService, f.accountkeeper, f.nftKeeper, f.stakingKeeper, logger, f.govModAddr)
|
f.k = keeper.NewKeeper(encCfg.Codec, storeService, logger, f.govModAddr, f.accountkeeper, f.nftKeeper, f.stakingKeeper)
|
||||||
f.msgServer = keeper.NewMsgServerImpl(f.k)
|
f.msgServer = keeper.NewMsgServerImpl(f.k)
|
||||||
f.queryServer = keeper.NewQuerier(f.k)
|
f.queryServer = keeper.NewQuerier(f.k)
|
||||||
f.appModule = module.NewAppModule(encCfg.Codec, f.k, f.nftKeeper)
|
f.appModule = module.NewAppModule(encCfg.Codec, f.k, f.nftKeeper)
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
|
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
|
|
||||||
"github.com/onsonr/sonr/x/did/types"
|
"github.com/onsonr/sonr/x/did/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -20,7 +21,7 @@ func NewQuerier(keeper Keeper) Querier {
|
|||||||
// Params returns the total set of did parameters.
|
// Params returns the total set of did parameters.
|
||||||
func (k Querier) Params(goCtx context.Context, req *types.QueryRequest) (*types.QueryParamsResponse, error) {
|
func (k Querier) Params(goCtx context.Context, req *types.QueryRequest) (*types.QueryParamsResponse, error) {
|
||||||
ctx := sdk.UnwrapSDKContext(goCtx)
|
ctx := sdk.UnwrapSDKContext(goCtx)
|
||||||
p, err := k.Keeper.CurrentParams(ctx)
|
p, err := k.CurrentParams(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -35,13 +36,11 @@ func (k Querier) Resolve(goCtx context.Context, req *types.QueryRequest) (*types
|
|||||||
// Sign implements types.QueryServer.
|
// Sign implements types.QueryServer.
|
||||||
func (k Querier) Sign(goCtx context.Context, req *types.QuerySignRequest) (*types.QuerySignResponse, error) {
|
func (k Querier) Sign(goCtx context.Context, req *types.QuerySignRequest) (*types.QuerySignResponse, error) {
|
||||||
// ctx := sdk.UnwrapSDKContext(goCtx)
|
// ctx := sdk.UnwrapSDKContext(goCtx)
|
||||||
panic("Sign is unimplemented")
|
|
||||||
return &types.QuerySignResponse{}, nil
|
return &types.QuerySignResponse{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verify implements types.QueryServer.
|
// Verify implements types.QueryServer.
|
||||||
func (k Querier) Verify(goCtx context.Context, req *types.QueryVerifyRequest) (*types.QueryVerifyResponse, error) {
|
func (k Querier) Verify(goCtx context.Context, req *types.QueryVerifyRequest) (*types.QueryVerifyResponse, error) {
|
||||||
// ctx := sdk.UnwrapSDKContext(goCtx)
|
// ctx := sdk.UnwrapSDKContext(goCtx)
|
||||||
panic("Verify is unimplemented")
|
|
||||||
return &types.QueryVerifyResponse{}, nil
|
return &types.QueryVerifyResponse{}, nil
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ import (
|
|||||||
"cosmossdk.io/depinject"
|
"cosmossdk.io/depinject"
|
||||||
"cosmossdk.io/log"
|
"cosmossdk.io/log"
|
||||||
"github.com/cosmos/cosmos-sdk/codec"
|
"github.com/cosmos/cosmos-sdk/codec"
|
||||||
|
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
|
||||||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||||
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
|
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
|
||||||
slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper"
|
slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper"
|
||||||
@ -40,6 +41,7 @@ type ModuleInputs struct {
|
|||||||
Cdc codec.Codec
|
Cdc codec.Codec
|
||||||
StoreService store.KVStoreService
|
StoreService store.KVStoreService
|
||||||
AddressCodec address.Codec
|
AddressCodec address.Codec
|
||||||
|
AccountKeeper authkeeper.AccountKeeper
|
||||||
DidKeeper didkeeper.Keeper
|
DidKeeper didkeeper.Keeper
|
||||||
|
|
||||||
StakingKeeper stakingkeeper.Keeper
|
StakingKeeper stakingkeeper.Keeper
|
||||||
@ -56,7 +58,7 @@ type ModuleOutputs struct {
|
|||||||
func ProvideModule(in ModuleInputs) ModuleOutputs {
|
func ProvideModule(in ModuleInputs) ModuleOutputs {
|
||||||
govAddr := authtypes.NewModuleAddress(govtypes.ModuleName).String()
|
govAddr := authtypes.NewModuleAddress(govtypes.ModuleName).String()
|
||||||
|
|
||||||
k := keeper.NewKeeper(in.Cdc, in.StoreService, log.NewLogger(os.Stderr), govAddr)
|
k := keeper.NewKeeper(in.Cdc, in.StoreService, log.NewLogger(os.Stderr), govAddr, in.AccountKeeper, in.DidKeeper)
|
||||||
m := NewAppModule(in.Cdc, k, in.DidKeeper)
|
m := NewAppModule(in.Cdc, k, in.DidKeeper)
|
||||||
|
|
||||||
return ModuleOutputs{Module: m, Keeper: k, Out: depinject.Out{}}
|
return ModuleOutputs{Module: m, Keeper: k, Out: depinject.Out{}}
|
||||||
|
@ -6,10 +6,12 @@ import (
|
|||||||
"cosmossdk.io/log"
|
"cosmossdk.io/log"
|
||||||
"cosmossdk.io/orm/model/ormdb"
|
"cosmossdk.io/orm/model/ormdb"
|
||||||
"github.com/cosmos/cosmos-sdk/codec"
|
"github.com/cosmos/cosmos-sdk/codec"
|
||||||
|
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
|
||||||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||||
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
|
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
|
||||||
|
|
||||||
apiv1 "github.com/onsonr/sonr/api/macaroon/v1"
|
apiv1 "github.com/onsonr/sonr/api/macaroon/v1"
|
||||||
|
didkeeper "github.com/onsonr/sonr/x/did/keeper"
|
||||||
"github.com/onsonr/sonr/x/macaroon/types"
|
"github.com/onsonr/sonr/x/macaroon/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -23,6 +25,9 @@ type Keeper struct {
|
|||||||
Params collections.Item[types.Params]
|
Params collections.Item[types.Params]
|
||||||
OrmDB apiv1.StateStore
|
OrmDB apiv1.StateStore
|
||||||
|
|
||||||
|
AccountKeeper authkeeper.AccountKeeper
|
||||||
|
DIDKeeper didkeeper.Keeper
|
||||||
|
|
||||||
authority string
|
authority string
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -32,6 +37,8 @@ func NewKeeper(
|
|||||||
storeService storetypes.KVStoreService,
|
storeService storetypes.KVStoreService,
|
||||||
logger log.Logger,
|
logger log.Logger,
|
||||||
authority string,
|
authority string,
|
||||||
|
accKeeper authkeeper.AccountKeeper,
|
||||||
|
didKeeper didkeeper.Keeper,
|
||||||
) Keeper {
|
) Keeper {
|
||||||
logger = logger.With(log.ModuleKey, "x/"+types.ModuleName)
|
logger = logger.With(log.ModuleKey, "x/"+types.ModuleName)
|
||||||
|
|
||||||
@ -58,6 +65,9 @@ func NewKeeper(
|
|||||||
Params: collections.NewItem(sb, types.ParamsKey, "params", codec.CollValue[types.Params](cdc)),
|
Params: collections.NewItem(sb, types.ParamsKey, "params", codec.CollValue[types.Params](cdc)),
|
||||||
OrmDB: store,
|
OrmDB: store,
|
||||||
|
|
||||||
|
AccountKeeper: accKeeper,
|
||||||
|
DIDKeeper: didKeeper,
|
||||||
|
|
||||||
authority: authority,
|
authority: authority,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ func SetupTest(t *testing.T) *testFixture {
|
|||||||
registerBaseSDKModules(f, encCfg, storeService, logger, require)
|
registerBaseSDKModules(f, encCfg, storeService, logger, require)
|
||||||
|
|
||||||
// Setup Keeper.
|
// Setup Keeper.
|
||||||
f.k = keeper.NewKeeper(encCfg.Codec, storeService, logger, f.govModAddr)
|
f.k = keeper.NewKeeper(encCfg.Codec, storeService, logger, f.govModAddr, f.accountkeeper, f.didk)
|
||||||
f.msgServer = keeper.NewMsgServerImpl(f.k)
|
f.msgServer = keeper.NewMsgServerImpl(f.k)
|
||||||
f.queryServer = keeper.NewQuerier(f.k)
|
f.queryServer = keeper.NewQuerier(f.k)
|
||||||
f.appModule = module.NewAppModule(encCfg.Codec, f.k, f.didk)
|
f.appModule = module.NewAppModule(encCfg.Codec, f.k, f.didk)
|
||||||
|
@ -32,13 +32,11 @@ func (k Querier) Params(c context.Context, req *types.QueryParamsRequest) (*type
|
|||||||
// RefreshToken implements types.QueryServer.
|
// RefreshToken implements types.QueryServer.
|
||||||
func (k Querier) RefreshToken(goCtx context.Context, req *types.QueryRefreshTokenRequest) (*types.QueryRefreshTokenResponse, error) {
|
func (k Querier) RefreshToken(goCtx context.Context, req *types.QueryRefreshTokenRequest) (*types.QueryRefreshTokenResponse, error) {
|
||||||
// ctx := sdk.UnwrapSDKContext(goCtx)
|
// ctx := sdk.UnwrapSDKContext(goCtx)
|
||||||
panic("RefreshToken is unimplemented")
|
|
||||||
return &types.QueryRefreshTokenResponse{}, nil
|
return &types.QueryRefreshTokenResponse{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ValidateToken implements types.QueryServer.
|
// ValidateToken implements types.QueryServer.
|
||||||
func (k Querier) ValidateToken(goCtx context.Context, req *types.QueryValidateTokenRequest) (*types.QueryValidateTokenResponse, error) {
|
func (k Querier) ValidateToken(goCtx context.Context, req *types.QueryValidateTokenRequest) (*types.QueryValidateTokenResponse, error) {
|
||||||
// ctx := sdk.UnwrapSDKContext(goCtx)
|
// ctx := sdk.UnwrapSDKContext(goCtx)
|
||||||
panic("ValidateToken is unimplemented")
|
|
||||||
return &types.QueryValidateTokenResponse{}, nil
|
return &types.QueryValidateTokenResponse{}, nil
|
||||||
}
|
}
|
||||||
|
@ -3,9 +3,9 @@ package keeper
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
|
"cosmossdk.io/errors"
|
||||||
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
|
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
|
||||||
|
|
||||||
"cosmossdk.io/errors"
|
|
||||||
"github.com/onsonr/sonr/x/macaroon/types"
|
"github.com/onsonr/sonr/x/macaroon/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -31,13 +31,11 @@ func (ms msgServer) UpdateParams(ctx context.Context, msg *types.MsgUpdateParams
|
|||||||
// AuthorizeService implements types.MsgServer.
|
// AuthorizeService implements types.MsgServer.
|
||||||
func (ms msgServer) AuthorizeService(ctx context.Context, msg *types.MsgIssueMacaroon) (*types.MsgIssueMacaroonResponse, error) {
|
func (ms msgServer) AuthorizeService(ctx context.Context, msg *types.MsgIssueMacaroon) (*types.MsgIssueMacaroonResponse, error) {
|
||||||
// ctx := sdk.UnwrapSDKContext(goCtx)
|
// ctx := sdk.UnwrapSDKContext(goCtx)
|
||||||
panic("AuthorizeService is unimplemented")
|
|
||||||
return &types.MsgIssueMacaroonResponse{}, nil
|
return &types.MsgIssueMacaroonResponse{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// IssueMacaroon implements types.MsgServer.
|
// IssueMacaroon implements types.MsgServer.
|
||||||
func (ms msgServer) IssueMacaroon(ctx context.Context, msg *types.MsgIssueMacaroon) (*types.MsgIssueMacaroonResponse, error) {
|
func (ms msgServer) IssueMacaroon(ctx context.Context, msg *types.MsgIssueMacaroon) (*types.MsgIssueMacaroonResponse, error) {
|
||||||
// ctx := sdk.UnwrapSDKContext(goCtx)
|
// ctx := sdk.UnwrapSDKContext(goCtx)
|
||||||
panic("IssueMacaroon is unimplemented")
|
|
||||||
return &types.MsgIssueMacaroonResponse{}, nil
|
return &types.MsgIssueMacaroonResponse{}, nil
|
||||||
}
|
}
|
||||||
|
@ -135,7 +135,8 @@ func (m *Params) GetCaveats() *Caveats {
|
|||||||
|
|
||||||
// Methods defines the available DID methods
|
// Methods defines the available DID methods
|
||||||
type Methods struct {
|
type Methods struct {
|
||||||
Methods []string `protobuf:"bytes,1,rep,name=methods,proto3" json:"methods,omitempty"`
|
Default string `protobuf:"bytes,1,opt,name=default,proto3" json:"default,omitempty"`
|
||||||
|
Supported []string `protobuf:"bytes,2,rep,name=supported,proto3" json:"supported,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Methods) Reset() { *m = Methods{} }
|
func (m *Methods) Reset() { *m = Methods{} }
|
||||||
@ -171,16 +172,24 @@ func (m *Methods) XXX_DiscardUnknown() {
|
|||||||
|
|
||||||
var xxx_messageInfo_Methods proto.InternalMessageInfo
|
var xxx_messageInfo_Methods proto.InternalMessageInfo
|
||||||
|
|
||||||
func (m *Methods) GetMethods() []string {
|
func (m *Methods) GetDefault() string {
|
||||||
if m != nil {
|
if m != nil {
|
||||||
return m.Methods
|
return m.Default
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Methods) GetSupported() []string {
|
||||||
|
if m != nil {
|
||||||
|
return m.Supported
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Scopes defines the set of scopes
|
// Scopes defines the set of scopes
|
||||||
type Scopes struct {
|
type Scopes struct {
|
||||||
Scopes []string `protobuf:"bytes,1,rep,name=scopes,proto3" json:"scopes,omitempty"`
|
Base string `protobuf:"bytes,1,opt,name=base,proto3" json:"base,omitempty"`
|
||||||
|
Supported []string `protobuf:"bytes,2,rep,name=supported,proto3" json:"supported,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Scopes) Reset() { *m = Scopes{} }
|
func (m *Scopes) Reset() { *m = Scopes{} }
|
||||||
@ -216,16 +225,24 @@ func (m *Scopes) XXX_DiscardUnknown() {
|
|||||||
|
|
||||||
var xxx_messageInfo_Scopes proto.InternalMessageInfo
|
var xxx_messageInfo_Scopes proto.InternalMessageInfo
|
||||||
|
|
||||||
func (m *Scopes) GetScopes() []string {
|
func (m *Scopes) GetBase() string {
|
||||||
if m != nil {
|
if m != nil {
|
||||||
return m.Scopes
|
return m.Base
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Scopes) GetSupported() []string {
|
||||||
|
if m != nil {
|
||||||
|
return m.Supported
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Caveats defines the available caveats
|
// Caveats defines the available caveats
|
||||||
type Caveats struct {
|
type Caveats struct {
|
||||||
Caveats []string `protobuf:"bytes,1,rep,name=caveats,proto3" json:"caveats,omitempty"`
|
SupportedFirstParty []string `protobuf:"bytes,1,rep,name=supported_first_party,json=supportedFirstParty,proto3" json:"supported_first_party,omitempty"`
|
||||||
|
SupportedThirdParty []string `protobuf:"bytes,2,rep,name=supported_third_party,json=supportedThirdParty,proto3" json:"supported_third_party,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Caveats) Reset() { *m = Caveats{} }
|
func (m *Caveats) Reset() { *m = Caveats{} }
|
||||||
@ -261,9 +278,16 @@ func (m *Caveats) XXX_DiscardUnknown() {
|
|||||||
|
|
||||||
var xxx_messageInfo_Caveats proto.InternalMessageInfo
|
var xxx_messageInfo_Caveats proto.InternalMessageInfo
|
||||||
|
|
||||||
func (m *Caveats) GetCaveats() []string {
|
func (m *Caveats) GetSupportedFirstParty() []string {
|
||||||
if m != nil {
|
if m != nil {
|
||||||
return m.Caveats
|
return m.SupportedFirstParty
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Caveats) GetSupportedThirdParty() []string {
|
||||||
|
if m != nil {
|
||||||
|
return m.SupportedThirdParty
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -279,29 +303,33 @@ func init() {
|
|||||||
func init() { proto.RegisterFile("macaroon/v1/genesis.proto", fileDescriptor_06e0b5dfdf5e52ba) }
|
func init() { proto.RegisterFile("macaroon/v1/genesis.proto", fileDescriptor_06e0b5dfdf5e52ba) }
|
||||||
|
|
||||||
var fileDescriptor_06e0b5dfdf5e52ba = []byte{
|
var fileDescriptor_06e0b5dfdf5e52ba = []byte{
|
||||||
// 343 bytes of a gzipped FileDescriptorProto
|
// 414 bytes of a gzipped FileDescriptorProto
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcc, 0x4d, 0x4c, 0x4e,
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x92, 0x41, 0xcb, 0xd3, 0x30,
|
||||||
0x2c, 0xca, 0xcf, 0xcf, 0xd3, 0x2f, 0x33, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6,
|
0x18, 0xc7, 0x9b, 0xbd, 0x2f, 0x2d, 0xcb, 0x2b, 0xa8, 0xd9, 0x84, 0x6e, 0x8c, 0x6e, 0xf4, 0xe2,
|
||||||
0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x86, 0x49, 0xe9, 0x95, 0x19, 0x4a, 0x09, 0x26, 0xe6,
|
0x50, 0x68, 0xd9, 0xbc, 0xed, 0xb6, 0x09, 0x7a, 0x12, 0x46, 0xb7, 0x93, 0x08, 0x23, 0x6b, 0xb3,
|
||||||
0x66, 0xe6, 0xe5, 0xeb, 0x83, 0x49, 0x88, 0xbc, 0x94, 0x48, 0x7a, 0x7e, 0x7a, 0x3e, 0x98, 0xa9,
|
0xae, 0x60, 0x9b, 0x92, 0x64, 0xc3, 0x7d, 0x05, 0xbd, 0x78, 0xf4, 0xb8, 0x8f, 0x20, 0xf8, 0x25,
|
||||||
0x0f, 0x62, 0x41, 0x44, 0x95, 0x1c, 0xb9, 0x78, 0xdc, 0x21, 0xc6, 0x04, 0x97, 0x24, 0x96, 0xa4,
|
0x76, 0xdc, 0xd1, 0x93, 0xc8, 0x76, 0xd0, 0x8f, 0x21, 0x4d, 0xd2, 0xea, 0x74, 0xe0, 0x25, 0x3c,
|
||||||
0x0a, 0x19, 0x72, 0xb1, 0x15, 0x24, 0x16, 0x25, 0xe6, 0x16, 0x4b, 0x30, 0x2a, 0x30, 0x6a, 0x70,
|
0xcd, 0xef, 0xf9, 0xff, 0xfb, 0x7f, 0x1e, 0x02, 0x5b, 0x29, 0x0e, 0x31, 0xa3, 0x34, 0xf3, 0xb7,
|
||||||
0x1b, 0x09, 0xeb, 0x21, 0x19, 0xab, 0x17, 0x00, 0x96, 0x72, 0x62, 0x39, 0x71, 0x4f, 0x9e, 0x21,
|
0x03, 0x3f, 0x26, 0x19, 0xe1, 0x09, 0xf7, 0x72, 0x46, 0x05, 0x45, 0x77, 0x25, 0xf2, 0xb6, 0x83,
|
||||||
0x08, 0xaa, 0x50, 0x69, 0x33, 0x23, 0x17, 0x1b, 0x44, 0x42, 0x48, 0x8f, 0x8b, 0x3d, 0x37, 0xb5,
|
0xf6, 0x43, 0x9c, 0x26, 0x19, 0xf5, 0xe5, 0xa9, 0x78, 0xbb, 0x19, 0xd3, 0x98, 0xca, 0xd2, 0x2f,
|
||||||
0x24, 0x23, 0x3f, 0x05, 0xa6, 0x5d, 0x04, 0x45, 0xbb, 0x2f, 0x44, 0x2e, 0x08, 0xa6, 0x48, 0x48,
|
0x2a, 0x75, 0xeb, 0x8e, 0xe1, 0xbd, 0x97, 0xca, 0x66, 0x26, 0xb0, 0x20, 0x68, 0x00, 0xcd, 0x1c,
|
||||||
0x9b, 0x8b, 0xad, 0x38, 0x39, 0xbf, 0x20, 0xb5, 0x58, 0x82, 0x09, 0x8b, 0x6d, 0xc1, 0x60, 0xa9,
|
0x33, 0x9c, 0x72, 0x1b, 0xf4, 0x40, 0xff, 0x6e, 0xd8, 0xf0, 0xfe, 0xb0, 0xf5, 0xa6, 0x12, 0x4d,
|
||||||
0x20, 0xa8, 0x12, 0x90, 0xe1, 0xc9, 0x89, 0x65, 0xa9, 0x89, 0x25, 0xc5, 0x12, 0xcc, 0x58, 0x0c,
|
0x6e, 0x0f, 0xdf, 0xba, 0x46, 0xa0, 0x1b, 0xdd, 0x2f, 0x00, 0x9a, 0x0a, 0x20, 0x0f, 0x5a, 0x29,
|
||||||
0x77, 0x86, 0xc8, 0x05, 0xc1, 0x14, 0x59, 0xc9, 0xcc, 0x58, 0x20, 0xcf, 0xf0, 0x62, 0x81, 0x3c,
|
0x11, 0x6b, 0x1a, 0x95, 0xf2, 0xe6, 0x85, 0xfc, 0x95, 0x62, 0x41, 0xd9, 0x84, 0x9e, 0x42, 0x93,
|
||||||
0x63, 0xd7, 0xf3, 0x0d, 0x5a, 0xfc, 0xf0, 0x80, 0x83, 0xba, 0xda, 0x8e, 0x8b, 0x1d, 0xea, 0x1c,
|
0x87, 0x34, 0x27, 0xdc, 0xae, 0x5d, 0xf9, 0xdb, 0x4c, 0xa2, 0x40, 0xb7, 0x14, 0xe6, 0x21, 0xde,
|
||||||
0x21, 0x09, 0x64, 0x57, 0x33, 0x6b, 0x70, 0xc2, 0xdd, 0x67, 0x25, 0x09, 0xd3, 0x2e, 0x00, 0xd7,
|
0x12, 0x2c, 0xb8, 0x7d, 0x73, 0xc5, 0xfc, 0xb9, 0x62, 0x41, 0xd9, 0x34, 0xea, 0x7c, 0xda, 0x77,
|
||||||
0x0e, 0x95, 0x52, 0xb2, 0xe2, 0x62, 0x83, 0xb8, 0x4f, 0x48, 0x0c, 0xee, 0x09, 0x88, 0x6e, 0x28,
|
0x8d, 0x9f, 0xfb, 0x2e, 0x78, 0xff, 0xe3, 0xf3, 0x93, 0xfb, 0xd5, 0xe2, 0x74, 0xea, 0x37, 0xd0,
|
||||||
0xcf, 0x4a, 0x02, 0xd3, 0x6e, 0x88, 0x8c, 0x92, 0x2d, 0x17, 0x3b, 0xd4, 0xb5, 0x20, 0xbb, 0x61,
|
0xd2, 0x71, 0x90, 0x0d, 0xad, 0x88, 0xac, 0xf0, 0xe6, 0xad, 0x90, 0xa9, 0xeb, 0x41, 0xf9, 0x89,
|
||||||
0x9e, 0x82, 0xda, 0x0d, 0x73, 0x3e, 0x16, 0xed, 0x10, 0x29, 0x27, 0xc7, 0x13, 0x8f, 0xe4, 0x18,
|
0x3a, 0xb0, 0xce, 0x37, 0x79, 0x4e, 0x99, 0x20, 0x91, 0x5d, 0xeb, 0xdd, 0xf4, 0xeb, 0xc1, 0xef,
|
||||||
0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5,
|
0x8b, 0x51, 0xab, 0x34, 0x7f, 0x50, 0x99, 0xeb, 0xc1, 0xdc, 0x39, 0x34, 0x55, 0x7a, 0x84, 0xe0,
|
||||||
0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0x52, 0x4f, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce,
|
0xed, 0x12, 0x73, 0xa2, 0x9d, 0x65, 0xfd, 0x1f, 0x5b, 0xfb, 0xdf, 0xcc, 0x6a, 0x03, 0xee, 0x07,
|
||||||
0xcf, 0xd5, 0xcf, 0xcf, 0x2b, 0xce, 0xcf, 0x2b, 0xd2, 0x07, 0x13, 0x15, 0xfa, 0x70, 0x33, 0x4a,
|
0x00, 0x2d, 0x3d, 0x26, 0x1a, 0xc2, 0x47, 0x95, 0x64, 0xb1, 0x4a, 0x18, 0x17, 0x8b, 0x1c, 0x33,
|
||||||
0x2a, 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0xb1, 0x6f, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0xe5,
|
0xb1, 0xb3, 0x81, 0xf4, 0x6b, 0x54, 0xf0, 0x45, 0xc1, 0xa6, 0x05, 0xba, 0xd4, 0x88, 0x75, 0xc2,
|
||||||
0x08, 0x7e, 0x28, 0x50, 0x02, 0x00, 0x00,
|
0x22, 0xad, 0xa9, 0xfd, 0xa5, 0x99, 0x17, 0x4c, 0x6a, 0xae, 0xa5, 0x51, 0x0b, 0x9e, 0x8c, 0x0f,
|
||||||
|
0x27, 0x07, 0x1c, 0x4f, 0x0e, 0xf8, 0x7e, 0x72, 0xc0, 0xc7, 0xb3, 0x63, 0x1c, 0xcf, 0x8e, 0xf1,
|
||||||
|
0xf5, 0xec, 0x18, 0xaf, 0x1f, 0xc7, 0x89, 0x58, 0x6f, 0x96, 0x5e, 0x48, 0x53, 0x9f, 0x66, 0x9c,
|
||||||
|
0x66, 0xcc, 0x97, 0xc7, 0x3b, 0xbf, 0xf2, 0x10, 0xbb, 0x9c, 0xf0, 0xa5, 0x29, 0x1f, 0xe1, 0xb3,
|
||||||
|
0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xa7, 0xa6, 0x33, 0x5b, 0xd7, 0x02, 0x00, 0x00,
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Params) Equal(that interface{}) bool {
|
func (this *Params) Equal(that interface{}) bool {
|
||||||
@ -353,11 +381,14 @@ func (this *Methods) Equal(that interface{}) bool {
|
|||||||
} else if this == nil {
|
} else if this == nil {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if len(this.Methods) != len(that1.Methods) {
|
if this.Default != that1.Default {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
for i := range this.Methods {
|
if len(this.Supported) != len(that1.Supported) {
|
||||||
if this.Methods[i] != that1.Methods[i] {
|
return false
|
||||||
|
}
|
||||||
|
for i := range this.Supported {
|
||||||
|
if this.Supported[i] != that1.Supported[i] {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -382,11 +413,14 @@ func (this *Scopes) Equal(that interface{}) bool {
|
|||||||
} else if this == nil {
|
} else if this == nil {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if len(this.Scopes) != len(that1.Scopes) {
|
if this.Base != that1.Base {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
for i := range this.Scopes {
|
if len(this.Supported) != len(that1.Supported) {
|
||||||
if this.Scopes[i] != that1.Scopes[i] {
|
return false
|
||||||
|
}
|
||||||
|
for i := range this.Supported {
|
||||||
|
if this.Supported[i] != that1.Supported[i] {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -411,11 +445,19 @@ func (this *Caveats) Equal(that interface{}) bool {
|
|||||||
} else if this == nil {
|
} else if this == nil {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if len(this.Caveats) != len(that1.Caveats) {
|
if len(this.SupportedFirstParty) != len(that1.SupportedFirstParty) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
for i := range this.Caveats {
|
for i := range this.SupportedFirstParty {
|
||||||
if this.Caveats[i] != that1.Caveats[i] {
|
if this.SupportedFirstParty[i] != that1.SupportedFirstParty[i] {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(this.SupportedThirdParty) != len(that1.SupportedThirdParty) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
for i := range this.SupportedThirdParty {
|
||||||
|
if this.SupportedThirdParty[i] != that1.SupportedThirdParty[i] {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -533,15 +575,22 @@ func (m *Methods) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|||||||
_ = i
|
_ = i
|
||||||
var l int
|
var l int
|
||||||
_ = l
|
_ = l
|
||||||
if len(m.Methods) > 0 {
|
if len(m.Supported) > 0 {
|
||||||
for iNdEx := len(m.Methods) - 1; iNdEx >= 0; iNdEx-- {
|
for iNdEx := len(m.Supported) - 1; iNdEx >= 0; iNdEx-- {
|
||||||
i -= len(m.Methods[iNdEx])
|
i -= len(m.Supported[iNdEx])
|
||||||
copy(dAtA[i:], m.Methods[iNdEx])
|
copy(dAtA[i:], m.Supported[iNdEx])
|
||||||
i = encodeVarintGenesis(dAtA, i, uint64(len(m.Methods[iNdEx])))
|
i = encodeVarintGenesis(dAtA, i, uint64(len(m.Supported[iNdEx])))
|
||||||
|
i--
|
||||||
|
dAtA[i] = 0x12
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(m.Default) > 0 {
|
||||||
|
i -= len(m.Default)
|
||||||
|
copy(dAtA[i:], m.Default)
|
||||||
|
i = encodeVarintGenesis(dAtA, i, uint64(len(m.Default)))
|
||||||
i--
|
i--
|
||||||
dAtA[i] = 0xa
|
dAtA[i] = 0xa
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return len(dAtA) - i, nil
|
return len(dAtA) - i, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -565,15 +614,22 @@ func (m *Scopes) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|||||||
_ = i
|
_ = i
|
||||||
var l int
|
var l int
|
||||||
_ = l
|
_ = l
|
||||||
if len(m.Scopes) > 0 {
|
if len(m.Supported) > 0 {
|
||||||
for iNdEx := len(m.Scopes) - 1; iNdEx >= 0; iNdEx-- {
|
for iNdEx := len(m.Supported) - 1; iNdEx >= 0; iNdEx-- {
|
||||||
i -= len(m.Scopes[iNdEx])
|
i -= len(m.Supported[iNdEx])
|
||||||
copy(dAtA[i:], m.Scopes[iNdEx])
|
copy(dAtA[i:], m.Supported[iNdEx])
|
||||||
i = encodeVarintGenesis(dAtA, i, uint64(len(m.Scopes[iNdEx])))
|
i = encodeVarintGenesis(dAtA, i, uint64(len(m.Supported[iNdEx])))
|
||||||
|
i--
|
||||||
|
dAtA[i] = 0x12
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(m.Base) > 0 {
|
||||||
|
i -= len(m.Base)
|
||||||
|
copy(dAtA[i:], m.Base)
|
||||||
|
i = encodeVarintGenesis(dAtA, i, uint64(len(m.Base)))
|
||||||
i--
|
i--
|
||||||
dAtA[i] = 0xa
|
dAtA[i] = 0xa
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return len(dAtA) - i, nil
|
return len(dAtA) - i, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -597,11 +653,20 @@ func (m *Caveats) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|||||||
_ = i
|
_ = i
|
||||||
var l int
|
var l int
|
||||||
_ = l
|
_ = l
|
||||||
if len(m.Caveats) > 0 {
|
if len(m.SupportedThirdParty) > 0 {
|
||||||
for iNdEx := len(m.Caveats) - 1; iNdEx >= 0; iNdEx-- {
|
for iNdEx := len(m.SupportedThirdParty) - 1; iNdEx >= 0; iNdEx-- {
|
||||||
i -= len(m.Caveats[iNdEx])
|
i -= len(m.SupportedThirdParty[iNdEx])
|
||||||
copy(dAtA[i:], m.Caveats[iNdEx])
|
copy(dAtA[i:], m.SupportedThirdParty[iNdEx])
|
||||||
i = encodeVarintGenesis(dAtA, i, uint64(len(m.Caveats[iNdEx])))
|
i = encodeVarintGenesis(dAtA, i, uint64(len(m.SupportedThirdParty[iNdEx])))
|
||||||
|
i--
|
||||||
|
dAtA[i] = 0x12
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(m.SupportedFirstParty) > 0 {
|
||||||
|
for iNdEx := len(m.SupportedFirstParty) - 1; iNdEx >= 0; iNdEx-- {
|
||||||
|
i -= len(m.SupportedFirstParty[iNdEx])
|
||||||
|
copy(dAtA[i:], m.SupportedFirstParty[iNdEx])
|
||||||
|
i = encodeVarintGenesis(dAtA, i, uint64(len(m.SupportedFirstParty[iNdEx])))
|
||||||
i--
|
i--
|
||||||
dAtA[i] = 0xa
|
dAtA[i] = 0xa
|
||||||
}
|
}
|
||||||
@ -658,8 +723,12 @@ func (m *Methods) Size() (n int) {
|
|||||||
}
|
}
|
||||||
var l int
|
var l int
|
||||||
_ = l
|
_ = l
|
||||||
if len(m.Methods) > 0 {
|
l = len(m.Default)
|
||||||
for _, s := range m.Methods {
|
if l > 0 {
|
||||||
|
n += 1 + l + sovGenesis(uint64(l))
|
||||||
|
}
|
||||||
|
if len(m.Supported) > 0 {
|
||||||
|
for _, s := range m.Supported {
|
||||||
l = len(s)
|
l = len(s)
|
||||||
n += 1 + l + sovGenesis(uint64(l))
|
n += 1 + l + sovGenesis(uint64(l))
|
||||||
}
|
}
|
||||||
@ -673,8 +742,12 @@ func (m *Scopes) Size() (n int) {
|
|||||||
}
|
}
|
||||||
var l int
|
var l int
|
||||||
_ = l
|
_ = l
|
||||||
if len(m.Scopes) > 0 {
|
l = len(m.Base)
|
||||||
for _, s := range m.Scopes {
|
if l > 0 {
|
||||||
|
n += 1 + l + sovGenesis(uint64(l))
|
||||||
|
}
|
||||||
|
if len(m.Supported) > 0 {
|
||||||
|
for _, s := range m.Supported {
|
||||||
l = len(s)
|
l = len(s)
|
||||||
n += 1 + l + sovGenesis(uint64(l))
|
n += 1 + l + sovGenesis(uint64(l))
|
||||||
}
|
}
|
||||||
@ -688,8 +761,14 @@ func (m *Caveats) Size() (n int) {
|
|||||||
}
|
}
|
||||||
var l int
|
var l int
|
||||||
_ = l
|
_ = l
|
||||||
if len(m.Caveats) > 0 {
|
if len(m.SupportedFirstParty) > 0 {
|
||||||
for _, s := range m.Caveats {
|
for _, s := range m.SupportedFirstParty {
|
||||||
|
l = len(s)
|
||||||
|
n += 1 + l + sovGenesis(uint64(l))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(m.SupportedThirdParty) > 0 {
|
||||||
|
for _, s := range m.SupportedThirdParty {
|
||||||
l = len(s)
|
l = len(s)
|
||||||
n += 1 + l + sovGenesis(uint64(l))
|
n += 1 + l + sovGenesis(uint64(l))
|
||||||
}
|
}
|
||||||
@ -975,7 +1054,7 @@ func (m *Methods) Unmarshal(dAtA []byte) error {
|
|||||||
switch fieldNum {
|
switch fieldNum {
|
||||||
case 1:
|
case 1:
|
||||||
if wireType != 2 {
|
if wireType != 2 {
|
||||||
return fmt.Errorf("proto: wrong wireType = %d for field Methods", wireType)
|
return fmt.Errorf("proto: wrong wireType = %d for field Default", wireType)
|
||||||
}
|
}
|
||||||
var stringLen uint64
|
var stringLen uint64
|
||||||
for shift := uint(0); ; shift += 7 {
|
for shift := uint(0); ; shift += 7 {
|
||||||
@ -1003,7 +1082,39 @@ func (m *Methods) Unmarshal(dAtA []byte) error {
|
|||||||
if postIndex > l {
|
if postIndex > l {
|
||||||
return io.ErrUnexpectedEOF
|
return io.ErrUnexpectedEOF
|
||||||
}
|
}
|
||||||
m.Methods = append(m.Methods, string(dAtA[iNdEx:postIndex]))
|
m.Default = string(dAtA[iNdEx:postIndex])
|
||||||
|
iNdEx = postIndex
|
||||||
|
case 2:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field Supported", wireType)
|
||||||
|
}
|
||||||
|
var stringLen uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowGenesis
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
stringLen |= uint64(b&0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
intStringLen := int(stringLen)
|
||||||
|
if intStringLen < 0 {
|
||||||
|
return ErrInvalidLengthGenesis
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + intStringLen
|
||||||
|
if postIndex < 0 {
|
||||||
|
return ErrInvalidLengthGenesis
|
||||||
|
}
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
m.Supported = append(m.Supported, string(dAtA[iNdEx:postIndex]))
|
||||||
iNdEx = postIndex
|
iNdEx = postIndex
|
||||||
default:
|
default:
|
||||||
iNdEx = preIndex
|
iNdEx = preIndex
|
||||||
@ -1057,7 +1168,7 @@ func (m *Scopes) Unmarshal(dAtA []byte) error {
|
|||||||
switch fieldNum {
|
switch fieldNum {
|
||||||
case 1:
|
case 1:
|
||||||
if wireType != 2 {
|
if wireType != 2 {
|
||||||
return fmt.Errorf("proto: wrong wireType = %d for field Scopes", wireType)
|
return fmt.Errorf("proto: wrong wireType = %d for field Base", wireType)
|
||||||
}
|
}
|
||||||
var stringLen uint64
|
var stringLen uint64
|
||||||
for shift := uint(0); ; shift += 7 {
|
for shift := uint(0); ; shift += 7 {
|
||||||
@ -1085,7 +1196,39 @@ func (m *Scopes) Unmarshal(dAtA []byte) error {
|
|||||||
if postIndex > l {
|
if postIndex > l {
|
||||||
return io.ErrUnexpectedEOF
|
return io.ErrUnexpectedEOF
|
||||||
}
|
}
|
||||||
m.Scopes = append(m.Scopes, string(dAtA[iNdEx:postIndex]))
|
m.Base = string(dAtA[iNdEx:postIndex])
|
||||||
|
iNdEx = postIndex
|
||||||
|
case 2:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field Supported", wireType)
|
||||||
|
}
|
||||||
|
var stringLen uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowGenesis
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
stringLen |= uint64(b&0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
intStringLen := int(stringLen)
|
||||||
|
if intStringLen < 0 {
|
||||||
|
return ErrInvalidLengthGenesis
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + intStringLen
|
||||||
|
if postIndex < 0 {
|
||||||
|
return ErrInvalidLengthGenesis
|
||||||
|
}
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
m.Supported = append(m.Supported, string(dAtA[iNdEx:postIndex]))
|
||||||
iNdEx = postIndex
|
iNdEx = postIndex
|
||||||
default:
|
default:
|
||||||
iNdEx = preIndex
|
iNdEx = preIndex
|
||||||
@ -1139,7 +1282,7 @@ func (m *Caveats) Unmarshal(dAtA []byte) error {
|
|||||||
switch fieldNum {
|
switch fieldNum {
|
||||||
case 1:
|
case 1:
|
||||||
if wireType != 2 {
|
if wireType != 2 {
|
||||||
return fmt.Errorf("proto: wrong wireType = %d for field Caveats", wireType)
|
return fmt.Errorf("proto: wrong wireType = %d for field SupportedFirstParty", wireType)
|
||||||
}
|
}
|
||||||
var stringLen uint64
|
var stringLen uint64
|
||||||
for shift := uint(0); ; shift += 7 {
|
for shift := uint(0); ; shift += 7 {
|
||||||
@ -1167,7 +1310,39 @@ func (m *Caveats) Unmarshal(dAtA []byte) error {
|
|||||||
if postIndex > l {
|
if postIndex > l {
|
||||||
return io.ErrUnexpectedEOF
|
return io.ErrUnexpectedEOF
|
||||||
}
|
}
|
||||||
m.Caveats = append(m.Caveats, string(dAtA[iNdEx:postIndex]))
|
m.SupportedFirstParty = append(m.SupportedFirstParty, string(dAtA[iNdEx:postIndex]))
|
||||||
|
iNdEx = postIndex
|
||||||
|
case 2:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field SupportedThirdParty", wireType)
|
||||||
|
}
|
||||||
|
var stringLen uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowGenesis
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
stringLen |= uint64(b&0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
intStringLen := int(stringLen)
|
||||||
|
if intStringLen < 0 {
|
||||||
|
return ErrInvalidLengthGenesis
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + intStringLen
|
||||||
|
if postIndex < 0 {
|
||||||
|
return ErrInvalidLengthGenesis
|
||||||
|
}
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
m.SupportedThirdParty = append(m.SupportedThirdParty, string(dAtA[iNdEx:postIndex]))
|
||||||
iNdEx = postIndex
|
iNdEx = postIndex
|
||||||
default:
|
default:
|
||||||
iNdEx = preIndex
|
iNdEx = preIndex
|
||||||
|
@ -6,8 +6,11 @@ import (
|
|||||||
|
|
||||||
// DefaultParams returns default module parameters.
|
// DefaultParams returns default module parameters.
|
||||||
func DefaultParams() Params {
|
func DefaultParams() Params {
|
||||||
// TODO:
|
return Params{
|
||||||
return Params{}
|
Methods: DefaultMethods(),
|
||||||
|
Scopes: DefaultScopes(),
|
||||||
|
Caveats: DefaultCaveats(),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stringer method for Params.
|
// Stringer method for Params.
|
||||||
@ -22,6 +25,28 @@ func (p Params) String() string {
|
|||||||
|
|
||||||
// Validate does the sanity check on the params.
|
// Validate does the sanity check on the params.
|
||||||
func (p Params) Validate() error {
|
func (p Params) Validate() error {
|
||||||
// TODO:
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func DefaultMethods() *Methods {
|
||||||
|
return &Methods{
|
||||||
|
Default: "did:sonr",
|
||||||
|
Supported: []string{"did:key", "did:web", "did:sonr", "did:ipfs", "did:btcr", "did:ethr"},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func DefaultScopes() *Scopes {
|
||||||
|
return &Scopes{
|
||||||
|
Base: "openid profile sonr.address",
|
||||||
|
Supported: []string{"create", "read", "update", "delete", "sign", "verify", "simulate", "execute", "broadcast", "admin"},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func DefaultCaveats() *Caveats {
|
||||||
|
return &Caveats{
|
||||||
|
// First party - JWT Format
|
||||||
|
SupportedFirstParty: []string{"aud", "exp", "iat", "iss", "nbf", "nonce", "sub"},
|
||||||
|
// Third party - UCAN Format
|
||||||
|
SupportedThirdParty: []string{"cap", "nbf", "exp", "att", "prf", "rmt", "sig", "ucv"},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -99,14 +99,99 @@ func (m *Grant) GetExpiryHeight() int64 {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Macaroon struct {
|
||||||
|
Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||||
|
Controller string `protobuf:"bytes,2,opt,name=controller,proto3" json:"controller,omitempty"`
|
||||||
|
Subject string `protobuf:"bytes,3,opt,name=subject,proto3" json:"subject,omitempty"`
|
||||||
|
Origin string `protobuf:"bytes,4,opt,name=origin,proto3" json:"origin,omitempty"`
|
||||||
|
ExpiryHeight int64 `protobuf:"varint,5,opt,name=expiry_height,json=expiryHeight,proto3" json:"expiry_height,omitempty"`
|
||||||
|
Macaroon string `protobuf:"bytes,6,opt,name=macaroon,proto3" json:"macaroon,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Macaroon) Reset() { *m = Macaroon{} }
|
||||||
|
func (m *Macaroon) String() string { return proto.CompactTextString(m) }
|
||||||
|
func (*Macaroon) ProtoMessage() {}
|
||||||
|
func (*Macaroon) Descriptor() ([]byte, []int) {
|
||||||
|
return fileDescriptor_2ade56339acadfd8, []int{1}
|
||||||
|
}
|
||||||
|
func (m *Macaroon) XXX_Unmarshal(b []byte) error {
|
||||||
|
return m.Unmarshal(b)
|
||||||
|
}
|
||||||
|
func (m *Macaroon) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||||
|
if deterministic {
|
||||||
|
return xxx_messageInfo_Macaroon.Marshal(b, m, deterministic)
|
||||||
|
} else {
|
||||||
|
b = b[:cap(b)]
|
||||||
|
n, err := m.MarshalToSizedBuffer(b)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return b[:n], nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func (m *Macaroon) XXX_Merge(src proto.Message) {
|
||||||
|
xxx_messageInfo_Macaroon.Merge(m, src)
|
||||||
|
}
|
||||||
|
func (m *Macaroon) XXX_Size() int {
|
||||||
|
return m.Size()
|
||||||
|
}
|
||||||
|
func (m *Macaroon) XXX_DiscardUnknown() {
|
||||||
|
xxx_messageInfo_Macaroon.DiscardUnknown(m)
|
||||||
|
}
|
||||||
|
|
||||||
|
var xxx_messageInfo_Macaroon proto.InternalMessageInfo
|
||||||
|
|
||||||
|
func (m *Macaroon) GetId() uint64 {
|
||||||
|
if m != nil {
|
||||||
|
return m.Id
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Macaroon) GetController() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.Controller
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Macaroon) GetSubject() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.Subject
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Macaroon) GetOrigin() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.Origin
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Macaroon) GetExpiryHeight() int64 {
|
||||||
|
if m != nil {
|
||||||
|
return m.ExpiryHeight
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Macaroon) GetMacaroon() string {
|
||||||
|
if m != nil {
|
||||||
|
return m.Macaroon
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
proto.RegisterType((*Grant)(nil), "macaroon.v1.Grant")
|
proto.RegisterType((*Grant)(nil), "macaroon.v1.Grant")
|
||||||
|
proto.RegisterType((*Macaroon)(nil), "macaroon.v1.Macaroon")
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { proto.RegisterFile("macaroon/v1/state.proto", fileDescriptor_2ade56339acadfd8) }
|
func init() { proto.RegisterFile("macaroon/v1/state.proto", fileDescriptor_2ade56339acadfd8) }
|
||||||
|
|
||||||
var fileDescriptor_2ade56339acadfd8 = []byte{
|
var fileDescriptor_2ade56339acadfd8 = []byte{
|
||||||
// 280 bytes of a gzipped FileDescriptorProto
|
// 306 bytes of a gzipped FileDescriptorProto
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xcf, 0x4d, 0x4c, 0x4e,
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xcf, 0x4d, 0x4c, 0x4e,
|
||||||
0x2c, 0xca, 0xcf, 0xcf, 0xd3, 0x2f, 0x33, 0xd4, 0x2f, 0x2e, 0x49, 0x2c, 0x49, 0xd5, 0x2b, 0x28,
|
0x2c, 0xca, 0xcf, 0xcf, 0xd3, 0x2f, 0x33, 0xd4, 0x2f, 0x2e, 0x49, 0x2c, 0x49, 0xd5, 0x2b, 0x28,
|
||||||
0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x86, 0x49, 0xe8, 0x95, 0x19, 0x4a, 0x89, 0x27, 0xe7, 0x17, 0xe7,
|
0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x86, 0x49, 0xe8, 0x95, 0x19, 0x4a, 0x89, 0x27, 0xe7, 0x17, 0xe7,
|
||||||
@ -119,12 +204,14 @@ var fileDescriptor_2ade56339acadfd8 = []byte{
|
|||||||
0x99, 0x8b, 0x37, 0xb5, 0xa2, 0x20, 0xb3, 0xa8, 0x32, 0x3e, 0x23, 0x35, 0x33, 0x3d, 0xa3, 0x44,
|
0x99, 0x8b, 0x37, 0xb5, 0xa2, 0x20, 0xb3, 0xa8, 0x32, 0x3e, 0x23, 0x35, 0x33, 0x3d, 0xa3, 0x44,
|
||||||
0x82, 0x55, 0x81, 0x51, 0x83, 0x39, 0x88, 0x07, 0x22, 0xe8, 0x01, 0x16, 0xb3, 0x52, 0xfb, 0x34,
|
0x82, 0x55, 0x81, 0x51, 0x83, 0x39, 0x88, 0x07, 0x22, 0xe8, 0x01, 0x16, 0xb3, 0x52, 0xfb, 0x34,
|
||||||
0xef, 0x72, 0x1f, 0xb3, 0x02, 0x17, 0x1b, 0xc8, 0x39, 0x02, 0x8c, 0x42, 0x22, 0x5c, 0x7c, 0x50,
|
0xef, 0x72, 0x1f, 0xb3, 0x02, 0x17, 0x1b, 0xc8, 0x39, 0x02, 0x8c, 0x42, 0x22, 0x5c, 0x7c, 0x50,
|
||||||
0x73, 0x75, 0x20, 0xc6, 0x08, 0x30, 0x4a, 0x30, 0x4a, 0x30, 0x3a, 0x39, 0x9e, 0x78, 0x24, 0xc7,
|
0x73, 0x75, 0x20, 0xc6, 0x08, 0x30, 0x4a, 0x30, 0x4a, 0x30, 0x2a, 0x5d, 0x65, 0xe4, 0xe2, 0xf0,
|
||||||
0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c,
|
0x85, 0xfa, 0x70, 0x90, 0xb8, 0x5d, 0x48, 0x8a, 0x8b, 0x03, 0x16, 0xe8, 0x12, 0x6c, 0x60, 0xed,
|
||||||
0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x7a, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72,
|
0x70, 0x3e, 0xb1, 0xfe, 0x72, 0x72, 0x3c, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07,
|
||||||
0x7e, 0xae, 0x7e, 0x7e, 0x5e, 0x71, 0x7e, 0x5e, 0x91, 0x3e, 0x98, 0xa8, 0xd0, 0x87, 0x07, 0x55,
|
0x8f, 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86,
|
||||||
0x49, 0x65, 0x41, 0x6a, 0x71, 0x12, 0x1b, 0x38, 0x08, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff,
|
0x28, 0xf5, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0xfd, 0xfc, 0xbc, 0xe2,
|
||||||
0x83, 0x14, 0xb8, 0x7a, 0x43, 0x01, 0x00, 0x00,
|
0xfc, 0xbc, 0x22, 0x7d, 0x30, 0x51, 0xa1, 0x0f, 0x4f, 0x02, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49,
|
||||||
|
0x6c, 0xe0, 0xa8, 0x35, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0xab, 0x93, 0xfc, 0x98, 0x1b, 0x02,
|
||||||
|
0x00, 0x00,
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Grant) Marshal() (dAtA []byte, err error) {
|
func (m *Grant) Marshal() (dAtA []byte, err error) {
|
||||||
@ -181,6 +268,67 @@ func (m *Grant) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|||||||
return len(dAtA) - i, nil
|
return len(dAtA) - i, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *Macaroon) Marshal() (dAtA []byte, err error) {
|
||||||
|
size := m.Size()
|
||||||
|
dAtA = make([]byte, size)
|
||||||
|
n, err := m.MarshalToSizedBuffer(dAtA[:size])
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return dAtA[:n], nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Macaroon) MarshalTo(dAtA []byte) (int, error) {
|
||||||
|
size := m.Size()
|
||||||
|
return m.MarshalToSizedBuffer(dAtA[:size])
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Macaroon) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
||||||
|
i := len(dAtA)
|
||||||
|
_ = i
|
||||||
|
var l int
|
||||||
|
_ = l
|
||||||
|
if len(m.Macaroon) > 0 {
|
||||||
|
i -= len(m.Macaroon)
|
||||||
|
copy(dAtA[i:], m.Macaroon)
|
||||||
|
i = encodeVarintState(dAtA, i, uint64(len(m.Macaroon)))
|
||||||
|
i--
|
||||||
|
dAtA[i] = 0x32
|
||||||
|
}
|
||||||
|
if m.ExpiryHeight != 0 {
|
||||||
|
i = encodeVarintState(dAtA, i, uint64(m.ExpiryHeight))
|
||||||
|
i--
|
||||||
|
dAtA[i] = 0x28
|
||||||
|
}
|
||||||
|
if len(m.Origin) > 0 {
|
||||||
|
i -= len(m.Origin)
|
||||||
|
copy(dAtA[i:], m.Origin)
|
||||||
|
i = encodeVarintState(dAtA, i, uint64(len(m.Origin)))
|
||||||
|
i--
|
||||||
|
dAtA[i] = 0x22
|
||||||
|
}
|
||||||
|
if len(m.Subject) > 0 {
|
||||||
|
i -= len(m.Subject)
|
||||||
|
copy(dAtA[i:], m.Subject)
|
||||||
|
i = encodeVarintState(dAtA, i, uint64(len(m.Subject)))
|
||||||
|
i--
|
||||||
|
dAtA[i] = 0x1a
|
||||||
|
}
|
||||||
|
if len(m.Controller) > 0 {
|
||||||
|
i -= len(m.Controller)
|
||||||
|
copy(dAtA[i:], m.Controller)
|
||||||
|
i = encodeVarintState(dAtA, i, uint64(len(m.Controller)))
|
||||||
|
i--
|
||||||
|
dAtA[i] = 0x12
|
||||||
|
}
|
||||||
|
if m.Id != 0 {
|
||||||
|
i = encodeVarintState(dAtA, i, uint64(m.Id))
|
||||||
|
i--
|
||||||
|
dAtA[i] = 0x8
|
||||||
|
}
|
||||||
|
return len(dAtA) - i, nil
|
||||||
|
}
|
||||||
|
|
||||||
func encodeVarintState(dAtA []byte, offset int, v uint64) int {
|
func encodeVarintState(dAtA []byte, offset int, v uint64) int {
|
||||||
offset -= sovState(v)
|
offset -= sovState(v)
|
||||||
base := offset
|
base := offset
|
||||||
@ -219,6 +367,37 @@ func (m *Grant) Size() (n int) {
|
|||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *Macaroon) Size() (n int) {
|
||||||
|
if m == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
var l int
|
||||||
|
_ = l
|
||||||
|
if m.Id != 0 {
|
||||||
|
n += 1 + sovState(uint64(m.Id))
|
||||||
|
}
|
||||||
|
l = len(m.Controller)
|
||||||
|
if l > 0 {
|
||||||
|
n += 1 + l + sovState(uint64(l))
|
||||||
|
}
|
||||||
|
l = len(m.Subject)
|
||||||
|
if l > 0 {
|
||||||
|
n += 1 + l + sovState(uint64(l))
|
||||||
|
}
|
||||||
|
l = len(m.Origin)
|
||||||
|
if l > 0 {
|
||||||
|
n += 1 + l + sovState(uint64(l))
|
||||||
|
}
|
||||||
|
if m.ExpiryHeight != 0 {
|
||||||
|
n += 1 + sovState(uint64(m.ExpiryHeight))
|
||||||
|
}
|
||||||
|
l = len(m.Macaroon)
|
||||||
|
if l > 0 {
|
||||||
|
n += 1 + l + sovState(uint64(l))
|
||||||
|
}
|
||||||
|
return n
|
||||||
|
}
|
||||||
|
|
||||||
func sovState(x uint64) (n int) {
|
func sovState(x uint64) (n int) {
|
||||||
return (math_bits.Len64(x|1) + 6) / 7
|
return (math_bits.Len64(x|1) + 6) / 7
|
||||||
}
|
}
|
||||||
@ -409,6 +588,222 @@ func (m *Grant) Unmarshal(dAtA []byte) error {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
func (m *Macaroon) Unmarshal(dAtA []byte) error {
|
||||||
|
l := len(dAtA)
|
||||||
|
iNdEx := 0
|
||||||
|
for iNdEx < l {
|
||||||
|
preIndex := iNdEx
|
||||||
|
var wire uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowState
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
wire |= uint64(b&0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fieldNum := int32(wire >> 3)
|
||||||
|
wireType := int(wire & 0x7)
|
||||||
|
if wireType == 4 {
|
||||||
|
return fmt.Errorf("proto: Macaroon: wiretype end group for non-group")
|
||||||
|
}
|
||||||
|
if fieldNum <= 0 {
|
||||||
|
return fmt.Errorf("proto: Macaroon: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||||
|
}
|
||||||
|
switch fieldNum {
|
||||||
|
case 1:
|
||||||
|
if wireType != 0 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType)
|
||||||
|
}
|
||||||
|
m.Id = 0
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowState
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
m.Id |= uint64(b&0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case 2:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field Controller", wireType)
|
||||||
|
}
|
||||||
|
var stringLen uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowState
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
stringLen |= uint64(b&0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
intStringLen := int(stringLen)
|
||||||
|
if intStringLen < 0 {
|
||||||
|
return ErrInvalidLengthState
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + intStringLen
|
||||||
|
if postIndex < 0 {
|
||||||
|
return ErrInvalidLengthState
|
||||||
|
}
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
m.Controller = string(dAtA[iNdEx:postIndex])
|
||||||
|
iNdEx = postIndex
|
||||||
|
case 3:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field Subject", wireType)
|
||||||
|
}
|
||||||
|
var stringLen uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowState
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
stringLen |= uint64(b&0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
intStringLen := int(stringLen)
|
||||||
|
if intStringLen < 0 {
|
||||||
|
return ErrInvalidLengthState
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + intStringLen
|
||||||
|
if postIndex < 0 {
|
||||||
|
return ErrInvalidLengthState
|
||||||
|
}
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
m.Subject = string(dAtA[iNdEx:postIndex])
|
||||||
|
iNdEx = postIndex
|
||||||
|
case 4:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field Origin", wireType)
|
||||||
|
}
|
||||||
|
var stringLen uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowState
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
stringLen |= uint64(b&0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
intStringLen := int(stringLen)
|
||||||
|
if intStringLen < 0 {
|
||||||
|
return ErrInvalidLengthState
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + intStringLen
|
||||||
|
if postIndex < 0 {
|
||||||
|
return ErrInvalidLengthState
|
||||||
|
}
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
m.Origin = string(dAtA[iNdEx:postIndex])
|
||||||
|
iNdEx = postIndex
|
||||||
|
case 5:
|
||||||
|
if wireType != 0 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field ExpiryHeight", wireType)
|
||||||
|
}
|
||||||
|
m.ExpiryHeight = 0
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowState
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
m.ExpiryHeight |= int64(b&0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case 6:
|
||||||
|
if wireType != 2 {
|
||||||
|
return fmt.Errorf("proto: wrong wireType = %d for field Macaroon", wireType)
|
||||||
|
}
|
||||||
|
var stringLen uint64
|
||||||
|
for shift := uint(0); ; shift += 7 {
|
||||||
|
if shift >= 64 {
|
||||||
|
return ErrIntOverflowState
|
||||||
|
}
|
||||||
|
if iNdEx >= l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
b := dAtA[iNdEx]
|
||||||
|
iNdEx++
|
||||||
|
stringLen |= uint64(b&0x7F) << shift
|
||||||
|
if b < 0x80 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
intStringLen := int(stringLen)
|
||||||
|
if intStringLen < 0 {
|
||||||
|
return ErrInvalidLengthState
|
||||||
|
}
|
||||||
|
postIndex := iNdEx + intStringLen
|
||||||
|
if postIndex < 0 {
|
||||||
|
return ErrInvalidLengthState
|
||||||
|
}
|
||||||
|
if postIndex > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
m.Macaroon = string(dAtA[iNdEx:postIndex])
|
||||||
|
iNdEx = postIndex
|
||||||
|
default:
|
||||||
|
iNdEx = preIndex
|
||||||
|
skippy, err := skipState(dAtA[iNdEx:])
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if (skippy < 0) || (iNdEx+skippy) < 0 {
|
||||||
|
return ErrInvalidLengthState
|
||||||
|
}
|
||||||
|
if (iNdEx + skippy) > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
iNdEx += skippy
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if iNdEx > l {
|
||||||
|
return io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
func skipState(dAtA []byte) (n int, err error) {
|
func skipState(dAtA []byte) (n int, err error) {
|
||||||
l := len(dAtA)
|
l := len(dAtA)
|
||||||
iNdEx := 0
|
iNdEx := 0
|
||||||
|
@ -8,6 +8,7 @@ import (
|
|||||||
"cosmossdk.io/core/store"
|
"cosmossdk.io/core/store"
|
||||||
"cosmossdk.io/depinject"
|
"cosmossdk.io/depinject"
|
||||||
"cosmossdk.io/log"
|
"cosmossdk.io/log"
|
||||||
|
nftkeeper "cosmossdk.io/x/nft/keeper"
|
||||||
"github.com/cosmos/cosmos-sdk/codec"
|
"github.com/cosmos/cosmos-sdk/codec"
|
||||||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||||
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
|
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
|
||||||
@ -44,6 +45,7 @@ type ModuleInputs struct {
|
|||||||
|
|
||||||
DidKeeper didkeeper.Keeper
|
DidKeeper didkeeper.Keeper
|
||||||
MacaroonKeeper macaroonkeeper.Keeper
|
MacaroonKeeper macaroonkeeper.Keeper
|
||||||
|
NFTKeeper nftkeeper.Keeper
|
||||||
StakingKeeper stakingkeeper.Keeper
|
StakingKeeper stakingkeeper.Keeper
|
||||||
SlashingKeeper slashingkeeper.Keeper
|
SlashingKeeper slashingkeeper.Keeper
|
||||||
}
|
}
|
||||||
@ -58,7 +60,7 @@ type ModuleOutputs struct {
|
|||||||
func ProvideModule(in ModuleInputs) ModuleOutputs {
|
func ProvideModule(in ModuleInputs) ModuleOutputs {
|
||||||
govAddr := authtypes.NewModuleAddress(govtypes.ModuleName).String()
|
govAddr := authtypes.NewModuleAddress(govtypes.ModuleName).String()
|
||||||
|
|
||||||
k := keeper.NewKeeper(in.Cdc, in.StoreService, log.NewLogger(os.Stderr), govAddr)
|
k := keeper.NewKeeper(in.Cdc, in.StoreService, log.NewLogger(os.Stderr), govAddr, in.DidKeeper, in.MacaroonKeeper, in.NFTKeeper)
|
||||||
m := NewAppModule(in.Cdc, k, in.DidKeeper, in.MacaroonKeeper)
|
m := NewAppModule(in.Cdc, k, in.DidKeeper, in.MacaroonKeeper)
|
||||||
|
|
||||||
return ModuleOutputs{Module: m, Keeper: k, Out: depinject.Out{}}
|
return ModuleOutputs{Module: m, Keeper: k, Out: depinject.Out{}}
|
||||||
|
@ -5,11 +5,14 @@ import (
|
|||||||
storetypes "cosmossdk.io/core/store"
|
storetypes "cosmossdk.io/core/store"
|
||||||
"cosmossdk.io/log"
|
"cosmossdk.io/log"
|
||||||
"cosmossdk.io/orm/model/ormdb"
|
"cosmossdk.io/orm/model/ormdb"
|
||||||
|
nftkeeper "cosmossdk.io/x/nft/keeper"
|
||||||
"github.com/cosmos/cosmos-sdk/codec"
|
"github.com/cosmos/cosmos-sdk/codec"
|
||||||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||||
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
|
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
|
||||||
|
|
||||||
apiv1 "github.com/onsonr/sonr/api/service/v1"
|
apiv1 "github.com/onsonr/sonr/api/service/v1"
|
||||||
|
didkeeper "github.com/onsonr/sonr/x/did/keeper"
|
||||||
|
macaroonkeeper "github.com/onsonr/sonr/x/macaroon/keeper"
|
||||||
"github.com/onsonr/sonr/x/service/types"
|
"github.com/onsonr/sonr/x/service/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -24,6 +27,10 @@ type Keeper struct {
|
|||||||
OrmDB apiv1.StateStore
|
OrmDB apiv1.StateStore
|
||||||
|
|
||||||
authority string
|
authority string
|
||||||
|
|
||||||
|
DidKeeper didkeeper.Keeper
|
||||||
|
MacaroonKeeper macaroonkeeper.Keeper
|
||||||
|
NFTKeeper nftkeeper.Keeper
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewKeeper creates a new Keeper instance
|
// NewKeeper creates a new Keeper instance
|
||||||
@ -32,6 +39,9 @@ func NewKeeper(
|
|||||||
storeService storetypes.KVStoreService,
|
storeService storetypes.KVStoreService,
|
||||||
logger log.Logger,
|
logger log.Logger,
|
||||||
authority string,
|
authority string,
|
||||||
|
didKeeper didkeeper.Keeper,
|
||||||
|
macaroonKeeper macaroonkeeper.Keeper,
|
||||||
|
nftKeeper nftkeeper.Keeper,
|
||||||
) Keeper {
|
) Keeper {
|
||||||
logger = logger.With(log.ModuleKey, "x/"+types.ModuleName)
|
logger = logger.With(log.ModuleKey, "x/"+types.ModuleName)
|
||||||
|
|
||||||
@ -59,6 +69,7 @@ func NewKeeper(
|
|||||||
OrmDB: store,
|
OrmDB: store,
|
||||||
|
|
||||||
authority: authority,
|
authority: authority,
|
||||||
|
NFTKeeper: nftKeeper,
|
||||||
}
|
}
|
||||||
|
|
||||||
schema, err := sb.Build()
|
schema, err := sb.Build()
|
||||||
|
@ -6,6 +6,7 @@ import (
|
|||||||
"cosmossdk.io/core/store"
|
"cosmossdk.io/core/store"
|
||||||
"cosmossdk.io/log"
|
"cosmossdk.io/log"
|
||||||
storetypes "cosmossdk.io/store/types"
|
storetypes "cosmossdk.io/store/types"
|
||||||
|
nftkeeper "cosmossdk.io/x/nft/keeper"
|
||||||
"github.com/cosmos/cosmos-sdk/runtime"
|
"github.com/cosmos/cosmos-sdk/runtime"
|
||||||
"github.com/cosmos/cosmos-sdk/testutil"
|
"github.com/cosmos/cosmos-sdk/testutil"
|
||||||
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
|
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
|
||||||
@ -53,6 +54,7 @@ type testFixture struct {
|
|||||||
mack macaroonkeeper.Keeper
|
mack macaroonkeeper.Keeper
|
||||||
stakingKeeper *stakingkeeper.Keeper
|
stakingKeeper *stakingkeeper.Keeper
|
||||||
mintkeeper mintkeeper.Keeper
|
mintkeeper mintkeeper.Keeper
|
||||||
|
nftkeeper nftkeeper.Keeper
|
||||||
|
|
||||||
addrs []sdk.AccAddress
|
addrs []sdk.AccAddress
|
||||||
govModAddr string
|
govModAddr string
|
||||||
@ -80,7 +82,7 @@ func SetupTest(t *testing.T) *testFixture {
|
|||||||
registerBaseSDKModules(f, encCfg, storeService, logger, require)
|
registerBaseSDKModules(f, encCfg, storeService, logger, require)
|
||||||
|
|
||||||
// Setup Keeper.
|
// Setup Keeper.
|
||||||
f.k = keeper.NewKeeper(encCfg.Codec, storeService, logger, f.govModAddr)
|
f.k = keeper.NewKeeper(encCfg.Codec, storeService, logger, f.govModAddr, f.didkeeper, f.mack, f.nftkeeper)
|
||||||
f.msgServer = keeper.NewMsgServerImpl(f.k)
|
f.msgServer = keeper.NewMsgServerImpl(f.k)
|
||||||
f.queryServer = keeper.NewQuerier(f.k)
|
f.queryServer = keeper.NewQuerier(f.k)
|
||||||
f.appModule = module.NewAppModule(encCfg.Codec, f.k, f.didkeeper, f.mack)
|
f.appModule = module.NewAppModule(encCfg.Codec, f.k, f.didkeeper, f.mack)
|
||||||
|
@ -9,6 +9,7 @@ import (
|
|||||||
"cosmossdk.io/depinject"
|
"cosmossdk.io/depinject"
|
||||||
"cosmossdk.io/log"
|
"cosmossdk.io/log"
|
||||||
"github.com/cosmos/cosmos-sdk/codec"
|
"github.com/cosmos/cosmos-sdk/codec"
|
||||||
|
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
|
||||||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||||
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
|
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
|
||||||
slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper"
|
slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper"
|
||||||
@ -41,6 +42,7 @@ type ModuleInputs struct {
|
|||||||
StoreService store.KVStoreService
|
StoreService store.KVStoreService
|
||||||
AddressCodec address.Codec
|
AddressCodec address.Codec
|
||||||
|
|
||||||
|
AccountKeeper authkeeper.AccountKeeper
|
||||||
DidKeeper didkeeper.Keeper
|
DidKeeper didkeeper.Keeper
|
||||||
StakingKeeper stakingkeeper.Keeper
|
StakingKeeper stakingkeeper.Keeper
|
||||||
SlashingKeeper slashingkeeper.Keeper
|
SlashingKeeper slashingkeeper.Keeper
|
||||||
@ -56,7 +58,7 @@ type ModuleOutputs struct {
|
|||||||
func ProvideModule(in ModuleInputs) ModuleOutputs {
|
func ProvideModule(in ModuleInputs) ModuleOutputs {
|
||||||
govAddr := authtypes.NewModuleAddress(govtypes.ModuleName).String()
|
govAddr := authtypes.NewModuleAddress(govtypes.ModuleName).String()
|
||||||
|
|
||||||
k := keeper.NewKeeper(in.Cdc, in.StoreService, log.NewLogger(os.Stderr), govAddr, in.DidKeeper)
|
k := keeper.NewKeeper(in.Cdc, in.StoreService, log.NewLogger(os.Stderr), govAddr, in.AccountKeeper, in.DidKeeper)
|
||||||
m := NewAppModule(in.Cdc, k, in.DidKeeper)
|
m := NewAppModule(in.Cdc, k, in.DidKeeper)
|
||||||
|
|
||||||
return ModuleOutputs{Module: m, Keeper: k, Out: depinject.Out{}}
|
return ModuleOutputs{Module: m, Keeper: k, Out: depinject.Out{}}
|
||||||
|
@ -10,6 +10,7 @@ import (
|
|||||||
"cosmossdk.io/orm/model/ormdb"
|
"cosmossdk.io/orm/model/ormdb"
|
||||||
"github.com/cosmos/cosmos-sdk/codec"
|
"github.com/cosmos/cosmos-sdk/codec"
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
|
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
|
||||||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||||
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
|
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
|
||||||
"github.com/ipfs/kubo/client/rpc"
|
"github.com/ipfs/kubo/client/rpc"
|
||||||
@ -34,6 +35,7 @@ type Keeper struct {
|
|||||||
|
|
||||||
ipfsClient *rpc.HttpApi
|
ipfsClient *rpc.HttpApi
|
||||||
|
|
||||||
|
AccountKeeper authkeeper.AccountKeeper
|
||||||
DIDKeeper didkeeper.Keeper
|
DIDKeeper didkeeper.Keeper
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,6 +45,7 @@ func NewKeeper(
|
|||||||
storeService storetypes.KVStoreService,
|
storeService storetypes.KVStoreService,
|
||||||
logger log.Logger,
|
logger log.Logger,
|
||||||
authority string,
|
authority string,
|
||||||
|
authKeeper authkeeper.AccountKeeper,
|
||||||
didk didkeeper.Keeper,
|
didk didkeeper.Keeper,
|
||||||
) Keeper {
|
) Keeper {
|
||||||
logger = logger.With(log.ModuleKey, "x/"+types.ModuleName)
|
logger = logger.With(log.ModuleKey, "x/"+types.ModuleName)
|
||||||
@ -68,6 +71,7 @@ func NewKeeper(
|
|||||||
cdc: cdc,
|
cdc: cdc,
|
||||||
logger: logger,
|
logger: logger,
|
||||||
DIDKeeper: didk,
|
DIDKeeper: didk,
|
||||||
|
AccountKeeper: authKeeper,
|
||||||
Params: collections.NewItem(sb, types.ParamsKey, "params", codec.CollValue[types.Params](cdc)),
|
Params: collections.NewItem(sb, types.ParamsKey, "params", codec.CollValue[types.Params](cdc)),
|
||||||
OrmDB: store,
|
OrmDB: store,
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ func SetupTest(t *testing.T) *testFixture {
|
|||||||
registerBaseSDKModules(f, encCfg, storeService, logger, require)
|
registerBaseSDKModules(f, encCfg, storeService, logger, require)
|
||||||
|
|
||||||
// Setup Keeper.
|
// Setup Keeper.
|
||||||
f.k = keeper.NewKeeper(encCfg.Codec, storeService, logger, f.govModAddr, f.didk)
|
f.k = keeper.NewKeeper(encCfg.Codec, storeService, logger, f.govModAddr, f.accountkeeper, f.didk)
|
||||||
f.msgServer = keeper.NewMsgServerImpl(f.k)
|
f.msgServer = keeper.NewMsgServerImpl(f.k)
|
||||||
f.queryServer = keeper.NewQuerier(f.k)
|
f.queryServer = keeper.NewQuerier(f.k)
|
||||||
f.appModule = module.NewAppModule(encCfg.Codec, f.k, f.didk)
|
f.appModule = module.NewAppModule(encCfg.Codec, f.k, f.didk)
|
||||||
|
@ -56,6 +56,7 @@ func NewAppModule(
|
|||||||
return &AppModule{
|
return &AppModule{
|
||||||
AppModuleBasic: AppModuleBasic{cdc: cdc},
|
AppModuleBasic: AppModuleBasic{cdc: cdc},
|
||||||
keeper: keeper,
|
keeper: keeper,
|
||||||
|
didk: didkeeper,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,8 @@ package types
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
|
||||||
|
"github.com/onsonr/sonr/pkg/orm"
|
||||||
)
|
)
|
||||||
|
|
||||||
// DefaultParams returns default module parameters.
|
// DefaultParams returns default module parameters.
|
||||||
@ -32,14 +34,14 @@ func (p Params) Validate() error {
|
|||||||
// DefaultSchema returns the default schema
|
// DefaultSchema returns the default schema
|
||||||
func DefaultSchema() *Schema {
|
func DefaultSchema() *Schema {
|
||||||
return &Schema{
|
return &Schema{
|
||||||
Version: 1,
|
Version: orm.SCHEMA_VERSION,
|
||||||
Account: "++, id, name, address, publicKey, chainCode, index, controller, createdAt",
|
Account: orm.AccountSchema(),
|
||||||
Asset: "++, id, name, symbol, decimals, chainCode, createdAt",
|
Asset: orm.AssetSchema(),
|
||||||
Chain: "++, id, name, networkId, chainCode, createdAt",
|
Chain: orm.ChainSchema(),
|
||||||
Credential: "++, id, subject, controller, attestationType, origin, label, deviceId, credentialId, publicKey, transport, signCount, userPresent, userVerified, backupEligible, backupState, cloneWarning, createdAt, updatedAt",
|
Credential: orm.CredentialSchema(),
|
||||||
Jwk: "++, kty, crv, x, y, n, e",
|
Jwk: orm.JwkSchema(),
|
||||||
Grant: "++, subject, controller, origin, token, scopes, createdAt, updatedAt",
|
Grant: orm.GrantSchema(),
|
||||||
Keyshare: "++, id, data, role, createdAt, lastRefreshed",
|
Keyshare: orm.KeyshareSchema(),
|
||||||
Profile: "++, id, subject, controller, originUri, publicMetadata, privateMetadata, createdAt, updatedAt",
|
Profile: orm.ProfileSchema(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user