Interface: UnlockedOrg
org.UnlockedOrg
Hierarchy
-
↳
UnlockedOrg
Properties
_key
• Protected
Optional
_key: Uint8Array
The key used for encryption. Sub classes must set this property in the unlock method.
Inherited from
Defined in
_propertySerializationOptions
• _propertySerializationOptions:
SerializationOptions
[]
Inherited from
Org._propertySerializationOptions
Defined in
accessors
• accessors: Accessor
[] = []
The ids and encrypted keys of all accessors
Inherited from
Defined in
created
• created: Date
Creation date
Inherited from
Defined in
directory
• directory:
OrgDirectorySettings
Inherited from
Defined in
encryptedData
• Optional
encryptedData: Uint8Array
Encrypted data
Inherited from
Defined in
encryptionParams
• encryptionParams:
AESEncryptionParams
Parameters used for encryption of content data
Inherited from
Defined in
groups
• groups: Group
[] = []
This organizations Groups.
Inherited from
Defined in
id
• id: string
= ""
Unique identier
Inherited from
Defined in
invites
• invites: Invite
[] = []
Pending Invites
Inherited from
Defined in
invitesKey
• invitesKey: Uint8Array
AES key used as encryption key for Invites
Overrides
Defined in
keyParams
• keyParams:
RSAEncryptionParams
Parameters used to wrap the shared encryption key
Inherited from
Defined in
members
• members: OrgMember
[] = []
Array of organization members
Inherited from
Defined in
minMemberUpdated
• minMemberUpdated: Date
Minimum accepted update time for organization members. Any members with a OrgMember.updated value lower than this should be considered invalid.
In order to prevent an attacker from rolling back this value, all clients should verify that updated organization object always have a Org.minMemberUpdated value equal to or higher than the previous one.
Inherited from
Defined in
name
• name: string
= ""
Organization name
Inherited from
Defined in
privateKey
• privateKey: Uint8Array
Private key used for signing member details
Overrides
Defined in
publicKey
• Optional
publicKey: Uint8Array
Public key used for verifying member signatures
Inherited from
Defined in
revision
• revision: string
= ""
Revision id used for ensuring continuity when synchronizing the account object between client and server
Inherited from
Defined in
signingParams
• signingParams: RSASigningParams
Parameters for creating member signatures
Inherited from
Defined in
updated
• updated: Date
Last updated
Inherited from
Defined in
vaults
• vaults: { id
: string
; name
: string
; revision?
: string
}[] =
[]
Shared Vaults owned by this organization
Inherited from
Defined in
Accessors
info
• get
info(): OrgInfo
Returns
Inherited from
Org.info
Defined in
kind
• get
kind(): string
A string representing the objects "type", useful for segmenting storage, among other things. Defaults to the lowercase class name, but can be overwritten by subclasses
Returns
string
Inherited from
Org.kind
Defined in
owner
• get
owner(): undefined
| OrgMember
Account which created this organization
Returns
undefined
| OrgMember
Inherited from
Org.owner
Defined in
Methods
_fromRaw
▸ Protected
_fromRaw(raw
): void
Restore values from a raw object. The default implementation simply copies over all iterable properties from the base object. Overwrite this method for properties that require special treatment
Parameters
Name | Type |
---|---|
raw |
any |
Returns
void
Inherited from
Defined in
_toRaw
▸ Protected
_toRaw(version
): any
Transform this object into a raw javascript object used for serialization. The default implementation simply copies all iterable properties not included in the [[exlude]] array and calls toRaw on any properties that are themselfes instances of Serializable. This method should be overwritten by subclasses if certain properties require special treatment.
Parameters
Name | Type |
---|---|
version |
undefined | string |
Returns
any
Inherited from
Defined in
addOrUpdateMember
▸ addOrUpdateMember(__namedParameters
): Promise
<void
>
Adds a member to the organization, or updates the existing member with the same id.
Parameters
Name | Type |
---|---|
__namedParameters |
Object |
__namedParameters.accountId? |
string |
__namedParameters.email |
string |
__namedParameters.name |
string |
__namedParameters.orgSignature? |
Uint8Array |
__namedParameters.publicKey? |
Uint8Array |
__namedParameters.role? |
OrgRole |
__namedParameters.status? |
OrgMemberStatus |
Returns
Promise
<void
>
Inherited from
Defined in
canRead
▸ canRead(vault
, account
): undefined
| boolean
Check whether the given account
has read access to a vault
Parameters
Name | Type |
---|---|
vault |
Object |
vault.id |
string |
account |
Object |
account.email |
string |
Returns
undefined
| boolean
Inherited from
Defined in
canWrite
▸ canWrite(vault
, acc
): undefined
| boolean
Check whether the given account
has write access to a vault
Parameters
Name | Type |
---|---|
vault |
Object |
vault.id |
string |
acc |
Object |
acc.email |
string |
Returns
undefined
| boolean
Inherited from
Defined in
clone
▸ clone(): UnlockedOrg
Creates a deep clone of the object
Returns
Inherited from
Defined in
fromBytes
▸ fromBytes(bytes
): UnlockedOrg
Deserializes the object from a byte array
Parameters
Name | Type |
---|---|
bytes |
Uint8Array |
Returns
Inherited from
Defined in
fromJSON
▸ fromJSON(json
): UnlockedOrg
Deserializes the object from a JSON string
Parameters
Name | Type |
---|---|
json |
string |
Returns
Inherited from
Defined in
fromRaw
▸ fromRaw(raw
): UnlockedOrg
Restores propertiers from a raw object of the same form generated by
toRaw. The base implementation blindly copies over
values from the raw object via Object.assign
so subclasses should explictly
process any propertyies that need special treatment.
Also takes are of validation and "upgrading" in case the raw object has an old version. Use the protected _fromRaw method to implement subclass-specific behavior.
Parameters
Name | Type |
---|---|
raw |
any |
Returns
Inherited from
Defined in
generateKeys
▸ generateKeys(): Promise
<void
>
Generates a new publicKey, privateKey and invitesKey and encrypts the latter two
Returns
Promise
<void
>
Inherited from
Defined in
getAccessors
▸ getAccessors(vault
): ActiveOrgMember
[]
Get all membes that have acess to a given vault
, either directly or through a
Group
Parameters
Name | Type |
---|---|
vault |
Vault |
Returns
Inherited from
Defined in
getData
▸ getData(): Promise
<Uint8Array
>
Decrypts and extracts the plain text data from the container. This will usually require unlocking the container first.
Returns
Promise
<Uint8Array
>
Inherited from
Defined in
getGroup
▸ getGroup(name
): undefined
| Group
Get group with the given name
Parameters
Name | Type |
---|---|
name |
string |
Returns
undefined
| Group
Inherited from
Defined in
getGroupsForMember
▸ getGroupsForMember(__namedParameters
):
Group
[]
Get all Groups the given Account is a member of
Parameters
Name | Type |
---|---|
__namedParameters |
Object |
__namedParameters.email |
string |
Returns
Group
[]
Inherited from
Defined in
getGroupsForVault
▸ getGroupsForVault(__namedParameters
):
Group
[]
Get all groups assigned to a given Vault
Parameters
Name | Type |
---|---|
__namedParameters |
Object |
__namedParameters.id |
string |
Returns
Group
[]
Inherited from
Defined in
getInvite
▸ getInvite(id
): undefined
| Invite
Get the invite with the given id
Parameters
Name | Type |
---|---|
id |
string |
Returns
undefined
| Invite
Inherited from
Defined in
getMember
▸ getMember(__namedParameters
): undefined
|
OrgMember
Get the OrgMember object for this Account
Parameters
Name | Type |
---|---|
__namedParameters |
{ accountId? : string ; email : string } | { accountId : string ; email? : string } |
Returns
undefined
| OrgMember
Inherited from
Defined in
getMembersForGroup
▸ getMembersForGroup(group
): OrgMember
[]
Get all members of a given group
Parameters
Name | Type |
---|---|
group |
Group |
Returns
Inherited from
Defined in
getMembersForVault
▸ getMembersForVault(__namedParameters
):
ActiveOrgMember
[]
Get all members directly assigned to a given Vault
Parameters
Name | Type |
---|---|
__namedParameters |
Object |
__namedParameters.id |
string |
Returns
Inherited from
Defined in
getVaultsForMember
▸ getVaultsForMember(acc
): { id
: string
; name
: string
;
revision?
: string
}[]
Get all vaults the given member has access to
Parameters
Name | Type |
---|---|
acc |
Object |
acc.email |
string |
Returns
{ id
: string
; name
: string
; revision?
: string
}[]
Inherited from
Defined in
initialize
▸ initialize(account
): Promise
<void
>
Initializes the organization, generating
publicKey,
privateKey, and
invitesKey and adding the given account
as
the organization owner.
Parameters
Name | Type |
---|---|
account |
Account |
Returns
Promise
<void
>
Inherited from
Defined in
isAdmin
▸ isAdmin(m
): boolean
Whether the given Account is an OrgRole.Admin
Parameters
Name | Type |
---|---|
m |
Object |
m.email |
string |
Returns
boolean
Inherited from
Defined in
isMember
▸ isMember(acc
): boolean
Whether the given Account is an organization member
Parameters
Name | Type |
---|---|
acc |
Object |
acc.email |
string |
Returns
boolean
Inherited from
Defined in
isOwner
▸ isOwner(__namedParameters
): boolean
Whether the given Account is an OrgRole.Owner
Parameters
Name | Type |
---|---|
__namedParameters |
Object |
__namedParameters.email |
string |
Returns
boolean
Inherited from
Defined in
isSuspended
▸ isSuspended(m
): boolean
Whether the given Account is currently suspended
Parameters
Name | Type |
---|---|
m |
Object |
m.email |
string |
Returns
boolean
Inherited from
Defined in
lock
▸ lock(): void
Locks the container, removing the possibility to extract the plain text data via getData until the container is unlocked again. Subclasses extending this class must take care to delete any keys or other sensitive data that may have been stored temporarily after unlocking the container.
Returns
void
Inherited from
Defined in
makeOwner
▸ makeOwner(member
): Promise
<void
>
Transfers organization ownership to a different member
Parameters
Name | Type |
---|---|
member |
Object |
member.email |
string |
Returns
Promise
<void
>
Inherited from
Defined in
removeInvite
▸ removeInvite(__namedParameters
): void
Remove an invite
Parameters
Name | Type |
---|---|
__namedParameters |
Invite |
Returns
void
Inherited from
Defined in
removeMember
▸ removeMember(member
, reSignMembers?
): Promise
<void
>
Removes a member from the organization
Parameters
Name | Type | Default value |
---|---|---|
member |
Object |
undefined |
member.email |
string |
undefined |
reSignMembers |
boolean |
true |
Returns
Promise
<void
>
Inherited from
Defined in
rotateKeys
▸ rotateKeys(force?
): Promise
<void
>
Regenerates all cryptographic keys and updates all member signatures
Parameters
Name | Type | Default value |
---|---|---|
force |
boolean |
false |
Returns
Promise
<void
>
Inherited from
Defined in
setData
▸ setData(data
): Promise
<void
>
Encrypts the provided data
and stores it in the container
Parameters
Name | Type |
---|---|
data |
Uint8Array |
Returns
Promise
<void
>
Inherited from
Defined in
sign
▸ sign(member
): Promise
<OrgMember
>
Signs the member
s public key, id, role and email address so they can be
verified later
Parameters
Name | Type |
---|---|
member |
OrgMember |
Returns
Promise
<OrgMember
>
Inherited from
Defined in
toBytes
▸ toBytes(): Uint8Array
Returns a serialization of the object in form of a byte array
Returns
Uint8Array
Inherited from
Defined in
toJSON
▸ toJSON(): string
Returns a JSON serialization of the object
Returns
string
Inherited from
Defined in
toRaw
▸ toRaw(version?
): any
Creates a raw javascript object representation of the class, which can be used for storage or data transmission. Also handles "downgrading" to previous versions. Use _toRaw for subclass-specific behavior.
Parameters
Name | Type |
---|---|
version? |
string |
Returns
any
Inherited from
Defined in
toString
▸ toString(): string
Returns
string
Inherited from
Defined in
unlock
▸ unlock(account
): Promise
<void
>
"Unlocks" the organization, granting access to the organizations privateKey and invitesKey properties.
Parameters
Name | Type |
---|---|
account |
UnlockedAccount |
Returns
Promise
<void
>
Inherited from
Defined in
updateAccessors
▸ updateAccessors(subjects
): Promise
<void
>
Updates the containers accessors, generating a new shared key and encrypting it with the public keys of the provided subjects. Non-empty containers need to be unlocked first.
Parameters
Name | Type |
---|---|
subjects |
{ id : string ; publicKey : Uint8Array }[] |
Returns
Promise
<void
>
Inherited from
Defined in
validate
▸ validate(): boolean
This is called during deserialization and should verify that all properties have been populated with values of the correct type. Subclasses should implement this method based on their class structure.
Returns
boolean
Inherited from
Defined in
verify
▸ verify(member
): Promise
<void
>
Verifies the member
s public key, id, role and email address. Throws if
verification fails.
Parameters
Name | Type |
---|---|
member |
OrgMember |
Returns
Promise
<void
>
Inherited from
Defined in
verifyAll
▸ verifyAll(members?
): Promise
<void
>
Verify all provided members
, throws if verification fails for any of them.
Parameters
Name | Type |
---|---|
members |
OrgMember [] |
Returns
Promise
<void
>