@@ -21,7 +21,7 @@ func (k msgServer) AddX509Cert(goCtx context.Context, msg *types.MsgAddX509Cert)
21
21
22
22
// check if signer has vendor role
23
23
if ! k .dclauthKeeper .HasRole (ctx , signerAddr , dclauthtypes .Vendor ) {
24
- return nil , pkitypes .NewErrUnauthorizedRole ("MsgAddNocX509RootCert " , dclauthtypes .Vendor )
24
+ return nil , pkitypes .NewErrUnauthorizedRole ("MsgAddX509Cert " , dclauthtypes .Vendor )
25
25
}
26
26
27
27
// decode pem certificate
@@ -58,7 +58,7 @@ func (k msgServer) AddX509Cert(goCtx context.Context, msg *types.MsgAddX509Cert)
58
58
return nil , pkitypes .NewErrProvidedNotNocCertButExistingNoc (x509Certificate .Subject , x509Certificate .SubjectKeyID )
59
59
}
60
60
61
- if err = k .EnsureSenderAndOwnerVidMatch (ctx , existingCertificate , msg .Signer ); err != nil {
61
+ if err = k .EnsureVidMatches (ctx , existingCertificate . Owner , msg .Signer ); err != nil {
62
62
return nil , err
63
63
}
64
64
}
@@ -81,8 +81,8 @@ func (k msgServer) AddX509Cert(goCtx context.Context, msg *types.MsgAddX509Cert)
81
81
return nil , pkitypes .NewErrProvidedNotNocCertButRootIsNoc ()
82
82
}
83
83
84
- // Provided certificate, root certificate and account VID must match
85
- if err = k .ensureCertsAndSenderVidMatch (ctx , rootCert , x509Certificate , signerAddr ); err != nil {
84
+ // VID of account must match to VID of root and provided child certificates
85
+ if err = k .ensureVidMatches (ctx , rootCert , x509Certificate , signerAddr ); err != nil {
86
86
return nil , err
87
87
}
88
88
@@ -127,7 +127,7 @@ func (k msgServer) AddX509Cert(goCtx context.Context, msg *types.MsgAddX509Cert)
127
127
return & types.MsgAddX509CertResponse {}, nil
128
128
}
129
129
130
- func (k msgServer ) ensureCertsAndSenderVidMatch (
130
+ func (k msgServer ) ensureVidMatches (
131
131
ctx sdk.Context ,
132
132
rootCert * types.Certificate ,
133
133
childCert * x509.Certificate ,
0 commit comments