Consider something like the following (fair amount of work - may not be worth it)
import { Oprf } from '@cloudflare/voprf-ts'
import { CryptoNoble } from '@cloudflare/voprf-ts/crypto-noble';
// Configure OprfNoble with a custom crypto provider
const OprfNoble = Oprf.withConfig({ cryptoProvider: CryptoNoble });
const suite = OprfNoble.makeSuite({mode: Oprf.Mode.OPRF, suite: Oprf.Suite.RISTRETTO255_SHA512});
// Generate a key pair
const { privateKey, publicKey } = suite.generateKeyPair();
// Create server and client instances using the suite's factory methods
const server = suite.makeServer(privateKey);
const client = suite.makeClient(publicKey);
// Do something with the group
const scalar = suite.group.newScalar()
Could do like this:
Draft new interfaces encapsulating desired functionality.
Adjust existing code minimally to comply with new interfaces.
Incorporate new tests validating the updated structures.
Expose the new interfaces while keeping the old ones internal.
Progressively refactor the internal code, ensuring continuous compliance with the new interfaces and passing tests.
Consider something like the following (fair amount of work - may not be worth it)
Could do like this: