Peer invitation refactor, Contact invitationId, Qrcode compression
This commit is contained in:
@ -30,12 +30,18 @@ func TestEndToEnd(t *testing.T) {
|
||||
// Create an invitation for a friend, I want him/her to know me as Bender //
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
fmt.Println("Creating an invitation for the first friend...")
|
||||
MyFirstFriend, invitation := Me.InvitePeer("Bender", "myfirstfriend", []int{1, 2})
|
||||
invitation := Me.InvitePeer("Bender", "myfirstfriend", []int{1, 2})
|
||||
// print my invitation
|
||||
a, _ := json.Marshal(invitation)
|
||||
fmt.Println(string(a))
|
||||
// TODO : Convert invitation to QR Code
|
||||
invitation.WritePng("invitation.png")
|
||||
data, err := invitation.Compress()
|
||||
if err != nil {
|
||||
println(err)
|
||||
}
|
||||
invitation.WriteQr("qrcode.png")
|
||||
println("Compressed contact card :", len(data))
|
||||
///////////////////////////////////////
|
||||
// Simulate peer invitation response //
|
||||
///////////////////////////////////////
|
||||
@ -50,6 +56,7 @@ func TestEndToEnd(t *testing.T) {
|
||||
ReceivedContact.ContactPublicKey = FirstFriendContactKp.Public
|
||||
ReceivedContact.EncryptionPublicKey = FirstFriendEncryptionKp.Public
|
||||
ReceivedContact.LookupPublicKey = FirstFriendLookupKp.Public
|
||||
ReceivedContact.InvitationId = invitation.InvitationId
|
||||
FriendServer1KP := meowlib.NewKeyPair()
|
||||
FriendServer1 := meowlib.Server{Name: "FriendServer1", Url: "http://myfriend.org/meow/", PublicKey: FriendServer1KP.Public, Description: "Fancy description", ConfidenceLevel: 1}
|
||||
ReceivedContact.PullServers = append(ReceivedContact.PullServers, &FriendServer1)
|
||||
@ -57,7 +64,7 @@ func TestEndToEnd(t *testing.T) {
|
||||
///////////////////////////////////////////////////////
|
||||
// Finalize the contact with the invitation response //
|
||||
///////////////////////////////////////////////////////
|
||||
Me.FinalizeInvitation(MyFirstFriend, &ReceivedContact)
|
||||
Me.FinalizeInvitation(&ReceivedContact)
|
||||
/*err = Me.Save("id.enc")
|
||||
if err != nil {
|
||||
fmt.Println(err.Error())
|
||||
@ -69,6 +76,7 @@ func TestEndToEnd(t *testing.T) {
|
||||
/////////////////////////////////////
|
||||
// Create a message to that friend //
|
||||
/////////////////////////////////////
|
||||
MyFirstFriend := Me.Peers[0]
|
||||
textmessage := "Hello friend!"
|
||||
// Creating User message
|
||||
usermessage, err := MyFirstFriend.BuildSimpleUserUMessage([]byte(textmessage))
|
||||
|
Reference in New Issue
Block a user