@dfinity/agent
Advanced tools
Comparing version 0.14.0 to 0.14.1
@@ -154,17 +154,15 @@ "use strict"; | ||
}); | ||
if (this._canisterId.compareTo(principal_1.Principal.managementCanister()) !== 'eq') { | ||
const rangeLookup = cert.lookup(['subnet', d.subnet_id, 'canister_ranges']); | ||
if (!rangeLookup) { | ||
throw new CertificateVerificationError(`Could not find canister ranges for subnet 0x${(0, buffer_1.toHex)(d.subnet_id)}`); | ||
} | ||
const ranges_arr = cbor.decode(rangeLookup); | ||
const ranges = ranges_arr.map(v => [ | ||
principal_1.Principal.fromUint8Array(v[0]), | ||
principal_1.Principal.fromUint8Array(v[1]), | ||
]); | ||
const canisterInRange = ranges.some(r => r[0].ltEq(this._canisterId) && r[1].gtEq(this._canisterId)); | ||
if (!canisterInRange) { | ||
throw new CertificateVerificationError(`Canister ${this._canisterId} not in range of delegations for subnet 0x${(0, buffer_1.toHex)(d.subnet_id)}`); | ||
} | ||
const rangeLookup = cert.lookup(['subnet', d.subnet_id, 'canister_ranges']); | ||
if (!rangeLookup) { | ||
throw new CertificateVerificationError(`Could not find canister ranges for subnet 0x${(0, buffer_1.toHex)(d.subnet_id)}`); | ||
} | ||
const ranges_arr = cbor.decode(rangeLookup); | ||
const ranges = ranges_arr.map(v => [ | ||
principal_1.Principal.fromUint8Array(v[0]), | ||
principal_1.Principal.fromUint8Array(v[1]), | ||
]); | ||
const canisterInRange = ranges.some(r => r[0].ltEq(this._canisterId) && r[1].gtEq(this._canisterId)); | ||
if (!canisterInRange) { | ||
throw new CertificateVerificationError(`Canister ${this._canisterId} not in range of delegations for subnet 0x${(0, buffer_1.toHex)(d.subnet_id)}`); | ||
} | ||
const publicKeyLookup = cert.lookup(['subnet', d.subnet_id, 'public_key']); | ||
@@ -171,0 +169,0 @@ if (!publicKeyLookup) { |
@@ -126,17 +126,15 @@ import * as cbor from './cbor'; | ||
}); | ||
if (this._canisterId.compareTo(Principal.managementCanister()) !== 'eq') { | ||
const rangeLookup = cert.lookup(['subnet', d.subnet_id, 'canister_ranges']); | ||
if (!rangeLookup) { | ||
throw new CertificateVerificationError(`Could not find canister ranges for subnet 0x${toHex(d.subnet_id)}`); | ||
} | ||
const ranges_arr = cbor.decode(rangeLookup); | ||
const ranges = ranges_arr.map(v => [ | ||
Principal.fromUint8Array(v[0]), | ||
Principal.fromUint8Array(v[1]), | ||
]); | ||
const canisterInRange = ranges.some(r => r[0].ltEq(this._canisterId) && r[1].gtEq(this._canisterId)); | ||
if (!canisterInRange) { | ||
throw new CertificateVerificationError(`Canister ${this._canisterId} not in range of delegations for subnet 0x${toHex(d.subnet_id)}`); | ||
} | ||
const rangeLookup = cert.lookup(['subnet', d.subnet_id, 'canister_ranges']); | ||
if (!rangeLookup) { | ||
throw new CertificateVerificationError(`Could not find canister ranges for subnet 0x${toHex(d.subnet_id)}`); | ||
} | ||
const ranges_arr = cbor.decode(rangeLookup); | ||
const ranges = ranges_arr.map(v => [ | ||
Principal.fromUint8Array(v[0]), | ||
Principal.fromUint8Array(v[1]), | ||
]); | ||
const canisterInRange = ranges.some(r => r[0].ltEq(this._canisterId) && r[1].gtEq(this._canisterId)); | ||
if (!canisterInRange) { | ||
throw new CertificateVerificationError(`Canister ${this._canisterId} not in range of delegations for subnet 0x${toHex(d.subnet_id)}`); | ||
} | ||
const publicKeyLookup = cert.lookup(['subnet', d.subnet_id, 'public_key']); | ||
@@ -143,0 +141,0 @@ if (!publicKeyLookup) { |
{ | ||
"name": "@dfinity/agent", | ||
"version": "0.14.0", | ||
"version": "0.14.1", | ||
"author": "DFINITY Stiftung <sdk@dfinity.org>", | ||
@@ -37,2 +37,3 @@ "license": "Apache-2.0", | ||
"module": "./lib/esm/index", | ||
"unpkg": "./lib/esm/index", | ||
"scripts": { | ||
@@ -53,4 +54,4 @@ "build": "tsc -b && tsc -p tsconfig-cjs.json", | ||
"peerDependencies": { | ||
"@dfinity/candid": "^0.14.0", | ||
"@dfinity/principal": "^0.14.0" | ||
"@dfinity/candid": "^0.14.1", | ||
"@dfinity/principal": "^0.14.1" | ||
}, | ||
@@ -57,0 +58,0 @@ "dependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1035609
7605