Skip to content

Commit

Permalink
revert identity provider
Browse files Browse the repository at this point in the history
  • Loading branch information
Lodek committed Jun 14, 2024
1 parent 568a46b commit d28db70
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 79 deletions.
21 changes: 19 additions & 2 deletions acp/identity/identity.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,29 @@ type Identity struct {

// FromPrivateKey returns a new identity using the given private key.
func FromPrivateKey(privateKey *secp256k1.PrivateKey) (immutable.Option[Identity], error) {
return newIdentityProvider().FromPrivateKey(privateKey)
pubKey := privateKey.PubKey()
did, err := DIDFromPublicKey(pubKey)
if err != nil {
return None, err

Check warning on line 44 in acp/identity/identity.go

View check run for this annotation

Codecov / codecov/patch

acp/identity/identity.go#L44

Added line #L44 was not covered by tests
}

return immutable.Some(Identity{
DID: did,
PublicKey: pubKey,
PrivateKey: privateKey,
}), nil
}

// FromPublicKey returns a new identity using the given public key.
func FromPublicKey(publicKey *secp256k1.PublicKey) (immutable.Option[Identity], error) {
return newIdentityProvider().FromPublicKey(publicKey)
did, err := DIDFromPublicKey(publicKey)
if err != nil {
return None, err

Check warning on line 58 in acp/identity/identity.go

View check run for this annotation

Codecov / codecov/patch

acp/identity/identity.go#L58

Added line #L58 was not covered by tests
}
return immutable.Some(Identity{
DID: did,
PublicKey: publicKey,
}), nil
}

// DIDFromPublicKey returns a did:key generated from the the given public key.
Expand Down
77 changes: 0 additions & 77 deletions acp/identity/provider.go

This file was deleted.

0 comments on commit d28db70

Please sign in to comment.