New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@ozkarjs/vhir

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ozkarjs/vhir - npm Package Compare versions

Comparing version 0.2.7 to 0.2.8

3

build/src/customTypes/cipherText.js

@@ -1,3 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
export {};
//# sourceMappingURL=cipherText.js.map

@@ -1,5 +0,3 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DynamicArray = void 0;
const o1js_1 = require("o1js");
import { Bool, Field, Poseidon, Provable, Struct } from 'o1js';
export { DynamicArray };
function hashable(type) {

@@ -9,3 +7,3 @@ return {

hash(x) {
return o1js_1.Poseidon.hash(type.toFields(x));
return Poseidon.hash(type.toFields(x));
},

@@ -20,7 +18,7 @@ equals(x, other) {

function Null() {
return type.fromFields(Array(type.sizeInFields()).fill((0, o1js_1.Field)(0)), type.toAuxiliary());
return type.fromFields(Array(type.sizeInFields()).fill(Field(0)), type.toAuxiliary());
}
return class _DynamicArray extends (0, o1js_1.Struct)({
length: o1js_1.Field,
values: o1js_1.Provable.Array(type, maxLength),
return class _DynamicArray extends Struct({
length: Field,
values: Provable.Array(type, maxLength),
}) {

@@ -32,3 +30,3 @@ static from(values) {

const arr = new _DynamicArray();
arr.length = length ?? (0, o1js_1.Field)(0);
arr.length = length ?? Field(0);
return arr;

@@ -39,3 +37,3 @@ }

values: fillWithNull(values ?? [], maxLength),
length: values === undefined ? (0, o1js_1.Field)(0) : (0, o1js_1.Field)(values.length),
length: values === undefined ? Field(0) : Field(values.length),
});

@@ -45,3 +43,3 @@ }

const mask = this.indexMask(index);
return o1js_1.Provable.switch(mask, type, this.values);
return Provable.switch(mask, type, this.values);
}

@@ -51,3 +49,3 @@ set(index, value) {

for (let i = 0; i < this.maxLength(); i++) {
this.values[i] = o1js_1.Provable.switch([mask[i], mask[i].not()], type, [
this.values[i] = Provable.switch([mask[i], mask[i].not()], type, [
value,

@@ -59,3 +57,3 @@ this.values[i],

push(value) {
this.incrementLength((0, o1js_1.Field)(1));
this.incrementLength(Field(1));
this.set(this.length.sub(1), value);

@@ -67,3 +65,3 @@ }

for (let i = 0; i < this.maxLength(); i++) {
this.values[i] = o1js_1.Provable.switch([mask[i], mask[i].not()], type, [
this.values[i] = Provable.switch([mask[i], mask[i].not()], type, [
this.values[i],

@@ -77,6 +75,6 @@ Null(),

newArr.shiftRight(this.length);
let masked = (0, o1js_1.Bool)(true);
let masked = Bool(true);
for (let i = 0; i < this.maxLength(); i++) {
masked = o1js_1.Provable.if((0, o1js_1.Field)(i).equals(this.length), (0, o1js_1.Bool)(false), masked);
newArr.values[i] = o1js_1.Provable.if(masked, this.values[i], newArr.values[i]);
masked = Provable.if(Field(i).equals(this.length), Bool(false), masked);
newArr.values[i] = Provable.if(masked, this.values[i], newArr.values[i]);
}

@@ -98,6 +96,6 @@ return newArr;

insert(index, value) {
const arr1 = this.slice((0, o1js_1.Field)(0), index);
const arr1 = this.slice(Field(0), index);
const arr2 = this.slice(index, this.length);
arr2.shiftRight((0, o1js_1.Field)(1));
arr2.set((0, o1js_1.Field)(0), value);
arr2.shiftRight(Field(1));
arr2.set(Field(0), value);
const concatArr = arr1.concat(arr2);

@@ -108,7 +106,7 @@ this.values = concatArr.values;

includes(value) {
let result = (0, o1js_1.Field)(0);
let result = Field(0);
for (let i = 0; i < this.maxLength(); i++) {
result = result.add(o1js_1.Provable.if(_type.equals(this.values[i], value), (0, o1js_1.Field)(1), (0, o1js_1.Field)(0)));
result = result.add(Provable.if(_type.equals(this.values[i], value), Field(1), Field(0)));
}
return result.equals((0, o1js_1.Field)(0)).not();
return result.equals(Field(0)).not();
}

@@ -128,3 +126,3 @@ assertIncludes(value) {

.concat(nullArray.values.slice(0, i));
mask[i] = (0, o1js_1.Field)(i).equals(n);
mask[i] = Field(i).equals(n);
}

@@ -134,3 +132,3 @@ const result = [];

const possibleFieldsAtI = possibleResults.map((r) => r[i]);
result[i] = o1js_1.Provable.switch(mask, type, possibleFieldsAtI);
result[i] = Provable.switch(mask, type, possibleFieldsAtI);
}

@@ -148,3 +146,3 @@ this.values = result;

.concat(this.values.slice(0, this.maxLength() - i));
mask[i] = (0, o1js_1.Field)(i).equals(nullArray.length);
mask[i] = Field(i).equals(nullArray.length);
}

@@ -154,3 +152,3 @@ const result = [];

const possibleFieldsAtI = possibleResults.map((r) => r[i]);
result[i] = o1js_1.Provable.switch(mask, type, possibleFieldsAtI);
result[i] = Provable.switch(mask, type, possibleFieldsAtI);
}

@@ -160,3 +158,3 @@ this.values = result;

hash() {
return o1js_1.Poseidon.hash(this.values.map((v) => type.toFields(v)).flat());
return Poseidon.hash(this.values.map((v) => type.toFields(v)).flat());
}

@@ -171,6 +169,6 @@ maxLength() {

const mask = [];
let lengthReached = (0, o1js_1.Bool)(false);
let lengthReached = Bool(false);
for (let i = 0; i < this.maxLength(); i++) {
lengthReached = (0, o1js_1.Field)(i).equals(this.length).or(lengthReached);
const isIndex = (0, o1js_1.Field)(i).equals(index);
lengthReached = Field(i).equals(this.length).or(lengthReached);
const isIndex = Field(i).equals(index);
// assert index < length

@@ -185,5 +183,5 @@ isIndex.and(lengthReached).not().assertTrue();

// assert length + n <= maxLength
let lengthLteMaxLength = (0, o1js_1.Bool)(false);
let lengthLteMaxLength = Bool(false);
for (let i = 0; i < this.maxLength() + 1; i++) {
lengthLteMaxLength = lengthLteMaxLength.or((0, o1js_1.Field)(i).equals(newLength));
lengthLteMaxLength = lengthLteMaxLength.or(Field(i).equals(newLength));
}

@@ -196,5 +194,5 @@ lengthLteMaxLength.assertTrue();

// make sure length did not underflow
let newLengthFound = (0, o1js_1.Bool)(false);
let newLengthFound = Bool(false);
for (let i = 0; i < this.maxLength() + 1; i++) {
newLengthFound = newLengthFound.or((0, o1js_1.Field)(i).equals(this.length));
newLengthFound = newLengthFound.or(Field(i).equals(this.length));
}

@@ -205,5 +203,5 @@ newLengthFound.assertTrue();

const mask = [];
let masked = (0, o1js_1.Bool)(true);
let masked = Bool(true);
for (let i = 0; i < this.maxLength(); i++) {
masked = o1js_1.Provable.if((0, o1js_1.Field)(i).equals(n), (0, o1js_1.Bool)(false), masked);
masked = Provable.if(Field(i).equals(n), Bool(false), masked);
mask[i] = masked;

@@ -215,6 +213,6 @@ }

const newArr = this.copy();
let masked = (0, o1js_1.Bool)(true);
let masked = Bool(true);
for (let i = 0; i < newArr.values.length; i++) {
masked = o1js_1.Provable.if((0, o1js_1.Field)(i).equals(newArr.length), (0, o1js_1.Bool)(false), masked);
newArr.values[i] = o1js_1.Provable.if(masked, fn(newArr.values[i], (0, o1js_1.Field)(i)), Null());
masked = Provable.if(Field(i).equals(newArr.length), Bool(false), masked);
newArr.values[i] = Provable.if(masked, fn(newArr.values[i], Field(i)), Null());
}

@@ -231,3 +229,2 @@ return newArr;

}
exports.DynamicArray = DynamicArray;
//# sourceMappingURL=dynamicArray.js.map

@@ -1,9 +0,5 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EncryptedCircuitString = void 0;
const o1js_1 = require("o1js");
const dynamicArray_1 = require("./dynamicArray");
class EncryptedCircuitString extends (0, dynamicArray_1.DynamicArray)(o1js_1.Field, 129) {
import { Field } from 'o1js';
import { DynamicArray } from './dynamicArray';
export class EncryptedCircuitString extends DynamicArray(Field, 129) {
}
exports.EncryptedCircuitString = EncryptedCircuitString;
//# sourceMappingURL=encryptedCircuitString.js.map

@@ -1,8 +0,4 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.IpfsHash = void 0;
const o1js_pack_1 = require("o1js-pack");
class IpfsHash extends (0, o1js_pack_1.MultiPackedStringFactory)(6) {
import { MultiPackedStringFactory } from 'o1js-pack';
export class IpfsHash extends MultiPackedStringFactory(6) {
}
exports.IpfsHash = IpfsHash;
//# sourceMappingURL=ipfsHash.js.map

@@ -1,10 +0,7 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseJSON = void 0;
const o1js_1 = require("o1js");
const dynamicArray_1 = require("./dynamicArray");
function parseJSON(json) {
import { Bool, Character, Circuit, Field } from 'o1js';
import { DynamicArray } from './dynamicArray';
export function parseJSON(json) {
// minify json
json = JSON.stringify(JSON.parse(json));
class JSONParser extends (0, dynamicArray_1.DynamicArray)(o1js_1.Character, json.length) {
class JSONParser extends DynamicArray(Character, json.length) {
static from(values) {

@@ -25,89 +22,89 @@ return new JSONParser(values);

index(at) {
this.get((0, o1js_1.Field)(0)).assertEquals((0, o1js_1.Field)(91));
this.get(this.length.sub(1)).assertEquals((0, o1js_1.Field)(93));
let index = (0, o1js_1.Field)(-1);
let newIndex = (0, o1js_1.Bool)(true);
let depth = (0, o1js_1.Field)(0);
let insideString = (0, o1js_1.Bool)(false);
let start = (0, o1js_1.Field)(0);
let end = (0, o1js_1.Field)(0);
this.get(Field(0)).assertEquals(Field(91));
this.get(this.length.sub(1)).assertEquals(Field(93));
let index = Field(-1);
let newIndex = Bool(true);
let depth = Field(0);
let insideString = Bool(false);
let start = Field(0);
let end = Field(0);
for (let i = 1; i < this.maxLength() - 1; i++) {
const val = this.values[i];
insideString = o1js_1.Circuit.if(val.equals((0, o1js_1.Field)(34)).and(this.values[i - 1].equals((0, o1js_1.Field)(92)).not()), insideString.not(), insideString);
depth = o1js_1.Circuit.if(insideString
insideString = Circuit.if(val.equals(Field(34)).and(this.values[i - 1].equals(Field(92)).not()), insideString.not(), insideString);
depth = Circuit.if(insideString
.not()
.and(val.equals((0, o1js_1.Field)(91)).or(val.equals((0, o1js_1.Field)(123)))), depth.add(1), depth);
depth = o1js_1.Circuit.if(insideString
.and(val.equals(Field(91)).or(val.equals(Field(123)))), depth.add(1), depth);
depth = Circuit.if(insideString
.not()
.and(val.equals((0, o1js_1.Field)(93)).or(val.equals((0, o1js_1.Field)(125)))), depth.sub(1), depth);
.and(val.equals(Field(93)).or(val.equals(Field(125)))), depth.sub(1), depth);
index = index.add(newIndex.toField());
start = o1js_1.Circuit.if(index.equals(at).and(newIndex), start.add(i), start);
end = o1js_1.Circuit.if(index.equals(at.add(1)).and(newIndex), end.add(i).sub((0, o1js_1.Field)(1)), end);
newIndex = val.equals((0, o1js_1.Field)(44)).and(depth.equals((0, o1js_1.Field)(0)));
start = Circuit.if(index.equals(at).and(newIndex), start.add(i), start);
end = Circuit.if(index.equals(at.add(1)).and(newIndex), end.add(i).sub(Field(1)), end);
newIndex = val.equals(Field(44)).and(depth.equals(Field(0)));
}
start
.equals((0, o1js_1.Field)(0))
.and(end.equals((0, o1js_1.Field)(0)))
.equals(Field(0))
.and(end.equals(Field(0)))
.assertFalse('Index out of bounds');
end = o1js_1.Circuit.if(end.equals((0, o1js_1.Field)(0)), this.length.sub(1), end);
end = Circuit.if(end.equals(Field(0)), this.length.sub(1), end);
return this.slice(start, end);
}
key(key) {
this.get((0, o1js_1.Field)(0)).assertEquals((0, o1js_1.Field)(123));
this.get(this.length.sub(1)).assertEquals((0, o1js_1.Field)(125));
const keyHash = (0, dynamicArray_1.DynamicArray)(o1js_1.Character, this.values.length)
.from(key.split('').map((c) => o1js_1.Character.fromString(c)))
this.get(Field(0)).assertEquals(Field(123));
this.get(this.length.sub(1)).assertEquals(Field(125));
const keyHash = DynamicArray(Character, this.values.length)
.from(key.split('').map((c) => Character.fromString(c)))
.hash();
let depth = (0, o1js_1.Field)(0);
let keyFound = (0, o1js_1.Bool)(false);
let insideString = (0, o1js_1.Bool)(false);
let keyStart = (0, o1js_1.Field)(0);
let start = (0, o1js_1.Field)(0);
let end = (0, o1js_1.Field)(0);
let depth = Field(0);
let keyFound = Bool(false);
let insideString = Bool(false);
let keyStart = Field(0);
let start = Field(0);
let end = Field(0);
for (let i = 1; i < this.maxLength() - 1; i++) {
const val = this.values[i];
depth = o1js_1.Circuit.if(insideString.not().and(val
.equals((0, o1js_1.Field)(58))
.and(depth.equals((0, o1js_1.Field)(0)))
.or(val.equals((0, o1js_1.Field)(91)).or(val.equals((0, o1js_1.Field)(123))))), depth.add(1), depth);
depth = o1js_1.Circuit.if(insideString.not().and(val
.equals((0, o1js_1.Field)(44))
.and(depth.equals((0, o1js_1.Field)(1)))
.or(val.equals((0, o1js_1.Field)(93)).or(val.equals((0, o1js_1.Field)(125))))), depth.sub(1), depth);
keyStart = o1js_1.Circuit.if(insideString
.and(depth.equals((0, o1js_1.Field)(0)))
.and(keyStart.equals((0, o1js_1.Field)(0))), (0, o1js_1.Field)(i), keyStart);
const keyEnd = o1js_1.Circuit.if(insideString.and(depth.equals((0, o1js_1.Field)(0))).and(val.equals((0, o1js_1.Field)(34))), (0, o1js_1.Field)(i), (0, o1js_1.Field)(0));
depth = Circuit.if(insideString.not().and(val
.equals(Field(58))
.and(depth.equals(Field(0)))
.or(val.equals(Field(91)).or(val.equals(Field(123))))), depth.add(1), depth);
depth = Circuit.if(insideString.not().and(val
.equals(Field(44))
.and(depth.equals(Field(1)))
.or(val.equals(Field(93)).or(val.equals(Field(125))))), depth.sub(1), depth);
keyStart = Circuit.if(insideString
.and(depth.equals(Field(0)))
.and(keyStart.equals(Field(0))), Field(i), keyStart);
const keyEnd = Circuit.if(insideString.and(depth.equals(Field(0))).and(val.equals(Field(34))), Field(i), Field(0));
const keyIdentified = keyStart
.equals((0, o1js_1.Field)(0))
.or(keyEnd.equals((0, o1js_1.Field)(0)))
.equals(Field(0))
.or(keyEnd.equals(Field(0)))
.not();
keyFound = o1js_1.Circuit.if(keyIdentified, this.slice(keyStart, o1js_1.Circuit.if(keyIdentified.not(), keyStart, keyEnd))
keyFound = Circuit.if(keyIdentified, this.slice(keyStart, Circuit.if(keyIdentified.not(), keyStart, keyEnd))
.hash()
.equals(keyHash), keyFound);
start = o1js_1.Circuit.if(keyFound
.and(val.equals((0, o1js_1.Field)(58)).not())
.and(depth.equals((0, o1js_1.Field)(0)).not())
.and(start.equals((0, o1js_1.Field)(0))), (0, o1js_1.Field)(i), start);
end = o1js_1.Circuit.if(keyFound
.and(depth.equals((0, o1js_1.Field)(0)))
.and(start.equals((0, o1js_1.Field)(0)).not())
.and(end.equals((0, o1js_1.Field)(0))), (0, o1js_1.Field)(i), end);
keyStart = o1js_1.Circuit.if(keyEnd.equals((0, o1js_1.Field)(0)).not(), (0, o1js_1.Field)(0), keyStart);
insideString = o1js_1.Circuit.if(val.equals((0, o1js_1.Field)(34)).and(this.values[i - 1].equals((0, o1js_1.Field)(92)).not()), insideString.not(), insideString);
start = Circuit.if(keyFound
.and(val.equals(Field(58)).not())
.and(depth.equals(Field(0)).not())
.and(start.equals(Field(0))), Field(i), start);
end = Circuit.if(keyFound
.and(depth.equals(Field(0)))
.and(start.equals(Field(0)).not())
.and(end.equals(Field(0))), Field(i), end);
keyStart = Circuit.if(keyEnd.equals(Field(0)).not(), Field(0), keyStart);
insideString = Circuit.if(val.equals(Field(34)).and(this.values[i - 1].equals(Field(92)).not()), insideString.not(), insideString);
}
start
.equals((0, o1js_1.Field)(0))
.and(end.equals((0, o1js_1.Field)(0)))
.equals(Field(0))
.and(end.equals(Field(0)))
.assertFalse(`Key "${key}" not found`);
end = o1js_1.Circuit.if(end.equals((0, o1js_1.Field)(0)), this.length.sub(1), end);
end = Circuit.if(end.equals(Field(0)), this.length.sub(1), end);
return this.slice(start, end);
}
toNumber() {
let result = (0, o1js_1.Field)(0);
let masked = (0, o1js_1.Bool)(true);
let result = Field(0);
let masked = Bool(true);
for (let i = 0; i < this.maxLength(); i++) {
masked = o1js_1.Circuit.if((0, o1js_1.Field)(i).equals(this.length), (0, o1js_1.Bool)(false), masked);
masked = Circuit.if(Field(i).equals(this.length), Bool(false), masked);
const val = toDigit(this.values[i]);
result = o1js_1.Circuit.if(masked, result.add(val.mul(power((0, o1js_1.Field)(10), this.length.sub((0, o1js_1.Field)(i).add(1))))), result);
result = Circuit.if(masked, result.add(val.mul(power(Field(10), this.length.sub(Field(i).add(1))))), result);
}

@@ -117,7 +114,7 @@ return result;

toBoolean() {
const trueAsFields = (0, dynamicArray_1.DynamicArray)(o1js_1.Character, this.values.length)
.from('true'.split('').map((c) => o1js_1.Character.fromString(c)))
const trueAsFields = DynamicArray(Character, this.values.length)
.from('true'.split('').map((c) => Character.fromString(c)))
.hash();
const falseAsFields = (0, dynamicArray_1.DynamicArray)(o1js_1.Character, this.values.length)
.from('false'.split('').map((c) => o1js_1.Character.fromString(c)))
const falseAsFields = DynamicArray(Character, this.values.length)
.from('false'.split('').map((c) => Character.fromString(c)))
.hash();

@@ -131,9 +128,8 @@ this.hash()

assertEqualString(expected) {
const expectedAsFields = (0, dynamicArray_1.DynamicArray)(o1js_1.Character, this.values.length).from(expected.split('').map((c) => o1js_1.Character.fromString(c)));
const expectedAsFields = DynamicArray(Character, this.values.length).from(expected.split('').map((c) => Character.fromString(c)));
this.hash().equals(expectedAsFields.hash()).assertTrue();
}
}
return JSONParser.from(json.split('').map((c) => o1js_1.Character.fromString(c)));
return JSONParser.from(json.split('').map((c) => Character.fromString(c)));
}
exports.parseJSON = parseJSON;
function toDigit(c) {

@@ -146,3 +142,3 @@ const val = c.toField();

// .assertTrue('Not a digit');
return val.sub((0, o1js_1.Field)(48));
return val.sub(Field(48));
}

@@ -152,7 +148,7 @@ function power(base, exp) {

// exp.assertLte(Field(maxPower), 'exceeds max power');
let result = (0, o1js_1.Field)(1);
let masked = (0, o1js_1.Bool)(true);
let result = Field(1);
let masked = Bool(true);
for (let i = 1; i <= maxPower; i++) {
masked = o1js_1.Circuit.if((0, o1js_1.Field)(i).equals(exp), (0, o1js_1.Bool)(false), masked);
result = o1js_1.Circuit.if(masked, result.mul(base), result);
masked = Circuit.if(Field(i).equals(exp), Bool(false), masked);
result = Circuit.if(masked, result.mul(base), result);
}

@@ -159,0 +155,0 @@ return result;

@@ -1,4 +0,1 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Uuidv4 = void 0;
// TODO: update UUIdv4 when CircuitString is made extendable

@@ -9,6 +6,5 @@ // export class Uuidv4 extends CircuitString {

// }
const o1js_pack_1 = require("o1js-pack");
class Uuidv4 extends (0, o1js_pack_1.MultiPackedStringFactory)(2) {
import { MultiPackedStringFactory } from 'o1js-pack';
export class Uuidv4 extends MultiPackedStringFactory(2) {
}
exports.Uuidv4 = Uuidv4;
//# sourceMappingURL=uuidv4.js.map

@@ -1,2 +0,1 @@

"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {

@@ -11,16 +10,14 @@ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;

};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ObservationShare = void 0;
const o1js_1 = require("o1js");
import { Field, SmartContract, state, State, method, PublicKey, MerkleMap, MerkleMapWitness, Poseidon, CircuitString, Signature, Nullifier, Provable, } from 'o1js';
const ORACLE_PUBLIC_KEY = process.env.ORACLE_PUBLIC_KEY || '';
class ObservationShare extends o1js_1.SmartContract {
export class ObservationShare extends SmartContract {
constructor() {
super(...arguments);
this.oraclePublicKey = (0, o1js_1.State)();
this.observationsRootHash = (0, o1js_1.State)();
this.observationCount = (0, o1js_1.State)();
this.observationsShareListRootHash = (0, o1js_1.State)();
this.nullifierRoot = (0, o1js_1.State)();
this.oraclePublicKey = State();
this.observationsRootHash = State();
this.observationCount = State();
this.observationsShareListRootHash = State();
this.nullifierRoot = State();
this.events = {
observationShared: o1js_1.Field,
observationShared: Field,
};

@@ -30,6 +27,6 @@ }

super.init();
let map = new o1js_1.MerkleMap();
let map = new MerkleMap();
this.observationsRootHash.set(map.getRoot());
this.observationCount.set((0, o1js_1.Field)(0));
this.oraclePublicKey.set(o1js_1.PublicKey.fromBase58(ORACLE_PUBLIC_KEY));
this.observationCount.set(Field(0));
this.oraclePublicKey.set(PublicKey.fromBase58(ORACLE_PUBLIC_KEY));
}

@@ -39,4 +36,4 @@ addObservation(observationId, observationCode, observationDateTime, value, valueCode, merkleWitness, signature, nullifier // Added nullifier parameter

let nullifierRoot = this.nullifierRoot.getAndRequireEquals();
let nullifierWitness = o1js_1.Provable.witness(o1js_1.MerkleMapWitness, () => NullifierTree.getWitness(nullifier.key()));
const nullifierMessage = o1js_1.Poseidon.hash([...observationId.toFields()]);
let nullifierWitness = Provable.witness(MerkleMapWitness, () => NullifierTree.getWitness(nullifier.key()));
const nullifierMessage = Poseidon.hash([...observationId.toFields()]);
nullifier.verify([nullifierMessage]);

@@ -48,3 +45,3 @@ nullifier.assertUnused(nullifierWitness, nullifierRoot);

const epoch = this.network.timestamp.get();
const dataHash = o1js_1.Poseidon.hash([
const dataHash = Poseidon.hash([
...observationCode.toFields(),

@@ -71,37 +68,36 @@ value,

__decorate([
(0, o1js_1.state)(o1js_1.PublicKey),
state(PublicKey),
__metadata("design:type", Object)
], ObservationShare.prototype, "oraclePublicKey", void 0);
__decorate([
(0, o1js_1.state)(o1js_1.Field),
state(Field),
__metadata("design:type", Object)
], ObservationShare.prototype, "observationsRootHash", void 0);
__decorate([
(0, o1js_1.state)(o1js_1.Field),
state(Field),
__metadata("design:type", Object)
], ObservationShare.prototype, "observationCount", void 0);
__decorate([
(0, o1js_1.state)(o1js_1.Field),
state(Field),
__metadata("design:type", Object)
], ObservationShare.prototype, "observationsShareListRootHash", void 0);
__decorate([
(0, o1js_1.state)(o1js_1.Field),
state(Field),
__metadata("design:type", Object)
], ObservationShare.prototype, "nullifierRoot", void 0);
__decorate([
o1js_1.method,
method,
__metadata("design:type", Function),
__metadata("design:paramtypes", [o1js_1.CircuitString,
o1js_1.CircuitString,
o1js_1.Field,
o1js_1.Field,
o1js_1.CircuitString,
o1js_1.MerkleMapWitness,
o1js_1.Signature,
o1js_1.Nullifier // Added nullifier parameter
__metadata("design:paramtypes", [CircuitString,
CircuitString,
Field,
Field,
CircuitString,
MerkleMapWitness,
Signature,
Nullifier // Added nullifier parameter
]),
__metadata("design:returntype", void 0)
], ObservationShare.prototype, "addObservation", null);
exports.ObservationShare = ObservationShare;
const NullifierTree = new o1js_1.MerkleMap();
const NullifierTree = new MerkleMap();
//# sourceMappingURL=ObservationShare.js.map

@@ -1,11 +0,6 @@

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const ObservationShare_1 = require("./ObservationShare");
const o1js_1 = require("o1js");
const heartbeat_json_1 = __importDefault(require("../../tests/data/observations/heartbeat.json"));
const globals_1 = require("@jest/globals");
const jsonParser_1 = require("../utils/jsonParser");
import { ObservationShare } from './ObservationShare';
import { Mina, PrivateKey, AccountUpdate, } from 'o1js';
const heartbeat = require('../../tests/data/observations/heartbeat.json');
import { it, describe, beforeAll } from '@jest/globals';
import { linearizeJson, linearDataToMerkleMap } from '../utils/jsonParser';
/*

@@ -18,11 +13,11 @@ * This file specifies how to test the `Add` example smart contract. It is safe to delete this file and replace

let proofsEnabled = false;
(0, globals_1.describe)('ObservationShare', () => {
describe('ObservationShare', () => {
let deployerAccount, deployerKey, senderAccount, senderKey, zkAppAddress, zkAppPrivateKey, zkApp, heartbeatMap;
(0, globals_1.beforeAll)(async () => {
beforeAll(async () => {
if (proofsEnabled)
await ObservationShare_1.ObservationShare.compile();
await ObservationShare.compile();
});
beforeEach(() => {
const Local = o1js_1.Mina.LocalBlockchain({ proofsEnabled });
o1js_1.Mina.setActiveInstance(Local);
const Local = Mina.LocalBlockchain({ proofsEnabled });
Mina.setActiveInstance(Local);
({ privateKey: deployerKey, publicKey: deployerAccount } =

@@ -32,10 +27,10 @@ Local.testAccounts[0]);

Local.testAccounts[1]);
zkAppPrivateKey = o1js_1.PrivateKey.random();
zkAppPrivateKey = PrivateKey.random();
zkAppAddress = zkAppPrivateKey.toPublicKey();
zkApp = new ObservationShare_1.ObservationShare(zkAppAddress);
heartbeatMap = (0, jsonParser_1.linearDataToMerkleMap)((0, jsonParser_1.linearizeJson)(heartbeat_json_1.default));
zkApp = new ObservationShare(zkAppAddress);
heartbeatMap = linearDataToMerkleMap(linearizeJson(heartbeat));
});
async function localDeploy() {
const txn = await o1js_1.Mina.transaction(deployerAccount, () => {
o1js_1.AccountUpdate.fundNewAccount(deployerAccount);
const txn = await Mina.transaction(deployerAccount, () => {
AccountUpdate.fundNewAccount(deployerAccount);
zkApp.deploy();

@@ -46,3 +41,3 @@ });

}
(0, globals_1.it)('generates and deploys the `ObservationShare` smart contract', async () => {
it('generates and deploys the `ObservationShare` smart contract', async () => {
// await localDeploy();

@@ -49,0 +44,0 @@ });

@@ -1,30 +0,9 @@

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.JsonParser = exports.ZkObservation = exports.DocumentReference = exports.Consent = void 0;
var consent_js_1 = require("./resource/consent.js");
Object.defineProperty(exports, "Consent", { enumerable: true, get: function () { return consent_js_1.Consent; } });
var document_js_1 = require("./resource/document.js");
Object.defineProperty(exports, "DocumentReference", { enumerable: true, get: function () { return document_js_1.DocumentReference; } });
var observation_js_1 = require("./resource/observation.js");
Object.defineProperty(exports, "ZkObservation", { enumerable: true, get: function () { return observation_js_1.ZkObservation; } });
__exportStar(require("./types/monitoring.types"), exports);
__exportStar(require("./query/query.js"), exports);
__exportStar(require("./proving/mina.js"), exports);
__exportStar(require("./linearization/ipld.js"), exports);
var jsonParser_js_1 = require("./utils/jsonParser.js");
Object.defineProperty(exports, "JsonParser", { enumerable: true, get: function () { return jsonParser_js_1.JsonParser; } });
export { Consent } from './resource/consent.js';
export { DocumentReference } from './resource/document.js';
export { ZkObservation } from './resource/observation.js';
export * from './types/monitoring.types';
export * from './query/query.js';
export * from './proving/mina.js';
export * from './linearization/ipld.js';
export { JsonParser } from './utils/jsonParser.js';
//# sourceMappingURL=index.js.map

@@ -1,2 +0,1 @@

"use strict";
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {

@@ -14,10 +13,8 @@ if (kind === "m") throw new TypeError("Private method is not writable");

var _a, _b, _c, _d, _e, _f, _g, _h, _j, _LinearModel_map;
Object.defineProperty(exports, "__esModule", { value: true });
exports.LinearModel = exports.toLinearElements = exports.UnsupportedScalarKindError = exports.LinearElement = exports.LinearPath = exports.fromJS = exports.BadInputError = exports.isScalarKind = exports.LinkKind = exports.MapKind = exports.ListKind = exports.BytesKind = exports.StringKind = exports.FloatKind = exports.IntegerKind = exports.BooleanKind = exports.NullKind = void 0;
const unreachable_case_error_js_1 = require("../proving/unreachable-case-error.js");
const custom_inspect_symbol_js_1 = require("../proving/custom-inspect-symbol.js");
import { UnreachableCaseError } from '../proving/unreachable-case-error.js';
import { CUSTOM_INSPECT_SYMBOL } from '../proving/custom-inspect-symbol.js';
/**
* Represents an [IPLD Data Model](https://ipld.io/) `Null`.
*/
class NullKind {
export class NullKind {
constructor() {

@@ -40,8 +37,7 @@ this.tag = 'null-kind';

}
exports.NullKind = NullKind;
_a = custom_inspect_symbol_js_1.CUSTOM_INSPECT_SYMBOL;
_a = CUSTOM_INSPECT_SYMBOL;
/**
* Represents an [IPLD Data Model](https://ipld.io/) `Boolean`.
*/
class BooleanKind {
export class BooleanKind {
constructor(value) {

@@ -64,8 +60,7 @@ this.value = value;

}
exports.BooleanKind = BooleanKind;
_b = custom_inspect_symbol_js_1.CUSTOM_INSPECT_SYMBOL;
_b = CUSTOM_INSPECT_SYMBOL;
/**
* Represents an [IPLD Data Model](https://ipld.io/) `Integer`.
*/
class IntegerKind {
export class IntegerKind {
constructor(value) {

@@ -88,8 +83,7 @@ this.value = value;

}
exports.IntegerKind = IntegerKind;
_c = custom_inspect_symbol_js_1.CUSTOM_INSPECT_SYMBOL;
_c = CUSTOM_INSPECT_SYMBOL;
/**
* Represents an [IPLD Data Model](https://ipld.io/) `Float`.
*/
class FloatKind {
export class FloatKind {
constructor(value) {

@@ -112,8 +106,7 @@ this.value = value;

}
exports.FloatKind = FloatKind;
_d = custom_inspect_symbol_js_1.CUSTOM_INSPECT_SYMBOL;
_d = CUSTOM_INSPECT_SYMBOL;
/**
* Represents an [IPLD Data Model](https://ipld.io/) `String`.
*/
class StringKind {
export class StringKind {
constructor(value) {

@@ -136,4 +129,3 @@ this.value = value;

}
exports.StringKind = StringKind;
_e = custom_inspect_symbol_js_1.CUSTOM_INSPECT_SYMBOL;
_e = CUSTOM_INSPECT_SYMBOL;
/**

@@ -159,3 +151,3 @@ * Converts a number to a two-symbol hexadecimal string representation. Pads with a leading `0` if `n < 16`.

*/
class BytesKind {
export class BytesKind {
constructor(value) {

@@ -178,8 +170,7 @@ this.value = value;

}
exports.BytesKind = BytesKind;
_f = custom_inspect_symbol_js_1.CUSTOM_INSPECT_SYMBOL;
_f = CUSTOM_INSPECT_SYMBOL;
/**
* Represents an [IPLD Data Model](https://ipld.io/) `List`.
*/
class ListKind {
export class ListKind {
constructor(value) {

@@ -202,8 +193,7 @@ this.value = value;

}
exports.ListKind = ListKind;
_g = custom_inspect_symbol_js_1.CUSTOM_INSPECT_SYMBOL;
_g = CUSTOM_INSPECT_SYMBOL;
/**
* Represents an [IPLD Data Model](https://ipld.io/) `Map`.
*/
class MapKind {
export class MapKind {
constructor(value) {

@@ -231,8 +221,7 @@ this.value = value;

}
exports.MapKind = MapKind;
_h = custom_inspect_symbol_js_1.CUSTOM_INSPECT_SYMBOL;
_h = CUSTOM_INSPECT_SYMBOL;
/**
* Represents an [IPLD Data Model](https://ipld.io/) `Link`.
*/
class LinkKind {
export class LinkKind {
constructor(value) {

@@ -255,4 +244,3 @@ this.value = value;

}
exports.LinkKind = LinkKind;
_j = custom_inspect_symbol_js_1.CUSTOM_INSPECT_SYMBOL;
_j = CUSTOM_INSPECT_SYMBOL;
/**

@@ -272,10 +260,9 @@ * Constructors of scalar kinds we support.

*/
function isScalarKind(input) {
export function isScalarKind(input) {
return ScalarKindTags.includes(input.tag);
}
exports.isScalarKind = isScalarKind;
/**
* Represents an error when the provided JS input could not be presented as an [IPLD Data Model](https://ipld.io/) kind.
*/
class BadInputError extends Error {
export class BadInputError extends Error {
constructor(value, kind) {

@@ -285,3 +272,2 @@ super(`Bad input ${value} for kind ${kind}`);

}
exports.BadInputError = BadInputError;
/**

@@ -295,3 +281,3 @@ * Convert a JavaScript thing to an IPLD model kind.

*/
function fromJS(input) {
export function fromJS(input) {
const t = typeof input;

@@ -343,6 +329,5 @@ switch (t) {

default:
throw new unreachable_case_error_js_1.UnreachableCaseError(t, 'Unknown IPLD model kind');
throw new UnreachableCaseError(t, 'Unknown IPLD model kind');
}
}
exports.fromJS = fromJS;
/**

@@ -352,6 +337,5 @@ * Marks `input` string as `LinearPath`.

*/
function LinearPath(input) {
export function LinearPath(input) {
return input;
}
exports.LinearPath = LinearPath;
// Slashes are not allowed in name

@@ -379,3 +363,3 @@ // TODO escape internal slashes (except leading one) and '0

*/
class LinearElement {
export class LinearElement {
constructor(path, value) {

@@ -386,7 +370,6 @@ this.path = path;

}
exports.LinearElement = LinearElement;
/**
* Represents an error that is thrown when an unsupported scalar kind is encountered during linearization.
*/
class UnsupportedScalarKindError extends Error {
export class UnsupportedScalarKindError extends Error {
constructor(kind) {

@@ -396,3 +379,2 @@ super(`Scalar kind ${kind} is not supported for linearization`);

}
exports.UnsupportedScalarKindError = UnsupportedScalarKindError;
/**

@@ -407,3 +389,3 @@ * Converts an IPLD structure to an array of linear elements.

*/
function toLinearElements(ipld, parent = '') {
export function toLinearElements(ipld, parent = '') {
const tag = ipld.tag;

@@ -429,10 +411,9 @@ switch (tag) {

default:
throw new unreachable_case_error_js_1.UnreachableCaseError(tag);
throw new UnreachableCaseError(tag);
}
}
exports.toLinearElements = toLinearElements;
/**
* Linearized version of an IPLD document.
*/
class LinearModel {
export class LinearModel {
constructor(map) {

@@ -479,4 +460,3 @@ _LinearModel_map.set(this, void 0);

}
exports.LinearModel = LinearModel;
_LinearModel_map = new WeakMap();
//# sourceMappingURL=ipld.js.map

@@ -1,2 +0,1 @@

"use strict";
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {

@@ -14,7 +13,5 @@ if (kind === "m") throw new TypeError("Private method is not writable");

var _MerkleMap_inner, _MerkleMap_tree;
Object.defineProperty(exports, "__esModule", { value: true });
exports.MerkleMapFactory = exports.MerkleMap = void 0;
const ipld_js_1 = require("../linearization/ipld.js");
const merkle_tree_js_1 = require("./merkle-tree.js");
class MerkleMap {
import { StringKind } from '../linearization/ipld.js';
import { MerkleTreeFactory } from './merkle-tree.js';
export class MerkleMap {
constructor(inner, tree) {

@@ -61,8 +58,7 @@ this.tree = tree;

}
exports.MerkleMap = MerkleMap;
_MerkleMap_inner = new WeakMap(), _MerkleMap_tree = new WeakMap();
class MerkleMapFactory {
export class MerkleMapFactory {
constructor(hashFn, zero, mergeFn) {
this.hashFn = hashFn;
this.merkleTreeFactory = new merkle_tree_js_1.MerkleTreeFactory(zero, mergeFn);
this.merkleTreeFactory = new MerkleTreeFactory(zero, mergeFn);
}

@@ -74,3 +70,3 @@ fromLinearModel(linearModel) {

for (const [path, scalar] of linearModel.entries()) {
const labelDigest = this.hashFn(new ipld_js_1.StringKind(path));
const labelDigest = this.hashFn(new StringKind(path));
const digest = this.hashFn(scalar);

@@ -91,3 +87,2 @@ leaves.push(labelDigest);

}
exports.MerkleMapFactory = MerkleMapFactory;
//# sourceMappingURL=merkle-map.js.map

@@ -1,8 +0,5 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MerkleTreeFactory = exports.Zeroes = exports.MerkleTree = void 0;
/**
* Represents a mutable Merkle tree data structure.
*/
class MerkleTree {
export class MerkleTree {
constructor(height, zeroes, mergeFn, nodes = {}) {

@@ -74,3 +71,4 @@ this.height = height;

setNode(level, index, value) {
(this.nodes[level] ??= {})[index.toString()] = value;
var _a;
((_a = this.nodes)[level] ?? (_a[level] = {}))[index.toString()] = value;
}

@@ -103,3 +101,2 @@ /**

}
exports.MerkleTree = MerkleTree;
/**

@@ -109,3 +106,3 @@ * Represents a class that caches zero values at different levels of a Merkle tree.

*/
class Zeroes {
export class Zeroes {
/**

@@ -135,7 +132,6 @@ * @param zero - The initial value of "zero" in a Merkle tree.

}
exports.Zeroes = Zeroes;
/**
* A factory class for creating Merkle Trees.
*/
class MerkleTreeFactory {
export class MerkleTreeFactory {
/**

@@ -175,3 +171,2 @@ * Constructor for creating an instance of the class.

}
exports.MerkleTreeFactory = MerkleTreeFactory;
//# sourceMappingURL=merkle-tree.js.map

@@ -1,8 +0,5 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BitSet = void 0;
/**
* Represents a bit set, which is a collection of bits that can be individually set or queried.
*/
class BitSet {
export class BitSet {
/**

@@ -53,3 +50,2 @@ * Creates a new instance of the BitSet class.

}
exports.BitSet = BitSet;
//# sourceMappingURL=bit-set.js.map

@@ -1,4 +0,1 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CUSTOM_INSPECT_SYMBOL = void 0;
/**

@@ -11,3 +8,3 @@ * Symbol used to customize the inspection behavior of an object.

*/
exports.CUSTOM_INSPECT_SYMBOL = Symbol.for('nodejs.util.inspect.custom');
export const CUSTOM_INSPECT_SYMBOL = Symbol.for('nodejs.util.inspect.custom');
//# sourceMappingURL=custom-inspect-symbol.js.map

@@ -1,9 +0,6 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Backend = exports.BackendFactory = exports.PublicInput = exports.WitnessValueClass = exports.MINA_MERKLE_MAP_FACTORY = void 0;
const o1js_1 = require("o1js");
const bit_set_js_1 = require("./bit-set.js");
const tuple_js_1 = require("./tuple.js");
const merkle_map_js_1 = require("../merkle/merkle-map.js");
const unreachable_case_error_js_1 = require("./unreachable-case-error.js");
import { Bool, Encoding, Field, Poseidon, Provable, SelfProof, Struct, ZkProgram, } from 'o1js';
import { BitSet } from './bit-set.js';
import { Tuple } from './tuple.js';
import { MerkleMapFactory, } from '../merkle/merkle-map.js';
import { UnreachableCaseError } from './unreachable-case-error.js';
/**

@@ -20,11 +17,11 @@ * Calculate the Poseidon hash for the given IPLD scalar.

case 'string-kind':
return o1js_1.Poseidon.hash(o1js_1.Encoding.stringToFields(input.value));
return Poseidon.hash(Encoding.stringToFields(input.value));
case 'null-kind':
return (0, o1js_1.Field)(1);
return Field(1);
case 'integer-kind':
return o1js_1.Field.from(input.value);
return Field.from(input.value);
case 'boolean-kind':
return input.value ? (0, o1js_1.Field)(2) : (0, o1js_1.Field)(1);
return input.value ? Field(2) : Field(1);
default:
throw new unreachable_case_error_js_1.UnreachableCaseError(tag);
throw new UnreachableCaseError(tag);
}

@@ -40,8 +37,8 @@ }

function poseidonMergeFn(left, right) {
return o1js_1.Poseidon.hash([left, right]);
return Poseidon.hash([left, right]);
}
exports.MINA_MERKLE_MAP_FACTORY = new merkle_map_js_1.MerkleMapFactory(poseidonScalarHash, (0, o1js_1.Field)(0), poseidonMergeFn);
class BitSetValue extends (0, o1js_1.Struct)({ field: o1js_1.Field }) {
export const MINA_MERKLE_MAP_FACTORY = new MerkleMapFactory(poseidonScalarHash, Field(0), poseidonMergeFn);
class BitSetValue extends Struct({ field: Field }) {
static fromBitSet(bitset) {
return new BitSetValue({ field: (0, o1js_1.Field)(bitset.toBigInt()) });
return new BitSetValue({ field: Field(bitset.toBigInt()) });
}

@@ -52,6 +49,6 @@ }

*/
function WitnessValueClass(n) {
class Witness_N extends (0, o1js_1.Struct)({
export function WitnessValueClass(n) {
class Witness_N extends Struct({
isLefts: BitSetValue,
siblings: (0, tuple_js_1.Tuple)(o1js_1.Field, n),
siblings: Tuple(Field, n),
}) {

@@ -64,5 +61,5 @@ root(value) {

const sibling = this.siblings[index];
const left = o1js_1.Provable.if(isLeft, hash, sibling);
const right = o1js_1.Provable.if(isLeft, sibling, hash);
hash = o1js_1.Poseidon.hash([left, right]);
const left = Provable.if(isLeft, hash, sibling);
const right = Provable.if(isLeft, sibling, hash);
hash = Poseidon.hash([left, right]);
}

@@ -75,7 +72,6 @@ return hash;

}
exports.WitnessValueClass = WitnessValueClass;
function fromMerkleMap(WitnessValueClass, input) {
if (input.length !== WitnessValueClass.witnessLength)
throw new Error(`Incompatible witness length`);
let isLefts = bit_set_js_1.BitSet.empty();
let isLefts = BitSet.empty();
const siblings = [];

@@ -91,13 +87,12 @@ for (const [index, witnessElement] of input.entries()) {

}
class PublicInput extends (0, o1js_1.Struct)({ root: o1js_1.Field, given: o1js_1.Field }) {
export class PublicInput extends Struct({ root: Field, given: Field }) {
static empty() {
return new PublicInput({ root: (0, o1js_1.Field)(0), given: (0, o1js_1.Field)(0) });
return new PublicInput({ root: Field(0), given: Field(0) });
}
}
exports.PublicInput = PublicInput;
function QueryProgram(witnessLength) {
return (0, o1js_1.ZkProgram)({
return ZkProgram({
name: `query-${witnessLength}`,
publicInput: PublicInput,
publicOutput: o1js_1.Bool,
publicOutput: Bool,
methods: {

@@ -117,3 +112,3 @@ eq: {

gt: {
privateInputs: [WitnessValueClass(witnessLength), o1js_1.Field],
privateInputs: [WitnessValueClass(witnessLength), Field],
method(input, witness, actual) {

@@ -126,3 +121,3 @@ return actual

lt: {
privateInputs: [WitnessValueClass(witnessLength), o1js_1.Field],
privateInputs: [WitnessValueClass(witnessLength), Field],
method(input, witness, actual) {

@@ -135,3 +130,3 @@ return actual

ge: {
privateInputs: [WitnessValueClass(witnessLength), o1js_1.Field],
privateInputs: [WitnessValueClass(witnessLength), Field],
method(input, witness, actual) {

@@ -144,3 +139,3 @@ return actual

le: {
privateInputs: [WitnessValueClass(witnessLength), o1js_1.Field],
privateInputs: [WitnessValueClass(witnessLength), Field],
method(input, witness, actual) {

@@ -156,4 +151,4 @@ return actual

privateInputs: [
(o1js_1.SelfProof),
(o1js_1.SelfProof),
(SelfProof),
(SelfProof),
],

@@ -169,4 +164,4 @@ method(_, a, b) {

privateInputs: [
(o1js_1.SelfProof),
(o1js_1.SelfProof),
(SelfProof),
(SelfProof),
],

@@ -181,3 +176,3 @@ method(_, a, b) {

},
compile: (options) => Promise.resolve({ verificationKey: { data: '', hash: new o1js_1.Field(0n) } }),
compile: (options) => Promise.resolve({ verificationKey: { data: '', hash: new Field(0n) } }),
verify: (proof) => Promise.resolve(true),

@@ -198,3 +193,3 @@ rawMethods: {},

}
class BackendFactory {
export class BackendFactory {
constructor() {

@@ -215,4 +210,3 @@ this.backendCache = new BackendCache();

}
exports.BackendFactory = BackendFactory;
class Backend {
export class Backend {
constructor(program, WitnessClass, verificationKey) {

@@ -237,3 +231,3 @@ this.program = program;

const b = await this.execute(map, query.b);
return this.program.and(new PublicInput({ root: map.root, given: (0, o1js_1.Field)(0) }), a, b);
return this.program.and(new PublicInput({ root: map.root, given: Field(0) }), a, b);
}

@@ -243,6 +237,6 @@ case '$or': {

const b = await this.execute(map, query.b);
return this.program.or(new PublicInput({ root: map.root, given: (0, o1js_1.Field)(0) }), a, b);
return this.program.or(new PublicInput({ root: map.root, given: Field(0) }), a, b);
}
default:
throw new unreachable_case_error_js_1.UnreachableCaseError(tag);
throw new UnreachableCaseError(tag);
}

@@ -280,3 +274,3 @@ }

default:
throw new unreachable_case_error_js_1.UnreachableCaseError(tag);
throw new UnreachableCaseError(tag);
}

@@ -288,3 +282,2 @@ }

}
exports.Backend = Backend;
//# sourceMappingURL=mina.js.map

@@ -1,4 +0,1 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Tuple = void 0;
/**

@@ -12,3 +9,3 @@ * Creates a tuple with the specified element repeated `n` times.

*/
function Tuple(element, n) {
export function Tuple(element, n) {
if (n < 1)

@@ -18,3 +15,2 @@ throw new RangeError(`Expect at least one element`);

}
exports.Tuple = Tuple;
//# sourceMappingURL=tuple.js.map

@@ -1,8 +0,5 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.UnreachableCaseError = void 0;
/**
* Error class for cases that should be unreachable. Used for exhaustiveness check.
*/
class UnreachableCaseError extends Error {
export class UnreachableCaseError extends Error {
constructor(value, message) {

@@ -14,3 +11,2 @@ super(message

}
exports.UnreachableCaseError = UnreachableCaseError;
//# sourceMappingURL=unreachable-case-error.js.map

@@ -1,32 +0,6 @@

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.parse = exports.OrGateGroup = exports.OrGate = exports.AndGateGroup = exports.AndGate = void 0;
const ipld_js_1 = require("../linearization/ipld.js");
const unreachable_case_error_js_1 = require("../proving/unreachable-case-error.js");
const IPLD = __importStar(require("../linearization/ipld.js"));
const custom_inspect_symbol_js_1 = require("../proving/custom-inspect-symbol.js");
class AndGate {
import { LinearPath } from '../linearization/ipld.js';
import { UnreachableCaseError } from '../proving/unreachable-case-error.js';
import * as IPLD from '../linearization/ipld.js';
import { CUSTOM_INSPECT_SYMBOL } from '../proving/custom-inspect-symbol.js';
export class AndGate {
constructor(a, b) {

@@ -37,9 +11,8 @@ this.a = a;

}
[custom_inspect_symbol_js_1.CUSTOM_INSPECT_SYMBOL](_depth, _inspectOptions, inspect) {
[CUSTOM_INSPECT_SYMBOL](_depth, _inspectOptions, inspect) {
return `$and(${inspect(this.a)}, ${inspect(this.b)})`;
}
}
exports.AndGate = AndGate;
AndGate.tag = '$and';
class AndGateGroup {
export class AndGateGroup {
constructor(conditions) {

@@ -50,3 +23,3 @@ this.conditions = conditions;

const conditions = Object.entries(query).map(([path, conditionQuery]) => {
const linearPath = (0, ipld_js_1.LinearPath)(path);
const linearPath = LinearPath(path);
for (const Condition of Conditions) {

@@ -75,4 +48,3 @@ const condition = Condition.parse(linearPath, conditionQuery);

}
exports.AndGateGroup = AndGateGroup;
class OrGate {
export class OrGate {
constructor(a, b) {

@@ -83,9 +55,8 @@ this.a = a;

}
[custom_inspect_symbol_js_1.CUSTOM_INSPECT_SYMBOL](_depth, _inspectOptions, inspect) {
[CUSTOM_INSPECT_SYMBOL](_depth, _inspectOptions, inspect) {
return `$or(${inspect(this.a)}, ${inspect(this.b)})`;
}
}
exports.OrGate = OrGate;
OrGate.tag = '$or';
class OrGateGroup {
export class OrGateGroup {
constructor(queries) {

@@ -118,3 +89,2 @@ this.queries = queries;

}
exports.OrGateGroup = OrGateGroup;
function Condition1(tag) {

@@ -139,3 +109,3 @@ var _a;

}
[custom_inspect_symbol_js_1.CUSTOM_INSPECT_SYMBOL](_depth, _inspectOptions, inspect) {
[CUSTOM_INSPECT_SYMBOL](_depth, _inspectOptions, inspect) {
return `${tag}(${inspect(this.path)}, ${inspect(this.expected)})`;

@@ -171,3 +141,3 @@ }

// array = or
function parse(input) {
export function parse(input) {
const t = typeof input;

@@ -192,6 +162,5 @@ switch (t) {

default:
throw new unreachable_case_error_js_1.UnreachableCaseError(t);
throw new UnreachableCaseError(t);
}
}
exports.parse = parse;
//# sourceMappingURL=query.js.map

@@ -1,10 +0,4 @@

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Consent = exports.ConsentSignerKind = void 0;
const assert_1 = __importDefault(require("assert"));
const o1js_1 = require("o1js");
const ipfsHash_1 = require("../customTypes/ipfsHash");
import assert from 'assert';
import { Struct, Field, CircuitString, PublicKey, Signature, PrivateKey, } from 'o1js';
import { IpfsHash } from '../customTypes/ipfsHash';
// export enum ConsentStatusKind {

@@ -19,3 +13,3 @@ // _draft = 0,

// https://www.hl7.org/fhir/consent-definitions.html#Consent
var ConsentSignerKind;
export var ConsentSignerKind;
(function (ConsentSignerKind) {

@@ -25,13 +19,13 @@ ConsentSignerKind[ConsentSignerKind["_unknown"] = 0] = "_unknown";

ConsentSignerKind[ConsentSignerKind["_controller"] = 2] = "_controller";
})(ConsentSignerKind = exports.ConsentSignerKind || (exports.ConsentSignerKind = {}));
})(ConsentSignerKind || (ConsentSignerKind = {}));
// https://www.hl7.org/fhir/consent.html
//Consent management - particularly privacy consent - is complicated by the fact that consent to share is often itself necessary to protect. The need to protect the privacy of the privacy statement itself competes with the execution of the consent statement. For this reason, it is common to deal with 'consent statements' that are only partial representations of the full consent statement that the patient provided.
class Consent extends (0, o1js_1.Struct)({
resourceType: o1js_1.CircuitString,
sourceReference: ipfsHash_1.IpfsHash,
export class Consent extends Struct({
resourceType: CircuitString,
sourceReference: IpfsHash,
//The entity responsible for granting the rights listed in a Consent Directive.
grantor: o1js_1.PublicKey,
grantor: PublicKey,
//The actor that controls/enforces the access according to the consent. Type Reference(HealthcareService | Organization | Patient | Practitioner)
controller: o1js_1.PublicKey,
dateTime: o1js_1.Field,
controller: PublicKey,
dateTime: Field,
// dateTime: Field,

@@ -47,16 +41,16 @@ // cosigner: PublicKey,

super(initArgs);
this.grantorSignature = o1js_1.Signature.create(o1js_1.PrivateKey.random(), [
(0, o1js_1.Field)(0),
this.grantorSignature = Signature.create(PrivateKey.random(), [
Field(0),
]);
this.controllerSignature = (0, o1js_1.Field)(0);
this.controllerSignature = Field(0);
}
//initiated w/ empty signer
static async init(sourceReference, grantor, controller) {
const date = (0, o1js_1.Field)(Date.now());
const date = Field(Date.now());
if (!controller) {
controller = o1js_1.PublicKey.empty();
controller = PublicKey.empty();
}
return new Consent({
resourceType: o1js_1.CircuitString.fromString('Consent'),
sourceReference: ipfsHash_1.IpfsHash.fromString(sourceReference),
resourceType: CircuitString.fromString('Consent'),
sourceReference: IpfsHash.fromString(sourceReference),
grantor: grantor,

@@ -69,12 +63,11 @@ controller: controller,

if (signerKind === ConsentSignerKind._grantor) {
(0, assert_1.default)(this.grantor.toBase58() === pvk.toPublicKey().toBase58());
this.grantorSignature = o1js_1.Signature.create(pvk, this.sourceReference.toFields());
assert(this.grantor.toBase58() === pvk.toPublicKey().toBase58());
this.grantorSignature = Signature.create(pvk, this.sourceReference.toFields());
}
if (signerKind === ConsentSignerKind._controller) {
(0, assert_1.default)(this.controller.toBase58() === pvk.toPublicKey().toBase58());
this.controllerSignature = o1js_1.Signature.create(pvk, this.sourceReference.toFields());
assert(this.controller.toBase58() === pvk.toPublicKey().toBase58());
this.controllerSignature = Signature.create(pvk, this.sourceReference.toFields());
}
}
}
exports.Consent = Consent;
//# sourceMappingURL=consent.js.map

@@ -1,17 +0,11 @@

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.DocumentReference = void 0;
//https://www.hl7.org/fhir/documentreference.html
const o1js_1 = require("o1js");
const fs_1 = __importDefault(require("fs"));
const crypto_1 = __importDefault(require("crypto"));
const bs58_1 = __importDefault(require("bs58"));
const ipfsHash_1 = require("../customTypes/ipfsHash");
class DocumentReference extends (0, o1js_1.Struct)({
resourceType: o1js_1.CircuitString,
identifier: ipfsHash_1.IpfsHash,
id: o1js_1.Field,
import { Struct, Field, CircuitString, Encryption, } from 'o1js';
import fs from 'fs';
import crypto from 'crypto';
import bs58 from 'bs58';
import { IpfsHash } from '../customTypes/ipfsHash';
export class DocumentReference extends Struct({
resourceType: CircuitString,
identifier: IpfsHash,
id: Field,
}) {

@@ -22,9 +16,9 @@ constructor(initArgs) {

static async init(filePath, fileType) {
const data = await fs_1.default.promises.readFile(filePath);
const hash = crypto_1.default.createHash('sha256').update(data).digest();
const encodedHash = bs58_1.default.encode(hash);
const data = await fs.promises.readFile(filePath);
const hash = crypto.createHash('sha256').update(data).digest();
const encodedHash = bs58.encode(hash);
return new DocumentReference({
resourceType: o1js_1.CircuitString.fromString('DocumentReference'),
identifier: ipfsHash_1.IpfsHash.fromString(encodedHash),
id: o1js_1.Field.random(),
resourceType: CircuitString.fromString('DocumentReference'),
identifier: IpfsHash.fromString(encodedHash),
id: Field.random(),
});

@@ -34,9 +28,9 @@ }

return new DocumentReference({
resourceType: o1js_1.CircuitString.fromString('DocumentReference'),
identifier: ipfsHash_1.IpfsHash.fromString(this._decryptIdentifier(privateKey, encryptedIdentifier)),
id: o1js_1.Field.random(),
resourceType: CircuitString.fromString('DocumentReference'),
identifier: IpfsHash.fromString(this._decryptIdentifier(privateKey, encryptedIdentifier)),
id: Field.random(),
});
}
encryptIdentifier(publicKey) {
this.encryptedIdentifier = o1js_1.Encryption.encrypt(this.identifier.toFields(), publicKey);
this.encryptedIdentifier = Encryption.encrypt(this.identifier.toFields(), publicKey);
}

@@ -47,9 +41,8 @@ decryptIdentifier(privateKey) {

static _decryptIdentifier(privateKey, encryptedIdentifier) {
const decryptedIdentifier = o1js_1.Encryption.decrypt(encryptedIdentifier, privateKey);
const decryptedIdentifier = Encryption.decrypt(encryptedIdentifier, privateKey);
console.log('decryptedIdentifier', decryptedIdentifier);
const circuitString = ipfsHash_1.IpfsHash.fromFields(decryptedIdentifier);
const circuitString = IpfsHash.fromFields(decryptedIdentifier);
return circuitString.toString();
}
}
exports.DocumentReference = DocumentReference;
//# sourceMappingURL=document.js.map

@@ -1,20 +0,16 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ZkObservation = exports.ZkQuantity = void 0;
const o1js_1 = require("o1js");
import { Struct, Field, CircuitString, Encryption, Character, } from 'o1js';
//TODO: implement nested struct
class ZkQuantity extends (0, o1js_1.Struct)({}) {
export class ZkQuantity extends Struct({}) {
}
exports.ZkQuantity = ZkQuantity;
class ZkObservation extends (0, o1js_1.Struct)({
resourceType: o1js_1.CircuitString,
identifier: o1js_1.CircuitString,
code: o1js_1.CircuitString,
status: o1js_1.CircuitString,
subject: o1js_1.CircuitString,
export class ZkObservation extends Struct({
resourceType: CircuitString,
identifier: CircuitString,
code: CircuitString,
status: CircuitString,
subject: CircuitString,
//NOTE: nested struct creates issues w/ typescript. work later on fixing this to allow nesting
valueQuantityCode: o1js_1.CircuitString,
valueQuantityValue: o1js_1.CircuitString,
effectiveDateTime: o1js_1.Field,
patientId: o1js_1.Field,
valueQuantityCode: CircuitString,
valueQuantityValue: CircuitString,
effectiveDateTime: Field,
patientId: Field,
}) {

@@ -26,13 +22,13 @@ constructor(initArgs) {

// Extract and process FHIR Observation data
const resourceType = o1js_1.CircuitString.fromString('Observation');
const resourceType = CircuitString.fromString('Observation');
//we assume that the identifier is a uuidv4
const identifier = o1js_1.CircuitString.fromString(rawData.identifier?.toString() || '');
const code = o1js_1.CircuitString.fromString(rawData.code?.coding?.[0].code?.toString() || '');
const status = o1js_1.CircuitString.fromString(rawData.status || '');
const subject = o1js_1.CircuitString.fromString(rawData.subject?.reference || '');
const valueQuantityValue = o1js_1.CircuitString.fromString(rawData.valueQuantity?.value?.toString() || '');
const valueQuantityCode = o1js_1.CircuitString.fromString(rawData.valueQuantity?.code?.toString() || '');
const identifier = CircuitString.fromString(rawData.identifier?.toString() || '');
const code = CircuitString.fromString(rawData.code?.coding?.[0].code?.toString() || '');
const status = CircuitString.fromString(rawData.status || '');
const subject = CircuitString.fromString(rawData.subject?.reference || '');
const valueQuantityValue = CircuitString.fromString(rawData.valueQuantity?.value?.toString() || '');
const valueQuantityCode = CircuitString.fromString(rawData.valueQuantity?.code?.toString() || '');
const patientIdString = rawData.subject?.reference?.split('/')[1] || '';
const patientId = (0, o1js_1.Field)(parseInt(patientIdString));
const effectiveDateTime = (0, o1js_1.Field)(Date.parse(rawData.effectiveDateTime || ''));
const patientId = Field(parseInt(patientIdString));
const effectiveDateTime = Field(Date.parse(rawData.effectiveDateTime || ''));
return new ZkObservation({

@@ -52,4 +48,4 @@ resourceType,

encryptSensitiveValues(publicKey) {
this.encryptedValue = o1js_1.Encryption.encrypt(this.valueQuantityValue.toFields(), publicKey);
this.encryptedSubject = o1js_1.Encryption.encrypt(this.subject.toFields(), publicKey);
this.encryptedValue = Encryption.encrypt(this.valueQuantityValue.toFields(), publicKey);
this.encryptedSubject = Encryption.encrypt(this.subject.toFields(), publicKey);
}

@@ -64,9 +60,9 @@ // Decrypt sensitive values

static _decryptValue(privateKey, encryptedValue) {
const decryptedValue = o1js_1.Encryption.decrypt(encryptedValue, privateKey);
const characters = decryptedValue.map((field) => o1js_1.Character.fromFields([field]));
return o1js_1.CircuitString.fromCharacters(characters);
const decryptedValue = Encryption.decrypt(encryptedValue, privateKey);
const characters = decryptedValue.map((field) => Character.fromFields([field]));
return CircuitString.fromCharacters(characters);
}
reencryptAndSign(privateKey, publicKey) {
const decryptedValue = ZkObservation._decryptValue(privateKey, this.encryptedValue);
const reencryptedValue = o1js_1.Encryption.encrypt(decryptedValue.toFields(), publicKey);
const reencryptedValue = Encryption.encrypt(decryptedValue.toFields(), publicKey);
//TODO: sign reencrypted value with private key

@@ -76,3 +72,2 @@ return reencryptedValue;

}
exports.ZkObservation = ZkObservation;
// Usage example:

@@ -79,0 +74,0 @@ // const zkObservation = await ZkObservation.init(observationData);

@@ -1,3 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
export {};
//# sourceMappingURL=monitoring.types.js.map

@@ -1,10 +0,6 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.JsonParser = exports.linearDataToMerkleMap = exports.linearizeJson = exports.TextInput = void 0;
const o1js_1 = require("o1js");
const o1js_pack_1 = require("o1js-pack");
class TextInput extends (0, o1js_pack_1.PackedStringFactory)() {
import { MerkleMap, Field } from 'o1js';
import { PackedStringFactory } from 'o1js-pack';
export class TextInput extends PackedStringFactory() {
}
exports.TextInput = TextInput;
function linearizeJson(jsonObject, parentKey = '') {
export function linearizeJson(jsonObject, parentKey = '') {
let kvPairs = {};

@@ -24,5 +20,4 @@ for (const key in jsonObject) {

}
exports.linearizeJson = linearizeJson;
function linearDataToMerkleMap(linearData) {
const merkleMap = new o1js_1.MerkleMap();
export function linearDataToMerkleMap(linearData) {
const merkleMap = new MerkleMap();
let value;

@@ -37,6 +32,6 @@ for (const [path, value] of Object.entries(linearData)) {

else if (typeof value === 'number') {
fieldValue = (0, o1js_1.Field)(value);
fieldValue = Field(value);
}
else {
fieldValue = (0, o1js_1.Field)(0);
fieldValue = Field(0);
}

@@ -49,4 +44,3 @@ //TODO: handle integers and booleans

}
exports.linearDataToMerkleMap = linearDataToMerkleMap;
class JsonParser {
export class JsonParser {
static countKeys(obj) {

@@ -65,3 +59,3 @@ let count = 0;

static linearDataToMerkleMap(linearData) {
const merkleMap = new o1js_1.MerkleMap();
const merkleMap = new MerkleMap();
let value;

@@ -76,6 +70,6 @@ for (const [path, value] of Object.entries(linearData)) {

else if (typeof value === 'number') {
fieldValue = (0, o1js_1.Field)(value);
fieldValue = Field(value);
}
else {
fieldValue = (0, o1js_1.Field)(0);
fieldValue = Field(0);
}

@@ -104,3 +98,2 @@ //TODO: handle integers and booleans

}
exports.JsonParser = JsonParser;
//# sourceMappingURL=jsonParser.js.map

@@ -1,7 +0,5 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const consent_1 = require("../src/resource/consent");
import { Consent, ConsentSignerKind } from '../src/resource/consent';
//import type { ConsentSignerKind } from '../src/resource/consent';
const document_1 = require("../src/resource/document");
const o1js_1 = require("o1js");
import { DocumentReference } from '../src/resource/document';
import { PrivateKey, Signature } from 'o1js';
describe('Lib Testing', () => {

@@ -11,16 +9,16 @@ let grantorAccount;

beforeAll(async () => {
grantorAccount = o1js_1.PrivateKey.random();
controllerAccount = o1js_1.PrivateKey.random();
grantorAccount = PrivateKey.random();
controllerAccount = PrivateKey.random();
//if (proofsEnabled) await SegmentVerifier.compile();
});
it('creates DocumentReference and a consent without a controller', async () => {
const doc = await document_1.DocumentReference.init('tests/data/sampleagreement.json', 'json');
const doc = await DocumentReference.init('tests/data/sampleagreement.json', 'json');
const docCid = doc.identifier.toString();
const consentMetadata = await document_1.DocumentReference.init('tests/data/samplemetadata.json', 'json');
const consentMetadata = await DocumentReference.init('tests/data/samplemetadata.json', 'json');
//
const consent = await consent_1.Consent.init(docCid, grantorAccount.toPublicKey(), controllerAccount.toPublicKey());
consent.sign(grantorAccount, consent_1.ConsentSignerKind._grantor);
const consent = await Consent.init(docCid, grantorAccount.toPublicKey(), controllerAccount.toPublicKey());
consent.sign(grantorAccount, ConsentSignerKind._grantor);
const grantorSignature = consent.grantorSignature;
let verification = false;
if (grantorSignature instanceof o1js_1.Signature) {
if (grantorSignature instanceof Signature) {
const verificationResult = grantorSignature.verify(grantorAccount.toPublicKey(), consent.sourceReference.toFields());

@@ -27,0 +25,0 @@ verification = verificationResult.toBoolean();

@@ -1,5 +0,3 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const document_1 = require("../src/resource/document");
const o1js_1 = require("o1js");
import { DocumentReference } from '../src/resource/document';
import { PrivateKey, } from 'o1js';
describe('Lib Testing', () => {

@@ -9,3 +7,3 @@ let account1;

beforeAll(async () => {
account1 = o1js_1.PrivateKey.random();
account1 = PrivateKey.random();
//if (proofsEnabled) await SegmentVerifier.compile();

@@ -15,3 +13,3 @@ });

const expectedCid = 'J1SEmUgGejuHTLMwcL5SwC9j9QA31ENRbyLA46FUyDFm';
const doc = await document_1.DocumentReference.init('tests/data/sampleprotocol.pdf', 'pdf');
const doc = await DocumentReference.init('tests/data/sampleprotocol.pdf', 'pdf');
expect(expectedCid).toEqual(doc.identifier.toString());

@@ -21,3 +19,3 @@ });

const expectedCid = 'J1SEmUgGejuHTLMwcL5SwC9j9QA31ENRbyLA46FUyDFm';
const doc = await document_1.DocumentReference.init('tests/data/sampleprotocol.pdf', 'pdf');
const doc = await DocumentReference.init('tests/data/sampleprotocol.pdf', 'pdf');
expect(doc.encryptedIdentifier).toEqual(undefined);

@@ -24,0 +22,0 @@ doc.encryptIdentifier(account1.toPublicKey());

{
"name": "@ozkarjs/vhir",
"version": "0.2.7",
"version": "0.2.8",
"author": "",
"main": "build/src/index.js",
"type": "module",
"devDependencies": {

@@ -8,0 +8,0 @@ "@babel/preset-env": "^7.16.4",

{
"compilerOptions": {
"target": "es2021",
"module": "commonjs",
"target": "es2020",
"module": "es2022",
"lib": ["dom", "esnext"],

@@ -9,6 +9,5 @@ "outDir": "./build",

"strict": true,
"strictPropertyInitialization": false,
"strictPropertyInitialization": false, // to enable generic constructors, e.g. on CircuitValue
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"esModuleInterop": true,

@@ -25,2 +24,2 @@ "moduleResolution": "node",

"include": ["./src", "tests/document.test.ts", "tests/consent.test.ts"]
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc