Merge pull request #1572 from SkynetLabs/registry-health-check-auth-cookie

Registry health check auth cookie
This commit is contained in:
firyx 2022-01-20 12:57:05 +01:00 committed by GitHub
commit 66a5ba3119
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -106,14 +106,15 @@ async function accountWebsiteCheck(done) {
// registryWriteAndReadCheck writes to registry and immediately reads and compares the data // registryWriteAndReadCheck writes to registry and immediately reads and compares the data
async function registryWriteAndReadCheck(done) { async function registryWriteAndReadCheck(done) {
const authCookie = await getAuthCookie();
const time = process.hrtime(); const time = process.hrtime();
const data = { name: "registry_write_and_read", up: false }; const data = { name: "registry_write_and_read", up: false };
const { privateKey, publicKey } = genKeyPairAndSeed(); const { privateKey, publicKey } = genKeyPairAndSeed();
const expected = { dataKey: "foo-key", data: stringToUint8ArrayUtf8("foo-data"), revision: BigInt(0) }; const expected = { dataKey: "foo-key", data: stringToUint8ArrayUtf8("foo-data"), revision: BigInt(0) };
try { try {
await skynetClient.registry.setEntry(privateKey, expected); await skynetClient.registry.setEntry(privateKey, expected, { customCookie: authCookie });
const { entry } = await skynetClient.registry.getEntry(publicKey, expected.dataKey); const { entry } = await skynetClient.registry.getEntry(publicKey, expected.dataKey, { customCookie: authCookie });
if (isEqual(expected, entry)) { if (isEqual(expected, entry)) {
data.up = true; data.up = true;