key-did-resolver
Advanced tools
Comparing version 2.0.6 to 2.1.0-rc.0
interface BigIntPoint { | ||
x: BigInt; | ||
y: BigInt; | ||
x: bigint; | ||
y: bigint; | ||
} | ||
@@ -5,0 +5,0 @@ interface base64urlPoint { |
@@ -53,10 +53,11 @@ import * as u8a from 'uint8arrays'; | ||
} | ||
if (typeof ecpoint !== "object") { | ||
throw new TypeError("Input must be an object with properties x and y"); | ||
if (typeof ecpoint !== 'object') { | ||
throw new TypeError('Input must be an object with properties x and y'); | ||
} | ||
if (!Object.prototype.hasOwnProperty.call(ecpoint, "x") || !Object.prototype.hasOwnProperty.call(ecpoint, "y")) { | ||
throw new Error("Input must have properties x and y"); | ||
if (!Object.prototype.hasOwnProperty.call(ecpoint, 'x') || | ||
!Object.prototype.hasOwnProperty.call(ecpoint, 'y')) { | ||
throw new Error('Input must have properties x and y'); | ||
} | ||
if (typeof ecpoint.x !== "bigint" && typeof ecpoint.y !== "bigint") { | ||
throw new Error("Input coordinates must be BigInt"); | ||
if (typeof ecpoint.x !== 'bigint' && typeof ecpoint.y !== 'bigint') { | ||
throw new Error('Input coordinates must be BigInt'); | ||
} | ||
@@ -72,13 +73,14 @@ const u8aOctetPoint = publicKeyIntToUint8ArrayPointPair(ecpoint); | ||
} | ||
if (typeof ecpoint !== "object") { | ||
throw new TypeError("Input must be an object with properties x and y"); | ||
if (typeof ecpoint !== 'object') { | ||
throw new TypeError('Input must be an object with properties x and y'); | ||
} | ||
if (!Object.prototype.hasOwnProperty.call(ecpoint, "x") || !Object.prototype.hasOwnProperty.call(ecpoint, "y")) { | ||
throw new Error("Input must have properties x and y"); | ||
if (!Object.prototype.hasOwnProperty.call(ecpoint, 'x') || | ||
!Object.prototype.hasOwnProperty.call(ecpoint, 'y')) { | ||
throw new Error('Input must have properties x and y'); | ||
} | ||
if (typeof ecpoint.x !== "bigint" && typeof ecpoint.y !== "bigint") { | ||
throw new Error("Input coordinates must be BigInt"); | ||
if (typeof ecpoint.x !== 'bigint' && typeof ecpoint.y !== 'bigint') { | ||
throw new Error('Input coordinates must be BigInt'); | ||
} | ||
const xHex = (ecpoint.x).toString(); | ||
const yHex = (ecpoint.y).toString(); | ||
const xHex = ecpoint.x.toString(); | ||
const yHex = ecpoint.y.toString(); | ||
const xOctet = u8a.fromString(xHex, 'base10'); | ||
@@ -85,0 +87,0 @@ const yOctet = u8a.fromString(yHex, 'base10'); |
interface BigIntPoint { | ||
x: BigInt; | ||
y: BigInt; | ||
x: bigint; | ||
y: bigint; | ||
} | ||
@@ -5,0 +5,0 @@ interface base64urlPoint { |
import * as u8a from 'uint8arrays'; | ||
import * as bigintModArith from './bigint-mod-arith.js'; | ||
import * as bigintModArith from 'bigint-mod-arith'; | ||
import * as nist_weierstrass_common from './nist_weierstrass_common.js'; | ||
@@ -10,3 +10,4 @@ export function keyToDidDoc(pubKeyBytes, fingerprint) { | ||
id: did, | ||
verificationMethod: [{ | ||
verificationMethod: [ | ||
{ | ||
id: keyId, | ||
@@ -16,8 +17,9 @@ type: 'JsonWebKey2020', | ||
publicKeyJwk: { | ||
kty: "EC", | ||
crv: "P-256", | ||
kty: 'EC', | ||
crv: 'P-256', | ||
x: key.xm, | ||
y: key.ym, | ||
}, | ||
}], | ||
}, | ||
], | ||
authentication: [keyId], | ||
@@ -34,3 +36,3 @@ assertionMethod: [keyId], | ||
const two = BigInt(2); | ||
const prime = (two ** 256n) - (two ** 224n) + (two ** 192n) + (two ** 96n) - 1n; | ||
const prime = two ** 256n - two ** 224n + two ** 192n + two ** 96n - 1n; | ||
const b = 41058363725152142129326129780047268409114441015993725554835256314039467401291n; | ||
@@ -48,3 +50,3 @@ const pIdent = (prime + 1n) / 4n; | ||
x: xBig, | ||
y: yBig | ||
y: yBig, | ||
}; | ||
@@ -51,0 +53,0 @@ } |
interface BigIntPoint { | ||
x: BigInt; | ||
y: BigInt; | ||
x: bigint; | ||
y: bigint; | ||
} | ||
@@ -5,0 +5,0 @@ interface base64urlPoint { |
import * as u8a from 'uint8arrays'; | ||
import * as bigintModArith from './bigint-mod-arith.js'; | ||
import * as bigintModArith from 'bigint-mod-arith'; | ||
import * as nist_weierstrass_common from './nist_weierstrass_common.js'; | ||
@@ -10,3 +10,4 @@ export function keyToDidDoc(pubKeyBytes, fingerprint) { | ||
id: did, | ||
verificationMethod: [{ | ||
verificationMethod: [ | ||
{ | ||
id: keyId, | ||
@@ -16,8 +17,9 @@ type: 'JsonWebKey2020', | ||
publicKeyJwk: { | ||
kty: "EC", | ||
crv: "P-384", | ||
kty: 'EC', | ||
crv: 'P-384', | ||
x: key.xm, | ||
y: key.ym, | ||
}, | ||
}], | ||
}, | ||
], | ||
authentication: [keyId], | ||
@@ -34,3 +36,3 @@ assertionMethod: [keyId], | ||
const two = BigInt(2); | ||
const prime = (two ** 384n) - (two ** 128n) - (two ** 96n) + (two ** 32n) - 1n; | ||
const prime = two ** 384n - two ** 128n - two ** 96n + two ** 32n - 1n; | ||
const b = 27580193559959705877849011840389048093056905856361568521428707301988689241309860865136260764883745107765439761230575n; | ||
@@ -48,3 +50,3 @@ const pIdent = (prime + 1n) / 4n; | ||
x: xBig, | ||
y: yBig | ||
y: yBig, | ||
}; | ||
@@ -51,0 +53,0 @@ } |
interface BigIntPoint { | ||
x: BigInt; | ||
y: BigInt; | ||
x: bigint; | ||
y: bigint; | ||
} | ||
@@ -5,0 +5,0 @@ interface base64urlPoint { |
import * as u8a from 'uint8arrays'; | ||
import * as bigintModArith from './bigint-mod-arith.js'; | ||
import * as bigintModArith from 'bigint-mod-arith'; | ||
import * as nist_weierstrass_common from './nist_weierstrass_common.js'; | ||
@@ -10,3 +10,4 @@ export function keyToDidDoc(pubKeyBytes, fingerprint) { | ||
id: did, | ||
verificationMethod: [{ | ||
verificationMethod: [ | ||
{ | ||
id: keyId, | ||
@@ -16,8 +17,9 @@ type: 'JsonWebKey2020', | ||
publicKeyJwk: { | ||
kty: "EC", | ||
crv: "P-521", | ||
kty: 'EC', | ||
crv: 'P-521', | ||
x: key.xm, | ||
y: key.ym, | ||
}, | ||
}], | ||
}, | ||
], | ||
authentication: [keyId], | ||
@@ -34,3 +36,3 @@ assertionMethod: [keyId], | ||
const two = BigInt(2); | ||
const prime = (two ** 521n) - 1n; | ||
const prime = two ** 521n - 1n; | ||
const b = 1093849038073734274511112390766805569936207598951683748994586394495953116150735016013708737573759623248592132296706313309438452531591012912142327488478985984n; | ||
@@ -48,3 +50,3 @@ const pIdent = (prime + 1n) / 4n; | ||
x: xBig, | ||
y: yBig | ||
y: yBig, | ||
}; | ||
@@ -57,3 +59,3 @@ } | ||
const publicKeyHex = nist_weierstrass_common.pubKeyBytesToHex(pubKeyBytes); | ||
if ((132 <= publicKeyHex.length) && (publicKeyHex.length <= 134)) { | ||
if (132 <= publicKeyHex.length && publicKeyHex.length <= 134) { | ||
if (publicKeyHex.slice(0, 2) == '03' || publicKeyHex.slice(0, 2) == '02') { | ||
@@ -60,0 +62,0 @@ const publicKey = u8a.fromString(publicKeyHex, 'base16'); |
{ | ||
"name": "key-did-resolver", | ||
"version": "2.0.6", | ||
"version": "2.1.0-rc.0", | ||
"description": "Ceramic did:key method resolver", | ||
@@ -37,2 +37,3 @@ "keywords": [ | ||
"@stablelib/ed25519": "^1.0.2", | ||
"bigint-mod-arith": "^3.1.0", | ||
"multiformats": "^9.5.2", | ||
@@ -46,3 +47,3 @@ "uint8arrays": "^3.0.0", | ||
}, | ||
"gitHead": "ac2f7715a2e9966a0dad9a0e1dd93406344e8645" | ||
"gitHead": "d4b6fd134bcc4a36e7db59f8a6b4f2eb6a832e82" | ||
} |
@@ -264,4 +264,4 @@ # did:key method resolver | ||
## Contributing | ||
We are happy to accept small and large contributions. Make sure to check out the [Ceramic specifications](https://github.com/ceramicnetwork/specs) for details of how the protocol works. | ||
We are happy to accept small and large contributions. Make sure to check out the [Ceramic specifications](https://github.com/ceramicnetwork/ceramic/blob/main/SPECIFICATION.md) for details of how the protocol works. | ||
## License |
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
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
47115
5
30
469
2
+ Addedbigint-mod-arith@^3.1.0
+ Addedbigint-mod-arith@3.3.1(transitive)