feat(api): add GetCommunityPublicKeyFromPrivateKey to api (#3828)
This commit is contained in:
parent
0cd140c9b2
commit
9267e58143
|
@ -2104,7 +2104,7 @@ func (m *Messenger) findCommunityInfoFromDB(communityID string) (*communities.Co
|
|||
}
|
||||
|
||||
func (m *Messenger) GetCommunityIDFromKey(communityKey string) string {
|
||||
// Check if the key is a private key
|
||||
// Check if the key is a private key. strip the 0x at the start
|
||||
privateKey, err := crypto.HexToECDSA(communityKey[2:])
|
||||
communityID := ""
|
||||
if err != nil {
|
||||
|
|
|
@ -452,6 +452,12 @@ func (api *PublicAPI) ImportCommunity(ctx context.Context, hexPrivateKey string)
|
|||
return nil, err
|
||||
}
|
||||
return api.service.messenger.ImportCommunity(ctx, privateKey)
|
||||
}
|
||||
|
||||
// GetCommunityPublicKeyFromPrivateKey gets the community's public key from its private key
|
||||
func (api *PublicAPI) GetCommunityPublicKeyFromPrivateKey(ctx context.Context, hexPrivateKey string) string {
|
||||
publicKey := api.service.messenger.GetCommunityIDFromKey(hexPrivateKey)
|
||||
return publicKey
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue