Skip to content

Commit

Permalink
Fix erroneous DID for keys
Browse files Browse the repository at this point in the history
  • Loading branch information
bahner committed Apr 23, 2024
1 parent 1f8ffeb commit 27f9a3c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 12 deletions.
8 changes: 0 additions & 8 deletions did/doc/document.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,3 @@ func compareSlices(a []string, b []string) bool {

return slices.Compare(a, b) == 0
}

// func (d *Document) Path() path.Path {
// return d.immutablePath
// }

// func (d *Document) DID() did.DID {
// return d.did
// }
4 changes: 2 additions & 2 deletions key/encryption.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ func NewEncryptionKey(d did.DID) (EncryptionKey, error) {
return EncryptionKey{}, fmt.Errorf("NewEncryptionKey: %w", err)
}

// We just mangle the base DID as this is not a pointer to a DID.
d.Fragment = name
// Create a unique identifier for the key
d = did.New(d.IPNSName(), name)

// Generate a random private key
var privKey [curve25519.ScalarSize]byte
Expand Down
5 changes: 3 additions & 2 deletions key/signing.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ func NewSigningKey(d did.DID) (SigningKey, error) {
if err != nil {
return SigningKey{}, fmt.Errorf("NewSigningKey: %w", err)
}
// We just mangle the base DID as this is not a pointer to a DID.
d.Fragment = name

// Create a unique identifier for the key
d = did.New(d.IPNSName(), name)

publicKey, privKey, err := ed25519.GenerateKey(rand.Reader)
if err != nil {
Expand Down

0 comments on commit 27f9a3c

Please sign in to comment.