diff --git a/package.json b/package.json index 1a54def..2e4b2ab 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@nillion/nilql", - "version": "0.0.0-alpha.11", + "version": "0.0.0-alpha.12", "description": "Library for working with encrypted data within NilDB queries and replies.", "license": "MIT", "homepage": "https://github.com/nillionnetwork/nilql-ts", diff --git a/src/nilql.ts b/src/nilql.ts index 08e7adc..95a8cbd 100644 --- a/src/nilql.ts +++ b/src/nilql.ts @@ -864,8 +864,8 @@ async function decrypt( function allot(document: object): object[] { // Values and `null` are base cases. if ( - typeof document === "number" || typeof document === "boolean" || + typeof document === "number" || typeof document === "string" || document === null ) { @@ -975,7 +975,7 @@ function allot(document: object): object[] { } throw new TypeError( - "number, boolean, string, array, null, or object expected", + "boolean, number, string, array, null, or object expected", ); } diff --git a/tests/nilql.test.ts b/tests/nilql.test.ts index bd0721c..5a27a8f 100644 --- a/tests/nilql.test.ts +++ b/tests/nilql.test.ts @@ -979,13 +979,14 @@ describe("end-to-end workflows involving share allotment and unification", () => }); test("allotment and unification of objects with nested arrays of shares for a multi-node cluster", async () => { - const data: { [k: string]: object | null } = { + const data: { [k: string]: object | null | number } = { a: [1n, [2n, 3n]], b: [4n, [5n, 6n]], c: null, + d: 1.23, }; const secretKey = await nilql.SecretKey.generate(cluster, { store: true }); - const encrypted: { [k: string]: object | null } = {}; + const encrypted: { [k: string]: object | null | number } = {}; for (const key of ["a", "b"]) { encrypted[key] = { "%allot": [ @@ -1004,6 +1005,7 @@ describe("end-to-end workflows involving share allotment and unification", () => }; } encrypted.c = null; + encrypted.d = 1.23; const shares = nilql.allot(encrypted) as Array<{ [key: string]: string | object; }>;