Reorg
This commit is contained in:
@ -1,10 +1,13 @@
|
||||
package meowlib
|
||||
package meowlib_test
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"testing"
|
||||
|
||||
"forge.redroom.link/yves/meowlib"
|
||||
"forge.redroom.link/yves/meowlib/client"
|
||||
)
|
||||
|
||||
func TestEndToEnd(t *testing.T) {
|
||||
@ -12,10 +15,10 @@ func TestEndToEnd(t *testing.T) {
|
||||
// Create my own identity
|
||||
//
|
||||
fmt.Println("Trying to load identity from file.")
|
||||
me, err := LoadIdentity("id.enc")
|
||||
me, err := client.LoadIdentity("id.enc")
|
||||
if err != nil {
|
||||
fmt.Println("Failed : creating New identity...")
|
||||
me = CreateIdentity("myname")
|
||||
me = client.CreateIdentity("myname")
|
||||
|
||||
//
|
||||
// define my preferences (servers)
|
||||
@ -35,24 +38,19 @@ func TestEndToEnd(t *testing.T) {
|
||||
//
|
||||
// Simulate peer invitation response : generate the friend's keypair
|
||||
fmt.Println("Simulating first friend answer...")
|
||||
var receivedContact ContactCard
|
||||
var receivedContact meowlib.ContactCard
|
||||
|
||||
// Friend simulated invitation
|
||||
firstFriendContactKp := NewKeyPair()
|
||||
firstFriendEncryptionKp := NewKeyPair()
|
||||
firstFriendLookupKp := NewKeyPair()
|
||||
firstFriendContactKp := meowlib.NewKeyPair()
|
||||
firstFriendEncryptionKp := meowlib.NewKeyPair()
|
||||
firstFriendLookupKp := meowlib.NewKeyPair()
|
||||
receivedContact.Name = "I'm the friend"
|
||||
receivedContact.ContactPublicKey = firstFriendContactKp.Public
|
||||
receivedContact.EncryptionPublicKey = firstFriendEncryptionKp.Public
|
||||
receivedContact.LookupPublicKey = firstFriendLookupKp.Public
|
||||
var friendsMessageServers ServerList
|
||||
friendsMessageServers.AddUrls([]string{"http://myfriend.org/meow/"})
|
||||
receivedContact.AddUrls([]string{"http://myfriend.org/meow/"})
|
||||
// end Friend simulated invitation
|
||||
|
||||
for _, srv := range friendsMessageServers.Servers {
|
||||
receivedContact.PullServers = append(receivedContact.PullServers, srv.ServerData)
|
||||
}
|
||||
|
||||
// End simulating contact invitation response
|
||||
//
|
||||
|
||||
@ -83,7 +81,7 @@ func TestEndToEnd(t *testing.T) {
|
||||
// simulates if peer can decrypt my message
|
||||
//Message := "toto"
|
||||
//Signature := "test"
|
||||
decMess, err2 := DecryptAndCheck(myFirstFriend.EncryptionKp.Private, myFirstFriend.Contact.EncryptionPublicKey, []byte(EncMsg), MsgSignature)
|
||||
decMess, err2 := meowlib.DecryptAndCheck(myFirstFriend.EncryptionKp.Private, myFirstFriend.Contact.EncryptionPublicKey, []byte(EncMsg), MsgSignature)
|
||||
if err2 != nil {
|
||||
fmt.Println(err2.Error())
|
||||
}
|
||||
|
Reference in New Issue
Block a user