Description
The current implementation of the Client class is designed to handle a single request at a time. This design can be surprising/confusing and does not align with the convention used in the OPRF setup, which returns a tuple [finData, request].
Proposed Solution
Two possible ways to approach this refactoring:
- Rename
Client to TokenRequestContext to better convey the per-request state and update its methods accordingly.
- Modify the
createTokenRequest method to return a tuple [finData, request] instead of a single TokenRequest object.
It's proposed to refactor the Client class to adhere to the OPRF convention.
export class TokenRequestContext {
private finData?: {
pkIssuer: CryptoKey;
tokenInput: Uint8Array;
authInput: AuthenticatorInput;
inv: Uint8Array;
};
async createRequest(
tokChl: TokenChallenge,
issuerPublicKey: Uint8Array,
): Promise<TokenRequest> {
or
interface Client2State {
authInput: AuthenticatorInput;
finData: FinalizeData;
}
export class Client2 {
vClient: Client<ModeVoprf>;
constructor(private issuerPublicKey: Uint8Array) {
this.vClient = MODE.makeClient(issuerPublicKey);
}
async createTokenRequest(
tokChl: TokenChallenge,
): Promise<[finData: Client2State, request: TokenRequest2]> {
Description
The current implementation of the
Clientclass is designed to handle a single request at a time. This design can be surprising/confusing and does not align with the convention used in the OPRF setup, which returns a tuple[finData, request].Proposed Solution
Two possible ways to approach this refactoring:
ClienttoTokenRequestContextto better convey the per-request state and update its methods accordingly.createTokenRequestmethod to return a tuple[finData, request]instead of a singleTokenRequestobject.It's proposed to refactor the
Clientclass to adhere to the OPRF convention.or