File tree 1 file changed +7
-7
lines changed
1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -14,9 +14,7 @@ export default class ContactBundle implements proto.ContactBundleV1 {
14
14
}
15
15
16
16
toBytes ( ) : Uint8Array {
17
- return proto . ContactBundleV1 . encode ( {
18
- keyBundle : this . keyBundle ,
19
- } ) . finish ( )
17
+ return this . keyBundle . toBytes ( )
20
18
}
21
19
22
20
static fromBytes ( bytes : Uint8Array ) : ContactBundle {
@@ -49,11 +47,13 @@ export default class ContactBundle implements proto.ContactBundleV1 {
49
47
e instanceof RangeError ||
50
48
( e instanceof Error && e . message . startsWith ( 'invalid wire type' ) )
51
49
) {
52
- // Adds a default fallback for older versions of the proto
53
- const legacyBundle = proto . ContactBundleV1 . decode ( bytes )
54
- return legacyBundle . keyBundle
50
+ // Adds a default fallback for older versions of the proto (Which may also fail)
51
+ try {
52
+ return proto . PublicKeyBundle . decode ( bytes )
53
+ } catch ( e ) {
54
+ throw new Error ( "Couldn't decode contact bundle: " + e )
55
+ }
55
56
}
56
- throw new Error ( "Couldn't decode contact bundle:" + e )
57
57
}
58
58
}
59
59
}
You can’t perform that action at this time.
0 commit comments