Skip to content

Commit

Permalink
Adapt to model changes and fix compile errors
Browse files Browse the repository at this point in the history
  • Loading branch information
sarashub committed Dec 5, 2024
1 parent 4256db6 commit 7ab9bf2
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 23 deletions.
5 changes: 5 additions & 0 deletions schemas/sys.json
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,11 @@
"name": "AddAssociation",
"sourceType": "KeyRotation",
"info": "AddAssociation KeyRotation/adminDistKeyPair/AGGREGATION/2499."
},
{
"name": "AddValue",
"sourceType": "UserGroupKeyRotationData",
"info": "AddValue UserGroupKeyRotationData/userGroupEncAdminGroupKey/2520."
}
]
}
Expand Down
29 changes: 19 additions & 10 deletions src/common/api/entities/sys/TypeModels.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,16 @@ export const typeModels = {
}
},
"associations": {
"userEncAdminSymKeyHash": {
"final": false,
"name": "userEncAdminSymKeyHash",
"id": 2504,
"since": 115,
"type": "AGGREGATION",
"cardinality": "One",
"refType": "EncryptedKeyHash",
"dependency": null
},
"userGroupId": {
"final": false,
"name": "userGroupId",
Expand Down Expand Up @@ -314,16 +324,6 @@ export const typeModels = {
"refType": "EncryptedKeyHash",
"dependency": null
},
"userEncAdminSymKeyHashList": {
"final": false,
"name": "userEncAdminSymKeyHashList",
"id": 2504,
"since": 115,
"type": "AGGREGATION",
"cardinality": "Any",
"refType": "EncryptedKeyHash",
"dependency": null
},
"userGroupKeyData": {
"final": false,
"name": "userGroupKeyData",
Expand Down Expand Up @@ -13880,6 +13880,15 @@ export const typeModels = {
"cardinality": "One",
"encrypted": false
},
"userGroupEncAdminGroupKey": {
"final": false,
"name": "userGroupEncAdminGroupKey",
"id": 2520,
"since": 115,
"type": "Bytes",
"cardinality": "ZeroOrOne",
"encrypted": false
},
"userGroupEncPreviousGroupKey": {
"final": false,
"name": "userGroupEncPreviousGroupKey",
Expand Down
3 changes: 2 additions & 1 deletion src/common/api/entities/sys/TypeRefs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export type AdminGroupKeyDistributionElement = {
_id: Id;
distEncAdminGroupKey: Uint8Array;

userEncAdminSymKeyHash: EncryptedKeyHash;
userGroupId: Id;
}
export const AdminGroupKeyRotationPostInTypeRef: TypeRef<AdminGroupKeyRotationPostIn> = new TypeRef("sys", "AdminGroupKeyRotationPostIn")
Expand All @@ -65,7 +66,6 @@ export type AdminGroupKeyRotationPostIn = {
adminGroupKeyData: GroupKeyRotationData;
distribution: AdminGroupKeyDistributionElement[];
userEncAdminPubKeyHashList: EncryptedKeyHash[];
userEncAdminSymKeyHashList: EncryptedKeyHash[];
userGroupKeyData: UserGroupKeyRotationData;
}
export const AdminGroupKeyRotationPutInTypeRef: TypeRef<AdminGroupKeyRotationPutIn> = new TypeRef("sys", "AdminGroupKeyRotationPutIn")
Expand Down Expand Up @@ -3411,6 +3411,7 @@ export type UserGroupKeyRotationData = {
authVerifier: Uint8Array;
distributionKeyEncUserGroupKey: Uint8Array;
passphraseEncUserGroupKey: Uint8Array;
userGroupEncAdminGroupKey: null | Uint8Array;
userGroupEncPreviousGroupKey: Uint8Array;
userGroupKeyVersion: NumberString;

Expand Down
4 changes: 3 additions & 1 deletion src/common/api/worker/facades/KeyRotationFacade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -428,9 +428,10 @@ export class KeyRotationFacade {
adminGroupKeyVersion: String(encryptedUserKeys.newAdminGroupKeyEncNewUserGroupKey.encryptingKeyVersion),
passphraseEncUserGroupKey: encryptedUserKeys.passphraseKeyEncNewUserGroupKey.key,
pubAdminGroupEncUserGroupKey: null,
userGroupEncAdminGroupKey: null,
})

return createAdminGroupKeyRotationPostIn({ adminGroupKeyData, userGroupKeyData, userEncAdminPubKeyHashList, distribution, userEncAdminSymKeyHashList })
return createAdminGroupKeyRotationPostIn({ adminGroupKeyData, userGroupKeyData, userEncAdminPubKeyHashList, distribution })
}

private async generateEncryptedKeyHashes(
Expand Down Expand Up @@ -961,6 +962,7 @@ export class KeyRotationFacade {
pubAdminGroupEncUserGroupKey,
adminGroupEncUserGroupKey: null,
recoverCodeData: recoverCodeData,
userGroupEncAdminGroupKey: null,
})

await this.serviceExecutor.post(UserGroupKeyRotationService, createUserGroupKeyRotationPostIn({ userGroupKeyData }))
Expand Down
4 changes: 3 additions & 1 deletion tuta-sdk/rust/sdk/src/entities/generated/sys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ pub struct AdminGroupKeyDistributionElement {
pub _id: Option<CustomId>,
#[serde(with = "serde_bytes")]
pub distEncAdminGroupKey: Vec<u8>,
pub userEncAdminSymKeyHash: EncryptedKeyHash,
pub userGroupId: GeneratedId,
}

Expand All @@ -68,7 +69,6 @@ pub struct AdminGroupKeyRotationPostIn {
pub adminGroupKeyData: GroupKeyRotationData,
pub distribution: Vec<AdminGroupKeyDistributionElement>,
pub userEncAdminPubKeyHashList: Vec<EncryptedKeyHash>,
pub userEncAdminSymKeyHashList: Vec<EncryptedKeyHash>,
pub userGroupKeyData: UserGroupKeyRotationData,
}

Expand Down Expand Up @@ -4258,6 +4258,8 @@ pub struct UserGroupKeyRotationData {
#[serde(with = "serde_bytes")]
pub passphraseEncUserGroupKey: Vec<u8>,
#[serde(with = "serde_bytes")]
pub userGroupEncAdminGroupKey: Option<Vec<u8>>,
#[serde(with = "serde_bytes")]
pub userGroupEncPreviousGroupKey: Vec<u8>,
pub userGroupKeyVersion: i64,
pub group: GeneratedId,
Expand Down
29 changes: 19 additions & 10 deletions tuta-sdk/rust/sdk/src/type_models/sys.json
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,16 @@
}
},
"associations": {
"userEncAdminSymKeyHash": {
"final": false,
"name": "userEncAdminSymKeyHash",
"id": 2504,
"since": 115,
"type": "AGGREGATION",
"cardinality": "One",
"refType": "EncryptedKeyHash",
"dependency": null
},
"userGroupId": {
"final": false,
"name": "userGroupId",
Expand Down Expand Up @@ -307,16 +317,6 @@
"refType": "EncryptedKeyHash",
"dependency": null
},
"userEncAdminSymKeyHashList": {
"final": false,
"name": "userEncAdminSymKeyHashList",
"id": 2504,
"since": 115,
"type": "AGGREGATION",
"cardinality": "Any",
"refType": "EncryptedKeyHash",
"dependency": null
},
"userGroupKeyData": {
"final": false,
"name": "userGroupKeyData",
Expand Down Expand Up @@ -13873,6 +13873,15 @@
"cardinality": "One",
"encrypted": false
},
"userGroupEncAdminGroupKey": {
"final": false,
"name": "userGroupEncAdminGroupKey",
"id": 2520,
"since": 115,
"type": "Bytes",
"cardinality": "ZeroOrOne",
"encrypted": false
},
"userGroupEncPreviousGroupKey": {
"final": false,
"name": "userGroupEncPreviousGroupKey",
Expand Down

0 comments on commit 7ab9bf2

Please sign in to comment.