lib invitation improvement for GUI
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
ycc 2023-12-31 18:43:55 +01:00
parent 0998845817
commit 04e81fcef1

View File

@ -30,21 +30,21 @@ func TestEndToEnd(t *testing.T) {
// Create an invitation for a friend, I want him/her to know me as Bender // // Create an invitation for a friend, I want him/her to know me as Bender //
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
fmt.Println("Creating an invitation for the first friend...") fmt.Println("Creating an invitation for the first friend...")
peer, myContactCard, err := Me.InvitePeer("Bender", "myfirstfriend", []int{1, 2}) peer, err := Me.InvitePeer("Bender", "myfirstfriend", []int{1, 2})
if err != nil { if err != nil {
println(err) println(err)
} }
println(peer.Name) println(peer.Name)
// print my invitation // print my invitation
a, _ := json.Marshal(myContactCard) a, _ := json.Marshal(peer.MyContact)
fmt.Println(string(a)) fmt.Println(string(a))
// TODO : Convert invitation to QR Code // TODO : Convert invitation to QR Code
myContactCard.WritePng("invitation.png") peer.MyContact.WritePng("invitation.png")
data, err := myContactCard.Compress() data, err := peer.MyContact.Compress()
if err != nil { if err != nil {
println(err) println(err)
} }
myContactCard.WriteQr("qrcode.png") peer.MyContact.WriteQr("qrcode.png")
println("Compressed contact card :", len(data)) println("Compressed contact card :", len(data))
/////////////////////////////////////// ///////////////////////////////////////
// Simulate peer invitation response // // Simulate peer invitation response //
@ -60,7 +60,7 @@ func TestEndToEnd(t *testing.T) {
ReceivedContact.ContactPublicKey = FirstFriendContactKp.Public ReceivedContact.ContactPublicKey = FirstFriendContactKp.Public
ReceivedContact.EncryptionPublicKey = FirstFriendEncryptionKp.Public ReceivedContact.EncryptionPublicKey = FirstFriendEncryptionKp.Public
ReceivedContact.LookupPublicKey = FirstFriendLookupKp.Public ReceivedContact.LookupPublicKey = FirstFriendLookupKp.Public
ReceivedContact.InvitationId = myContactCard.InvitationId ReceivedContact.InvitationId = peer.MyContact.InvitationId
FriendServer1KP := meowlib.NewKeyPair() FriendServer1KP := meowlib.NewKeyPair()
FriendServer1 := meowlib.ServerCard{Name: "FriendServer1", Url: "http://myfriend.org/meow/", PublicKey: FriendServer1KP.Public, Description: "Fancy description"} FriendServer1 := meowlib.ServerCard{Name: "FriendServer1", Url: "http://myfriend.org/meow/", PublicKey: FriendServer1KP.Public, Description: "Fancy description"}
ReceivedContact.PullServers = append(ReceivedContact.PullServers, &FriendServer1) ReceivedContact.PullServers = append(ReceivedContact.PullServers, &FriendServer1)