webcrypto-core
Advanced tools
Comparing version 1.7.2 to 1.7.3
@@ -5,3 +5,3 @@ /*! | ||
import { Convert, BufferSourceConverter } from 'pvtsutils'; | ||
import { Convert, BufferSourceConverter, combine } from 'pvtsutils'; | ||
export { BufferSourceConverter } from 'pvtsutils'; | ||
@@ -700,5 +700,5 @@ import { AsnProp, AsnPropTypes, AsnType, AsnTypeTypes, AsnIntegerConverter, AsnSerializer, AsnConvert } from '@peculiar/asn1-schema'; | ||
const valueHex = new Uint8Array(value)[0] > 127 | ||
? Buffer.concat([Buffer.from([0]), Buffer.from(value)]) | ||
: Buffer.from(value); | ||
return new asn1.Integer({ valueHex: new Uint8Array(valueHex).buffer }); | ||
? combine(new Uint8Array([0]).buffer, value) | ||
: value; | ||
return new asn1.Integer({ valueHex }); | ||
}, | ||
@@ -810,7 +810,3 @@ }; | ||
const y = Convert.FromBase64Url(json.y); | ||
const value = Buffer.concat([ | ||
new Uint8Array([0x04]), | ||
new Uint8Array(x), | ||
new Uint8Array(y), | ||
]); | ||
const value = combine(new Uint8Array([0x04]).buffer, x, y); | ||
this.value = new Uint8Array(value).buffer; | ||
@@ -1309,3 +1305,6 @@ return this; | ||
randomUUID() { | ||
const uuid = Convert.ToHex(this.getRandomValues(new Uint8Array(16))).toLowerCase(); | ||
const b = this.getRandomValues(new Uint8Array(16)); | ||
b[6] = (b[6] & 0x0f) | 0x40; | ||
b[8] = (b[8] & 0x3f) | 0x80; | ||
const uuid = Convert.ToHex(b).toLowerCase(); | ||
return `${uuid.substring(0, 8)}-${uuid.substring(8, 12)}-${uuid.substring(12, 16)}-${uuid.substring(16)}`; | ||
@@ -1312,0 +1311,0 @@ } |
@@ -722,5 +722,5 @@ /*! | ||
const valueHex = new Uint8Array(value)[0] > 127 | ||
? Buffer.concat([Buffer.from([0]), Buffer.from(value)]) | ||
: Buffer.from(value); | ||
return new asn1__namespace.Integer({ valueHex: new Uint8Array(valueHex).buffer }); | ||
? pvtsutils.combine(new Uint8Array([0]).buffer, value) | ||
: value; | ||
return new asn1__namespace.Integer({ valueHex }); | ||
}, | ||
@@ -832,7 +832,3 @@ }; | ||
const y = pvtsutils.Convert.FromBase64Url(json.y); | ||
const value = Buffer.concat([ | ||
new Uint8Array([0x04]), | ||
new Uint8Array(x), | ||
new Uint8Array(y), | ||
]); | ||
const value = pvtsutils.combine(new Uint8Array([0x04]).buffer, x, y); | ||
this.value = new Uint8Array(value).buffer; | ||
@@ -1331,3 +1327,6 @@ return this; | ||
randomUUID() { | ||
const uuid = pvtsutils.Convert.ToHex(this.getRandomValues(new Uint8Array(16))).toLowerCase(); | ||
const b = this.getRandomValues(new Uint8Array(16)); | ||
b[6] = (b[6] & 0x0f) | 0x40; | ||
b[8] = (b[8] & 0x3f) | 0x80; | ||
const uuid = pvtsutils.Convert.ToHex(b).toLowerCase(); | ||
return `${uuid.substring(0, 8)}-${uuid.substring(8, 12)}-${uuid.substring(12, 16)}-${uuid.substring(16)}`; | ||
@@ -1334,0 +1333,0 @@ } |
{ | ||
"name": "webcrypto-core", | ||
"version": "1.7.2", | ||
"version": "1.7.3", | ||
"description": "Common layer to be used by crypto libraries based on WebCrypto API for input validation.", | ||
@@ -5,0 +5,0 @@ "main": "build/webcrypto-core.js", |
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
163017
3935