Skip to content

Commit 7a02da3

Browse files
committed
ready to start debugging sn channels - towards a working version
1 parent cdaaf2a commit 7a02da3

File tree

4 files changed

+30
-4
lines changed

4 files changed

+30
-4
lines changed

app/src/main/java/net/sharksystem/asap/sharknet/android/SNChannelViewContentAdapter.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,15 +147,29 @@ public static SharkNetMessage parseMessage(byte[] message, String sender, String
147147
// do we have an decrypted message?
148148
if(snMessage.couldBeDecrypted()) {
149149
byte[] snContent = snMessage.getContent();
150-
content2View = String.valueOf(snMessage);
150+
content2View = String.valueOf(snContent);
151151

152152
Timestamp creationTime = snMessage.getCreationTime();
153153
timestamp2View = DateTimeHelper.long2DateString(creationTime.getTime());
154154

155-
sender2View = "from: " + snMessage.getSender();
155+
CharSequence senderName = snMessage.getSender();
156+
try {
157+
senderName = SNChannelsComponent.getSharkNetChannelComponent().
158+
getPersonName(senderName);
159+
}
160+
catch(ASAPException e) {
161+
// no name found
162+
}
163+
164+
sender2View = "from: " + senderName;
156165

157166
if(snMessage.verified()) {
158167
verified2View = "verified";
168+
169+
int identityAssurance = SNChannelsComponent.getSharkNetChannelComponent().
170+
getAsapPKI().getIdentityAssurance(snMessage.getSender());
171+
172+
iA2View = "iA (" + senderName + "): " + identityAssurance;
159173
}
160174
}
161175

app/src/main/java/net/sharksystem/asap/sharknet/android/SNChannelsComponent.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import net.sharksystem.asap.android.apps.ASAPComponentNotYetInitializedException;
1515
import net.sharksystem.asap.android.apps.ASAPMessageReceivedListener;
1616
import net.sharksystem.crypto.BasicKeyStore;
17+
import net.sharksystem.persons.ASAPPKI;
1718
import net.sharksystem.sharknet.android.PersonsStorage;
1819
import net.sharksystem.sharknet.android.OwnerFactory;
1920

@@ -30,15 +31,19 @@ public class SNChannelsComponent implements
3031
private final BasicKeyStore basicKeyStore;
3132
private final OwnerFactory ownerFactory;
3233
private final PersonsStorage personsStorage;
34+
private final ASAPPKI asapPKI;
3335

3436
public SNChannelsComponent(ASAPApplication asapApplication,
35-
BasicKeyStore basicKeyStore, OwnerFactory ownerFactory,
37+
BasicKeyStore basicKeyStore,
38+
ASAPPKI asapPKI,
39+
OwnerFactory ownerFactory,
3640
PersonsStorage personsStorage) {
3741

3842
// set up component helper
3943
this.asapComponentHelper = new ASAPApplicationComponentHelper();
4044
this.asapComponentHelper.setASAPApplication(asapApplication);
4145
this.basicKeyStore = basicKeyStore;
46+
this.asapPKI = asapPKI;
4247
this.ownerFactory = ownerFactory;
4348
this.personsStorage = personsStorage;
4449
}
@@ -49,12 +54,14 @@ public SNChannelsComponent(ASAPApplication asapApplication,
4954
*/
5055
public static void initialize(ASAPApplication asapApplication,
5156
BasicKeyStore basicKeyStore,
57+
ASAPPKI asapPKI,
5258
OwnerFactory ownerFactory,
5359
PersonsStorage personsStorage) {
5460
try {
5561
SNChannelsComponent.instance = new SNChannelsComponent(
5662
asapApplication,
5763
basicKeyStore,
64+
asapPKI,
5865
ownerFactory,
5966
personsStorage
6067
);
@@ -88,6 +95,8 @@ public BasicKeyStore getBasicKeyStore() {
8895
return this.basicKeyStore;
8996
}
9097

98+
public ASAPPKI getAsapPKI() { return this.asapPKI; }
99+
91100
public CharSequence getOwnerID() {
92101
return this.ownerFactory.getOwner().getUUID();
93102
}

app/src/main/java/net/sharksystem/sharknet/android/AndroidASAPKeyStorage.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@
1313
import net.sharksystem.asap.util.DateTimeHelper;
1414
import net.sharksystem.crypto.ASAPCertificateImpl;
1515
import net.sharksystem.crypto.ASAPKeyStorage;
16+
import net.sharksystem.crypto.BasicKeyStore;
1617
import net.sharksystem.crypto.SharkCryptoException;
1718
import net.sharksystem.persons.ASAPKeyStoreWithWriteAccess;
19+
import net.sharksystem.persons.ASAPPKI;
1820
import net.sharksystem.persons.SampleFullAsapPKIStorage;
1921
import net.sharksystem.persons.android.PersonsStorageAndroidComponent;
2022

@@ -36,7 +38,7 @@
3638
* Overwrites key creation and add kex persistence to the more general super class
3739
*/
3840
public class AndroidASAPKeyStorage extends SampleFullAsapPKIStorage
39-
implements ASAPKeyStoreWithWriteAccess {
41+
implements ASAPKeyStoreWithWriteAccess, ASAPPKI, BasicKeyStore {
4042

4143
private static final String KEYPAIR_CREATION_TIME = "ASAPCertificatesKeyPairCreationTime";
4244
public static final String KEYSTORE_NAME = "AndroidKeyStore";

app/src/main/java/net/sharksystem/sharknet/android/SharkNetApp.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ static SharkNetApp initializeSharkNetApp(Activity initActivity) {
8888
SNChannelsComponent.initialize(
8989
SharkNetApp.singleton, // ASAPApplication
9090
asapKeyStorage, // BasicKeyStore
91+
asapKeyStorage, // ASAPPKI
9192
SharkNetApp.singleton, // OwnerFactory
9293
PersonsStorageAndroidComponent.getPersonsStorage() // PersonStorage
9394
);

0 commit comments

Comments
 (0)