-
Notifications
You must be signed in to change notification settings - Fork 53
Support key access in all services #110
Support key access in all services #110
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #110 +/- ##
==========================================
- Coverage 28.53% 28.20% -0.34%
==========================================
Files 18 18
Lines 1146 1202 +56
==========================================
+ Hits 327 339 +12
- Misses 775 815 +40
- Partials 44 48 +4 ☔ View full report in Codecov by Sentry. |
func (ka DataIntegrityKeyAccess) Sign(payload cryptosuite.Provable) ([]byte, error) { | ||
// DataIntegrityJSON represents a response from a DataIntegrityKeyAccess.Sign() call represented | ||
// as a serialized JSON object | ||
type DataIntegrityJSON struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice
@@ -1,13 +1,15 @@ | |||
package router | |||
|
|||
import ( | |||
"os" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to make sure I'm on the same linter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -31,16 +33,16 @@ func NewBoltDIDStorage(db *storage.BoltDB) (*BoltDIDStorage, error) { | |||
} | |||
|
|||
func (b BoltDIDStorage) StoreDID(did StoredDID) error { | |||
couldNotStoreDIDErr := fmt.Sprintf("could not store DID: %s", did.DID.ID) | |||
namespace, err := getNamespaceForDID(did.DID.ID) | |||
couldNotStoreDIDErr := fmt.Sprintf("could not store DID: %s", did.ID) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch, I think Schema does this too?
@@ -10,9 +10,8 @@ import ( | |||
) | |||
|
|||
type StoredDID struct { | |||
ID string `json:"id"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh you put a top level ID I see
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for simpler indexing in the db
pkg/service/did/key.go
Outdated
return nil, errors.Wrap(err, "could not store did:key private key") | ||
} | ||
|
||
privKeyBase58, err := privateKeyToBase58(privKey) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this happen before you store the key?
Because there could be a case where you store a key but you can't convert it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, good call out
return b.db.Write(namespace, id, keyBytes) | ||
|
||
// encrypt key before storing | ||
encryptedKey, err := util.XChaCha20Poly1305Encrypt(b.serviceKey, keyBytes) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wild names for encryption these days
pkg/service/manifest/manifest.go
Outdated
}, nil | ||
} | ||
|
||
func (s Service) CreateManifest(request CreateManifestRequest) (*CreateManifestResponse, error) { | ||
logrus.Debugf("creating manifest: %+v", request) | ||
logrus.Debugf("creating m: %+v", request) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change log lines 'm' to manifest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ahh
@@ -154,7 +147,7 @@ func isValidApplication(gotManifest *manifeststorage.StoredManifest, application | |||
return nil | |||
} | |||
|
|||
func (s Service) SubmitApplication(request SubmitApplicationRequest) (*SubmitApplicationResponse, error) { | |||
func (s Service) ProcessApplicationSubmission(request SubmitApplicationRequest) (*SubmitApplicationResponse, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good name change
pkg/service/manifest/manifest.go
Outdated
credentialBuilder.SetIssuanceDate(time.Now().Format(time.RFC3339)) | ||
|
||
cred, err := credentialBuilder.Build() | ||
createdResponse, err := s.credential.CreateCredential(credentialRequest) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This probably needs to be credentialResponse
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
made changes
@@ -10,9 +10,8 @@ import ( | |||
) | |||
|
|||
type StoredDID struct { | |||
ID string `json:"id"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for simpler indexing in the db
pkg/service/manifest/manifest.go
Outdated
}, nil | ||
} | ||
|
||
func (s Service) CreateManifest(request CreateManifestRequest) (*CreateManifestResponse, error) { | ||
logrus.Debugf("creating manifest: %+v", request) | ||
logrus.Debugf("creating m: %+v", request) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ahh
pkg/service/manifest/manifest.go
Outdated
credentialBuilder.SetIssuanceDate(time.Now().Format(time.RFC3339)) | ||
|
||
cred, err := credentialBuilder.Build() | ||
createdResponse, err := s.credential.CreateCredential(credentialRequest) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
A few things:
string
and[]byte
request/responses for key accessnext up: actually signing / verifying objects