import { IpfsHash } from '../src/customTypes/ipfsHash'; import { test, expect, it, describe, beforeAll } from '@jest/globals'; import { Consent, ConsentSignerKind } from '../src/resource/consent'; //import type { ConsentSignerKind } from '../src/resource/consent'; import { DocumentReference } from '../src/resource/document'; import { Field, CircuitString, Character, PrivateKey, Signature } from 'o1js'; import { Uuidv4 } from '../src/customTypes/uuidv4'; describe('Lib Testing', () => { let grantorAccount: PrivateKey; let controllerAccount: PrivateKey; beforeAll(async () => { grantorAccount = PrivateKey.random(); controllerAccount = PrivateKey.random(); //if (proofsEnabled) await SegmentVerifier.compile(); }); it('uses o1js for ipfs hash', async () => { const doc = await DocumentReference.init( 'tests/data/sampleagreement.json', 'json' ); const docCid = doc.identifier.toString(); const packedIpfsHash = IpfsHash.fromString(docCid); expect(packedIpfsHash.toString()).toEqual(docCid); }); it('signs packed uuid', async () => { const UUID = '75a8a5f7-f779-48ba-bd27-be70169eb4ad'; const packedUUID = Uuidv4.fromString(UUID); //TODO: wait for packedIpfsHash to support toFields() to allow for signature const sig = Signature.create(grantorAccount, [...packedUUID.toFields()]); }); });