@dfinity/assets
Advanced tools
Comparing version 1.3.0 to 1.4.0
@@ -386,3 +386,7 @@ "use strict"; | ||
// Check certificate time | ||
const decodedTime = (0, candid_1.lebDecode)(new buffer_1.PipeArrayBuffer(cert.lookup(['time']))); | ||
const timeLookup = cert.lookup(['time']); | ||
if (timeLookup.status !== agent_1.LookupStatus.Found || !(timeLookup.value instanceof ArrayBuffer)) { | ||
return false; | ||
} | ||
const decodedTime = (0, candid_1.lebDecode)(new buffer_1.PipeArrayBuffer(timeLookup.value)); | ||
const certTime = Number(decodedTime / BigInt(1000000)); // Convert from nanos to millis | ||
@@ -397,3 +401,3 @@ const now = Date.now(); | ||
const witness = cert.lookup(['canister', canisterId.toUint8Array(), 'certified_data']); | ||
if (!witness) { | ||
if (witness.status !== agent_1.LookupStatus.Found || !(witness.value instanceof ArrayBuffer)) { | ||
// Could not find certified data for this canister in the certificate | ||
@@ -403,3 +407,3 @@ return false; | ||
// First validate that the Tree is as good as the certification | ||
if ((0, agent_1.compare)(witness, reconstructed) !== 0) { | ||
if ((0, agent_1.compare)(witness.value, reconstructed) !== 0) { | ||
// Witness != Tree passed in ic-certification | ||
@@ -406,0 +410,0 @@ return false; |
@@ -12,3 +12,3 @@ var __rest = (this && this.__rest) || function (s, e) { | ||
}; | ||
import { Actor, Cbor as cbor, Certificate, compare, getDefaultAgent, lookup_path, lookupResultToBuffer, reconstruct, uint8ToBuf, } from '@dfinity/agent'; | ||
import { Actor, Cbor as cbor, Certificate, compare, getDefaultAgent, lookup_path, lookupResultToBuffer, LookupStatus, reconstruct, uint8ToBuf, } from '@dfinity/agent'; | ||
import { lebDecode } from '@dfinity/candid'; | ||
@@ -357,3 +357,7 @@ import { PipeArrayBuffer } from '@dfinity/candid/lib/cjs/utils/buffer'; | ||
// Check certificate time | ||
const decodedTime = lebDecode(new PipeArrayBuffer(cert.lookup(['time']))); | ||
const timeLookup = cert.lookup(['time']); | ||
if (timeLookup.status !== LookupStatus.Found || !(timeLookup.value instanceof ArrayBuffer)) { | ||
return false; | ||
} | ||
const decodedTime = lebDecode(new PipeArrayBuffer(timeLookup.value)); | ||
const certTime = Number(decodedTime / BigInt(1000000)); // Convert from nanos to millis | ||
@@ -368,3 +372,3 @@ const now = Date.now(); | ||
const witness = cert.lookup(['canister', canisterId.toUint8Array(), 'certified_data']); | ||
if (!witness) { | ||
if (witness.status !== LookupStatus.Found || !(witness.value instanceof ArrayBuffer)) { | ||
// Could not find certified data for this canister in the certificate | ||
@@ -374,3 +378,3 @@ return false; | ||
// First validate that the Tree is as good as the certification | ||
if (compare(witness, reconstructed) !== 0) { | ||
if (compare(witness.value, reconstructed) !== 0) { | ||
// Witness != Tree passed in ic-certification | ||
@@ -377,0 +381,0 @@ return false; |
{ | ||
"name": "@dfinity/assets", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"author": "DFINITY Stiftung <sdk@dfinity.org>", | ||
@@ -52,4 +52,4 @@ "license": "Apache-2.0", | ||
"peerDependencies": { | ||
"@dfinity/agent": "^1.3.0", | ||
"@dfinity/principal": "^1.3.0", | ||
"@dfinity/agent": "^1.4.0", | ||
"@dfinity/principal": "^1.4.0", | ||
"@noble/hashes": "^1.3.1" | ||
@@ -56,0 +56,0 @@ }, |
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
321044
2308