@dfinity/identity
Advanced tools
Comparing version 0.10.3 to 0.10.4
@@ -44,3 +44,3 @@ "use strict"; | ||
} | ||
return buffer_1.fromHexString(value); | ||
return (0, buffer_1.fromHexString)(value); | ||
} | ||
@@ -69,3 +69,3 @@ /** | ||
// with an OID). After de-hex, if it's not obvious what it is, it's an ArrayBuffer. | ||
return Object.assign({ expiration: this.expiration.toString(16), pubkey: buffer_1.toHexString(this.pubkey) }, (this.targets && { targets: this.targets.map(p => p.toHex()) })); | ||
return Object.assign({ expiration: this.expiration.toString(16), pubkey: (0, buffer_1.toHexString)(this.pubkey) }, (this.targets && { targets: this.targets.map(p => p.toHex()) })); | ||
} | ||
@@ -92,3 +92,3 @@ } | ||
...domainSeparator, | ||
...new Uint8Array(agent_1.requestIdOf(delegation)), | ||
...new Uint8Array((0, agent_1.requestIdOf)(delegation)), | ||
]); | ||
@@ -192,9 +192,9 @@ const signature = await from.sign(challenge); | ||
return { | ||
delegation: Object.assign({ expiration: delegation.expiration.toString(16), pubkey: buffer_1.toHexString(delegation.pubkey) }, (targets && { | ||
delegation: Object.assign({ expiration: delegation.expiration.toString(16), pubkey: (0, buffer_1.toHexString)(delegation.pubkey) }, (targets && { | ||
targets: targets.map(t => t.toHex()), | ||
})), | ||
signature: buffer_1.toHexString(signature), | ||
signature: (0, buffer_1.toHexString)(signature), | ||
}; | ||
}), | ||
publicKey: buffer_1.toHexString(this.publicKey), | ||
publicKey: (0, buffer_1.toHexString)(this.publicKey), | ||
}; | ||
@@ -238,3 +238,3 @@ } | ||
const { body } = request, fields = __rest(request, ["body"]); | ||
const requestId = await agent_1.requestIdOf(body); | ||
const requestId = await (0, agent_1.requestIdOf)(body); | ||
return Object.assign(Object.assign({}, fields), { body: { | ||
@@ -241,0 +241,0 @@ content: body, |
@@ -77,3 +77,3 @@ "use strict"; | ||
const decodeLen = (buf, offset) => { | ||
const lenBytes = exports.decodeLenBytes(buf, offset); | ||
const lenBytes = (0, exports.decodeLenBytes)(buf, offset); | ||
if (lenBytes === 1) | ||
@@ -125,10 +125,10 @@ return buf[offset]; | ||
// The Bit String header needs to include the unused bit count byte in its length | ||
const bitStringHeaderLength = 2 + exports.encodeLenBytes(payload.byteLength + 1); | ||
const bitStringHeaderLength = 2 + (0, exports.encodeLenBytes)(payload.byteLength + 1); | ||
const len = oid.byteLength + bitStringHeaderLength + payload.byteLength; | ||
let offset = 0; | ||
const buf = new Uint8Array(1 + exports.encodeLenBytes(len) + len); | ||
const buf = new Uint8Array(1 + (0, exports.encodeLenBytes)(len) + len); | ||
// Sequence | ||
buf[offset++] = 0x30; | ||
// Sequence Length | ||
offset += exports.encodeLen(buf, offset, len); | ||
offset += (0, exports.encodeLen)(buf, offset, len); | ||
// OID | ||
@@ -139,3 +139,3 @@ buf.set(oid, offset); | ||
buf[offset++] = 0x03; | ||
offset += exports.encodeLen(buf, offset, payload.byteLength + 1); | ||
offset += (0, exports.encodeLen)(buf, offset, payload.byteLength + 1); | ||
// 0 padding | ||
@@ -165,4 +165,4 @@ buf[offset++] = 0x00; | ||
expect(0x30, 'sequence'); | ||
offset += exports.decodeLenBytes(buf, offset); | ||
if (!exports.bufEquals(buf.slice(offset, offset + oid.byteLength), oid)) { | ||
offset += (0, exports.decodeLenBytes)(buf, offset); | ||
if (!(0, exports.bufEquals)(buf.slice(offset, offset + oid.byteLength), oid)) { | ||
throw new Error('Not the expected OID.'); | ||
@@ -172,4 +172,4 @@ } | ||
expect(0x03, 'bit string'); | ||
const payloadLen = exports.decodeLen(buf, offset) - 1; // Subtracting 1 to account for the 0 padding | ||
offset += exports.decodeLenBytes(buf, offset); | ||
const payloadLen = (0, exports.decodeLen)(buf, offset) - 1; // Subtracting 1 to account for the 0 padding | ||
offset += (0, exports.decodeLenBytes)(buf, offset); | ||
expect(0x00, '0 padding'); | ||
@@ -176,0 +176,0 @@ const result = buf.slice(offset); |
@@ -43,6 +43,6 @@ "use strict"; | ||
static derEncode(publicKey) { | ||
return der_1.wrapDER(publicKey, der_1.ED25519_OID).buffer; | ||
return (0, der_1.wrapDER)(publicKey, der_1.ED25519_OID).buffer; | ||
} | ||
static derDecode(key) { | ||
const unwrapped = der_1.unwrapDER(key, der_1.ED25519_OID); | ||
const unwrapped = (0, der_1.unwrapDER)(key, der_1.ED25519_OID); | ||
if (unwrapped.length !== this.RAW_KEY_LENGTH) { | ||
@@ -79,3 +79,3 @@ throw new Error('An Ed25519 public key must be exactly 32bytes long'); | ||
const [publicKeyDer, privateKeyRaw] = obj; | ||
return new Ed25519KeyIdentity(Ed25519PublicKey.fromDer(buffer_1.fromHexString(publicKeyDer)), buffer_1.fromHexString(privateKeyRaw)); | ||
return new Ed25519KeyIdentity(Ed25519PublicKey.fromDer((0, buffer_1.fromHexString)(publicKeyDer)), (0, buffer_1.fromHexString)(privateKeyRaw)); | ||
} | ||
@@ -105,3 +105,3 @@ static fromJSON(json) { | ||
toJSON() { | ||
return [buffer_1.toHexString(this._publicKey.toDer()), buffer_1.toHexString(this._privateKey)]; | ||
return [(0, buffer_1.toHexString)(this._publicKey.toDer()), (0, buffer_1.toHexString)(this._privateKey)]; | ||
} | ||
@@ -108,0 +108,0 @@ /** |
@@ -35,6 +35,6 @@ "use strict"; | ||
static derEncode(publicKey) { | ||
return der_1.wrapDER(publicKey, der_1.SECP256K1_OID).buffer; | ||
return (0, der_1.wrapDER)(publicKey, der_1.SECP256K1_OID).buffer; | ||
} | ||
static derDecode(key) { | ||
return der_1.unwrapDER(key, der_1.SECP256K1_OID); | ||
return (0, der_1.unwrapDER)(key, der_1.SECP256K1_OID); | ||
} | ||
@@ -77,5 +77,5 @@ toDer() { | ||
else { | ||
privateKey = new Uint8Array(tweetnacl_1.randomBytes(32)); | ||
privateKey = new Uint8Array((0, tweetnacl_1.randomBytes)(32)); | ||
while (!secp256k1_1.default.privateKeyVerify(privateKey)) { | ||
privateKey = new Uint8Array(tweetnacl_1.randomBytes(32)); | ||
privateKey = new Uint8Array((0, tweetnacl_1.randomBytes)(32)); | ||
} | ||
@@ -89,3 +89,3 @@ } | ||
const [publicKeyRaw, privateKeyRaw] = obj; | ||
return new Secp256k1KeyIdentity(Secp256k1PublicKey.fromRaw(buffer_1.fromHexString(publicKeyRaw)), buffer_1.fromHexString(privateKeyRaw)); | ||
return new Secp256k1KeyIdentity(Secp256k1PublicKey.fromRaw((0, buffer_1.fromHexString)(publicKeyRaw)), (0, buffer_1.fromHexString)(privateKeyRaw)); | ||
} | ||
@@ -126,3 +126,3 @@ static fromJSON(json) { | ||
toJSON() { | ||
return [buffer_1.toHexString(this._publicKey.toRaw()), buffer_1.toHexString(this._privateKey)]; | ||
return [(0, buffer_1.toHexString)(this._publicKey.toRaw()), (0, buffer_1.toHexString)(this._privateKey)]; | ||
} | ||
@@ -129,0 +129,0 @@ /** |
@@ -32,3 +32,3 @@ "use strict"; | ||
function _coseToDerEncodedBlob(cose) { | ||
return der_1.wrapDER(cose, der_1.DER_COSE_OID).buffer; | ||
return (0, der_1.wrapDER)(cose, der_1.DER_COSE_OID).buffer; | ||
} | ||
@@ -143,3 +143,3 @@ /** | ||
} | ||
return new this(buffer_1.fromHexString(rawId), buffer_1.fromHexString(publicKey)); | ||
return new this((0, buffer_1.fromHexString)(rawId), (0, buffer_1.fromHexString)(publicKey)); | ||
} | ||
@@ -201,4 +201,4 @@ /** | ||
return { | ||
publicKey: buffer_1.toHexString(this._publicKey.getCose()), | ||
rawId: buffer_1.toHexString(this.rawId), | ||
publicKey: (0, buffer_1.toHexString)(this._publicKey.getCose()), | ||
rawId: (0, buffer_1.toHexString)(this.rawId), | ||
}; | ||
@@ -205,0 +205,0 @@ } |
{ | ||
"name": "@dfinity/identity", | ||
"version": "0.10.3", | ||
"version": "0.10.4", | ||
"author": "DFINITY Stiftung <sdk@dfinity.org>", | ||
@@ -39,4 +39,4 @@ "license": "Apache-2.0", | ||
"peerDependencies": { | ||
"@dfinity/agent": "^0.10.3", | ||
"@dfinity/principal": "^0.10.3" | ||
"@dfinity/agent": "^0.10.4", | ||
"@dfinity/principal": "^0.10.4" | ||
}, | ||
@@ -43,0 +43,0 @@ "dependencies": { |
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
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
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
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
208209
1