account identity

This commit is contained in:
Christien Rioux 2023-07-04 22:48:34 -05:00
parent 0bc9dc3ad4
commit e1a1baf4b1
3 changed files with 95 additions and 7 deletions

View file

@ -0,0 +1,45 @@
import 'package:flutter/widgets.dart';
import 'package:veilid/veilid.dart';
@immutable
class Identity {
final TypedKey identityPublicKey;
final TypedKey masterPublicKey;
final Signature identitySignature;
final Signature masterSignature;
const Identity(
{required this.identityPublicKey,
required this.masterPublicKey,
required this.identitySignature,
required this.masterSignature});
// Todo with slightly different content.
Identity copyWith(
{TypedKey? identityPublicKey,
TypedKey? masterPublicKey,
Signature? identitySignature,
Signature? masterSignature}) {
return Identity(
identityPublicKey: identityPublicKey ?? this.identityPublicKey,
masterPublicKey: masterPublicKey ?? this.masterPublicKey,
identitySignature: identitySignature ?? this.identitySignature,
masterSignature: masterSignature ?? this.masterSignature,
);
}
Identity.fromJson(Map<String, dynamic> json)
: identityPublicKey = TypedKey.fromJson(json['identity_public_key']),
masterPublicKey = TypedKey.fromJson(json['master_public_key']),
identitySignature = Signature.fromJson(json['identity_signature']),
masterSignature = Signature.fromJson(json['master_signature']);
Map<String, dynamic> toJson() {
return {
'identity_public_key': identityPublicKey.toJson(),
'master_public_key': masterPublicKey.toJson(),
'identity_signature': identitySignature.toJson(),
'master_signature': masterSignature.toJson(),
};
}
}