Skip to content

Commit

Permalink
Merge pull request #307 from logion-network/feature/recovery-info
Browse files Browse the repository at this point in the history
Enable secret recovery review and decision
  • Loading branch information
gdethier authored May 23, 2024
2 parents d6252b4 + b69133c commit c3c8136
Show file tree
Hide file tree
Showing 24 changed files with 984 additions and 138 deletions.
2 changes: 1 addition & 1 deletion resources/mail/recoverable-secret-added.pug
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
| logion notification - Recoverable secret added
| Dear #{walletUser.firstName} #{walletUser.lastName},
|
| You receive this message because you just added a recoverable secret with name #{secretName} to your Identity LOC #{loc.id}.
| You receive this message because you just added a recoverable secret with name #{secret.secretName} to your Identity LOC #{loc.id}.
|
| Please note, you can't answer this email. The logion network will never ask you to provide any kind of information or access to a web address through its email notifications.
|
Expand Down
9 changes: 9 additions & 0 deletions resources/mail/secret-recovery-accepted.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
| logion notification - Secret recovery accepted
| Dear #{walletUser.firstName} #{walletUser.lastName},
|
| You receive this message because your request to recover the secret with name #{secret.secretName} linked to your Identity LOC #{loc.id} has been accepted
| by the legal officer in charge.
|
| Please note, you can't answer this email. The logion network will never ask you to provide any kind of information or access to a web address through its email notifications.
|
include /footer.pug
10 changes: 10 additions & 0 deletions resources/mail/secret-recovery-rejected.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
| logion notification - Secret recovery rejected
| Dear #{walletUser.firstName} #{walletUser.lastName},
|
| You receive this message because your request to recover the secret with name #{secret.secretName} linked to your Identity LOC #{loc.id} has been rejected
| by the legal officer in charge for the following reason:
| #{secret.decision.rejectReason}
|
| Please note, you can't answer this email. The logion network will never ask you to provide any kind of information or access to a web address through its email notifications.
|
include /footer.pug
2 changes: 1 addition & 1 deletion resources/mail/secret-recovery-requested-user.pug
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
| logion notification - Recoverable secret added
| Dear #{walletUser.firstName} #{walletUser.lastName},
|
| You receive this message because you just requested to recover the secret with name #{secretName} linked to your Identity LOC #{loc.id}.
| You receive this message because you just requested to recover the secret with name #{secret.secretName} linked to your Identity LOC #{loc.id}.
|
| Please note, you can't answer this email. The logion network will never ask you to provide any kind of information or access to a web address through its email notifications.
|
Expand Down
113 changes: 102 additions & 11 deletions resources/schemas.json
Original file line number Diff line number Diff line change
Expand Up @@ -412,33 +412,60 @@
"title": "ProtectionRequestView",
"description": "Information about the created Protection Request"
},
"RecoveryInfoIdentityView": {
"type": "object",
"properties": {
"userIdentity": {
"$ref": "#/components/schemas/UserIdentityView"
},
"userPostalAddress": {
"$ref": "#/components/schemas/PostalAddressView"
}
}
},
"RecoveryInfoView": {
"type": "object",
"properties": {
"addressToRecover": {
"type": "string",
"description": "The address to recover"
"identity1": {
"$ref": "#/components/schemas/RecoveryInfoIdentityView"
},
"accountToRecover": {
"$ref": "#/components/schemas/ProtectionRequestView"
"identity2": {
"$ref": "#/components/schemas/RecoveryInfoIdentityView"
},
"recoveryAccount": {
"$ref": "#/components/schemas/ProtectionRequestView"
"type": {
"$ref": "#/components/schemas/RecoveryRequestType"
},
"accountRecovery": {
"type": "object",
"properties": {
"address1": {
"type": "string",
"description": "The address to recover"
},
"address2": {
"type": "string",
"description": "The recovering address"
}
}
}
},
"title": "RecoveryInfoView",
"description": "The new (recovery) and old (to recover) account data"
"description": "The new (recovery) and old (to recover) account data",
"required": [
"identity2",
"type"
]
},
"RejectProtectionRequestView": {
"RejectRecoveryRequestView": {
"type": "object",
"properties": {
"rejectReason": {
"type": "string",
"description": "The rejection reason"
}
},
"title": "RejectProtectionRequestView",
"description": "The Protection Request to reject"
"title": "RejectRecoveryRequestView",
"description": "The Recovery Request to reject"
},
"RejectTokenRequestView": {
"type": "object",
Expand Down Expand Up @@ -1955,6 +1982,70 @@
"userIdentity",
"userPostalAddress"
]
},
"RecoveryRequestType": {
"type": "string",
"description": "The recovery request type",
"enum": [
"ACCOUNT",
"SECRET"
]
},
"RecoveryRequestView": {
"type": "object",
"properties": {
"userIdentity": {
"$ref": "#/components/schemas/UserIdentityView"
},
"userPostalAddress": {
"$ref": "#/components/schemas/PostalAddressView"
},
"createdOn": {
"type": "string",
"format": "date-time",
"description": "The creation timestamp"
},
"status": {
"type": "string",
"description": "A recovery request status",
"enum": [
"ACCEPTED",
"PENDING",
"REJECTED",
"ACTIVATED",
"CANCELLED",
"REJECTED_CANCELLED",
"ACCEPTED_CANCELLED"
]
},
"type": {
"$ref": "#/components/schemas/RecoveryRequestType"
},
"id": {
"type": "string",
"format": "uuid",
"description": "The ID of created Protection Request"
}
},
"required": [
"id",
"createdOn",
"status",
"type",
"userIdentity",
"userPostalAddress"
]
},
"RecoveryRequestsView": {
"type": "object",
"properties": {
"requests": {
"type": "array",
"items": {
"$ref": "#/components/schemas/RecoveryRequestView"
}
}
}
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/logion/app.support.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { fillInSpec as fillInSpecVote, VoteController } from "./controllers/vote
import { fillInSpec as fillInSpecTokensRecord, TokensRecordController } from "./controllers/records.controller.js";
import { fillInSpec as fillInSpecWorkload, WorkloadController } from "./controllers/workload.controller.js";
import { fillInSpec as fillInSpecSecretRecovery, SecretRecoveryController } from "./controllers/secret_recovery.controller.js";
import { fillInSpec as fillInSpecRecovery, RecoveryController } from "./controllers/recovery.controller.js";

const { logger } = Log;

Expand Down Expand Up @@ -64,6 +65,7 @@ export function predefinedSpec(spec: OpenAPIV3.Document): OpenAPIV3.Document {
fillInSpecTokensRecord(spec);
fillInSpecWorkload(spec);
fillInSpecSecretRecovery(spec);
fillInSpecRecovery(spec);

return spec;
}
Expand Down Expand Up @@ -127,6 +129,7 @@ export function setupApp(expressConfig?: ExpressConfig): Express {
dino.registerController(TokensRecordController);
dino.registerController(WorkloadController);
dino.registerController(SecretRecoveryController);
dino.registerController(RecoveryController);

dino.dependencyResolver<Container>(AppContainer,
(injector, type) => {
Expand Down
2 changes: 2 additions & 0 deletions src/logion/container/app.container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ import {
SecretRecoveryRequestService,
TransactionalSecretRecoveryRequestService
} from "../services/secret_recovery.service.js";
import { RecoveryController } from "../controllers/recovery.controller.js";

const container = new Container({ defaultScope: "Singleton", skipBaseClassChecks: true });
configureContainer(container);
Expand Down Expand Up @@ -175,5 +176,6 @@ container.bind(VoteController).toSelf().inTransientScope();
container.bind(TokensRecordController).toSelf().inTransientScope();
container.bind(WorkloadController).toSelf().inTransientScope();
container.bind(SecretRecoveryController).toSelf().inTransientScope();
container.bind(RecoveryController).toSelf().inTransientScope();

export { container as AppContainer };
51 changes: 44 additions & 7 deletions src/logion/controllers/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,21 +236,30 @@ export interface components {
/** @description The postal address of the requester */
userPostalAddress?: components["schemas"]["PostalAddressView"];
};
RecoveryInfoIdentityView: {
userIdentity?: components["schemas"]["UserIdentityView"];
userPostalAddress?: components["schemas"]["PostalAddressView"];
};
/**
* RecoveryInfoView
* @description The new (recovery) and old (to recover) account data
*/
RecoveryInfoView: {
/** @description The address to recover */
addressToRecover?: string;
accountToRecover?: components["schemas"]["ProtectionRequestView"];
recoveryAccount?: components["schemas"]["ProtectionRequestView"];
identity1?: components["schemas"]["RecoveryInfoIdentityView"];
identity2: components["schemas"]["RecoveryInfoIdentityView"];
type: components["schemas"]["RecoveryRequestType"];
accountRecovery?: {
/** @description The address to recover */
address1?: string;
/** @description The recovering address */
address2?: string;
};
};
/**
* RejectProtectionRequestView
* @description The Protection Request to reject
* RejectRecoveryRequestView
* @description The Recovery Request to reject
*/
RejectProtectionRequestView: {
RejectRecoveryRequestView: {
/** @description The rejection reason */
rejectReason?: string;
};
Expand Down Expand Up @@ -1052,6 +1061,34 @@ export interface components {
userIdentity: components["schemas"]["UserIdentityView"];
userPostalAddress: components["schemas"]["PostalAddressView"];
};
/**
* @description The recovery request type
* @enum {string}
*/
RecoveryRequestType: "ACCOUNT" | "SECRET";
RecoveryRequestView: {
userIdentity: components["schemas"]["UserIdentityView"];
userPostalAddress: components["schemas"]["PostalAddressView"];
/**
* Format: date-time
* @description The creation timestamp
*/
createdOn: string;
/**
* @description A recovery request status
* @enum {string}
*/
status: "ACCEPTED" | "PENDING" | "REJECTED" | "ACTIVATED" | "CANCELLED" | "REJECTED_CANCELLED" | "ACCEPTED_CANCELLED";
type: components["schemas"]["RecoveryRequestType"];
/**
* Format: uuid
* @description The ID of created Protection Request
*/
id: string;
};
RecoveryRequestsView: {
requests?: components["schemas"]["RecoveryRequestView"][];
};
};
responses: never;
parameters: never;
Expand Down
Loading

0 comments on commit c3c8136

Please sign in to comment.