feature/1109 grpc session model (#1141)

- **feat: remove Hway deployment**
- **feat: introduce session middleware for requests**
- **refactor: update path imports to use new pkg folder**
- **feat: add gRPC client for interacting with services**
- **feat: remove grpc client and use REST api**
- **refactor: move  from  to**
- **feat: add client views endpoint**
- **feat: add webauthn support**
- **closes: #1124**
- **refactor: Improve PR labeler configuration**
- **feat: add milestone discussion template**
- **feat: remove OKR tracking issue template**
- **feat: use gorilla sessions for session management**
- **refactor: move pubkey related code to**
- **<no value>**
- **refactor: remove unused identifier type**
- **feat: integrate Macaroon Keeper with Service Module**
- **refactor: rename worker routes for clarity**
This commit is contained in:
Prad Nukala
2024-10-11 16:47:52 -04:00
committed by GitHub
parent 1d569d35b4
commit 3790e926de
121 changed files with 869 additions and 589 deletions
-1
View File
@@ -1 +0,0 @@
package types
+64
View File
@@ -1,6 +1,8 @@
package types
import (
"strings"
didv1 "github.com/onsonr/sonr/api/did/v1"
)
@@ -10,3 +12,65 @@ type PubKeyI interface {
GetRawKey() *didv1.RawKey
GetJwk() *didv1.JSONWebKey
}
// PubKey defines a generic pubkey.
type PublicKey interface {
VerifySignature(msg, sig []byte) bool
}
type PubKeyG[T any] interface {
*T
PublicKey
}
type pubKeyImpl struct {
decode func(b []byte) (PublicKey, error)
validate func(key PublicKey) error
}
// func WithSecp256K1PubKey() Option {
// return WithPubKeyWithValidationFunc(func(pt *secp256k1.PubKey) error {
// _, err := dcrd_secp256k1.ParsePubKey(pt.Key)
// return err
// })
// }
//
// func WithPubKey[T any, PT PubKeyG[T]]() Option {
// return WithPubKeyWithValidationFunc[T, PT](func(_ PT) error {
// return nil
// })
// }
//
// func WithPubKeyWithValidationFunc[T any, PT PubKeyG[T]](validateFn func(PT) error) Option {
// pkImpl := pubKeyImpl{
// decode: func(b []byte) (PublicKey, error) {
// key := PT(new(T))
// err := gogoproto.Unmarshal(b, key)
// if err != nil {
// return nil, err
// }
// return key, nil
// },
// validate: func(k PublicKey) error {
// concrete, ok := k.(PT)
// if !ok {
// return fmt.Errorf(
// "invalid pubkey type passed for validation, wanted: %T, got: %T",
// concrete,
// k,
// )
// }
// return validateFn(concrete)
// },
// }
// return func(a *Account) {
// a.supportedPubKeys[gogoproto.MessageName(PT(new(T)))] = pkImpl
// }
// }
func nameFromTypeURL(url string) string {
name := url
if i := strings.LastIndexByte(url, '/'); i >= 0 {
name = name[i+len("/"):]
}
return name
}
+30
View File
@@ -0,0 +1,30 @@
package types
import (
"context"
signingv1beta1 "cosmossdk.io/api/cosmos/tx/signing/v1beta1"
"cosmossdk.io/x/tx/signing"
"github.com/cosmos/cosmos-sdk/types/tx"
)
type directHandler struct{}
func (s directHandler) Mode() signingv1beta1.SignMode {
return signingv1beta1.SignMode_SIGN_MODE_DIRECT_AUX
}
func (s directHandler) GetSignBytes(
_ context.Context,
signerData signing.SignerData,
txData signing.TxData,
) ([]byte, error) {
txDoc := tx.SignDoc{
BodyBytes: txData.BodyBytes,
AuthInfoBytes: txData.AuthInfoBytes,
ChainId: signerData.ChainID,
AccountNumber: signerData.AccountNumber,
}
return txDoc.Marshal()
}