refactor: use RawPublicKey instead of PublicKey in macaroon issuer

This commit is contained in:
Prad Nukala
2024-10-18 14:09:16 -04:00
parent 6da6f2b97b
commit a0a5f0c7e0
5 changed files with 19 additions and 17 deletions
+2 -6
View File
@@ -10,7 +10,7 @@ import (
)
// assembleVault assembles the initial vault
func (k Keeper) assembleVault(cotx sdk.Context) (string, int64, error) {
func (k Keeper) assembleVault(cotx sdk.Context, schema *dwngen.Schema) (string, int64, error) {
_, con, err := k.DIDKeeper.NewController(cotx)
if err != nil {
return "", 0, err
@@ -19,11 +19,7 @@ func (k Keeper) assembleVault(cotx sdk.Context) (string, int64, error) {
if err != nil {
return "", 0, err
}
sch, err := k.currentSchema(cotx)
if err != nil {
return "", 0, err
}
v, err := types.NewVault(usrKs, con.SonrAddress(), con.ChainID(), sch)
v, err := types.NewVault(usrKs, con.SonrAddress(), con.ChainID(), schema)
if err != nil {
return "", 0, err
}
+9 -3
View File
@@ -53,10 +53,16 @@ func (k Querier) Schema(goCtx context.Context, req *types.QuerySchemaRequest) (*
func (k Querier) Allocate(goCtx context.Context, req *types.AllocateRequest) (*types.AllocateResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
// 2.Allocate the vault msg.GetSubject(), msg.GetOrigin()
cid, expiryBlock, err := k.assembleVault(ctx)
// 1. Get current schema
sch, err := k.currentSchema(ctx)
if err != nil {
return nil, err
return nil, types.ErrInvalidSchema.Wrap(err.Error())
}
// 2.Allocate the vault msg.GetSubject(), msg.GetOrigin()
cid, expiryBlock, err := k.assembleVault(ctx, sch)
if err != nil {
return nil, types.ErrVaultAssembly.Wrap(err.Error())
}
return &types.AllocateResponse{