Skip to content

Commit 30bb383

Browse files
forgetsoCopilot
andauthored
Fix verify fn and test accounts (#1941)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 9575eaa commit 30bb383

17 files changed

Lines changed: 279 additions & 239 deletions

File tree

.changeset/cool-hairs-cry.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
"@prosopo/util-crypto": minor
3+
"@prosopo/provider": minor
4+
"@prosopo/keyring": minor
5+
"@prosopo/types": minor
6+
"@prosopo/scripts": minor
7+
---
8+
9+
Making sure verify works and derived accounts
10+

dev/scripts/src/setup/provider.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,11 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
import { ProsopoEnvError } from "@prosopo/common";
1615
import { datasetWithSolutionHashes } from "@prosopo/datasets";
1716
import { Tasks } from "@prosopo/provider";
18-
import type { IProviderAccount } from "@prosopo/types";
1917
import type { ProviderEnvironment } from "@prosopo/types-env";
2018

21-
export async function setupProvider(
22-
env: ProviderEnvironment,
23-
provider: IProviderAccount,
24-
): Promise<void> {
25-
if (!provider.pair) {
26-
throw new ProsopoEnvError("DEVELOPER.MISSING_PROVIDER_PAIR", {
27-
context: { provider },
28-
});
29-
}
19+
export async function setupProvider(env: ProviderEnvironment): Promise<void> {
3020
const logger = env.logger;
3121
const tasks = new Tasks(env);
3222
logger.info(" - providerSetDataset");

dev/scripts/src/setup/setup.ts

Lines changed: 7 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,12 @@ import { defaultConfig, getSecret } from "@prosopo/cli";
1717
import { LogLevel, ProsopoEnvError, getLogger } from "@prosopo/common";
1818
import { getEnvFile } from "@prosopo/dotenv";
1919
import { ProviderEnvironment } from "@prosopo/env";
20-
import { DEV_PHRASE, generateMnemonic, getPair } from "@prosopo/keyring";
2120
import {
22-
CaptchaType,
23-
ClientSettingsSchema,
24-
type IProviderAccount,
25-
type ISite,
26-
} from "@prosopo/types";
21+
generateMnemonic,
22+
getDefaultSiteKeys,
23+
getPair,
24+
} from "@prosopo/keyring";
25+
import type { IProviderAccount } from "@prosopo/types";
2726
import { get } from "@prosopo/util";
2827
import fse from "fs-extra";
2928
import { updateDemoHTMLFiles, updateEnvFiles } from "../util/index.js";
@@ -59,41 +58,9 @@ function getDefaultProvider(): IProviderAccount {
5958
address: process.env.PROSOPO_PROVIDER_ADDRESS || "",
6059
secret: getSecret(),
6160
captchaDatasetId: "",
61+
pair: getPair(getSecret()),
6262
};
6363
}
64-
//sr25519 dev site keys
65-
export function getDefaultSiteKeys(): ISite[] {
66-
return [
67-
{
68-
secret: `${DEV_PHRASE}//${CaptchaType.image}`,
69-
address: "5DWuxC3covEaAsPcMt1zcpibGLsHAqMcfAzi2fzuWtQupFgq",
70-
settings: ClientSettingsSchema.parse({
71-
captchaType: CaptchaType.image,
72-
}),
73-
},
74-
{
75-
secret: `${DEV_PHRASE}//${CaptchaType.pow}`,
76-
address: "5GWr5T3bCvBZMG9H9CDM5ynYS1zo7vcwS24Dg4DismRmsD8P",
77-
settings: ClientSettingsSchema.parse({
78-
captchaType: CaptchaType.pow,
79-
}),
80-
},
81-
{
82-
secret: `${DEV_PHRASE}//${CaptchaType.frictionless}`,
83-
address: "5Do7mgno9VQCDPn6abR1UgB9jUjaEmqVQb5paB5fHNabvRDE",
84-
settings: ClientSettingsSchema.parse({
85-
captchaType: CaptchaType.frictionless,
86-
}),
87-
},
88-
{
89-
secret: `${DEV_PHRASE}//${CaptchaType.invisible}`,
90-
address: "5FNFBC97JQoJu7LBapycXbT66N9xzQH2tyFv1yNvBxqa8tQR",
91-
settings: ClientSettingsSchema.parse({
92-
captchaType: CaptchaType.invisible,
93-
}),
94-
},
95-
];
96-
}
9764

9865
async function copyEnvFile() {
9966
try {
@@ -169,7 +136,7 @@ export async function setup(provider: boolean, sites: boolean) {
169136

170137
defaultProvider.pair = getPair(providerSecret);
171138
if (provider) {
172-
await setupProvider(env, defaultProvider);
139+
await setupProvider(env);
173140

174141
if (!hasProviderAccount) {
175142
await updateEnvFile({

0 commit comments

Comments
 (0)