chore: update to version 14.0.11 and align website URLs

This commit is contained in:
2026-01-11 11:34:13 +03:00
parent ef74383349
commit 19c8d69bd8
1499 changed files with 53633 additions and 89 deletions
+1
View File
@@ -0,0 +1 @@
export declare function ed25519DeriveHard(seed: Uint8Array, chainCode: Uint8Array): Uint8Array;
@@ -0,0 +1,9 @@
import { compactAddLength, isU8a, stringToU8a, u8aConcat } from '@pezkuwi/util';
import { blake2AsU8a } from '../blake2/asU8a.js';
const HDKD = compactAddLength(stringToU8a('Ed25519HDKD'));
export function ed25519DeriveHard(seed, chainCode) {
if (!isU8a(chainCode) || chainCode.length !== 32) {
throw new Error('Invalid chainCode passed to derive');
}
return blake2AsU8a(u8aConcat(HDKD, seed, chainCode));
}
+10
View File
@@ -0,0 +1,10 @@
/**
* @summary Implements ed25519 operations
*/
export { ed25519DeriveHard } from './deriveHard.js';
export { ed25519PairFromRandom } from './pair/fromRandom.js';
export { ed25519PairFromSecret } from './pair/fromSecret.js';
export { ed25519PairFromSeed } from './pair/fromSeed.js';
export { ed25519PairFromString } from './pair/fromString.js';
export { ed25519Sign } from './sign.js';
export { ed25519Verify } from './verify.js';
+10
View File
@@ -0,0 +1,10 @@
/**
* @summary Implements ed25519 operations
*/
export { ed25519DeriveHard } from './deriveHard.js';
export { ed25519PairFromRandom } from './pair/fromRandom.js';
export { ed25519PairFromSecret } from './pair/fromSecret.js';
export { ed25519PairFromSeed } from './pair/fromSeed.js';
export { ed25519PairFromString } from './pair/fromString.js';
export { ed25519Sign } from './sign.js';
export { ed25519Verify } from './verify.js';
+16
View File
@@ -0,0 +1,16 @@
import type { Keypair } from '../../types.js';
/**
* @name ed25519PairFromRandom
* @summary Creates a new public/secret keypair.
* @description
* Returns a new generate object containing a `publicKey` & `secretKey`.
* @example
* <BR>
*
* ```javascript
* import { ed25519PairFromRandom } from '@pezkuwi/util-crypto';
*
* ed25519PairFromRandom(); // => { secretKey: [...], publicKey: [...] }
* ```
*/
export declare function ed25519PairFromRandom(): Keypair;
@@ -0,0 +1,19 @@
import { randomAsU8a } from '../../random/index.js';
import { ed25519PairFromSeed } from './fromSeed.js';
/**
* @name ed25519PairFromRandom
* @summary Creates a new public/secret keypair.
* @description
* Returns a new generate object containing a `publicKey` & `secretKey`.
* @example
* <BR>
*
* ```javascript
* import { ed25519PairFromRandom } from '@pezkuwi/util-crypto';
*
* ed25519PairFromRandom(); // => { secretKey: [...], publicKey: [...] }
* ```
*/
export function ed25519PairFromRandom() {
return ed25519PairFromSeed(randomAsU8a());
}
+16
View File
@@ -0,0 +1,16 @@
import type { Keypair } from '../../types.js';
/**
* @name ed25519PairFromSecret
* @summary Creates a new public/secret keypair from a secret.
* @description
* Returns a object containing a `publicKey` & `secretKey` generated from the supplied secret.
* @example
* <BR>
*
* ```javascript
* import { ed25519PairFromSecret } from '@pezkuwi/util-crypto';
*
* ed25519PairFromSecret(...); // => { secretKey: [...], publicKey: [...] }
* ```
*/
export declare function ed25519PairFromSecret(secretKey: Uint8Array): Keypair;
@@ -0,0 +1,23 @@
/**
* @name ed25519PairFromSecret
* @summary Creates a new public/secret keypair from a secret.
* @description
* Returns a object containing a `publicKey` & `secretKey` generated from the supplied secret.
* @example
* <BR>
*
* ```javascript
* import { ed25519PairFromSecret } from '@pezkuwi/util-crypto';
*
* ed25519PairFromSecret(...); // => { secretKey: [...], publicKey: [...] }
* ```
*/
export function ed25519PairFromSecret(secretKey) {
if (secretKey.length !== 64) {
throw new Error('Invalid secretKey provided');
}
return {
publicKey: secretKey.slice(32),
secretKey
};
}
+16
View File
@@ -0,0 +1,16 @@
import type { Keypair } from '../../types.js';
/**
* @name ed25519PairFromSeed
* @summary Creates a new public/secret keypair from a seed.
* @description
* Returns a object containing a `publicKey` & `secretKey` generated from the supplied seed.
* @example
* <BR>
*
* ```javascript
* import { ed25519PairFromSeed } from '@pezkuwi/util-crypto';
*
* ed25519PairFromSeed(...); // => { secretKey: [...], publicKey: [...] }
* ```
*/
export declare function ed25519PairFromSeed(seed: Uint8Array, onlyJs?: boolean): Keypair;
@@ -0,0 +1,31 @@
import { ed25519 } from '@noble/curves/ed25519';
import { hasBigInt, u8aConcatStrict } from '@pezkuwi/util';
import { ed25519KeypairFromSeed, isReady } from '@pezkuwi/wasm-crypto';
/**
* @name ed25519PairFromSeed
* @summary Creates a new public/secret keypair from a seed.
* @description
* Returns a object containing a `publicKey` & `secretKey` generated from the supplied seed.
* @example
* <BR>
*
* ```javascript
* import { ed25519PairFromSeed } from '@pezkuwi/util-crypto';
*
* ed25519PairFromSeed(...); // => { secretKey: [...], publicKey: [...] }
* ```
*/
export function ed25519PairFromSeed(seed, onlyJs) {
if (!hasBigInt || (!onlyJs && isReady())) {
const full = ed25519KeypairFromSeed(seed);
return {
publicKey: full.slice(32),
secretKey: full.slice(0, 64)
};
}
const publicKey = ed25519.getPublicKey(seed);
return {
publicKey,
secretKey: u8aConcatStrict([seed, publicKey])
};
}
+16
View File
@@ -0,0 +1,16 @@
import type { Keypair } from '../../types.js';
/**
* @name ed25519PairFromString
* @summary Creates a new public/secret keypair from a string.
* @description
* Returns a object containing a `publicKey` & `secretKey` generated from the supplied string. The string is hashed and the value used as the input seed.
* @example
* <BR>
*
* ```javascript
* import { ed25519PairFromString } from '@pezkuwi/util-crypto';
*
* ed25519PairFromString('test'); // => { secretKey: [...], publicKey: [...] }
* ```
*/
export declare function ed25519PairFromString(value: string): Keypair;
@@ -0,0 +1,20 @@
import { stringToU8a } from '@pezkuwi/util';
import { blake2AsU8a } from '../../blake2/asU8a.js';
import { ed25519PairFromSeed } from './fromSeed.js';
/**
* @name ed25519PairFromString
* @summary Creates a new public/secret keypair from a string.
* @description
* Returns a object containing a `publicKey` & `secretKey` generated from the supplied string. The string is hashed and the value used as the input seed.
* @example
* <BR>
*
* ```javascript
* import { ed25519PairFromString } from '@pezkuwi/util-crypto';
*
* ed25519PairFromString('test'); // => { secretKey: [...], publicKey: [...] }
* ```
*/
export function ed25519PairFromString(value) {
return ed25519PairFromSeed(blake2AsU8a(stringToU8a(value)));
}
+16
View File
@@ -0,0 +1,16 @@
import type { Keypair } from '../types.js';
/**
* @name ed25519Sign
* @summary Signs a message using the supplied secretKey
* @description
* Returns message signature of `message`, using the `secretKey`.
* @example
* <BR>
*
* ```javascript
* import { ed25519Sign } from '@pezkuwi/util-crypto';
*
* ed25519Sign([...], [...]); // => [...]
* ```
*/
export declare function ed25519Sign(message: string | Uint8Array, { publicKey, secretKey }: Partial<Keypair>, onlyJs?: boolean): Uint8Array;
+30
View File
@@ -0,0 +1,30 @@
import { ed25519 } from '@noble/curves/ed25519';
import { hasBigInt, u8aToU8a } from '@pezkuwi/util';
import { ed25519Sign as wasmSign, isReady } from '@pezkuwi/wasm-crypto';
/**
* @name ed25519Sign
* @summary Signs a message using the supplied secretKey
* @description
* Returns message signature of `message`, using the `secretKey`.
* @example
* <BR>
*
* ```javascript
* import { ed25519Sign } from '@pezkuwi/util-crypto';
*
* ed25519Sign([...], [...]); // => [...]
* ```
*/
export function ed25519Sign(message, { publicKey, secretKey }, onlyJs) {
if (!secretKey) {
throw new Error('Expected a valid secretKey');
}
else if (!publicKey) {
throw new Error('Expected a valid publicKey');
}
const messageU8a = u8aToU8a(message);
const privateU8a = secretKey.subarray(0, 32);
return !hasBigInt || (!onlyJs && isReady())
? wasmSign(publicKey, privateU8a, messageU8a)
: ed25519.sign(messageU8a, privateU8a);
}
+15
View File
@@ -0,0 +1,15 @@
/**
* @name ed25519Sign
* @summary Verifies the signature on the supplied message.
* @description
* Verifies the `signature` on `message` with the supplied `publicKey`. Returns `true` on sucess, `false` otherwise.
* @example
* <BR>
*
* ```javascript
* import { ed25519Verify } from '@pezkuwi/util-crypto';
*
* ed25519Verify([...], [...], [...]); // => true/false
* ```
*/
export declare function ed25519Verify(message: string | Uint8Array, signature: string | Uint8Array, publicKey: string | Uint8Array, onlyJs?: boolean): boolean;
+36
View File
@@ -0,0 +1,36 @@
import { ed25519 } from '@noble/curves/ed25519';
import { hasBigInt, u8aToU8a } from '@pezkuwi/util';
import { ed25519Verify as wasmVerify, isReady } from '@pezkuwi/wasm-crypto';
/**
* @name ed25519Sign
* @summary Verifies the signature on the supplied message.
* @description
* Verifies the `signature` on `message` with the supplied `publicKey`. Returns `true` on sucess, `false` otherwise.
* @example
* <BR>
*
* ```javascript
* import { ed25519Verify } from '@pezkuwi/util-crypto';
*
* ed25519Verify([...], [...], [...]); // => true/false
* ```
*/
export function ed25519Verify(message, signature, publicKey, onlyJs) {
const messageU8a = u8aToU8a(message);
const publicKeyU8a = u8aToU8a(publicKey);
const signatureU8a = u8aToU8a(signature);
if (publicKeyU8a.length !== 32) {
throw new Error(`Invalid publicKey, received ${publicKeyU8a.length}, expected 32`);
}
else if (signatureU8a.length !== 64) {
throw new Error(`Invalid signature, received ${signatureU8a.length} bytes, expected 64`);
}
try {
return !hasBigInt || (!onlyJs && isReady())
? wasmVerify(signatureU8a, messageU8a, publicKeyU8a)
: ed25519.verify(signatureU8a, messageU8a, publicKeyU8a);
}
catch {
return false;
}
}