@dfinity/agent
Advanced tools
Comparing version 0.6.23 to 0.6.24-authentication.0
{ | ||
"name": "@dfinity/agent", | ||
"version": "0.6.23", | ||
"version": "0.6.24-authentication.0", | ||
"main": "src/index.js", | ||
@@ -19,2 +19,3 @@ "scripts": { | ||
"base32.js": "^0.1.0", | ||
"base64-arraybuffer": "^0.2.0", | ||
"bignumber.js": "^9.0.0", | ||
@@ -39,3 +40,4 @@ "borc": "^2.1.1", | ||
"whatwg-fetch": "^3.0.0" | ||
} | ||
}, | ||
"gitHead": "fed615f9663216037e55d69a3257306e59ec051a" | ||
} |
@@ -1,2 +0,2 @@ | ||
import { ActorFactory, BinaryBlob, CallFields, JsonObject, Principal, QueryFields, QueryResponse, ReadStateFields, ReadStateResponse, SubmitResponse } from '@dfinity/agent'; | ||
import { ActorFactory, BinaryBlob, CallFields, JsonObject, Principal, QueryFields, QueryResponse, ReadStateFields, ReadStateResponse, SubmitResponse } from '..'; | ||
import * as IDL from '../idl'; | ||
@@ -3,0 +3,0 @@ import { Agent } from './api'; |
@@ -23,3 +23,3 @@ "use strict"; | ||
exports.ProxyAgent = exports.ProxyStubAgent = exports.ProxyMessageKind = void 0; | ||
const agent_1 = require("@dfinity/agent"); | ||
const __1 = require(".."); | ||
const actor = __importStar(require("../actor")); | ||
@@ -132,3 +132,3 @@ var ProxyMessageKind; | ||
if (typeof principalOrNull === 'string') { | ||
return agent_1.Principal.fromText(principalOrNull); | ||
return __1.Principal.fromText(principalOrNull); | ||
} | ||
@@ -135,0 +135,0 @@ else { |
@@ -51,3 +51,3 @@ "use strict"; | ||
const msg = buffer_1.Buffer.concat([domain_sep('ic-state-root'), rootHash]); | ||
const res = await bls_1.BLS.blsVerify(bufferToHex(key), bufferToHex(sig), bufferToHex(msg)); | ||
const res = await bls_1.blsVerify(key, sig, msg); | ||
this.verified = res; | ||
@@ -85,5 +85,2 @@ return res; | ||
} | ||
function bufferToHex(buf) { | ||
return buf.toString('hex'); | ||
} | ||
async function reconstruct(t) { | ||
@@ -90,0 +87,0 @@ switch (t[0]) { |
@@ -1,5 +0,2 @@ | ||
export declare class BLS { | ||
static blsVerify(pk: string, sig: string, msg: string): Promise<boolean>; | ||
private static verify; | ||
private constructor(); | ||
} | ||
export declare let verify: (pk: Uint8Array, sig: Uint8Array, msg: Uint8Array) => boolean; | ||
export declare function blsVerify(pk: Uint8Array, sig: Uint8Array, msg: Uint8Array): Promise<boolean>; |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (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.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.BLS = void 0; | ||
// tslint:disable-next-line:no-var-requires | ||
const BLSModule = require('./bls_gen'); | ||
class BLS { | ||
constructor() { } | ||
static async blsVerify(pk, sig, msg) { | ||
if (!BLS.verify) { | ||
const m = await BLSModule(); | ||
if (m._init() !== 0) { | ||
throw new Error('Cannot initialize BLS'); | ||
} | ||
BLS.verify = m.cwrap('verify', 'boolean', ['string', 'string', 'string']); | ||
exports.blsVerify = exports.verify = void 0; | ||
const bls_1 = __importStar(require("../vendor/bls/bls")); | ||
async function blsVerify(pk, sig, msg) { | ||
if (!exports.verify) { | ||
await bls_1.default(); | ||
if (bls_1.bls_init() !== 0) { | ||
throw new Error('Cannot initialize BLS'); | ||
} | ||
const res = BLS.verify(pk, sig, msg); | ||
return res; | ||
exports.verify = (pk1, sig1, msg1) => { | ||
// Reorder things from what the WASM expects (sig, m, w). | ||
return bls_1.bls_verify(sig1, msg1, pk1) === 0; | ||
}; | ||
} | ||
return exports.verify(pk, sig, msg); | ||
} | ||
exports.BLS = BLS; | ||
exports.blsVerify = blsVerify; | ||
//# sourceMappingURL=bls.js.map |
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
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
No License Found
License(Experimental) License information could not be found.
Found 1 instance in 1 package
266921
0
5720
1
1
11
+ Addedbase64-arraybuffer@^0.2.0
+ Addedbase64-arraybuffer@0.2.0(transitive)