diff --git a/bindings/channels.go b/bindings/channels.go index 07d34441ca2b15db49452d303004a8e47b23d137..98e746041e1c88ec29cbf84a2148eb5f46d58614 100644 --- a/bindings/channels.go +++ b/bindings/channels.go @@ -126,6 +126,23 @@ func GenerateChannelIdentity(cmixID int) ([]byte, error) { return pi.Marshal(), nil } +// ImportPrivateIdentity generates a new [channel.PrivateIdentity] from exported +// data. +// +// Parameters: +// - password - The password used to encrypt the identity. +// - data - The encrypted data. +// +// Returns: +// - JSON of [channel.PrivateIdentity]. +func ImportPrivateIdentity(password string, data []byte) ([]byte, error) { + pi, err := cryptoChannel.ImportPrivateIdentity(password, data) + if err != nil { + return nil, err + } + return pi.Marshal(), nil +} + // GetPublicChannelIdentity constructs a public identity ([channel.Identity]) // from a bytes version and returns it JSON marshaled. //