Add Subscriber constructor

This commit is contained in:
Jeremy Lakeman 2016-08-08 15:23:48 +09:30
parent 30167ce4ed
commit 8ee7245881
2 changed files with 10 additions and 2 deletions

View File

@ -18,8 +18,10 @@ public class SigningKey extends AbstractId {
super(binary);
}
public static final int BINARY_SIZE = 32;
@Override
int getBinarySize() {
return 32;
public int getBinarySize() {
return BINARY_SIZE;
}
}

View File

@ -20,6 +20,12 @@ public final class Subscriber {
this.combined = combined;
}
public Subscriber(byte[] sidBytes, byte[] signBytes, boolean combined) throws AbstractId.InvalidBinaryException {
sid = new SubscriberId(sidBytes);
signingKey = signBytes==null ? null : new SigningKey(signBytes);
this.combined = combined;
}
public Subscriber(ByteBuffer buff) throws AbstractId.InvalidBinaryException {
SubscriberId sid = new SubscriberId(buff);
SigningKey signingKey = new SigningKey(buff);