Add getters

This commit is contained in:
Franck Royer 2021-10-19 11:25:31 +11:00
parent 9c2ee46db0
commit 501d9d50d4
No known key found for this signature in database
GPG Key ID: A82ED75A8DFC50A4
1 changed files with 34 additions and 0 deletions

View File

@ -1,6 +1,7 @@
import { Reader } from "protobufjs"; import { Reader } from "protobufjs";
import * as proto from "../proto/communities/v1/chat_identity"; import * as proto from "../proto/communities/v1/chat_identity";
import { IdentityImage } from "../proto/communities/v1/chat_identity";
export class ChatIdentity { export class ChatIdentity {
public constructor(public proto: proto.ChatIdentity) {} public constructor(public proto: proto.ChatIdentity) {}
@ -14,4 +15,37 @@ export class ChatIdentity {
encode(): Uint8Array { encode(): Uint8Array {
return proto.ChatIdentity.encode(this.proto).finish(); return proto.ChatIdentity.encode(this.proto).finish();
} }
/** Lamport timestamp of the message */
get clock(): number | undefined {
return this.proto.clock;
}
/** ens_name is the valid ENS name associated with the chat key */
get ensName(): string | undefined {
return this.proto.ensName;
}
/** images is a string indexed mapping of images associated with an identity */
get images(): { [key: string]: IdentityImage } | undefined {
return this.proto.images;
}
/** display name is the user set identity, valid only for organisations */
get displayName(): string | undefined {
return this.proto.displayName;
}
/** description is the user set description, valid only for organisations */
get description(): string | undefined {
return this.proto.description;
}
get color(): string | undefined {
return this.proto.color;
}
get emoji(): string | undefined {
return this.proto.emoji;
}
} }